• Stars
    star
    1,460
  • Rank 31,431 (Top 0.7 %)
  • Language
    Go
  • License
    GNU Lesser Genera...
  • Created about 6 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The core protocol of harmony

Harmony

Build Status gopherbadger-tag-do-not-edit Discord Github Action Go Report Card

General Documentation

https://docs.harmony.one

API Guide

http://api.hmny.io/

Requirements

Go 1.19

GMP and OpenSSL

On macOS:

brew install gmp
brew install openssl
sudo ln -sf /usr/local/opt/[email protected] /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 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
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 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 .

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 harmony .

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 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/opt/homebrew/opt/[email protected]/include"
export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L/opt/homebrew/opt/[email protected]/lib"
export LD_LIBRARY_PATH=$GOPATH/src/github.com/harmony-one/bls/lib:$GOPATH/src/github.com/harmony-one/mcl/lib:/opt/homebrew/opt/[email protected]/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 testing docker container binds a couple of ports to the host machine for your convince. 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, hmy 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 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-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 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.

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

Harmony is licensed under GNU Lesser General Public License v3.0. 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

More Repositories

1

sdk

Javascript SDK of Harmony protocol.
TypeScript
92
star
2

chrome-extension-wallet

Harmony Chrome Extension Wallet
Vue
60
star
3

bounties

Bounty program is to help the community take part in the development of the Harmony blockchain. It covers from core feature to validator tooling, from dApp development to DeFi integration.
59
star
4

vdf

The first go implementation of verifiable delay function (VDF)
Go
54
star
5

pyhmy

A Python library for interacting and working with the harmony blockchain.
Python
47
star
6

ethhmy-bridge

Ethereum<>Harmony two way bridge (trusted version)
Solidity
45
star
7

go-sdk

Go-SDK & CLI tool to interact with the Harmony Blockchain
Go
43
star
8

docs-home

Harmony Documentation
40
star
9

staking-dashboard

Repo for harmony staking dashboard
JavaScript
39
star
10

go-raptorq

RFC 6330 compliant implementation of RaptorQ
Go
37
star
11

harmony-ops

Harmony Ops Master Repository.
Python
35
star
12

horizon

Horizon - a trustless harmony to ethereum bridge
Solidity
35
star
13

onebtc

Trustless Bitcoin on Harmony
Solidity
31
star
14

token-faucet-demo-dapp

A simple token faucet demo dApp to showcase how to build dApps on Harmony
JavaScript
29
star
15

harmonyj

Harmony Java SDK
Java
28
star
16

davinci_nft_marketplace

Harmony NFT marketplace Core Contract
Solidity
27
star
17

ethhmy-bridge.frontend

Ethereum<>Harmony two way bridge (trusted version) - frontend part
TypeScript
25
star
18

harmony-dashboard

Harmony Explorer Front-end
Vue
21
star
19

libunison

An opinionated, curated Golang networking library for real-world E2E/P2P applications
Go
20
star
20

experiment-deploy

Repo for conducting benchmark experiments
Shell
20
star
21

explorer-v2-frontend

TypeScript
20
star
22

harmony-open

Open-participation projects for Harmony
Go
16
star
23

HRC

HRC token standards
16
star
24

pangaea-community

The one-stop spot for Pangaea scripts! Open to contribution from all!
Shell
16
star
25

nft-store

NFT store sample dapp with client and server
JavaScript
15
star
26

dapp-examples

TypeScript
14
star
27

hackathon

repo for harmony hackathons
JavaScript
13
star
28

explorer-v2-backend

TypeScript
12
star
29

ethhmy-bridge.sdk

Horizon Bridge SDK
TypeScript
12
star
30

ledger-app-one

Ledger hardware wallet
C
9
star
31

x

AI ∩ Crypto
Swift
9
star
32

H2O

Harmony ERC20
JavaScript
9
star
33

auto-node

Run a harmony node with 1 command!
Python
8
star
34

validator-logos

Repository to store validator logos
8
star
35

harmony-box

Truffle box for Harmony - deploy smart contracts to Harmony using Truffle & native Ethereum tooling
JavaScript
8
star
36

layerzero-bridge.frontend

Harmony LayerZero Bridge - Frontend
TypeScript
7
star
37

hardhat-starter-pack

Hardhat Starter Pack for smart contract deployments on Harmony
TypeScript
7
star
38

harmony-tui

Text based user interface for Harmony node
Go
7
star
39

harmony-react

web3-react for Harmony
TypeScript
7
star
40

android-puzzle

JavaScript
6
star
41

watchdog

Harmony Watchdog
Go
6
star
42

HRC20-logos

