Added content on using multinode example (#1345)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
MadelineMurray 6 years ago committed by GitHub
parent 764e18174f
commit 80b27f3dab
  1. 13
      docs/Privacy/Configuring-Privacy.md
  2. 103
      docs/Privacy/Creating-Sending-Private-Transactions.md
  3. 2
      docs/Tutorials/Create-IBFT-Network.md

@ -107,11 +107,11 @@ orion orion.conf
In the `Node-1` directory, start Pantheon Node-1:
```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../ibftGenesis.json --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --privacy-enabled --privacy-url=http://127.0.0.1:8888 --privacy-public-key-file=Orion/nodeKey.pub
pantheon --data-path=data --genesis-file=../ibftGenesis.json --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --privacy-enabled --privacy-url=http://127.0.0.1:8888 --privacy-public-key-file=Orion/nodeKey.pub --min-gas-price=0
```
```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --privacy-enabled --privacy-url=http://127.0.0.1:8888 --privacy-public-key-file=Orion\nodeKey.pub
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --privacy-enabled --privacy-url=http://127.0.0.1:8888 --privacy-public-key-file=Orion\nodeKey.pub --min-gas-price=0
```
The command line specifies privacy options:
@ -122,6 +122,7 @@ The command line specifies privacy options:
Orion node public key (created in [3. Generate Orion Keys](#3-generate-orion-keys))
* [`--rpc-http-api`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-api) includes `EEA` in the list of
JSON-RPC APIs to enable privacy JSON-RPC API methods.
* [`--min-gas-price`](../Reference/Pantheon-CLI-Syntax.md#min-gas-price) set to 0 for a [free gas network](../Configuring-Pantheon/FreeGas.md).
!!!note
The [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path), [`--genesis-file`](../Reference/Pantheon-CLI-Syntax.md#genesis-file),
@ -138,11 +139,11 @@ Copy the enode URL to specify Node-1 as the bootnode in the following steps.
In the `Node-2` directory, start Pantheon Node-2 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546 --privacy-enabled --privacy-url=http://127.0.0.1:8889 --privacy-public-key-file=Orion/nodeKey.pub
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546 --privacy-enabled --privacy-url=http://127.0.0.1:8889 --privacy-public-key-file=Orion/nodeKey.pub --min-gas-price=0
```
```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546 --privacy-enabled --privacy-url=http://127.0.0.1:8889 --privacy-public-key-file=Orion\nodeKey.pub
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30304 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8546 --privacy-enabled --privacy-url=http://127.0.0.1:8889 --privacy-public-key-file=Orion\nodeKey.pub --min-gas-price=0
```
The command line specifies the same options as for Node-1 with different ports and Orion node URL. The
@ -157,11 +158,11 @@ The command line specifies the same options as for Node-1 with different ports a
In the `Node-3` directory and start Pantheon Node-3 specifying the Node-1 enode URL copied when starting Node-1 as the bootnode:
```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547 --privacy-enabled --privacy-url=http://127.0.0.1:8890 --privacy-public-key-file=Orion/nodeKey.pub
pantheon --data-path=data --genesis-file=../ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547 --privacy-enabled --privacy-url=http://127.0.0.1:8890 --privacy-public-key-file=Orion/nodeKey.pub --min-gas-price=0
```
```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547 --privacy-enabled --privacy-url=http://127.0.0.1:8890 --privacy-public-key-file=Orion\nodeKey.pub
pantheon --data-path=data --genesis-file=..\ibftGenesis.json --bootnodes=<Node-1 Enode URL> --p2p-port=30305 --rpc-http-enabled --rpc-http-api=ETH,NET,IBFT,EEA --host-whitelist=* --rpc-http-cors-origins="all" --rpc-http-port=8547 --privacy-enabled --privacy-url=http://127.0.0.1:8890 --privacy-public-key-file=Orion\nodeKey.pub --min-gas-price=0
```
The command line specifies the same options as for Node-1 with different ports and Orion node URL. The

@ -8,4 +8,105 @@ RLP-encoded private transactions.
!!! note
Private transactions either deploy contracts or call contract functions.
Ether transfers cannot be a private transaction.
Ether transfer transactions cannot be private.
The [EEAJS library README](https://github.com/PegaSysEng/eeajs/blob/master/README.md) describes how to use
the provided examples with the [Privacy Quickstart](https://github.com/PegaSysEng/pantheon-quickstart/tree/master/privacy).
## Using Multinode Example
To use the examples provided in EEA JS library with [your privacy network](Configuring-Privacy.md):
1. Clone the **PegaSysEng/eeajs** repository:
```bash
git clone https://github.com/PegaSysEng/eeajs.git
```
1. In the `eeajs` directory:
```bash
npm install
```
1. In the `example` directory, update the `keys.js` file to include:
* Orion node public keys
* Pantheon node RPC URLs
* Pantheon node private keys
1. If the `chainID` specified in the genesis file for your network is not `2018`, update `deployContract.js`,
`storeValueFromNode1.js`, and `storeValueFromNode2.js` to specify your chain ID instead of `2018`.
1. In the `example/multiNodeExample` directory, deploy the contract:
```bash
node deployContract.js
```
A private transaction receipt is returned.
```
Transaction Hash 0x23b57ddc3ecf9c9a548e4401a411420ffc0002fd259a86d5656add7c6108beeb
Waiting for transaction to be mined ...
Private Transaction Receipt
{ contractAddress: '0xfee84481da8f4b9a998dfacb38091b3145bb01ab',
from: '0x9811ebc35d7b06b3fa8dc5809a1f9c52751e1deb',
to: null,
output:
'0x6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce146100ae575b600080fd5b34801561006757600080fd5b506100706100ec565b60408051918252519081900360200190f35b34801561008e57600080fd5b506100ac600480360360208110156100a557600080fd5b50356100f2565b005b3480156100ba57600080fd5b506100c3610151565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff169056fea165627a7a72305820c7f729cb24e05c221f5aa913700793994656f233fe2ce3b9fd9a505ea17e8d8a0029',
logs: [] }
```
1. Copy the contract address from the private transaction receipt and set the `CONTRACT_ADDRESS` environment variable:
```bash
export CONTRACT_ADDRESS=<Contract Address from Private Transaction Receipt>
```
!!! example
```bash
export CONTRACT_ADDRESS=0xfee84481da8f4b9a998dfacb38091b3145bb01ab
```
1. Store a value in the contract from Node 1:
```bash
node storeValueFromNode1.js
```
The value of 1000 (3e8 in hex) is stored by Node 1 and is visible to Node 1 and Node 2.
```bash
Transaction Hash: 0xd9d71cc6f64675e1a48183ded8f08930af317eb883ebae4c4eec66ae68618d85
Waiting for transaction to be mined ...
Event Emited: 0x0000000000000000000000009811ebc35d7b06b3fa8dc5809a1f9c52751e1deb00000000000000000000000000000000000000000000000000000000000003e8
Waiting for transaction to be mined ...
Get Value from http://localhost:8545: 0x00000000000000000000000000000000000000000000000000000000000003e8
Waiting for transaction to be mined ...
Get Value from http://localhost:8546: 0x00000000000000000000000000000000000000000000000000000000000003e8
Waiting for transaction to be mined ...
Get Value from http://localhost:8547: 0x
```
7. Store a value in the contract from Node 2:
```bash
node storeValueFromNode2.js
```
The value of 42 (2a in hex) is stored by Node 1 and is visible to Node 1 and Node 2.
```bash
Transaction Hash: 0xa025433aec47a71b0230f12f43708812fd38ff7b7c1dc89a715f71dcbd5fbdbf
Waiting for transaction to be mined ...
Event Emited: 0x000000000000000000000000372a70ace72b02cc7f1757183f98c620254f9c8d000000000000000000000000000000000000000000000000000000000000002a
Waiting for transaction to be mined ...
Get Value from http://localhost:8545: 0x000000000000000000000000000000000000000000000000000000000000002a
Waiting for transaction to be mined ...
Get Value from http://localhost:8546: 0x000000000000000000000000000000000000000000000000000000000000002a
Waiting for transaction to be mined ...
Get Value from http://localhost:8547: 0x
```
!!! note
The Node 3 Orion log messages indicate payloads cannot be found. This is expected behaviour
because Node 3 does not have access to the private transactions between Node 1 and Node 2.

@ -101,7 +101,7 @@ Copy the following genesis definition to a file called `ibftGenesis.json` and sa
```json
{
"config": {
"chainId": 1981,
"chainId": 2018,
"constantinoplefixblock": 0,
"ibft2": {
"blockperiodseconds": 2,

Loading…
Cancel
Save