Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: califminer on June 15, 2020, 04:32:17 AM



Title: listreceivedbyaddress for ETH
Post by: califminer on June 15, 2020, 04:32:17 AM
Under bitcoin-core, when one fires the command:
Code:
bitcoin-cli listreceivedbyaddress 1 true
The output is something like:
[ {
    "address": "address-goes-here",
    "amount": 0.00000000,
    "confirmations": 10,
    "label": "label1",
    "txids": [
    ]
} ]


What is the equivalent command for Ethereum (geth)?
I just need to know the number confirmations for an ethereum address while it is receiving coins.
I am running the daemon with indexing.. currently testing on rinkeby.


Title: Re: listreceivedbyaddress for ETH
Post by: HCP on June 15, 2020, 04:42:13 AM
Not wanting to point out the obvious... but Bitcoin Technical Support is for: "Questions regarding issues with Bitcoin Core, nodes, the Bitcoin network, transactions, and addresses."

You might have better luck asking on the Altcoins board here (https://bitcointalk.org/index.php?board=67.0), or some of the ETH community boards like:
https://www.reddit.com/r/ethereum/

or perhaps try some of the other resources here: https://ethereum.org/community/


Title: Re: listreceivedbyaddress for ETH
Post by: Heisenberg_Hunter on June 15, 2020, 02:52:28 PM
As HCP suggested, you could move this topic to Altcoin Discussion board by clicking on the Move Topic button in the bottom. The listreceivedbyaddress command in the Bitcoin Core is different from just receiving the number of confirmations of a bitcoin tx. Rather listreceivedbyaddress is used to list all the bitcoin addresses which has received transactions irrespective of number of confirmations. You can get all the addresses which has 0 transactions by changing the argument to 0.

In terms of Ethereum, the number of confirmations for a transaction is found by subtracting the Current Ethereum Block Number and the Block in which the transaction was mined. Here, you can find the Block in which tx was mined using eth_getTransactionByHash rpc command which displays the required information about the transaction hash.

Code:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["txhash"],"id":1}'

This inturn returns with the block number for the tx hash and the current Block number can be found using eth_blockNumber rpc command.

Code:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

This will return the most recent block number which was mined. If you don't really wan't to go through all these, try web3.eth.getblockNumber - web3.eth.getTransaction('txhash').blockNumber