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

refactor more

This commit is contained in:
Sebastian Gerske 2018-12-06 09:16:50 +01:00
parent 6824e8309e
commit 306585118b
42 changed files with 306 additions and 227 deletions

View File

@ -2,6 +2,8 @@ version: '2.1'
services:
keeper-node:
image: trufflesuite/ganache-cli:latest
command:
-d
ports:
- 8545:8545
networks:

View File

@ -1,8 +1,7 @@
version: '2.1'
services:
keeper-node:
image: oceanprotocol/parity-ethereum:beta
entrypoint: /opt/parity/parity
image: parity/parity:stable
command:
--chain kovan
--light

View File

@ -0,0 +1,29 @@
version: '2.1'
services:
keeper-node:
image: parity/parity:stable
command:
--config /home/parity/parity/config/config.toml
--db-path /home/parity/chains
--keys-path /home/parity/.local/share/io.parity.ethereum/keys
--base-path /home/parity/base
--engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e
--ws-interface all
--jsonrpc-cors all
--jsonrpc-interface all
--jsonrpc-hosts all
--jsonrpc-apis all
--unsafe-expose
--unlock 0x00bd138abd70e2f00903268f3db08f2d25677c9e
volumes:
- ../networks/lake/config:/home/parity/parity/config
- keeper-node:/home/parity/.local/share/io.parity.ethereum/
- ../networks/lake/authorities/validator0.json:/home/parity/.local/share/io.parity.ethereum/keys/lake/validator.json
- ../networks/lake/keys:/home/parity/.local/share/io.parity.ethereum/keys/lake
- ../networks/lake/authorities/validator0.pwd:/home/parity/parity/validator.pwd
- ../networks/lake/node0.network.key:/home/parity/.local/share/io.parity.ethereum/network/key
ports:
- 8545:8545
networks:
backend:
ipv4_address: 172.15.0.12

View File

@ -1,28 +1,21 @@
version: '2.1'
services:
keeper-node:
image: oceanprotocol/parity-ethereum:beta
entrypoint: /opt/parity/parity
image: parity/parity:stable
command:
--config /home/parity/parity/config/secretstoreclient.toml
--db-path /home/parity/chains
--config /home/parity/parity/config/config.toml
--keys-path /home/parity/.local/share/io.parity.ethereum/keys
--base-path /home/parity/base
--engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e
--ws-interface all
--min-gas-price 0
--reseal-min-period 0
--jsonrpc-cors all
--jsonrpc-interface all
--jsonrpc-hosts all
--jsonrpc-apis all
--unsafe-expose
--unlock 0x00bd138abd70e2f00903268f3db08f2d25677c9e
volumes:
- ../parity/parity/config:/home/parity/parity/config
- keeper-node:/home/parity/.local/share/io.parity.ethereum/
- ../parity/parity/authorities/validator0.json:/home/parity/.local/share/io.parity.ethereum/keys/ocean-network/validator.json
- ../parity/parity/keys:/home/parity/.local/share/io.parity.ethereum/keys/ocean-network
- ../parity/parity/authorities/validator0.pwd:/home/parity/parity/validator.pwd
- ../parity/parity/node0.network.key:/home/parity/.local/share/io.parity.ethereum/network/key
- ../networks/pond/config:/home/parity/parity/config
- ../networks/pond/keys/validator.pwd:/home/parity/parity/validator.pwd
- ../networks/pond/keys:/home/parity/.local/share/io.parity.ethereum/keys/pond
ports:
- 8545:8545
networks:

View File

@ -2,14 +2,17 @@ version: '2.1'
services:
secret-store:
image: oceanprotocol/parity-ethereum:master
# entrypoint: tail -f /dev/null
entrypoint: /opt/parity/parity
command:
--config /etc/parity/secretstore/config.toml --jsonrpc-cors all --jsonrpc-interface all --jsonrpc-hosts all --jsonrpc-apis all
--config /etc/parity/secretstore/config.toml
--jsonrpc-cors all
--jsonrpc-interface all
--jsonrpc-hosts all
--jsonrpc-apis all
volumes:
- ../parity/secret_store/config/:/etc/parity/secretstore/
- secret-store:/parity_data/
- ../parity/secret_store/keys/:/parity_data/keys/ocean-network/
- ../parity/secret-store/config/:/etc/parity/secretstore/
- secret-store:/secret-store/
- ../parity/secret-store/keys/:/secret-store/keys/secretstore/
ports:
- 12000:12000
- 12001
@ -31,8 +34,7 @@ services:
command: nginx -g 'daemon off;'
secret-store-signing-node:
image: oceanprotocol/parity-ethereum:master
entrypoint: /opt/parity/parity
image: parity/parity:stable
command:
--chain dev
--light
@ -43,7 +45,7 @@ services:
ports:
- 9545:8545
volumes:
- ../parity/parity/keys:/home/parity/.local/keys/DevelopmentChain:ro
- ../parity/secret-store/keys:/home/parity/.local/keys/DevelopmentChain:ro
networks:
backend:
ipv4_address: 172.15.0.18

