ledger_model

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0, MIT Imports: 14 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)
	// 更新用户状态
	UPDATE_USER_STATE = LedgerPermission(0x0F)
	// 更新根证书
	UPDATE_ROOT_CA = LedgerPermission(0x10)
	// 更新用户证书
	UPDATE_USER_CA = LedgerPermission(0x11)
	// 更新合约状态
	UPDATE_CONTRACT_STATE = LedgerPermission(0x12)
)
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)
	// 事件账户不存在
	EVENT_ACCOUNT_DOES_NOT_EXIST = TransactionState(0x07)
	// 合约部署时版本冲突
	CONTRACT_VERSION_CONFLICT = TransactionState(0x08)
	// 账户状态错误
	ILLEGAL_ACCOUNT_STATE = TransactionState(0x09)
	// 合约执行错误
	CONTRACT_EXECUTE_ERROR = TransactionState(0x10)
	// 被安全策略拒绝
	REJECTED_BY_SECURITY_POLICY = TransactionState(0x11)
	// 账户注册冲突
	ACCOUNT_REGISTER_CONFLICT = TransactionState(0x12)
	// 角色不存在
	ROLE_DOES_NOT_EXIST = TransactionState(0x13)
	// 不支持的HASH算法
	UNSUPPORTED_HASH_ALGORITHM = TransactionState(0x14)
	// 合约方法不存在
	CONTRACT_METHOD_NOT_FOUND = TransactionState(0x15)
	//合约参数错误
	CONTRACT_PARAMETER_ERROR = TransactionState(0x16)
	// 由于在错误的账本上执行交易而被忽略
	IGNORED_BY_WRONG_LEDGER = TransactionState(0x40)
	// 由于交易内容的验签失败而忽略
	IGNORED_BY_ILLEGAL_CONTENT_SIGNATURE = TransactionState(0x41)
	// 由于交易内容哈希不一致而忽略
	IGNORED_BY_INCONSISTENT_CONTENT_HASH = TransactionState(0x42)
	// 由于交易的整体回滚而丢弃
	IGNORED_BY_TX_FULL_ROLLBACK = TransactionState(0x43)
	// 由于区块的整体回滚而丢弃
	IGNORED_BY_BLOCK_FULL_ROLLBACK = TransactionState(0x44)
	// 系统错误
	SYSTEM_ERROR = TransactionState(-128)
	// 超时
	TIMEOUT = TransactionState(-127)
	// 共识错误
	CONSENSUS_ERROR = TransactionState(-126)
	// 未收到共识网络响应的错误
	CONSENSUS_NO_REPLY_ERROR = TransactionState(-125)
	// 创建共识的代理客户端错误
	CONSENSUS_PROXY_CLIENT_ERROR = TransactionState(-124)
	// 空区块错误
	EMPTY_BLOCK_ERROR = TransactionState(-123)
	// 共识时间戳错误
	CONSENSUS_TIMESTAMP_ERROR = TransactionState(-122)
	// 账本参数丢失
	LEDGER_HASH_EMPTY = TransactionState(-48)
	// 不合法的合约包
	ILLEGAL_CONTRACT_CAR = TransactionState(-47)
	// 不合法的节点签名
	ILLEGAL_NODE_SIGNATURE = TransactionState(-46)
	// 没有终端签名
	NO_ENDPOINT_SIGNATURE = TransactionState(-45)
	// 终端签名验证不通过
	INVALID_ENDPOINT_SIGNATURE = TransactionState(-44)
)
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"           // 用户授权
	OperationTypeUserStateUpdate                  = "UserStateUpdateOperation"         // 用户状态变更
	OperationTypeContractStateUpdate              = "ContractStateUpdateOperation"     // 合约状态变更
	OperationTypeAccountPermissionSetOperation    = "AccountPermissionSetOperation"    // 账户权限变更
	OperationTypeUserCAUpdateOperation            = "UserCAUpdateOperation"            // 用户证书更新
	OperationTypeRootCAUpdateOperation            = "RootCAUpdateOperation"            // 根证书更新
	OperationTypeLedgerInitOperation              = "LedgerInitOperation"              // 账本初始化
	OperationTypeConsensusSettingsUpdateOperation = "ConsensusSettingsUpdateOperation" // 共识信息变更
	OperationTypeCryptoHashAlgoUpdateOperation    = "HashAlgorithmUpdateOperation"     // Hash算法变更

	// Consensus Providers
	BFTSMaRtConsensusProvider = "com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider"
	RaftConsensusProvider     = "com.jd.blockchain.consensus.raft.RaftConsensusProvider"
	MQConsensusProvider       = "com.jd.blockchain.consensus.mq.MsgQueueConsensusProvider"
)
View Source
const MAX_ROLE_NAMES = 20

