The Transaction Model
交易的结构
{
"id": "<hash of transaction, excluding signatures>",
"version": "<version number of the transaction model>",
"inputs": ["<list of inputs>"],
"outputs": ["<list of outputs>"],
"operation": "<string>",
"asset": "<asset model>",
"metadata": "<any JSON document>"
}
- id: 交易的id,也数据库的主键
- version:Version number of the transaction model
- inputs:
- outputs:
- operation:正在执行的操作的字符串表示形式,可以是“CREATE”, “TRANSFER” 或者 “GENESIS”
- asset:定义的资产
- metadata:用户提供的交易元数据,可以是任何JSON文档,也可以是NULL
The Asset Model
为了避免交易中的冗余数据,对于CREATE and TRANSFER交易,资产模型是不同的。
在 CREATE 交易中,“资产”必须正好包含一个键-值对,键必须是“data”,值可以是任何有效的JSON文档,也可以是null
在 TRANSFER 交易中,“资产”必须正好包含一个键-值对。键必须是“id”,值必须包含交易id。the ID of the CREATE transaction which created the asset, which also serves as the asset ID
Inputs and Outputs
pass
The Block Model
区块的结构
{
"id": "<hash of block>",
"block": {
"timestamp": "<block-creation timestamp>",
"transactions": ["<list of transactions>"],
"node_pubkey": "<public key of the node creating the block>",
"voters": ["<list of public keys of all nodes in the cluster>"]
},
"signature": "<signature of block>"
}
- id: 序列化的内部块的散列
- timestamp: 创建块的Unix时间, 它由创建块的节点提供
- transactions: A list of the transactions included in the block
- node_pubkey: The public key of the node that created the block
- voters: 创建块时所有集群节点的公钥列表
- signature: 创建块的节点对块的加密签名。为了生成签名,节点使用node_pubkey对应的私钥对序列化后的内部块进行签名
The Vote Model
投票的结构
{
"node_pubkey": "<The public key of the voting node>",
"vote": {
"voting_for_block": "<ID of the block the node is voting on>",
"previous_block": "<ID of the block previous to the block being voted on>",
"is_block_valid": "<true OR false>",
"invalid_reason": null,
"timestamp": "<Unix time when the vote was generated, provided by the voting node>"
},
"signature": "<Cryptographic signature of vote>"
}