HyperChains 0.2

Hi all,

As described in another thread, the node version v6.6.0 is out. It includes the latest new version of HyperChains. We are about to deprecate the old one and release the new version. Since there are a lot of changes, all progress from the HyperChain Alpha network would be deleted - the changes are so radical that migrating state would be a big task of its own.

I will post live updates here :slight_smile:

9 Likes

A longer description what you can test in this version. Please note that HyperChain 0.2 is the software while HyperChain2 is the current testnet that runs HyperChain 0.2

There are various changes in the smart contract. We have a lot of new settings added to the contract creation so your own unique hyper chains can be customised according to your particular business case. Currently the following are being enforced:

  • validator minimum stake - a minimum amount of staking power a validator must have in order to become on. Then the validator can withdraw an amount (for example rewards) but can not go below this threshold. On HyperChain2 that is 1mln HC AE
  • validator minimum percentage - each validator must have staking power in their own pool. If a validator gets a lot of support, then the percentage of their stake shrinks. This setting limits validator withdrawals if their stake goes below a this percent in their own pool. On HyperChain2 that is 30%
  • stake minimum - the minimum stake required to delegate your staking power. On HyperChain2 that is 1 HC AE
  • online delay - once a validator becomes online, they must wait this amount of blocks before they can become online and participate in the election. This limits newly created validators of taking over the network. On HyperChain2 that is 0 and there is no delay.
  • stake delay - the delay in number of generations before a delegate’s staking power takes effect. On HyperChain2 that is 0, the stake is instant.
  • unstake delay - the delay in number of generations before an unstake action can be executed. On HyperChain2 that is 0, the unstake is instant

This is all governed by the two smart contracts:

  • MainStaking.aes - the contract that manages all staking and unstaking
  • StakingValidator.aes - the contract that manages the staking distribution in a single validator staking pool

Now with HyperChains 0.2 we have a third contract - we’ve taken out the election process out of the staking contract and it lives in its own contract. This allows you to spawn a HyperChain with the same staking contracts as the ones above but with your own election process. In HyperChain2 we use this one. Note that this is fully configurable in the config, no need of a new release in order to change a contract for your own HyperChain!

This election contract uses a bit different function for electing the new leader: it expects a new entropy on every new generation. This is where the parent chain comes in - in HyperChains 0.2, the hyper_chain consensus is added. It adds a connection to the parent chain: the blocks on the child chain follow the blocks on the parent chain in a relation 1:1 - for each block on the parent chain, there is a new block on the child chain. The hash of the parent chain’s block is being used in the child chain as a source of entropy in the leader election. This is a first step connecting the child chain with a parent chain. In HyperChain2 the parent chain is Aeternity main net. In order for us to skip any forks on the parent chain, the current child chain’s top is being attached not to the parent’s top but rather X blocks in the past. This is a configurable confirmations height that in HyperChain2 is set to 101.

Another configurable value is when the child chain starts - the block in the parent chain that corresponds to the child’s genesis block. In HyperChain2 that is Aeternity main net block 649000.

We want users to spawn their own HyperChains and we want to make it easier for them to do so. A new HyperChain requires custom setup of seed accounts and contracts. We need those in order to elect the first leader. We revisited the config and now depending on your network ID defines the names of your HyperChain seed files. This makes it much easier to prepare and share configs. What is more, we are building a tool to produce those for you. The configs for HyperChain2 had been produced by it. The tool is still WIP and once ready - we will announce it.

So a lot of changes in a single release!

8 Likes

While I was writing this, the deployment of HyperChains2 is done. We have deployed 2 nodes:

curl -s 13.239.157.207:3013/v3/status | jq ".top_block_height"
797

and

curl -s 3.105.185.75:3013/v3/status | jq ".top_block_height"
797

Both nodes are up and running. They have reached a height that is 101 blocks below the current top - exactly as expected.
HC-specific Base app wallet was deployed under: https://base-hc.dev.aepps.com/
before creating a new account, make sure you’re connected to propper network:

To top up your account, you can use a new faucet: https://dev-faucet-hc.aepps.com/ The limit is 30AE daily.

We will release a new version of the staking UI soon :slight_smile:

6 Likes

A complete guide how to join the network:

This is the setup for joining the HyperChain2 network. It has a network ID hyper_chain2, 3 different online validators and 1 offline. It attaches to the aeternity mainnet.

Step 1 - get the node

