How on Earth do you change the sending address (on the latest release?)

No matter what order the accounts are listed on the Owned Account panel, there's no way to alter which one sends the transaction. I've looked all over. Is there seriously no way to change the sending account?

Comments

  • SmithgiftSmithgift Member Posts: 64
    It appears that the account at the top of the Owned Account panel does, in fact, matter. It picks the first one that could possibly afford the transaction and sends it.

    Nevertheless, this seems really, really dangerous. I'd like very much to make sure which account is sending which transaction before sending it in the first place.
  • JasperJasper Eindhoven, the NetherlandsMember Posts: 514 ✭✭✭
    Yep, alethzero interface needs work. Mist(previously known as Ethereal) is intended to have the better gui, not sure if alethzero is getting a makeover.

    Note that the JS api can choose any of those privkeys. Some of the code i wrote selects the private key relevant. (and displays that you have a private key to an address, if that is the case)
  • chevdorchevdor Member Posts: 6
    Please note that for testing you CAN drag and drop your addresses in order to bring on top the one of your choice.
  • AronVanAmmersAronVanAmmers Amsterdam, NetherlandsMember Posts: 40 ✭✭
    I've noticed the same in AlethZero PoC8/win. Dragging/dropping an address to the top of the list will make that the sending address for sending transactions using the "New transaction" dialog.

    From the Javascript API when using web3.code.transact() it's possible to pass the sending address in the from parameter, as shown in this old version of the API docs (in the current version this function is missing :warning: although it does exist in the current implementations, did I miss something?).

    When using Solidity contracts generated from ABI, there is no such option AFAIK. For example the following dummy contract that just stores the address it was called from:
    contract addressList {
    	mapping (address => address) public addresses;
    
    	function saveMyAddress() {
    		addresses[tx.origin] = tx.origin;
    	}
    }
    
    And calling it from Javascript like so:
    > var addressList = web3.eth.contractFromAbi([{"constant":false,"inputs":[],"name":"saveMyAddress","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addresses","outputs":[{"name":"","type":"address"}],"type":"function"}]);
    > var a = addressList("0x...")
    > a.saveMyAddress()
    The address used for calling will always be the same, no matter how much you drag and drop. Also, setting web3.eth.coinbase has no effect on it.

    There is a way though. For Solidity contracts, you can pass the same set of options in the _options collection. So setting an option from to another account you own will make that account be used as the sender for transactions to the contract:
    > a._options["from"] = "0x..."
    > a.saveMyAddress()
  • AronVanAmmersAronVanAmmers Amsterdam, NetherlandsMember Posts: 40 ✭✭
    Indeed I missed something, in the latest API the function is called web3.eth.sendTransaction().
Sign In or Register to comment.