Documentation ¶
Overview ¶
Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func BytesToI64(b []byte) (int64, error)
- func BytesToU64(b []byte) (uint64, error)
- func CheckProposalRequestResp(resp *common.TxResponse, needContractResult bool) error
- func DecryptHibeTx(localId string, hibeParams []byte, hibePrvKey []byte, tx *common.Transaction, ...) ([]byte, error)
- func Exists(path string) bool
- func GetCertificateId(certPEM []byte, hashType string) ([]byte, error)
- func GetCertificateIdFromDER(certDER []byte, hashType string) ([]byte, error)
- func GetNanoByTimestampTxId(timestampTxId string) (nano int64, err error)
- func GetRandTxId() string
- func GetTimestampTxId() string
- func GetTimestampTxIdByNano(nano int64) string
- func I64ToBytes(i int64) []byte
- func InitConfig(confPath string) error
- func IsArchived(txStatusCode common.TxStatusCode) bool
- func IsArchivedString(txStatusCode string) bool
- func MakeEndorser(orgId string, hashType crypto.HashType, memberType accesscontrol.MemberType, ...) (*common.EndorsementEntry, error)
- func MakeEndorserWithPath(keyFilePath, crtFilePath string, payload *common.Payload) (*common.EndorsementEntry, error)
- func MakeEndorserWithPathAndP11Handle(keyFilePath, crtFilePath string, p11Handle *pkcs11.P11Handle, ...) (*common.EndorsementEntry, error)
- func MakeEndorserWithPem(keyPem, certPem []byte, payload *common.Payload) (*common.EndorsementEntry, error)deprecated
- func MakePkEndorserWithPath(keyFilePath string, hashType crypto.HashType, orgId string, ...) (*common.EndorsementEntry, error)
- func MakePkEndorserWithPem(keyPem []byte, hashType crypto.HashType, orgId string, payload *common.Payload) (*common.EndorsementEntry, error)deprecated
- func NewEndorser(orgId string, certPem []byte, sig []byte) *common.EndorsementEntrydeprecated
- func NewEndorserWithMemberType(orgId string, memberInfo []byte, memberType accesscontrol.MemberType, ...) *common.EndorsementEntry
- func NewPayload(opts ...PayloadOption) *commonPb.Payload
- func NewPkEndorser(orgId string, pk []byte, sig []byte) *common.EndorsementEntry
- func ParseCert(crtPEM []byte) (*bcx509.Certificate, error)
- func ReadHibeParamsWithFilePath(hibeParamsFilePath string) ([]byte, error)
- func ReadHibePrvKeysWithFilePath(hibePrvKeyFilePath string) ([]byte, error)
- func SignPayload(privateKey crypto.PrivateKey, cert *bcx509.Certificate, ...) ([]byte, error)deprecated
- func SignPayloadBytes(privateKey crypto.PrivateKey, cert *bcx509.Certificate, payloadBytes []byte) ([]byte, error)deprecated
- func SignPayloadBytesWithHashType(privateKey crypto.PrivateKey, hashType crypto.HashType, payloadBytes []byte) ([]byte, error)
- func SignPayloadWithHashType(privateKey crypto.PrivateKey, hashType crypto.HashType, ...) ([]byte, error)
- func SignPayloadWithPath(keyFilePath, crtFilePath string, payload *common.Payload) ([]byte, error)
- func SignPayloadWithPkPath(keyFilePath, hashType string, payload *common.Payload) ([]byte, error)
- func U64ToBytes(i uint64) []byte
- type ChainClientConfigModel
- type Logger
- type PayloadOption
- func AddParameter(parameter *commonPb.KeyValuePair) PayloadOption
- func WithChainId(chainId string) PayloadOption
- func WithContractName(contractName string) PayloadOption
- func WithExpirationTime(expirationTime int64) PayloadOption
- func WithLimit(limit *commonPb.Limit) PayloadOption
- func WithMethod(method string) PayloadOption
- func WithParameters(parameters []*commonPb.KeyValuePair) PayloadOption
- func WithSequence(sequence uint64) PayloadOption
- func WithTimestamp(timestamp int64) PayloadOption
- func WithTxId(txId string) PayloadOption
- func WithTxType(txType commonPb.TxType) PayloadOption
Constants ¶
const ( // SUCCESS ContractResult success code SUCCESS uint32 = 0 // Separator chainmker hex ca Separator = byte(202) )
const ( HibeMsgKey = "hibe_msg" HibeMsgIdKey = "tx_id" HibeMsgCipherTextKey = "CT" HibeParamsKey = "org_id" HibeParamsValueKey = "params" )
hibe msg's Keys
const ( // System Block Contract keys KeyBlockContractWithRWSet = "withRWSet" KeyBlockContractBlockHash = "blockHash" KeyBlockContractBlockHeight = "blockHeight" KeyBlockContractTxId = "txId" // System Chain Config Contract keys KeyChainConfigContractRoot = "root" KeyChainConfigContractOrgId = "org_id" KeyChainConfigAddrType = "addr_type" KeyChainConfigContractNodeId = "node_id" KeyChainConfigContractNewNodeId = "new_node_id" KeyChainConfigContractNodeIds = "node_ids" KeyChainConfigContractBlockHeight = "block_height" KeyChainConfigContractTrustMemberOrgId = "org_id" KeyChainConfigContractTrustMemberInfo = "member_info" KeyChainConfigContractTrustMemberNodeId = "node_id" KeyChainConfigContractTrustMemberRole = "role" // CoreConfig keys KeyTxSchedulerTimeout = "tx_scheduler_timeout" KeyTxSchedulerValidateTimeout = "tx_scheduler_validate_timeout" // BlockConfig keys KeyTxTimeOut = "tx_timeout" KeyBlockTxCapacity = "block_tx_capacity" KeyBlockSize = "block_size" KeyBlockInterval = "block_interval" KeyTxParamterSize = "tx_parameter_size" // CertManage keys KeyCertHashes = "cert_hashes" KeyCerts = "certs" KeyCertCrl = "cert_crl" // PrivateCompute keys KeyOrderId = "order_id" KeyPrivateDir = "private_dir" KeyContractName = "contract_name" KeyCodeHash = "code_hash" KeyResult = "result" KeyCodeHeader = "code_header" KeyVersion = "version" KeyIsDeploy = "is_deploy" KeyRWSet = "rw_set" KeyEvents = "events" KeyReportHash = "report_hash" KeySign = "sign" KeyKey = "key" KeyPayload = "payload" KeyOrgIds = "org_ids" KeySignPairs = "sign_pairs" KeyCaCert = "ca_cert" KeyEnclaveId = "enclave_id" KeyReport = "report" KeyProof = "proof" KeyDeployReq = "deploy_req" KeyPrivateReq = "private_req" // PubkeyManage keys KeyPubkey = "pubkey" KeyPubkeyRole = "role" KeyPubkeyOrgId = "org_id" // Gas management KeyGasAddressKey = "address_key" KeyGasPublicKey = "public_key" KeyGasBatchRecharge = "batch_recharge" KeyGasBalancePublicKey = "balance_public_key" KeyGasChargePublicKey = "charge_public_key" KeyGasChargeGasAmount = "charge_gas_amount" KeyGasFrozenPublicKey = "frozen_public_key" )
nolint
const ( // ArchiveConfig consts MysqlDBNamePrefix = "cm_archived_chain" MysqlTableNamePrefix = "t_block_info" RowsPerBlockInfoTable = 100000 )
nolint
Variables ¶
This section is empty.
Functions ¶
func BytesToI64 ¶
func BytesToU64 ¶
func CheckProposalRequestResp ¶
func CheckProposalRequestResp(resp *common.TxResponse, needContractResult bool) error
func DecryptHibeTx ¶
func GetCertificateIdFromDER ¶
func GetNanoByTimestampTxId ¶
GetNanoByTimestampTxId validate and parse 160 ... 223 22
func GetRandTxId ¶
func GetRandTxId() string
func GetTimestampTxId ¶
func GetTimestampTxId() string
GetTimestampTxId by current time, see: GetTimestampTxIdByNano eg: 687dca1d9c4fdf1652fdfc072182654f53622c496aa94c05b47d34263cd99ec9
func GetTimestampTxIdByNano ¶
GetTimestampTxIdByNano nanosecond
func I64ToBytes ¶
func InitConfig ¶
func IsArchived ¶
func IsArchived(txStatusCode common.TxStatusCode) bool
func IsArchivedString ¶
func MakeEndorser ¶
func MakeEndorser(orgId string, hashType crypto.HashType, memberType accesscontrol.MemberType, keyPem, memberInfo []byte, payload *common.Payload) (*common.EndorsementEntry, error)
func MakeEndorserWithPath ¶
func MakeEndorserWithPem
deprecated
func MakePkEndorserWithPath ¶
func MakePkEndorserWithPem
deprecated
func NewEndorser
deprecated
func NewEndorser(orgId string, certPem []byte, sig []byte) *common.EndorsementEntry
Deprecated: This function will be deleted when appropriate. Please use NewEndorserWithMemberType
func NewEndorserWithMemberType ¶
func NewEndorserWithMemberType(orgId string, memberInfo []byte, memberType accesscontrol.MemberType, sig []byte) *common.EndorsementEntry
func NewPayload ¶
func NewPayload(opts ...PayloadOption) *commonPb.Payload
func NewPkEndorser ¶
func NewPkEndorser(orgId string, pk []byte, sig []byte) *common.EndorsementEntry
func ReadHibeParamsWithFilePath ¶
ReadHibeParamsWithFilePath Returns the serialized byte array of hibeParams
func ReadHibePrvKeysWithFilePath ¶
ReadHibePrvKeysWithFilePath Returns the serialized byte array of hibePrvKey
func SignPayload
deprecated
func SignPayload(privateKey crypto.PrivateKey, cert *bcx509.Certificate, payload *common.Payload) ([]byte, error)
Deprecated: This function will be deleted when appropriate. Please use SignPayloadWithHashType
func SignPayloadBytes
deprecated
func SignPayloadBytes(privateKey crypto.PrivateKey, cert *bcx509.Certificate, payloadBytes []byte) ([]byte, error)
Deprecated: This function will be deleted when appropriate. Please use SignPayloadBytesWithHashType
func SignPayloadWithHashType ¶
func SignPayloadWithPath ¶
func SignPayloadWithPkPath ¶
func U64ToBytes ¶
Types ¶
type ChainClientConfigModel ¶
type ChainClientConfigModel struct {
ChainClientConfig chainClientConfigModel `mapstructure:"chain_client"`
}
var Config *ChainClientConfigModel
Config global ChainClientConfigModel
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) }
type PayloadOption ¶
func AddParameter ¶
func AddParameter(parameter *commonPb.KeyValuePair) PayloadOption
AddParameter add one Parameter of payload
func WithChainId ¶
func WithChainId(chainId string) PayloadOption
WithChainId set chainId of payload
func WithContractName ¶
func WithContractName(contractName string) PayloadOption
WithContractName set ContractName of payload
func WithExpirationTime ¶
func WithExpirationTime(expirationTime int64) PayloadOption
WithExpirationTime set ExpirationTime of payload
func WithParameters ¶
func WithParameters(parameters []*commonPb.KeyValuePair) PayloadOption
WithParameters set Parameters of payload
func WithSequence ¶
func WithSequence(sequence uint64) PayloadOption
WithSequence set Sequence of payload
func WithTimestamp ¶
func WithTimestamp(timestamp int64) PayloadOption
WithTimestamp set Timestamp of payload
func WithTxType ¶
func WithTxType(txType commonPb.TxType) PayloadOption
WithTxType set TxType of payload