ledger_model

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2021 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 配置角色的权限
	CONFIGURE_ROLES = LedgerPermission(0x01)
	// 授权用户角色
	AUTHORIZE_USER_ROLES = LedgerPermission(0x02)
	// 设置共识协议
	SET_CONSENSUS = LedgerPermission(0x03)
	// 设置密码体系
	SET_CRYPTO = LedgerPermission(0x04)
	// 注册参与方
	REGISTER_PARTICIPANT = LedgerPermission(0x05)
	// 注册用户
	REGISTER_USER = LedgerPermission(0x06)
	// 注册数据账户
	REGISTER_DATA_ACCOUNT = LedgerPermission(0x07)
	// 注册合约
	REGISTER_CONTRACT = LedgerPermission(0x08)
	// 升级合约
	UPGRADE_CONTRACT = LedgerPermission(0x14)
	// 设置用户属性
	SET_USER_ATTRIBUTES = LedgerPermission(0x09)
	// 写入数据账户
	WRITE_DATA_ACCOUNT = LedgerPermission(0x0A)
	// 参与方核准交易
	// 如果不具备此项权限,则无法作为节点签署由终端提交的交易
	// 只对交易请求的节点签名列表{@link TransactionRequest#getNodeSignatures()}的用户产生影响
	APPROVE_TX = LedgerPermission(0x0B)
	// 参与方共识交易
	// 如果不具备此项权限,则无法作为共识节点接入并对交易进行共识
	CONSENSUS_TX = LedgerPermission(0x0C)
	// 注册事件账户
	REGISTER_EVENT_ACCOUNT = LedgerPermission(0x0D)
	// 发布事件
	WRITE_EVENT_ACCOUNT = LedgerPermission(0x0E)
)
View Source
const (
	// 交易中包含指令操作
	DIRECT_OPERATION = TransactionPermission(1)
	// 交易中包含合约操作
	CONTRACT_OPERATION = TransactionPermission(2)
)
View Source
const (
	// 成功
	SUCCESS = TransactionState(0)
	// 账本错误
	LEDGER_ERROR = TransactionState(0x01)
	// 数据账户不存在
	DATA_ACCOUNT_DOES_NOT_EXIST = TransactionState(0x02)
	// 用户不存在
	USER_DOES_NOT_EXIST = TransactionState(0x03)
	// 合约不存在
	CONTRACT_DOES_NOT_EXIST = TransactionState(0x04)
	// 数据写入时版本冲突
	DATA_VERSION_CONFLICT = TransactionState(0x05)
	// 参与方不存在
	PARTICIPANT_DOES_NOT_EXIST = TransactionState(0x06)
	// 被安全策略拒绝
	REJECTED_BY_SECURITY_POLICY = TransactionState(0x10)
	// 由于在错误的账本上执行交易而被丢弃
	IGNORED_BY_WRONG_LEDGER = TransactionState(0x40)
	// 由于交易内容的验签失败而丢弃
	IGNORED_BY_WRONG_CONTENT_SIGNATURE = TransactionState(0x41)
	// 由于交易内容的验签失败而丢弃
	IGNORED_BY_CONFLICTING_STATE = TransactionState(0x42)
	// 由于交易的整体回滚而丢弃
	IGNORED_BY_TX_FULL_ROLLBACK = TransactionState(0x43)
	// 由于区块的整体回滚而丢弃
	IGNORED_BY_BLOCK_FULL_ROLLBACK = TransactionState(0x44)
	// 共识阶段加入新区块哈希预计算功能, 如果来自其他Peer的新区块哈希值不一致,本批次整体回滚
	IGNORED_BY_CONSENSUS_PHASE_PRECOMPUTE_ROLLBACK = TransactionState(0x45)
	// 系统错误
	SYSTEM_ERROR = TransactionState(-128)
	// 超时
	TIMEOUT = TransactionState(-127)
	// 共识错误
	CONSENSUS_ERROR = TransactionState(-126)
)
View Source
const (
	// 操作类型名称 TODO 不全
	OperationTypeUserRegister                    = "UserRegisterOperation"           // 用户注册
	OperationTypeDataAccountRegisterOperation    = "DataAccountRegisterOperation"    // 数据账户注册
	OperationTypeDataAccountKVSetOperation       = "DataAccountKVSetOperation"       // KV写入
	OperationTypeEventAccountRegisterOperation   = "EventAccountRegisterOperation"   // 事件账户注册
	OperationTypeEventPublishOperation           = "EventPublishOperation"           // 事件发布
	OperationTypeParticipantRegisterOperation    = "ParticipantRegisterOperation"    // 参与方注册
	OperationTypeParticipantStateUpdateOperation = "ParticipantStateUpdateOperation" // 参与方变更
	OperationTypeContractCodeDeployOperation     = "ContractCodeDeployOperation"     // 合约部署
	OperationTypeContractEventSendOperation      = "ContractEventSendOperation"      // 合约调用
	OperationTypeRolesConfigureOperation         = "RolesConfigureOperation"         // 角色配置
	OperationTypeUserAuthorizeOperation          = "UserAuthorizeOperation"          // 用户授权
)
View Source
const MAX_ROLE_NAMES = 20

Variables

This section is empty.

Functions

func ComputeTxContentHash

func ComputeTxContentHash(algorithm framework.CryptoAlgorithm, txContent TransactionContent) framework.HashDigest

func FormatRoleName

func FormatRoleName(roleName string) string

校验角色名称的有效性,并格式化角色名称:去掉两端空白字符,统一为大写字符

func SignBytesWithPrivKey

func SignBytesWithPrivKey(hash []byte, privKey framework.PrivKey) framework.SignatureDigest

func VerifyHashSignature

func VerifyHashSignature(hash []byte, signDigest framework.SignatureDigest, pubKey framework.PubKey) bool

func VerifySignature

func VerifySignature(hashAlgorithm int16, txContent TransactionContent, signDigest framework.SignatureDigest, pubKey framework.PubKey) bool

func VerifyTxContentHash

func VerifyTxContentHash(algorithm framework.CryptoAlgorithm, txContent TransactionContent, verifiedHash framework.HashDigest) bool

Types

type ActiveParticipantService

type ActiveParticipantService interface {
	/**
	ledgerHash	账本HASH
	ip 待激活节点IP
	port 待激活节点端口
	remoteManageHost	其他任一非拜占庭节点IP
	remoteManagePort	其他任一非拜占庭节点管理端口
	*/
	ActivateParticipant(ledgerHash, ip string, port int, remoteManageHost string, remoteManagePort int, shutdown bool) (bool, error)

	/**
	ledgerHash	账本HASH
	participantAddress 待移除节点地址
	remoteManageHost	其他任一非拜占庭节点IP
	remoteManagePort	其他任一非拜占庭节点管理端口
	*/
	InactivateParticipant(ledgerHash, participantAddress, remoteManageHost string, remoteManagePort int) (bool, error)
}

type AuthorizationDataEntry

type AuthorizationDataEntry struct {
	UserRolesEntry
	// contains filtered or unexported fields
}

func NewAuthorizationDataEntry

func NewAuthorizationDataEntry(opTemplate *UserAuthorizeOpTemplate, users [][]byte) *AuthorizationDataEntry

func (*AuthorizationDataEntry) Authorize

func (*AuthorizationDataEntry) ForUser

func (a *AuthorizationDataEntry) ForUser(users [][]byte) UserRolesAuthorizer

func (*AuthorizationDataEntry) SetPolicy

func (a *AuthorizationDataEntry) SetPolicy(rolePolicy RolesPolicy) UserRolesAuthorizer

func (*AuthorizationDataEntry) Unauthorize

func (a *AuthorizationDataEntry) Unauthorize(role string) UserRolesAuthorizer

type BlockBody

type BlockBody struct {
	LedgerDataSnapshot
	LedgerEventSnapshot
	PreviousHash       []byte `primitiveType:"BYTES"`
	LedgerHash         []byte `primitiveType:"BYTES"`
	Height             int64  `primitiveType:"INT64"`
	TransactionSetHash []byte `primitiveType:"BYTES"`
	Timestamp          int64  `primitiveType:"INT64"`
}

func (BlockBody) ContractCode

func (b BlockBody) ContractCode() int32

func (BlockBody) ContractName

func (b BlockBody) ContractName() string

func (BlockBody) Description

func (b BlockBody) Description() string

type BlockChainLedgerQueryService

