バイトサイズ表
各トランザクションのサイズをcatbufferのスキーマからClaude Codeに作成させたものです。
以下、Claude Codeによって、生成された文章ママです。
精査していないので、現時点では間違いが含まれている可能性があります。
読みながら間違いがあれば訂正していきます。
Claude Codeで作ってもらった円換算計算機です。
見た感じ大丈夫そうですが、NSの固定手数料などが考慮されてない部分がありました。
が、とりあえず目安としては十分使い物になると判断しました。
概要
Symbol のトランザクションは、共通のベース構造を持ち、その上にトランザクション固有のフィールドが追加される構造になっています。全てのトランザクションは最低128バイトのベースサイズを持ちます。
共通トランザクション構造
全てのSymbolトランザクションは以下の共通構造を持ちます:
ベーストランザクション構造 (128バイト)
| フィールド名 | 型 | サイズ (バイト) | 説明 |
|---|---|---|---|
| SizePrefixedEntity | 4 | ||
| size | uint32 | 4 | トランザクション全体のサイズ |
| VerifiableEntity | 68 | ||
| verifiable_entity_header_reserved_1 | uint32 | 4 | 予約フィールド (アライメント用) |
| signature | Signature | 64 | トランザクションの署名 |
| EntityBody | 38 | ||
| signer_public_key | PublicKey | 32 | 署名者の公開鍵 |
| entity_body_reserved_1 | uint32 | 4 | 予約フィールド (アライメント用) |
| version | uint8 | 1 | トランザクションバージョン |
| network | NetworkType | 1 | ネットワークタイプ |
| Transaction固有 | 18 | ||
| type | TransactionType | 2 | トランザクションタイプ |
| fee | Amount | 8 | 手数料 |
| deadline | Timestamp | 8 | 期限 |
合計ベースサイズ: 128バイト
全トランザクションタイプ一覧
| トランザクションタイプ | 16進コード | 固定サイズ | 可変フィールド | 最小サイズ | 最大サイズ |
|---|---|---|---|---|---|
| ACCOUNT_KEY_LINK | 0x414C | 161 | なし | 161 | 161 |
| NODE_KEY_LINK | 0x424C | 161 | なし | 161 | 161 |
| AGGREGATE_COMPLETE | 0x4141 | 168 | トランザクション、コサイン | 168 | 可変 |
| AGGREGATE_BONDED | 0x4241 | 168 | トランザクション、コサイン | 168 | 可変 |
| VOTING_KEY_LINK | 0x4143 | 169 | なし | 169 | 169 |
| VRF_KEY_LINK | 0x4243 | 161 | なし | 161 | 161 |
| HASH_LOCK | 0x4148 | 184 | なし | 184 | 184 |
| SECRET_LOCK | 0x4152 | 209 | なし | 209 | 209 |
| SECRET_PROOF | 0x4252 | 187 | プルーフ配列 | 187 | 65,722 |
| ACCOUNT_METADATA | 0x4144 | 164 | 値配列 | 164 | 65,699 |
| MOSAIC_METADATA | 0x4244 | 172 | 値配列 | 172 | 65,707 |
| NAMESPACE_METADATA | 0x4344 | 172 | 値配列 | 172 | 65,707 |
| MOSAIC_DEFINITION | 0x414D | 150 | なし | 150 | 150 |
| MOSAIC_SUPPLY_CHANGE | 0x424D | 145 | なし | 145 | 145 |
| MOSAIC_SUPPLY_REVOCATION | 0x434D | 168 | なし | 168 | 168 |
| MULTISIG_ACCOUNT_MODIFICATION | 0x4155 | 136 | アドレス配列 | 136 | 12,376 |
| ADDRESS_ALIAS | 0x424E | 161 | なし | 161 | 161 |
| MOSAIC_ALIAS | 0x434E | 145 | なし | 145 | 145 |
| NAMESPACE_REGISTRATION | 0x414E | 146 | 名前配列 | 146 | 401 |
| ACCOUNT_ADDRESS_RESTRICTION | 0x4150 | 136 | アドレス配列 | 136 | 12,376 |
| ACCOUNT_MOSAIC_RESTRICTION | 0x4250 | 136 | モザイクID配列 | 136 | 4,216 |
| ACCOUNT_OPERATION_RESTRICTION | 0x4350 | 136 | トランザクションタイプ配列 | 136 | 1,156 |
| MOSAIC_ADDRESS_RESTRICTION | 0x4251 | 184 | なし | 184 | 184 |
| MOSAIC_GLOBAL_RESTRICTION | 0x4151 | 170 | なし | 170 | 170 |
| TRANSFER | 0x4154 | 160 | モザイク、メッセージ | 160 | 69,775 |
詳細トランザクション構造
1. アカウントキーリンク (ACCOUNT_KEY_LINK: 0x414C)
固定サイズ: 161バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| linked_public_key | PublicKey | 32 |
| link_action | LinkAction | 1 |
2. ノードキーリンク (NODE_KEY_LINK: 0x424C)
固定サイズ: 161バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| linked_public_key | PublicKey | 32 |
| link_action | LinkAction | 1 |
3. アグリゲート (AGGREGATE_COMPLETE: 0x4141 / AGGREGATE_BONDED: 0x4241)
基本サイズ: 168バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| transactions_hash | Hash256 | 32 |
| payload_size | uint32 | 4 |
| aggregate_transaction_header_reserved_1 | uint32 | 4 |
| transactions | EmbeddedTransaction[] | 可変 |
| cosignatures | Cosignature[] | 可変 |
可変フィールド:
- transactions: 埋め込みトランザクションの配列
- cosignatures: コサインの配列 (各104バイト)
4. 投票キーリンク (VOTING_KEY_LINK: 0x4143)
固定サイズ: 169バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| linked_public_key | VotingPublicKey | 32 |
| start_epoch | FinalizationEpoch | 4 |
| end_epoch | FinalizationEpoch | 4 |
| link_action | LinkAction | 1 |
5. VRFキーリンク (VRF_KEY_LINK: 0x4243)
固定サイズ: 161バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| linked_public_key | PublicKey | 32 |
| link_action | LinkAction | 1 |
6. ハッシュロック (HASH_LOCK: 0x4148)
固定サイズ: 184バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| mosaic | UnresolvedMosaic | 16 |
| duration | BlockDuration | 8 |
| hash | Hash256 | 32 |
7. シークレットロック (SECRET_LOCK: 0x4152)
固定サイズ: 209バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| recipient_address | UnresolvedAddress | 24 |
| secret | Hash256 | 32 |
| mosaic | UnresolvedMosaic | 16 |
| duration | BlockDuration | 8 |
| hash_algorithm | LockHashAlgorithm | 1 |
8. シークレットプルーフ (SECRET_PROOF: 0x4252)
基本サイズ: 187バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| recipient_address | UnresolvedAddress | 24 |
| secret | Hash256 | 32 |
| proof_size | uint16 | 2 |
| hash_algorithm | LockHashAlgorithm | 1 |
| proof | array(uint8) | 可変 |
可変フィールド:
- proof: プルーフデータ配列 (最大65,535バイト)
9. アカウントメタデータ (ACCOUNT_METADATA: 0x4144)
基本サイズ: 164バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| target_address | UnresolvedAddress | 24 |
| scoped_metadata_key | uint64 | 8 |
| value_size_delta | int16 | 2 |
| value_size | uint16 | 2 |
| value | array(uint8) | 可変 |
可変フィールド:
- value: メタデータ値配列 (最大65,535バイト)
10. モザイクメタデータ (MOSAIC_METADATA: 0x4244)
基本サイズ: 172バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| target_address | UnresolvedAddress | 24 |
| scoped_metadata_key | uint64 | 8 |
| target_mosaic_id | UnresolvedMosaicId | 8 |
| value_size_delta | int16 | 2 |
| value_size | uint16 | 2 |
| value | array(uint8) | 可変 |
可変フィールド:
- value: メタデータ値配列 (最大65,535バイト)
11. ネームスペースメタデータ (NAMESPACE_METADATA: 0x4344)
基本サイズ: 172バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| target_address | UnresolvedAddress | 24 |
| scoped_metadata_key | uint64 | 8 |
| target_namespace_id | NamespaceId | 8 |
| value_size_delta | int16 | 2 |
| value_size | uint16 | 2 |
| value | array(uint8) | 可変 |
可変フィールド:
- value: メタデータ値配列 (最大65,535バイト)
12. モザイク定義 (MOSAIC_DEFINITION: 0x414D)
固定サイズ: 150バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| id | MosaicId | 8 |
| duration | BlockDuration | 8 |
| nonce | MosaicNonce | 4 |
| flags | MosaicFlags | 1 |
| divisibility | uint8 | 1 |
13. モザイク供給量変更 (MOSAIC_SUPPLY_CHANGE: 0x424D)
固定サイズ: 145バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| mosaic_id | UnresolvedMosaicId | 8 |
| delta | Amount | 8 |
| action | MosaicSupplyChangeAction | 1 |
14. モザイク供給量取消 (MOSAIC_SUPPLY_REVOCATION: 0x434D)
固定サイズ: 168バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| source_address | UnresolvedAddress | 24 |
| mosaic | UnresolvedMosaic | 16 |
15. マルチシグアカウント変更 (MULTISIG_ACCOUNT_MODIFICATION: 0x4155)
基本サイズ: 136バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| min_removal_delta | int8 | 1 |
| min_approval_delta | int8 | 1 |
| address_additions_count | uint8 | 1 |
| address_deletions_count | uint8 | 1 |
| multisig_account_modification_transaction_body_reserved_1 | uint32 | 4 |
| address_additions | array(UnresolvedAddress) | 可変 |
| address_deletions | array(UnresolvedAddress) | 可変 |
可変フィールド:
- address_additions: 追加アドレス配列 (各24バイト、最大255個)
- address_deletions: 削除アドレス配列 (各24バイト、最大255個)
16. アドレスエイリアス (ADDRESS_ALIAS: 0x424E)
固定サイズ: 161バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| namespace_id | NamespaceId | 8 |
| address | Address | 24 |
| alias_action | AliasAction | 1 |
17. モザイクエイリアス (MOSAIC_ALIAS: 0x434E)
固定サイズ: 145バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| namespace_id | NamespaceId | 8 |
| mosaic_id | MosaicId | 8 |
| alias_action | AliasAction | 1 |
18. ネームスペース登録 (NAMESPACE_REGISTRATION: 0x414E)
基本サイズ: 146バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| duration/parent_id | uint64 | 8 |
| id | NamespaceId | 8 |
| registration_type | NamespaceRegistrationType | 1 |
| name_size | uint8 | 1 |
| name | array(uint8) | 可変 |
可変フィールド:
- name: ネームスペース名配列 (最大255バイト)
19. アカウントアドレス制限 (ACCOUNT_ADDRESS_RESTRICTION: 0x4150)
基本サイズ: 136バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| restriction_flags | AccountRestrictionFlags | 2 |
| restriction_additions_count | uint8 | 1 |
| restriction_deletions_count | uint8 | 1 |
| account_restriction_transaction_body_reserved_1 | uint32 | 4 |
| restriction_additions | array(UnresolvedAddress) | 可変 |
| restriction_deletions | array(UnresolvedAddress) | 可変 |
可変フィールド:
- restriction_additions: 追加制限アドレス配列 (各24バイト、最大255個)
- restriction_deletions: 削除制限アドレス配列 (各24バイト、最大255個)
20. アカウントモザイク制限 (ACCOUNT_MOSAIC_RESTRICTION: 0x4250)
基本サイズ: 136バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| restriction_flags | AccountRestrictionFlags | 2 |
| restriction_additions_count | uint8 | 1 |
| restriction_deletions_count | uint8 | 1 |
| account_restriction_transaction_body_reserved_1 | uint32 | 4 |
| restriction_additions | array(UnresolvedMosaicId) | 可変 |
| restriction_deletions | array(UnresolvedMosaicId) | 可変 |
可変フィールド:
- restriction_additions: 追加制限モザイクID配列 (各8バイト、最大255個)
- restriction_deletions: 削除制限モザイクID配列 (各8バイト、最大255個)
21. アカウントオペレーション制限 (ACCOUNT_OPERATION_RESTRICTION: 0x4350)
基本サイズ: 136バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| restriction_flags | AccountRestrictionFlags | 2 |
| restriction_additions_count | uint8 | 1 |
| restriction_deletions_count | uint8 | 1 |
| account_restriction_transaction_body_reserved_1 | uint32 | 4 |
| restriction_additions | array(TransactionType) | 可変 |
| restriction_deletions | array(TransactionType) | 可変 |
可変フィールド:
- restriction_additions: 追加制限トランザクションタイプ配列 (各2バイト、最大255個)
- restriction_deletions: 削除制限トランザクションタイプ配列 (各2バイト、最大255個)
22. モザイクアドレス制限 (MOSAIC_ADDRESS_RESTRICTION: 0x4251)
固定サイズ: 184バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| mosaic_id | UnresolvedMosaicId | 8 |
| restriction_key | uint64 | 8 |
| previous_restriction_value | uint64 | 8 |
| new_restriction_value | uint64 | 8 |
| target_address | UnresolvedAddress | 24 |
23. モザイクグローバル制限 (MOSAIC_GLOBAL_RESTRICTION: 0x4151)
固定サイズ: 170バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| mosaic_id | UnresolvedMosaicId | 8 |
| reference_mosaic_id | UnresolvedMosaicId | 8 |
| restriction_key | uint64 | 8 |
| previous_restriction_value | uint64 | 8 |
| new_restriction_value | uint64 | 8 |
| previous_restriction_type | MosaicRestrictionType | 1 |
| new_restriction_type | MosaicRestrictionType | 1 |
24. 転送 (TRANSFER: 0x4154)
基本サイズ: 160バイト
| フィールド名 | 型 | サイズ (バイト) |
|---|---|---|
| ベーストランザクション | - | 128 |
| recipient_address | UnresolvedAddress | 24 |
| message_size | uint16 | 2 |
| mosaics_count | uint8 | 1 |
| transfer_transaction_body_reserved_1 | uint8 | 1 |
| transfer_transaction_body_reserved_2 | uint32 | 4 |
| mosaics | array(UnresolvedMosaic) | 可変 |
| message | array(uint8) | 可変 |
可変フィールド:
- mosaics: モザイク配列 (各16バイト、最大255個)
- message: メッセージ配列 (最大65,535バイト)
計算例
例1: 基本的なTransferトランザクション
設定:
- 1つのモザイク (16バイト)
- 100文字のメッセージ (100バイト)
計算:
基本サイズ: 160バイト
モザイク: 1 × 16 = 16バイト
メッセージ: 100バイト
合計: 160 + 16 + 100 = 276バイト
例2: マルチシグアカウント変更
設定:
- 追加アドレス: 3個 (3 × 24 = 72バイト)
- 削除アドレス: 1個 (1 × 24 = 24バイト)
計算:
基本サイズ: 136バイト
追加アドレス: 72バイト
削除アドレス: 24バイト
合計: 136 + 72 + 24 = 232バイト
例3: アカウントメタデータ
設定:
- メタデータ値: 1024バイト
計算:
基本サイズ: 164バイト
メタデータ値: 1024バイト
合計: 164 + 1024 = 1188バイト
注意事項
- アライメント: 全てのトランザクションは8バイト境界にアライメントされます
- 予約フィールド: 予約フィールドは将来の拡張のために0で初期化されます
- 最大サイズ: 理論上の最大サイズは示されていますが、実際のネットワークでは制限が適用される場合があります
- 可変フィールド: 配列の最大サイズは対応する count フィールドのデータ型によって決まります
このリファレンスを使用して、アプリケーションで正確なトランザクションサイズを計算し、適切な手数料設定を行うことができます。