Repository to store HRC20 token logos
6
star
43

tracking

public report to keep track of all harmony engineering/business deliverables as part of our open development
6
star
44

1earn

Yearn/YFI on Harmony - #DeFi Hackathon week 32
JavaScript
5
star
45

chainlink-demo-project

A demo project for chainlink integration to harmony.
JavaScript
5
star
46

harmony-test

Contains all the integration & end-user tests ran on a live network.
Python
5
star
47

multisig-react

Harmony multisig react app
TypeScript
5
star
48

harmony-log-analysis

Harmony Log Analysis and Visualization
Jupyter Notebook
5
star
49

1-country.frontend

frontend for dot-country
TypeScript
5
star
50

hmy-ecosystem

4
star
51

zkHMY

JavaScript
4
star
52

rings-dapp

Harmony Transaction Mixer using Ring Signature dAPP [WIP]
JavaScript
4
star
53

multisig-transaction-service

Harmony multisig transaction service
Python
4
star
54

layerzero-bridge.sdk

SDK for Harmony Layer Zero bridge
TypeScript
4
star
55

ansible

Ansible scripts to manage Harmony node/network
Shell
4
star
56

pangaea-ops

Pangaea (Harmony testnet) Ops
Shell
4
star
57

website

JavaScript
3
star
58

hrc1155

Hrc1155 smart contract
Solidity
3
star
59

Engineering-Guide

Guide and best practices for engineering with Harmony
3
star
60

key-generation

generate private key and address pairs for harmony tokens
Python
3
star
61

terraform

terraform scripts to manage harmony network
Go
3
star
62

one-names-example

One names subdomain register example
JavaScript
3
star
63

swoop-utils

Common libraries, utilities and abstractions used by the Swoop project.
TypeScript
3
star
64

harmony-contract-code-verification-tool

TypeScript
3
star
65

contract-libs

Harmony smart contracts templates and libraries
Solidity
3
star
66

onebtc.relayer-client

OneBtc relayer client
TypeScript
3
star
67

dapp-demo-crowdfunding

A demo crowdfunding dapp that you can deploy on Harmony!
Vue
3
star
68

seeswap

JS command-line scripts to interact with Balancer demo on Harmony
JavaScript
3
star
69

one-names

JavaScript
2
star
70

snapshot-spaces

TypeScript
2
star
71

dapp

Harmony Dapp
2
star
72

go-lib

Go library used to interact with the Harmony Blockchain
Go
2
star
73

ledger-harmony-js

Web2USB/Javascript driver for Harmony on Ledger Nano S
Vue
2
star
74

py-pangaea-ops

py-pangaea-ops is a collection of operational support tools for Pangaea – the Harmony testnet.
Python
2
star
75

staking-sdk

Harmony Staking SDK
TypeScript
2
star
76

multisig-contracts

Harmony multisig contracts
Solidity
2
star
77

onebtc.frontend

OneBtc UI client
TypeScript
2
star
78

developer-captains

2
star
79

one-names.migration-scripts

JavaScript
2
star
80

analytics-ops

Python
2
star
81

inscription.indexer

inscription.indexer
TypeScript
2
star
82

x-payments-backend

TypeScript
2
star
83

node-log-monitoring

Monitor Harmony Node Log using ELK Stack
Dockerfile
1
star
84

harmony-erc-20

JavaScript
1
star
85

dapp-curve-contracts

JavaScript
1
star
86

ethconnector

Ethereum Connector to Harmony Protocol
JavaScript
1
star
87

vid3-radical-videos

TypeScript
1
star
88

transaction-generator

https://pypi.org/project/harmony-transaction-generator/
Python
1
star
89

BeastQuest

BeastQuest game contracts
JavaScript
1
star
90

contract-verification-service

Verify & Publish Contract Source Code
Solidity
1
star
91

native-bridge

Native ONE token bridge with BEP2/ERC20 ONE
JavaScript
1
star
92

monitor

Projects for https://monitor.hmny.io
Python
1
star
93

harmony-tests

Regression tests for Harmony
Shell
1
star
94

papers

This repository contains Harmony research papers and white papers
1
star
95

ethhmy-bridge.tests

Ethhmy-bridge end2end tests
TypeScript
1
star
96

one-names.sdk

Harmony ONE Names SDK
TypeScript
1
star
97

oneAnchor-webapp

SCSS
1
star
98

vid3-mux-uploader

short-reels-video uploader demo
TypeScript
1
star
99

swoop-deployment

Swoop deployment tools
Shell
1
star
100

layerzero-bridge.monitoring

layerzero-bridge.monitoring
TypeScript
1
star