7

While experimenting. I creating a wallet contract. Here is the address: https://etherscan.io/address/0xC23501aB1E8E5C5EDB0fFA83C5A4DcFb9c31a355 I sent some ether to it. Now I want to send the ether from the wallet contract to a different account. I go to send, I input amount, check the gas, when I press send. The amount shows 0. I think I did something wrong with the creation of the wallet contract in Mist.

  • You have to invoke the contract. Amount 0 is perfectly fine, go ahead and create that transaction. – Waqar Lim May 3 '16 at 15:03
  • 1
    If I were you, I would rather make my experiments on the testnet this would be less expensive. But if you have money to spend, go on, we will earn more mining fees ;) – Nicolas Massart May 3 '16 at 15:52
  • 1
    @Gianni D'Alerta -- did you get this issue resolved? If so, please post what solved it and choose it as the answer for others who may have the same issue later. – tayvano May 16 '16 at 19:51
3

I prefer to use geth rather than mist to interact with contracts. The command line lets you do exactly what you intend vs working through a GUI.

The first thing you need is the contract ABI. This is a piece of javascript (or JSON) which defines how you can interact with the contract. Every contract on the blockchain has one -- a simple greeter contract, Etheria, the DAO... all of them.

To get the abi, paste your contract code into a compiler e.g. https://ethereum.github.io/browser-solidity/.

This "endowment retriever" contract may be similar to what you're trying to do. When compiled, its abi is revealed to be:

[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"getContractCreationValue","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[],"name":"sendOneEtherHome","outputs":[],"type":"function"},{"inputs":[],"type":"constructor"}]

Compile your contract and you'll get something that looks similar. (The above code will not work for your contract.)

Now that you have the ABI and the contract address, you’re ready to gain interactive access to the contract with geth.

var abi = <cut and paste the contract abi here>;
var contract = web3.eth.contract(abi).at(<contract address>);
contract.functionname();
contract.functionname.sendTransaction(...);

Hopefully the contract from which you're trying to retrieve funds contains a method for retrieving the ether and you have permission to do so. In my "endowment retriever" example, you'd do:

var tx = endowmentretriever.sendOneEtherHome.sendTransaction({from:eth.coinbase});

If you post the entire contract (use a gist, probably), I might be able to help further and/or determine if retrieval is even possible.

Good luck!

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.