Giter VIP home page Giter VIP logo

ethnode's Introduction

ethnode, run an Ethereum node for test and development

ethnode is a zero configuration tool to run a local Ethereum node. It supports both Openethereum and Geth.

Try it out:

npm install -g ethnode
ethnode

Or docker:

docker run -it ghcr.io/vrde/ethnode:latest

ethnode automatically:

  • downloads the latest stable version of geth or openethereum
  • configures geth or openethereum to run in a single node network using the clique (Geth) or InstantSeal (Openethereum) consensus engine (transactions are processed instantly)
  • provides 10 unlocked accounts with 100ETH each
  • enables all RPC endpoints (personal, db, eth, net, web3, debug and more)
  • allows CORS from any domain (so you can use it with remix)

By default ethnode runs geth. If you want to run openethereum type ethnode openethereum.

Examples

Start ethnode and store the data in a specific directory

Every time you run ethnode, it creates a new temporary directory to store the data. If you want to persist the data in a specific directory use:

ethnode --workdir=mydata

Start ethnode and allocate 100ETH to one or more target addresses

Sometimes you want to allocate Ether to some specific addresses (maybe some other accounts you have on MetaMask). This is an alternative approach to import a private key to your MetaMask extension.

ethnode --allocate=0xad7b5e515e557b2dc4d0625d206394b502412003,0xecdd5b467e38731bfad4bd75faa45c7d58e41b49

Start ethnode to run some tests and then exit

This is quite handy if you want to have a precommit hook that runs tests before committing, or if you want to integrate with a continuous integration system like travis.

ethnode --execute="truffle test"

Start

FAQ

Why not just running openethereum --config dev?

Openethereum has a nice feature to run it as a private development chain (aka test RPC).

While testing it, I run into some problems, like:

  • address management
  • outdated genesis file
  • the default configuration (--config dev) doesn't:
    • open up CORS
    • unlock the test keys

Why not just running geth --dev?

More or less for the same reasons mentioned above.

Why not ganache-cli?

Ganache sometimes is not enough.

ethnode's People

Contributors

antomor avatar briungri avatar rkachowski avatar srccraftsman avatar timdaub avatar vrde 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  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  avatar  avatar

ethnode's Issues

ethnode openethereum returned 404 downloading openethereum

Hi!

I execute this command as the instructions say:
ethnode openethereum --workdir=/some/path
and got this:

Download latest openethereum version, please wait.

Downloading https://github.com/openethereum/openethereum/releases/download/v3.0.1/openethereum-linux-v3.0.1.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
Error downloading openethereum, this might be temporary, try again later.

-V, --version option shows up twice when doing --help

ethnode --help
Usage: ethnode [options] [command]

Options:
  -V, --version               output the version number
  -d, --download              Download the Ethereum client and exit.
  -w, --workdir <dir>         Specify a working dir.
  -l, --logging <level>       Specify logging level (error, warn, info).
  -w, --workdir <dir>         Specify a working dir.
  -c, --chainid <int>         Set the chainId (also called network id), can be an int or the string "random". (default: 666666)
  -a, --allocate <addresses>  Comma separated list of addresses. Allocate 100 Ethers for each address. (default: [])
  -e, --execute <command>     Start ethnode, execute command, and exit ethnode (useful for testing).
  -V, --version               output the version number
  -h, --help                  display help for command

Commands:
  openethereum                Run an Openethereum development node.
  geth                        Run a Geth development node.
  help [command]              display help for command

See output above -V, --version line shows up twice.

Port ethnode to windows

Problem

Ethnode doesn't work on Windows machines (see #11). The two scripts get_geth.sh and get_openethereum.sh rely on bash to run.

Solution

Port get_geth.sh and get_openethereum.sh to pure JavaScript functions. AFAIK that's the only part that is incompatible with windows.

Multiple predifined accounts