Variables

This section is empty.

Functions

func ComputeTxContentHash

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

func FormatRoleName

func FormatRoleName(roleName string) string

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

func SignBytesWithPrivKey

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

func SignWithPrivKey

func SignWithPrivKey(hash *framework.HashDigest, privKey *framework.PrivKey) (*framework.SignatureDigest, error)

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 AccountPermissionSetOperation added in v1.3.0

type AccountPermissionSetOperation struct {
	Address     []byte      `primitiveType:"BYTES"`
	AccountType AccountType `refEnum:"3330"`
	Mode        int32       `primitiveType:"INT32"`
	Role        string      `primitiveType:"TEXT"`
}

func (AccountPermissionSetOperation) ContractCode added in v1.3.0

func (o AccountPermissionSetOperation) ContractCode() int32

func (AccountPermissionSetOperation) ContractName added in v1.3.0

func (o AccountPermissionSetOperation) ContractName() string

func (AccountPermissionSetOperation) Description added in v1.3.0

func (o AccountPermissionSetOperation) Description() string

type AccountPermissionSetOperationBuilder added in v1.3.0

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

func NewAccountPermissionSetOperationBuilder added in v1.3.0

func NewAccountPermissionSetOperationBuilder(accountType AccountType, address []byte, factory *BlockchainOperationFactory) *AccountPermissionSetOperationBuilder

func (*AccountPermissionSetOperationBuilder) Mode added in v1.3.0

func (*AccountPermissionSetOperationBuilder) Role added in v1.3.0

type AccountState added in v1.3.0

type AccountState int8

账户状态

const (
	// 正常
	NORMAL AccountState = iota + 1
	// 冻结
	FREEZE
	// 撤销/移除
	REVOKE
)

func (AccountState) ContractCode added in v1.3.0

func (as AccountState) ContractCode() int32

func (AccountState) ContractName added in v1.3.0

func (as AccountState) ContractName() string

func (AccountState) ContractType added in v1.3.0

func (as AccountState) ContractType() string

func (AccountState) ContractVersion added in v1.3.0

func (as AccountState) ContractVersion() int64

func (AccountState) Description added in v1.3.0

func (as AccountState) Description() string

func (AccountState) GetValue added in v1.3.0

func (as AccountState) GetValue(CODE int32) binary_proto.EnumContract

func (AccountState) GetValueByName added in v1.3.0

func (as AccountState) GetValueByName(name string) binary_proto.EnumContract

type AccountType added in v1.3.0

type AccountType int8
const (
	DATA AccountType = iota + 1
	EVENT
	CONTRACT
)

func (AccountType) ContractCode added in v1.3.0

func (r AccountType) ContractCode() int32

func (AccountType) ContractName added in v1.3.0

func (r AccountType) ContractName() string

func (AccountType) ContractType added in v1.3.0

func (r AccountType) ContractType() string

func (AccountType) ContractVersion added in v1.3.0

func (r AccountType) ContractVersion() int64

func (AccountType) Description added in v1.3.0

func (r AccountType) Description() string

func (AccountType) GetValue added in v1.3.0

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

func (AccountType) GetValueByName added in v1.3.0

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

type ActivateParticipantParams added in v1.3.3

