0

I sent ETH to the address of deployment contract,and I mining.But I find this address still doesn't have ETH. Can I send ETH to the address of the deployment contract?

1

1 Answer 1

2

If you're sending ETH to a contract, it triggers the fallback function in the contract. If the fallback function isn't payable (or isn't defined), the transaction will fail and your contract won't get any ether.

You can either create a payable fallback function, or you can create another function in the contract and mark it as payable. Then you can call that function and pass the ETH to the contract.

You can read more about fallback functions in this answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.