Merge pull request #7 from oceanprotocol/develop

Plankton release 0.1
This commit is contained in:
Aitor 2018-08-15 15:30:06 +02:00 committed by GitHub
commit 232aaba5b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 629 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea
artifacts/

View File

@ -1 +1,84 @@
# docker-images
[![banner](doc/img/repo-banner@2x.png)](https://oceanprotocol.com)
<h1 align="center">docker-images</h1>
> 💧 Integration of TCRs, CPM and Ocean Tokens in Solidity
> [oceanprotocol.com](https://oceanprotocol.com)
[![Build Status](https://travis-ci.com/oceanprotocol/keeper-contracts.svg?token=soMi2nNfCZq19zS1Rx4i&branch=master)](https://travis-ci.com/oceanprotocol/keeper-contracts)
[![js ascribe](https://img.shields.io/badge/js-ascribe-39BA91.svg)](https://github.com/ascribe/javascript)
Ocean Keeper implementation where we put the following modules together:
* **TCRs**: users create challenges and resolve them through voting to maintain registries;
* **Ocean Tokens**: the intrinsic tokens circulated inside Ocean network, which is used in the voting of TCRs;
* **Marketplace**: the core marketplace where people can transact with each other with Ocean tokens.
## Table of Contents
- [Get Started](#get-started)
- [Docker](#docker)
- [Contributing](#contributing)
- [License](#license)
---
## Get Started
For local development you can use Docker & Docker Compose. To do that you need to have the newest versions available of both:
* [Docker](https://www.docker.com/get-started)
* [Docker Compose](https://docs.docker.com/compose/)
### Docker
The most simple way to get started is with Docker compose:
```bash
docker-compose --project-name=ocean up
```
This will give you a local instance of Ocean Protocol.
After having everything running, you could open the browser and access to the **pleuston frontend** application:
```
http://localhost:3000
```
## Ocean components
The Ocean Docker compose starts the following components:
* **Pleuston** frontend application. Listening the **3000** port.
* **Provider backend**. Listening the **5000** port.
* **Keeper contracts**. Listening the **8545** port.
* **BigchainDB**. Listening the **9984** port.
![Ocean Docker Images](doc/img/docker-images.jpg)
## Contributing
We use GitHub as a means for maintaining and tracking issues and source code development.
If you would like to contribute, please fork this repository, do work in a feature branch, and finally open a pull request for maintainers to review your changes.
Ocean Protocol uses [C4 Standard process](https://github.com/unprotocols/rfc/blob/master/1/README.md) to manage changes in the source code. Find here more details about [Ocean C4 OEP](https://github.com/oceanprotocol/OEPs/tree/master/1).
## License
```
Copyright 2018 Ocean Protocol Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

BIN
doc/img/docker-images.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
doc/img/repo-banner@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

86
docker-compose.yml Normal file
View File

@ -0,0 +1,86 @@
version: '2.1'
# Run: docker-compose --project-name=ocean up
services:
mongodb:
image: mongo:3.6
ports:
- "27017:27017"
command: mongod
networks:
- backend
bigchaindb:
depends_on:
- mongodb
image: bigchaindb/bigchaindb:2.0.0-beta1
environment:
BIGCHAINDB_DATABASE_BACKEND: localmongodb
BIGCHAINDB_DATABASE_HOST: mongodb
BIGCHAINDB_DATABASE_PORT: 27017
BIGCHAINDB_SERVER_BIND: 0.0.0.0:9984
BIGCHAINDB_WSSERVER_HOST: 0.0.0.0
BIGCHAINDB_WSSERVER_ADVERTISED_HOST: bigchaindb
BIGCHAINDB_TENDERMINT_HOST: tendermint
BIGCHAINDB_TENDERMINT_PORT: 46657
ports:
- "9984:9984"
- "9985:9985"
- "46658"
healthcheck:
test: ["CMD", "bash", "-c", "curl http://bigchaindb:9984 && curl http://tendermint:46657/abci_query"]
interval: 3s
timeout: 5s
retries: 3
networks:
- backend
tendermint:
depends_on:
- bigchaindb
image: tendermint/tendermint:0.19.9
# volumes:
# - ./tmdata:/tendermint
entrypoint: ''
ports:
- "46656:46656"
- "46657:46657"
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --proxy_app=tcp://bigchaindb:46658"
networks:
- backend
keeper-contracts:
image: oceanprotocol/keeper-contracts
ports:
- 8545:8545
networks:
- backend
volumes:
- artifacts:/keeper-contracts/artifacts/
provider-backend:
image: oceanprotocol/provider-backend
ports:
- 5000:5000
networks:
- backend
depends_on:
- keeper-contracts
volumes:
- artifacts:/usr/local/contracts/:ro
pleuston:
image: oceanprotocol/pleuston
ports:
- 3000:3000
depends_on:
- keeper-contracts
volumes:
- artifacts:/pleuston/node_modules/@oceanprotocol/keeper-contracts/artifacts/:ro
networks:
backend:
volumes:
artifacts:

1
parity/.env Executable file
View File

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

111
parity/README.md Normal file
View File

@ -0,0 +1,111 @@
# 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"
},
```

88
parity/docker-compose.yml Normal file
View File

@ -0,0 +1,88 @@
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/${NETWORK_NAME}/validator.json:ro
- ./parity/keys:/root/.local/share/io.parity.ethereum/keys/${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/${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/${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/${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

@ -0,0 +1,22 @@
{
"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

@ -0,0 +1,22 @@
{
"id": "e854acbe-e6b2-e812-9f84-7b0945a1f14f",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "1b90ae52dcc1bc285ae3846d0ca9be53"
},
"ciphertext": "b80f21bfb2029dafc89c36c6838e7a9e711ee13ec3e6900c3b097e45ae2ece7c",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "d823ab988002888a19336ab6650b83a4c536b42612148c9c5337ec4d92e981d1"
},
"mac": "f8d1e53f4be85b0f77aa02bfe08b93eacdef74995822a59ddaea0497a69318af"
},
"address": "00aa39d30f0d20ff03a22ccfc30b7efbfca597c2",
"name": "Validator1",
"meta": "{}"
}

View File

@ -0,0 +1 @@
node1

View File

@ -0,0 +1,22 @@
{
"id": "26ef5e07-4494-52b5-653f-a982ac907807",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "53addf73788522f6d5bf73abb0e0b8da"
},
"ciphertext": "88c1013308cff929825e5da57ceaf15ae86e656165bcb2de3b06b24985358af6",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "ab8efcf7ee2c368eced8982b22328d862ea0c15307ce6ccd5994fae5a9b13244"
},
"mac": "c93ca54145b4f21b62c422247609d0b891149f0d9752f6fe9ef60421f10bad6c"
},
"address": "002e28950558fbede1a9675cb113f0bd20912019",
"name": "Validator2",
"meta": "{}"
}

View File

@ -0,0 +1 @@
node2

View File

@ -0,0 +1,103 @@
{
"name": "ocean-network",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "1",
"validators": {
"list": [
"0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e",
"0x00Aa39d30F0D20FF03a22cCfc30B7EfbFca597C2",
"0x002e28950558fbede1a9675cb113f0bd20912019"
]
},
"validateScoreTransition": 1000000000,
"validateStepTransition": 1500000000,
"maximumUncleCount": 1000000000
}
}
},
"params": {
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x2323",
"gasLimitBoundDivisor": "0x400",
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"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
}
}
}
},
"0x6B0c56d1Ad5144b4d37fa6e27DC9afd5C2435c3B": {
"balance": "1000"
},
"0x0011598De1016A350ad719D23586273804076774": {
"balance": "100500"
},
"0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e": {
"balance": "10000000111000111000111000"
}
}
}

View File

@ -0,0 +1,18 @@
[parity]
chain = "/parity/config/chain.json"
[rpc]
interface = "0.0.0.0"
cors = ["all"]
hosts = ["all"]
apis = ["web3", "eth", "net", "parity", "traces", "rpc", "personal", "parity_accounts", "signer", "parity_set"]
[network]
bootnodes = [
"enode://147573f46fe9f5cc38fbe070089a31390baec5dd2827c8f2ef168833e4d0254fbee3969a02c5b9910ea5d5b23d86a6ed5eabcda17cc12007b7d9178b6c697aa5@172.16.0.10:30303",
"enode://1412ee9b9e23700e4a67a8fe3d8d02e10376b6e1cb748eaaf8aa60d4652b27872a8e1ad65bb31046438a5d3c1b71b00ec3ce0b4b42ac71464b28026a3d0b53af@172.16.0.11:30303",
"enode://9076c143a487aa163437a86f7d009f257f405c50bb2316800b9c9cc40e5a38fef5b414a47636ec38fdabc8a1872b563effa8574a7f8f85dc6bde465c368f1bf5@172.16.0.12:30303"
]
[ui]
interface = "0.0.0.0"

View File

@ -0,0 +1,21 @@
[parity]
chain = "/parity/config/chain.json"
[rpc]
interface = "0.0.0.0"
cors = ["all"]
hosts = ["all"]
apis = ["web3", "eth", "net", "parity", "traces", "rpc", "personal", "parity_accounts", "signer", "parity_set"]
[network]
bootnodes = [
"enode://147573f46fe9f5cc38fbe070089a31390baec5dd2827c8f2ef168833e4d0254fbee3969a02c5b9910ea5d5b23d86a6ed5eabcda17cc12007b7d9178b6c697aa5@172.16.0.10:30303",
"enode://1412ee9b9e23700e4a67a8fe3d8d02e10376b6e1cb748eaaf8aa60d4652b27872a8e1ad65bb31046438a5d3c1b71b00ec3ce0b4b42ac71464b28026a3d0b53af@172.16.0.11:30303",
"enode://9076c143a487aa163437a86f7d009f257f405c50bb2316800b9c9cc40e5a38fef5b414a47636ec38fdabc8a1872b563effa8574a7f8f85dc6bde465c368f1bf5@172.16.0.12:30303"
]
[account]
password = ["/parity/validator.pwd"]
[mining]
reseal_on_txs = "none"

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,21 @@
{
"id": "0d1533e9-dd7a-a838-68dc-36ddc025c1ab",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "acbabbab8eab2b952ad3cf2bd1aab0ca"
},
"ciphertext": "134b54d057c3c0a9ac08b5eae36c46ab8dd45774215ce860afaeb4e8e50c927d",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "6f9e3ebd99b24becad3e8f773f44df8397cad68694abf7651880528d9552bfe7"
},
"mac": "f8939019ec29b46694b5ac07fdf971ec740ca4de23e7ae84a1239f54c617f7d9"
},
"address": "6b0c56d1ad5144b4d37fa6e27dc9afd5c2435c3b",
"name": "master0"
}

View File

@ -0,0 +1,21 @@
{
"id": "76d1dcd3-0c3b-24c8-0875-78e3cc151659",
"version": 3,
"crypto": {
"cipher": "aes-128-ctr",
"cipherparams": {
"iv": "6cbc68e1c87f82cefc954217cec45d64"
},
"ciphertext": "a0f97cd495dbe38dc6fa13c23a7cc15a6abc75b894827bd2729a72bc3a1ec92d",
"kdf": "pbkdf2",
"kdfparams": {
"c": 10240,
"dklen": 32,
"prf": "hmac-sha256",
"salt": "b7704b289ced489bf6da93f6d335537763d3cc68460509321a73e50b185685de"
},
"mac": "881850b5ce7709a7fd5ea923d97f77f0bd8717f054c44d35104cafc78d21813c"
},
"address": "0011598de1016a350ad719d23586273804076774",
"name": "master1"
}

View File

View File

@ -0,0 +1 @@
b3244c104fb56d28d3979f6cd14a8b5cf5b109171d293f4454c97c173a9f9374

View File

@ -0,0 +1 @@
c07b4807e704dfff975d82fc807a3da7947838379007b49c51f6a04faf4cdea8

View File

@ -0,0 +1 @@
d8bf44e2b69604bde8c84c4b403114f4410dc4f57d80e026b24b8f1af70d5633