All Products
Search
Document Center

Blockchain as a Service:Data Model

Last Updated:May 28, 2019

The SDK of the contract blockchain of Ant Blockchain involves eight data models:

Account Model

The account model stores account information including the account address, the account balance, and the account weight.

  • Account
Parameter Type Description
identity Identity The business ID of the account.
balance long The balance.
authMap AuthMap The public key and weight value of an account or a smart contract.
recoverKey PublicKey The recovery public key that is used when the private key is lost.
recoverTimestamp long The last recovery time.
status ObjectStatus The status of the object. 0: NORMAL. 1: FREEZE. 2: RECOVERING.
encryptionKey String The public key used to encrypt the transaction amount in a smart contract.

Contract Model

  • Contract
Parameter Type Description
identity Identity The business ID of the account.
balance long The balance.
authMap AuthMap The public key and weight value of an account or a smart contract.
recoverKey PublicKey The recovery public key that is used when the private key is lost.
recoverTimestamp long The last recovery time.
status ObjectStatus The status of the object. 0: NORMAL. 1: FREEZE. 2: RECOVERING.
encryptionKey String The public key that is used to encrypt the transaction amount in a smart contract.
storageRoot Identity The root node hash of the Merkle tree in the world state.
codeHash Identity The smart contract code hash.
code byte[] The smart contract code.

Transaction Model

TransactionDO displays all information of a transaction. But the required parameters vary with the request types. When you use the SDK, you do not need to construct TransactionDO. You can directly use the corresponding service.

  • TransacitonDO
Parameter Type Description
hash String The transaction hash composed of all fields excluding the signature field.
type TransactionType The type of the transaction.
timestamp long The timestamp of the transaction.
nonce Fixed64BitUnsignedInteger Prevents replay attacks.
period long The time in milliseconds when the transaction starts or ends. This parameter can be extended.
from String The sender of the transaction.
to String The recipient of the transaction.
value Fixed64BitUnsignedInteger The transferred amount.
gas Fixed64BitUnsignedInteger The transaction fee paid by the source account for the transaction.
data byte[] The encoding of the transaction data.
signatureList List The signature list. You can obtain this list by signing the hash using one or multiple private keys.
groupId Fixed20ByteArray The transaction is executed in a transaction group.
extensions List This field is used as the proof of work in a smart contract.

Receipt Model

A transaction is completed when it is added to a block, and you can query the transaction receipt on the client. The transaction receipt model includes the following elements:

  • TransactionReceipt
Parameter Type Description
result long The transaction result.
gasUsed BigInteger The transaction fee paid by the source account for a transaction.
logs List The logs of transaction executions.
output byte[] The output of the smart contract.

Log Model

The log model is a storage structure for output log entries.

  • LogEntry
Parameter Type Description
from String The sender of the transaction.
to String The recipient of the transaction.
topics List The subscribed topics.
logData byte[] The log data generated by the transaction.

Block Model

A block is divided into two parts: the block header and the block body.

  • Block
Parameter Type Description
blockHeader BlockHeader The block header.
blockBody blockBody The block body.
  • Blockheader
Parameter Type Description
hash String The block header hash.
version long The version of the block header.
number BigInteger The block number.
parentHash String The previous block hash.
transactionRoot String The root node hash of the Merkle tree generated by the transaction in the block body.
receiptRoot String The root node hash of the Merkle tree generated by the receipts in the block body.
stateRoot String The root node hash of the Merkle tree in the world state.
gasUsed BigInteger The total gas consumed by transactions.
timestamp long The timestamp.
logBloom String Log’s Bloom filter.
  • BlockBody
Parameter Type Description
transactionList List The transaction list.
receiptList List The receipt list.
consensusProof byte[] The consensus proof.
  • MychainEnv
Parameter Type Description
identity String The name of the SDK instance.
clientType ClientTypeEnum The type of the network connection.
hashType HashTypeEnum The type of the hash algorithm.
signType SignTypeEnum The type of the signature algorithm.
codecType CodecTypeEnum The encoding type of the data.
socketAddress SocketAddress The primary node.
sslOption ISslOption The configurations for TLS connection.
backups List The backup nodes. Not required.
  • SslBytesOption
Parameter Type Description
keyBytes byte[] The private key array on the client.
certBytes byte[] The certificate array on the client.
keyPassword String The key password on the client.
trustStoreBytes byte[] The CA certificate byte array.
trustStorePassword String The password of the CA certificate.
userPrivateKey PrivateKey The key that is used to sign transactions. It is required.

Common Extension Parameters

  • MychainParams
Parameter Type Description
privateKeyList List Optional. The private key list required to execute a transaction.
gas BigInteger Required. The gas set for a transaction.
localBlockNumber BigInteger Optional. The specified block number of a local transaction.
type EnvelopeType.DEFAULT Optional. The field required for data isolation. It is set to DEFAULT by default.
envelopePublicKey String Optional. The public key used for data isolation and encryption.
groupId Fixed20ByteArray Optional. The group ID to be executed for data isolation.
extensions List Optional. The specified extension parameters required for privacy protection.
  • BaseApiRequest
Parameter Type Description
mychainParams MychainParams Optional. An extended data structure suitable for the SDK.
timestamp long Optional. The timestamp of the transaction.
period long Optional. The time in milliseconds when the transaction starts or ends.
nonce Fixed64BitUnsignedInteger Optional. Prevents replay attacks.