type BlockChainLedgerQueryService interface {
	// 返回所有的账本的 hash 列表
	GetLedgerHashs() ([]framework.HashDigest, error)

	// 获取账本信息
	GetLedger(ledgerHash framework.HashDigest) (LedgerInfo, error)

	// 获取账本信息
	GetLedgerAdminInfo(ledgerHash framework.HashDigest) (LedgerAdminInfo, error)

	// 返回当前账本的参与者信息列表
	GetConsensusParticipants(ledgerHash framework.HashDigest) ([]ParticipantNode, error)

	// 返回当前账本的元数据
	GetLedgerMetadata(ledgerHash framework.HashDigest) (LedgerMetadata, error)

	// 返回指定账本序号的区块
	GetBlockByHeight(ledgerHash framework.HashDigest, height int64) (LedgerBlock, error)

	// 返回指定区块hash的区块
	GetBlockByHash(ledgerHash, blockHash framework.HashDigest) (LedgerBlock, error)

	// 返回指定高度的区块中记录的交易总数
	GetTransactionCountByHeight(ledgerHash framework.HashDigest, height int64) (int64, error)

	// 返回指定高度的区块中记录的交易总数
	GetTransactionCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	// 返回当前账本的交易总数
	GetTransactionTotalCount(ledgerHash framework.HashDigest) (int64, error)

	// 返回指定高度的区块中记录的数据账户总数
	GetDataAccountCountByHeight(ledgerHash framework.HashDigest, height int64) (int64, error)

	// 返回指定的区块中记录的数据账户总数
	GetDataAccountCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	// 返回当前账本的数据账户总数
	GetDataAccountTotalCount(ledgerHash framework.HashDigest) (int64, error)

	// 返回指定高度区块中的用户总数
	GetUserCountByHeight(ledgerHash framework.HashDigest, height int64) (int64, error)

	// 返回指定区块中的用户总数
	GetUserCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	// 返回当前账本的用户总数
	GetUserTotalCount(ledgerHash framework.HashDigest) (int64, error)

	// 返回指定高度区块中的合约总数
	GetContractCountByHeight(ledgerHash framework.HashDigest, height int64) (int64, error)

	// 返回指定区块中的合约总数
	GetContractCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	// 返回当前账本的合约总数
	GetContractTotalCount(ledgerHash framework.HashDigest) (int64, error)

	/**
	 * 分页返回指定账本序号的区块中的交易列表;
	 *
	 * @param ledgerHash 账本hash;
	 * @param height     账本高度;
	 * @param fromIndex  开始的记录数;
	 * @param count      本次返回的记录数;
	 */
	GetTransactionsByHeight(ledgerHash framework.HashDigest, height int64, fromIndex, count int64) ([]LedgerTransaction, error)

	/**
	 * 分页返回指定账本序号的区块中的交易列表;
	 *
	 * @param ledgerHash 账本hash;
	 * @param blockHash  账本高度;
	 * @param fromIndex  开始的记录数;
	 * @param count      本次返回的记录数;
	 * @return
	 */
	GetTransactionsByHash(ledgerHash, blockHash framework.HashDigest, fromIndex, count int64) ([]LedgerTransaction, error)

	/**
	 * 根据交易内容的哈希获取对应的交易记录;
	 *
	 * @param ledgerHash  账本hash;
	 * @param contentHash 交易内容的hash;
	 * @return
	 */
	GetTransactionByContentHash(ledgerHash, contentHash framework.HashDigest) (LedgerTransaction, error)

	/**
	 * 根据交易内容的哈希获取对应的交易状态;
	 *
	 * @param ledgerHash  账本hash;
	 * @param contentHash 交易内容的hash;
	 * @return
	 */
	GetTransactionStateByContentHash(ledgerHash, contentHash framework.HashDigest) (TransactionState, error)

	// 返回用户信息
	GetUser(ledgerHash framework.HashDigest, address string) (UserInfo, error)

	// 返回数据账户信息
	GetDataAccount(ledgerHash framework.HashDigest, address string) (BlockchainIdentity, error)

	/**
	 * 返回数据账户中指定的键的最新值;
	 *
	 * 返回结果的顺序与指定的键的顺序是一致的;
	 *
	 * 如果某个键不存在,则返回版本为 -1 的数据项;
	 *
	 */
	GetLatestDataEntries(ledgerHash framework.HashDigest, address string, keys []string) ([]TypedKVEntry, error)

	GetDataEntries(ledgerHash framework.HashDigest, address string, kvInfoVO KVInfoVO) ([]TypedKVEntry, error)

	// 返回指定数据账户中KV数据的总数
	GetDataEntriesTotalCount(ledgerHash framework.HashDigest, address string) (int64, error)

	/**
	 * 返回数据账户中指定序号的最新值; 返回结果的顺序与指定的序号的顺序是一致的;
	 *
	 * @param ledgerHash 账本hash;
	 * @param address    数据账户地址;
	 * @param fromIndex  开始的记录数;
	 * @param count      本次返回的记录数;
	 *                   如果参数值为 -1,则返回全部的记录;
	 */
	GetLatestDataEntriesByRange(ledgerHash framework.HashDigest, address string, fromIndex, count int64) ([]TypedKVEntry, error)

	// 返回合约账户信息
	GetContract(ledgerHash framework.HashDigest, address string) (ContractInfo, error)

	// get users by ledgerHash and its range
	GetUsers(ledgerHash framework.HashDigest, fromIndex, count int64) ([]BlockchainIdentity, error)

	// get data accounts by ledgerHash and its range
	GetDataAccounts(ledgerHash framework.HashDigest, fromIndex, count int64) ([]BlockchainIdentity, error)

	// get contract accounts by ledgerHash and its range
	GetContractAccounts(ledgerHash framework.HashDigest, fromIndex, count int64) ([]BlockchainIdentity, error)

	/**
	 * 返回系统事件;
	 *
	 * @param ledgerHash   账本哈希;
	 * @param eventName    事件名;
	 * @param fromSequence 开始的事件序列号;
	 * @param maxCount     最大数量;
	 * @return
	 */
	GetSystemEvents(ledgerHash framework.HashDigest, eventName string, fromSequence int64, maxCount int64) ([]Event, error)

	/**
	 * 返回自定义事件账户;
	 * @param ledgerHash
	 * @param fromIndex
	 * @param count
	 * @return
	 */
	GetUserEventAccounts(ledgerHash framework.HashDigest, fromSequence int64, maxCount int64) ([]BlockchainIdentity, error)

	/**
	 * 返回自定义事件;
	 *
	 * @param ledgerHash   账本哈希;
	 * @param address      事件账户地址;
	 * @param eventName    事件名;
	 * @param fromSequence 开始的事件序列号;
	 * @param maxCount     最大数量;
	 * @return
	 */
	GetUserEvents(ledgerHash framework.HashDigest, address string, eventName string, fromSequence int64, maxCount int64) ([]Event, error)

	/**
	 * 返回系统事件名称总数; <br>
	 *
	 * @param ledgerHash
	 * @return
	 */
	GetSystemEventNameTotalCount(digest framework.HashDigest) (int64, error)

	/**
	 * 返回系统事件名称列表; <br>
	 *
	 * @param ledgerHash
	 * @param fromIndex
	 * @param count
	 * @return
	 */
	GetSystemEventNames(digest framework.HashDigest, fromIndex, count int64) ([]string, error)

	/**
	 * 返回指定系统事件名称下事件总数; <br>
	 *
	 * @param ledgerHash
	 * @param eventName
	 * @return
	 */
	GetSystemEventsTotalCount(digest framework.HashDigest, eventName string) (int64, error)

	/**
	 * 返回事件账户信息;
	 *
	 * @param ledgerHash
	 * @param address
	 * @return
	 */
	GetUserEventAccount(digist framework.HashDigest, address string) (BlockchainIdentity, error)

	/**
	 * 返回事件账户总数; <br>
	 *
	 * @param ledgerHash
	 * @return
	 */
	GetUserEventAccountTotalCount(digest framework.HashDigest) (int64, error)

	/**
	 * 返回指定事件账户事件名称列表; <br>
	 *
	 * @param ledgerHash
	 * @param address
	 * @return
	 */
	GetUserEventNames(ledgerHash framework.HashDigest, address string, fromIndex, count int64) ([]string, error)

	/**
	 * 返回指定事件账户事件名称总数; <br>
	 *
	 * @param ledgerHash
	 * @param address
	 * @return
	 */
	GetUserEventNameTotalCount(digest framework.HashDigest, address string) (int64, error)

	/**
	 * 返回指定事件账户,指定事件名称下事件总数; <br>
	 *
	 * @param ledgerHash
	 * @param address
	 * @param eventName
	 * @return
	 */
	GetUserEventsTotalCount(digest framework.HashDigest, address, eventName string) (int64, error)

	/**
	 * 返回最新系统事件; <br>
	 *
	 * @param ledgerHash
	 * @param eventName
	 * @return
	 */
	GetLatestSystemEvent(ledgerHash framework.HashDigest, eventName string) (Event, error)

	/**
	 * 返回最新用户自定义事件; <br>
	 *
	 * @param ledgerHash
	 * @param address
	 * @param eventName
	 * @return
	 */
	GetLatestUserEvent(ledgerHash framework.HashDigest, address string, eventName string) (Event, error)

	/**
	 * 获取最新区块
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @return
	 */
	GetLatestBlock(ledgerHash framework.HashDigest) (LedgerBlock, error)

	/**
	 * 获取指定区块高度中新增的交易总数(即该区块中交易集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHeight
	 *         区块高度
	 * @return
	 */
	GetAdditionalTransactionCountByHeight(ledgerHash framework.HashDigest, blockHeight int64) (int64, error)

	/**
	 * 获取指定区块Hash中新增的交易总数(即该区块中交易集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHash
	 *         区块Hash
	 * @return
	 */
	GetAdditionalTransactionCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定账本最新区块附加的交易数量
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @return
	 */
	GetAdditionalTransactionCount(ledgerHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定区块高度中新增的数据账户总数(即该区块中数据账户集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHeight
	 *         区块高度
	 * @return
	 */
	GetAdditionalDataAccountCountByHeight(ledgerHash framework.HashDigest, blockHeight int64) (int64, error)

	/**
	 * 获取指定区块Hash中新增的数据账户总数(即该区块中数据账户集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHash
	 *         区块Hash
	 * @return
	 */
	GetAdditionalDataAccountCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定账本中附加的数据账户数量
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @return
	 */
	GetAdditionalDataAccountCount(ledgerHash framework.HashDigest) (int64, error)
	/**
	 * 获取指定区块高度中新增的用户总数(即该区块中用户集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHeight
	 *         区块高度
	 * @return
	 */
	GetAdditionalUserCountByHeight(ledgerHash framework.HashDigest, blockHeight int64) (int64, error)

	/**
	 * 获取指定区块Hash中新增的用户总数(即该区块中用户集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHash
	 *         区块Hash
	 * @return
	 */
	GetAdditionalUserCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定账本中新增的用户数量
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @return
	 */
	GetAdditionalUserCount(ledgerHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定区块高度中新增的合约总数(即该区块中合约集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHeight
	 *         区块高度
	 * @return
	 */
	GetAdditionalContractCountByHeight(ledgerHash framework.HashDigest, blockHeight int64) (int64, error)

	/**
	 * 获取指定区块Hash中新增的合约总数(即该区块中合约集合的数量)
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHash
	 *         区块Hash
	 * @return
	 */
	GetAdditionalContractCountByHash(ledgerHash, blockHash framework.HashDigest) (int64, error)

	/**
	 * 获取指定账本中新增的合约数量
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @return
	 */
	GetAdditionalContractCount(ledgerHash framework.HashDigest) (int64, error)

	/**
	 *  get all ledgers count;
	 */
	GetLedgersCount() (int64, error)

	/**
	 * return role's privileges;
	 * @param ledgerHash
	 * @param roleName
	 * @return
	 */
	GetRolePrivileges(ledgerHash framework.HashDigest, roleName string) (RolePrivileges, error)

	/**
	 * 返回user's priveleges;
	 *
	 * @param userAddress
	 * @return
	 */
	GetUserPrivileges(ledgerHash framework.HashDigest, userAddress string) (UserRolesPrivileges, error)

	/**
	 * 获取指定区块高度中新增的交易
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHeight
	 *         区块高度
	 * @return
	 */
	GetAdditionalTransactionsByHeight(ledgerHash framework.HashDigest, height int64, fromIndex, count int64) ([]LedgerTransaction, error)

	/**
	 * 获取指定区块Hash中新增的交易
	 *
	 * @param ledgerHash
	 *         账本Hash
	 * @param blockHash
	 *         区块Hash
	 * @return
	 */
	GetAdditionalTransactionsByHash(ledgerHash, blockHash framework.HashDigest, fromIndex, count int64) ([]LedgerTransaction, error)
}

区块链账本相关查询器

type BlockchainIdentity

type BlockchainIdentity struct {
	Address []byte `primitiveType:"BYTES"`
	PubKey  []byte `primitiveType:"BYTES"`
}

func NewBlockchainIdentity

func NewBlockchainIdentity(pubKey framework.PubKey) BlockchainIdentity

func (BlockchainIdentity) ContractCode

func (b BlockchainIdentity) ContractCode() int32

func (BlockchainIdentity) ContractName

func (b BlockchainIdentity) ContractName() string

func (BlockchainIdentity) Description

func (b BlockchainIdentity) Description() string

type BlockchainKeypair

type BlockchainKeypair struct {
	framework.AsymmetricKeypair
	// contains filtered or unexported fields
}

func NewBlockchainKeypair

func NewBlockchainKeypair(pubKey framework.PubKey, privKey framework.PrivKey) BlockchainKeypair

func (BlockchainKeypair) GetAddress

func (pair BlockchainKeypair) GetAddress() []byte

func (BlockchainKeypair) GetIdentity

func (pair BlockchainKeypair) GetIdentity() BlockchainIdentity

type BlockchainOperationFactory

type BlockchainOperationFactory struct {
	// contains filtered or unexported fields
}

func (*BlockchainOperationFactory) ContractEvents

func (*BlockchainOperationFactory) Contracts

func (*BlockchainOperationFactory) DataAccount

func (b *BlockchainOperationFactory) DataAccount(accountAddress []byte) *DataAccountKVSetOperationBuilder

func (*BlockchainOperationFactory) DataAccounts

func (*BlockchainOperationFactory) EventAccount

func (b *BlockchainOperationFactory) EventAccount(accountAddress []byte) *EventPublishOperationBuilder

func (*BlockchainOperationFactory) EventAccounts

func (*BlockchainOperationFactory) Participants

func (*BlockchainOperationFactory) Security

func (*BlockchainOperationFactory) States

func (*BlockchainOperationFactory) Users

type BlockchainQueryService

type BlockchainQueryService interface {
	BlockChainLedgerQueryService
}

type BytesValue

type BytesValue struct {
	// 数据类型
	Type DataType `refEnum:"2851"`
	// 数据值的二进制序列
	Bytes []byte `primitiveType:"BYTES"`
}

func (BytesValue) ContractCode

func (b BytesValue) ContractCode() int32

func (BytesValue) ContractName

func (b BytesValue) ContractName() string

func (BytesValue) Description

func (b BytesValue) Description() string

type BytesValueList

type BytesValueList struct {
	Values []BytesValue `refContract:"128" list:"true"`
}

func (BytesValueList) ContractCode

func (b BytesValueList) ContractCode() int32

func (BytesValueList) ContractName

func (b BytesValueList) ContractName() string

func (BytesValueList) Description

func (b BytesValueList) Description() string

type ContractCodeDeployOperation

type ContractCodeDeployOperation struct {
	ContractID BlockchainIdentity `refContract:"144"`

	ChainCode []byte `primitiveType:"BYTES"`
	// 地址签名
	// 这是合约账户身份 使用对应的私钥对地址做出的签名
	// 在注册时将校验此签名与账户地址、公钥是否相匹配,以此保证只有私钥的持有者才能注册相应的合约账户,确保合约账户的唯一性
	AddressSignature DigitalSignature `refContract:"2864"`

	ChainCodeVersion int64 `primitiveType:"INT64"`
}

func (ContractCodeDeployOperation) ContractCode

func (c ContractCodeDeployOperation) ContractCode() int32

func (ContractCodeDeployOperation) ContractName

func (c ContractCodeDeployOperation) ContractName() string

func (ContractCodeDeployOperation) Description

func (c ContractCodeDeployOperation) Description() string

type ContractCodeDeployOperationBuilder

type ContractCodeDeployOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*ContractCodeDeployOperationBuilder) Deploy

type ContractEventSendOperation

type ContractEventSendOperation struct {

	// 响应事件的合约地址
	ContractAddress []byte `primitiveType:"BYTES"`

	// 事件名
	Event string `primitiveType:"TEXT"`

	// 事件参数
	Args BytesValueList `refContract:"129"`

	// contract's version
	Version int64 `primitiveType:"INT64"`
}

func (ContractEventSendOperation) ContractCode

func (c ContractEventSendOperation) ContractCode() int32

func (ContractEventSendOperation) ContractName

func (c ContractEventSendOperation) ContractName() string

func (ContractEventSendOperation) Description

func (c ContractEventSendOperation) Description() string

type ContractEventSendOperationBuilder

type ContractEventSendOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*ContractEventSendOperationBuilder) Send

func (cesob *ContractEventSendOperationBuilder) Send(address []byte, version int64, event string, args ...interface{}) error

address 合约地址 event 合约版本 event 合约方法 args 参数列表, 仅支持 bool/int16/int32/int64/string/[]byte

type ContractInfo

type ContractInfo struct {
	BlockchainIdentity
	MerkleSnapshot
	ChainCode []byte `primitiveType:"BYTES"`
}

func (ContractInfo) ContractCode

func (c ContractInfo) ContractCode() int32

func (ContractInfo) ContractName

func (c ContractInfo) ContractName() string

func (ContractInfo) Description

func (c ContractInfo) Description() string

type ContractOperator

type ContractOperator interface {

	// 部署合约
	Contracts() *ContractCodeDeployOperationBuilder

	// contract events
	ContractEvents() *ContractEventSendOperationBuilder
}

type CryptoProvider

type CryptoProvider struct {
	Name       string                      `primitiveType:"TEXT"`
	Algorithms []framework.CryptoAlgorithm `refContract:"2849" list:"true"`
}

func (CryptoProvider) ContractCode

func (c CryptoProvider) ContractCode() int32

func (CryptoProvider) ContractName

func (c CryptoProvider) ContractName() string

func (CryptoProvider) Description

func (c CryptoProvider) Description() string

type CryptoSetting

type CryptoSetting struct {
	// 系统支持的密码服务提供者
	SupportedProviders []CryptoProvider `refContract:"1603" list:"true"`
	// 系统中使用的 Hash 算法
	HashAlgorithm int16 `primitiveType:"INT16"`
	// 当有加载附带哈希摘要的数据时,是否重新计算哈希摘要进行完整性校验
	AutoVerifyHash bool `primitiveType:"BOOLEAN"`
}

func (CryptoSetting) ContractCode

func (c CryptoSetting) ContractCode() int32

func (CryptoSetting) ContractName

func (c CryptoSetting) ContractName() string

func (CryptoSetting) Description

func (c CryptoSetting) Description() string

type DataAccountKVSetOperation

type DataAccountKVSetOperation struct {
	AccountAddress []byte         `primitiveType:"BYTES"`
	WriteSet       []KVWriteEntry `refContract:"802" list:"true"`
}

func (DataAccountKVSetOperation) ContractCode

func (d DataAccountKVSetOperation) ContractCode() int32

func (DataAccountKVSetOperation) ContractName

func (d DataAccountKVSetOperation) ContractName() string

func (DataAccountKVSetOperation) Description

func (d DataAccountKVSetOperation) Description() string

type DataAccountKVSetOperationBuilder

type DataAccountKVSetOperationBuilder struct {
	Operation *DataAccountKVSetOperation
	// contains filtered or unexported fields
}

func NewDataAccountKVSetOperationBuilder

func NewDataAccountKVSetOperationBuilder(address []byte, factory *BlockchainOperationFactory) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetBytes

func (dakvob *DataAccountKVSetOperationBuilder) SetBytes(key string, value []byte, expVersion int64) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetImage

func (dakvob *DataAccountKVSetOperationBuilder) SetImage(key string, value []byte, expVersion int64) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetInt64

func (dakvob *DataAccountKVSetOperationBuilder) SetInt64(key string, value int64, expVersion int64) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetJSON

func (dakvob *DataAccountKVSetOperationBuilder) SetJSON(key, value string, expVersion int64) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetText

func (dakvob *DataAccountKVSetOperationBuilder) SetText(key, value string, expVersion int64) *DataAccountKVSetOperationBuilder

func (*DataAccountKVSetOperationBuilder) SetTimestamp

func (dakvob *DataAccountKVSetOperationBuilder) SetTimestamp(key string, value int64, expVersion int64) *DataAccountKVSetOperationBuilder

type DataAccountOperator

type DataAccountOperator interface {

	// 数据账户
	DataAccounts() *DataAccountRegisterOperationBuilder

	// 写入数据
	DataAccount(accountAddress []byte) *DataAccountKVSetOperationBuilder
}

type DataAccountRegisterOperation

type DataAccountRegisterOperation struct {
	AccountID        BlockchainIdentity `refContract:"144"`
	AddressSignature DigitalSignature   `refContract:"2864"`
}

func (DataAccountRegisterOperation) ContractCode

func (d DataAccountRegisterOperation) ContractCode() int32

func (DataAccountRegisterOperation) ContractName

func (d DataAccountRegisterOperation) ContractName() string

func (DataAccountRegisterOperation) Description

func (d DataAccountRegisterOperation) Description() string

type DataAccountRegisterOperationBuilder

type DataAccountRegisterOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*DataAccountRegisterOperationBuilder) Register

type DataType

type DataType int8

键值操作的数据类型

func (DataType) ContractCode

func (d DataType) ContractCode() int32

func (DataType) ContractName

func (d DataType) ContractName() string

func (DataType) ContractType

func (d DataType) ContractType() string

func (DataType) ContractVersion

func (d DataType) ContractVersion() int64

func (DataType) Description

func (d DataType) Description() string

func (DataType) GetValue

func (d DataType) GetValue(CODE int32) binary_proto.EnumContract

func (DataType) GetValueByName

func (d DataType) GetValueByName(name string) binary_proto.EnumContract

type DigitalSignature

type DigitalSignature struct {
	DigitalSignatureBody
}

func Sign

func Sign(transactionHash framework.HashDigest, keyPair framework.AsymmetricKeypair) DigitalSignature

func SignBytes

func SignBytes(transactionHash []byte, keyPair framework.AsymmetricKeypair) DigitalSignature

func (DigitalSignature) ContractCode

func (d DigitalSignature) ContractCode() int32

func (DigitalSignature) ContractName

func (d DigitalSignature) ContractName() string

func (DigitalSignature) Description

func (d DigitalSignature) Description() string

type DigitalSignatureBody

type DigitalSignatureBody struct {
	PubKey []byte `primitiveType:"BYTES"`
	Digest []byte `primitiveType:"BYTES"`
}

func (DigitalSignatureBody) ContractCode

func (d DigitalSignatureBody) ContractCode() int32

func (DigitalSignatureBody) ContractName

func (d DigitalSignatureBody) ContractName() string

func (DigitalSignatureBody) Description

func (d DigitalSignatureBody) Description() string

type EndpointRequest

type EndpointRequest struct {
	//Hash []byte `primitiveType:"BYTES"`
	// 交易内容
	TransactionContent TransactionContent `refContract:"512"`
	// 终端用户的签名列表
	EndpointSignatures []DigitalSignature `refContract:"2864" list:"true"`
}

func (*EndpointRequest) AddEndpointSignatures

func (e *EndpointRequest) AddEndpointSignatures(signature DigitalSignature)

func (*EndpointRequest) ContainsEndpointSignature

func (e *EndpointRequest) ContainsEndpointSignature(pubKey []byte) bool

func (EndpointRequest) ContractCode

func (e EndpointRequest) ContractCode() int32

func (EndpointRequest) ContractName

func (e EndpointRequest) ContractName() string

func (EndpointRequest) Description

func (e EndpointRequest) Description() string

type Event

type Event struct {
	// 事件名
	Name string `primitiveType:"TEXT"`

	// 事件序号
	Sequence int64 `primitiveType:"INT64"`

	// 事件内容
	Content BytesValue `refContract:"128"`

	// 产生事件的交易哈希
	TransactionSource []byte `primitiveType:"BYTES"`

	// 产生事件的合约地址
	ContractSource string `primitiveType:"TEXT"`

	// 产生事件的区块高度
	BlockHeight int64 `primitiveType:"INT64"`

	// 事件账户地址
	EventAccount []byte `primitiveType:"BYTES"`
}

事件

func (Event) ContractCode

func (e Event) ContractCode() int32

func (Event) ContractName

func (e Event) ContractName() string

func (Event) Description

func (e Event) Description() string

type EventAccountRegisterOperation

type EventAccountRegisterOperation struct {
	EventAccountID BlockchainIdentity `refContract:"144"`
}

func (EventAccountRegisterOperation) ContractCode

func (e EventAccountRegisterOperation) ContractCode() int32

func (EventAccountRegisterOperation) ContractName

func (e EventAccountRegisterOperation) ContractName() string

func (EventAccountRegisterOperation) Description

func (e EventAccountRegisterOperation) Description() string

type EventAccountRegisterOperationBuilder

type EventAccountRegisterOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*EventAccountRegisterOperationBuilder) Register