type ActivateParticipantParams struct {
	LedgerHash         string
	ConsensusHost      string // 待激活节点共识地址
	ConsensusPort      int    // 待激活节点共识端口
	ConsensusSecure    bool   // 待激活节点共识服务是否启动安全连接
	RemoteManageHost   string // 数据同步节点地址
	RemoteManagePort   int    // 数据同步节点端口
	RemoteManageSecure bool   // 数据同步节点服务是否启动安全连接
	Shutdown           bool   // 是否停止旧的节点服务
}

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)

	// 获取账本算法配置信息
	GetLedgerCryptoSetting(ledgerHash *framework.HashDigest) (CryptoSetting, 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) (*DataAccountInfo, 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) (*EventAccountInfo, 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" json:"address"`
	PubKey  []byte `primitiveType:"BYTES" json:"pubkey"`
}

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, error)

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) Consensus added in v1.3.3

func (*BlockchainOperationFactory) Contract added in v1.3.0

func (*BlockchainOperationFactory) ContractEvents

func (*BlockchainOperationFactory) Contracts

func (*BlockchainOperationFactory) DataAccount

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

func (*BlockchainOperationFactory) DataAccounts

func (*BlockchainOperationFactory) EventAccount

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

func (*BlockchainOperationFactory) EventAccounts

func (*BlockchainOperationFactory) MetaInfo added in v1.3.0

func (*BlockchainOperationFactory) Participants

func (*BlockchainOperationFactory) Security

func (*BlockchainOperationFactory) Settings added in v1.3.3

func (*BlockchainOperationFactory) States

func (*BlockchainOperationFactory) User added in v1.3.0

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 ConsensusOperator added in v1.3.3

type ConsensusOperator interface {
	Consensus() *ConsensusSettingsUpdateOperationBuilder
}

type ConsensusSettingsUpdateOperation added in v1.3.0

type ConsensusSettingsUpdateOperation struct {
	Properties [][]byte `primitiveType:"BYTES" list:"true"`
	Provider   string   `primitiveType:"TEXT"`
}

func (ConsensusSettingsUpdateOperation) ContractCode added in v1.3.0

func (c ConsensusSettingsUpdateOperation) ContractCode() int32

func (ConsensusSettingsUpdateOperation) ContractName added in v1.3.0

func (c ConsensusSettingsUpdateOperation) ContractName() string

func (ConsensusSettingsUpdateOperation) Description added in v1.3.0

func (c ConsensusSettingsUpdateOperation) Description() string

type ConsensusSettingsUpdateOperationBuilder added in v1.3.3

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

func NewConsensusSettingsUpdateOperationBuilder added in v1.3.3

func NewConsensusSettingsUpdateOperationBuilder(factory *BlockchainOperationFactory) *ConsensusSettingsUpdateOperationBuilder

func (*ConsensusSettingsUpdateOperationBuilder) Update added in v1.3.3

func (*ConsensusSettingsUpdateOperationBuilder) UpdateWithConfigFile added in v1.3.4

func (ctuob *ConsensusSettingsUpdateOperationBuilder) UpdateWithConfigFile(provider string, configFile string) ConsensusSettingsUpdateOperation

type ContractCodeDeployOperation

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

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

	ChainCodeVersion int64 `primitiveType:"INT64"`

	Lang ContractLang `refEnum:"2561"`
}

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

func (*ContractCodeDeployOperationBuilder) DeployWithLang added in v1.3.3

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 NewContractEventSendOperationBuilder

func NewContractEventSendOperationBuilder(address []byte, factory *BlockchainOperationFactory) *ContractEventSendOperationBuilder

func NewDeprecatedContractEventSendOperationBuilder added in v1.3.0

func NewDeprecatedContractEventSendOperationBuilder(factory *BlockchainOperationFactory) *ContractEventSendOperationBuilder

func (*ContractEventSendOperationBuilder) Invoke added in v1.3.0

func (cesob *ContractEventSendOperationBuilder) Invoke(version int64, event string, args []interface{}) error

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

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"`
	ChainCodeVersion int64          `primitiveType:"INT64"`
	State            AccountState   `refEnum:"788"`
	Permission       DataPermission `json:"permission"`
	Lang             ContractLang   `refEnum:"2561"`
}

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 ContractLang added in v1.3.3

