I'm running simple tests using geth console before making implementation in java project. I'm using geth 1.5.4 running as one private node with mining. Here is the command I use to start geth:

geth --datadir /home/javauser/geth_dev/data init /home/javauser/geth_dev/genesis_block_test.json
geth --networkid 123456 --identity "TestNode"  --nodiscover --mine --maxpeers 0 --datadir /home/javauser/geth_dev/data --rpc --rpcaddr "" --rpcapi "admin,debug,miner,shh,txpool,personal,eth,net,web3" --unlock 0,1,2,3

The content of the genesis_block_test.json:

  "nonce": "0x0000000000000042",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x200",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "nonce"      : "0x0000000000000452",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "",
    "gasLimit": "0xffffffff",
    "alloc": {
        "0x3a5a8f7951f10aeccc331899dcf291e33ea20355": {
          "balance": "1000000000000000000011"
        "0x4aab741837102f5663bfa36fcea844a2bd46be3f": {
          "balance": "1000000000000000000012"
        "0x1d470f694369586005f4eef6ca44b08513ea7bea": {
          "balance": "1000000000000000000013"
        "0xdf2bbb6ce06c9d3962da556ed321ba8ed96e7188": {
          "balance": "1000000000000000000014"

I've created 4 accounts which already has some eth.

Also I've created several multisig wallets based on three different solidity contracts.

So the scheme for running tests:

var _owners = [eth.accounts[0],eth.accounts[1]] ;
var _required = 2 ;
var _daylimit = web3.toWei(10, "ether");

Then goes wallet creating, then I'm sending some eth from the accounts[0] to my wallet:

eth.sendTransaction({from: eth.accounts[0], to:  wallet.address, value: web3.toWei(100, "ether")});

Then waiting for transaction mined and checking the result using

web3.fromWei(eth.getBalance(wallet.address), "ether");

At this step I found the the first wallet implementation does not recieve any eth, the second and the third implementations works fine.

Then I'm trying to send some eth to the third account running command for the second wallet implementation:

h = wallet.execute(eth.accounts[2], web3.toWei(5, "ether"), web3.toHex('send some money'), { from: eth.accounts[0]});
wallet.confirm(h , { from: eth.accounts[0] })

and running for the third:

var nonce1 = wallet.getNonce(eth.accounts[1], web3.toWei(50, "ether"), "");
var transHash = wallet.submitTransaction(eth.accounts[1], web3.toWei(50, "ether"), "", nonce1, {from:eth.accounts[0], sender:eth.accounts[0]})

And gets nothing. Transaction mined but balance of the wallet and accounts[2] do not change. I've tried to send eth value less then daily limit, to change requirement, but nothing helps. What is my mistake?


The issue here is that you are confusing the transaction hash with the "operation hash". The command

h = wallet.execute(eth.accounts[2], web3.toWei(5, "ether"), web3.toHex('send some money'), { from: eth.accounts[0]});

is actually returning the transaction hash, whereas the contract wants you to refer to the pending operation by its "operation hash", which the contract defines separately (contracts do not know tx hashes).

What you need to do is set up a listener for the event that the contract will emit, which is called ConfirmationNeeded.

This should work:

wallet.ConfirmationNeeded({address:eth.accounts[2]}, function(err, res){
        wallet.confirm(res.args.operation, {from: eth.accounts[0]});

Set that listener before using the execute method, and it will automatocally authorize any transaction. That's obviously not what you want in a production environment, but it shows what the process should look like.

| improve this answer | |

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.