Skip to content

Lesson 4 补充学习笔记

Shunda edited this page Jan 22, 2018 · 8 revisions

1. 框架相关文档

truffle:http://truffleframework.com/docs/
WEB3:https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendrawtransaction

2.测试相关

truffle test with solidity:
http://truffleframework.com/docs/getting_started/solidity-tests
truffle test with js:
http://truffleframework.com/docs/getting_started/javascript-tests#writing-tests-in-javascript
mocha测试框架:
https://mochajs.org/
timestamp的修改方法:
testrpc提供了一个方法evm_increaseTime,可以用来修改timestamp

evm_increaseTime : Jump forward in time. Takes one parameter, which is the amount of time to increase in seconds. Returns the total time adjustment, in seconds.
https://github.com/ethereumjs/testrpc#implemented-methods

参考的调用方式:

//增加11s
web3.currentProvider.send({jsonrpc: "2.0", method: "evm_increaseTime", params: [11], id: 0})
//挖一个区块
web3.currentProvider.send({jsonrpc: "2.0", method: "evm_mine", params: [], id: 0})

(by 顺达助教)