2

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://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa34969124257[email protected]:30303"

Not sure why the 6 ethers are not reflecting on my personal account balance.

1 Answer 1

3

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.

  • Compile your code from remix online solidity compiler. Copy the bytecode from here.
  • Open my ether wallet. Go to Contracts--> Deploy contract.
  • Choose the network to Ropsten from top-right corner.
  • Paste the bytecode and unlock you wallet using any of the provided methods and deploy the contract.

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:

eth.syncing

If your node is not syncing eth.syncing returns false. Else it returns output like

{ currentBlock: 10000, highestBlock: 1822434, knownStates: 1, pulledStates: 0, startingBlock: 90 }

This 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 use eth.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.

6
  • thanks for your swift response. I have been running geth for the past three days on "fast" mode, but couldn't succeed in getting the right balance. I got confused and did a --removedb. Have restarted again in a "full" mode. I ran a eth.syncing and could see, '{ currentBlock: 68, highestBlock: 1822434, knownStates: 1, pulledStates: 0, startingBlock: 1822318 }' Am i proceeding in the correct direction. How do i make sure, i have synched the block in which i have received my test ethers. Is it through the periodic checks i make on my balance. Oct 7, 2017 at 12:09
  • I have updated my answer. Oct 7, 2017 at 12:46
  • Thanks for your inputs. I have successfully deployed my contract through "MyEtherWallet" and "Remix". The Transaction is pending. Oct 7, 2017 at 13:52
  • Will i be able to call the Contract function once the Transaction is through. Currently am not able to invoke the Contract, and i get the following error, 'has not been deployed to detected network (network/artfact mismatch)' Oct 7, 2017 at 14:06
  • Yeah. Wait for contract to be deployed. Once deployed you can call your contact methods. Oct 7, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.