View File

@ -1,5 +1,5 @@
{
"name": "ocean-network",
"name": "lake",
"engine": {
"authorityRound": {
"params": {
@ -20,7 +20,7 @@
"params": {
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x2324",
"networkID": "0x2323",
"gasLimitBoundDivisor": "0x400",
"eip140Transition": 0,
"eip211Transition": 0,

View File

@ -0,0 +1,155 @@
{
"name": "pond",
"engine": {
"instantSeal": null
},
"params": {
"gasLimitBoundDivisor": "0x0400",
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x2324",
"registrar": "0x0000000000000000000000000000000000001337",
"eip150Transition": "0x0",
"eip160Transition": "0x0",
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip155Transition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip658Transition": "0x0",
"wasmActivationTransition": "0x0"
},
"genesis": {
"seal": {
"generic": "0x0"
},
"difficulty": "0x20000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x165A0BC00"
},
"accounts": {
"0x0000000000000000000000000000000000000001": {
"balance": "1",
"builtin": {
"name": "ecrecover",
"pricing": {
"linear": {
"base": 3000,
"word": 0
}
}
}
},
"0x0000000000000000000000000000000000000002": {
"balance": "1",
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
}
}
}
},
"0x0000000000000000000000000000000000000003": {
"balance": "1",
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
}
}
}
},
"0x0000000000000000000000000000000000000004": {
"balance": "1",
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
}
}
}
},
"0x0000000000000000000000000000000000000005": {
"balance": "1",
"builtin": {
"name": "modexp",
"activate_at": 0,
"pricing": {
"modexp": {
"divisor": 20
}
}
}
},
"0x0000000000000000000000000000000000000006": {
"balance": "1",
"builtin": {
"name": "alt_bn128_add",
"activate_at": 0,
"pricing": {
"linear": {
"base": 500,
"word": 0
}
}
}
},
"0x0000000000000000000000000000000000000007": {
"balance": "1",
"builtin": {
"name": "alt_bn128_mul",
"activate_at": 0,
"pricing": {
"linear": {
"base": 40000,
"word": 0
}
}
}
},
"0x0000000000000000000000000000000000000008": {
"balance": "1",
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": 0,
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
"pair": 80000
}
}
}
},
"0x6B0c56d1Ad5144b4d37fa6e27DC9afd5C2435c3B": {
"balance": "0x200000000000000000000000000000000000000000000000"
},
"0x0011598De1016A350ad719D23586273804076774": {
"balance": "0x200000000000000000000000000000000000000000000000"
},
"0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0": {
"balance": "0x200000000000000000000000000000000000000000000000"
},
"0xa99d43d86a0758d5632313b8fa3972b6088a21bb": {
"balance": "0x200000000000000000000000000000000000000000000000"
},
"0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e": {
"balance": "0x200000000000000000000000000000000000000000000000"
}
}
}

View File

@ -0,0 +1,18 @@
# Users config file in users.toml
# This configuration file can be used for either Alice, Bob or Charlie
[parity]
chain = "/home/parity/parity/config/chain.json"
[rpc]
port = 8545
interface = "0.0.0.0"
cors = ["all"]
hosts = ["all"]
apis = ["all"]
[mining]
engine_signer = "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"
[account]
password = ["/home/parity/parity/validator.pwd"]

View File

@ -0,0 +1,23 @@
{
"id": "0902d04b-f26e-5c1f-e3ae-78d2c1cb16e7",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "6a829fe7bc656d85f6c2e9fd21784952"
},
"ciphertext": "1bfec0b054a648af8fdd0e85662206c65a4af0ed15fede4ad41ca9ab7b504ce2",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "95f96b5ee22dd537e06076eb8d7078eb7275d29af935782fe476696b11be50e5"
},
"mac": "4af2215c3cd9447a5b0512d7d1c3ea5a4435981e1c8f48bf71d7a49c0e5b4986"
},
"address": "00bd138abd70e2f00903268f3db08f2d25677c9e",
"name": "Validator0",
"meta": "{}"
}

View File

@ -0,0 +1 @@
node0

View File

@ -1,5 +1,5 @@
{
"name": "ocean-network",
"name": "secrestore",
"engine": {
"authorityRound": {
"params": {

View File

@ -0,0 +1,22 @@
{
"id": "50aa801a-8d66-1402-1fa4-d8987868c2ce",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "a874e6fe50a5bb088826c45560dc1b7e"
},
"ciphertext": "2383c6aa50c744b6558e77b5dcec6137f647c81f10f71f22a87321fd1306056c",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "eca6ccc9fbb0bdc3a516c7576808ba5031669e6878f3bb95624ddb46449e119c"
},
"mac": "14e9a33a45ae32f88a0bd5aac14521c1fcf14f56fd55c1a1c080b2f81ddb8d44"
},
"address": "068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0",
"name": "",
"meta": "{}"
}

View File

@ -0,0 +1,22 @@
{
"id": "ce455fdd-11fd-5a71-0a31-9d0bec6a605d",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "56b27c187d45aab59377869042b948aa"
},
"ciphertext": "c774b879793e2e54b85071d929cc7fbb11b47f6bab6e590edf3997fe4373eaf8",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "33b3b99e4c6f7f6d7d804555d40c08e4a2acba20e1e46aca712c82c3b9bab749"
},
"mac": "10ee295ce6b1553887413f0e717ccedc1bddb62572bb9208ec3bd091085990db"
},
"address": "a99d43d86a0758d5632313b8fa3972b6088a21bb",
"name": "",
"meta": "{}"
}

