生产环境手把手部署ERC20智能合约

工具
  • rimex http://remix.ethereum.org/
  • metamask https://metamask.io/
  • ERC20 代码 https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/examples/SimpleToken.sol
合约代码
  • SimpleToken.sol 自定义Contract代码,继承自StandardToken,自定义合约代码全在这里,其他sol文件为准标准化ERC20代码,标准代码经过安全审计建议不要更改。这里发发10000ExampleToken, 18位小数,全部token放到0x8fe35Af6277xxxxxxxxxxxxc2910961dddf地址里。
  • ERC20.sol
  • ERC20Basic.sol
  • SafeMath.sol
  • StandardToken.sol 标准ERC20代码。
    851155-20180607104136570-328732473.png
部署步骤
  1. 下载metamask插件,导入或者生成钱包。ERC20部署一次大概消耗0.006ETH,确保钱包里余额足够。

  2. 打开rimex,新建sol文件,将合约代码复制进去,然后compile。
    851155-20180607103609196-1370557160.png

  3. compile成功后,开始部署,点击rimex右上角run,enviroment选择inject web3,account会自动检测到metamask的账户地址,gaslimit默认数值,然后下拉框选择SimpleToken,然后Deploy。
    851155-20180607103724017-59040502.png
    851155-20180607104028584-146470406.png

  4. 确认Gas limit 和Gas Price,没问题点submit就完成,之后等待contract被打包即完成合约部署。一次ERC20合约部署费用大概在0.008ETH左右。
    851155-20180607103727188-1067942098.png

  5. 欢迎讲你的token打到我的地址 :P

    0xE7B46DF76776a587A5fC8BaE0790fB028161d327

Token钱包管理
  • 提交PR给imToken https://github.com/consenlabs/token-profile
  • 模板https://github.com/consenlabs/token-profile/blob/master/erc20/$template.json
  • 等到imToken repo接受了你提交的代码,就能在imToken里面搜到了。
Truffle部署遇到的未知问题
coray@ubuntu:~/code/ico/Test$ truffle migrate
Using network 'development'.

Running migration: 1_initial_migration.js
>> Unlocking account 0xa550c561b919xxxxxxxxxxxx3cf67d3e72
>> Deploying migration
  Replacing Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: exceeds block gas limit

./geth --exec  "eth.getBlock('latest').gasLimit" attach  geth.ipc 

5000

来改了好几次Truffle配置文件的gas值还是会报这个error。应该是节点的问题,没能解决。

转载于:https://www.cnblogs.com/xiaoxiaoleo/p/9146031.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值