Do not send eth directly to an Ethereum contract

in Cryptomission3 years ago

Ethereum Smart Contract

In general, the Ethereum smart contract coding system allows you to receive or send tokens through them. But there are bigger problems. For example, you can not send eth directly to a smart contract, and you have to send and receive tokens instead, but what is the reason for this error, and how can we fix it?

Each Ethereum contract can be coded so that ETH can be sent to the contract address. This method makes the operation of Ethereum Smart Contract easier, and there is no need for different applications to work with Smart Contract.

send-Ethereum-gID_6.jpeg

Do Not Send Eth Directly To An Ethereum Contract

But just as you can enable this feature by embedding a line of code in a smart contract, we need to keep in mind that sending ETH directly to a contract is not the right thing to do. According to solidity documents, when you enable this code snippet, more than 2300 gases are required to send each ETH to Ethereum Smart Contract . So this becomes one of the most costly smart contract processes.

The error when sending ETH to an Ethereum contract address is also due to default contracts called ECRECOVER. The fallback process in ECRECOVER requires more than 2300 gases to carry out ETH transmission operations. So you better not do that and only use tokens for smart contracts.

Sort:  

These has fees are crazy! But worth going through because you learn first hand and so build the experience! Good read!

thank you a lot

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.029
BTC 63788.86
ETH 2476.31
USDT 1.00
SBD 2.66