View File

@ -0,0 +1 @@
{}

View File

@ -1 +0,0 @@
NETWORK_NAME=ocean-network

View File

@ -1,111 +0,0 @@
# Ocean private test net using Proof Of Authority consensus
### Setup
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
### 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-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 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`
## The ocean test net
The private test net is running on Azure VM `ocn-hackaton` with ip address `40.115.16.244`
To connect to the network, provide the ip address and use port `8545`
To deploy keeper-contracts, use the following in your truffle.js file:
```
ocean_poa_net: {
host: 'http://40.115.16.244',
port: 8545,
network_id: '*',
gas: 6000000,
from: "0x00bd138abd70e2f00903268f3db08f2d25677c9e"
},
```

View File

@ -1,88 +0,0 @@
version: '2.1'
services:
validator0:
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e
--jsonrpc-interface 0.0.0.0
--ws-interface 0.0.0.0
--ui-interface 0.0.0.0
--unsafe-expose
--jsonrpc-cors all
--unlock 0x00bd138abd70e2f00903268f3db08f2d25677c9e
volumes:
- ./parity/config:/parity/config:ro
- validator0:/root/.local/share/io.parity.ethereum/
- ./parity/authorities/validator0.json:/root/.local/share/io.parity.ethereum/keys/${KEEPER_NETWORK_NAME}/validator.json:ro
- ./parity/keys:/root/.local/share/io.parity.ethereum/keys/${KEEPER_NETWORK_NAME}
- ./parity/authorities/validator0.pwd:/parity/validator.pwd:ro
- ./parity/node0.network.key:/root/.local/share/io.parity.ethereum/network/key:ro
ports:
- 8545:8545
networks:
my_net:
ipv4_address: 172.16.0.10
validator1:
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00aa39d30f0d20ff03a22ccfc30b7efbfca597c2
volumes:
- ./parity/config:/parity/config:ro
- validator1:/root/.local/share/io.parity.ethereum/
- ./parity/authorities/validator1.json:/root/.local/share/io.parity.ethereum/keys/${KEEPER_NETWORK_NAME}/validator.json:ro
- ./parity/authorities/validator1.pwd:/parity/validator.pwd:ro
- ./parity/node1.network.key:/root/.local/share/io.parity.ethereum/network/key:ro
networks:
my_net:
ipv4_address: 172.16.0.11
validator2:
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x002e28950558fbede1a9675cb113f0bd20912019
volumes:
- ./parity/config:/parity/config:ro
- validator2:/root/.local/share/io.parity.ethereum/
- ./parity/authorities/validator2.json:/root/.local/share/io.parity.ethereum/keys/${KEEPER_NETWORK_NAME}/validator.json:ro
- ./parity/authorities/validator2.pwd:/parity/validator.pwd:ro
- ./parity/node2.network.key:/root/.local/share/io.parity.ethereum/network/key:ro
networks:
my_net:
ipv4_address: 172.16.0.12
user0:
image: parity/parity:stable
command:
--config /parity/config/member.toml
--jsonrpc-interface 0.0.0.0
--ws-interface 0.0.0.0
--ui-interface 0.0.0.0
--unsafe-expose
volumes:
- ./parity/config:/parity/config:ro
- ./parity/keys:/root/.local/share/io.parity.ethereum/keys/${KEEPER_NETWORK_NAME}
ports:
- 8180:8180
- 8546:8546
- 30303:30303
networks:
my_net:
ipv4_address: 172.16.0.20
volumes:
validator0:
validator1:
validator2:
networks:
my_net:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.0.1/24
gateway: 172.16.0.1

View File

@ -68,6 +68,18 @@ while :; do
COMPOSE_FILES=${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/pleuston.yml/}
printf $COLOR_Y'Starting without Pleuston...\n\n'$COLOR_RESET
;;
--no-brizo)
COMPOSE_FILES=${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/brizo.yml/}
printf $COLOR_Y'Starting without Brizo...\n\n'$COLOR_RESET
;;
--no-aquarius)
COMPOSE_FILES=${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius.yml/}
printf $COLOR_Y'Starting without Aquarius...\n\n'$COLOR_RESET
;;
--no-secret-store)
COMPOSE_FILES=${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store.yml/}
printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET
;;
#################################################
# Contract/Storage switches
#################################################