I'd like to move ether from one arbitrary account to another account following a contract. From the execution method, I'd like to send ether. Can I do that?

contract MultiplyContract{
    address public sender;
    address public receiver;
    uint public price;
    function MultiplyContract(
      address _sender,
      address _receiver,
      uint _price
      sender = _sender;
      receiver = _receiver;
      price = _price;
    function Execution(){
      //sender send ether to receiver//
    function () {
  • I think the question still needs to be clarified, maybe use "arbitrary account to another one"... Otherwise the answer is going to be the same as ethereum.stackexchange.com/questions/3649/… – eth May 6 '16 at 14:13
  • This sounds like an XY problem. What are you actually trying to do? – Nick Johnson May 6 '16 at 22:30
  • @NickJohnson I'd like to make swap trading account. According to the contract info, I'll want let it move ether from one account to another. – lalala May 7 '16 at 1:23
  • @toshikaseda The way to do that is to hold ether in the contract, and keep a map recording individual account balances. – Nick Johnson May 7 '16 at 17:44

No. A contract can only spend Ether from its own funds. Being able to sign a transaction for an arbitrary account would entail the contract having access to said account's private key, making it public for everyone.

  • Thank you Péter. Btw, I'd like to realise derivative, that move ether of one eoa to another one according to a contract. Can I actualise it? – lalala May 7 '16 at 1:27

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.