信息安全从业人员^_^
一个未入门de情报学胖子(邮箱:tenghm1986@163.com)
Toggle navigation
信息安全从业人员^_^
主页
About Me
归档
标签
关于智能合约编写/部署以及debug
2018-08-16 10:28:09
443
0
0
heming
#0.参考 [1] [Building an intelligent contract development environment based on testrpc and truffle under Mac](http://www.codeblogbt.com/archives/292379) #1.编写智能合约/迁移步骤 ## 1.1 编写智能合约/迁移脚本 ## 1.2 编译 ``` truffle compile --all ``` ## 1.3 启动测试网络 ``` testrpc //或者私链 geth --datadir "./db" --rpc --rpcaddr=0.0.0.0 --rpcport 8545 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,admin,shh,txpool,debug,miner" --nodiscover --maxpeers --networkid 1981 --port 30303 --mine --minerthreads 1 --etherbase "0xeb680f30715f347d4eb5cd03ac5eced297ac5046" console truffle migrate --reset ``` ## 1.4 迁移 ``` truffle migrate --reset ``` #2.相关issue ## 2.1 authentication needed:password or unlock <center> ![authentication needed:password or unlock](https://leanote.com/api/file/getImage?fileId=5b70dec3ab64412543000546) </center> --- 对策: 解锁账户: <center> ![unlockAccount](https://leanote.com/api/file/getImage?fileId=5b711b73ab64412543001139) </center> --- ## 2.2 exceeds block gas limit <center> ![exceeds block gas limit](https://leanote.com/api/file/getImage?fileId=5b711c16ab64412739001382) </center> --- 对策: >truffle.js ``` networks: { development: { host: "localhost", port: 8545, gas:4712388, gasPrice:65000000000, network_id: "*" // Match any network id } } ``` --- ## 2.3 truffle migrate,and stuck there for a long long time ``` #truffle migrate Running migration: 1_initial_migration.js Deploying Migrations... ``` <center> ![id-increase](https://leanote.com/api/file/getImage?fileId=5b7406aeab64415efc0023e4) ... Continues like this with the "id" field increasing indefinitely </center> >对策:开启挖矿 Truffle was never able to verify the contract was mined successfully.mining ``` truffle migrate --verbose-rp//查看详细过程 miner.start(1) ``` ## 2.4 truffle server fsevents is not a constructor ``` TypeError: fsevents is not a constructor ``` >对策:修改cli.bundled.js ``` vim /usr/local/lib/node_modules/truffle/build/cli.bundled.js // Enable fsevents on OS X when polling isn't explicitly enabled. //if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling; // If we can't use fsevents, ensure the options reflect it's disabled. //if (!FsEventsHandler.canUse()) opts.useFsEvents = false; opts.useFsEvents = false; ```
上一篇:
双线性对知识梳理
下一篇:
选专业参考--生物学
0
赞
443 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus
文档导航