Skip to main content

Join a network

Configure General Settings

The following information describes the most important node configuration settings found in the ~/.hedge/berberis-1/config/ directory. It is recommended that you update these settings with your own information.

~/.hedge/berberis-1/config
│-- app.toml # hedged configuration file.
│-- client.toml # CLI wallet configurations.
│-- config.toml # Tendermint configuration file
│-- genesis.json # Initial blockchain configuration.
│-- node_key.json # private key used for node authentication in the p2p protocol (its corresponding public key is the nodeid)
└-- priv_validator_key.json # key used by the validator on the node to sign blocks

Initialize and Configure Moniker

Initialize the node with a human-readable name:

hedged init <your_custom_moniker> --chain-id berberis-1 --home ./hedge/berberis-1 

Example:

hedged init test_node --chain-id berberis-1 --home ./hedge/berberis-1 
MONIKER CHARACTERS

Monikers can only contain ASCII characters. Using Unicode characters will render your node unreachable by other peers in the network.

You can update your node's moniker by editing the moniker field in ~/.hedge/berberis-1/config/config.toml.

Add Genesis File

Download the Genesis file from the specified RPC endpoint and save it to the ~/.hedge/berberis-1/config/ directory

curl https://www.rpc-berberis.hedgeblock.io/genesis | jq ".result.genesis" > ./hedge/berberis-1/config/genesis.json

This command fetches the Genesis file from the provided RPC endpoint and stores it locally in the genesis.json file

Update Persistent Peers

Update the persistent peers configuration in the config.toml file with the specified node information to connect to other specified nodes in the network.

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"<peers_node_id>@<rpc_node_ip>:26656\"/" ./hedge/berberis-1/config/config.toml

Example:

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"15c4b9e4c180dffe096d56aca0a084e551208c87@54.92.167.150:26656\"/" ./hedge/berberis-1/config/config.toml

Update Minimum Gas Prices

Modify minimum-gas-prices and set the minimum price of gas a validator will accept to validate a transaction and to prevent spam.

# Update the minimum gas prices to your preferred value by replacing "0.0025uhedge" with your desired amount.
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0025uhedge\"/" ./hedge/berberis-1/config/app.toml

This command updates the minimum gas prices in the app.toml file with the specified value.

Start the Light Client Daemon (LCD)

For information about the available Hedge REST API endpoints, see the Swagger documentation. To enable the REST API and Swagger, and to start the LCD, complete the following steps:

sed -i 's/enable = false/enable = true/g' ./hedge/berberis-1/config/app.toml

Optional: Swagger defines if swagger documentation should automatically be registered. To enable Swagger, change swagger = false to swagger = true.

sed -i 's/swagger = false/swagger = true/g' ./hedge/berberis-1/config/app.toml

Modify the REST endpoint to allow external connections. This ensures external applications can interact with the Hedge Node's REST API.

sed -i 's#"tcp://localhost:1317"#"tcp://0.0.0.0:1317"#g' ./hedge/berberis-1/config/app.toml

Set up external_address in config.toml

In order to be added to the address book in seed nodes, you need to configure external_address in config.toml. This addition will prevent continuous reconnections. The default P2P_PORT is 26656.

sed -i.bak -e "s/^external_address *=.*/external_address = \"$(curl ifconfig.me):26556\"/" ./hedge/berberis-1/config/config.toml

This command updates the external address configuration in the config.toml file with the specified IP address and port.

Update RPC Endpoint

To make your Hedge Node accessible externally, update the RPC endpoint configuration in the config.toml file:

sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ./hedge/berberis-1/config/config.toml

This command modifies the RPC endpoint to allow external connections, ensuring that the Hedge Node is reachable from outside the local machine.

sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' ./hedge/berberis-1/config/config.toml

This command sets up CORS, permitting connections from any origin.

Add CORS Origins

Add CORS origins to the app.toml file, allowing requests from any origin.

# Customize the list of allowed origins or specify it as "*" to allow any origin.
sed -i '$ a\cors_allowed_origins = ["*"]' ./hedge/berberis-1/config/app.toml

This enables cross-origin resource sharing and allows requests from any origin to access the Hedge Node's REST API.

Start the Hedge Node

Initiate the Hedge Node with the specified configurations and begin participating in the blockchain network.

hedged start --home ./hedge/berberis-1