Skip to content

Commit d6e69c0

Browse files
authored
fix(quorum/api): use Web3 HTTP Provider by default (hyperledger-cacti#66)
* fix(quorum/api): use Web3 HTTP Provider by default It is deprecated because it does not support subscriptions, but we do not use that feature anyway and just need the examples to work so it seems like an okay trade-off to use HTTP instead of WS. Signed-off-by: Peter Somogyvari <[email protected]> * fix(quorum/platform): RPC API in docker-compose Signed-off-by: Peter Somogyvari <[email protected]> * fix(quorum/platform): opens port 8545 on node1 Signed-off-by: Peter Somogyvari <[email protected]> * fix(quorum/platform): ports in config.js, .env Signed-off-by: Peter Somogyvari <[email protected]>
1 parent be6c39c commit d6e69c0

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

examples/simple-asset-transfer/quorum/api/.env

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ WEB3_HOST_LINUX=0.0.0.0
99
WEB3_HOST_DARWIN=localhost
1010
WEB3_HOST_WIN32=localhost
1111
WEB3_PORT=22000
12+
WEB3_RPC_PORT=8545
1213

1314
# PARTICIPANT
1415
WEB3_ETH_KEY=0xed9d02e382b34818e88B88a309c7fe71E65f419d

examples/simple-asset-transfer/quorum/api/config/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const config = {
8686
win32: envVars.WEB3_HOST_WIN32,
8787
},
8888
port: envVars.WEB3_PORT,
89+
rpcPort: envVars.WEB3_RPC_PORT,
8990
ethKey: envVars.WEB3_ETH_KEY,
9091
constKey: envVars.WEB3_CONST_KEY,
9192
},
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const Web3 = require('web3');
22
const config = require('../config/config');
33

4-
const option = `ws://${config.web3.host[`${process.platform}`]}:${config.web3.port}`;
5-
const web3 = new Web3(option);
6-
4+
const rpcApiHost = `http://${config.web3.host[`${process.platform}`]}:${config.web3.rpcPort}`;
5+
const web3Provider = new Web3.providers.HttpProvider(rpcApiHost);
6+
const web3 = new Web3(web3Provider);
77
web3.eth.defaultAccount = config.web3.ethKey;
8-
98
module.exports = web3;

examples/simple-asset-transfer/quorum/platform/docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ x-quorum-def:
5454
--nodiscover \
5555
--verbosity 5 \
5656
--networkid $${NETWORK_ID} \
57+
--rpc \
58+
--rpcaddr=0.0.0.0 \
59+
--rpcvhosts=node1 \
60+
--rpcport=8545 \
61+
--rpcapi=private,parity,admin,db,eth,debug,miner,net,txpool,personal,web3,quorum,${QUORUM_CONSENSUS:-istanbul} \
62+
--rpccorsdomain "*" \
5763
--ws \
5864
--wsaddr 0.0.0.0 \
5965
--wsport 8546 \
@@ -179,6 +185,7 @@ services:
179185
hostname: node1
180186
ports:
181187
- "22000:8546"
188+
- "8545:8545"
182189
volumes:
183190
- 1:/qdata
184191
- .:/examples:ro

0 commit comments

Comments
 (0)