Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Testnet v2 #50

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# Fuse Network

- [General](#general)
- [Clone Repository](#clone-repository)
- [Install Dependencies](#install-dependencies)
- [Run Unit Tests](#run-unit-tests)
- [Contracts](#contracts)
- [Documentation](https://github.com/fuseio/fuse-network/blob/master/CONTRACTS.md)
- [Compile](#compile)
- [Flatten](#flatten)
- [Deploy](#deploy)
- [Run Local Node](#run-local-node)
- [Pre-Requisites](#pre-requisites)
- [Hardware](#hardware)
- [Quickstart](#using-quickstart)
- [Using Docker](#using-docker)
- [Usage](#usage)
- [Examples](#examples)
- [Bootnode](#bootnode)
- [Node](#node)
- [Validator](#validator)
- [Create New Account](#create-new-account)
- [Explorer node](#explorer-node)
- [Validators App](https://github.com/fuseio/fuse-network/tree/master/app/README.md)
- [Fuse Network](#fuse-network)
- [General](#general)
- [Clone Repository](#clone-repository)
- [Install Dependencies](#install-dependencies)
- [Run Unit Tests](#run-unit-tests)
- [Contracts](#contracts)
- [Compile](#compile)
- [ABIs](#abis)
- [Flatten](#flatten)
- [Deploy](#deploy)
- [Run Local Node](#run-local-node)
- [Pre-Requisites](#pre-requisites)
- [Hardware](#hardware)
- [Bootnode, Node or Explorer Node](#bootnode-node-or-explorer-node)
- [Validator](#validator)
- [Using Quickstart](#using-quickstart)
- [Using Docker](#using-docker)
- [Usage](#usage)
- [Examples](#examples)
- [Bootnode](#bootnode)
- [Node](#node)
- [Validator](#validator-1)
- [Create New Account](#create-new-account)
- [Explorer node](#explorer-node)

## General
### Clone Repository
Expand Down Expand Up @@ -132,9 +134,9 @@ The script will make sure you have everything that is necessary, create a new ac
The script can be called multiple times without problems, so it checks what is already there and will at least update all service processes.

```sh
$ wget -O quickstart.sh https://raw.githubusercontent.com/fuseio/fuse-network/master/scripts/quickstart.sh
$ wget -O quickstart.sh https://raw.githubusercontent.com/fuseio/fuse-network/testnet-v2/scripts/quickstart.sh
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testnet-v2 -> tesnet-spark

$ chmod 777 quickstart.sh
$ wget -O .env https://raw.githubusercontent.com/fuseio/fuse-network/master/scripts/examples/.env.<ROLE>.example
$ wget -O .env https://raw.githubusercontent.com/fuseio/fuse-network/testnet-v2/scripts/examples/.env.<ROLE>.example
$ ./quickstart.sh
```

Expand Down
6 changes: 3 additions & 3 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM node:10

ENV POLLING_INTERVAL=5000
ENV LOG_LEVEL=debug
ENV RPC=https://rpc.fuse.io
ENV CONSENSUS_ADDRESS=0x3014ca10b91cb3D0AD85fEf7A3Cb95BCAc9c0f79
ENV BLOCK_REWARD_ADDRESS=0x63D4efeD2e3dA070247bea3073BCaB896dFF6C9B
ENV RPC=https://testrpc.fuse.io
ENV CONSENSUS_ADDRESS=0xF5C4782d61611e12CD9651355841716ea1801d5c
ENV BLOCK_REWARD_ADDRESS=0x3b8C048DdEC04709125aF939360BDD619Ec6e9E3

COPY ./ ./
RUN npm install --only=prod
Expand Down
5 changes: 2 additions & 3 deletions config/bootnodes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
enode://557d1daafb34627822b7934e864beded775534e28818365b03f2dd75490ab7deb2e3166bbf821e878046f5209cbaab46e5ce99d9f8313e8cf319a0a1b2b257ec@18.184.21.11:30303
enode://19fb95a31a00479209511e61fb7f46316069a6a282a57155071c4bd6774c03be211d3d2c5a761756563cbeae2ef023d8800c53d9a6e65b97a0665bbb3461b89c@18.184.223.179:30303
enode://7bc2e851cad345437984d6550b1b98d7029b694f2793e2c592637a793b243760060a5a3e00d6212b75f1c534a97b41d532221071242d01116e9ff3c8dcc95672@95.217.1.4:30303
enode://abeec9512cffcb9e6097991ed76b87df95cf21ff95c9e5e732fbecafd6dd7c03c2d65fc3a819dce28d6743d009151a3d85d7e8833e24b23d255fbae2bf3bdb57@18.156.82.209:30303
enode://35ace80df7579130470aadceaae789f6397d4b1c3eebd60071a59a1172afaae1c644e51590b4174d963aac0f9925354161988558b17d3e14d06c5b6bf8ad4390@18.197.97.224:30303
4 changes: 4 additions & 0 deletions config/reserved_peers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enode://124f58ce10979932f559550f109fdc0360eab224a379297cc3d7ed5689b0a65163704c451138fe847fd06208b1056c75ef9f07ebf24fdb2138cc89031d5a4a50@172.17.0.2:30300
enode://abeec9512cffcb9e6097991ed76b87df95cf21ff95c9e5e732fbecafd6dd7c03c2d65fc3a819dce28d6743d009151a3d85d7e8833e24b23d255fbae2bf3bdb57@18.156.82.209:30303
enode://35ace80df7579130470aadceaae789f6397d4b1c3eebd60071a59a1172afaae1c644e51590b4174d963aac0f9925354161988558b17d3e14d06c5b6bf8ad4390@18.197.97.224:30303
enode://f4513ebef64b1314bf43ceadb6bbe3d99c895cc8f560ccc1136118a8c705d49102dd9f73349585c437ae019cb357ded7103b71d96a7609c4e47bf5a774ec9f9e@172.17.0.2:30300
124 changes: 78 additions & 46 deletions config/spec.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"name": "FuseNetwork",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "5",
"blockReward": "0x0",
"blockRewardContractAddress": "0x63D4efeD2e3dA070247bea3073BCaB896dFF6C9B",
"blockRewardContractTransition": 100,
"validators": {
"multi": {
"0": {
"list": ["0xd9176e84898a0054680aec3f7c056b200c3d96c3"]
},
"name": "FuseNetwork",
"engine": {
"authorityRound": {
"params": {
"stepDuration": "5",
"blockReward": "0x0",
"blockRewardContractAddress": "0x3b8C048DdEC04709125aF939360BDD619Ec6e9E3",
"blockRewardContractTransition": 100,
"validators": {
"multi": {
"0": {
"list": [ "0xbb79a903f699f2e54c970ac7ab30403a56f67804" ]
},
"100": {
"safeContract": "0x3014ca10b91cb3D0AD85fEf7A3Cb95BCAc9c0f79"
"safeContract": "0xF5C4782d61611e12CD9651355841716ea1801d5c"
}
}
}
}
}
},
"params": {
}
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x400",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x07a",
"networkID" : "0x07b",
"eip155Transition": 0,
"validateChainIdTransition": 0,
"eip140Transition": 0,
Expand All @@ -36,31 +36,63 @@
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip145Transition": "0x38ada7",
"eip1014Transition": "0x38ada7",
"eip1052Transition": "0x38ada7",
"eip145Transition": "0x6bf64",
"eip1014Transition": "0x6bf64",
"eip1052Transition": "0x6bf64",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0"
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x989680"
},
"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": { "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
"0x0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": 0, "pricing": { "linear": { "base": 500, "word": 0 } } } },
"0x0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": 0, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
"0x0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": 0, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
"0xd9176e84898a0054680aec3f7c056b200c3d96c3": { "balance": "300000000000000000000000000" }
}
},
"genesis": {
"seal": {
"authorityRound": {
"step": "0x0",
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x5F5E100"
},
"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": {
"builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } }
},
"0x0000000000000000000000000000000000000006": {
"builtin": {
"name": "alt_bn128_add",
"activate_at": 0,
"pricing": { "linear": { "base": 500, "word": 0 } }
}
},
"0x0000000000000000000000000000000000000007": {
"builtin": {
"name": "alt_bn128_mul",
"activate_at": 0,
"pricing": { "linear": { "base": 40000, "word": 0 } }
}
},
"0x0000000000000000000000000000000000000008": {
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": 0,
"pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } }
}
},
"0xbb79a903f699f2e54c970ac7ab30403a56f67804": { "balance": "300000000000000000000000000" }
}
}
2 changes: 1 addition & 1 deletion contracts/ConsensusUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract ConsensusUtils is EternalStorage, ValidatorSet {
uint256 public constant DECIMALS = 10 ** 18;
uint256 public constant MAX_VALIDATORS = 100;
uint256 public constant MIN_STAKE = 1e23; // 100,000
uint256 public constant CYCLE_DURATION_BLOCKS = 120960; // 7 days [7*24*60*60/5]
uint256 public constant CYCLE_DURATION_BLOCKS = 720; // 1 hour [60*60/5]
uint256 public constant SNAPSHOTS_PER_CYCLE = 10; // snapshot each 1008 minutes [120960/10/60*5]
uint256 public constant DEFAULT_VALIDATOR_FEE = 1e17; // 10%

Expand Down
8 changes: 8 additions & 0 deletions migrations/2_deploy_contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ module.exports = function(deployer, network, accounts) {
let voting, votingImpl

deployer.then(async function() {
/*
// In case the consensus implementation fails to deploy with truffle,
// use other tool like remix and put the address here in the following way:
consensusImpl = {
address: '0x789b5f79EAd29C4dc39b22C12602D59f6c613e4C'
}
*/

// Consensus
consensusImpl = await Consensus.new()
debug(`consensusImpl: ${consensusImpl.address}`)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"flatten": "scripts/flatten.sh",
"abi": "scripts/abi.sh",
"deploy:fuse": "node_modules/.bin/truffle migrate --reset --network fuse",
"deploy:testnet": "node_modules/.bin/truffle migrate --reset --network testnet",
"deploy:local": "node_modules/.bin/truffle migrate --reset --network local",
"app": "node app/index.js"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples/.env.bootnode.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# general
ROLE=bootnode
NODE_KEY=<your_node_key>
BOOTNODES=enode://557d1daafb34627822b7934e864beded775534e28818365b03f2dd75490ab7deb2e3166bbf821e878046f5209cbaab46e5ce99d9f8313e8cf319a0a1b2b257ec@18.184.21.11:30303,enode://19fb95a31a00479209511e61fb7f46316069a6a282a57155071c4bd6774c03be211d3d2c5a761756563cbeae2ef023d8800c53d9a6e65b97a0665bbb3461b89c@18.184.223.179:30303,enode://7bc2e851cad345437984d6550b1b98d7029b694f2793e2c592637a793b243760060a5a3e00d6212b75f1c534a97b41d532221071242d01116e9ff3c8dcc95672@95.217.1.4:30303
BOOTNODES=enode://abeec9512cffcb9e6097991ed76b87df95cf21ff95c9e5e732fbecafd6dd7c03c2d65fc3a819dce28d6743d009151a3d85d7e8833e24b23d255fbae2bf3bdb57@172.17.0.2:30300

# in case `sudo` is needed
PERMISSION_PREFIX=""
2 changes: 1 addition & 1 deletion scripts/parity_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ cors = ["all"]
port = 8545
interface = "all"
hosts = ["all"]
apis = ["web3", "eth", "net", "parity", "traces", "rpc", "secretstore"]
apis = ["web3", "eth", "net", "parity", "parity_set", "traces", "rpc", "secretstore"]

[websockets]
disable = true
Expand Down
18 changes: 9 additions & 9 deletions scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ set -e
OLDIFS=$IFS

ENV_FILE=".env"
DOCKER_IMAGE_PARITY="fusenet/node"
DOCKER_IMAGE_PARITY="fusenet/testnet-node"
DOCKER_CONTAINER_PARITY="fusenet"
DOCKER_IMAGE_APP="fusenet/validator-app"
DOCKER_IMAGE_APP="fusenet/testnet-validator-app"
DOCKER_CONTAINER_APP="fuseapp"
DOCKER_IMAGE_NETSTAT="fusenet/netstat"
DOCKER_IMAGE_NETSTAT="fusenet/testnet-netstat"
DOCKER_CONTAINER_NETSTAT="fusenetstat"
DOCKER_COMPOSE_ORACLE="https://raw.githubusercontent.com/fuseio/fuse-bridge/master/native-to-erc20/oracle/docker-compose.keystore.yml"
DOCKER_IMAGE_ORACLE_VERSION="2.0.5"
Expand Down Expand Up @@ -266,7 +266,7 @@ function setup {
if [[ $ROLE == validator ]] ; then
echo -e "\nPull additional docker images..."
$PERMISSION_PREFIX docker pull $DOCKER_IMAGE_APP
$PERMISSION_PREFIX docker pull $DOCKER_IMAGE_ORACLE
# $PERMISSION_PREFIX docker pull $DOCKER_IMAGE_ORACLE

echo -e "\nDownload oracle docker-compose.yml"
wget -O docker-compose.yml $DOCKER_COMPOSE_ORACLE
Expand Down Expand Up @@ -469,12 +469,12 @@ function run {
--restart=always \
--memory="250m" \
$DOCKER_IMAGE_APP

## Start oracle container with all necessary arguments.
$PERMISSION_PREFIX docker-compose up \
--build \
-d
;;
## Start oracle container with all necessary arguments.
# $PERMISSION_PREFIX docker-compose up \
# --build \
# -d
# ;;

"explorer")
INSTANCE_NAME=$NODE_KEY
Expand Down
6 changes: 3 additions & 3 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ function docker-compose {
function config {
echo -e "\nDowloading config files and scripts..."

wget -O quickstart.sh "https://raw.githubusercontent.com/fuseio/fuse-network/master/scripts/quickstart.sh"
wget -O quickstart.sh "https://raw.githubusercontent.com/fuseio/fuse-network/testnet-v2/scripts/quickstart.sh"

chmod +x quickstart.sh

wget -O .env "https://raw.githubusercontent.com/fuseio/fuse-network/master/scripts/examples/.env.validator.example"
wget -O .env "https://raw.githubusercontent.com/fuseio/fuse-network/testnet-v2/scripts/examples/.env.validator.example"

wget -O clean-docker.sh "https://raw.githubusercontent.com/fuseio/fuse-network/master/scripts/clean-docker.sh"
wget -O clean-docker.sh "https://raw.githubusercontent.com/fuseio/fuse-network/testnet-v2/scripts/clean-docker.sh"

chmod +x clean-docker.sh
}
Expand Down
6 changes: 6 additions & 0 deletions truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ module.exports = {
// gas: 10000000,
gasPrice: 1000000000 // 1 gwei
},
testnet: {
provider: walletProvider,
network_id: 123,
// gas: 10000000,
gasPrice: 1000000000 // 1 gwei
},
local: {
provider: walletProvider,
network_id: 999,
Expand Down