Fetch the v6.6.0 release and untar it. In the example we would be installing it on a Ubuntu 18.04.5 LTS system, so the package used was https://github.com/aeternity/aeternity/releases/download/v6.6.0/aeternity-v6.6.0-ubuntu-x86_64.tar.gz

Step 2 - setup custom accounts

Set up the seed accounts

cat data/aecore/.ceres/hyper_chain2_accounts.json
{
  "ak_22Hf8gDLTGgq92Kppr3i8sz9j12ZVUosuNDAom7wzeZ5LEoMnB": 1000000000000000000000000000000000000000000000000,
  "ak_2evAxTKozswMyw9kXkvjJt3MbomCR1nLrf91BduXKdJLrvaaZt": 1000000000000000000000000000000000000000000000000,
  "ak_2KAcA2Pp1nrR8Wkt3FtCkReGzAi8vJ9Snxa4PcmrthVx8AhPe8": 3100000000000000000000000000,
  "ak_9WxeQ3aJFVJvVkWrJQFyqMipYaBMWJexEmUK2TLtKjLYp2Ssb": 3100000000000000000000000000,
  "ak_2k9KPk4as3RiJJwzkXvaS6VkduidCRfAZsdxkKNoJEcucKwY7j": 3100000000000000000000000000,
  "ak_irnHka6YqQmLgQmjJ8GUVAqwNqXs7sLm4U9DTG72j23Vy39gD": 3100000000000000000000000000
}

Out of those the first one is a big spender in case we need it, the second one is the faucet and the following 4 are the validators. We need those accounts in order to set up the initial contracts and feed them initial data.

Step 3 - setup custom contracts

