Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pendingTransactions subscription returns transaction hash instead of object #1144

Closed
kot-begemot opened this issue Oct 26, 2017 · 6 comments
Closed
Assignees
Labels
Documentation Relates to project wiki or documentation

Comments

@kot-begemot
Copy link

kot-begemot commented Oct 26, 2017

web3.js
version: 1.0.0-beta.24

nodejs
version: v8.4.0

Geth
Version: 1.7.0-stable
Git Commit: 6c6c7b2af3efdad4d2f64f70f3a724af434bbcd2
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.8.3
Operating System: linux

tl;dr

subscription returns transaction hash instead of transaction receipt

Full story short

Here is my code

var Web3 = require('web3');
global.web3 = new Web3("ws://127.0.0.1:8585");

web3.eth.subscribe('pendingTransactions', function(error, result){
  if (!error) {
    console.log("Transactions matching 1");
    console.log(result);
  }
})
.on("data", function(trxData){
  console.log("Transactions matching 2");
  console.log(trxData);
});

Here is log I am getting

$ nodejs runner.js 
Transactions matching 2
0xfd7ad0fd246eb775347b0b5ae6899d605d0acc20e13a50f01425301d1e28d655
Transactions matching 1
0xfd7ad0fd246eb775347b0b5ae6899d605d0acc20e13a50f01425301d1e28d655
Transactions matching 2
0x0ff8dbb3a2fae70ca97022591e1a9f62cd0b812c482c0050bf4d6b48ad190c3f
Transactions matching 1
0x0ff8dbb3a2fae70ca97022591e1a9f62cd0b812c482c0050bf4d6b48ad190c3f
Transactions matching 2
0x06e747d323cd4d8bfc6c207f5eddd16c71266bdd94e0e558cef64d59d2de7dac
Transactions matching 1
0x06e747d323cd4d8bfc6c207f5eddd16c71266bdd94e0e558cef64d59d2de7dac

Here is web3.js documentation -
http://web3js.readthedocs.io/en/1.0/web3-eth-subscribe.html#subscribe-pendingtransactions

It says

Returns

EventEmitter: An subscription instance as an event emitter with the following events:

"data" returns Object: Fires on each incoming pending transaction.
"error" returns Object: Fires when an error in the subscription occours.
For the structure of the returned object see web3.eth.getTransaction() return values.

Am I getting something wrong? Is that is bug or that is intended behavior?

@shamoons
Copy link

I'm having the same issue.

@madmartian5
Copy link

Also seeing the same.

@youfoundron
Copy link

Having the same issue, using a parity node.

@baiumbg
Copy link

baiumbg commented Jul 30, 2018

Can we get some clarification on this? Calling getTransaction on every hash that I get from the subscription is too slow for me - I have to be getting those pretty much in real time (I have a private geth node running on version 1.8.12), so this is a big deal for me - dunno if getting the whole transaction object instead of just the hash will be as slow as calling getTransaction for each hash. Are there any alternatives currently?

EDIT: I guess one way to solve this is to create a websocket server wherever the node is hosted, which listens for pending transactions and gets more information about them over IPC and emits anything of interest.

@nivida nivida self-assigned this Aug 9, 2018
@nivida nivida added Bug Addressing a bug Documentation Relates to project wiki or documentation and removed Bug Addressing a bug labels Aug 9, 2018
@nivida
Copy link
Contributor

nivida commented Aug 14, 2018

@baiumbg This is an mistake in the documentation we only get the transaction hash from the rpc call as you can see here: https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB#newpendingtransactions

nivida pushed a commit that referenced this issue Aug 15, 2018
@frozeman
Copy link
Contributor

fixed in #1876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Relates to project wiki or documentation
Projects
None yet
Development

No branches or pull requests

7 participants