1.任何浏览器开启Remix
2.代币合约范例,Ethereum 官网有提供一个最小可行的代币合约(MINIMUM VIABLE TOKEN):
pragma solidity ^0.5.1;
contract MyToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor (uint256 initialSupply) public {
balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens
}
/* Send coins */
function transfer(address _to, uint256 _value) public {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
balanceOf[msg.sender] -=

本文介绍了如何在Ethereum上使用Remix部署和执行一个最简单的智能合约——MINIMUM VIABLE TOKEN。通过编译、本地部署合约,并演示查询余额和转移代币的过程,详细阐述了智能合约的运作机制。
最低0.47元/天 解锁文章
7026

被折叠的 条评论
为什么被折叠?



