Skip to content

Commit 5e5bc7e

Browse files
authored
s/parity/openethereum (#9)
1 parent 7fb67c3 commit 5e5bc7e

9 files changed

+699
-988
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Warning: this tool is experimental. It should work for GNU/Linux and hopefully on Mac OS.
22

33
# `ethnode`, run an Ethereum node for test and development
4-
`ethnode` is a **zero configuration** tool to run a local Ethereum node. It supports both [Parity][parity] and [Geth][geth].
4+
`ethnode` is a **zero configuration** tool to run a local Ethereum node. It supports both [Openethereum][openethereum] and [Geth][geth].
55

66
Try it out:
77
```
@@ -10,13 +10,13 @@ ethnode
1010
```
1111

1212
`ethnode` automatically:
13-
- downloads the latest stable version of `geth` or `parity`
14-
- configures `geth` or `parity` to run in a single node network using the *clique* (Geth) or *InstantSeal* (Parity) consensus engine (transactions are processed **instantly**)
13+
- downloads the latest stable version of `geth` or `openethereum`
14+
- configures `geth` or `openethereum` to run in a single node network using the *clique* (Geth) or *InstantSeal* (Openethereum) consensus engine (transactions are processed **instantly**)
1515
- provides 10 unlocked accounts with 100ETH each
1616
- enables all RPC endpoints (personal, db, eth, net, web3, debug and more)
1717
- allows CORS from any domain (so you can use it with [remix][remix])
1818

19-
By default `ethnode` runs `geth`. If you want to run `parity` type `ethnode parity`.
19+
By default `ethnode` runs `geth`. If you want to run `openethereum` type `ethnode openethereum`.
2020

2121
# Examples
2222

@@ -42,8 +42,8 @@ ethnode --execute="truffle test"
4242
## Start
4343

4444
## FAQ
45-
### Why not just running `parity --config dev`?
46-
Parity has a nice feature to run it as a [private development chain][parity:devchain] (aka *test RPC*).
45+
### Why not just running `openethereum --config dev`?
46+
Openethereum has a nice feature to run it as a [private development chain][openethereum:devchain] (aka *test RPC*).
4747

4848
While testing it, I run into some problems, like:
4949
- address management
@@ -59,9 +59,9 @@ More or less for the same reasons mentioned above.
5959
Ganache sometimes is not enough.
6060

6161

62-
[parity]: https://github.com/paritytech/parity-ethereum
62+
[openethereum]: https://github.com/openethereum/openethereum
6363
[geth]: https://github.com/ethereum/go-ethereum
64-
[parity:devchain]: https://wiki.parity.io/Private-development-chain
64+
[openethereum:devchain]: https://openethereum.github.io/wiki/Private-development-chain
6565
[remix]: http://remix.ethereum.org/
6666
[geth-testnet]: https://hackernoon.com/setup-your-own-private-proof-of-authority-ethereum-network-with-geth-9a0a3750cda8
6767
[hudson:gas]: https://hudsonjameson.com/2017-06-27-accounts-transactions-gas-ethereum/

cli.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ program
3434
.option("-w, --workdir <dir>", "Specify a working dir.")
3535
.option("-l, --logging <level>", "Specify logging level (error, warn, info).")
3636
.option("-w, --workdir <dir>", "Specify a working dir.")
37-
.option("-c, --chainid <int>", "Set the chainId (also called network id), can be an int or the string \"random\".", 666666, parseChainId)
37+
.option(
38+
"-c, --chainid <int>",
39+
'Set the chainId (also called network id), can be an int or the string "random".',
40+
666666,
41+
parseChainId
42+
)
3843
.option(
3944
"-a, --allocate <addresses>",
4045
"Comma separated list of addresses. Allocate 100 Ethers for each address.",
@@ -49,11 +54,11 @@ program
4954
program.version(packageJson.version);
5055

5156
program
52-
.command("parity")
53-
.description("Run a Parity development node.")
57+
.command("openethereum")
58+
.description("Run an Openethereum development node.")
5459
.action(cmd => {
5560
noAction = false;
56-
run("parity", getOptions(program));
61+
run("openethereum", getOptions(program));
5762
});
5863

5964
program
File renamed without changes.

get_geth.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ HOMEDIR=${HOMEDIR:-"."}
99
# Unfortunately GitHub ratelimits the following requests when running on travis. That's the reason why I had to hardcode the values of VERSION and COMMIT for now.
1010
# VERSION=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/releases/latest | python -c "import sys, json; print(json.load(sys.stdin)['tag_name'])")
1111
# COMMIT=$(curl -s https://api.github.com/repos/ethereum/go-ethereum/commits/${VERSION} | python -c "import sys, json; print(json.load(sys.stdin)['sha'])")
12-
VERSION="1.9.7"
13-
COMMIT="a718daa6"
12+
VERSION="1.9.14"
13+
COMMIT="6d74d1e5"
1414
PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
1515
ARCH=$(uname -m)
1616
NAME="geth-${PLATFORM}-amd64-${VERSION}-${COMMIT}"

get_openethereum.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Note: $HOMEDIR is defined in main.js, check it out
6+
HOMEDIR=${HOMEDIR:-"."}
7+
8+
PLATFORM=$(uname | tr '[:upper:]' '[:lower:]')
9+
DIST=$([ "${PLATFORM}" == "darwin" ] && echo "macos" || echo "linux")
10+
DOWNLOAD_URL="https://github.com/openethereum/openethereum/releases/download/v3.0.0/openethereum-${DIST}-v3.0.0.zip"
11+
TMP_DIR=$(mktemp -d)
12+
TMP_ZIP="${TMP_DIR}/openethereum.zip"
13+
14+
echo "Downloading ${DOWNLOAD_URL}"
15+
curl --fail -L ${DOWNLOAD_URL} > ${TMP_ZIP}
16+
unzip ${TMP_ZIP} -d ${TMP_DIR}
17+
mv ${TMP_DIR}/openethereum ${HOMEDIR}/openethereum
18+
chmod +x ${HOMEDIR}/openethereum

get_parity.sh

-103
This file was deleted.

main.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function generateGenesis(client, chainId, balances) {
5252
Object.keys(balances)[0].substr(2) +
5353
"0".repeat(130);
5454
genesis.alloc = { ...genesis.alloc, ...balances };
55-
} else if (client === "parity") {
55+
} else if (client === "openethereum") {
5656
genesis.params.networkID = chainId;
5757
genesis.accounts = { ...genesis.accounts, ...balances };
5858
}
@@ -70,7 +70,7 @@ function generateBalances(addresses, balance) {
7070
return balances;
7171
}
7272

73-
function downloadClient(client, workdir) {
73+
function downloadClient(client, workdir, download) {
7474
const paths = getPaths(client, workdir);
7575
if (!canWrite(path.join(HOMEDIR, "__remove_me__"))) {
7676
console.log(
@@ -94,8 +94,10 @@ function downloadClient(client, workdir) {
9494
);
9595
process.exit(childResult.status);
9696
}
97-
} else {
98-
console.error(`You have downloaded ${client} already, if you want to force the download remove ${paths.binary}`);
97+
} else if (download) {
98+
console.error(
99+
`You have downloaded ${client} already, if you want to force the download remove ${paths.binary}`
100+
);
99101
process.exit(1);
100102
}
101103
}
@@ -146,14 +148,17 @@ function provide(client, workdir, allocate, chainId, execute, loggingOptions) {
146148
}
147149
}
148150

149-
function run(client, { download, workdir, logging, allocate, chainId, execute }) {
151+
function run(
152+
client,
153+
{ download, workdir, logging, allocate, chainId, execute }
154+
) {
150155
const loggingOptions = logging
151156
? client === "geth"
152157
? ["--verbosity", LOGLEVELS.indexOf(logging)]
153158
: ["--logging", logging]
154159
: [];
155160
const paths = getPaths(client, workdir);
156-
downloadClient(client, workdir);
161+
downloadClient(client, workdir, download);
157162
if (download) {
158163
return;
159164
}
@@ -198,7 +203,7 @@ function run(client, { download, workdir, logging, allocate, chainId, execute })
198203
"--rpcport",
199204
"8545",
200205
"--rpcapi",
201-
"personal,db,eth,net,web3,txpool,miner,debug",
206+
"personal,eth,net,web3,txpool,miner,debug",
202207
"--rpccorsdomain",
203208
"*",
204209
"--ws",
@@ -207,7 +212,7 @@ function run(client, { download, workdir, logging, allocate, chainId, execute })
207212
"--wsport",
208213
"8546",
209214
"--wsapi",
210-
"personal,db,eth,net,web3,txpool,miner,debug",
215+
"personal,eth,net,web3,txpool,miner,debug",
211216
"--wsorigins",
212217
"*",
213218
"--mine",
@@ -226,7 +231,7 @@ function run(client, { download, workdir, logging, allocate, chainId, execute })
226231
genesis.config.chainId,
227232
...loggingOptions
228233
];
229-
} else if (client === "parity") {
234+
} else if (client === "openethereum") {
230235
args = [
231236
"--db-path",
232237
paths.data,

0 commit comments

Comments
 (0)