Rollup data restore
All transaction data on the shard chain has full data visibility on the beacon chain, so anyone is able to restore the data on the shard chain without permission. The process of data restoration involves rebuilding the Genesis root node by getting records from the beacon chain based on the Genesis hash, and then restoring the state tree and all rollup transactions based on transaction.input
. The details are as follows.
Restore the Genesis Root Node
All the operations of the sharded chain are stored in transaction.input
on the base chain. We can get the record of Genesis hash to reconstruct the Genesis root node information by the eth_getTransactionByHash method, which is stored from the transaction.input.0
commitment
field to extract the 6 smart contract addresses.
Restore Rollup Transaction Data
The calldata
field of transaction.input.1
contains the original compressed data of all blocks of the shard chain, which can restore all transaction data.
transaction.input[1]._calldata = tx_type | chips * chip_bytes(10bytes)
DepositTx structure
tx_type | chips |
---|---|
0x01 | 6 |
account_id | token | amount | to |
---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 25 bytes | 25 ~ 45 bytes |
TransferToNewAddrTx & TransferToNewAddrNFTTx structure
tx_type | chips |
---|---|
0x02 | 6 |
from_id | token | amount | to | to_id | fee |
---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 14 bytes | 14 ~ 34 bytes | 34 ~ 38 bytes | 38 ~ 40 bytes |
WithdrawTx structure
tx_type | chips |
---|---|
0x03 | 6 |
account_id | token | amount | fee | to |
---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 13 bytes | 25 ~ 27 bytes | 27 ~ 47 bytes |
TransferTx & TransferNFTTx structure
tx_type | chips |
---|---|
0x05 | 2 |
account_id | token | to | amount | fee |
---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 13 bytes | 13 ~ 18 bytes | 18 ~ 20 bytes |
FullWithdrawTx & FullWithdrawNFTTx structure
tx_type | chips |
---|---|
0x06 | 11 |
account_id | eth_address | token | amount | creator_address | content_hash |
---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 25 bytes | 25 ~ 29 bytes | 29 ~ 45 bytes | 45 ~ 65 bytes | 65 ~ 97 bytes |
UpdatePublicKeyTx structure
tx_type | chips |
---|---|
0x07 | 6 |
account_id | new_pk_hash | account | nonce | fee_token | fee |
---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 25 bytes | 25 ~ 45 bytes | 45 ~ 49 bytes | 49 ~ 53 bytes | 53 ~ 55 bytes |
ForcedWithdrawTx structure
tx_type | chips |
---|---|
0x08 | 6 |
initiator_account_id | target_account_id | token | amount | fee | target |
---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 13 bytes | 13 ~ 29 bytes | 29 ~ 31 bytes | 31 ~ 51 bytes |
MintNFTTx structure
tx_type | chips |
---|---|
0x09 | 5 |
creator_account_id | recipient_account_id | content_hash | fee_token_id | fee |
---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 41 bytes | 41 ~ 45 bytes | 45 ~ 47 bytes |
WithdrawNFTTx structure
tx_type | chips |
---|---|
0x0a | 10 |
account_id | creator_id | creator_address | serial_id | content_hash | to | token | token_fee | fee |
---|---|---|---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 29 bytes | 29 ~ 33 bytes | 33 ~ 65 bytes | 65 ~ 85 bytes | 85 ~ 89 bytes | 89 ~ 93 bytes | 93 ~ 95 bytes |
SwapTx & SwapNFTTx structure
tx_type | chips |
---|---|
0x0b | 5 |
account_id_0 | recipient_id_0 | account_id_1 | recipient_id_1 | submitter_id | token_0 | token_1 | fee_token | amount_0 | amount_1 | fee | swap_fee_0 | swap_fee_1 | nonce |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 ~ 5 bytes | 5 ~ 9 bytes | 9 ~ 13 bytes | 13 ~ 17 bytes | 17 ~ 21 bytes | 21 ~ 25 bytes | 25 ~ 29 bytes | 29 ~ 33 byte | 33 ~ 38 bytes | 38 ~ 43 bytes | 43 ~ 45 bytes | 45~47 bytes | 47 ~ 49 bytes | 49 ~ 49 bytes |
Last updated