Set the following contract creates and calls:

 cat data/aecore/.ceres/hyper_chain2_contracts.json 
{
  "contracts": [
    {
      "abi_version": 3,
      "vm_version": 8,
      "amount": 0,
      "nonce": 1,
      "call_data": "cb_KxFE1kQfK58AoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqADl6ZnU=",
      "code": "cb_+QXhRgOgnDB+VpcIbO4QCQE/Y0fj2YyEyC6iyams963aUQI7SxTAuQWzuQPw/g3YEMwENwA3AAIDEbTVYSIPAm+CJs8BAz/+GNwlLQA3ADcAAgMRtNVhIg8Cb4Imz1kCAi8oiAIHDAYBAz8aCgiIDAMrEW9MN6k/KygIAgIDEcPyLzwPAm+CJs8uKoiIAgEDP/4k0towADcBdzcAAgMRtNVhIg8Cb4ImzxoGigABAz/+MeNBoQI3ATcCRwAHNwAoHAIAKBwAAGUAKBwCABUKhoYBAz/+PR6JaAA3ADcJRwAHB2cHJzcCRwAHd3d3Z0cABwcCAxG01WEiDwJvgibPDAKCDAKEDAKGDAKIDAKKDAKMDAKODAKQDAKSJwwSAP5E1kQfADcCRwAHNwAaDogvABoOkC8AGgaCABoGhAIaDoYAGg6KXxoOjF8aDo5fGg6SAAEDP/5GWismADcABwIDEbTVYSIPAm+CJs8BApL+TTVCYgA3AUcABwIDEbTVYSIPAm+CJs8s2JA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GFyZXMRWts43hVzdGFrZRFbFAe5iS5TdGFraW5nVmFsaWRhdG9yLmNhbGN1bGF0ZV9zaGFyZXMRb0w3qRkuXjEyNjERchUgOD1zZXRfZGVzY3JpcHRpb24RgjZJAR11bnN0YWtlEbMt89w5c2V0X2F2YXRhcl91cmwRtIwWhB1iYWxhbmNlEbTVYSJ9LlN0YWtpbmdWYWxpZGF0b3IuYXNzZXJ0X2NhbGxlchG1e2kQiS5TdGFraW5nVmFsaWRhdG9yLmNvbnRyYWN0X2JhbGFuY2URw/IvPDUuTGlzdC5mb3JlYWNoEdTNKfhxLlN0YWtpbmdWYWxpZGF0b3IuYWRkX3NoYXJlcxH+rdkXeS5TdGFraW5nVmFsaWRhdG9yLnNoYXJlc190b19hZYIvAIU2LjEuMAC9o39S",
      "owner_pubkey": "ak_11111111111111111111111111111115rHyByZ",
      "pubkey": "ct_KJgjAXMtRF68AbT5A2aC9fTk8PA4WFv26cFSY27fXs6FtYQHK"
    },
    {
      "abi_version": 3,
      "vm_version": 8,
      "amount": 0,
      "nonce": 2,
      "call_data": "cb_KxFE1kQfe58CoCmQRGuzLDSzySG/5UcFOdoQ1iYy6a6fhJXVahjufrESb4rTwhvOzO2g///AQm+IDeC2s6dj/8AAAAAY4w8Y",
      "code": "cb_+RYCRgOg2rO1Gb8yo1+O1E6Qez1BeePDDwhZfH7JccotJeAQZ7LAuRXUuRBz/g/BzJoANwAnNwJHAAcaCgCEMggADAMrETfgmNk/BAMRaHbW3/4Td9gGAjcCJ+cAJ+cAJ+cAMwQABwwENQYAADYFAAA0GQIAAgYDAAEBAv4Z4kTzAjcBRwA3BUcCBwcHBwwBAAIDESwmBx4IPAQGKxiEAAArGIYAAP4acuPYAjcC9/f3KB4CAgIMAwMoHAACKCwEAicMBDQAAP4mtK0QAjcBJ+cAJ+cADAMDDAEABAMRE3fYBv4rvGCQAjcBBxceJACKBwwEAQN/+wO1VmFsaWRhdG9yIGNhbiBub3Qgd2l0aGRyYXcgYmVsb3cgdG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udHJhY3QRlyifYUlvZmZsaW5lX3ZhbGlkYXRvcnMRnvUxMBkuXjM2ODcRpRqxwhlyZXdhcmQRtVzUfaUuTWFpblN0YWtpbmcuYXNzZXJ0X2FsbG93ZWRfdG9fc2V0X29ubGluZRG37iMwYXNldF92YWxpZGF0b3JfYXZhdGFyX3VybBG4xFyoGS5eMzY4ORHD8i88NS5MaXN0LmZvcmVhY2gRyo+fSBkuXjM2ODQR1mGl6JEuTWFpblN0YWtpbmcuYXNzZXJ0X3Vrbm93bl92YWxpZGF0b3IR2efX1U1nZXRfdmFsaWRhdG9yX3N0YXRlEdt3dqJNaXNfdmFsaWRhdG9yX29ubGluZRHb+BxsLS5MaXN0Lm1lcmdlEeOzccNpLk1haW5TdGFraW5nLnZhbGlkYXRvcl9jbXAR5b3qti1zZXRfb2ZmbGluZRHmHW7hhS5NYWluU3Rha2luZy5tYXBfdmFsaWRhdG9yc19zdGF0ZRHmZidJKXNldF9vbmxpbmUR7uAJiCkuTGlzdC5kZXNjEfD+PXwpcG9zdF9lbGVjdBH3XcI8cS5NYWluU3Rha2luZy5zZXRfc3Rha2VfbGltaXQR/AgNHSkuTGlzdC5zb3J0Ef72LKwtdG90YWxfc3Rha2WCLwCFNi4xLjAAkdUpKw==",
      "owner_pubkey": "ak_11111111111111111111111111111115rHyByZ",
      "pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ"
    },
    {
      "abi_version": 3,
      "vm_version": 8,
      "amount": 0,
      "nonce": 3,
      "call_data": "cb_KxFE1kQfK58CoCwa1XR0IGCPLLSke5feeoiyjmk1qS7sGM/WHuFMzrFoKUhDX0VOVFJPUFki6CEa",
      "code": "cb_+QJFRgOg9YCG3/eOkZdwDPtnQl8y97A4kpwyv8QFjNoh7auJV4TAuQIXuQGC/iGkaj8CNwInNwLnAAcHhwI3ADcB5wAzBAAHDAg1BgAANgYCACguBAAAKC4GAgAfGAYCBwwGGgkAAhUlAgIGBgMADAIERPwjAAICAgABA6+CAAEAP/49HoloADcANwNHAndHAAwCggwChAwChicMBgD+RNZEHwA3AkcCdzcAXgKGGgaCABoGhAIBAz/+gHWgxwA3Agd3RwAcBgACDAMADAKCAwD8ETiOBG83ACc3AkcABw8CAgwDAAwCggMA/BH+9iysNwAHPwgAFhAAGAAMAgICAxEhpGo/DwIGCD4GCAr7AzFOTyBDQU5ESURBVEVGOAYAAP6kPMxUADcARwABAob+zT1auAA3AXc3AAIDEefR0MAPAm+CJs8MAQBZAAIDEYB1oMcPAgIMAwAMAoIDAPwR8P49fDcANwAPAm+CJs8aBoQAGgqGAgEDP/7n0dDAAjcANwB9AFUAIAAHDAT7A3lNdXN0IGJlIGNhbGxlZCBieSB0aGUgcHJvdG9jb2wBAz+4jS8HESGkaj9pLkhDRWxlY3Rpb24uZmluZF92YWxpZGF0b3IRPR6JaCVnZXRfc3RhdGURRNZEHxFpbml0EYB1oMc9ZWxlY3RfYXRfaGVpZ2h0EaQ8zFQZbGVhZGVyEc09WrgVZWxlY3QR59HQwIEuSENFbGVjdGlvbi5hc3NlcnRfcHJvdG9jb2xfY2FsbIIvAIU2LjEuMAAQeqcj",
      "owner_pubkey": "ak_11111111111111111111111111111115rHyByZ",
      "pubkey": "ct_t7ESuRFvGdYHwM6KJhKbSnFUJQhnB9aCFed1RWR89ShNDgwWA"
    }
  ],
  "calls": [
    {
      "abi_version": 3,
      "amount": 1000000000000000000000000,
      "call_data": "cb_KxFuGm1JPyDWziI=",
      "caller": "ak_9WxeQ3aJFVJvVkWrJQFyqMipYaBMWJexEmUK2TLtKjLYp2Ssb",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 1,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxHmZidJP7W4jFY=",
      "caller": "ak_9WxeQ3aJFVJvVkWrJQFyqMipYaBMWJexEmUK2TLtKjLYp2Ssb",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 2,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxEy4TFQGzlIb3JyaWJsZSBTcXVpZMbmDtk=",
      "caller": "ak_9WxeQ3aJFVJvVkWrJQFyqMipYaBMWJexEmUK2TLtKjLYp2Ssb",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 3,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 1000000000000000000000000,
      "call_data": "cb_KxFuGm1JPyDWziI=",
      "caller": "ak_2k9KPk4as3RiJJwzkXvaS6VkduidCRfAZsdxkKNoJEcucKwY7j",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 1,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxHmZidJP7W4jFY=",
      "caller": "ak_2k9KPk4as3RiJJwzkXvaS6VkduidCRfAZsdxkKNoJEcucKwY7j",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 2,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxEy4TFQG0FUZXJyaWJsZSBPc3RyaWNoUPGRWQ==",
      "caller": "ak_2k9KPk4as3RiJJwzkXvaS6VkduidCRfAZsdxkKNoJEcucKwY7j",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 3,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 1000000000000000000000000,
      "call_data": "cb_KxFuGm1JPyDWziI=",
      "caller": "ak_irnHka6YqQmLgQmjJ8GUVAqwNqXs7sLm4U9DTG72j23Vy39gD",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 1,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxHmZidJP7W4jFY=",
      "caller": "ak_irnHka6YqQmLgQmjJ8GUVAqwNqXs7sLm4U9DTG72j23Vy39gD",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 2,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxEy4TFQG1lVbmludGVyZXN0ZWQgUm91bmR3b3Jt+lLBnw==",
      "caller": "ak_irnHka6YqQmLgQmjJ8GUVAqwNqXs7sLm4U9DTG72j23Vy39gD",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 3,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 1000000000000000000000000,
      "call_data": "cb_KxFuGm1JPyDWziI=",
      "caller": "ak_2KAcA2Pp1nrR8Wkt3FtCkReGzAi8vJ9Snxa4PcmrthVx8AhPe8",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 1,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxEy4TFQG1VBZXRlcm5pdHkgQlJJIEFjY291bnTYY3Ho",
      "caller": "ak_2KAcA2Pp1nrR8Wkt3FtCkReGzAi8vJ9Snxa4PcmrthVx8AhPe8",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 2,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    },
    {
      "abi_version": 3,
      "amount": 0,
      "call_data": "cb_KxG37iMwG+lodHRwczovL2F2YXRhcnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3UvMjE5ODkyMzQ/cz0yMDAmdj00gb6p5A==",
      "caller": "ak_2KAcA2Pp1nrR8Wkt3FtCkReGzAi8vJ9Snxa4PcmrthVx8AhPe8",
      "contract_pubkey": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
      "nonce": 3,
      "fee": 1000000000000000,
      "gas": 1000000,
      "gas_price": 1000000000
    }
  ]
}