type EventEntry

type EventEntry struct {
	Name     string     `primitiveType:"TEXT"`
	Content  BytesValue `refContract:"128"`
	Sequence int64      `primitiveType:"INT64"`
}

func (EventEntry) ContractCode

func (e EventEntry) ContractCode() int32

func (EventEntry) ContractName

func (e EventEntry) ContractName() string

func (EventEntry) Description

func (e EventEntry) Description() string

type EventOperator

type EventOperator interface {
	// 事件账户
	EventAccounts() *EventAccountRegisterOperationBuilder
	// 发布消息
	EventAccount(accountAddress []byte) *EventPublishOperationBuilder
}

type EventPublishOperation

type EventPublishOperation struct {
	EventAddress []byte `primitiveType:"BYTES"`

	Events []EventEntry `refContract:"898" list:"true"`
}

func (EventPublishOperation) ContractCode

func (e EventPublishOperation) ContractCode() int32

func (EventPublishOperation) ContractName

func (e EventPublishOperation) ContractName() string

func (EventPublishOperation) Description

func (e EventPublishOperation) Description() string

type EventPublishOperationBuilder

type EventPublishOperationBuilder struct {
	Operation *EventPublishOperation
	// contains filtered or unexported fields
}

func NewEventPublishOperationBuilder

