Skip to content

Commit 2f13197

Browse files
committed
Update README and docs
1 parent 542dba3 commit 2f13197

File tree

4 files changed

+123
-160
lines changed

4 files changed

+123
-160
lines changed

README.md

Lines changed: 40 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[![Build Status](https://travis-ci.org/TrueBitFoundation/scrypt-interactive.svg?branch=master)](https://travis-ci.org/TrueBitFoundation/scrypt-interactive)
21

32
# Truebit Verification for Scrypt.
43

@@ -19,189 +18,71 @@ The client relies on a local Parity instance to execute the ScryptRunner contrac
1918

2019
The rest of the contracts can be deployed on any chain (currently ganache for local development, Rinkeby for staging, and mainnet for production).
2120

22-
There are 3 actors in the system:
21+
There are 2 actors in the system:
2322

24-
1. The claimant submitting doge block headers to the DogeRelay contract.
25-
- The claimant must also defend their block headers in the event of a challenge.
26-
2. The challenger that has the option of challenging a claimant's block headers.
27-
3. The user who wishes to use the bridge to move dogecoins to Ethereum
28-
- This user can be the same as the claimant, but it's not necessary.
29-
- This user provides a merkle proof of a tx on dogecoin that is validated against the blockheader stored in DogeRelay.
30-
- DogeRelay can trust the blockheader submissions due to the protocol described in this repo.
23+
1. The Claimant:
24+
- submits doge block headers to the DogeRelay contract.
25+
- must also defend their block headers in the event of a challenge.
26+
2. The Verifier:
27+
- monitors the Truebit contract and challenges incorrect claims.
3128

29+
The address for the contracts as deployed on Rinkeby are in the [`.env`](https://github.com/TrueBitFoundation/scrypt-interactive/blob/master/.env) file.
3230

33-
The addresses of the doge relay on mainnet are
34-
```
35-
# @TODO - update this once we deploy
36-
DOGE_RELAY_ADDRESS=0xd5cd4e3bede456d9e1da2582d7771fdbf6e28846
37-
SCRYPT_VERIFIER_ADDRESS=0xc4291fc3a35a66c993a47b96079e5439c5febe16
38-
SCRYPT_RUNNER_ADDRESS=0x75d860a49037082f1c96fe0c527f7cb9be3a3be6
39-
CLAIM_MANAGER_ADDRESS=0xff35220a6e4771b94bf1a92cf27f060d6598b1c7
40-
```
41-
42-
For your convenience, they've been coded into `.env`, but if you're interested in running against a different chain, make sure to deploy and then update those values.
43-
44-
## Running the Tests
45-
46-
First, install the needed dependencies.
47-
48-
Running the tests involves
49-
1. Running ganache `npm run ganache`
50-
2. Running parity `npm run parity`
51-
3. Running the tests `npm run test`
52-
53-
We also have a convenient `test.sh` script that does all that for you.
54-
```bash
55-
./bin/test.sh
56-
```
57-
58-
## Installing Dependencies
59-
60-
Install the latest stable release of the Parity Ethereum client. You can look for the binary [here](https://github.com/paritytech/parity/releases).
61-
```bash
62-
# make sure it's executable
63-
chmod 755 ./parity
64-
# add it to your PATH if you want to use our scripts for launching it
65-
```
66-
67-
Initialize the parity development chain database with
68-
```bash
69-
parity --chain dev
70-
```
71-
72-
Let that run for 5 seconds or whatever and then kill it. In the future, run parity with
73-
```bash
74-
npm run parity
75-
# or
76-
parity --config config.toml --geth
77-
```
78-
79-
Ensure you have the latest version of node installed (currently v9.4.0).
80-
81-
Then install packages deps:
82-
```bash
83-
npm install
84-
npm install -g sequelize-cli
85-
npm install -g truffle
86-
```
87-
88-
Install postgres and run it on the default port `5432`:
89-
90-
```
91-
# Ubuntu instructions for installing psql
92-
93-
sudo apt-get update
94-
sudo apt-get install postgresql postgresql-contrib
95-
96-
# Switch over to postgres account
97-
sudo -i -u postgres
98-
99-
# create a new role
100-
createuser --interactive
101-
102-
# enter user name
103-
# then select yes for superuser
104-
105-
# give you user the ability to execute commands as postgres user
106-
# by giving it the right permissions in pg_hba.conf
107-
108-
```
31+
## Running the client
10932

110-
Bootstrap your database with:
33+
The client software is open-source and available in this repo.
11134

112-
```bash
113-
sequelize db:create
114-
sequelize db:migrate
115-
NODE_ENV=test sequelize db:create
116-
NODE_ENV=test sequelize db:migrate
117-
```
35+
Follow [these directions](https://github.com/TrueBitFoundation/scrypt-interactive/blob/master/docs/setup.md) to setup the client.
11836

119-
Configure your client by updating the `.env` file:
37+
Use the CLI tool to interact with the client:
12038

12139
```bash
122-
export WEB3_HTTP_PROVIDER=http://localhost:8545
123-
export WEB3_PARITY_PROVIDER=http://localhost:4242
124-
export DOGE_RELAY_ADDRESS=0x0
125-
export SCRYPT_VERIFIER_ADDRESS=0x0
126-
export SCRYPT_RUNNER_ADDRESS=0x0
127-
export CLAIM_MANAGER_ADDRESS=0x0
128-
```
129-
130-
## The CLI
40+
# check the status
41+
npm start status
13142

132-
```bash
133-
bridge --help
43+
# manage your deposits
44+
npm start deposit <amout_in_ether>
45+
npm start withdraw <amout_in_ether>
13446

135-
# run the cli as a challenger
136-
# The `challenge` and `deposit` flags configure how the bridge behaves.
137-
# note: as a challenger, your account must have the required amount of Ether to stake per claim you want to challenge;
47+
# monitor the system as a Verifier.
48+
# note: you must have the required amount of eth deposited to stake per claim you want to challenge;
13849
# otherwise, it won't be able to do anything but watch.
139-
bridge monitor [-c, --auto-challenge]
50+
npm start monitor --auto-challenge
14051

141-
# run the cli as a claimant
142-
# note: your job is to submit doge block headers and defend them against challenges.
143-
# if you never submit an invalid doge header (who would do that??), you'll never have to play the verification game.
144-
# note: you must have enough Ether deposited within the ClaimManager in order to submit blocks.
145-
# @TODO
146-
bridge claim <block_header> <block_header_hash>
147-
148-
# manage your deposits
149-
# @TODO
150-
bridge deposit <amout_in_ether>
151-
bridge withdraw <amout_in_ether>
52+
# submit a claim as a Claimant.
53+
# note: you must defend your claim (scrypt hash and plaintext payload) against challenges.
54+
# note: you must have the required amount of eth deposited to stake.
55+
npm start claim <input> <hash> <proposalID>
15256

153-
# show the status of the bridge
154-
# @TODO
155-
bridge status
15657
```
15758

158-
## Deploying the Contracts
59+
## Running the tests
15960

160-
To deploy the contracts to your favorite dev chain,
161-
```bash
162-
npm run migrate:dev
163-
# or
164-
truffle migrate --network :your-chain-here
61+
First, install the needed dependencies as described in the [setup docs](https://github.com/TrueBitFoundation/scrypt-interactive/blob/master/docs/setup.md).
16562

166-
# use `npm run migrate:dev -- --reset` for force-migrate
167-
```
63+
Running the tests involves
64+
1. Running ganache `npm run ganache`
65+
2. Running parity `npm run parity`
66+
3. Running the tests `npm run test`
16867

169-
To deploy the contracts to your favorite infura chain, do something like
68+
We also have a convenient `test.sh` script that does all that for you.
17069
```bash
171-
MNEMONIC="your mnemonic here do not put this in a file keep it in the interpreter" \
172-
npm run migrate:rinkeby
173-
# or
174-
MNEMONIC="your mnemonic here do not put this in a file keep it in the interpreter" \
175-
INFURA_CHAIN=ropsten \
176-
truffle migrate --network infura
70+
./bin/test.sh
17771
```
17872

179-
And note the addresses for configuring your env when actually running the code.
73+
## Deploying the contracts
18074

181-
## Geth Docker Image Testing
75+
To deploy the contracts to your favorite chain:
18276

183-
Want to test against a more reasonable test chain?
184-
185-
```
186-
git clone [email protected]:livepeer/docker-livepeer.git
187-
cd docker-livepeer/geth-dev
188-
189-
# replace the latest tag with v1.7.3
190-
s/latest/v1.7.3/g Dockerfile
77+
```bash
78+
# first:
79+
# update the .env file.
19180

192-
docker build . -t geth-dev
81+
# then
82+
npm run migrate:rinkeby # or target another chain.
19383

194-
docker run \
195-
--name geth-dev --rm -d \
196-
-p 8545:8545 \
197-
geth-dev
84+
# then
85+
# update the resulting contract addresses in .env
19886

199-
docker logs -f :container-id
20087
```
20188

202-
## Doge-Ethereum Bounty Split Contract
203-
204-
We're splitting the bounty with additional developers via smart contract.
205-
206-
The bounty contract is deployed at: `0x1ed3e252dcb6d540947d2d63a911f56733d55681`
207-

bin/server_setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ wget https://parity-downloads-mirror.parity.io/v1.8.8/x86_64-unknown-linux-gnu/p
101101
sudo apt install ./parity_1.8.8_amd64.deb
102102

103103
# follow the README:
104-
parity --chain dev # kill this after ~ 5 seconds, when the dev db is setup.
104+
# kill this after ~ 5 seconds, when the dev db is setup.
105+
parity --chain dev
105106

106107
#----------------------------------
107108

docs/misc.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Here are some odds and ends:
3+
4+
## Geth Docker Image Testing
5+
6+
Want to test against a more reasonable test chain?
7+
8+
```
9+
git clone [email protected]:livepeer/docker-livepeer.git
10+
cd docker-livepeer/geth-dev
11+
12+
# replace the latest tag with v1.7.3
13+
s/latest/v1.7.3/g Dockerfile
14+
15+
docker build . -t geth-dev
16+
17+
docker run \
18+
--name geth-dev --rm -d \
19+
-p 8545:8545 \
20+
geth-dev
21+
22+
docker logs -f :container-id
23+
```
24+
25+
## Doge-Ethereum Bounty Split Contract
26+
27+
We're splitting the bounty with additional developers via smart contract.
28+
29+
The bounty contract is deployed at: `0x1ed3e252dcb6d540947d2d63a911f56733d55681`
30+

docs/setup.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
## Setting up the client
3+
4+
The specific commands used to setup our Ubuntu 16.04 server can be found [here](https://github.com/TrueBitFoundation/scrypt-interactive/blob/master/bin/server_setup.sh).
5+
6+
More general directions follow:
7+
8+
```bash
9+
# Install the latest stable release of the Parity Ethereum client.
10+
# You can look for the binary [here](https://github.com/paritytech/parity/releases).
11+
12+
# make sure it's executable
13+
chmod 755 ./parity
14+
15+
# Initialize the parity development chain database with
16+
# kill this after the dev db is setup (a few seconds).
17+
parity --chain dev
18+
19+
# run parity
20+
npm run parity
21+
22+
# Ensure you have the latest version of node installed (currently v9.4.0).
23+
24+
# Then install npm packages deps:
25+
npm install
26+
npm install -g sequelize-cli
27+
npm install -g truffle
28+
29+
# Install postgres and run it on the default port `5432`:
30+
sudo apt-get update
31+
sudo apt-get install postgresql postgresql-contrib
32+
33+
# give you user the ability to execute commands as postgres user
34+
# by giving it the right permissions in pg_hba.conf
35+
36+
# Bootstrap your database with:
37+
sequelize db:create
38+
sequelize db:migrate
39+
NODE_ENV=test sequelize db:create
40+
NODE_ENV=test sequelize db:migrate
41+
42+
# Configure your client by updating the `.env` file, as follows:
43+
#
44+
# export WEB3_HTTP_PROVIDER=http://localhost:8545
45+
# export WEB3_PARITY_PROVIDER=http://localhost:4242
46+
# export DOGE_RELAY_ADDRESS=0x0
47+
# export SCRYPT_VERIFIER_ADDRESS=0x0
48+
# export SCRYPT_RUNNER_ADDRESS=0x0
49+
# export CLAIM_MANAGER_ADDRESS=0x0
50+
```
51+

0 commit comments

Comments
 (0)