Skip to content

Commit

Permalink
fix(quorum/api): use Web3 HTTP Provider by default (#66)
Browse files Browse the repository at this point in the history
* 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 <peter.somogyvari@accenture.com>

* fix(quorum/platform): RPC API in docker-compose

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>

* fix(quorum/platform): opens port 8545 on node1

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>

* fix(quorum/platform): ports in config.js, .env

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz authored Nov 26, 2019
1 parent be6c39c commit d6e69c0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/simple-asset-transfer/quorum/api/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ WEB3_HOST_LINUX=0.0.0.0
WEB3_HOST_DARWIN=localhost
WEB3_HOST_WIN32=localhost
WEB3_PORT=22000
WEB3_RPC_PORT=8545

# PARTICIPANT
WEB3_ETH_KEY=0xed9d02e382b34818e88B88a309c7fe71E65f419d
Expand Down
1 change: 1 addition & 0 deletions examples/simple-asset-transfer/quorum/api/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const config = {
win32: envVars.WEB3_HOST_WIN32,
},
port: envVars.WEB3_PORT,
rpcPort: envVars.WEB3_RPC_PORT,
ethKey: envVars.WEB3_ETH_KEY,
constKey: envVars.WEB3_CONST_KEY,
},
Expand Down
7 changes: 3 additions & 4 deletions examples/simple-asset-transfer/quorum/api/utils/web3.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const Web3 = require('web3');
const config = require('../config/config');

const option = `ws://${config.web3.host[`${process.platform}`]}:${config.web3.port}`;
const web3 = new Web3(option);

const rpcApiHost = `http://${config.web3.host[`${process.platform}`]}:${config.web3.rpcPort}`;
const web3Provider = new Web3.providers.HttpProvider(rpcApiHost);
const web3 = new Web3(web3Provider);
web3.eth.defaultAccount = config.web3.ethKey;

module.exports = web3;
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ x-quorum-def:
--nodiscover \
--verbosity 5 \
--networkid $${NETWORK_ID} \
--rpc \
--rpcaddr=0.0.0.0 \
--rpcvhosts=node1 \
--rpcport=8545 \
--rpcapi=private,parity,admin,db,eth,debug,miner,net,txpool,personal,web3,quorum,${QUORUM_CONSENSUS:-istanbul} \
--rpccorsdomain "*" \
--ws \
--wsaddr 0.0.0.0 \
--wsport 8546 \
Expand Down Expand Up @@ -179,6 +185,7 @@ services:
hostname: node1
ports:
- "22000:8546"
- "8545:8545"
volumes:
- 1:/qdata
- .:/examples:ro
Expand Down

0 comments on commit d6e69c0

Please sign in to comment.