Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Feature-request: _listTransactions() #3567

Closed
SinErgy84 opened this issue Nov 22, 2016 · 4 comments
Closed

Feature-request: _listTransactions() #3567

SinErgy84 opened this issue Nov 22, 2016 · 4 comments
Labels
M6-rpcapi 📣 RPC API. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.

Comments

@SinErgy84
Copy link

Over a year passed by and the go-ethereum developers have no ETA (clue?) to implement this feature.

Original request from ethereum/go-ethereum#1897:

This feature has been discussed on gitter in the past and we would like to see this get implemented for accounts and contracts.

Proposal

eth_listTransactions

Returns a list of transaction hashes for a given external or contract account

Parameters

String - the account or contract address

params: [
  "0x385acafdb80b71ae001f1dbd0d65e62ec2fff055"
]

Returns

DATA - A list of transaction hashes


Additional Parameter:
STRING (IN|OUT) - for incoming or outgoing transactions

What's your opinion for implementing this feature?

@tomusdrw
Copy link
Collaborator

tomusdrw commented Nov 22, 2016

Have a look at trace_filter - it allows you to get all traces of transactions touching particular address.

As stated in the original issue, it's not enough to list incoming/outgoing transactions since there are also internal contract calls that may transfer value as well. trace_filter covers those cases, example:

curl --data '{"jsonrpc":"2.0", "id":1, "method": "trace_filter", "params": [{ "fromAccount": "0x385acafdb80b71ae001f1dbd0d65e62ec2fff055" }] }' -X POST -H Content-Type:application/json 

Note that you need to run with --tracing=on for this to work.

@tomusdrw tomusdrw added M6-rpcapi 📣 RPC API. Z1-question 🙋‍♀️ Issue is a question. Closer should answer. labels Nov 22, 2016
@SinErgy84
Copy link
Author

SinErgy84 commented Nov 22, 2016

@tomusdrw thanks for your answer.

  1. api-docs for params are wrong: toAddress / fromAddress result in invalid params. your example provides correct param keys

  2. trace_filter with param toAccount / fromAccount seems to be buggy, cause both calls produces same result for Account 0x6c637709f5ba4c1cdf758fb46b30ea4940db5d44:
    toAccount (should be empty, cause no incoming tx)

array(1) {
  [0] =>
  class stdClass#471 (9) {
    public $action =>
    class stdClass#484 (6) {
      public $callType =>
      string(4) "call"
      public $from =>
      string(42) "0x6c637709f5ba4c1cdf758fb46b30ea4940db5d44"
      public $gas =>
      string(3) "0x0"
      public $input =>
      string(2) "0x"
      public $to =>
      string(42) "0x002e922e6d00fdfffb050762e3123bbe1c2ed9a5"
      public $value =>
      string(13) "0x9184e72a000"
    }
    public $blockHash =>
    string(66) "0x6129757d968f4301b01f02dc20317206d6f6b43c2232e458d5a0f0c9a6f306f8"
    public $blockNumber =>
    int(20232)
    public $result =>
    class stdClass#481 (2) {
      public $gasUsed =>
      string(3) "0x0"
      public $output =>
      string(2) "0x"
    }
    public $subtraces =>
    int(0)
    public $traceAddress =>
    array(0) {
    }
    public $transactionHash =>
    string(66) "0x1be45dc3795144a056f5df3ce697e79044fc4e3b4639cfdf78103b1ba1b5ba78"
    public $transactionPosition =>
    int(0)
    public $type =>
    string(4) "call"
  }
}

fromAccount

array(1) {
  [0] =>
  class stdClass#481 (9) {
    public $action =>
    class stdClass#480 (6) {
      public $callType =>
      string(4) "call"
      public $from =>
      string(42) "0x6c637709f5ba4c1cdf758fb46b30ea4940db5d44"
      public $gas =>
      string(3) "0x0"
      public $input =>
      string(2) "0x"
      public $to =>
      string(42) "0x002e922e6d00fdfffb050762e3123bbe1c2ed9a5"
      public $value =>
      string(13) "0x9184e72a000"
    }
    public $blockHash =>
    string(66) "0x6129757d968f4301b01f02dc20317206d6f6b43c2232e458d5a0f0c9a6f306f8"
    public $blockNumber =>
    int(20232)
    public $result =>
    class stdClass#472 (2) {
      public $gasUsed =>
      string(3) "0x0"
      public $output =>
      string(2) "0x"
    }
    public $subtraces =>
    int(0)
    public $traceAddress =>
    array(0) {
    }
    public $transactionHash =>
    string(66) "0x1be45dc3795144a056f5df3ce697e79044fc4e3b4639cfdf78103b1ba1b5ba78"
    public $transactionPosition =>
    int(0)
    public $type =>
    string(4) "call"
  }
}
  1. fromBlock: 'earliest' + fromAccount for example '0x6c637709f5ba4c1cdf758fb46b30ea4940db5d44' (only 1 tx on ropsten so far) crashes parity with:
