合约代码:
// SPDX-License-Identifier: CC-BY-SA-4.0
// Version of Solidity compiler this program was written for
pragma solidity 0.6.4;
contract Faucet {
//Purpose:receive ETH coin
receive() external payable {}
// Give out ether to anyone who asks
function withdraw(uint withdraw_amount) public {
// Limit withdrawal amount 0.1eth => 100000000000000000 wei
require(withdraw_amount <= 100000000000000000);
// Send the amount to the address that requested it
msg.sender.transfer(withdraw_amount);
}
}
编译合约:
使用RemixIDE将合约编译成EVM字节码
注册合约:
将合约注册到区块链网络上需要一个特殊的交易,这个交易的目标地址是0x00000000000000000,也被称为零地址,这是一个特殊的地址,用来告诉以太坊&#x