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
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.
## Dev Environment
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).**
```
$ docker container ls
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:
### First Install
Clone and set up all of the repos with the following set of commands:
> 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.
### 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:
Then you can build all executables with the following command:
```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
https://docs.harmony.one
## Debugging
### API guides
One can start a local network (a.k.a localnet) with your current code using the following command:
```bash
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).
https://docs.harmony.one/home/developers/api
One can force kill the local network with the following command:
```bash
make debug-kill
```
> You can view all make commands with `make help`
### Running locally
## Testing
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.
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
./test/debug.sh
make test-go
```
This test runs the go tests along with go lint, go fmt, go imports, go mod, and go generate checks.
### Terminate the local blockchain
### API tests
To run this test do:
```bash
./test/kill_nodes.sh
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).
## Testing
Make sure you use the following command and make sure everything passed before submitting your code.
If you wish to debug further with the localnet after the tests are done, open a new shell and run:
```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
Harmony is licensed under the MIT License. See [`LICENSE`](LICENSE) file for
the terms and conditions.
Harmony includes third-party opensource 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
modifications thereto are licensed under the same third-party open source
license.
@ -237,7 +188,7 @@ See [`CONTRIBUTING`](CONTRIBUTING.md) for details.
## Development Status
### Features Done
### Finished Features
- Fully sharded network with beacon chain and shard chains
- Sharded P2P network and P2P gossiping
@ -250,7 +201,7 @@ See [`CONTRIBUTING`](CONTRIBUTING.md) for details.