Closed dformdotdk closed 6 years ago
You are correct, you can't check the ethereum balance of an address with erc20-php. But you can do it with its dependency.
You could for example use the following code:
<?php require_once 'vendor/autoload.php'; $geth = new \EthereumRPC\EthereumRPC('IP', PORT); $balance = $geth->eth()->getBalance('ETHADDRESS'); ?>
Awesome - Thank you @mrpetfreak 👍
You should be able to perform nearly all RPC functions available to Ethereum node using my "EthereumRPC" package. However this "erc20-php" package is just an interface for working with ERC20 tokens and it also works on top of same EthereumRPC package.
Hi
First of all, thank you for providing this script. It has really helped me with a project I'm working on.
Before sending a transaction I do a balance check, to make sure the account has enough tokens to complete the transfer.
I would like to check the same for ether using eth_getBalance. See https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance
In essence, I would like to check if the account has enough ether to pay for gas. I can't seem to find any reference to eth_getBalance in your script, so I don't think it's supported ATM, but would it be something you would consider adding?
Thanks again :-)