func NewEventPublishOperationBuilder(address []byte, factory *BlockchainOperationFactory) *EventPublishOperationBuilder

func (*EventPublishOperationBuilder) PublishBytes

func (epob *EventPublishOperationBuilder) PublishBytes(name string, content []byte, sequence int64) *EventPublishOperationBuilder

func (*EventPublishOperationBuilder) PublishInt64

func (epob *EventPublishOperationBuilder) PublishInt64(name string, content int64, sequence int64) *EventPublishOperationBuilder

func (*EventPublishOperationBuilder) PublishString

func (epob *EventPublishOperationBuilder) PublishString(name string, content string, sequence int64) *EventPublishOperationBuilder

type KVDataVO

type KVDataVO struct {
	Key     string
	Version []int64
}

type KVInfoVO

type KVInfoVO struct {
	Data []KVDataVO
}

type KVWriteEntry

type KVWriteEntry struct {
	Key             string     `primitiveType:"TEXT"`
	Value           BytesValue `refContract:"128"`
	ExpectedVersion int64      `primitiveType:"INT64"`
}

func (KVWriteEntry) ContractCode

func (K KVWriteEntry) ContractCode() int32

func (KVWriteEntry) ContractName

func (K KVWriteEntry) ContractName() string

func (KVWriteEntry) Description

