The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
nico 631d384609 woop 8 months ago
.github woop 8 months ago
.wiki woop 8 months ago
accounts woop 8 months ago
api woop 8 months ago
block woop 8 months ago
cmd woop 8 months ago
common Release Candidate hotfix: dev -> main (#4333) 2 years ago
consensus woop 8 months ago
contracts Release Candidate 2023.2.0 ( dev -> main ) (#4399) 2 years ago
core woop 8 months ago
core_test woop 8 months ago
crypto woop 8 months ago
eth/rpc woop 8 months ago
internal woop 8 months ago
multibls woop 8 months ago
node woop 8 months ago
numeric Release Candidate 2023.2.0 ( dev -> main ) (#4399) 2 years ago
p2p woop 8 months ago
rosetta woop 8 months ago
rpc woop 8 months ago
scripts woop 8 months ago
shard woop 8 months ago
staking woop 8 months ago
test woop 8 months ago
tools woop 8 months ago
webhooks update deprecated ioutil, improve local accounts (#4527) 1 year ago
wiki woop 8 months ago
.bnkey [bootnode] add a default bootnode key locally 6 years ago
.dockerignore Release Candidate hotfix: dev -> main (#4333) 2 years ago
.gitignore woop 8 months ago
.ignore [misc] add .ignore file to shorten search time 3 years ago
.mergify.yml [build] add mergify rules (#4486) 1 year ago
.rpmmacros woop 8 months ago
.travis.yml woop 8 months ago
BLACKLIST.md woop 8 months ago
CODE_OF_CONDUCT.md woop 8 months ago
CONTRIBUTING.md woop 8 months ago
Dockerfile woop 8 months ago
FLA.md woop 8 months ago
LICENSE update License to LGPL-3.0 4 years ago
Makefile woop 8 months ago
PULL_REQUEST_TEMPLATE.md Update PULL_REQUEST_TEMPLATE.md 5 years ago
README.md woop 8 months ago
SECURITY.md woop 8 months ago
go.mod woop 8 months ago
go.sum woop 8 months ago

README.md

WoopChain

General Documentation

https://docs.wikiwoop.com/

Requirements

Go 1.19

GMP and OpenSSL

On macOS:

brew install gmp
brew install openssl
sudo ln -sf /usr/local/opt/openssl@1.1 /usr/local/opt/openssl

On Linux (Ubuntu)

sudo apt install libgmp-dev  libssl-dev  make gcc g++

On Linux (Cent OS / Amazon Linux 2)

sudo yum install glibc-static gmp-devel gmp-static openssl-libs openssl-static gcc-c++

Docker (for testing)

On macOS:

brew install --cask docker
open /Applications/Docker.app

On Linux, reference official documentation here.

Bash 4+

For macOS, you can reference this guide. For Linux, you can reference this guide.

Dev Environment

Most repos from woop-chain assumes the GOPATH convention. More information here.

First Install

Clone and set up all of the repos with the following set of commands:

  1. Create the appropriate directories:
mkdir -p $(go env GOPATH)/src/github.com/woop-chain
cd $(go env GOPATH)/src/github.com/woop-chain

If you get 'unknown command' or something along those lines, make sure to install golang first.

  1. Clone this repo & dependent repos.
git clone https://github.com/woop-chain/mcl.git
git clone https://github.com/woop-chain/bls.git
git clone https://github.com/woop-chain/woop.git
cd woop
  1. Build the woop binary & dependent libs
go mod tidy
make

Run bash scripts/install_build_tools.sh to ensure build tools are of correct versions. If you get 'missing go.sum entry for module providing package <package_name>', run go mod tidy.

Dev Docker Image

Included in this repo is a Dockerfile that has a full woop development environment and comes with emacs, vim, ag, tig and other creature comforts. Most importantly, it already has the go environment with our C/C++ based library dependencies (libbls and mcl) set up correctly for you.

You can build the docker image for yourself with the following commands:

cd $(go env GOPATH)/src/github.com/woop-chain/woop
make clean
docker build -t woop .

If your build machine has an ARM-based chip, like Apple silicon (M1), the image is built for linux/arm64 by default. To build for x86_64, apply the --platform arg like so:

docker build --platform linux/amd64 -t woop .

Learn more about the --platform arg and multi-CPU architecture support, here and here.

Then you can start your docker container with the following command:

docker run --rm --name woop -it -v "$(go env GOPATH)/src/github.com/woop-chain/woop:/root/go/src/github.com/woop-chain/woop" woop /bin/bash

Note that the woop repo will be shared between your docker container and your host machine. However, everything else in the docker container will be ephemeral.

If you need to open another shell, just do:

docker exec -it woop /bin/bash

Learn more about docker here.

Build

The make command should automatically build the Woop binary & all dependent libs.

However, if you wish to bypass the Makefile, first export the build flags:

export CGO_CFLAGS="-I$GOPATH/src/github.com/woop-chain/bls/include -I$GOPATH/src/github.com/woop-chain/mcl/include -I/opt/homebrew/opt/openssl@1.1/include"
export CGO_LDFLAGS="-L$GOPATH/src/github.com/woop-chain/bls/lib -L/opt/homebrew/opt/openssl@1.1/lib"
export LD_LIBRARY_PATH=$GOPATH/src/github.com/woop-chain/bls/lib:$GOPATH/src/github.com/woop-chain/mcl/lib:/opt/homebrew/opt/openssl@1.1/lib
export LIBRARY_PATH=$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
export GO111MODULE=on

Then you can build all executables with the following command:

bash ./scripts/go_executable_build.sh -S

Reference bash ./scripts/go_executable_build.sh -h for more build options

Debugging

One can start a local network (a.k.a localnet) with your current code using the following command:

make debug

This localnet has 2 shards, with 11 nodes on shard 0 (+1 explorer node) and 10 nodes on shard 0 (+1 explorer node).

The shard 0 endpoint will be on the explorer at http://localhost:9599. The shard 1 endpoint will be on the explorer at http://localhost:9598.

You can view the localnet configuration at /test/configs/local-resharding.txt. The fields for the config are (space-delimited & in order) ip, port, mode, bls_pub_key, and shard (optional).

One can force kill the local network with the following command:

make debug-kill

You can view all make commands with make help

Testing

To keep things consistent, we have a docker image to run all tests. These are the same tests ran on the pull request checks.

Note that all test Docker containers bind several ports to the host machine for your convenience. The ports are:

  • 9500 - Shard 0 RPC for a validator
  • 9501 - Shard 1 RPC for a validator
  • 9599 - Shard 0 RPC for an explorer
  • 9598 - Shard 1 RPC for an explorer
  • 9799 - Shard 0 Rosetta (for an explorer)
  • 9798 - Shard 1 Rosetta (for an explorer)
  • 9899 - Shard 0 WS for an explorer
  • 9898 - Shard 1 WS for an explorer

This allows you to use curl, wiki CLI, postman, rosetta-cli, etc... on your host machine to play with or probe the localnet that was used for the test.

Go tests

To run this test, do:

make test-go

This test runs the go tests along with go lint, go fmt, go imports, go mod, and go generate checks.

RPC tests

To run this test, do:

make test-rpc

This test starts a localnet (within the Docker container), ensures it reaches a consensus, and runs a series of tests to ensure correct RPC behavior. This test also acts as a preliminary integration test (more thorough tests are done on the testnets).

The tests ran by this command can be found here.

If you wish to debug further with the localnet after the tests are done, open a new shell and run:

make test-rpc-attach

This will open a shell in the docker container that is running the Node API tests.

Note that the docker container has the Woop CLI on path, therefore you can use that to debug if needed. For example, one could do wiki blockchain latest-headers to check the current block height of localnet. Reference the documentation for the CLI here for more details & commands.

Rosetta tests

To run this test, do:

make test-rosetta

This test starts a localnet (within the Docker container), ensures it reaches a consensus, and runs the Construction & Data API checks using the rosetta-cli. This test also acts as a preliminary integration test (more thorough tests are done on the testnets).

The config for this test can be found here & here

Similar to the RPC tests, if you wish to debug further with the localnet after the tests are done, open a new shell and run:

make test-rosetta-attach

License

Woop is licensed under GNU Lesser General Public License v3.0. See LICENSE file for the terms and conditions.

Woop includes third-party open-source code. In general, a source subtree with a LICENSE or COPYRIGHT file is from a third party, and our modifications thereto are licensed under the same third-party open source license.

Also please see our Fiduciary License Agreement if you are contributing to the project. By your submission of your contribution to us, you and we mutually agree to the terms and conditions of the agreement.

Contributing To Woop

See CONTRIBUTING for details.

Development Status

Finished Features

  • Fully sharded network with beacon chain and shard chains
  • Sharded P2P network and P2P gossiping
  • FBFT (Fast Byzantine Fault Tolerance) Consensus with BLS multi-signature
  • Consensus view-change protocol
  • Account model and support for Solidity
  • Cross-shard transaction
  • VRF (Verifiable Random Function) and VDF (Verifiable Delay Function)
  • Cross-links
  • EPoS staking mechanism
  • Kademlia routing