0

If you look on etherscan, they unroll the transaction into a lot of really good data. I'm trying to figure out where they are getting this information from and how they are unrolling it.

For instance, take this Dystopunks transfer:

https://etherscan.io/tx/0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0

On OpenSea, there's a Transaction Action action

Transfer of DystoPunks V...(DYSTO)
From 0xf0d6999725115e3ead3d927eb3329d63afaec09b
To   0xb20a327c9b4da091f454b1ce0e2e4dc5c128b5b4
1of
Token ID [721]

It also shows you the royalty payouts to the owner, and to OpenSea:

Interacted With (To):
Contract 0x7be8076f4ea4a4ad08075c2508e481d6c946d12b (OpenSea) 
TRANSFER  0.357 Ether From OpenSea To  OpenSea: Wallet
TRANSFER  3.143 Ether From OpenSea To  0xf0d6999725115e3ead3d927eb3329d63afaec09b

Where is this information stored in the contract, and how to extract it?

I've got a rudimentary web3 script that can pull down the transaction:

  const transactionHash =
    '0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0'

  const transaction = await web3.eth.getTransaction(transactionHash)
  const transactionReceipt = await web3.eth.getTransactionReceipt(
    transactionHash,
  )
  Object.assign(transaction, transactionReceipt)
  console.log(JSON.stringify(transaction, null, 2))

This produces JSON output:

{
  "accessList": [],
  "blockHash": "0xd4e2f774f4ba7f64be28527de038e8e5f3fbf5d159ff8c9c720e63fca3218c34",
  "blockNumber": 13113774,
  "chainId": "0x1",
  "condition": null,
  "creates": null,
  "from": "0xb20a327c9b4da091f454b1ce0e2e4dc5c128b5b4",
  "gas": 316752,
  "gasPrice": "56966222435",
  "hash": "0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0",
  "input": "0xab834...",
  "maxFeePerGas": "77590790242",
  "maxPriorityFeePerGas": "2287157665",
  "nonce": 325,
  "publicKey": "0x...",
  "r": "0x6ccf869b0b0bbc9c5fd856e0e439564c3780951af84707f07a1205d7e903219c",
  "raw": "0x...",
  "s": "0x61b26373d404f19d17ac93789ef77e76c3a2f0d384bb1ff7f1493fead3a1807c",
  "to": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
  "transactionIndex": 186,
  "type": "0x2",
  "v": "0x1",
  "value": "3500000000000000000",
  "contractAddress": null,
  "cumulativeGasUsed": 11533725,
  "effectiveGasPrice": "0xd43739263",
  "gasUsed": 229114,
  "logs": [
    {
      "address": "0xbEA8123277142dE42571f1fAc045225a1D347977",
      "blockHash": "0xd4e2f774f4ba7f64be28527de038e8e5f3fbf5d159ff8c9c720e63fca3218c34",
      "blockNumber": 13113774,
      "data": "0x",
      "logIndex": 234,
      "removed": false,
      "topics": [
        "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
        "0x000000000000000000000000f0d6999725115e3ead3d927eb3329d63afaec09b",
        "0x0000000000000000000000000000000000000000000000000000000000000000",
        "0x00000000000000000000000000000000000000000000000000000000000002d1"
      ],
      "transactionHash": "0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0",
      "transactionIndex": 186,
      "transactionLogIndex": "0x0",
      "type": "mined",
      "id": "log_7649c88f"
    },
    {
      "address": "0xbEA8123277142dE42571f1fAc045225a1D347977",
      "blockHash": "0xd4e2f774f4ba7f64be28527de038e8e5f3fbf5d159ff8c9c720e63fca3218c34",
      "blockNumber": 13113774,
      "data": "0x",
      "logIndex": 235,
      "removed": false,
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000f0d6999725115e3ead3d927eb3329d63afaec09b",
        "0x000000000000000000000000b20a327c9b4da091f454b1ce0e2e4dc5c128b5b4",
        "0x00000000000000000000000000000000000000000000000000000000000002d1"
      ],
      "transactionHash": "0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0",
      "transactionIndex": 186,
      "transactionLogIndex": "0x1",
      "type": "mined",
      "id": "log_f1914c69"
    },
    {
      "address": "0x7Be8076f4EA4A4AD08075C2508e481d6C946D12b",
      "blockHash": "0xd4e2f774f4ba7f64be28527de038e8e5f3fbf5d159ff8c9c720e63fca3218c34",
      "blockNumber": 13113774,
      "data": "0x0000...",
      "logIndex": 236,
      "removed": false,
      "topics": [
        "0xc4109843e0b7d514e4c093114b863f8e7d8d9a458c372cd51bfe526b588006c9",
        "0x000000000000000000000000f0d6999725115e3ead3d927eb3329d63afaec09b",
        "0x000000000000000000000000b20a327c9b4da091f454b1ce0e2e4dc5c128b5b4",
        "0x0000000000000000000000000000000000000000000000000000000000000000"
      ],
      "transactionHash": "0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0",
      "transactionIndex": 186,
      "transactionLogIndex": "0x2",
      "type": "mined",
      "id": "log_6e1d30dc"
    }
  ],
  "logsBloom": "0x0000...",
  "status": true,
  "transactionHash": "0x47a95ec47e423dfa55c63358a87ca9e71978df5b6ff4833ca0c2555aa5fbc5c0"
}

Where is the OpenSea data stored in this transaction, does this require other transactions to be loaded or is everything located in this one transaction?

Thanks for the help!

0

Most of this data is the Logs.

Topic 0 is the event signature. The Event signature is the keccak256 of the event name and attribute types. Look at https://www.4byte.directory/ for more info

All the other Topics are the INDEXED params

Data is the unindexed params.

Take the logs and parse them. This is where you will find your data.

Use ABI to parse out the "data" portion ABI of the "address" for the log.

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.