Code Monkey home page Code Monkey logo

ethersim's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ”ญ Iโ€™m currently working on ...

Head of Desktop at Status.im (formerly Remix Core Dev at the Ethereum Foundation)

๐Ÿ“‚ Previous open source projects ...

  • Embark Framework - First Ethereum Framework. A Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms
  • Ethersim - First Ethereum Simulator in javascript, later forks became Ganache
  • Subspace - Library to create reactive Dapps
  • Transaction Relay - First POC of gasless Ethereum transactions
  • Remix IDE & Libs - Core Contributor
  • jump-tracker - Vim plugin that tracks your cursor when it 'jumps'

โšก Main Interests: Decentralized Protocols & Apps, Machine Learning (in particular: image generation, reinforcement learning and genetic algorithms)

ethersim's People

Contributors

ckeenan avatar iurimatias avatar ryepdx avatar tcoulter avatar xertrov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethersim's Issues

TypeError: Cannot read property 'stopWatching' of undefined

Here is a nodejs script that i execute via node script.js

var Web3 = require('web3');
var web3 = new Web3(); 

var EtherSim = require('ethersim'); 
var sim = new EtherSim.init();
web3.setProvider(sim.provider);

//getting bytecode and ABI...

sim.reset();
sim.createAccounts(10, function() {
    sim.setBalance(web3.eth.accounts[0], 123450000, function() {
        web3.eth.getAccounts(function(err, accs) {
            var TestContract = web3.eth.contract(ABI);
            TestContract.new({
                from: web3.eth.accounts[0],
                gas : 3000000,
                data: bytecode
            }, function(err, deployedContract){
                console.log(deployedContract);
                //sim.mine() //should be required to get address?
                var transactionReceipt = web3.eth.getTransactionReceipt(deployedContract.transactionHash);

                console.log(transactionReceipt.contractAddress);
                //sim.reset(); never ends
            });
        });
    }); 
});

I get the following error :

/vagrant/node_modules/web3/lib/web3/contract.js:128
                            filter.stopWatching();
                                  ^

TypeError: Cannot read property 'stopWatching' of undefined
    at Object.callback (/vagrant/node_modules/web3/lib/web3/contract.js:128:35)
    at /vagrant/node_modules/web3/lib/web3/method.js:142:25
    at /vagrant/node_modules/web3/lib/web3/requestmanager.js:89:9
    at /vagrant/node_modules/ethersim/lib/manager.js:60:7
    at Manager.eth_getCode (/vagrant/node_modules/ethersim/lib/manager.js:110:10)
    at Manager.request (/vagrant/node_modules/ethersim/lib/manager.js:64:19)
    at TestProvider.sendAsync (/vagrant/node_modules/ethersim/lib/provider.js:11:23)
    at RequestManager.sendAsync (/vagrant/node_modules/web3/lib/web3/requestmanager.js:80:19)
    at Eth.send [as getCode] (/vagrant/node_modules/web3/lib/web3/method.js:141:42)
    at Object.callback (/vagrant/node_modules/web3/lib/web3/contract.js:122:39)

if I uncomment the last sim.reset() node hang

any idea?

Unsupported media type

Hi, when trying to access via http i get "Unsupported media type" as a return value.
running with ethersim

from pyethapp import rpc_client
c = rpc_client.JSONRPCClient(8101)
c.blocknumber()

sent:
{
  "jsonrpc": "2.0", 
  "method": "eth_blockNumber", 
  "id": 6
}
received:
Unsupported media type

this works when using geth or pyethapp.

I tried with web3.py as well.

Cannot use 'call'-function offChain

When is run a call-function to get some data from the blockchain without making a transaction, is says

Error: sender doesn't have enough funds to send tx. The upfront cost is: 3141592 and the senders account only has: 0

state.contractInstance['foobar'].call(function(err, res){
   err && console.dir(err);
   console.dir(res);
});

