How to Decode Arbitrum's L1 Batch Transaction Data Retrieved from Etherscan?

83 views Asked by At

I'm trying to decode Arbitrum's L1 batch data fetched from Etherscan. I'm using ethers.js to convert the hexadecimal data to a Uint8Array and then attempting to decompress it with a Brotli library in Node.js. However, I'm encountering an error during the decompression process.

Code Snippet:

const ethers = require('ethers');
const brotli = require('brotli');

let data = '0x...'; // Hexadecimal string from Etherscan (the `data` in `bytes` under Input Data)
let bytesData = ethers.getBytes(data);
let decompressedData = brotli.decompress(bytesData);

Error:

Error: [ReadHuffmanCodeLengths] space = -1024

I'm looking for guidance on:

  1. Correctly converting the data for Brotli decompression.
  2. Handling specifics of Arbitrum's batch data format.
  3. Resolving the decompression error in Node.js.

Any advice or insights would be greatly appreciated!

0

There are 0 answers