type ContractLang int8
const (
	Java ContractLang = iota + 1
	JavaScript
	Python
	Rust
)

func (ContractLang) ContractCode added in v1.3.3

func (r ContractLang) ContractCode() int32

func (ContractLang) ContractName added in v1.3.3

func (r ContractLang) ContractName() string

func (ContractLang) ContractType added in v1.3.3

func (r ContractLang) ContractType() string

func (ContractLang) ContractVersion added in v1.3.3

func (r ContractLang) ContractVersion() int64

func (ContractLang) Description added in v1.3.3

func (r ContractLang) Description() string

func (ContractLang) GetValue added in v1.3.3

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

func (ContractLang) GetValueByName added in v1.3.3

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

type ContractOperationBuilder added in v1.3.0

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

func NewContractOperationBuilder added in v1.3.0

func NewContractOperationBuilder(address []byte, factory *BlockchainOperationFactory) *ContractOperationBuilder

func (*ContractOperationBuilder) Invoke added in v1.3.0

func (cob *ContractOperationBuilder) Invoke(event string, args ...interface{}) error

func (*ContractOperationBuilder) InvokeWithVersion added in v1.3.4

func (cob *ContractOperationBuilder) InvokeWithVersion(version int64, event string, args ...interface{}) error

func (*ContractOperationBuilder) Permission added in v1.3.0

func (*ContractOperationBuilder) State added in v1.3.0

func (cob *ContractOperationBuilder) State(state AccountState)

type ContractOperator

type ContractOperator interface {

	// 部署合约
	Contracts() *ContractCodeDeployOperationBuilder

	// 合约更新操作
	Contract(address []byte) *ContractOperationBuilder

	// contract events
	ContractEvents() *ContractEventSendOperationBuilder
}

type ContractRuntimeConfig added in v1.3.3

type ContractRuntimeConfig struct {
	Timeout int64 `primitiveType:"INT64"`
}

func (ContractRuntimeConfig) ContractCode added in v1.3.3

func (c ContractRuntimeConfig) ContractCode() int32

func (ContractRuntimeConfig) ContractName added in v1.3.3

func (c ContractRuntimeConfig) ContractName() string

func (ContractRuntimeConfig) Description added in v1.3.3

func (c ContractRuntimeConfig) Description() string

type ContractStateUpdateOperation added in v1.3.0

type ContractStateUpdateOperation struct {
	ContractAddress []byte       `primitiveType:"BYTES"`
	State           AccountState `refEnum:"788"`
}

func (ContractStateUpdateOperation) ContractCode added in v1.3.0

func (u ContractStateUpdateOperation) ContractCode() int32

func (ContractStateUpdateOperation) ContractName added in v1.3.0

func (u ContractStateUpdateOperation) ContractName() string

func (ContractStateUpdateOperation) Description added in v1.3.0

func (u ContractStateUpdateOperation) Description() string

type ContractUpdateOperationBuilder added in v1.3.0

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

func NewContractUpdateOperationBuilder added in v1.3.0

func NewContractUpdateOperationBuilder(address []byte, factory *BlockchainOperationFactory) *ContractUpdateOperationBuilder

func (*ContractUpdateOperationBuilder) State added in v1.3.0

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 DataAccountInfo added in v1.3.0

type DataAccountInfo struct {
	*BlockchainIdentity
	// 数据权限
	Permission DataPermission `json:"permission"`
	// KV总数
	DataCount int64
}

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 DataAccountOperationBuilder added in v1.3.0

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

func NewDataAccountOperationBuilder added in v1.3.0

func NewDataAccountOperationBuilder(address []byte, factory *BlockchainOperationFactory) *DataAccountOperationBuilder

func (*DataAccountOperationBuilder) Permission added in v1.3.0

func (*DataAccountOperationBuilder) SetBytes added in v1.3.0

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

func (*DataAccountOperationBuilder) SetImage added in v1.3.0

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

func (*DataAccountOperationBuilder) SetInt64 added in v1.3.0

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

func (*DataAccountOperationBuilder) SetJSON added in v1.3.0

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

