Hyperchains v0.9 Developement Guide
Current Hyperchains Documentation for Beta release
Introduction
This document describes the Aeternity Hyperchain architecture and provides configuration guidance for deploying a Hyperchain node. It includes configuration parameters, setup requirements, and step-by-step deployment instructions.
Hyperchains represent an evolution in blockchain architecture that combines Proof-of-Work (PoW) security with Proof-of-Stake (PoS) efficiency. Through a child chain that periodically synchronizes with a parent PoW chain, Hyperchains enable scalable blockchain networks while maintaining strong security guarantees. This hybrid approach significantly reduces energy consumption compared to traditional PoW systems.
The 0.9 beta release provides developers who are already running Aeternity nodes with the foundation to test and validate Hyperchain functionality. This release focuses on establishing the parent-child chain relationship, implementing chain synchronization, and managing validator operations. This documentation will guide you through the essential configuration parameters and setup requirements needed to participate in the beta testing phase.
Before You Begin
This guide assumes you have:
A running Aeternity node (v6.7.0 or later)
Experience managing blockchain nodes
Access to sufficient funds for pinning operations
Understanding of node validator operations
Important:
Back up your existing node configuration before making any changes
Store all private keys securely
Verify all prerequisites before proceeding
Prerequisites Checklist
Required Infrastructure
Running Aeternity node (v6.7.0 or later)
Minimum 4GB RAM dedicated to Hyperchain operations
100GB available storage space
Stable internet connection with minimum 10Mbps upload/download
Required Technical Knowledge
Experience running and maintaining Aeternity nodes
Basic understanding of blockchain concepts
Familiarity with command-line operations
Understanding of YAML configuration files
Required Accounts and Keys
Access to parent chain (Aeternity) wallet with sufficient funds for pinning
Private key for hyperchain staking operations
Private key for parent chain pinning operations
Setup Process Overview
Time Investment
Initial setup: 2-3 hours
Configuration testing: 1-2 hours
Initial sync time: 2-4 hours (depends on network conditions)
Resource Requirements
Parent chain wallet must maintain minimum balance of X AE for pinning operations
Continuous monitoring during first 24 hours of operation
Regular maintenance windows for updates and optimizations
Implementation Steps
Configure parent chain connection
Set up and configure Hyperchain node
Complete validation period (24-48 hours)
Begin network participation
Configuring Your Own Hyperchain Node
Setting up a Hyperchain requires careful configuration and several specific steps. To simplify this process, Aeternity provides the hyperchain-starter-kit tool, which automates many of the complex configuration tasks. See hyperchain-starter-kit
(from Aeternity GitHub org)
Please note that this tool is currently in development. While functional, you may encounter some warnings or minor issues as we continue to improve its stability and user experience
Requirements:
A running Aeternity node installation (following the installation instructions)
Git version control system installed to download the starter kit code
Node.js installed to run the
hyperchain-starter-kit
Jq installed for JSON formatting
Note: These instructions use Unix/Linux/MacOS shell commands. Windows users will need to adjust paths and commands accordingly.
1. Install the Hyperchains Starter Kit
2. Tool configuration
Our Hyperchain (configuration) will be named hc_test
for this example. A directory with the same name will be created in the root directory of the tool where generated files will end up.
This command creates an init.yaml
file in the root of your hc_test
directory. It contains parameters and settings for your hyperchain. It looks like:
This is the default setup that uses Aeternity testnet
as parent chain and appropriate block time and epoch length for it. The configuration can be changed as needs following the rules in the Configuration Details.
3. Set Up Contracts
To prepare the Hyperchain contracts run the following:
This will download the standard contracts from the latest Aeternity release and compile them in contracts
sub-directory.
4. Generate the Economy
To generate your Hyperchain "economy" according to init.yaml
run the following:
This command will generate random keypairs for all accounts that are needed:
Faucet: can be used to fund other accounts in an automated way
Treasury: the same purpose as Faucet but manual funding
Validators: pre-funded (Stakers) accounts used to initialized the Hyperchain
Pinners: a list of accounts used for pinning
Please note that you have to somehow fund all pinners accounts on the parent chain prior starting your node/validator.
You can inspect the outcome of this in the hc_test/economy-unencrypted.yaml
file:
Example output:
5. Generate Configuration Files
To generate all the configuration files needed to run a Hyperchain, run:
This will create 3 files in nodeConfig
directory:
aeternity.yaml
hc_test_accounts.json
hc_test_contracts.json
Don't forget to fund all pinners accounts on the parent chain prior starting your node/validator.
IMPORTANT: If you used a known public chain (testnet or mainnet) as parent chain, the tool will set the start_height
as current block + 10, that is 30 minutes in future. Keep that in mind when verifying your chain, either decrease the number or wait until that block is produced on the parent chain before you start transacting on the Hyperchain.
6. Run a Node
Docker
Use Docker volumes to install the configuration files and run the node at once:
Verify your node is running with:
Expected output:
For more details refer to dedicated Docker section.
Tarball Installation
Copy all of the above files to their node corresponding directory, i.e. assuming it's in ~/aeternity/node
:
then run your node:
Verify your node is running with:
Expected output:
If the output is Node is not running!
check node logs for errors to debug it further.
7. Begin Operations
After your Hyperchain node is running and producing blocks, you can begin interacting with the chain. The recommended next steps are:
Connect supporting tools to your chain:
Block explorer (e.g., Aescan)
Wallet interface (e.g., Superhero Wallet or Base app)
Import your test accounts:
Access the account mnemonics from
hc_test/economy-unencrypted.yaml
Import these into your preferred wallet (e.g., Superhero Wallet)
Configure your wallet's network settings:
Node address (e.g., localhost)
HTTP API port (default: 3013)
Network ID (
hc_test
in this example)
You can now begin testing transactions and interactions with your Hyperchain deployment.
Happy Hyperchaining :)
Configuration Explained
An Aeternity Hyperchain node is built on a standard Aeternity release with specific consensus configuration. After completing the installation and basic configuration, you'll need to add the following Hyperchain-specific configurations to your aeternity.yaml or .json file. Please follow the installation instructions and do basic configuration. Then adopt and add the additional configuration below to your aternity.yaml
or (.json
).
Parent chain
To configure your parent chain connection, you'll need to specify several key parameters. Start by setting the chain connector to AE2AE and network ID to ae_uat. Next, configure your parent chain node address using the parent node's HTTP API port, not the external port. When setting the fetch interval, ensure it's frequent enough to capture all state changes on the parent chain. Finally, specify a future block height on the parent chain as your starting point. This height determines when your child chain will begin its operations, including block production and pinning. This configuration creates a deliberate delay, allowing for proper initialization and synchronization:
Block times and epochs
The initial "speed" of the Hyperchain is defined by the epoch and block production parameters. These will be different for each Hyperchain, depending on the desired transactional characteristics of the chain. The values below are useful for testing purposes, and when running on Aeternity testnet
. Please see the main Hyperchain documentation for more information in how to optimize block and epoch parameters per application and parent chain characteristics.
First a parent chain epoch length should be picked. That should be long enough to statistically easy any block time fluctuations. In this example with Aeternity testnet
as parent chain, 10 blocks should be enough.
This version of Hyperchains supports block times as low as 3 seconds for various reasons (i.e. network latency, disk latency, etc.) That can be set as (in milliseconds):
And lastly, but very important is the child epoch length. It is mandatory to have equal parent and child epoch length in wall clock times:
In this example the Aeternity testnet
is having 180s block times, so:
Stakers
We define three stakers
, that need to have accounts and funds to stake on the Hyperchain. Once a staker becomes leader, their private key is used to sign produced blocks by the node.
Accounts
When starting a Hyperchain it needs some pre-funded accounts as most other chains and types. At least the staker's accounts must be funded so that they can be registered with some initial stake to boot the consensus. In this example there are 3 stakers pre-funded with 3100000000000000000000000000
each so they can be registered at genesis time. Also some additional accounts like Faucet (ak_WNkJkmaEoyScVRaeZeDvvmCqLn1HkfNnQDy1oSJp6Jm5YPpAq
) and Treasury (ak_CLTKb9tdvXGwpgUBW8GytW7kXv9r1eJyY4YtgKKWtKcY3poQf
) are also funded for easing the chain usage.
Contracts
Hyperchains operate through FATE contracts which must be compiled and provided to the node. These contracts require initialization during the first (genesis) block of the Hyperchain, which involves specific contract calls. While this configuration can be manually set in contracts.json, the process is technically complex. We recommend using our purpose-built CLI tools to handle contract deployment and initialization.
In this example two contracts are deployed: MainStaking.aes and HCElection.aes then there are three contract calls to register the stakers/validators, 3 in this example.
Please refer to the hyperchain-starter-kit
documentation above how to generate the files.
Once the contracts are generated they have to be also added in the node consensus configuration. Current configuration expect 3 separate contracts:
However, the current implementation is using the staking contract instance for rewards distribution, thus the addresses are the same.
Finally the contract owner should be set the same as the owner of the contract deployment in the contracts.json
:
This ensures that the protocol methods can be called only by the protocol and not other accounts. In this example the so called "zero" address is used for that.
Pinning
Currently only a single pinning behavior is supported. Validators will automatically pin the Hyperchain state to the parent chain when they are leaders of the last block of the epoch using their mapped parent account credentials. It can be enabled by:
That feature also needs pinning accounts configuration, it's map of staker to pinning account, for example:
To encourage validators to pin epoch states to the parent chain, the system provides rewards in the Hyperchain's native currency. The reward amount for each successful pinning operation can be configured to align with your Hyperchain's economic model. This value represents the compensation validators receive for performing verifiable pinning operations for each epoch.
Complete configuration example
Addendum 1: Hyperchain-specific confguration reference
chain.consensus: object
The consensus algorithms used for validating blocks. Ignored if 'fork_management > network_id' has value 'ae_mainnet' or 'ae_uat'.
Properties (Pattern)
<height>
object
Property name indicates minimum height at which the given
consensus algorithm gets activated. By default from genesis Cuckoo cycle based BitcoinNG is used.
yes
chain.consensus.<height>: object
Configuration parameters for the selected consensus algorithm (Hyperchain).
Properties
type
string
The type of the consensus algorithm used at the given height (ex. pow_cuckoo, smart_contract
or hyperchain)
Default: "hyperchain"
yes
config
object
Configuration for the given consensus algorithm
no
Example
chain.consensus.<height>.config: object
Configuration for the given consensus algorithm
Properties
contract_owner
string
Owner of the smart contracts that controls the consensus.
election_contract
string
The address of the smart contract that will be used for leader elections. For a new chain this contract should be loaded at genesis
rewards_contract
string
The address of the smart contract that will be used for reward distributions. For a new chain this contract should be loaded at genesis
genesis_start_time
integer
Timestamp for genesis
Default: 0
child_block_time
integer
The average time in milliseconds between two key blocks on the hyperchain
Default: 3000
child_block_production_time
integer
The time in milliseconds to produce a hyperchain block
child_epoch_length
integer
The number of blocks in an epoch on the hyperchain
pinning_reward_value
integer
The initial value of the Pinning reward. It can later be changed through consensus
Default: 0
default_pinning_behavior
boolean
Use the default pinning behavior, where in each epoch, if the last leader has defined pinning/parent chain credentials, they will pin
Default: false
fixed_coinbase
integer
The coinbase reward specifies the fixed amount of newly minted tokens allocated to block producers as an incentive for validating and adding blocks to the chain.
Default: 0
parent_chain
object
Details of how this node will connect to a parent chain if this is a hyperchain.
stakers
object[]
List of hyperchain accounts
pinners
object[]
List of parent chain accounts
Example
chain.consensus.<height>.config.parent_chain: object
Details of how this node will connect to a parent chain if this is a hyperchain.
Properties
start_height
integer
Height on the parent chain that this hyperchain will start posting commitments and start creating blocks
Default: 0
finality
integer
The number of blocks on the parent chain to reach finality.
parent_epoch_length
integer
The number of blocks in an epoch on the parent chain.
acceptable_sync_offset
integer
The maximum amount of time the parent chain block generation can be off the expected time.
Default: 60000
consensus
object
Details of the parent chain.
polling
object
Parent chain connection configuration
Additional Properties: not allowed Example
chain.consensus.<height>.config.parent_chain.consensus: object
Details of the parent chain.
Properties
network_id
string
The network Id of the parent chain if it has one
Default: "ae_mainnet"
type
string
The type of parent network connection. Currently only AE, Bitcoin and Dogecoin are implemented
Default: "AE2AE"
Enum: "AE2AE"
, "AE2BTC"
, "AE2DOGE"
Additional Properties: not allowed Example
chain.consensus.<height>.config.parent_chain.polling: object
Parent chain connection configuration
Properties
fetch_interval
integer
The interval between polls of the parent chain looking for a new block (milliseconds)
Default: 500
retry_interval
integer
The amount of time in milliseconds to wait before retrying a check for a block on the parent chain.
Default: 1000
cache_size
integer
Size of local cache for parent chain
Default: 200
nodes
string[]
List of parent chain nodes to poll for new blocks Default:
Additional Properties: not allowed Example
chain.consensus.<height>.config.parent_chain.polling.nodes[]: array
List of parent chain nodes to poll for new blocks
Items
URL address of the API - ://:@:
Item Type: string
chain.consensus.<height>.config.stakers[]: array
List of hyperchain accounts
Items
Hyperchain account pair
Item Properties
hyper_chain_account
object
Hyperchain staking account
Item Additional Properties: not allowed Example
chain.consensus.<height>.config.stakers[].hyper_chain_account: object
Hyper chain validator/staking account(s)
Properties
pub
string
Public key
Default: ""
priv
string
Private key
Default: ""
Additional Properties: not allowed Example
chain.consensus.<height>.config.pinners[]: array
List of parent chain accounts. Relevant only to Aeternity parent chains. For BTC and Doge, each node relies on a local wallet setup with accounts and funds.
Items
Hyperchain parent accounts.
Item Properties
parent_chain_account
object
Parent chain pinning account
Item Additional Properties: not allowed Example
chain.consensus.<height>.config.pinners[].parent_chain_account: object
Parent chain account for executing pinning (spend) transactions
Properties
pub
string
Public key
Default: ""
priv
string
Private key
Default: ""
owner
string
Public key of Hyperchain account owner. Needs to correspond to an account defined in stakers
Default: ""
Additional Properties: not allowed Example