Skip to content

公共数据类型

VIZ Ledger 协议操作和虚拟操作中使用的所有共享数据类型。


原始类型

C++ 类型JSON 表示描述
stringstringUTF-8 字符串
boolbooleantrue / false
uint8_tinteger无符号 8 位整数
uint16_tinteger无符号 16 位整数(0–65535)
int16_tinteger有符号 16 位整数(−32768–32767)
uint32_tinteger无符号 32 位整数
int32_tinteger有符号 32 位整数
uint64_tstringinteger无符号 64 位整数——在 JavaScript 中使用字符串以避免溢出
int64_tstringinteger有符号 64 位整数
share_typeintegersafe<int64_t> 的别名——以最小单位表示的代币数量
time_point_secstringISO 8601 UTC 日期时间:"2024-01-15T12:00:00"(无时区后缀)

account_name_type

标识账户的固定长度字符串(最多 16 字节)。规则:

  • 点号分隔的标签;每个标签至少 3 个字符。
  • 以字母开头,以字母或数字结尾。
  • 仅小写字母(az)、数字(09)、连字符(-)。
  • 最小长度:2 个字符(CHAIN_MIN_ACCOUNT_NAME_LENGTH)。
  • 最大长度:16 个字符(CHAIN_MAX_ACCOUNT_NAME_LENGTH)。

JSON: 普通字符串——"alice""alice.bob"


public_key_type

以 base58check 编码并带有 VIZ 前缀的 secp256k1 压缩公钥。

JSON: 字符串——"VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9"

  • 前缀必须是 VIZ(不是 STMGLS 或其他)。
  • 由 33 字节压缩公钥 + 4 字节校验和 = 共 37 字节进行 base58 编码。

asset

表示带有符号的代币数量。在 JSON API 响应和操作参数中序列化为人类可读的字符串:

"10.000 VIZ"
"5.000000 SHARES"

代币符号

符号字符串小数位数描述
TOKEN_SYMBOLVIZ3主要流动代币
SHARES_SYMBOLSHARES6质押份额(已质押的 VIZ)

构建操作时,始终使用字符串格式。通过空格分割解析:左边是数量,右边是符号。VIZ 使用 3 位小数;SHARES 使用 6 位。


authority

控制账户权限级别的多重签名授权结构。

json
{
  "weight_threshold": 1,
  "account_auths": [
    ["alice", 1]
  ],
  "key_auths": [
    ["VIZ5hqSa4NkEZGAMUpoH5EaEr64mBJuMcPpGjvk8qb7hcPFTbXSQ9", 1]
  ]
}
字段类型描述
weight_thresholduint32_t满足授权所需的最低总权重
account_auths[[account_name, weight], ...]基于账户的签名者
key_auths[[public_key, weight], ...]基于密钥的签名者

满足的签名者权重之和必须 ≥ weight_threshold。空授权:{ "weight_threshold": 0, "account_auths": [], "key_auths": [] }

授权级别

级别用于
master最高安全性——更换密钥、账户恢复
active代币操作——转账、质押、验证者投票
regular社交操作——内容、奖励、委员会投票

beneficiary_route_type

指定内容支付的受益人及其奖励份额。

json
{ "account": "alice", "weight": 2500 }
字段类型描述
accountaccount_name_type受益人账户
weightuint16_t以基点表示的份额(10000 = 100%)
  • 所有受益人权重之和不得超过 10000。
  • 受益人必须在数组中按账户名升序排列。
  • 每个受益人账户必须在链上存在。

extensions_type

当前未使用——始终序列化为空数组。

json
"extensions": []

versioned_chain_properties

包含链属性某一版本的静态变体。序列化为 2 元素数组 [type_index, object]

索引类型
0chain_properties_init
1chain_properties_hf4
2chain_properties_hf6
3chain_properties_hf9(当前)

每个版本的完整字段参考参见链属性


operation(静态变体)

每个操作序列化为 2 元素数组:[type_id, operation_object]

常规操作(用户广播)

ID操作
0vote_operation (已弃用)
1content_operation (已弃用)
2transfer_operation
3transfer_to_vesting_operation
4withdraw_vesting_operation
5account_update_operation
6validator_update_operation
7account_validator_vote_operation
8account_validator_proxy_operation
9delete_content_operation (已弃用)
10custom_operation
11set_withdraw_vesting_route_operation
12request_account_recovery_operation
13recover_account_operation
14change_recovery_account_operation
15escrow_transfer_operation
16escrow_dispute_operation
17escrow_release_operation
18escrow_approve_operation
19delegate_vesting_shares_operation
20account_create_operation
21account_metadata_operation
22proposal_create_operation
23proposal_update_operation
24proposal_delete_operation
25chain_properties_update_operation
35committee_worker_create_request_operation
36committee_worker_cancel_request_operation
37committee_vote_request_operation
43create_invite_operation
44claim_invite_balance_operation
45invite_registration_operation
46versioned_chain_properties_update_operation
47award_operation
50set_paid_subscription_operation
51paid_subscribe_operation
54set_account_price_operation
55set_subaccount_price_operation
56buy_account_operation
58use_invite_balance_operation
60fixed_award_operation
61target_account_sale_operation

虚拟操作(区块链生成,不可广播)

ID操作
26author_reward_operation
27curation_reward_operation
28content_reward_operation
29fill_vesting_withdraw_operation
30shutdown_validator_operation
31hardfork_operation
32content_payout_update_operation
33content_benefactor_reward_operation
34return_vesting_delegation_operation
38committee_cancel_request_operation
39committee_approve_request_operation
40committee_payout_request_operation
41committee_pay_request_operation
42validator_reward_operation
48receive_award_operation
49benefactor_award_operation
52paid_subscription_action_operation
53cancel_paid_subscription_operation
57account_sale_operation
59expire_escrow_ratification_operation
62bid_operation
63outbid_operation

交易构建

已签名交易包含:

字段
ref_block_numhead_block_number & 0xFFFF
ref_block_prefixblock_id 的第 4–7 字节(小端 uint32
expirationUTC 时间字符串;建议从广播时间起最多 ~60 秒
operations[type_id, object] 对的数组
extensions始终为 []
signatures紧凑十六进制编码的 ECDSA 签名数组

签名: sha256(chain_id + serialized_transaction_body) → secp256k1 上的紧凑 ECDSA 签名。

私钥: WIF 格式(base58check,版本字节 0x80)。


能量系统

能量由奖励类型操作使用。

  • 以基点存储:0–10000(0%–100%)。
  • 每 24 小时恢复 100%(CHAIN_ENERGY_REGENERATION_SECONDS = 86400)。
  • 当前能量:min(10000, last_energy + elapsed_seconds × 10000 / 86400)

参见:操作概述虚拟操作链属性