2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TransferTransactionのスキーマを読み解こうその5

Last updated at Posted at 2022-06-24

TransferTransactionBodyについて

# Send mosaics and messages between two accounts.
struct TransferTransaction
	TRANSACTION_VERSION = make_const(uint8, 1)
	TRANSACTION_TYPE = make_const(TransactionType, TRANSFER)

	inline Transaction
	inline TransferTransactionBody // 今回はここ

スキーマ

スキーマは以下のようになっています。

# Shared content between TransferTransaction and EmbeddedTransferTransaction.
inline struct TransferTransactionBody
	# recipient address 受取人のアドレス
	recipient_address = UnresolvedAddress

	# size of attached message メッセージのサイズをアタッチする2バイト
	message_size = uint16

	# number of attached mosaics モザイクの数をアタッチする1バイト
	mosaics_count = uint8

	# reserved padding to align mosaics on 8-byte boundary 
    # モザイクのために空白の1バイトを設定
	transfer_transaction_body_reserved_1 = make_reserved(uint8, 0)

	# reserved padding to align mosaics on 8-byte boundary
        # モザイクを8バイト境界に整列させるための予約パディング
	transfer_transaction_body_reserved_2 = make_reserved(uint32, 0)

	# attached mosaics
    # 送信するモザイク
	@sort_key(mosaic_id)
	mosaics = array(UnresolvedMosaic, mosaics_count)

	# attached message
        # 送信するメッセージ
	message = array(uint8, message_size)

recipient_address = UnresolvedAddress
つまり
recipient_address = binary_fixed(24): 24バイト

message_size = uint16

2バイト

mosaics_count = uint8

1バイト

transfer_transaction_body_reserved_1 = make_reserved(uint8, 0)

1バイト

transfer_transaction_body_reserved_2 = make_reserved(uint32, 0)

4バイト

UnresolvedMosaic

# A quantity of a certain mosaic, specified either through a MosaicId or an alias.
struct UnresolvedMosaic
	# Unresolved mosaic identifier.
	mosaic_id = UnresolvedMosaicId

	# Mosaic amount.
	amount = Amount

using UnresolvedMosaicId = uint64
8バイト

using Amount = uint64
8バイト

message = array(uint8, message_size)

メッセージサイズの文字をキャラクターとしてuint8の表現で1文字2バイトで表現する?

スクリーンショット 2022-06-24 15.49.17.png

まとめ

まとめるとこんな感じかと。

スクリーンショット 2022-06-24 15.51.24.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?