baidux 发表于 2012-6-11 03:17:11

通过以太坊发行ERC-20代币(token)

2017年开始,区块链ICO项目层出不穷,市场热度一波更胜一波,很多ICO都是通过以太坊智能合约发行自己的代币(token),具体怎样才能发行代币呢?本文进行具体详细的介绍。准备工作
[*]以太坊官网ERC20标准合约代码:https://www.ethereum.org/token#minimum-viable-token
[*]MetaMask:一款在谷歌浏览器Chrome上使用的插件类型的以太坊钱包
[*]Remix:Solidity(以太坊智能合约开发语言)开发神器,https://ethereum.github.io/browser-solidity
[*]以太坊web钱包:https://www.myetherwallet.com/#send-transaction如果以上网站不能打开,请使用***×××。
安装MetaMask第一步:打开Chrome浏览器,在地址栏里输入:chrome://apps/,点击“Chrome网上应用商店”https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken1.png第二步:搜索metamask插件https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken2.png第三步:安装,第一次安装时会出现“添加至CHROME”按钮,直接点击进行安装https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken3.png安装成功在浏览器右上角会出现metamask图标https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken4.png第四步:选择网络https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken5.png
[*]Main Ethereum Network:主网络
[*]Ropsten Test Network:Ropsten测试网络
[*]Kovan Test Network:Kovan测试网络
[*]Rinkeby Test Network:Rinkeby测试网络
[*]Localhost 8545:本地测试网络
[*]Custom RPC:配置更多的私有网络主网络上的操作都要用到真实的ETH,测试网络可以申请免费的测试币进行操作,我们可以先在测试网络上进行操作,然后再到主网络上进行操作。
免费测试币的申请,可以在网上搜索一下相关教程第五步:创建钱包账号https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken6.png输入尽量复杂的密码,并保存好助记词,一旦忘记密码和丢失了助记词,该钱包将不能再使用。第六步:转入0.1个ETHhttps://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken7.png可以通过二维码或者把地址复制到剪贴板,进行转入操作。编译智能合约,发行token第一步:编译合约打开官方网站:https://www.ethereum.org/token#minimum-viable-token ,拷贝官方标准合约代码。https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken8.png打开在线IDE:https://ethereum.github.io/browser-solidity ,新建一个文件,粘贴合约代码。https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken9.png先编译
https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken10.png设置参数:
第一个参数:发行token的数量
第二个参数:代币的全称
第三个参数:代币的简称,比如BTC、ETH
格式,例:1300000000,"Person name token","PNT"
https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken11.png生成成功会弹出确认界面,可以看到需要的手续费https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken12.pnghttps://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken13.png然后弹出提×××约的界面,点击“SUBMIT”https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken14.png可以看到正在提交中https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken15.png点开进入网页,可以查看状态https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken16.png第二步:添加发行的代币到钱包中向钱包账号中添加发行的tokenhttps://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken17.png填入提×××约时生成的合约地址https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken18.png添加成功,我们发行的代币将会出现在我们的钱包账号中。https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken19.png第三步:验证合约打开验证合约网址https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken20.pnghttps://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken21.png添加合约信息https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken22.png合约信息包括:
[*]合约地址:提交成功后生成的合约地址
[*]合约名称:编译时我们选择的MyAdvancedToken
[*]版本号:编译时使用的版本号
https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken23.png
[*]是否优化:否
[*]合约代码
[*]合约中构造函数传入的参数的ABI码
点击查看合约状态页面中的合约地址
https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken24.png选择:Code标签,“Constructor Arguments”中就是ABI码
https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken25.png点击按键,进行验证和发布https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken26.png验证和发布成功会出现如下界面:https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken27.png在合约查看页面出现如下信息:https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken28.png将代币转出MetaMask不支持转出Token,我们使用以太坊的web钱包进行操作,打开:https://www.myetherwallet.com/#send-transaction,
按图片中提示进行操作https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken29.png点击后,定位到网页右下角,按如下提示进行操作https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken30.png出现如下错误信息,是因为“PNT”这个符号已经有人使用了,所以在发行代币前最好取一个没有使用过的简称,这里我们可以换一个名称再次提交https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken31.png添加成功后如下显示:https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken32.png现在转到我们自己的imToken钱包中https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken33.png生成交易https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken34.png确认发送https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken35.png弹出MetaMask操作界面,进行提交https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken36.png成功提交,浏览器底部出现如下提示:https://blockchain-imgs.oss-cn-shenzhen.aliyuncs.com/create-ethtoken/createtoken37.png至此,我们自己的代币就发行成功了,然后就可以进行宣传包装,然后ICO等,充分发挥你的想像力,创造奇迹。http://you.d1v1.com/data/attachment/forum/201811/29/070613elz59p8uq80uq1tb.jpg
http://you.d1v1.com/data/attachment/forum/201811/19/021949pp04ek5vitm4j5iq.jpg


©著作权归作者所有:来自51CTO博客作者thao888的原创作品,如需转载,请注明出处,否则将追究法律责任
页: [1]
查看完整版本: 通过以太坊发行ERC-20代币(token)