Skip to content

Commit 035ca6b

Browse files
committed
Reorganize/refactor 7nodes example and update for latest Vagrant
1 parent c50e97a commit 035ca6b

20 files changed

+91
-437
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The easiest way to get started with running the examples is to use the vagrant e
1010

1111
**Important note**: Any account/encryption keys contained in this repository are for
1212
demonstration and testing purposes only. Before running a real environment, you should
13-
generate new ones using Geth's `account` tool and `constellation-enclave-keygen`.
13+
generate new ones using Geth's `account` tool and `constellation-node --generate-keys`.
1414

1515
## Vagrant Usage
1616

@@ -20,7 +20,7 @@ Quorum examples.
2020
### Requirements
2121

2222
1. Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
23-
1. Install [Vagrant](https://www.vagrantup.com/downloads.html)
23+
2. Install [Vagrant](https://www.vagrantup.com/downloads.html)
2424

2525
(If you are behind a proxy server, please see https://github.com/jpmorganchase/quorum/issues/23)
2626

@@ -41,8 +41,6 @@ cd quorum-examples
4141
exist, please run `sudo rm -r /opt/vagrant/embedded/bin/curl`. This is usually due to
4242
issues with the version of curl bundled with Vagrant.)
4343

44-
45-
4644
To shut down the Vagrant instance, run `vagrant suspend`. To delete it, run
4745
`vagrant destroy`. To start from scratch, run `vagrant up` after destroying the
4846
instance.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
set -u
3+
set -e
4+
5+
for i in {1..7}
6+
do
7+
DDIR="qdata/c$i"
8+
mkdir -p $DDIR
9+
mkdir -p qdata/logs
10+
cp "keys/tm$i.pub" "$DDIR/tm.pub"
11+
cp "keys/tm$i.key" "$DDIR/tm.key"
12+
rm -f "$DDIR/tm.ipc"
13+
CMD="constellation-node --url=https://127.0.0.$i:900$i/ --port=900$i --workdir=$DDIR --socket=tm.ipc --publickeys=tm.pub --privatekeys=tm.key --othernodes=https://127.0.0.1:9001/"
14+
echo "$CMD >> qdata/logs/constellation$i.log 2>&1 &"
15+
$CMD >> "qdata/logs/constellation$i.log" 2>&1 &
16+
done
17+
18+
DOWN=true
19+
while $DOWN; do
20+
sleep 0.1
21+
DOWN=false
22+
for i in {1..7}
23+
do
24+
if [ ! -S "qdata/c$i/tm.ipc" ]; then
25+
DOWN=true
26+
fi
27+
done
28+
done

examples/7nodes/istanbul-init.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,54 @@ mkdir -p qdata/logs
88

99
echo "[*] Configuring node 1"
1010
mkdir -p qdata/dd1/{keystore,geth}
11-
cp raft/static-nodes.json qdata/dd1
11+
cp permissioned-nodes.json qdata/dd1/static-nodes.json
12+
cp permissioned-nodes.json qdata/dd1/
1213
cp keys/key1 qdata/dd1/keystore
1314
cp raft/nodekey1 qdata/dd1/geth/nodekey
1415
geth --datadir qdata/dd1 init istanbul-genesis.json
1516

1617
echo "[*] Configuring node 2"
1718
mkdir -p qdata/dd2/{keystore,geth}
18-
cp raft/static-nodes.json qdata/dd2
19+
cp permissioned-nodes.json qdata/dd2/static-nodes.json
20+
cp permissioned-nodes.json qdata/dd2/
1921
cp keys/key2 qdata/dd2/keystore
2022
cp keys/key3 qdata/dd2/keystore
2123
cp raft/nodekey2 qdata/dd2/geth/nodekey
2224
geth --datadir qdata/dd2 init istanbul-genesis.json
2325

2426
echo "[*] Configuring node 3"
2527
mkdir -p qdata/dd3/{keystore,geth}
26-
cp raft/static-nodes.json qdata/dd3
28+
cp permissioned-nodes.json qdata/dd3/static-nodes.json
29+
cp permissioned-nodes.json qdata/dd3/
2730
cp raft/nodekey3 qdata/dd3/geth/nodekey
2831
geth --datadir qdata/dd3 init istanbul-genesis.json
2932

3033
echo "[*] Configuring node 4 as voter"
3134
mkdir -p qdata/dd4/{keystore,geth}
32-
cp raft/static-nodes.json qdata/dd4
35+
cp permissioned-nodes.json qdata/dd4/static-nodes.json
36+
cp permissioned-nodes.json qdata/dd4/
3337
cp keys/key4 qdata/dd4/keystore
3438
cp raft/nodekey4 qdata/dd4/geth/nodekey
3539
geth --datadir qdata/dd4 init istanbul-genesis.json
3640

3741
echo "[*] Configuring node 5 as voter"
3842
mkdir -p qdata/dd5/{keystore,geth}
39-
cp raft/static-nodes.json qdata/dd5
43+
cp permissioned-nodes.json qdata/dd5/static-nodes.json
44+
cp permissioned-nodes.json qdata/dd5/
4045
cp keys/key5 qdata/dd5/keystore
4146
cp raft/nodekey5 qdata/dd5/geth/nodekey
4247
geth --datadir qdata/dd5 init istanbul-genesis.json
4348

4449
echo "[*] Configuring node 6"
4550
mkdir -p qdata/dd6/{keystore,geth}
46-
cp raft/static-nodes.json qdata/dd6
51+
cp permissioned-nodes.json qdata/dd6/static-nodes.json
52+
cp permissioned-nodes.json qdata/dd6/
4753
cp raft/nodekey6 qdata/dd6/geth/nodekey
4854
geth --datadir qdata/dd6 init istanbul-genesis.json
4955

5056
echo "[*] Configuring node 7"
5157
mkdir -p qdata/dd7/{keystore,geth}
52-
cp raft/static-nodes.json qdata/dd7
58+
cp permissioned-nodes.json qdata/dd7/static-nodes.json
59+
cp permissioned-nodes.json qdata/dd7/
5360
cp raft/nodekey7 qdata/dd7/geth/nodekey
54-
geth --datadir qdata/dd7 init istanbul-genesis.json
61+
geth --datadir qdata/dd7 init istanbul-genesis.json

examples/7nodes/istanbul-start.sh

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,22 @@
22
set -u
33
set -e
44

5-
GLOBAL_ARGS="--syncmode full --mine --rpc --rpcaddr 0.0.0.0 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul"
6-
5+
mkdir -p qdata/logs
76
echo "[*] Starting Constellation nodes"
8-
nohup constellation-node tm1.conf 2>> qdata/logs/constellation1.log &
9-
sleep 1
10-
nohup constellation-node tm2.conf 2>> qdata/logs/constellation2.log &
11-
nohup constellation-node tm3.conf 2>> qdata/logs/constellation3.log &
12-
nohup constellation-node tm4.conf 2>> qdata/logs/constellation4.log &
13-
nohup constellation-node tm5.conf 2>> qdata/logs/constellation5.log &
14-
nohup constellation-node tm6.conf 2>> qdata/logs/constellation6.log &
15-
nohup constellation-node tm7.conf 2>> qdata/logs/constellation7.log &
16-
17-
sleep 1
18-
19-
echo "[*] Starting node 1"
20-
PRIVATE_CONFIG=tm1.conf nohup geth --datadir qdata/dd1 $GLOBAL_ARGS --rpcport 22000 --port 21000 --unlock 0 --password passwords.txt 2>>qdata/logs/1.log &
21-
22-
echo "[*] Starting node 2"
23-
PRIVATE_CONFIG=tm2.conf nohup geth --datadir qdata/dd2 $GLOBAL_ARGS --rpcport 22001 --port 21001 2>>qdata/logs/2.log &
24-
25-
echo "[*] Starting node 3"
26-
PRIVATE_CONFIG=tm3.conf nohup geth --datadir qdata/dd3 $GLOBAL_ARGS --rpcport 22002 --port 21002 2>>qdata/logs/3.log &
27-
28-
echo "[*] Starting node 4"
29-
PRIVATE_CONFIG=tm4.conf nohup geth --datadir qdata/dd4 $GLOBAL_ARGS --rpcport 22003 --port 21003 2>>qdata/logs/4.log &
30-
31-
echo "[*] Starting node 5"
32-
PRIVATE_CONFIG=tm5.conf nohup geth --datadir qdata/dd5 $GLOBAL_ARGS --rpcport 22004 --port 21004 2>>qdata/logs/5.log &
33-
34-
echo "[*] Starting node 6"
35-
PRIVATE_CONFIG=tm6.conf nohup geth --datadir qdata/dd6 $GLOBAL_ARGS --rpcport 22005 --port 21005 2>>qdata/logs/6.log &
36-
37-
echo "[*] Starting node 7"
38-
PRIVATE_CONFIG=tm7.conf nohup geth --datadir qdata/dd7 $GLOBAL_ARGS --rpcport 22006 --port 21006 2>>qdata/logs/7.log &
39-
40-
echo "[*] Waiting for nodes to start"
41-
sleep 10
42-
echo "[*] Sending first transaction"
43-
PRIVATE_CONFIG=tm1.conf geth --exec 'loadScript("script1.js")' attach ipc:qdata/dd1/geth.ipc
44-
45-
echo "All nodes configured. See 'qdata/logs' for logs, and run e.g. 'geth attach qdata/dd1/geth.ipc' to attach to the first Geth node"
7+
./constellation-start.sh
8+
9+
echo "[*] Starting Ethereum nodes"
10+
set -v
11+
ARGS="--syncmode full --mine --rpc --rpcaddr 0.0.0.0 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,istanbul"
12+
PRIVATE_CONFIG=qdata/c1/tm.ipc nohup geth --datadir qdata/dd1 $ARGS --rpcport 22000 --port 21000 --unlock 0 --password passwords.txt 2>>qdata/logs/1.log &
13+
PRIVATE_CONFIG=qdata/c2/tm.ipc nohup geth --datadir qdata/dd2 $ARGS --rpcport 22001 --port 21001 2>>qdata/logs/2.log &
14+
PRIVATE_CONFIG=qdata/c3/tm.ipc nohup geth --datadir qdata/dd3 $ARGS --rpcport 22002 --port 21002 2>>qdata/logs/3.log &
15+
PRIVATE_CONFIG=qdata/c4/tm.ipc nohup geth --datadir qdata/dd4 $ARGS --rpcport 22003 --port 21003 2>>qdata/logs/4.log &
16+
PRIVATE_CONFIG=qdata/c5/tm.ipc nohup geth --datadir qdata/dd5 $ARGS --rpcport 22004 --port 21004 2>>qdata/logs/5.log &
17+
PRIVATE_CONFIG=qdata/c6/tm.ipc nohup geth --datadir qdata/dd6 $ARGS --rpcport 22005 --port 21005 2>>qdata/logs/6.log &
18+
PRIVATE_CONFIG=qdata/c7/tm.ipc nohup geth --datadir qdata/dd7 $ARGS --rpcport 22006 --port 21006 2>>qdata/logs/7.log &
19+
set +v
20+
21+
echo
22+
echo "All nodes configured. See 'qdata/logs' for logs, and run e.g. 'geth attach qdata/dd1/geth.ipc' to attach to the first Geth node."
23+
echo "To test sending a private transaction from Node 1 to Node 7, run './runscript script1.js'"

0 commit comments

Comments
 (0)