Is there any convenient way to generate large amount of accounts(~10 000) with predefined balance?
I've tried to use geth account new to generate account keys and put it into 'keys' folder, but it worked only until big amount of accounts. At 25 accounts it already stucks for several minutes during the start, at 600 it's impossible to wait until start(

add tutorial about how to run a localhost testnet (maybe using metamask + remix)

I found your project through ethereum.org

  1. I tried to use ethnode and it is true, it installs easily and it downloads the node and runs it pretty much flawlessly and that is awesome :-)

  2. I also managed to connect to it via metamask while using remix, but all account addresses that were listed in metamask had 0 ether on it which gave me some headache.

  3. After copying one of the addresses shown in metamask when connecting to localhost and running ethnode again with --allocate=<paste adddress from metamask> it gave 100 ETH to that address.

...but when I tried to deploy a contract or do any kind of transactions, metamask ALWAYS responds with:

MetaMask - RPC Error: Error: Error: [ethjs-rpc] rpc error with payload {"id":9245888516496,"jsonrpc":"2.0","params":["0xf9182b808502e90edd008319a810808...b2b"],"method":"eth_sendRawTransaction"} Error: invalid sender

This might of course be unrelated to ethnode and a metamask or probably geth issue, but still - it would be cool to resolve this and maybe explain how to specifically run ethnode to make it work as a testnet on localhost :-)

'.' is not recognised as an internal or external command

I tried installing ethnode as an alternative to ganache on a 32bit windows OS but it did not finish installing. I have pasted details below:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Tobb>npm install -g ethereumjs-testrpc
npm WARN deprecated [email protected]: ethereumjs-testrpc has been rename
d to ganache-cli, please use this package from now on.
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade
to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and coul
d be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprec
ated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#dep
recated
C:\Users\Tobb\AppData\Roaming\npm\testrpc -> C:\Users\Tobb\AppData\Roaming\npm\n
ode_modules\ethereumjs-testrpc\build\cli.node.js

> [email protected] postinstall C:\Users\Tobb\AppData\Roaming\npm\no
de_modules\ethereumjs-testrpc\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\et
hereumjs-testrpc\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"
})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\et
hereumjs-testrpc\node_modules\watchpack-chokidar2\node_modules\chokidar\node_mod
ules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32
"})

+ [email protected]
added 369 packages from 292 contributors in 177.79s

C:\Users\Tobb>testrpc -m "small failure organs crooks zero delivery fired extrem
e lost twenty alpha terror"
EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

Available Accounts
==================
(0) 0x5386d64023dde8e391f8bce92b5cd5bff31413ef
(1) 0x10372ec71a29a5fe011ca0eb154f36ee27bbbc61
(2) 0xb3dab625941bb8be74a00540ec8f94aa064ea42c
(3) 0x78de65ea4abd9b0279389f46ea3cccb02040abc4
(4) 0xd01781777d483489437bd3181081be3b6e70094b
(5) 0xc639073c8f9500c53e4fb66f3103b654a68ec795
(6) 0x99a8bb5d8c5283bbce5ea08b2a2b77b6b4e30ce0
(7) 0xb14bab716b4f31f0fae4af3ddf0e1dbef18d3321
(8) 0x773dd52b3cb53d5422f570354ddef1bae2cca90e
(9) 0xc876c21cb85c0d2551f9e056a1a6475972fb6620

Private Keys
==================
(0) a83053ca6a972fd9b26848c7e0e08e17ade242d273b40c6267ffffb8fbf7d77b
(1) 8d9764791b2b94f0421d6e6d889b745a91f73b49922d90ab8432c359e4bbdd3e
(2) e692f72fb0c289db6b04b38669a784e3181f327f71cea652206b39de3855c629
(3) 9295308912887732ed6e29fe529f0e191aaeacb9434976b532bcb1bf82d8cf5b
(4) d054a284751de6629b2541bab44368314a19d3a86295bd35def91b953a1849d4
(5) 5c1954b882613240fba090ea4bee4b52e2a73ecb4f230475a294492a9479674f
(6) ee49fb7e19d57326f19e8aaaae9aee5b19b52dfded3e729552f41c4119d1c819
(7) cbb767bb3220ea0144e6c310b2759b9c2e8a034d134c3a540f976a7a43110d48
(8) 1e0310fa6f19e93f20815875ccda17b445db4ea361e7e8b4dd9c819696656764
(9) 10cefc7e0278dc75c353c2274d0a5ce35d2d798b2e73a00ca2a1f6ee9e38a92b

