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.
 
 
 
Ganesha Upadhyaya a0f2af1f43
[rpc] fix transaction receipt fetch bug (#3327)
4 years ago
.github/ISSUE_TEMPLATE Update issue templates 5 years ago
.hmy [blacklist] Move default file to `.hmy` & support comments in file 5 years ago
accounts [accounts] Remove dead code (#2946) 5 years ago
api [sync] add timeout for grpc dial 4 years ago
block [RPC] Fixes for issues found during documentation (#3185) 4 years ago
cmd [cmd] set kms default enabled to false 4 years ago
common/denominations Move networkType into internal config 6 years ago
consensus Revert "Add multi-sig merged messaging logic (#3300)" (#3326) 4 years ago
contracts Remove unused code and add benchmark for consensus msg check (#3211) 4 years ago
core Increase crosslink catching rate, expect to have equillibrium at 5 block delay (#3333) 4 years ago
crypto Revert "Add multi-sig merged messaging logic (#3300)" (#3326) 4 years ago
hmy Rosetta Implementation - pt2 FIX (Stage 3.2 of Node API Overhaul) (#3321) 4 years ago
internal Add one-off fork for testnet adjusted reward (#3302) 4 years ago
multibls [node.sh] adapt to new multibls.PrivateKeys 4 years ago
node Increase crosslink catching rate, expect to have equillibrium at 5 block delay (#3333) 4 years ago
numeric Msg copy fix (#2921) 5 years ago
p2p [cmd] more refactoring 4 years ago
rosetta [core] Add localnet only testing account in genesis conf (#3332) 4 years ago
rpc [rpc] fix transaction receipt fetch bug (#3327) 4 years ago
scripts move codecov script to checker 4 years ago
shard Optimize bls Mask infra to avoid loops (#3243) 4 years ago
staking Revert "Add multi-sig merged messaging logic (#3300)" (#3326) 4 years ago
test Rosetta Implementation - pt2 (Stage 3.2 of Node API Overhaul) (#3312) 4 years ago
tools Add github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15.0 as a build tool 6 years ago
webhooks Merge master to t3 0523 (#3085) 5 years ago
.bnkey [bootnode] add a default bootnode key locally 6 years ago
.gitignore [cmd] fix gitignore 4 years ago
.rpmmacros [rpm] support rpm signing 4 years ago
.travis.yml move codecov script to checker 4 years ago
BLACKLIST.md [blacklist] Move default file to `.hmy` & support comments in file 5 years ago
CONTRIBUTING.md s/gofmt/goimports/ 6 years ago
Dockerfile Make given harmony build dynamically 4 years ago
FLA.md cla@ → licensing@ 6 years ago
LICENSE Add MIT License 6 years ago
Makefile [travis] Move `go get` to Makefile 4 years ago
PULL_REQUEST_TEMPLATE.md Update PULL_REQUEST_TEMPLATE.md 5 years ago
README.md [travis]integrate with codecov.io 4 years ago
go.mod Rosetta Implementation - pt2 FIX (Stage 3.2 of Node API Overhaul) (#3321) 4 years ago

README.md

Harmony

Build Status gopherbadger-tag-do-not-edit Discord Coverage Status Go Report Card codecov

General Documentation

https://docs.harmony.one

API Guide

http://api.hmny.io/

Requirements

Go 1.14.7

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 glibc-static gmp-devel gmp-static openssl-libs openssl-static gcc-c++

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 cask install 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 harmony-one 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/harmony-one
cd $(go env GOPATH)/src/github.com/harmony-one

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/harmony-one/mcl.git
git clone https://github.com/harmony-one/bls.git
git clone https://github.com/harmony-one/harmony.git
cd harmony
  1. Build the harmony binary & dependent libs
make

Run bash scripts/install_build_tools.sh to ensure build tools are of correct versions.

Dev Docker Image

Included in this repo is a Dockerfile that has a full harmony 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/harmony-one/harmony
make clean
docker build -t harmony .

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

docker rm harmony # Remove old docker container
docker run --name harmony -it -v "$(go env GOPATH)/src/github.com/harmony-one/harmony:/root/go/src/github.com/harmony-one/harmony" harmony /bin/bash

Note that the harmony 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 harmony /bin/bash

Learn more about docker here.

Build

The make command should automatically build the Harmony 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/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include -I/usr/local/opt/openssl/include"
export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/usr/local/opt/openssl/lib"
export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/usr/local/opt/openssl/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.

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.

API tests

To run this test do:

make test-api

This test starts a localnet (within the Docker container), ensures it reaches consensus, and runs a series of tests to ensure correct Node API behavior. This test also acts as a preliminary integration test (more through 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-api-attach

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

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

License

Harmony is licensed under the MIT License. See LICENSE file for the terms and conditions.

Harmony 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 Harmony

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

Planned Features

  • Resharding
  • Integration with WASM
  • Fast state synchronization
  • Auditable privacy asset using ZK proof