0

This might be a simple question. Let's say I have the transaction hash:

{
  blockNumber: "6214286",
  timeStamp: "1535248365",
  hash: "0x144018f7327b3990124762d1aefececff3897755ce15313e662f2c5699aaaca1",
  nonce: "5",
  blockHash: "0x6bd409190b38364611b96006ead9f2281262e8d4b71cd712e528c7459d56962f",
  transactionIndex: "135",
  from: "0x446252b54d626cf4192e5c74545761dfaf7e5a50",
  to: "0xb1690c08e213a35ed9bab7b318de14420fb57d8c",
  value: "2000000000000000",
  gas: "148770",
  gasPrice: "1400000000",
  isError: "1",
  txreceipt_status: "0",
  input: "0x454a2ab300000000000000000000000000000000000000000000000000000000000d1596",
  contractAddress: "",
  cumulativeGasUsed: "4423724",
  gasUsed: "22540",
  confirmations: "189517"
}

Is there a way to get what contract function was called with which parameters?

I do have the contract ABI and address.


More information:

I have trying to get the CryptoKitty tokenId from the above transaction. I go this transaction by querying Etherscan with my Account and filter on "to" destination that maps to CryptoKitty auction contract (CryptoKittiesSalesAuction).

1

Yes, you can.

The info you need is here: input: "0x454a2ab300000000000000000000000000000000000000000000000000000000000d1596",

First 4 bytes is what you need to find the function that was called. It is called METHOD ID. You have an example here

This is derived as the first 4 bytes of the Keccak hash of the ASCII form of the signature

And the parameter is 00000000000000000000000000000000000000000000000000000000000d1596

In your smart contract, you can find the method id by using .selector

for example, for this setup() function, function setup() external onlyOwner, you get method id by doing this: this.setup.selector

0

Try ethereum abi decoder https://www.npmjs.com/package/ethereum-input-data-decoder You can decode input data using it.

Your Answer

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

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