func (K KVWriteEntry) Description() string

type LedgerAdminInfo

type LedgerAdminInfo struct {
	Metadata         LedgerMetadata_V2 `refContract:"1537"`
	Settings         LedgerSettings    `refContract:"1568"`
	Participants     []ParticipantNode `refContract:"1569" list:"true"`
	ParticipantCount int64             `primitiveType:"INT64"`
}

func (LedgerAdminInfo) ContractCode

func (l LedgerAdminInfo) ContractCode() int32

func (LedgerAdminInfo) ContractName

func (l LedgerAdminInfo) ContractName() string

func (LedgerAdminInfo) Description

func (l LedgerAdminInfo) Description() string

type LedgerBlock

type LedgerBlock struct {
	BlockBody
	Hash []byte `primitiveType:"BYTES"`
}

func (LedgerBlock) ContractCode

func (l LedgerBlock) ContractCode() int32

func (LedgerBlock) ContractName

func (l LedgerBlock) ContractName() string

func (LedgerBlock) Description

func (l LedgerBlock) Description() string

type LedgerDataSnapshot

type LedgerDataSnapshot struct {
	AdminAccountHash       []byte `primitiveType:"BYTES"`
	UserAccountSetHash     []byte `primitiveType:"BYTES"`
	DataAccountSetHash     []byte `primitiveType:"BYTES"`
	ContractAccountSetHash []byte `primitiveType:"BYTES"`
}

func (LedgerDataSnapshot) ContractCode

func (l LedgerDataSnapshot) ContractCode() int32

func (LedgerDataSnapshot) ContractName

func (l LedgerDataSnapshot) ContractName() string

func (LedgerDataSnapshot) Description

func (l LedgerDataSnapshot) Description() string

type LedgerEventSnapshot

type LedgerEventSnapshot struct {
	SystemEventSetHash []byte `primitiveType:"BYTES"`
	UserEventSetHash   []byte `primitiveType:"BYTES"`
}

func (LedgerEventSnapshot) ContractCode

func (l LedgerEventSnapshot) ContractCode() int32

func (LedgerEventSnapshot) ContractName

func (l LedgerEventSnapshot) ContractName() string

func (LedgerEventSnapshot) Description

func (l LedgerEventSnapshot) Description() string

type LedgerInfo

type LedgerInfo struct {
	Hash              framework.HashDigest
	LatestBlockHash   framework.HashDigest
	LatestBlockHeight int64
}

type LedgerMetadata

type LedgerMetadata struct {
	// 账本的初始化种子
	Seed []byte `primitiveType:"BYTES"`
	// 共识参与方的默克尔树的根
	ParticipantsHash []byte `primitiveType:"BYTES"`
	// 账本配置的哈希
	SettingsHash []byte `primitiveType:"BYTES"`
}

账本的元数据

func (LedgerMetadata) ContractCode

func (l LedgerMetadata) ContractCode() int32

func (LedgerMetadata) ContractName

func (l LedgerMetadata) ContractName() string

func (LedgerMetadata) Description

func (l LedgerMetadata) Description() string

type LedgerMetadata_V2

type LedgerMetadata_V2 struct {
	LedgerMetadata
	// 角色权限集合的根哈希
	RolePrivilegesHash []byte `primitiveType:"BYTES"`
	// 用户角色授权集合的根哈希
	UserRolesHash []byte `primitiveType:"BYTES"`
}

func (LedgerMetadata_V2) ContractCode

func (l LedgerMetadata_V2) ContractCode() int32

func (LedgerMetadata_V2) ContractName

func (l LedgerMetadata_V2) ContractName() string

func (LedgerMetadata_V2) Description

func (l LedgerMetadata_V2) Description() string

type LedgerPermission

type LedgerPermission int8

func (LedgerPermission) ContractCode

func (l LedgerPermission) ContractCode() int32

func (LedgerPermission) ContractName

func (l LedgerPermission) ContractName() string

func (LedgerPermission) ContractType

func (l LedgerPermission) ContractType() string

func (LedgerPermission) ContractVersion

func (l LedgerPermission) ContractVersion() int64

func (LedgerPermission) Description

func (l LedgerPermission) Description() string

func (LedgerPermission) GetValue

func (LedgerPermission) GetValueByName

func (l LedgerPermission) GetValueByName(name string) binary_proto.EnumContract

type LedgerPrivilegeBitset

type LedgerPrivilegeBitset struct {
	Privilege       []LedgerPermission
	PermissionCount int32
}

type LedgerSettings

type LedgerSettings struct {
	ConsensusProvider string        `primitiveType:"TEXT"`
	ConsensusSetting  []byte        `primitiveType:"BYTES"`
	CryptoSetting     CryptoSetting `refContract:"1602"`
}

func (LedgerSettings) ContractCode

func (l LedgerSettings) ContractCode() int32

func (LedgerSettings) ContractName

func (l LedgerSettings) ContractName() string

func (LedgerSettings) Description

func (l LedgerSettings) Description() string

type LedgerTransaction

type LedgerTransaction struct {
	Request TransactionRequest `refContract:"514"`
	Result  TransactionResult  `refContract:"515"`
}

func (LedgerTransaction) ContractCode

func (l LedgerTransaction) ContractCode() int32

func (LedgerTransaction) ContractName

func (l LedgerTransaction) ContractName() string

func (LedgerTransaction) Description

func (l LedgerTransaction) Description() string

type MerkleSnapshot

type MerkleSnapshot struct {
	RootHash []byte `primitiveType:"BYTES"`
}

func (MerkleSnapshot) ContractCode

func (m MerkleSnapshot) ContractCode() int32

func (MerkleSnapshot) ContractName

func (m MerkleSnapshot) ContractName() string

func (MerkleSnapshot) Description

func (m MerkleSnapshot) Description() string

type NodeRequest

type NodeRequest struct {
	EndpointRequest
	// 接入交易的节点的签名
	NodeSignatures []DigitalSignature `refContract:"2864" list:"true"`
}

func (NodeRequest) ContractCode

