Categorychainmaker.org/chainmaker/utils/v2
modulepackage
2.3.6
Repository: https://git.chainmaker.org.cn/chainmaker/utils
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# Functions

AddPrefix add prefix to origin string, use delimiter :.
AttestationVerify attestation verify.
AttestationVerifyComponents attestation verify components.
BinaryToUint32 binary to uint32.
CalcBlockFingerPrint since the block has not yet formed,snapshot uses fingerprint as the possible unique value of the block.
CalcBlockFingerPrintWithoutTx 排除掉Tx的因素,计算Block的指纹,这样计算出来不管Block如何包含Tx,其指纹不变.
CalcBlockHash calculate block hash.
CalcDagHash calculate DAG hash.
CalcFingerPrint calculate finger print.
CalcPartialBlockHash calculate partial block bytes hash contains Header without BlockHash, ConsensusArgs, Signature.
CalcResultBytes get bytearray of result.
CalcRWSetHash calculate read-write set hash return (nil, nil) if read-write set is nil.
CalcRWSetRoot calculate txs' read-write set root hash, following the tx order in txs.
CalcTxHash calculate transaction hash, include tx.Payload, tx.signature, tx.Payload, tx.Result.
CalcTxHashWithVersion use version to judge if set tx gasUsed to zero when calc tx hash.
CalcTxRequestHash calculate hash of transaction request.
CalcTxResultHash calculate hash of transaction result.
CalcTxVerifyWorkers calculate work size of transaction verify.
CalcUnsignedTxBytes calculate unsigned transaction bytes [request payload bytes].
CalcUnsignedTxRequestBytes calculate unsigned transaction request bytes.
CanProposeEmptyBlock can empty blocks be packed.
CertToAddrInt create big.Int address by certificate.
CertToAddrStr create string address by certificate.
CheckChainIdFormat check chain id format.
CheckContractNameFormat check contract name format.
CheckEvmAddressFormat check evm address format.
CheckRootCertificate check the root certificate.
CheckTxIDFormat check tx id format.
CheckZxlAddrFormat check evm address format.
CreateGenesis create genesis block (with read-write set) based on chain config.
CurrentTimeMillisSeconds return current unix timestamp in milliseconds.
CurrentTimeSeconds return current unix timestamp in seconds.
DispatchTxVerifyTask dispatch transaction verify task.
FilterBlacklistTxs filter transactions with blacklist.
FilterBlockBlacklistEvents filter events in blacklist tx id.
FilterBlockBlacklistTxRWSet filter txRWSet in blacklist tx id.
FilterBlockBlacklistTxs filter transactions with blacklist.
FilterBlockTxs filter transactions with given sender org id.
FormatBlock format block into string.
FormatRWSet format rwset.
GenerateCreateTopicTableDdl generate create topic table.
GenerateInstallContractPayload generate install contract payload.
GenerateSaveBlockHeightWithTopicDdl generate save block height with topic.
GenerateSaveContractEventDdl generate save contract event.
GenerateUpdateBlockHeightIndexDdl generate update block height index.
GetBlockVersion 根据vX.Y.Z形势的字符串转换为int类型的BlockVersion @param cfgVersion @return uint32.
GetCertHash get certificate hash.
GetCertificateId get certificate id.
GetCertificateIdFromDER get certificate id from DER.
GetCertificateIdHex on input a certificate in PEM format, a hash algorithm(should be the one in chain configuration),output the identity of the certificate in the form of a string (under hexadecimal encoding).
GetConsensusArgsFromBlock get args from block.
GetContractByName get contract by name.
GetContractBytecode get contract bytecode.
GetContractByteCodeDbKey get contract byte code db key.
GetContractDbKey get contract db key.
GetContractMethodPayerDbKey return the key of contract + method => payer mapping.
GetContractMethodPayerPK return a payer public key of invoking contract.
GetContractMethodPayerPKFromAC return a payer public key of invoking contract.
GetIntAddrFromMember calculate Int address from protocol member.
GetIntAddrFromPbMember calculate Int address from pb member.
GetMemberPubKeySA get member public key.
GetNodeUidFromAddr get protocol.NodeUId from node's address.
GetRandTxId return hex string format random transaction id with length = 64.
GetRoleFromTx get role from tx.
GetSqlStatementCount 判断一个sql字符串是由多少条独立的SQL语句组成.
GetSqlTableName 获得SQL中使用到的表名,如果带有dbName.tableName,那么返回完整的dbName.tableName.
GetStrAddrFromMember calculate string address from protocol member.
GetStrAddrFromPbMember calculate string address from pb Member.
GetTimestampTxId return hex string format random transaction id with length = 64 GetTimestampTxId by current time, see: GetTimestampTxIdByNano eg: 687dca1d9c4fdf1652fdfc072182654f53622c496aa94c05b47d34263cd99ec9.
GetTimestampTxIdByNano nanosecond TODO TxId is generated linearly according to Nano.
GetTxIds get tx ids.
GetTxIdWithSeed return tx-id with seed.
GetTxResourceName return the resource name this tx want to operate.
GrapheneAttestationVerify graphene attestation verify.
GZipCompressBytes compress bytes with GZip(BestSpeed mode).
GZipDeCompressBytes decompress bytes with GZip.
HasDPosTxWritesInHeader check if header has DPoS tx writes.
IsAllBlank args type only string/[]byte.
IsAnyBlank args type only string/[]byte.
IsCertManagementTx the transaction is a cert management transaction or not.
IsConfBlock is it a configuration block.
IsConfigTx the transaction is a config transaction or not separate blocks are required.
IsContractManagementTx the transaction is a contract management transaction or not.
IsContractMgmtBlock check is contract management block.
IsContractMgmtTx 是否是合约安装、升级的交易.
IsDagEqual compare two DAG by bytes.
IsEmptyBlock is it a empty block.
IsManageContractAsConfigTx Whether the Manager Contract is considered a configuration transaction.
IsManagementTx the transaction is a management transaction or not separate blocks are required.
IsMultiSignManagementTx the transaction is a multi sign management transaction or not.
IsNativeContract return is native contract name.
IsNativeTx check tx is a native contract invoke tx.
IsPubKeyManagementTx the transaction is a pub key management transaction or not.
IsValidConfigTx the transaction is a valid config transaction or not.
NameToAddrInt create big.Int address by name.
NameToAddrStr create string address by name.
NewBigInteger create a BigInteger.
NewZeroBigInteger create a BigInteger of zero.
ParseCert convert bytearray to certificate.
ParsePkFromPbMember parse public key from member.
PkToAddrInt create big.Int address by pk.
PkToAddrStr crete string address by pk.
RearrangeRWSet rearrange rwSetMap into slice by block.Txs order.
SignBlock sign the block (in fact, here we sign block hash...) with signing member return hash bytes and signature bytes.
Sub subtracts two big integer.
Sum adds two big integer.
ToCamelCase as: abc_def -> AbcDef.
Uint32ToBinary uint32 to binary.
UnmarshalJsonStrKV2KVPairs 传入一个json字符串,该字符串key value都是string,转换为系统需要的KeyValuePair列表.
UpdateField set the key in data by params[key] to struct public field return if the field has been changed such as key->field: block_height -> BlockHeight.
VerifyBlockSig verify block proposer and signature.
VerifyCertIssue verify that the certificate is issued by the root/intermediate certificate caCerts caCert list, caCert means cert []byte(string).
VerifyTxWithoutPayload verify a transaction with access control provider.The payload of the transaction will not be verified.

# Constants

DecBase 10.
DPosOrgId DPoS org id.
KLV_LENGTH_SIZE 4.
NativePrefix black list profix.
PrefixContractByteCode prefix of contract bytecode.
PrefixContractInfo prefix of contract info.
PrefixContractMethodPayer prefix of contract method's payer address.
Separator split the contract and method.
TopicTableColumnDdl describe topic table column.
TopicTableIndex describe topic table index.
TopicTableUniqueKey describe topic table unique key.
Violation black list message.

# Variables

OidKeyBag oid key bag.

# Structs

BigInteger wrapper for big.Int.
ERC20Config for DPoS.
StakeConfig defines stake config.
TEEProof TEE proof.

# Interfaces

MemberGetter member getter interface.

# Type aliases

BlockFingerPrint alias for string.