0.5.0 • Published 10 years ago
ethersim v0.5.0
What is EtherSim
EtherSim is a Limited Ethereum RPC simulator for testing and development purposes. EtherSim is used by the Embark Framework
Installation
$ npm install -g ethersimUsage - as a RPC Server
$ ethersimUsage - as a Lib
Setup
var EtherSim = require('ethersim');
var sim = new EtherSim.init();
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(sim.provider);Adding accounts
sim.createAccounts(10, function() {})
web3.eth.accounts //=> [..10..accounts..]Set Balance
sim.setBalance(web3.eth.accounts[0], 123450000, function() {})
web3.eth.getBalance(web3.eth.accounts[0], function(err, balance) {console.log(balance.toNumber())}) //=> 123450000
// send ether from one account to another
web3.eth.sendTransaction({value: 1000, from: web3.eth.accounts[0], to: web3.eth.accounts[1], gasLimit: 10000},function() {console.log("transaction sent")})
// mine transaction
sim.mine()Time Travel
web3.eth.getBlock('latest') // => current time
sim.jump("5 hours")
sim.mine();
web3.eth.getBlock('latest') // => will be 5 hours aheadStart Over
sim.reset()0.5.0
10 years ago
0.4.0
10 years ago
0.3.0
10 years ago
0.2.0
10 years ago
0.1.6
10 years ago
0.1.5
10 years ago
0.1.4
10 years ago
0.1.4-beta4
10 years ago
0.1.4-beta3
10 years ago
0.1.4-beta2
10 years ago
0.1.4-beta1
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago