Closed riyazlafir closed 6 years ago
There's a UDF get_balance()
. You can call it like ordinary utility function in SQL.
Example:
SELECT block_miner, get_balance(block_miner), count(*) AS num, count(*)/100000.0 AS PERCENT
FROM block
WHERE block_number<=100
GROUP BY block_miner
ORDER BY num DESC
LIMIT 15;
More details here: https://github.com/xiaoyao1991/presto-ethereum/blob/master/src/main/java/im/xiaoyao/presto/ethereum/udfs/EthereumUDFs.java#L75-L94
Hi Xiaoyao , I'm getting this error "Query 20180507_052320_00005_xjvrh failed: line 1:21: Function get_balance not registered" .
@riyazlafir I'm sorry. It should be eth_getBalance()
@xiaoyao1991 Thanks . eth_getBalance() method works fine but I didn't get any ether balance from my default account .
this is the query I tried : SELECT block_miner, eth_getBalance(block_miner), count(*) AS num, count(*)/100000.0 AS PERCENT FROM block WHERE block_number<=100 GROUP BY block_miner ORDER BY num DESC LIMIT 15;
and out put : Query 20180507_070040_00017_xjvrh failed: Cannot get block number:
I'm trying to query parity ropsten network .
Parity running command : parity --chain ropsten --jsonrpc-apis "eth,net,web3,personal" --jsonrpc-cors '*' --jsonrpc-interface 0.0.0.0 --jsonrpc-port 8545 --jsonrpc-hosts="all"
do you know why i'm getting this out put ? do I need to add or change anything ?
Most likely you are running a warp sync parity client right? In that case, parity is only keeping the latest few blocks on the disk. The early blocks(the current query is only looking at the very first 100 blocks) info cannot be retrieved.
You can try with a different range of blocks in the query. For example, you can change the block_number <= 100
to block_number > eth_blockNumber() - 100
Hi , I need to know how can I get account balance of the given ethereum account with presto-ethereum ? what is the presto query for this ?
thanks.