func (*DataAccountOperationBuilder) SetText added in v1.3.0

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

func (*DataAccountOperationBuilder) SetTimestamp added in v1.3.0

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

type DataAccountOperator

type DataAccountOperator interface {

	// 数据账户
	DataAccounts() *DataAccountRegisterOperationBuilder

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

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 DataPermission added in v1.3.0

type DataPermission struct {
	// 所属角色
	Role string `json:"role"`
	// 所属用户列表
	Owners []string `json:"owners"`
	// 权限值
	Mode string `json:"modeBits"`
}

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, error)

func SignBytes

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

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 EventAccountInfo added in v1.3.0

type EventAccountInfo struct {
	*BlockchainIdentity
	// 数据权限
	Permission DataPermission `json:"permission"`
	// KV总数
	DataCount int64
}

type EventAccountOperationBuilder added in v1.3.0

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

func NewEventAccountOperationBuilder added in v1.3.0

func NewEventAccountOperationBuilder(address []byte, factory *BlockchainOperationFactory) *EventAccountOperationBuilder

func (*EventAccountOperationBuilder) Permission added in v1.3.0

func (*EventAccountOperationBuilder) PublishBytes added in v1.3.0

func (eaob *EventAccountOperationBuilder) PublishBytes(key string, content []byte, sequence int64) *EventPublishOperationBuilder

func (*EventAccountOperationBuilder) PublishInt64 added in v1.3.0

func (eaob *EventAccountOperationBuilder) PublishInt64(key string, content int64, sequence int64) *EventPublishOperationBuilder

func (*EventAccountOperationBuilder) PublishString added in v1.3.0

func (eaob *EventAccountOperationBuilder) PublishString(key string, content string, sequence int64) *EventPublishOperationBuilder

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) *EventAccountOperationBuilder
}

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 GenesisUser added in v1.3.0

type GenesisUser struct {
	PubKey      []byte      `primitiveType:"BYTES"`
	Certificate string      `primitiveType:"TEXT"`
	Roles       []string    `primitiveType:"TEXT" list:"true"`
	RolesPolicy RolesPolicy `refEnum:"1027"`
}

创世用户信息

func (GenesisUser) ContractCode added in v1.3.0

func (u GenesisUser) ContractCode() int32

func (GenesisUser) ContractName added in v1.3.0

func (u GenesisUser) ContractName() string

func (GenesisUser) Description added in v1.3.0

func (u GenesisUser) Description() string

type HashAlgorithmUpdateOperation added in v1.3.3

type HashAlgorithmUpdateOperation struct {
	Algorithm string `primitiveType:"TEXT"`
}

func (HashAlgorithmUpdateOperation) ContractCode added in v1.3.3

func (c HashAlgorithmUpdateOperation) ContractCode() int32

func (HashAlgorithmUpdateOperation) ContractName added in v1.3.3

func (c HashAlgorithmUpdateOperation) ContractName() string

func (HashAlgorithmUpdateOperation) Description added in v1.3.3

func (c HashAlgorithmUpdateOperation) Description() string

type IdentityMode added in v1.3.0

type IdentityMode int8

身份认证模式

const (
	// 公私钥对模式
	KEYPAIR IdentityMode = iota + 1
	// 证书模式
	CA
)

func (IdentityMode) ContractCode added in v1.3.0

func (m IdentityMode) ContractCode() int32

func (IdentityMode) ContractName added in v1.3.0

func (m IdentityMode) ContractName() string

func (IdentityMode) ContractType added in v1.3.0

func (m IdentityMode) ContractType() string

func (IdentityMode) ContractVersion added in v1.3.0

func (m IdentityMode) ContractVersion() int64

func (IdentityMode) Description added in v1.3.0

func (m IdentityMode) Description() string

func (IdentityMode) GetValue added in v1.3.0

func (m IdentityMode) GetValue(CODE int32) binary_proto.EnumContract

func (IdentityMode) GetValueByName added in v1.3.0

func (m IdentityMode) GetValueByName(name string) binary_proto.EnumContract

type InactivateParticipantParams added in v1.3.3

