All Products
Search
Document Center

Blockchain as a Service:Data model

Last Updated:May 08, 2020

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

Account model

The account model is an important concept in MyChain. The account address, balance, account weight, and other information are stored in the account model.

  • Account
Parameter Type Description
id Identity The account’s business ID.
balance long The balance.
authMap AuthMap The public key and weight of the account or contract.
recoverKey PublicKey The recovery public key used when the account private key is lost.
recoverTimestamp long The last successful recovery time.
status ObjectStatus The status. 0 indicates Normal, 1 indicates Freeze, and 2 indicates Recovering.
encryptionKey String The encryption public key for encrypting the transaction amount in a smart contract.

Contract model

The following describes basic contract parameters.

  • Contract
Parameter Type Description
id Identity The account’s business ID.
balance long The balance.
authMap AuthMap The public key and weight of the account or contract.
recoverKey PublicKey The recovery public key used when the account private key is lost.
recoverTimestamp long The last successful recovery time.
status ObjectStatus The status. 0 indicates Normal, 1 indicates Freeze, and 2 indicates Recovering.
encryptionKey String The encryption public key for encrypting the transaction amount in a smart contract.
storageRoot Identity The Merkle hash root of the world state.
codeHash Identity The contract code hash.
code byte[] The contract code.

Transaction model

A Transaction contains the complete information required for a transaction. Different request types may require different parameters. The SDK allows you to use a Service without needing to construct a Transaction.

  • Transaction
Parameter Type Description
hash String The transaction hash, which consists of all fields other than signature.
type TransactionType The transaction type.
timestamp long The transaction timestamp.
nonce Fixed64BitUnsignedInteger Prevents replay attacks.
period long The transaction start or end time, in milliseconds, used for future expansion.
from String The transaction sender.
to String The transaction recipient.
value Fixed64BitUnsignedInteger The transfer amount.
gas Fixed64BitUnsignedInteger The transaction execution cost.
data byte[] The transaction data code.
signatureList List<byte[]> The signature obtained by signing the hash with one or more private keys.
groupId Fixed20ByteArray The group where the transaction is executed.
extensions List The proof data currently used in a smart contract.
version short The version.

Receipt model

A transaction receipt proves that the block has been successfully delivered and that the transaction has been confirmed.

  • TransactionReceipt
Parameter Type Description
result long The transaction result.
gasUsed BigInteger The transaction execution cost.
logs List The collection of transaction execution logs.
output byte[] The contract ouput.

Log model

The LogEntry blockchain provides the data storage structure of logs.

  • LogEntry
Parameter Type Description
from String The transaction sender.
to String The transaction recipient.
topics List The subscribed topics, which are usually encoded in hexadecimal format.
logData byte[] The logs generated for a transaction.

Block model

A blockchain consists of blocks, each of which contains a block header and a 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.
number BigInteger The block number.
parentHash String The hash of the parent block.
transactionRoot String The Merkle hash root composed of transactions in the block body.
receiptRoot String The Merkle hash root composed of receipts in the block body.
stateRoot String The Merkle hash root of the world state.
gasUsed BigInteger The total consumption of transaction execution.
timestamp long The timestamp.
logBloom String The log Bloom filter.
  • BlockBody
Parameter Type Description
transactionList List The transaction list.
receiptList List The receipt list.
consensusProof byte[] The consensus proof.
  • ClientEnv
Parameter Type Description
signerOption SignerOption The signature configuration option.
sslOption ISslOption The TLS API, which contains the following implementation classes: SslBytesOption and SslOption.
networkOption NetworkOption The network configuration option.
requestOption RequestOption The message request configuration option.
logger ILogger The log API.
needPrivacy Boolean Specifies whether to enable privacy protection.
  • SignerOption
Parameter Type Description
signers List The signature API.
  • SslOption
Parameter Type Description
keyFilePath String The client private key.
certFilePath String The client certificate.
keyPassword String The password for the client private key.
trustStoreFilePath String The path of the CA root certificate.
trustStorePassword String The password for the CA root certificate.
  • SslBytesOption
Parameter Type Description
keyBytes byte[] The client private key.
certBytes byte[] The client certificate.
keyPassword String The password for the client private key.
trustStoreBytes byte[] The CA root certificate.
trustStorePassword String The password for the CA root certificate.
  • NetworkOption
Parameter Type Description
socketAddressList List The node’s IP address and port information.
codecType CodecType The codec mode. 0 indicates RLP, and 1 indicates JSON.
networkType NetworkType The network connection mode. 2 indicates HTTPS, and 3 indicates TLS.
enableCompress Boolean Specifies whether to compress messages.
compressSizeLimit Integer The maximum size of a compressed message. This parameter is not used yet.
maxMessageSize Integer The maximum size of a message received over HTTPS, or the maximum TX and RX buffer size for a TLS channel.
connectTimeoutMs Integer The connection timeout time, in milliseconds.
heartbeatIntervalMs Integer The heartbeat interval, in milliseconds.
retryHeartbeatTimes Integer The number of heartbeat retries.
retryConnectTimes Integer The number of reconnections with a single node.
coreThreadPoolSize Integer The number of Netty threads for handling network events, or the number of threads for the message decoder.
threadPoolQueueSize Integer The size of the network-layer message send task queue, or the size of the Netty task queue for handling network events.
  • RequestOption
Parameter Type Description
queryReceiptTimeoutMs Integer The receipt query timeout time, in milliseconds.
sendRequestTimeoutMs Integer The message sending timeout time, in milliseconds.
queryReceiptIntervalMs Integer The receipt query interval, in milliseconds.
enableQueryTxReceipt Boolean Specifies whether to automatically query for the transaction receipt. The default value is true.
  • ILogger
Parameter Type Description
logger ILogger The log API, which cannot be modified by default.