func (n NodeRequest) ContractCode() int32

func (NodeRequest) ContractName

func (n NodeRequest) ContractName() string

func (NodeRequest) Description

func (n NodeRequest) Description() string

type Operation

type Operation struct {
}

func (Operation) ContractCode

func (o Operation) ContractCode() int32

func (Operation) ContractName

func (o Operation) ContractName() string

func (Operation) Description

func (o Operation) Description() string

type OperationResult

type OperationResult struct {
	Index  int32      `primitiveType:"INT32"`
	Result BytesValue `refContract:"128"`
}

func (OperationResult) ContractCode

func (o OperationResult) ContractCode() int32

func (OperationResult) ContractName

func (o OperationResult) ContractName() string

func (OperationResult) Description

func (o OperationResult) Description() string

type ParticipantNode

type ParticipantNode struct {
	// 节点的顺序编号 TODO
	Id int32 `primitiveType:"INT32"`
	// 节点的虚拟地址,根据公钥生成
	Address []byte `primitiveType:"BYTES"`
	// 参与者名称
	Name string `primitiveType:"TEXT"`
	// 节点消息认证的公钥
	PubKey []byte `primitiveType:"BYTES"`
	// 节点的状态:已注册/已参与共识
	ParticipantNodeState ParticipantNodeState `refEnum:"2852"`
}

参与方节点

func (ParticipantNode) ContractCode

func (p ParticipantNode) ContractCode() int32

func (ParticipantNode) ContractName

func (p ParticipantNode) ContractName() string

func (ParticipantNode) Description

func (p ParticipantNode) Description() string

type ParticipantNodeState

type ParticipantNodeState int8

参与方节点状态

const (
	// 已注册
	READY ParticipantNodeState = iota
	// 已激活
	CONSENSUS
	// 不可用
	DECONSENSUS
)

func (ParticipantNodeState) ContractCode

func (p ParticipantNodeState) ContractCode() int32

func (ParticipantNodeState) ContractName

func (p ParticipantNodeState) ContractName() string

func (ParticipantNodeState) ContractType

func (p ParticipantNodeState) ContractType() string

func (ParticipantNodeState) ContractVersion

func (p ParticipantNodeState) ContractVersion() int64

func (ParticipantNodeState) Description

func (p ParticipantNodeState) Description() string

func (ParticipantNodeState) GetValue

func (ParticipantNodeState) GetValueByName

func (p ParticipantNodeState) GetValueByName(name string) binary_proto.EnumContract

type ParticipantOperator

type ParticipantOperator interface {

	// 注册参与方操作
	Participants() *ParticipantRegisterOperationBuilder

	// 参与方状态更新操作
	States() *ParticipantStateUpdateOperationBuilder
}

type ParticipantRegisterOperation

type ParticipantRegisterOperation struct {
	ParticipantName string `primitiveType:"TEXT"`

	ParticipantRegisterIdentity BlockchainIdentity `refContract:"144"`
}

func (ParticipantRegisterOperation) ContractCode

func (p ParticipantRegisterOperation) ContractCode() int32

func (ParticipantRegisterOperation) ContractName

func (p ParticipantRegisterOperation) ContractName() string

func (ParticipantRegisterOperation) Description

func (p ParticipantRegisterOperation) Description() string

type ParticipantRegisterOperationBuilder

type ParticipantRegisterOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*ParticipantRegisterOperationBuilder) Register

func (prob *ParticipantRegisterOperationBuilder) Register(participantName string, participantPubKey BlockchainIdentity) ParticipantRegisterOperation

type ParticipantStateUpdateOperation

type ParticipantStateUpdateOperation struct {
	StateUpdateIdentity BlockchainIdentity `refContract:"144"`

	NetworkAddress []byte `primitiveType:"BYTES"`

	State ParticipantNodeState `refEnum:"2852"`
}

func (ParticipantStateUpdateOperation) ContractCode

func (p ParticipantStateUpdateOperation) ContractCode() int32

func (ParticipantStateUpdateOperation) ContractName

func (p ParticipantStateUpdateOperation) ContractName() string

func (ParticipantStateUpdateOperation) Description

func (p ParticipantStateUpdateOperation) Description() string

type ParticipantStateUpdateOperationBuilder

type ParticipantStateUpdateOperationBuilder struct {
	// contains filtered or unexported fields
}

func (*ParticipantStateUpdateOperationBuilder) Update

func (psuob *ParticipantStateUpdateOperationBuilder) Update(blockchainIdentity BlockchainIdentity, networkAddress []byte, participantNodeState ParticipantNodeState) ParticipantStateUpdateOperation

type PreparedTransaction

type PreparedTransaction interface {
	GetHash() framework.HashDigest

	GetTransactionContent() TransactionContent

	Sign(keyPair framework.AsymmetricKeypair) DigitalSignature

	AddSignature(signature DigitalSignature)

	Commit() (TransactionResponse, error)
}

type PreparedTx

type PreparedTx struct {
	// contains filtered or unexported fields
}

func NewPreparedTx

func NewPreparedTx(txReqBuilder TransactionRequestBuilder, txService TransactionService) *PreparedTx

func (*PreparedTx) AddSignature

func (p *PreparedTx) AddSignature(signature DigitalSignature)

func (*PreparedTx) Commit

func (p *PreparedTx) Commit() (TransactionResponse, error)

func (*PreparedTx) GetHash

func (p *PreparedTx) GetHash() framework.HashDigest

func (*PreparedTx) GetTransactionContent

func (p *PreparedTx) GetTransactionContent() TransactionContent

func (*PreparedTx) Sign

type RolePrivilegeConfig

type RolePrivilegeConfig struct {
	RolePrivilegeEntry
	// contains filtered or unexported fields
}

func NewRolePrivilegeConfig

func NewRolePrivilegeConfig(opTemplate *RolesConfigureOpTemplate, name string) *RolePrivilegeConfig

func (*RolePrivilegeConfig) Configure

func (r *RolePrivilegeConfig) Configure(roleName string) RolePrivilegeConfigurer

func (*RolePrivilegeConfig) DisableLedgerPermission

func (r *RolePrivilegeConfig) DisableLedgerPermission(permission LedgerPermission) RolePrivilegeConfigurer

func (*RolePrivilegeConfig) DisableTransactionPermission

func (r *RolePrivilegeConfig) DisableTransactionPermission(permission TransactionPermission) RolePrivilegeConfigurer

func (*RolePrivilegeConfig) EnableLedgerPermission

func (r *RolePrivilegeConfig) EnableLedgerPermission(permission LedgerPermission) RolePrivilegeConfigurer

func (*RolePrivilegeConfig) EnableTransactionPermission

func (r *RolePrivilegeConfig) EnableTransactionPermission(permission TransactionPermission) RolePrivilegeConfigurer

func (*RolePrivilegeConfig) RoleName

func (r *RolePrivilegeConfig) RoleName() string

type RolePrivilegeConfigurer

type RolePrivilegeConfigurer interface {
	RolesConfigure

	RoleName() string

	DisableTransactionPermission(permission TransactionPermission) RolePrivilegeConfigurer

	EnableTransactionPermission(permission TransactionPermission) RolePrivilegeConfigurer

	DisableLedgerPermission(permission LedgerPermission) RolePrivilegeConfigurer

	EnableLedgerPermission(permission LedgerPermission) RolePrivilegeConfigurer
}

type RolePrivilegeEntry

type RolePrivilegeEntry struct {
	RoleName string `primitiveType:"TEXT"`

	EnableLedgerPermissions []LedgerPermission `refEnum:"1026" list:"true"`

	DisableLedgerPermissions []LedgerPermission `refEnum:"1026" list:"true"`

	EnableTransactionPermissions []TransactionPermission `refEnum:"1025" list:"true"`

	DisableTransactionPermissions []TransactionPermission `refEnum:"1025" list:"true"`
}

func (RolePrivilegeEntry) ContractCode

func (r RolePrivilegeEntry) ContractCode() int32

func (RolePrivilegeEntry) ContractName

func (r RolePrivilegeEntry) ContractName() string

func (RolePrivilegeEntry) Description

func (r RolePrivilegeEntry) Description() string

type RolePrivileges

type RolePrivileges struct {
	RoleName             string
	Version              int64
	LedgerPrivilege      LedgerPrivilegeBitset
	TransactionPrivilege TransactionPrivilegeBitset
}

type RoleSet

type RoleSet struct {
	Policy RolesPolicy `refEnum:"1027"`
	Roles  []string    `primitiveType:"TEXT" list:"true"`
}

func (RoleSet) ContractCode