HD Wallet
==================
Mnemonic:      small failure organs crooks zero delivery fired extreme lost twen
ty alpha terror
Base HD Path:  m/44'/60'/0'/0/{account_index}

Listening on localhost:8545

C:\Users\Tobb>

C:\Users\Tobb>

C:\Users\Tobb>npm install -g ethnode
C:\Users\Tobb\AppData\Roaming\npm\ethnode -> C:\Users\Tobb\AppData\Roaming\npm\n
ode_modules\ethnode\cli.js

> [email protected] postinstall C:\Users\Tobb\AppData\Roaming\npm\node_modules\ethn
ode
> ./cli.js -d

'.' is not recognized as an internal or external command,
operable program or batch file.
npm WARN rollback Rolling back @ethersproject/[email protected] failed (this is probably
 harmless): EPERM: operation not permitted, lstat 'C:\Users\Tobb\AppData\Roaming
\npm\node_modules\ethnode\node_modules\@ethersproject'
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. Yo
u must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed
. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `./cli.js -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tobb\AppData\Roaming\npm-cache\_logs\2020-11-09T04_25_45_4
81Z-debug.log

C:\Users\Tobb>

Ganache does not support 32bit OS and if ethnode will support it then that will be nice.

You help is greatly appreciated.

Generate keys from mnemonic

A user asked me if there is a way to know the mnemonic. Keys were not generated using a mnemonic seed, so there is no mnemonic available.

There should be an option to do so.

ERROE npm install -g ethnode ethnode

[email protected] postinstall: ./cli.js -d
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script './cli.js -d'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ethnode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./cli.js -d
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ethnode
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ethnode
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/a/npm-debug.log
npm ERR! code 1

Cannot start parity - "curl" binary not found

Description

Running ethnode parity fails with error.

$ ethnode parity
Download latest parity version, please wait.
"curl" binary not found, please install and retry
Error downloading parity, this might be temporary, try again later.
$ which curl
/usr/bin/curl
$ curl --version
curl 7.64.1 (x86_64-pc-linux-gnu) libcurl/7.64.1 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.1.1 libpsl/0.20.2 (+libidn2/2.1.1) libssh2/1.8.1 nghttp2/1.36.0
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

Version used:

$ ethnode --version
0.0.17

Parity already is available in my path, meaning I can run parity to connect to the main Ethereum network. I also have geth in my path.

My operating system is Arch Linux:

$ uname -a                    
Linux cola 5.0.9-arch1-1-ARCH #1 SMP PREEMPT Sat Apr 20 15:00:46 UTC 2019 x86_64 GNU/Linux

Current shell zsh:

$ echo $SHELL              
/usr/bin/zsh
$ zsh --version      
zsh 5.7.1 (x86_64-pc-linux-gnu)

[feature request] forking mode

ganache-cli has a really helpful --fork flag that uses mainnet state as the starting point. This is essentially necessary for testing multiple defi projects together. However, it has some bugs in how it handles delegatecalls and clearing storage (trufflesuite/ganache#797).

It would be awesome if geth could handle this itself, but they closed my issue saying that they'd prefer ganache handle it. ethereum/go-ethereum#21224.

I understand ethereum's decision to have multiple clients, but I think having the development clients separate from the production clients is guaranteed to cause problems (just like the 6 or so I've been dealing with). Having my tests use a production client would make me much more comfortable in my test results.

Do you think this is something that ethnode can help with?

Unclear what version of geth or openethereum ethnode is running at the moment

Problem:

I want to file a bug over at openethereum/openethereum, but for that I need to know which version of e.g. openethereum ethnode is currently running.

Ideas:

  1. When running --version, ethnode could also show the version of the underlying Ethereum node
  2. We could allow passing arguments through ethnode to the Ethereum node
  3. We could introduce a new option to retrieve the Ethereum node version

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.