4

I'm having trouble getting a couple test transactions to show up in the destination account balance. Code is below. Appreciate someone pointing out whatever move I've made...

Running geth as:

geth --rpc --networkid=34534 --maxpeers=0 --datadir=~/.ethereum/DevChain/ --mine --minerthreads 1 --genesis development_genesis.json console

Console session:

> var receiver = eth.accounts[1];
undefined
> var amount = web3.toWei(1, "ether")
undefined
> var amount = web3.toWei(2, "ether")
undefined
> personal.unlockAccount(eth.accounts[0], “passwd”, 9000)
true
> eth.sendTransaction({from:sender, to:receiver, value: amount})
I0401 19:49:03.928354 eth/api.go:1072] Tx(0x8c3c85c225c76bd558cba37c7336d73aec9825e668da3b241d80119bde3a6d40) to: 0x9a22b931b03768958141afa40d66fa587c7bfd3a
"0x8c3c85c225c76bd558cba37c7336d73aec9825e668da3b241d80119bde3a6d40"
> eth.pendingTransactions
[{
    blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
    blockNumber: null,
    from: "0x87fa50f10eda0ee47376427d4623deae9577c048",
    gas: "0x15f90",
    gasPrice: "0x4a817c800",
    hash: "0x8c3c85c225c76bd558cba37c7336d73aec9825e668da3b241d80119bde3a6d40",
    input: "0x",
    nonce: "0x0",
    to: "0x9a22b931b03768958141afa40d66fa587c7bfd3a",
    transactionIndex: null,
    value: "0x1bc16d674ec80000"
}]
> 
> miner.start(1)
I0401 19:49:13.013921 miner/miner.go:119] Starting mining operation (CPU=1 TOT=2)
true
> I0401 19:49:13.044968 miner/worker.go:564] commit new work on block 28 with 1 txs & 0 uncles. Took 31.004161ms
> checkAllBalances()
  eth.accounts[0]: 0x87fa50f10eda0ee47376427d4623deae9577c048   balance: 135 ether
  eth.accounts[1]: 0x9a22b931b03768958141afa40d66fa587c7bfd3a   balance: 0 ether

I wanted to see 2 ether in that second account. (Actually 3 ether since a prior transaction also never seems to have gone through.)

checkAllBalances() is:

function checkAllBalances() { 
var i =0; 
eth.accounts.forEach( function(e){
     console.log("  eth.accounts["+i+"]: " +  e + " \tbalance: " + web3.fromWei(eth.getBalance(e), "ether") + " ether"); 
i++; 
})
};

The transferred 2 ether just finally showed up, after about 5 blocks were mined. Is that expected behavior?

But then I sent another 3 ether and it showed in other account balance much more quickly. Now I have 0.5 ether pending, with mining output recognizing 1 txn but eth.pendingTransactions still showing it pending.

Is there a private testnet block explorer?

Would love a way to plug in a transaction and get a picture of what's happening.

Appreciate your tips as I learn the basics!

2

Yes. This is an expected behaviour. Transactions will be confirmed and included into the blockchain when it is included into a mined block. This will take at least one mined block.

I don't know of any private testnet explorer.

The way you track transactions in the Ethereum geth console is keep track of the transaction hash displayed after the eth.sendTransaction(...) command is executed, then you can use eth.getTransaction(...) to retrieve the transaction details. In the example below, the transaction was mined in block 84. Before the transaction is mined, blockHash and blockNumber will be null.

> eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], web3.toWei(2, "ether")})
"0xe548890adc667af1f0b9694ddd9da75dd85d17d6ffcaef62aedb63389ac2da9b"
> eth.getTransaction("0xe548890adc667af1f0b9694ddd9da75dd85d17d6ffcaef62aedb63389ac2da9b")
{
  blockHash: null,
  blockNumber: null,
  from: "0x1111903a542ef1ff952eab096eab0517a7d4eeee",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xe548890adc667af1f0b9694ddd9da75dd85d17d6ffcaef62aedb63389ac2da9b",
  input: "0x",
  nonce: 0,
  to: "0x22222a45dce56b6804bbf6a2dc8fae045511ffff",
  transactionIndex: null,
  value: 1000000000000000000
}
... transaction mined ...
> eth.getTransaction("0xe548890adc667af1f0b9694ddd9da75dd85d17d6ffcaef62aedb63389ac2da9b")
{
  blockHash: "0xc74d2b08c28b801344006e477fe99cdc7cd6f3936a4223135eec7b42a04bf999",
  blockNumber: 84,
  from: "0x1111903a542ef1ff952eab096eab0517a7d4eeee",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xe548890adc667af1f0b9694ddd9da75dd85d17d6ffcaef62aedb63389ac2da9b",
  input: "0x",
  nonce: 0,
  to: "0x22222a45dce56b6804bbf6a2dc8fae045511ffff",
  transactionIndex: 0,
  value: 1000000000000000000
}
  • Got it. I erroneously thought that commit new work on block 28 was a sign of block being mined. Thanks! – mowliv Apr 3 '16 at 5:19
  • testnet.etherscan.io for the Morden Testnet Explorer – mtbitcoin Apr 4 '16 at 15:48
  • @mtbitcoin thanks, but my question was about explorers for a local dev test harness of my own. – mowliv Apr 5 '16 at 22:06
  • I am also looking for an explorer for local private chain? – Aman C Jun 21 '16 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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