2016-11-22 14:31:59  Imported #20479 911d…446c (0 txs, 0.00 Mgas, 0.99 ms, 0.52 KiB)
thread '<unnamed>' panicked at 'Expected to find a trace. Db is probably corrupted.', ../src/libcore/option.rs:705
stack backtrace:
   1:     0x7f8de41b702f - <unknown>
   2:     0x7f8de41bee2d - <unknown>
   3:     0x7f8de41bd78a - <unknown>
   4:     0x7f8de41bdd88 - <unknown>
   5:     0x7f8de41bdc22 - <unknown>
   6:     0x7f8de41bdb60 - <unknown>
   7:     0x7f8de41bdae1 - <unknown>
   8:     0x7f8de41fa10f - <unknown>
   9:     0x7f8de41fa185 - <unknown>
  10:     0x7f8de3d20472 - <unknown>
  11:     0x7f8de3d50373 - <unknown>
  12:     0x7f8de37bf098 - <unknown>
  13:     0x7f8de377ab18 - <unknown>
  14:     0x7f8de3b1a787 - <unknown>
  15:     0x7f8de3b1b904 - <unknown>
  16:     0x7f8de3b1adc3 - <unknown>
  17:     0x7f8de3b1d943 - <unknown>
  18:     0x7f8de3afce90 - <unknown>
  19:     0x7f8de3af5bfd - <unknown>
  20:     0x7f8de3af5d68 - <unknown>
  21:     0x7f8de3af5ada - <unknown>
  22:     0x7f8de3af3de3 - <unknown>
  23:     0x7f8de3af21b5 - <unknown>
  24:     0x7f8de3ae6a2d - <unknown>
  25:     0x7f8de3aef57f - <unknown>
  26:     0x7f8de3ae62e7 - <unknown>
  27:     0x7f8de41c68f6 - <unknown>
  28:     0x7f8de3aefc54 - <unknown>
  29:     0x7f8de41bc560 - <unknown>
  30:     0x7f8de27690a3 - start_thread
  31:     0x7f8de317962c - clone
  32:                0x0 - <unknown>
2016-11-22 14:31:59  Finishing work, please wait...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Closed', ../src/libcore/result.rs:799
stack backtrace:
   1:     0x7f8de41b702f - <unknown>
   2:     0x7f8de41bee2d - <unknown>
   3:     0x7f8de41bd78a - <unknown>
   4:     0x7f8de41bdd88 - <unknown>
   5:     0x7f8de41bdc22 - <unknown>
   6:     0x7f8de41bdb60 - <unknown>
   7:     0x7f8de41bdae1 - <unknown>
   8:     0x7f8de41fa10f - <unknown>
   9:     0x7f8de4141a75 - <unknown>
  10:     0x7f8de4155fa9 - <unknown>
  11:     0x7f8de3b05249 - <unknown>
  12:     0x7f8de3829fef - <unknown>
  13:     0x7f8de3909c2c - <unknown>
  14:     0x7f8de3912453 - <unknown>
  15:     0x7f8de391ef7d - <unknown>
  16:     0x7f8de41c68f6 - <unknown>
  17:     0x7f8de41bd001 - <unknown>
  18:     0x7f8de30b2b44 - __libc_start_main
  19:     0x7f8de376382d - <unknown>
  20:                0x0 - <unknown>

@tomusdrw
Copy link
Collaborator

tomusdrw commented Nov 22, 2016

Sorry, just checked the format, in my example fromAccount/toAccount is ignored hence the results are the same.

The correct format is (note it's fromAddress: <Array of Addresses>)

curl --data '{"jsonrpc":"2.0", "id":1, "method": "trace_filter", "params": [{ "fromAddress": ["0x385acafdb80b71ae001f1dbd0d65e62ec2fff055"] }] }' -X POST -H Content-Type:application/json 

I will move point 3. to a separate issue: https://github.com/ethcore/parity/issues/3571

@SinErgy84
Copy link
Author

SinErgy84 commented Nov 22, 2016

Thanks, so only point 3 remains.

@tomusdrw P.S.: sorry, haven't searched the api for solution intense enough. your comment is the solution for the requested feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
M6-rpcapi 📣 RPC API. Z1-question 🙋‍♀️ Issue is a question. Closer should answer.
Projects
None yet
Development

No branches or pull requests

2 participants