智能合同是否有可能在后台发送eth?
如果是的话,那么智能契约和web3 html (如果可能的话)会是什么样的呢?
发布于 2021-12-16 13:12:57
是的,您可以像这样使用transfer函数;
function SenEth(address payable beneficiary) pubic{
uint balance = address(this).balance;//This will send all the balance inside the contract
beneficiary.transfer(balance);
}您也可以发送一个固定的金额,而不是全部余额。web3部分将是对契约函数的简单调用。
https://ethereum.stackexchange.com/questions/116698
复制相似问题