func (r RoleSet) ContractCode() int32

func (RoleSet) ContractName

func (r RoleSet) ContractName() string

func (RoleSet) Description

func (r RoleSet) Description() string

type RolesConfigure

type RolesConfigure interface {
	Configure(roleName string) RolePrivilegeConfigurer
}

type RolesConfigureOpTemplate

type RolesConfigureOpTemplate struct {
	*RolesConfigureOperation
	// contains filtered or unexported fields
}

func NewRolesConfigureOpTemplate

func NewRolesConfigureOpTemplate() *RolesConfigureOpTemplate

func (*RolesConfigureOpTemplate) Configure

type RolesConfigureOperation

type RolesConfigureOperation struct {
	Roles []RolePrivilegeEntry `refContract:"882" list:"true"`
}

func (RolesConfigureOperation) ContractCode

func (r RolesConfigureOperation) ContractCode() int32

func (RolesConfigureOperation) ContractName

func (r RolesConfigureOperation) ContractName() string

func (RolesConfigureOperation) Description

func (r RolesConfigureOperation) Description() string

type RolesConfigurer

type RolesConfigurer interface {
	RolesConfigure
	// contains filtered or unexported methods
}

type RolesPolicy

type RolesPolicy int8

多角色策略 表示如何处理一个对象被赋予多个角色时的综合权限

const (
	UNION RolesPolicy = iota
	INTERSECT
)

func (RolesPolicy) ContractCode

func (r RolesPolicy) ContractCode() int32

func (RolesPolicy) ContractName

func (r RolesPolicy) ContractName() string

func (RolesPolicy) ContractType

func (r RolesPolicy) ContractType() string

func (RolesPolicy) ContractVersion

func (r RolesPolicy) ContractVersion() int64

func (RolesPolicy) Description

func (r RolesPolicy) Description() string

func (RolesPolicy) GetValue

func (r RolesPolicy) GetValue(CODE int32) binary_proto.EnumContract

func (RolesPolicy) GetValueByName

func (r RolesPolicy) GetValueByName(name string) binary_proto.EnumContract

type SecurityOperationBuilder

type SecurityOperationBuilder struct {
	// contains filtered or unexported fields
}

func NewSecurityOperationBuilder

func NewSecurityOperationBuilder(factory *BlockchainOperationFactory) *SecurityOperationBuilder

func (*SecurityOperationBuilder) Authorziations

func (sob *SecurityOperationBuilder) Authorziations() UserAuthorizer

func (*SecurityOperationBuilder) Roles

type SecurityOperator

type SecurityOperator interface {
	Security() *SecurityOperationBuilder
}

type State

type State byte
const (
	// 可操作
	OPERABLE State = iota
	// 就绪
	PREPARED
	// 已提交
	COMMITTED
	// 已关闭
	CLOSED
)

type StatefulPreparedTx

type StatefulPreparedTx struct {
	*PreparedTx
	// contains filtered or unexported fields
}

func NewStatefulPreparedTx

func NewStatefulPreparedTx(tx *PreparedTx, stateManager *TxStateManager) *StatefulPreparedTx

func (*StatefulPreparedTx) Commit

type TransactionBuilder

type TransactionBuilder interface {
	ClientOperator

	GetLedgerHash() framework.HashDigest

	// 基于当前的系统时间完成交易定义,并生成就绪的交易数据
	// 调用此方法后,不能再向当前对象加入更多的操作
	PrepareRequestNow() TransactionRequestBuilder

	// 生成交易内容
	PrepareContentNow() TransactionContent

	// 基于当前的系统时间完成交易定义,并生成就绪的交易数据
	PrepareRequest(time int64) TransactionRequestBuilder

	// 生成交易内容
	PrepareContent(time int64) TransactionContent
}

区块链交易模板

type TransactionContent

type TransactionContent struct {
	LedgerHash []byte                      `primitiveType:"BYTES"`
	Operations []binary_proto.DataContract `refContract:"768" genericContract:"true" list:"true"`
	Timestamp  int64                       `primitiveType:"INT64"`
}

func NewTransactionContent

func NewTransactionContent(ledgerHash framework.HashDigest, operations []binary_proto.DataContract, time int64) TransactionContent

func (TransactionContent) ContractCode

func (t TransactionContent) ContractCode() int32

func (TransactionContent) ContractName

func (t TransactionContent) ContractName() string

func (TransactionContent) Description

func (t TransactionContent) Description() string

type TransactionPermission

type TransactionPermission int8

func (TransactionPermission) ContractCode

func (t TransactionPermission) ContractCode() int32

func (TransactionPermission) ContractName

func (t TransactionPermission) ContractName() string

func (TransactionPermission) ContractType

func (t TransactionPermission) ContractType() string

func (TransactionPermission) ContractVersion

func (t TransactionPermission) ContractVersion() int64

func (TransactionPermission) Description

func (t TransactionPermission) Description() string

func (TransactionPermission) GetValue

func (TransactionPermission) GetValueByName

func (t TransactionPermission) GetValueByName(name string) binary_proto.EnumContract

type TransactionPrivilegeBitset

type TransactionPrivilegeBitset struct {
	Privilege       []TransactionPermission
	PermissionCount int32
}

type TransactionRequest

type TransactionRequest struct {
	TransactionHash    []byte             `primitiveType:"BYTES"`
	TransactionContent TransactionContent `refContract:"512"`
	EndpointSignatures []DigitalSignature `refContract:"2864" list:"true"`
	NodeSignatures     []DigitalSignature `refContract:"2864" list:"true"`
}

func NewTransactionRequest

func NewTransactionRequest(transactionHash []byte, content TransactionContent) TransactionRequest

func (*TransactionRequest) AddEndpointSignatures

func (t *TransactionRequest) AddEndpointSignatures(signature DigitalSignature)

func (*TransactionRequest) ContainsEndpointSignature

func (t *TransactionRequest) ContainsEndpointSignature(pubKey []byte) bool

func (TransactionRequest) ContractCode

func (t TransactionRequest) ContractCode() int32

func (TransactionRequest) ContractName

func (t TransactionRequest) ContractName() string

func (TransactionRequest) Description

func (t TransactionRequest) Description() string

type TransactionRequestBuilder

type TransactionRequestBuilder interface {
	GetTransactionHash() framework.HashDigest

	GetTransactionContent() TransactionContent

	SignAsEndpoint(keyPair framework.AsymmetricKeypair) DigitalSignature

	SignAsNode(keyPair framework.AsymmetricKeypair) DigitalSignature

	AddEndpointSignature(signature DigitalSignature)

	AddNodeSignature(signature DigitalSignature)

	BuildRequest() TransactionRequest
}

已就绪的交易

type TransactionResponse

type TransactionResponse struct {
	ContentHash []byte `primitiveType:"BYTES"`

	ExecutionState TransactionState `refEnum:"2850"`

	BlockHash []byte `primitiveType:"BYTES"`

	BlockHeight int64 `primitiveType:"INT64"`

	Success bool `primitiveType:"BOOLEAN"`

	OperationResults []OperationResult `refContract:"880" list:"true"`
}

func (TransactionResponse) ContractCode

func (t TransactionResponse) ContractCode() int32

func (TransactionResponse) ContractName

func (t TransactionResponse) ContractName() string

func (TransactionResponse) Description

func (t TransactionResponse) Description() string

type TransactionResult

type TransactionResult struct {
	TransactionHash  []byte             `primitiveType:"BYTES"`
	BlockHeight      int64              `primitiveType:"INT64"`
	ExecutionState   TransactionState   `refEnum:"2850"`
	OperationResults []OperationResult  `refContract:"880" list:"true"`
	DataSnapshot     LedgerDataSnapshot `refContract:"304"`
}

func (TransactionResult) ContractCode

func (t TransactionResult) ContractCode() int32

func (TransactionResult) ContractName

func (t TransactionResult) ContractName() string

func (TransactionResult) Description

func (t TransactionResult) Description() string

type TransactionService

type TransactionService interface {
	Process(txRequest TransactionRequest) (TransactionResponse, error)
}

type TransactionState

type TransactionState int8

交易(事务)执行状态

func (TransactionState) ContractCode

func (t TransactionState) ContractCode() int32

func (TransactionState) ContractName

func (t TransactionState) ContractName() string

func (TransactionState) ContractType

func (t TransactionState) ContractType() string

func (TransactionState) ContractVersion

func (t TransactionState) ContractVersion() int64

func (TransactionState) Description

func (t TransactionState) Description() string

func (TransactionState) GetValue

func (TransactionState) GetValueByName

func (t TransactionState) GetValueByName(name string) binary_proto.EnumContract