type InactivateParticipantParams struct {
	LedgerHash         string
	ParticipantAddress string
}

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 LedgerDataStructure added in v1.3.0

type LedgerDataStructure int8

底层数据结构

const (
	// 正常
	MERKLE_TREE LedgerDataStructure = iota + 1
	// 冻结
	KV
)

func (LedgerDataStructure) ContractCode added in v1.3.0

func (ls LedgerDataStructure) ContractCode() int32

func (LedgerDataStructure) ContractName added in v1.3.0

func (ls LedgerDataStructure) ContractName() string

func (LedgerDataStructure) ContractType added in v1.3.0

func (ls LedgerDataStructure) ContractType() string

func (LedgerDataStructure) ContractVersion added in v1.3.0

func (ls LedgerDataStructure) ContractVersion() int64

func (LedgerDataStructure) Description added in v1.3.0

func (ls LedgerDataStructure) Description() string

func (LedgerDataStructure) GetValue added in v1.3.0

func (LedgerDataStructure) GetValueByName added in v1.3.0

func (ls LedgerDataStructure) GetValueByName(name string) binary_proto.EnumContract

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 LedgerInitOperation added in v1.3.0

type LedgerInitOperation struct {
	InitSetting LedgerInitSetting `refContract:"1552"`
}

func (LedgerInitOperation) ContractCode added in v1.3.0

func (lso LedgerInitOperation) ContractCode() int32

func (LedgerInitOperation) ContractName added in v1.3.0

func (lso LedgerInitOperation) ContractName() string

func (LedgerInitOperation) Description added in v1.3.0

func (lso LedgerInitOperation) Description() string

type LedgerInitSetting added in v1.3.0

type LedgerInitSetting struct {
	LedgerSeed             []byte                `primitiveType:"BYTES"`
	ConsensusParticipants  []*ParticipantNode    `refContract:"1569" list:"true"`
	CryptoSetting          CryptoSetting         `refContract:"1602"`
	ConsensusProvider      string                `primitiveType:"TEXT"`
	ConsensusSettings      []byte                `primitiveType:"BYTES"`
	CreatedTime            int64                 `primitiveType:"INT64"`
	LedgerStructureVersion int64                 `primitiveType:"INT64"`
	IdentityMode           IdentityMode          `refEnum:"1604"`
	LedgerCertificates     []string              `primitiveType:"TEXT" list:"true"`
	GenesisUsers           []GenesisUser         `refContract:"1605" list:"true"`
	LedgerDataStructure    LedgerDataStructure   `refEnum:"1606"`
	ContractRuntimeConfig  ContractRuntimeConfig `refEnum:"2562"`
}

账本初始配置

func (LedgerInitSetting) ContractCode added in v1.3.0

func (ls LedgerInitSetting) ContractCode() int32

func (LedgerInitSetting) ContractName added in v1.3.0

func (ls LedgerInitSetting) ContractName() string

func (LedgerInitSetting) Description added in v1.3.0

func (ls LedgerInitSetting) Description() string

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"`
	LedgerStructureVersion int64                 `primitiveType:"INT64"`
	IdentityMode           IdentityMode          `refEnum:"1604"`
	LedgerCertificates     []string              `primitiveType:"TEXT" list:"true"`
	GenesisUsers           []GenesisUser         `refContract:"1605" list:"true"`
	ContractRuntimeConfig  ContractRuntimeConfig `refEnum:"2562"`
}

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 MetaInfoOperator added in v1.3.0

type MetaInfoOperator interface {
	MetaInfo() *MetaInfoUpdateOperationBuilder
}

type MetaInfoUpdateOperationBuilder added in v1.3.0

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

func NewMetaInfoUpdateOperationBuilder added in v1.3.0

func NewMetaInfoUpdateOperationBuilder(factory *BlockchainOperationFactory) *MetaInfoUpdateOperationBuilder

func (*MetaInfoUpdateOperationBuilder) CA added in v1.3.0

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
	// 不可用
	DEACTIVATED
)

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"`
	ParticipantID   *BlockchainIdentity `refContract:"144"`
	Certificate     string              `primitiveType:"TEXT"`
}

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