This feeds the genesis block with the appropriate 3 different consensus contracts:

It also creates the 4 validators, sets 3 of them online, sets them names and so on. I order for the first block to be created we need a leader for the first generation :slight_smile:

Step 4 - node configuration

This is an example configuration:

cat aeternity.json                                                       
{
  "chain": {
    "consensus": {
      "0": {
        "config": {
          "contract_owner": "ak_11111111111111111111111111111115rHyByZ",
          "election_contract": "ct_t7ESuRFvGdYHwM6KJhKbSnFUJQhnB9aCFed1RWR89ShNDgwWA",
          "expected_key_block_rate": 2000,
          "parent_chain": {
            "confirmations": 101,
            "fetch_interval": 1000,
            "nodes": [
              {
                "host": "mainnet.aeternity.io",
                "password": "Pass",
                "port": 80,
                "user": "test"
              }
            ],
            "start_height": 649000,
            "type": "AE"
          },
          "rewards_contract": "ct_LRbi65kmLtE7YMkG6mvG5TxAXTsPJDZjAtsPuaXtRyPA7gnfJ",
          "stakers": []
        },
        "name": "hyper_chain"
      }
    },
    "db_direct_access": true,
    "hard_forks": {
      "6": 0
    },
    "persist": true
  },
  "fork_management": {
    "network_id": "hyper_chain2"
  },
  "include_default_peers": false,
  "mining": {
    "autostart": true,
    "beneficiary": "ak_2evAxTKozswMyw9kXkvjJt3MbomCR1nLrf91BduXKdJLrvaaZt"
  },
  "peers": [
  ],
  "logging":
  {
      "level": "info"
  }
}

