3

I've often moved ETH around using geth using simple sendTransaction, with say 21 000 gas or 30 000 gas and never had any issue.

For example the following basically always worked for me (there's 30 K gas):

eth.sendTransaction({from:eth.accounts[0],to:"0x....",value:web3.toWei(50,"ether"),gas:30000})

However today I participated in an ICO that stated two things which I find extremely confusing:

  • "We’ve spent a lot of time perfecting the TKN smart contracts and you are only required to send your ETH or token contribution. No further action or ABI is needed."

  • "Set the gas limit at 200,000"

I take it I've got only one question, but which can be formulated differently, so here we go..

If all I'm required to do is sent tokens to an address, why then is a 200 K gas limit needed?

Can the same sendTransaction call that is I'm using to move ETH between simple address be used to sent from a simple address to a smart contract?

Doesn't a sendTransaction to a smart contract's address just raise the balance of that address? What additional code is executed that is not executed in the case of a sendTransaction to a non-smart-contract address?

1

sendTransaction() sends ETH to an address. Contracts have an address in the same way plain "accounts" have addresses. In that way, a contract can be the recipient of sendTransaction().

If ETH is sent to a contract outside of a method call, the contract's default unnamed method is called. This method can update an internal representation of your balance, or even relay calls to another contract.

Actions that method takes need to paid for in gas, and that's why you have an increased gas requirement.

0

I wish I could comment but I'll address your second point about the gas limit. Since more transactions might occur on the network during the token sale, you would need to set a higher gas limit to allow the transaction to go through. The higher the limit, the more likely it gets put into the block. So they probably said that to ensure your transaction actually goes through.

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.