func (*ParticipantRegisterOperationBuilder) RegisterWithCA added in v1.3.3

func (prob *ParticipantRegisterOperationBuilder) RegisterWithCA(participantName string, certificate *ca.Certificate) (*ParticipantRegisterOperation, error)

type ParticipantService added in v1.3.3

type ParticipantService interface {
	/**
	激活参与方
	*/
	ActivateParticipant(params ActivateParticipantParams) (bool, error)

	/**
	移除参与方
	*/
	InactivateParticipant(params InactivateParticipantParams) (bool, error)
}

type ParticipantStateUpdateOperation

type ParticipantStateUpdateOperation struct {
	ParticipantID *BlockchainIdentity  `refContract:"144"`
	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

type PreparedTransaction

type PreparedTransaction interface {
	GetHash() *framework.HashDigest

	GetTransactionContent() *TransactionContent

	Sign(keyPair *framework.AsymmetricKeypair) (*DigitalSignature, error)

	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 Properties added in v1.3.3

type Properties []Property

func LoadProperties added in v1.3.3

func LoadProperties(configFile string) Properties

type Property added in v1.3.0

type Property struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func (*Property) ToBytes added in v1.3.3

func (p *Property) ToBytes() []byte

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 RootCAUpdateOperation added in v1.3.0

type RootCAUpdateOperation struct {
	CertificatesAdd    []string `primitiveType:"TEXT" list:"true" json:"certificatesAdd"`
	CertificatesUpdate []string `primitiveType:"TEXT" list:"true" json:"certificatesUpdate"`
	CertificatesRemove []string `primitiveType:"TEXT" list:"true" json:"certificatesRemove"`
}

用户证书更新

func (RootCAUpdateOperation) ContractCode added in v1.3.0

func (u RootCAUpdateOperation) ContractCode() int32

func (RootCAUpdateOperation) ContractName added in v1.3.0

func (u RootCAUpdateOperation) ContractName() string

func (RootCAUpdateOperation) Description added in v1.3.0

func (u RootCAUpdateOperation) Description() string

type RootCAUpdateOperationBuilder added in v1.3.0

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

func NewRootCAUpdateOperationBuilder added in v1.3.0

func NewRootCAUpdateOperationBuilder(factory *BlockchainOperationFactory) *RootCAUpdateOperationBuilder

func (*RootCAUpdateOperationBuilder) Add added in v1.3.0

func (*RootCAUpdateOperationBuilder) Remove added in v1.3.0

func (*RootCAUpdateOperationBuilder) Update added in v1.3.0

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 SettingsOperationBuilder added in v1.3.3

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

func NewSettingsOperationBuilder added in v1.3.3

func NewSettingsOperationBuilder(factory *BlockchainOperationFactory) *SettingsOperationBuilder

func (*SettingsOperationBuilder) HashAlgorithm added in v1.3.3

func (ctuob *SettingsOperationBuilder) HashAlgorithm(hashAlgoName string) HashAlgorithmUpdateOperation

type SettingsOperator added in v1.3.3

type SettingsOperator interface {
	Settings() *SettingsOperationBuilder
}

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, error)

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

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

	// 生成交易内容
	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, error)

	SignAsNode(keyPair *framework.AsymmetricKeypair) (*DigitalSignature, error)

	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"`
	DerivedOperations []binary_proto.DataContract `refContract:"768" genericContract:"true" list:"true"`
}

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

func (TransactionState) ToString added in v1.3.3

func (t TransactionState) ToString() string

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) Consensus added in v1.3.3

func (*TxBuilder) Contract added in v1.3.0

func (t *TxBuilder) Contract(address []byte) *ContractOperationBuilder

func (*TxBuilder) ContractEvents

func (t *TxBuilder) ContractEvents() *ContractEventSendOperationBuilder

func (*TxBuilder) Contracts

func (*TxBuilder) DataAccount

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

func (*TxBuilder) DataAccounts

func (*TxBuilder) EventAccount

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

func (*TxBuilder) EventAccounts

func (t *TxBuilder) EventAccounts() *EventAccountRegisterOperationBuilder

