Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ecroxchain committed Sep 15, 2023
0 parents commit ea16575
Show file tree
Hide file tree
Showing 134 changed files with 190,347 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RPC=http://127.0.0.1:8545

WALLET_PROVIDER_METHOD=keystore
CREDENTIALS_KEYSTORE=~/Dev/io.parity.ethereum/config/keys/FuseNetwork/UTC--2019-04-30T11-43-32Z--a72d124a-5c05-c97c-e345-65c030649352
CREDENTIALS_PASSWORD=~/Dev/io.parity.ethereum/config/pass.pwd

#WALLET_PROVIDER_METHOD=mnemonic
#MNEMONIC=sniff hour weekend august credit alley crumble process rubber select child eternal

### Deployment ###
INITIAL_SUPPLY_GWEI=300000000000000000
SAVE_TO_FILE=false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
71 changes: 71 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# General
.DS_Store
build
flats
fusenet*
contracts.json
runlocal.txt

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.local
.env.fusenet

# next.js build output
.next
42 changes: 42 additions & 0 deletions CONTRACTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Ecrox Network Contracts

- [Consensus](#consensus)
- [Block Reward](#block-reward)
- [Voting](#voting)
- [Proxy Storage](#proxy-storage)

![Contracts Schema](https://storage.googleapis.com/sol2uml-storage/mainnet-0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d.svg "Contracts Schema")

### Consensus

This contract is responsible for handling the network DPos consensus.

This contract is storing the current validator set and choosing a new validator set at the end of each cycle.

The logic for updating the validator set is to select a random snapshot from the snapshots taken during the cycle.

The snapshots taken, are of pending validators, who are those which staked more than the minimum stake needed to become a network validator. Therefore the contract is also responsible for staking, delegating and withdrawing those funds.

This contract is based on `non-reporting ValidatorSet` [described in Parity Wiki](https://wiki.parity.io/Validator-Set.html#non-reporting-contract).

### Block Reward

This contract is responsible for generating and distributing block rewards to the network validators according to the network specs (5% yearly inflation).

Another role of this contract is to call the snapshot/cycle logic on the Consensus contract.

This contract is based on `BlockReward` [described in Parity Wiki](https://wiki.parity.io/Block-Reward-Contract).

### Voting

This contract is responsible for opening new ballots and voting to accept/reject them.

Ballots are basically offers to change other network contracts implementation.

Only network validators can open new ballots, eveyone can vote on them, but only validators votes count when the ballot is closed.

Ballots are opened/closed on cycle end.

### Proxy Storage

This contract is responsible for holding network contracts implementation addresses and upgrading them if necessary (via ballot approval).
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM alpine:edge AS builder

ENV HOME=/home/parity
ENV PARITY_HOME_DIR=$HOME/.local/share/io.parity.ethereum
ENV PARITY_CONFIG_FILE_CHAIN=$PARITY_HOME_DIR/spec.json
ENV PARITY_CONFIG_FILE_BOOTNODES=$PARITY_HOME_DIR/bootnodes.txt
ENV PARITY_CONFIG_FILE_TEMPLATE=$PARITY_HOME_DIR/config_template.toml
ENV PARITY_DATA_DIR=$PARITY_HOME_DIR/chains
ENV PARITY_BIN=/usr/local/bin/parity
ENV PARITY_WRAPPER_SCRIPT=$HOME/parity_wrapper.sh

RUN mkdir -p $PARITY_HOME_DIR && ls -la $PARITY_HOME_DIR

# add depends
RUN apk add --no-cache \
libstdc++ \
eudev-libs \
libgcc \
curl \
jq \
bash

COPY --from=openethereum/openethereum:v3.3.5 /home/openethereum/openethereum $PARITY_BIN

### Network RPC WebSocket
EXPOSE 30300 8545 8546

### Default chain and node configuration files.
COPY config/spec.json $PARITY_CONFIG_FILE_CHAIN
COPY config/bootnodes.txt $PARITY_CONFIG_FILE_BOOTNODES
COPY config/config.toml $PARITY_CONFIG_FILE_TEMPLATE

### Wrapper script for Parity.
COPY scripts/parity_wrapper.sh $PARITY_WRAPPER_SCRIPT
RUN chmod +x $PARITY_WRAPPER_SCRIPT

### Shorthand links
RUN ln -s $PARITY_HOME_DIR /config && ln -s $PARITY_DATA_DIR /data

# Start
ENTRYPOINT ["/home/parity/parity_wrapper.sh"]
41 changes: 41 additions & 0 deletions Dockerfile.spark
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM alpine:edge AS builder

ENV HOME=/home/parity
ENV PARITY_HOME_DIR=$HOME/.local/share/io.parity.ethereum
ENV PARITY_CONFIG_FILE_CHAIN=$PARITY_HOME_DIR/spec.json
ENV PARITY_CONFIG_FILE_BOOTNODES=$PARITY_HOME_DIR/bootnodes.txt
ENV PARITY_CONFIG_FILE_TEMPLATE=$PARITY_HOME_DIR/config_template.toml
ENV PARITY_DATA_DIR=$PARITY_HOME_DIR/chains
ENV PARITY_BIN=/usr/local/bin/parity
ENV PARITY_WRAPPER_SCRIPT=$HOME/parity_wrapper.sh

RUN mkdir -p $PARITY_HOME_DIR && ls -la $PARITY_HOME_DIR

# add depends
RUN apk add --no-cache \
libstdc++ \
eudev-libs \
libgcc \
curl \
jq \
bash

COPY --from=openethereum/openethereum:v3.3.5 /home/openethereum/openethereum $PARITY_BIN

### Network RPC WebSocket
EXPOSE 30300 8545 8546

### Default chain and node configuration files.
COPY config/spark/spec.json $PARITY_CONFIG_FILE_CHAIN
COPY config/spark/bootnodes.txt $PARITY_CONFIG_FILE_BOOTNODES
COPY config/spark/config.toml $PARITY_CONFIG_FILE_TEMPLATE

### Wrapper script for Parity.
COPY scripts/parity_wrapper_spark.sh $PARITY_WRAPPER_SCRIPT
RUN chmod +x $PARITY_WRAPPER_SCRIPT

### Shorthand links
RUN ln -s $PARITY_HOME_DIR /config && ln -s $PARITY_DATA_DIR /data

# Start
ENTRYPOINT ["/home/parity/parity_wrapper.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Ecrox Network

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Network

- [Network](#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)
- [OE](#oe)
- [Nethermind](#nethermind)
- [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)
- [Building containers](#building-containers)

## General
### Clone Repository
```
$ git clone https://github.com/ecroxchain/network.git ~/Dev/network
```

### Install Dependencies
```
$ npm install
```

### Run Unit Tests
```
$ npm test
```

## Contracts
### Compile
```
$ npm run compile
```

### ABIs
```
$ npm run abi
```

### Flatten
```
$ npm run flatten
```

### Deploy
Make sure `NETWORK_NAME` is defined in [`truffle-config`](https://github.com/ecroxchain/network/blob/master/truffle-config.js)

Make sure you've created an `.env` using the template [`env.example`](https://github.com/ecroxchain/network/blob/master/.env.example)

Run:

```
$ ./node_modules/.bin/truffle migrate --reset --network <NETWORK_NAME>
```

## Run Local Node

Read more at: [https://github.com/ecroxchain/CoinNetwork/tree/master/node-example](https://github.com/ecroxchain/CoinNetwork/tree/master/node-example)
5 changes: 5 additions & 0 deletions Version
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DOCKER_IMAGE_ORACLE_VERSION="3.0.0"
DOCKER_IMAGE_FUSE_APP_VERSION="2.0.0"
DOCKER_IMAGE_FUSE_PARITY_VERSION="2.0.2"
DOCKER_IMAGE_NET_STATS_VERSION="1.0.0"
DOCKER_IMAGE_NM_CLIENT="nethermind-1.13.3-v3.0.0"
4 changes: 4 additions & 0 deletions Version_legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DOCKER_IMAGE_ORACLE_VERSION="3.0.0"
DOCKER_IMAGE_FUSE_APP_VERSION="1.0.0"
DOCKER_IMAGE_FUSE_PARITY_VERSION="1.0.0"
DOCKER_IMAGE_NET_STATS_VERSION="1.0.0"
4 changes: 4 additions & 0 deletions Version_testNet
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DOCKER_IMAGE_FUSE_APP_VERSION="2.0.0"
DOCKER_IMAGE_FUSE_PARITY_VERSION="3.0.0"
DOCKER_IMAGE_NET_STATS_VERSION="1.0.0"
DOCKER_IMAGE_NM_CLIENT="nethermind-1.13.3-v3.0.0"
Loading

0 comments on commit ea16575

Please sign in to comment.