type TransactionTemplate

type TransactionTemplate interface {
	ClientOperator
	GetLedgerHash() framework.HashDigest
	Prepare() PreparedTransaction
}

type TxBuilder

type TxBuilder struct {
	// contains filtered or unexported fields
}

func NewTxBuilder

func NewTxBuilder(ledgerHash framework.HashDigest, hashAlgorithm framework.CryptoAlgorithm) *TxBuilder

func (*TxBuilder) ContractEvents

func (t *TxBuilder) ContractEvents() *ContractEventSendOperationBuilder

func (*TxBuilder) Contracts

func (*TxBuilder) DataAccount

func (t *TxBuilder) DataAccount(accountAddress []byte) *DataAccountKVSetOperationBuilder

func (*TxBuilder) DataAccounts

func (*TxBuilder) EventAccount

func (t *TxBuilder) EventAccount(accountAddress []byte) *EventPublishOperationBuilder

func (*TxBuilder) EventAccounts

func (t *TxBuilder) EventAccounts() *EventAccountRegisterOperationBuilder

func (*TxBuilder) GetLedgerHash

func (t *TxBuilder) GetLedgerHash() framework.HashDigest

func (*TxBuilder) Participants

func (*TxBuilder) PrepareContent

func (t *TxBuilder) PrepareContent(time int64) TransactionContent

func (*TxBuilder) PrepareContentNow

func (t *TxBuilder) PrepareContentNow() TransactionContent

func (*TxBuilder) PrepareRequest

func (t *TxBuilder) PrepareRequest(time int64) TransactionRequestBuilder

func (*TxBuilder) PrepareRequestNow

func (t *TxBuilder) PrepareRequestNow() TransactionRequestBuilder

func (*TxBuilder) Security

func (t *TxBuilder) Security() *SecurityOperationBuilder

func (*TxBuilder) States

func (*TxBuilder) Users

type TxRequestBuilder

type TxRequestBuilder struct {
	// contains filtered or unexported fields
}

func NewTxRequestBuilder

func NewTxRequestBuilder(transactionHash framework.HashDigest, txContent TransactionContent) *TxRequestBuilder

func (*TxRequestBuilder) AddEndpointSignature

func (t *TxRequestBuilder) AddEndpointSignature(signature DigitalSignature)

func (*TxRequestBuilder) AddNodeSignature

func (t *TxRequestBuilder) AddNodeSignature(signature DigitalSignature)

func (*TxRequestBuilder) BuildRequest

func (t *TxRequestBuilder) BuildRequest() TransactionRequest

func (*TxRequestBuilder) GetTransactionContent

func (t *TxRequestBuilder) GetTransactionContent() TransactionContent

func (*TxRequestBuilder) GetTransactionHash

func (t *TxRequestBuilder) GetTransactionHash() framework.HashDigest

func (*TxRequestBuilder) SignAsEndpoint

func (t *TxRequestBuilder) SignAsEndpoint(keyPair framework.AsymmetricKeypair) DigitalSignature

func (*TxRequestBuilder) SignAsNode

type TxStateManager

type TxStateManager struct {
	// contains filtered or unexported fields
}

func NewTxStateManager

func NewTxStateManager() *TxStateManager

type TxTemplate

type TxTemplate struct {
	// contains filtered or unexported fields
}

func NewTxTemplate

func NewTxTemplate(ledgerHash framework.HashDigest, hashAlgorithm framework.CryptoAlgorithm, txService TransactionService) *TxTemplate

func (*TxTemplate) ContractEvents

func (t *TxTemplate) ContractEvents() *ContractEventSendOperationBuilder

func (*TxTemplate) Contracts

func (*TxTemplate) DataAccount

func (t *TxTemplate) DataAccount(accountAddress []byte) *DataAccountKVSetOperationBuilder

func (*TxTemplate) DataAccounts

func (*TxTemplate) EventAccount

func (t *TxTemplate) EventAccount(accountAddress []byte) *EventPublishOperationBuilder

func (*TxTemplate) EventAccounts

func (*TxTemplate) GetLedgerHash

func (t *TxTemplate) GetLedgerHash() framework.HashDigest

func (*TxTemplate) Participants

func (*TxTemplate) Prepare

func (t *TxTemplate) Prepare() PreparedTransaction

func (*TxTemplate) Security

func (t *TxTemplate) Security() *SecurityOperationBuilder

func (*TxTemplate) States

func (*TxTemplate) Users

type TypedKVEntry

type TypedKVEntry struct {
	// 键名
	Key string
	// 版本
	Version int64
	// 数据类型
	Type DataType
	// 值
	Value interface{}
}

type UserAccountHeader

type UserAccountHeader struct {
	BlockchainIdentity
}

func (UserAccountHeader) ContractCode

func (b UserAccountHeader) ContractCode() int32

func (UserAccountHeader) ContractName

func (b UserAccountHeader) ContractName() string

func (UserAccountHeader) Description

func (b UserAccountHeader) Description() string

type UserAuthorize

type UserAuthorize interface {
	ForUser(users [][]byte) UserRolesAuthorizer
}

type UserAuthorizeOpTemplate

type UserAuthorizeOpTemplate struct {
	*UserAuthorizeOperation
	// contains filtered or unexported fields
}

func NewUserAuthorizeOpTemplate

func NewUserAuthorizeOpTemplate() *UserAuthorizeOpTemplate

func (*UserAuthorizeOpTemplate) ForUser

func (u *UserAuthorizeOpTemplate) ForUser(users [][]byte) UserRolesAuthorizer

type UserAuthorizeOperation

type UserAuthorizeOperation struct {
	UserRolesAuthorizations []UserRolesEntry `refContract:"884" list:"true"`
}

角色配置操作

func (UserAuthorizeOperation) ContractCode

func (u UserAuthorizeOperation) ContractCode() int32

func (UserAuthorizeOperation) ContractName

func (u UserAuthorizeOperation) ContractName() string

func (UserAuthorizeOperation) Description

func (u UserAuthorizeOperation) Description() string

type UserAuthorizer

type UserAuthorizer interface {
	UserAuthorize
	// contains filtered or unexported methods
}

type UserInfo

type UserInfo struct {
	UserAccountHeader
}

func (UserInfo) ContractCode

func (b UserInfo) ContractCode() int32

func (UserInfo) ContractName

func (b UserInfo) ContractName() string

func (UserInfo) Description

func (b UserInfo) Description() string

type UserOperator

type UserOperator interface {
	Users() *UserRegisterOperationBuilder
}

type UserRegisterOperation

type UserRegisterOperation struct {
	UserID BlockchainIdentity `refContract:"144"`
}

func (UserRegisterOperation) ContractCode

func (u UserRegisterOperation) ContractCode() int32

func (UserRegisterOperation) ContractName

func (u UserRegisterOperation) ContractName() string

func (UserRegisterOperation) Description

func (u UserRegisterOperation) Description() string

type UserRegisterOperationBuilder

type UserRegisterOperationBuilder struct {
	// contains filtered or unexported fields
}

func NewUserRegisterOperationBuilder

func NewUserRegisterOperationBuilder(factory *BlockchainOperationFactory) *UserRegisterOperationBuilder

func (*UserRegisterOperationBuilder) Register

type UserRolesAuthorizer

type UserRolesAuthorizer interface {
	UserAuthorize

	Authorize(role string) UserRolesAuthorizer

	Unauthorize(role string) UserRolesAuthorizer

	SetPolicy(rolePolicy RolesPolicy) UserRolesAuthorizer
}

type UserRolesEntry

type UserRolesEntry struct {
	// 用户地址
	Addresses [][]byte `primitiveType:"BYTES" list:"true"`

	// 要更新的多角色权限策略
	Policy RolesPolicy `refEnum:"1027"`

	// 授权的角色清单
	AuthorizedRoles []string `primitiveType:"TEXT" list:"true"`

	// 取消授权的角色清单
	UnauthorizedRoles []string `primitiveType:"TEXT" list:"true"`
}

func (UserRolesEntry) ContractCode

func (u UserRolesEntry) ContractCode() int32

func (UserRolesEntry) ContractName

func (u UserRolesEntry) ContractName() string

func (UserRolesEntry) Description

func (u UserRolesEntry) Description() string

type UserRolesPrivileges

type UserRolesPrivileges struct {
	UserAddress                 []byte
	UserRoles                   []string
	LedgerPrivilegesBitset      LedgerPrivilegeBitset
	TransactionPrivilegesBitset TransactionPrivilegeBitset
}

* Author: imuge * Date: 2020/6/28 下午2:29

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL