I have a problem in developing a program to decode the input data of transactions created by a smart contract on the polygon blockchain.

The smart contract:


encode input data decode input data



The function of the smart contract for which I want to decode the input data is:

function createPack(uint8 packType, bytes memory signature)

The steps are the following : 1a- Extraction of the data from the google dataset : public-data-finance.crypto_polygon.transactions 1b- Decoding in the query in the input_data field 2- Storage of the decoded data in the database

For steps 1a and 1b, I used this source on github : Gitub blockchain-etl/ethers.js-bigquery

I adapted the BigQuery query as follows:

  LANGUAGE js AS """
    var CTA_CREATEPACK = {
      "inputs": [
          "name": "packType",
          "type": "uint8"
          "name": "signature",
          "type": "bytes"
      "name": "createPack",
      "outputs": [],
      "stateMutability": "payable",
      "type": "function"

    var interface_instance = new ethers.utils.Interface([CTA_CREATEPACK]);
    --You might need to wrap with try-catch here as transaction input is user provided data and might not follow abi. 
    var parsedTransaction = interface_instance.parseTransaction({data: data});

    return parsedTransaction.args;
  ( library="gs://blockchain-etl-bigquery/ethers.js" );
  `hash`, DECODE_CREATEPACK(input) AS decoded_input
  STARTS_WITH(input, "0x48b70391") -- 4byte sighash for createPack(uint8 packType, bytes signature) method
  AND to_address = "0xb6041eae62c4591458af480679c6a497eda6cfcd"
LIMIT 100;

When running the query, I get the following error:

SyntaxError: Unexpected identifier at DECODE_CREATEPACK(STRING) line 21, columns 10-15

As it seems that my problem comes from the ABI, I compiled the smart contract code on REMIX to get the ABI. However, I don't have the ABI of the "Contract" functions

contract PremiumPack is ERC1155, Ownable, AccessControl, ReentrancyGuard { ... }

My solidity skills are very limited so I am stuck on the tracks to solve my problem.

Do any of you have a clue?

1 Answer 1


The BigQuery data leaves a lot to be desired, which is part of the reason I made Luabase. Luabase has direct SQL access and already full decodes any contract with verified ABI's. Let me know if you run into any data missing and we can get it added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.