Skip to main content

Build Hedge (Berberis)

Hedge (Berberis) is the official Golang reference implementation of the Hedge testnet node software. Use this guide to install Hedge (Berberis) and hedged, the command-line interface and daemon that connects to Hedge and enables you to interact with the Hedge blockchain.

To build and run the Hedge Node from source, follow the steps below:

Clone the Repository

Clone the Hedge Node repository to your local machine:

git clone https://<username>@github.com/hedgeblock/hedge.git
cd hedge

Set up Environment Variables

Since this version uses a private repository hosted on GitHub, you'll need to set up the following environment variables for authentication. Replace <username>, <reponame>, and <your-token> with your specific GitHub information.

export GOPRIVATE=github.com/hedgeblock/hedge-sdk
export GONOPROXY=localhost
export GITHUB_ACCESS_TOKEN=<your-token>
  • <username>: Your GitHub username associated with the Hedge repository.
  • <reponame>: The name of the Hedge repository on your GitHub account.
  • <your-token>: Your GitHub access token. This token is used for authentication when downloading dependencies from private repositories.

These environment variables ensure that the Go tools and Git are configured to access the private repository securely.

Configure Git for GitHub Access

Configure Git to use your GitHub access token for authentication:

git config --global url."https://$GITHUB_ACCESS_TOKEN:x-oauth-basic@github.com/".insteadOf "https://github.com/"

Update Go Modules

Ensure that your go.mod file reflects the correct dependencies:

go mod tidy

Build Hedge Node

This will install the hedged executable to your GOPATH environment variable.

make install

Verify Hedge Node Installation

Verify that Hedge Node is installed correctly.

hedged version --long

Example:

name: hedge
server_name: hedged
version: release/dev-507ebff7c96571699c95e298e3af7ee445320403
cosmos_sdk_version: v0.47.5
commit: 507ebff7c96571699c95e298e3af7ee445320403
build_tags: netgo,ledger
go: go version go1.20.7 linux/amd64
# .. followed by a lot of dependencies
tip

If the hedged: command not found error message is returned, confirm that the Go binary path is correctly configured by running the following command:

export PATH=$PATH:$(go env GOPATH)/bin