Am trying to deploy a contract to "Ropsten Testnet" network. I have an account to which i have managed to transfer 6 ethers through faucet. My account's "ETH Balance" shows 6 ethers, from site https://ropsten.etherscan.io/address/. But web3.eth.getBalance('address')
for some reason still gives me a zero balance
on truffle console.
I am therefore not able to deploy my Contract to "Testnet".
I get an error as:
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value
Below is my geth command.
geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"
Not sure why the 6 ethers are not reflecting on my personal account balance.
Best Answer
Is your node fully synced? I guess this is the main reason why your eth balance is 0. The balance will be zero unless you sync to the block in which you received test ethers.
In order to deploy the contract, you could use MyEtherWallet and Remix. Steps for the same are quite simple.
Else you can also use Remix with Metamask for the same. Import your account to metamask and deploy contract directly from remix.
Update:
How to know if your blockchain is synced ?
You can check whether your node is syncing by:
If your node is not syncing
eth.syncing
returnsfalse
. Else it returns output likeThis means you have downloaded 10000 blocks where total blocks are 1822434.
You can check the block in which you received the ether balance by the
transactionHash
. If you have transaction hash you can useeth.getTransactionReceipt(txHash)
to check the block in which your transaction was included. If you have downloaded the blockchain upto that block then your balance will appear. Note: If you are using fast sync, you may have to wait till complete node is in sync to see your balance not only syncing till the block in which your transaction was included.