I am new to Ethereum dev.

I wrote the code below in my local node to transfer 1 ether between my two Rinkeby testnet.

From account: 0xffD8eb81304291AFcA2C4DA5D26B691b8CC81Bd5
It has 21 ether in Rinkeby (Hope this is sufficient).

// Environment
"web3": "^0.19.1"

Version: 1.7.2-stable
Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2
Operating System: darwin

My nodejs code:

var Web3 = require('web3');
var util = require('ethereumjs-util');
var Tx = require('ethereumjs-tx');
var lightwallet = require('eth-lightwallet');
var txutils = lightwallet.txutils;

var web3 = new Web3(

new Web3.providers.HttpProvider('https://rinkeby.infura.io/qyft9l9yABZ7tJuoX8R4')
//new Web3.providers.HttpProvider('')

var addr1 = '0xffd8eb81304291afca2c4da5d26b691b8cc81bd5';
var addr2 = '0xba5453837f30b2ba413c06567dd9ea812abf123f';
var privateKey = new Buffer('bf36e0ba1bb26ad4949df0d92554b8702cb595a23410ba8ecac8dbde0d607dfc', 'hex');

var rawTx = {
chainId: web3.toHex('4'),
gas: web3.toHex('21000'),
gasPrice: web3.toHex('25000000000'),
gasLimit: web3.toHex('90000'),
from: '0xffd8eb81304291afca2c4da5d26b691b8cc81bd5',
to: '0xba5453837f30b2ba413c06567dd9ea812abf123f',
value : web3.toHex(web3.toWei(1, "ether"))


var tx = new Tx(rawTx);
var serializedTx = tx.serialize();

web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
if (!err)

I always end up with this below error msg :-(
Same happens for me in other private network and mainnet also.

Can you please tell how to get rid of this insufficient funds error.

Error: insufficient funds for gas * price + value at Object.InvalidResponse (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/web3/lib/web3/errors.js:38:16) at /Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/web3/lib/web3/requestmanager.js:86:36 at XMLHttpRequest.request.onreadystatechange (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/web3/lib/web3/httpprovider.js:118:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/xhr2/lib/xhr2.js:64:18) at XMLHttpRequest._setReadyState (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/xhr2/lib/xhr2.js:354:12) at XMLHttpRequest._onHttpResponseEnd (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/xhr2/lib/xhr2.js:509:12) at IncomingMessage. (/Users/antonyjohnson/Documents/development/angularjs/mean/todo-app/todo-api/node_modules/xhr2/lib/xhr2.js:469:24) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1056:12)

1 Answer 1


This isn't an coding error, you just havn't the 1 eth you try to send. And your GETH isn't in Rinkeby, you are in main network :

Network Id: 1

This is the id for main network. Rinkeby is 4. You can start geth with --rinkeby, it will automaticaly change network id, genesis, ...

  • The code is connected to rinkeby only and also the accounts I have used are from Rinkeby. The geth network id = 1 was coming when I used console command : geth version in my mac os console.
    – antjohns
    Dec 9, 2017 at 16:47
  • "network id = 1 was coming when I used console command" yeah, what the console said is over all other information, because it is created by the node (geth it self), the client (geth attach) will just make it printable (beautifier the json). I verify now and with 18.xx of geth, on rikeby network id = 4 and main network is 1. For rinkeby address and main address, it is the same things, so you can have the same address for both network, juste balance will not shared.
    – Jorropo
    Dec 9, 2017 at 22:29
  • Like you said i started get with --rinkeby <br/> console.log(web3.version.network); --->>> 4 But Still I get the same Error: insufficient funds for gas * price + value . :-(
    – antjohns
    Dec 10, 2017 at 7:17
  • 1
    The issue is solved. I had mistakenly used the wrong private key for signing.
    – antjohns
    Dec 10, 2017 at 13:43

Your Answer

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

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