func (*TxBuilder) GetLedgerHash

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

func (*TxBuilder) MetaInfo added in v1.3.0

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, error)

func (*TxBuilder) PrepareRequestNow

func (t *TxBuilder) PrepareRequestNow() (TransactionRequestBuilder, error)

func (*TxBuilder) Security

func (t *TxBuilder) Security() *SecurityOperationBuilder

func (*TxBuilder) Settings added in v1.3.3

func (t *TxBuilder) Settings() *SettingsOperationBuilder

func (*TxBuilder) States

func (*TxBuilder) User added in v1.3.0

func (t *TxBuilder) User(address []byte) *UserUpdateOperationBuilder

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, error)

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) Consensus added in v1.3.3

func (*TxTemplate) Contract added in v1.3.0

func (t *TxTemplate) Contract(address []byte) *ContractOperationBuilder

func (*TxTemplate) ContractEvents

func (t *TxTemplate) ContractEvents() *ContractEventSendOperationBuilder

func (*TxTemplate) Contracts

func (*TxTemplate) DataAccount

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

func (*TxTemplate) DataAccounts

func (*TxTemplate) EventAccount

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

func (*TxTemplate) EventAccounts

func (*TxTemplate) GetLedgerHash

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

func (*TxTemplate) MetaInfo added in v1.3.0

func (*TxTemplate) Participants

func (*TxTemplate) Prepare

func (t *TxTemplate) Prepare() PreparedTransaction

func (*TxTemplate) Security

func (t *TxTemplate) Security() *SecurityOperationBuilder

func (*TxTemplate) Settings added in v1.3.3

func (t *TxTemplate) Settings() *SettingsOperationBuilder

func (*TxTemplate) States

func (*TxTemplate) User added in v1.3.0

func (t *TxTemplate) User(address []byte) *UserUpdateOperationBuilder

func (*TxTemplate) Users

type TypedKVEntry

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

type UserAccountHeader

type UserAccountHeader struct {
	*BlockchainIdentity
	State       AccountState `refEnum:"788"`
	Certificate string       `primitiveType:"TEXT"`
}

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 UserCAUpdateOperation added in v1.3.0

type UserCAUpdateOperation struct {
	UserAddress []byte `primitiveType:"BYTES"`
	Certificate string `primitiveType:"TEXT"`
}

根证书更新

func (UserCAUpdateOperation) ContractCode added in v1.3.0

func (u UserCAUpdateOperation) ContractCode() int32

func (UserCAUpdateOperation) ContractName added in v1.3.0

func (u UserCAUpdateOperation) ContractName() string

func (UserCAUpdateOperation) Description added in v1.3.0

func (u UserCAUpdateOperation) Description() string

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

	User(address []byte) *UserUpdateOperationBuilder
}

type UserRegisterOperation

type UserRegisterOperation struct {
	UserID      *BlockchainIdentity `refContract:"144"`
	Certificate string              `primitiveType:"TEXT"`
}

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

func (*UserRegisterOperationBuilder) RegisterWithCA added in v1.3.0

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

type UserStateUpdateOperation added in v1.3.0

type UserStateUpdateOperation struct {
	UserAddress []byte       `primitiveType:"BYTES"`
	State       AccountState `refEnum:"788"`
}

func (UserStateUpdateOperation) ContractCode added in v1.3.0

func (u UserStateUpdateOperation) ContractCode() int32

func (UserStateUpdateOperation) ContractName added in v1.3.0

func (u UserStateUpdateOperation) ContractName() string

func (UserStateUpdateOperation) Description added in v1.3.0

func (u UserStateUpdateOperation) Description() string

type UserUpdateOperationBuilder added in v1.3.0

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

func NewUserUpdateOperationBuilder added in v1.3.0

func NewUserUpdateOperationBuilder(address []byte, factory *BlockchainOperationFactory) *UserUpdateOperationBuilder

func (*UserUpdateOperationBuilder) CA added in v1.3.0

func (*UserUpdateOperationBuilder) State added in v1.3.0

Source Files

Jump to

Keyboard shortcuts

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