State Machine
Introduction
The State Machine is core protocol component responsible for maintaining and updating the state of the blockchain as it progresses it represents the collective state of all accounts, validators, and other relevant data stored on the blockchain.
Accounts
An account is a structure that holds funds and can send or receive transactions.
Each account has a unique address and a balance, think a bank account - but managed by the blockchain instead of a bank.
The native crypto-currency is able to be transferred to and from accounts from a digital signature from the users private key that corresponds to the account Address
.
Pool
A pool is like an account without an owner, holding funds that are managed directly by the blockchain protocol. It's very similar to an account but instead of an address it has a unique ID and operates based on predefined blockchain rules rather than individual control.
For example:
DAO Treasury Pool
Committee Funds Pool
Committee Escrow Pool
Validators
A Validator is an actor in the blockchain network responsible for verifying transactions, creating new blocks, and maintaining the blockchain's integrity and security. In Canopy, Validators provide this service for multiple chains by restaking their tokens across multiple 'committees' and run a blockchain client for each.
The native crypto-currency is able to be surety bonded by participants to become validators. When staking (bonding), validators are able to choose a variety of configurations:
Amount: The amount of tokens to be removed from the sender account and locked as a surety bond against bad behavior during BFT. The entirety of this 'stake' is re-used (restaked) in each Committee BFT at the same time.
Delegate: A non-delegate is registering for active participation in the committee consensus, whereas a delegate is passive participation that contributes its tokens to influence subsidized status.
Compounding: Automatically compounds rewards to the stake or early withdraws them to the reward address for a penalty.
Output Address: The address where early-withdrawal rewards and the unstaking surety bond are transferred to.
⇨ The more tokens the validator bonds, the more voting power it has in consensus operations. However, the more staked, the more at risk if ‘slashed’ for bad behavior like double or non-signing during consensus.
Both the Operator and the Output private key may sign transactions on behalf of the Validator, but only the Output private key may change the Output address.
At any time a validator is able to update their stake information like committees and compounding
status by submitting an edit_stake
transaction:
In addition to this, the validator may also pause operations across all committees by submitting a pause_tx
, temporarily removing it from service, and submit an unpause_tx
to resume committee membership.
➩ To exit completely the validator may submit an unstake_tx
, permanently leaving the committees it is staked for. A Validator may be Paused up to MaxPauseBlocks
before it's automatically unstaked.
For short and long-range attack protection, the validator must wait for governance-controlled unstaking_blocks
before their bond is fully returned, during which they are still eligible for slashing for bad behavior.
Committee
A validator is eligible to provide shared security services to any Nested Chain it chooses.
💡The quorum of Validators that participate in the BFT process are called Committees
.
Once staked for a Committee, the validator connects with the other members of that Committee via the P2P layer. Together the committee executes consensus for the Nested-Chain, producing immediately final Nested-Chain blocks.
➩ For each Nested-Chain block, the elected leader submits a Certificate Result Transaction to the Canopy Root-Chain, encapsulating the results of the quorum.
Details of how Validators perform BFT for Nested Chains are found in the Utility section.
Subsidization
Committees qualify as AutoSubsidized
using the following formula:
Patrons may manually subsidize the Committee Funds Pool by directly sending tokens to it with an OpCode
instruction on distribution rules (if applicable)
➩ From the Committee Funds Pool — the Committee may distribute these rewards at the quorums discretion.
Rewards
The tokens for the RewardRecipients
are distributed from the Committee Pool — which is funded by (auto & manual) Subsidies.
Each committee may choose Reward Recipients as determined by their respective software—but the default is:
70% → Block Producer: The Root-Chain Validator who produced the Nested-Chain block.
10% → Root-Chain Delegate: Randomly selected by stake-weight from Delegates staked for the
NestedChainID
on the Root-Chain.10% → Nested-Chain Validator: Randomly selected by stake-weight from Validators staked for the
NestedChainID
on the Nested-Chain (will perform BFT once Nested-Chain is independent).10% → Nested-Chain Delegate: Randomly selected by stake-weight from Delegates staked for the
NestedChainID
on the Nested-Chain (will influence subsidization once Nested-Chain is independent).
The Certificate Result is included in the Nested-Chain block — so Reward Recipients are processed on both chains! Meaning, tokens are distributed proportionally to the same 4 actors on both chains.
Slashes
SlashRecipients are burned when processing each Certificate Result. By default, slashes only occur for 2 reasons:
A Validator didn't sign
MaxNonSign
blocks within theNonSignWindow
of blocks.A Validator Double Signed blocks — violating BFT safety.
Both of these Slashes have respective burn amounts which are parameterized.
Unlike rewards, Slashes are processed only on the Root-Chain and are applied directly without normalization by transaction count.
A governance parameter, MaxSlashPerCommittee
limits the number of slashes per Committee per block.
⇨ If this limit is exceeded, slashes are capped, and a safety mechanism automatically ejects Validators from the Committee — removing their eligibility to participate and receive slashes, preventing cascading failures.
Token Swaps
A Seller may submit
CreateOrder
transactions that creates a sell order on the Root-Chain. When submitting a CreateOrder transaction, the 'Root-Chain asset' is transferred to a Committee controlled escrow pool.The Buyer may reserve an Order by submitting a transaction to themselves on the 'buyer asset' chain with a
LockOrder
embedded in the transaction (via SigScript, OpData, Memo etc).The Committee witnesses the Lock by deterministically parsing the buyer chain block. The Committee marks the on-chain SellOrder as 'Locked' by recording the Buyer's information and setting the BuyerChainDeadline.
The Buyer witnesses their information in the SellOrder on the Root-Chain and directly sends the funds to the Seller — embedding a
CloseOrder
in the transaction.The Committee witnesses the CloseOrder by deterministically parsing the buyer chain block and releases the Seller's escrowed funds to the Buyer.
The Seller may
EditOrder
orDeleteOrder
if the order is not yet locked.
Governance
Canopy is pre-built with 2 different on-chain governance mechanisms:
Polling: Gather community sentiment by executing an on-chain vote of Accounts and Validators.
Polling
Polls don't actually execute any action — rather they are an on-chain community sentiment gathering tool.
Polling transactions come in 2 flavors:
StartPoll: Encoded in Root-Chain
SendTransactions
— an Account or Validator begins an on-chain poll. StartPoll transactions cost a higher fee as dictated by governance parameters to prevent spam.VotePoll: Encoded in Root-Chain
SendTransactions
— an Account or Validator signals their sentiment with a vote on an existing poll.
The result of a poll are automatically recorded by the Canopy node deterministically parsing the block for StartPoll
and VotePoll
transactions.
⇨ The results are updated per block as Account and Validator funds change and may be viewed in the web wallet. Results are locked in after EndBlock
and are pruned after a node-configurable expiration height.
Proposals
Canopy has 2 different flavors of Proposal:
DAO Transfer: Distribute treasury funds from the DAO pool to any account
Proposals require approval from +⅔ of the Voting Power of the Root-Chain committee to be finalized.
A Proposal Transaction is created by any community member.
This proposal is exported in JSON format and may be distributed via governance forum.
Once exported, each Validator configures their node to approve or reject the proposal via the web interface. This configures the node to accept or reject this proposal hash when validating the transaction at the Mempool and BFT level.
Once +⅔ of the Voting Power have approved the proposal, the Proposal Transaction may be submitted by any community member to be included in a block. Importantly, the transaction may never be sent before the
StartHeight
ensuring sufficient time to achieve quorum.
It's an expected pattern to execute a poll to check Validator votes and then execute a proposal to execute an action.
Supply Tracker
A supply tracker is a structure that keeps track of the total amount of tokens or funds available across the entire blockchain.
➤ It provides a single source of truth for the overall token supply managed by the network. It conveniently buckets the tokens into useful categories allowing transparency and consistency.
'staked' includes delegations, to calculate stake without delegations, simply staked - delegated_only
Last updated