0

I'm trying to follow the POS bridge steps for transfer an ER20 token from ethereum görli testnet to polygon (mumbai testnet).

I've accomplished the approval, deposit and burn steps. Nevertheless, in the exit step I've not been able to build all the necessary data for the transaction.

For this work i'm using the go official package go-ethereum

According to the github repo, the transaction needs the following RLP encoded data:

 0 - headerNumber - Checkpoint header block number containing the reference tx
 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root
 2 - blockNumber - Block number containing the reference tx on child chain
 3 - blockTime - Reference tx block time
 4 - txRoot - Transactions root of block
 5 - receiptRoot - Receipts root of block
 6 - receipt - Receipt of the reference transaction
 7 - receiptProof - Merkle proof of the reference receipt
 8 - branchMask - 32 bits denoting the path of receipt in merkle tree
 9 - receiptLogIndex - Log Index to read from the receipt

Almost all the necessary data has been built and RLP encoded. For example for the blocknumber:

clientChild, err := ethclient.Dial(childProvider)
if err != nil {
    log.Fatal(err)
} else {
    log.Printf("Cliente en la cadena Child: %v", *clientChild)
}

ctx := context.Background()

hash := common.HexToHash(burnHash)

receiptTx, _ := clientChild.TransactionReceipt(ctx, hash)

blockNumber := receiptTx.BlockNumber

But, for the receiptProof (7 - receiptProof - Merkle proof of the reference receipt) i've not been able to obtain this data.

When i try the following

proof := memorydb.New()
trieObj.Prove(txIdx, 0, proof) //ReceiptProof
if proof == nil {
    fmt.Printf("prover: nil proof")
}

// Verify the proof
val, _ := trie.VerifyProof(raiz, txIdx, proof)

I obtain the receipt parameter (6 - receipt - Receipt of the reference transaction).

Any idea to obtain the Merkle trie proof (receiptProof) parameter?

I really appreciate any suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.