EDIT: The call works of course, if I give enough eth to the coinbase. But shouldn't be the call-function completely offchain?

Having trouble installing via NPM

nick@nick:~/Github$ sudo npm install -g ethersim
[sudo] password for nick:
npm ERR! not a package /tmp/npm-16321-owQ1nK8p/github.com/iurimatias/node-jsonrpc2.git
npm ERR! Error: ENOENT, open '/tmp/npm-16321-owQ1nK8p/github.com/iurimatias/node-jsonrpc2.git-unpack/package.json'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Linux 4.0.0-040000-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ethersim"
npm ERR! cwd /home/nick/Github
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! path /tmp/npm-16321-owQ1nK8p/github.com/iurimatias/node-jsonrpc2.git-unpack/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/nick/Github/npm-debug.log
npm ERR! not ok code 0

having trouble installing ethersim from NPM, any thoughts?

EtherSim exception thrown during based truffle test

Copied from: trufflesuite/truffle#54 (comment)


@tcoulter EtherSim from npm still tries to install an outdated secp256k1, causing it to fail:

ethersim/node_modules/ethereumjs-block/node_modules/secp256k1

> [email protected] install /usr/local/lib/node_modules/ethersim/node_modules/ethereumjs-vm/node_modules/secp256k1

The develop copy per your instructions has the correct version and therefore installed, but running truffle test caused it to throw an exception:

-> % ./bin/ethersim -p 8545
EtherSim v0.1.6

Available Accounts
==================
0x1a9dc2ad31f3fdf575479760980b242d073ee149
0xd13493e9d590ba763c202ab4fbe4ab17978cda32
0xbce16ecae7407ac3e852b8d8ea088746e357dc82
0x6d17d3b407ff990279cd852c5fe4805523cdc293
0xba88351daf7a545becf4fccd1555e2750b445c9c
0x7ab301af6a5d37c09b1264d46a42c78288a339ff
0xe0c1976e9e9350986aa942b1176f6d23e0db90f8
0xfb61aa6b35754d8779f989e50e616b0ab4d11662
0x52e18c7cda62b91cbeafd52fbd0561720e2bd804
0xa2d916f6f7490ab9f1aa5e444ef078eb7478b23b

Listening on localhost:8545
eth_accounts
eth_coinbase
eth_sendTransaction
eth_newBlockFilter
eth_getFilterChanges
/Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:313
    queued.callback(err, result);
           ^

TypeError: queued.callback is not a function
    at intermediary (/Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:313:12)
    at /Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:418:7
    at Object.async.eachSeries (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async-eventemitter/node_modules/async/lib/async.js:130:20)
    at VM.AsyncEventEmitter.emit (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:9)
    at afterBlock (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/runBlock.js:55:10)
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/runBlock.js:179:9
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/cache.js:136:7
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:52:16
    at iterate (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:260:24)
    at Object.async.forEachOfSeries.async.eachOfSeries (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:281:9)

truffle test got as far as:

-> % truffle test
Using environment test.
Compiling contracts...


  Contract: Example

ReferenceError: ethUtil is not defined

Hello, this is an error I just got using Dapple:

/usr/local/lib/node_modules/dapple/node_modules/solc/soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filena

ReferenceError: ethUtil is not defined
    at Blockchain.setGasLimit (/usr/local/lib/node_modules/dapple/node_modules/ethersim/lib/blockchain.js:138:16)
    at Object.module.exports.EVM (/usr/local/lib/node_modules/dapple/lib/web3Factory.js:65:33)
    at Object.TestPipeline (/usr/local/lib/node_modules/dapple/lib/pipelines.js:116:27)
    at Object.<anonymous> (/usr/local/lib/node_modules/dapple/cmd/main.js:250:25)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)

I think it could be an issue here, because when I look at blockchain.js it doesn't look like ethUtil is actually defined.

Link to Dapple issue: dapphub/dapple#281

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.