Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Fetch the relevant block with block = eth.chain.get_block_by_number(53989)
  2. Grab the relevant transaction with transaction = block.transactions[1]
    1. You can double check you got the right transaction by comparing the txhash

      In: transaction.hash.hex()

      Out: '423a89ae3fa471502c03e1d79e5fad8fa3637aea0e9687396315fe1a60687143'

  3. You can look at the pyethapp README to see a list of attributes you can fetch from the transaction. I personally just type transaction. and hit the TAB key to see the list of possible options.
    1. For example gas price can be queried as follows

      In [54]: transaction.gasprice

      Out[54]: 57036234360

    2. Or you can just see all the attributes with .to_dict()

      In [58]: transaction.to_dict()

      Out[58]:

      {'data': '0x',

      'gasprice': 57036234360,

      'hash': '0x423a89ae3fa471502c03e1d79e5fad8fa3637aea0e9687396315fe1a60687143',

      'nonce': 0,

      'r': 100109914899522740072820940032964549000152372784597782163962964272918287896235,

      's': 34504076207637428225392040647648060942376898176377071704915726387968418661732,

      'sender': '0x4f68024b7ceb5ca92e7308bd08e523c632c0c739',

      'startgas': 90000,

      'to': '0x',

      'v': 28,

      'value': 50000000000000000}

  4. Note the 'to': '0x' means that this transaction creates a contract. This contract is created at address

    In [61]: transaction.creates.hex()

    Out[61]: '9b4364943c18c594d11e7a4484c40f41fce7c9be'


    with contract code 'data': '0x'. Basically someone created a useless contract?!