I wrote the following script to send Ether. I can't figure out why the balance is still the same after I send out the Ether. I re run this script multiple times but nothing changes with the balance. Even when I check the blockchain network at https://ropsten.etherscan.io/address/0xbf14644246ebb0209bdb03be0cd1a3b27fc009af
I don't see either the test Ethers that I mined nor the transaction.
I am currently using the test network geth --testnet
What is wrong?
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var coinbase = web3.eth.coinbase;
console.log('coinbase address',coinbase);
var balance = web3.eth.getBalance(coinbase);
console.log('balacance', balance.toString(10));
var recipient_address = web3.eth.accounts[1]
console.log('recipient address',recipient_address);
web3.personal.unlockAccount(coinbase, 'love2017');
console.log('coinbase address',coinbase);
web3.eth.sendTransaction({
from: coinbase,
to:recipient_address ,
gas: 200000,
value: web3.toWei(1, "ether"),
}, function (err, address) {
if (!err) {
console.log('success transaction address is', address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385"
var balance = web3.eth.getBalance(coinbase);
console.log('balance', balance.toString(10));
} else {
console.log(err)
}
});
This is what I get in the console:
coinbase address 0xbf14644246ebb0209bdb03be0cd1a3b27fc009af
balacance 8930000000000000000000
recipient address 0x15fd7829542d2e851a9787d76f027992b89b2398
coinbase address 0xbf14644246ebb0209bdb03be0cd1a3b27fc009af
success transaction address is 0x093b9306e7b0517e105168b9cd4f42344eddcb7cfa10e9f6d9a095cf9cd1e66c
balance 8930000000000000000000