On Linux, reference official documentation [here](https://docs.docker.com/engine/install/).
3. **Go 1.14.1**
4. **Bash 4+**
## Using our hmy command line tool
For macOS, you can reference this [guide](http://tldrdevnotes.com/bash-upgrade-3-4-macos). For Linux, you can reference this [guide](https://fossbytes.com/installing-gnu-bash-4-4-linux-distros/).
Assuming that you got `test/debug.sh` running in your docker container, we can interact with
## Dev Environment
the running blockchain using our `hmy` command line tool. Its part of our
[go-sdk](https://github.com/harmony-one/go-sdk) repo, but our docker container already has it as
well and built.
Find your running container's ID, here's an example
**Most repos from [harmony-one](https://github.com/harmony-one) assumes the GOPATH convention. More information [here](https://github.com/golang/go/wiki/GOPATH).**
```
### First Install
$ docker container ls
Clone and set up all of the repos with the following set of commands:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
62572a199bac harmonyone/main:stable "/bin/bash" 2 minutes ago Up 2 minutes awesome_cohen
```
now lets get our second shell in the running container:
```
$ docker exec -it 62572a199bac /bin/bash
```
The container already comes with a prebuilt `hmy` that you can invoke anywhere, but lets go ahead
> 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.
Note : Some of our scripts require bash 4.x support, please [install bash 4.x](http://tldrdevnotes.com/bash-upgrade-3-4-macos) on MacOS X.
Then you can build all executables with the following command:
### Build all executables
You can run the script `./scripts/go_executable_build.sh` to build all the executables.
### Build individual executables
Harmony server / main node:
```bash
```bash
./scripts/go_executable_build.sh harmony
bash ./scripts/go_executable_build.sh -S
```
```
> Reference `bash ./scripts/go_executable_build.sh -h` for more build options
### Harmony docs and guides
## Debugging
https://docs.harmony.one
### API guides
https://docs.harmony.one/home/developers/api
### Running locally
The debug.sh script calls test/deploy.sh script to create a local environment of Harmony blockchain devnet based on the configuration file.
The configuration file configures number of nodes and their IP/Port.
The script starts 2 shards and 7 nodes in each shard.
One can start a local network (a.k.a localnet) with your current code using the following command:
```bash
```bash
./test/debug.sh
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).
### Terminate the local blockchain
One can force kill the local network with the following command:
```bash
```bash
./test/kill_nodes.sh
make debug-kill
```
```
> You can view all make commands with `make help`
## Testing
## Testing
Make sure you use the following command and make sure everything passed before submitting your code.
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:
```bash
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:
```bash
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](https://github.com/harmony-one/harmony-test/tree/master/localnet).
If you wish to debug further with the localnet after the tests are done, open a new shell and run:
```bash
```bash
./test/test_before_submit.sh
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](https://docs.harmony.one/home/wallets/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](https://docs.harmony.one/home/wallets/harmony-cli)
> for more details & commands.
## License
## License
Harmony is licensed under the MIT License. See [`LICENSE`](LICENSE) file for
Harmony is licensed under the MIT License. See [`LICENSE`](LICENSE) file for
the terms and conditions.
the terms and conditions.
Harmony includes third-party open source code. In general, a source subtree
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
with a `LICENSE` or `COPYRIGHT` file is from a third party, and our
modifications thereto are licensed under the same third-party open source
modifications thereto are licensed under the same third-party open source
license.
license.
@ -237,7 +188,7 @@ See [`CONTRIBUTING`](CONTRIBUTING.md) for details.
## Development Status
## Development Status
### Features Done
### Finished Features
- Fully sharded network with beacon chain and shard chains
- Fully sharded network with beacon chain and shard chains
- Sharded P2P network and P2P gossiping
- Sharded P2P network and P2P gossiping
@ -250,9 +201,9 @@ See [`CONTRIBUTING`](CONTRIBUTING.md) for details.