1
0
mirror of https://github.com/oceanprotocol/barge.git synced 2024-11-22 09:47:04 +01:00

Fix smart contract issue, update documentation.

This commit is contained in:
ssallam 2018-06-27 15:51:32 +02:00
parent ce4136f86b
commit 56f7e024df
7 changed files with 108 additions and 183 deletions

View File

@ -1 +1 @@
NETWORK_NAME=ocean-protocol
NETWORK_NAME=ocean-network

View File

@ -1,25 +1,96 @@
# Instructions to run a Parity dev node using Docker Compose
### Pre-requisites
* Docker
* Docker-compose
# Ocean private test net using Proof Of Authority consensus
### Setup
### Run a private network based on this repository
* Download/clone the files in this repository
`git clone https://github.com/oceanprotocol/docker-images.git`
* cd into `parity`
* Run: `docker-compose up -d`
* This will run 3 validator/authority nodes and 3 user nodes
0. Install [docker](https://docs.docker.com/engine/installation/) and [docker-compose](https://docs.docker.com/compose/install/)
1. Run `git clone https://github.com/oceanprotocol/docker-images.git`
2. Run `cd docker-images/parity`
3. Run `docker-compose up ` (add `-d` to run in daemon mode)
4. This will run 3 validator/authority nodes and 1 user node
### Add more authority nodes to the base network
### Access JSON RPC
Access JSON RPC at [http://127.0.0.1:8545](http://127.0.0.1:8545).
### Some handy curl commands
### Send transaction
```
curl --data '{"jsonrpc":"2.0","method":"personal_sendTransaction","params":[{"from":"0x<address>","to":"0x<address>","value":"0x<value>"}, "<password if any>"],"id":0}' -H "Content-Type: application/json" -X POST localhost:8545
```
#### Unlock account
replace `null` with number of seconds to indicate how long account will be unlocked
Account address goes in the first param (here is's just "0x")
```
curl --data '{"method":"personal_unlockAccount","params":["0x","hunter2",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
```
### New account
Using just a password
```
curl --data '{"method":"personal_newAccount","params":["password-hunter2"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
```
Using a recovery phrase and password
```
curl --data '{"method":"parity_newAccountFromPhrase","params":["stylus outing overhand dime radial seducing harmless uselessly evasive tastiness eradicate imperfect","hunter2"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
```
Refer to these sources for more goodies:
* https://github.com/paritytech/wiki
* https://github.com/paritytech/wiki/blob/master/JSONRPC-personal-module.md
* https://github.com/paritytech/wiki/blob/master/JSONRPC-parity_accounts-module.md
### Instructions to add a validator node using Docker Compose
* Run the private network as described above
* Create a new validator account:
`curl --data '{"jsonrpc":"2.0","method":"parity_newAccountFromPhrase","params":["nodeX", "nodeX"],"id":0}' -H "Content-Type: application/json" -X POST localhost:8545`
`curl --data '{"jsonrpc":"2.0","method":"parity_newAccountFromPhrase","params":["nodeX-phrase", "nodeX-password"],"id":0}' -H "Content-Type: application/json" -X POST localhost:8545`
* Returns something like this: `{"jsonrpc":"2.0","result":"0x00aa39d30f0d20ff03a22ccfc30b7efbfca597c2","id":0}`
* Copy the file `parity/keys/UTC--2018-05-22T13-53-28Z--ed4d9a7c-4206-bbf3-673c-fdd1d41b4dcb` to `parity/authorities` and rename it to `validatorX.json` (pick a better name) then modify the contents to indent properly
* Add a simple text file named `validatorX.pwd` in `parity/authorities` and add the password `nodeX` (or whatever was specified in the "params":["nodeX", "nodeX"])
* Copy/paste one of the validator specs in the docker-compose.yml file and modify it to reflect the new node name and make sure to point to the new `validatorX.json` and `validayorX.pwd` files.
* Also specify the address in the --engine-signer option
* And add the name in the volumes section in the compose file
* Make a copy of `parity/node0.network.key` and modify the key inside this file (anything should do)
* Copy the file `parity/keys/UTC--2018-05-22T13-53-28Z--ed4d9a7c-4206-bbf3-673c-fdd1d41b4dcb` to `parity/authorities` and rename it to `validatorX.json` (pick a better name) then modify the contents to improve indentation (optional)
* Add a simple text file named `validatorX.pwd` in `parity/authorities` and add the password `nodeX-password` (or whatever was specified in the "params":["nodeX-phrase", "nodeX-password"])
* Copy/paste a validator image definition section in the docker-compose.yml file and modify it to reflect the new node name and make sure to point to the new `validatorX.json` and `validayorX.pwd` files.
* This is what will be added to the docker-compose.yml file:
```
validatorX:
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00aa39d30f0d20ff03a22ccfc30b7efbfca597c2
volumes:
- ./parity/config:/parity/config:ro
- validatorX:/root/.local/share/io.parity.ethereum/
- ./parity/authorities/validatorX.json:/root/.local/share/io.parity.ethereum/keys/${NETWORK_NAME}/validator.json:ro
- ./parity/authorities/validatorX.pwd:/parity/validator.pwd:ro
- ./parity/nodeX.network.key:/root/.local/share/io.parity.ethereum/network/key:ro
networks:
my_net:
ipv4_address: 172.16.0.13
```
* Make sure to assign a new `ipv4_address` address
* Specify the new account address in the --engine-signer option
* And add the name in the volumes section in the compose file:
```
volumes:
validator0:
validator1:
validator2:
validatorX:
```
* Generate a new bootnode key and add it here `docker-images/parity/parity/nodeX.network.key`
* Get an enode address and add it in both `member.toml` and `validator.toml` files in the bootnodes list under `[network]`
* Update the validators list in `chain.json` by adding the new account to the existing list
## Notes
* We ran into an issue with running smart contracts where a function in one contract fails if it calls a function of another contract
* This problem is fixed by adding the following lines to the `chain.json` file to enable byzantium mode in the EVM:
```
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
```
* The problem is reported in `https://github.com/paritytech/parity/issues/8503` and `https://github.com/ethereum/solidity/issues/3969`

View File

@ -1 +0,0 @@
["123"]

View File

@ -1,11 +1,11 @@
version: '2.1'
services:
validator0:
image: parity/parity:latest
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e
--dapps-interface 0.0.0.0
--jsonrpc-interface 0.0.0.0
--ws-interface 0.0.0.0
--ui-interface 0.0.0.0
--unsafe-expose
@ -25,7 +25,7 @@ services:
ipv4_address: 172.16.0.10
validator1:
image: parity/parity:latest
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00aa39d30f0d20ff03a22ccfc30b7efbfca597c2
@ -40,7 +40,7 @@ services:
ipv4_address: 172.16.0.11
validator2:
image: parity/parity:latest
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x002e28950558fbede1a9675cb113f0bd20912019
@ -55,10 +55,10 @@ services:
ipv4_address: 172.16.0.12
user0:
image: parity/parity:latest
image: parity/parity:stable
command:
--config /parity/config/member.toml
--dapps-interface 0.0.0.0
--jsonrpc-interface 0.0.0.0
--ws-interface 0.0.0.0
--ui-interface 0.0.0.0
--unsafe-expose

View File

@ -1,149 +0,0 @@
[
{
"name" : "validator0",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "validator0",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "validator0",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "validator1",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "validator1",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "validator1",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "validator2",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "validator2",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "validator2",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "validator3",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "validator3",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "validator3",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "user0",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "user0",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "user0",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "user1",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "user1",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "user1",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
},
{
"name" : "user2",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"merge_logs" : false,
"watch" : true,
"max_restarts" : 10,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "user2",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "user2",
"WS_SERVER" : "ws://dashboard:3000",
"WS_SECRET" : "123",
"VERBOSITY" : 3
}
}
]

View File

@ -1,5 +1,5 @@
{
"name": "ocean-protocol",
"name": "ocean-network",
"engine": {
"authorityRound": {
"params": {
@ -7,7 +7,7 @@
"validators": {
"list": [
"0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e",
"0x00aa39d30f0d20ff03a22ccfc30b7efbfca597c2",
"0x00Aa39d30F0D20FF03a22cCfc30B7EfbFca597C2",
"0x002e28950558fbede1a9675cb113f0bd20912019"
]
},
@ -20,8 +20,13 @@
"params": {
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x2323",
"gasLimitBoundDivisor": "0x400"
"networkID": "0x2323",
"gasLimitBoundDivisor": "0x400",
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
},
"genesis": {
"seal": {
@ -83,10 +88,10 @@
}
},
"0x6B0c56d1Ad5144b4d37fa6e27DC9afd5C2435c3B": {
"balance": "10"
"balance": "1000"
},
"0x0011598De1016A350ad719D23586273804076774": {
"balance": "10"
"balance": "100500"
},
@ -95,4 +100,4 @@
}
}
}
}

View File

@ -1 +0,0 @@
{"parity://1.ui.parity":{"last_accessed":1529334413},"":{"last_accessed":1529074407}}