Feel free modifying it but do no change the chain section as it has impact on the actual consensus. If you modify it - your node will not sync with the rest of the network.

Known limitations

Our nodes are deployed in AWS. Since the node eagerly tries caching all parent chain blocks it would need soon, we have a cache to store those. Apparently sending a lot of requests triggers some defences and requests start dropping. This corrupts the cache (tracked as an issue in GH) which leaves the node simply waiting and unable to sync. This will be fixed in a future release. If you want to sync with the HyperChain2, you would need to do one of the following:

  • host it on AWS
  • spawn your own Aeternity node fully synced with mainnet and point your HyperChain2 node to it instead
4 Likes

nice to see the progress. thanks for sharing the update @dimitar.chain :slight_smile:

after having a quick look at the election contract I have a question to this code:

  function assert_protocol_call() =
      require(Call.caller == Contract.creator, "Must be called by the protocol")

what’s the address of the protocol? :sweat_smile:

2 Likes

Since we are using the existing infrastructure for seeding the genesis block with contracts (see hyper_chain2_contracts.json above), each contract has an owner/creator. We just pick one that is all zeroes and the number 42 at the end:

Since we don’t have the private keys for this account, we can not make calls. The hyper_chain protocol on the other hand executes the contract using the configured owner on every new key block in order to elect the next leader. This is a bit special call and it is not authenticated - so we don’t need the private key for it.

5 Likes

Hello everyone,

We now have a UI for this test hyper chain.
You can find it here: https://hc-ui.dev.aepps.com
Currently tested only in Chrome based browsers.
The initial process of connecting to the special Base Aepp wallet is a bit tricky, as you need to allow pop-ups in the browser and you may need to refresh the page afterwards.
We’ll work on the process in the future.

Otherwise it should be quite familiar and similar to other PoS blockchains.

The source code is here: GitHub - aeternity/aepp-hc-ui: Hyperchains UI

7 Likes

how about consider adding a flexible follow-up mechanism of 1:n, which is used for the unavailability of the parent chain or other unexpected situations. At this time, the child chain can fully operate in the Pos mode, but the reward is only 40%. After that, the first child chain block on the parient chain will receive 40% of the reward of the previous child chain blocks that is not on the parient chain. I don’t know if this is necessary or easy to achieve. :grinning:

Yep, the 1:N relation is something we are eager to explore as it would allow us to have leader more often and this is good. First we want to have a solid implementation that is easer to reason about (esp. with regards of forks), that’s why we go 1:1 initially.

7 Likes

very cool.

Hello ;from this topic post; Didn’t see the hyperchain theme update either? How is it going on now?

1 Like