fsm

package
v0.1.14-snapshot Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 27 Imported by: 0

README

Finite State Machine (FSM) Package

The FSM package is the core protocol component responsible for maintaining and updating the state of the Canopy blockchain as it progresses. It represents the collective state of all accounts, validators, and other relevant data stored on the blockchain. This document provides a comprehensive overview of the FSM module, its components, and how they interact within the Canopy ecosystem.

The FSM can be best understood as the rules by which the blockchain ledger changes. If you think of transactions as commands and the blockchain database as the ledger, the FSM is the protocol that interprets those commands to change the ledger. It serves as both the entry point and the only mechanism through which the blockchain state can be modified, with the exception of automatic state changes that occur at block boundaries.

What is a Finite State Machine?

A Finite State Machine (FSM) is a computational model used to represent and control execution flow. It consists of:

  1. A finite set of states
  2. A finite set of inputs (events)
  3. A transition function that maps state-input pairs to states
  4. An initial state
  5. A set of final states (optional)

In the context of blockchain, an FSM manages the transition from one blockchain state to another as new blocks are added. It ensures that all state transitions follow predefined rules and maintains consistency across the network.

The Role of Canopy's Finite State Machine

In the Canopy blockchain, the FSM module serves as the rules by which the blockchain ledger changes. It is the entry point and the only mechanism through which the blockchain state (ledger) can be modified. The FSM:

  1. State Management: Maintains the current state of all accounts, validators, and other blockchain data
  2. Transaction Processing: Validates and applies transactions to modify the state
  3. Rule Enforcement: Ensures all operations follow the protocol rules
  4. Consensus Support: Providing the state information needed for consensus mechanisms
  5. Governance Implementation: Executing governance decisions that affect the blockchain state

The FSM ensures deterministic execution - given the same input (transactions) and starting state, all nodes will arrive at the identical resulting state, which is crucial for blockchain consensus.

Core Components

The State Machine

The state machine type is the fundamental backbone of the Canopy blockchain, responsible for maintaining and updating the collective state as the blockchain progresses. It represents a comprehensive snapshot of the entire blockchain at any given moment, including all accounts, validators, pools, and other critical data structures.

The state machine acts as a persistent database that tracks every change that occurs on the blockchain. When transactions are processed or blocks are finalized, the state machine updates accordingly, ensuring that all nodes in the network maintain an identical view of the blockchain's current condition.

What makes the state machine particularly powerful is its ability to provide a deterministic representation of the blockchain. This means that given the same sequence of transactions and starting from the same initial state, any node in the network will arrive at exactly the same resulting state. This property is essential for achieving consensus in a distributed system.

The state machine also provides mechanisms for querying current values, such as account balances, validator information, or governance parameters. These queries allow applications built on top of Canopy to access the information they need without having to process the entire blockchain history.

Key aspects of the state machine:

  • Deterministic state transitions ensuring network-wide consistency
  • Persistent storage of all blockchain data
  • Efficient querying mechanisms for accessing current state values
  • Support for complex data structures beyond simple key-value pairs
  • Atomic updates that maintain data integrity during state changes
  • Versioning capabilities that allow for historical state access
Accounts

Accounts are fundamental entities that hold and transfer value within the Canopy blockchain. Each account represents a participant in the network with the ability to hold tokens and initiate transactions.

In Canopy, accounts are identified by unique 20-byte addresses (160 bits) derived from public keys, providing strong collision resistance. This addressing scheme ensures that each account is uniquely identifiable while maintaining a practical address length for use in transactions and user interfaces.

Each account maintains a balance of tokens that can be increased through receiving transfers or rewards, and decreased through sending transfers, paying fees, or other protocol interactions. The account balance is a core part of the blockchain state and is updated atomically during transaction processing to maintain consistency.

Accounts serve as the primary interface through which users interact with the Canopy blockchain. They can initiate various transaction types, including token transfers to other accounts, staking operations for validator participation, governance actions like voting on proposals, and interactions with nested chains.

The security of accounts is maintained through public-key cryptography, with transactions requiring valid signatures from the private key corresponding to the account's address. This ensures that only the legitimate owner of an account can authorize transactions that affect its balance or state.

Committees

Committees are validator sets responsible for consensus across the Canopy network. Committees represent quorums of validators that participate in the Byzantine Fault Tolerant (BFT) consensus process for specific chains within the Canopy ecosystem.

In Canopy's architecture, validators can provide shared security services to any nested chain they choose to participate in. When a validator stakes for a particular Committee, they connect with other Committee members through the P2P layer. Together, these validators execute consensus for their designated nested chain.

The Committee structure is particularly powerful because it enables specialized security for different chains without requiring validators to secure the entire network. The root chain itself functions as just another nested chain, leveraging the network's shared security model. This design allows validators to secure specific sub-chains without being required to validate the root chain itself.

For each nested chain block, the elected leader within a Committee submits a certificate result transaction to the Canopy root chain, encapsulating the results of the quorum's consensus process. This certificate serves as proof that the Committee has reached agreement on the state of their nested chain.

Committees also handle the formation, management, and dissolution of these validator quorums, ensuring that each Committee maintains sufficient security properties while allowing validators the flexibility to participate in multiple Committees simultaneously.

Key aspects of Canopy committees:

  • Management of validator sets for different chains within the Canopy ecosystem
  • Tracking of Committee membership and voting power distribution
  • Handling of validator staking and unstaking processes for Committees
  • Distribution of rewards to Committee members for their consensus participation
  • Implementation of slashing conditions for Byzantine behavior within Committees
  • Support for cross-Committee communication and coordination
Pools

Pools are special fund repositories that operate based on predefined blockchain rules rather than individual control. Unlike accounts which are controlled by private keys, pools are controlled directly by the protocol itself, making them crucial for automated token distribution and protocol-level fund management.

Pools serve as the primary mechanism for token minting and distribution in the Canopy ecosystem. Rather than minting tokens directly to accounts, new tokens are always minted to pools first, and then distributed according to protocol rules. This approach provides a clear audit trail and ensures that token creation follows governance-approved mechanisms.

Each pool has a unique identifier and maintains a balance of funds, similar to an account but without an associated address. The protocol defines specific rules for how funds enter and exit each pool, creating a transparent and predictable system for token economics.

Canopy implements several important pools, including the DAO Treasury Pool for governance-controlled funds, Committee Funds Pool for validator rewards, and Committee Escrow Pool for staked tokens. These pools work together to create a balanced economic system that incentivizes desired behaviors while maintaining protocol security.

The pools interact closely with governance mechanisms, allowing the community to influence how funds are distributed from certain pools. For example, governance proposals can trigger transfers from the DAO Treasury Pool to fund community initiatives or protocol improvements.

Key aspects of pools include:

  • Protocol-controlled fund repositories without individual ownership
  • Structured token minting and distribution pathways
  • Support for multiple specialized pools with different purposes
  • Integration with governance for community-directed fund allocation
  • Transparent accounting of protocol funds and their movements
  • Automated distribution mechanisms based on protocol rules
Transactions

Transactions are the primary mechanism through which changes are made to the blockchain state. Transactions represent user-initiated actions that modify the state according to predefined rules, serving as the interface between users and the blockchain.

Each transaction in Canopy contains specific instructions for how the state should change, along with cryptographic signatures that prove the transaction was authorized by the appropriate parties. When a transaction is included in a block and processed by the FSM, it triggers a series of state transitions that update account balances, validator information, or other relevant data.

Transactions in Canopy support various operations, including token transfers between accounts, validator staking and unstaking, governance actions, and interactions with nested chains. Each transaction type follows specific validation rules to ensure it can be executed correctly and securely.

The transaction processing flow involves several steps: validation to ensure the transaction is well-formed and properly signed, execution to apply the transaction's effects to the state, and finalization to commit the changes permanently. This process is deterministic, meaning that all nodes processing the same transaction will arrive at identical state changes.

Fee mechanisms are built into the transaction system to prevent spam and compensate validators for their work in processing transactions. These fees are automatically deducted from the sender's account and distributed according to protocol rules.

Key aspects transactions in Canopy:

  • Cryptographically secured user instructions for state changes
  • Support for multiple transaction types with different purposes
  • Deterministic execution ensuring network-wide consistency
  • Fee mechanisms to prevent spam and compensate validators
  • Validation rules to ensure transactions are well-formed and authorized
  • Atomic execution to maintain state integrity during processing
Validators

Validators are the entities responsible for securing the Canopy network through participation in consensus. Validators stake tokens as collateral, process transactions, produce blocks, and maintain network security in exchange for rewards.

In Canopy's architecture, validators play a crucial role in the Byzantine Fault Tolerant (BFT) consensus process. They verify transactions, propose and vote on blocks, and ensure that the network reaches agreement on the state of the blockchain. The security of the entire system depends on having a sufficient number of honest validators with adequate stake.

Validators in Canopy have the flexibility to participate in multiple committees, providing security to different nested chains based on their preferences and capabilities. This allows for specialization while maintaining the overall security of the network. Validators stake tokens as a form of economic security, putting their own assets at risk if they behave maliciously.

The validator lifecycle includes several states: staking to join the validator set, active participation in consensus, optional pausing for maintenance, and unstaking to exit completely. During the unstaking period, validators must wait for a governance-controlled number of blocks before their bond is fully returned, during which they remain eligible for slashing if evidence of past misbehavior is discovered.

The Validators component tracks important metrics for each validator, including their voting power (proportional to their stake), uptime, and participation in consensus. These metrics influence reward distribution and help users make informed decisions about which validators to delegate to.

Key aspects of Canopy validators:

  • Management of validator registration, staking, and unstaking processes
  • Tracking of validator participation and performance metrics
  • Implementation of slashing conditions for Byzantine behavior
  • Support for validator pausing and maintenance operations
  • Distribution of rewards based on validator contributions
  • Governance mechanisms for adjusting validator parameters

Core Concepts in Canopy

Subsidization

Subsidization is the creation and distribution of newly minted tokens to support various protocol functions and incentivize desired behaviors. It implements the token emission schedule and ensures that subsidies are distributed according to governance-approved parameters.

In Canopy, subsidization serves multiple purposes: it provides rewards for validators securing the network, funds the DAO treasury for community initiatives, and supports other protocol-level incentives. Rather than minting tokens directly to recipients, all newly created tokens first flow through designated pools, creating a transparent and auditable path for token distribution.

The subsidization rate follows a predetermined schedule that may include gradual reduction over time, similar to Bitcoin's halving mechanism. This approach creates predictable token economics while allowing for some flexibility through governance adjustments to distribution parameters.

Committee subsidization is particularly important, as it provides the economic incentives for validators to secure nested chains. The subsidization component calculates appropriate reward amounts based on factors like committee size, total stake, and network parameters, then distributes these rewards to the relevant committee pools.

Governance plays a crucial role in the subsidization process, allowing the community to adjust parameters like distribution percentages between different pools or modify the overall emission schedule within predefined bounds. This creates a balance between predictability and adaptability in the token economic system.

Key aspects of subsidization:

  • Implementation of token emission schedules and distribution rules
  • Management of subsidy flows through designated protocol pools
  • Support for committee-specific reward calculations and distributions
  • Integration with governance for parameter adjustments
  • Transparent accounting of all subsidization activities
  • Mechanisms for adjusting incentives to maintain network security
Block Rewards

The block rewards system handles the distribution of incentives to participants in the Canopy ecosystem, particularly validators who contribute to network security through consensus participation. It ensures that rewards are calculated fairly and distributed according to protocol rules.

In Canopy, rewards come from multiple sources: newly minted tokens through subsidization, transaction fees collected from users, and other protocol-level incentives. These rewards are first collected in designated pools, then distributed to eligible validators based on their contributions and stake.

The reward distribution process follows a deterministic algorithm that considers factors like validator uptime, voting power, and participation in specific committees. This creates a predictable and fair system that properly incentivizes desired behaviors while maintaining transparency.

Committee rewards are particularly important in Canopy's multi-chain architecture. Validators receive rewards for participating in committee consensus, with reward amounts varying based on the specific committee and its importance to the network. This allows for specialized incentives that align with the security needs of different nested chains.

Governance mechanisms allow the community to adjust reward parameters, such as the distribution percentages between different validator activities or the relative reward weights for different committees. This creates flexibility while maintaining the core incentive structure of the network.

Key aspects of the block reward system:

  • Calculation of rewards based on validator contributions and stake
  • Distribution of rewards from designated pools to eligible participants
  • Support for committee-specific reward structures
  • Transparent accounting of all reward activities
  • Governance mechanisms for adjusting reward parameters
Slashing

Slashing implements the penalty mechanisms that discourage malicious or negligent behavior by validators. It detects violations of protocol rules, calculates appropriate penalties, and executes the slashing of stake as a consequence for these violations.

In Canopy, slashing serves as a critical security mechanism that creates economic consequences for behaviors that could harm the network. When a validator engages in activities like double-signing (voting for conflicting blocks), extended downtime, or other protocol violations, canopy identifies these infractions and imposes penalties proportional to their severity.

The slashing process involves several steps: detection of the violation through evidence submission or automatic monitoring, verification that the violation occurred and is attributable to a specific validator, calculation of the appropriate penalty amount based on governance parameters, and execution of the slash by removing tokens from the validator's stake.

Slashed tokens may be burned (removed from circulation) or redirected to designated pools like the DAO Treasury, depending on governance decisions. This creates additional economic consequences beyond the direct loss to the validator and ensures that the slashing mechanism contributes to the overall token economics of the network.

To protect against long-range attacks, validators remain subject to slashing for a governance-defined period even after they begin the unstaking process. This ensures that validators cannot escape penalties for past misbehavior by quickly unstaking their tokens.

Governance plays an important role in the slashing mechanism, allowing the community to adjust parameters like slash amounts for different violations or the duration of the slashing liability period. This creates a balance between deterrence and fairness in the penalty system.

Key aspects of slashing in Canopy:

  • Detection and verification of protocol violations by validators
  • Calculation of penalties based on violation type and severity
  • Execution of slashes by removing tokens from validator stakes
  • Management of slashed token destinations (burning or redirection)
  • Extended slashing liability during the unstaking period
  • Governance mechanisms for adjusting slashing parameters
Supply Tracking

The Supply Tracker component maintains accurate accounting of all tokens in the Canopy ecosystem, tracking their creation, destruction, and movement between different parts of the system. It provides a comprehensive view of the token supply and its distribution across accounts and pools.

In Canopy, the Supply Tracker serves as the authoritative source of information about the total token supply, including circulating supply (tokens available for transactions), staked supply (tokens bonded by validators), and reserved supply (tokens held in protocol pools). This information is crucial for understanding the token economics of the network and verifying that token creation and destruction follow protocol rules.

The tracking process involves monitoring all operations that affect the token supply, including minting through subsidization, burning through slashing or fee mechanisms, and transfers between accounts and pools. Each of these operations is recorded with appropriate metadata to maintain a complete audit trail.

The Supply Tracker provides important metrics for network participants, including the current inflation rate, the percentage of tokens staked versus circulating, and the distribution of tokens across different protocol pools. These metrics help users make informed decisions about participation in the network.

By maintaining accurate supply information, the Supply Tracker also supports governance processes that depend on understanding the current state of the token economy. This includes decisions about adjusting subsidization rates, modifying fee structures, or allocating funds from protocol pools.

Key aspects of the supply tracker include:

  • Tracking of total, circulating, staked, and reserved token supplies
  • Monitoring of all token creation and destruction events
  • Recording of token movements between accounts and pools
  • Calculation of key economic metrics like inflation rate and stake ratio
  • Support for governance decisions related to token economics
  • Verification that token operations follow protocol rules
Chain Genesis

The Genesis component defines the initial state of the Canopy blockchain at its launch, establishing the starting point from which all subsequent state transitions occur. It represents the foundation of the blockchain and encodes the fundamental parameters and initial distribution of resources.

In Canopy, the genesis state includes several critical elements: initial accounts and their token balances, the initial validator set with their stakes and powers, protocol pools with their starting balances, and governance parameters that control various aspects of the network's operation. This comprehensive initial state ensures that the blockchain begins with a well-defined configuration.

The genesis process involves creating a special "genesis block" that does not reference any previous blocks and contains the complete initial state. This block serves as the anchor for the blockchain and is agreed upon by all participants before the network launches. Once the network is live, the genesis state cannot be altered except through the normal state transition rules defined by the protocol.

Genesis configuration is particularly important for establishing the economic and governance foundations of the network. It defines the initial token distribution, which influences the decentralization and power dynamics of the network from the start. It also sets baseline parameters for important protocol functions like staking requirements, reward rates, and governance thresholds.

For testing and development purposes, Canopy supports the creation of custom genesis states that can be used to launch test networks with specific configurations. This allows developers to experiment with different initial conditions and parameter settings without affecting the main network.

Key aspects of this component include:

  • Definition of the initial blockchain state at network launch
  • Configuration of initial accounts, validators, and token distribution
  • Establishment of baseline protocol parameters and governance settings
  • Creation of the genesis block as the anchor for the blockchain
  • Support for custom genesis configurations for testing and development
  • Immutability of genesis state after network launch
Governance

The Governance component enables on-chain decision-making processes that allow the Canopy community to control protocol parameters and resource allocation without requiring software upgrades. It implements mechanisms for proposal submission, voting, and execution of approved changes.

Canopy features two distinct on-chain governance mechanisms: Polling for gathering community sentiment, and Proposals for making binding changes to the protocol. These mechanisms work together to create a comprehensive governance system that balances efficiency with community input.

Polling serves as a non-binding sentiment gathering tool, allowing any account or validator to initiate an on-chain vote on any topic. Polls have a defined end block and require a higher fee to prevent spam. While polls don't directly execute any actions, they provide valuable signals about community preferences that can inform subsequent binding proposals.

Proposals come in two varieties: Change Parameter proposals for updating governance parameters without software changes, and DAO Transfer proposals for distributing funds from the DAO Treasury pool. Proposals require approval from two-thirds of the voting power of the Root-Chain committee to be finalized and executed.

The governance process follows a structured flow: proposal submission with a deposit to prevent spam, a voting period during which eligible participants can cast their votes, a tallying phase to determine the outcome, and execution of approved proposals through automatic state changes. This process ensures that governance actions are transparent, fair, and follow predetermined rules.

Governance parameters themselves can be adjusted through the governance process, allowing the system to evolve over time based on community needs. This creates a flexible framework that can adapt to changing circumstances while maintaining stability through well-defined processes.

Key aspects of governance in Canopy:

  • Dual governance mechanisms for sentiment gathering and binding decisions
  • Support for parameter changes and treasury fund distribution
  • Structured proposal lifecycle from submission to execution
  • Voting mechanisms with appropriate security and weight calculations
  • Automatic execution of approved governance actions
  • Self-modifying capability through governance parameter adjustments
Swap

The Swap component facilitates the exchange of tokens between different accounts or between accounts and pools within the Canopy ecosystem. It implements the rules and mechanisms for these exchanges, ensuring they occur atomically and according to protocol-defined parameters.

In Canopy, swaps serve multiple purposes: they enable direct peer-to-peer token exchanges, support protocol-level operations like staking and unstaking, and facilitate interactions with liquidity pools or other financial primitives built into the protocol. Each swap operation follows specific validation rules to ensure it can be executed correctly and securely.

The swap process involves several steps: validation to ensure the swap is well-formed and authorized by the relevant parties, execution to move tokens between the specified accounts or pools, and finalization to commit the changes permanently to the blockchain state. This process is atomic, meaning that either the entire swap succeeds or it fails completely, preventing partial or inconsistent state changes.

Swaps can be initiated through various transaction types, including direct transfer transactions, staking operations, governance actions, or specialized swap transactions. Each type follows its own rules while leveraging the common swap infrastructure to ensure consistent and secure token movements.

Swapping works closely with accounts and pools to manage the actual token movements, updating balances atomically and ensuring that all operations follow protocol rules. It also interacts with other components like Validators and Governance that depend on token movements for their operations.

Key aspects of this component include:

  • Atomic token exchange operations between accounts and pools
  • Support for various swap types with different purposes and rules
  • Validation mechanisms to ensure swaps are authorized and valid
  • Integration with other components that depend on token movements
  • Deterministic execution ensuring network-wide consistency
  • Transaction fee handling for swap operations
Automatic State Changes

Automatic state changes are processes that occur without manual intervention, executing predetermined operations at specific blockchain events like block beginnings and endings. It ensures that critical protocol functions continue reliably without requiring explicit transactions.

In Canopy, automatic state changes serve several important purposes: they distribute rewards to validators at regular intervals, apply inflation through token minting according to the emission schedule, execute approved governance decisions when their time comes, and perform housekeeping operations like pruning expired data or updating cumulative metrics.

The begin-block and end-block functionality is particularly important, as it defines operations that occur automatically at the boundaries of each block. Begin-block operations typically include setup tasks for the new block, while end-block operations handle finalization tasks like reward distribution, validator set updates, and parameter changes from executed governance proposals.

Automatic state changes follow deterministic rules, ensuring that all nodes in the network will execute exactly the same operations given the same blockchain state. This determinism is crucial for maintaining consensus across the network, as automatic operations modify the blockchain state just like regular transactions.

Key aspects of this component include:

  • Execution of predetermined operations at block boundaries
  • Distribution of rewards and application of inflation
  • Implementation of approved governance decisions
  • Housekeeping operations for blockchain maintenance
  • Deterministic execution ensuring network-wide consistency
Byzantine Behavior Detection

Byzantine behavior is an action by validators or other participants that deviate from the protocol rules, whether due to malicious intent or technical failures. It ensures that the network can maintain consensus and security even in the presence of such behavior.

In Canopy, Byzantine fault tolerance is a critical property that allows the network to function correctly as long as no more than one-third of the validator voting power is compromised. The Byzantine component supports this property through detection mechanisms for common Byzantine behaviors, evidence handling for proven violations, and penalty systems to discourage such behaviors.

Common Byzantine behaviors addressed by byzantine behavior detection include double-signing (voting for conflicting blocks), equivocation (sending different messages to different peers), extended downtime (failing to participate in consensus), and various forms of censorship or selective message propagation. Each of these behaviors has specific detection mechanisms and appropriate penalties.

The evidence handling process involves collecting cryptographic proof of Byzantine behavior, validating this evidence to ensure it's legitimate, and processing it to apply the appropriate penalties through slashing. Evidence can be submitted by any validator who observes Byzantine behavior, creating a distributed detection system.

Key aspects of this component include:

  • Detection mechanisms for various forms of Byzantine behavior
  • Evidence collection, validation, and processing workflows
  • Integration with the Slashes component for penalty application
  • Protection against long-range and other sophisticated attacks
  • Threshold mechanisms for critical operations
  • Contribution to the overall Byzantine fault tolerance of the network

Component Interactions

How Transactions Modify Accounts
sequenceDiagram
    participant User
    participant Transaction
    participant StateMachine
    participant Account
    
    User->>Transaction: Create and sign transaction
    Transaction->>StateMachine: Submit transaction
    StateMachine->>Account: Verify sender balance
    Account-->>StateMachine: Return balance
    StateMachine->>StateMachine: Validate transaction
    StateMachine->>Account: Deduct amount from sender
    StateMachine->>Account: Add amount to recipient
    StateMachine-->>User: Return transaction result

When a user initiates a transaction to transfer tokens, the process involves multiple components working together. First, the user creates and cryptographically signs a transaction specifying the recipient address and amount. This transaction is submitted to the State Machine, which verifies that the sender has sufficient balance by checking their account.

If the validation passes, the State Machine updates both the sender's and recipient's accounts, deducting the amount from one and adding it to the other. This state change is recorded in the blockchain, making it permanent and transparent.

The transaction processing ensures atomicity - either the entire transaction succeeds, or it fails completely without partial changes. This maintains the integrity of account balances and prevents issues like double-spending.

Staking Sequence
sequenceDiagram
    participant Validator
    participant FSM
    participant Account
    participant Pool
    participant Committee
    
    Validator->>FSM: Submit stake transaction
    FSM->>Account: Verify sufficient funds
    FSM->>Pool: Transfer tokens to Committee Escrow Pool
    FSM->>Committee: Register validator
    Committee->>Committee: Calculate new voting power
    Committee->>Validator: Confirm staking
    
    Note over Validator,Committee: Validator now participates in consensus
    
    Validator->>FSM: Submit unstake transaction
    FSM->>Committee: Mark validator as unstaking
    FSM->>Committee: Calculate unstaking completion block
    
    Note over Validator,Committee: Waiting period for security
    
    FSM->>Committee: Check if unstaking period complete
    FSM->>Pool: Transfer tokens from Escrow to Account
    FSM->>Committee: Remove validator
    Committee->>Committee: Recalculate voting powers

The staking process in Canopy involves a carefully orchestrated sequence of interactions between validators and several FSM components. This sequence ensures secure validator participation while maintaining the economic security of the network.

When a validator decides to stake tokens and join a committee, they submit a stake transaction to the FSM. The FSM first verifies that the validator's account has sufficient funds for the stake amount. Once verified, the tokens are transferred from the validator's account to the Committee Escrow Pool, where they remain locked as collateral against Byzantine behavior.

After the tokens are escrowed, the validator is registered with the appropriate committee, and their voting power is calculated based on their stake amount. The committee then confirms the staking, and the validator begins participating in consensus for that committee's chain. This might involve connecting to other committee members via the P2P layer and starting to propose and vote on blocks.

If a validator needs temporary maintenance, they can submit a pause transaction, which temporarily removes them from consensus participation without unstaking their tokens. This status can continue for a governance-defined maximum period before automatic unstaking occurs.

When a validator decides to exit completely, they submit an unstake transaction. The committee marks the validator as unstaking and calculates the completion block based on governance parameters. During this waiting period (which might be several days or weeks), the validator no longer participates in consensus but their tokens remain escrowed and subject to slashing for any previously committed violations.

Once the unstaking period completes, the FSM transfers the tokens from the Escrow Pool back to the validator's account (minus any slashes that occurred), and removes the validator from the committee. The committee then recalculates voting powers for the remaining validators to maintain proper consensus weights.

This entire sequence balances the need for flexible validator participation with the security requirements of a Byzantine-resistant consensus system.

Documentation

Index

Constants

View Source
const (
	PoolPageName     = "pools"    // name for page of 'Pools'
	AccountsPageName = "accounts" // name for page of 'Accounts'
)
View Source
const (
	ParamPrefixCons = "/c/" // store key prefix for Consensus param space
	ParamPrefixVal  = "/v/" // store key prefix for Validators param space
	ParamPrefixFee  = "/f/" // store key prefix for Fee param space
	ParamPrefixGov  = "/g/" // store key prefix for Gov param space

	ParamSpaceCons = "cons" // name of Consensus param space
	ParamSpaceVal  = "val"  // name of Validator param space
	ParamSpaceFee  = "fee"  // name of Fee param space
	ParamSpaceGov  = "gov"  // name of Governance param space

	Delimiter = "/" // standard delimiter for protocol version

	AcceptAllProposals  = GovProposalVoteConfig_ACCEPT_ALL
	ProposalApproveList = GovProposalVoteConfig_APPROVE_LIST
	RejectAllProposals  = GovProposalVoteConfig_REJECT_ALL
)
View Source
const (
	ParamBlockSize       = "blockSize"       // size of the block - header
	ParamProtocolVersion = "protocolVersion" // current protocol version (upgrade enforcement)
	ParamRetired         = "retired"         // if the chain is marking itself as 'retired' to the root-chain making it forever un-subsidized
	ParamRootChainId     = "rootChainID"     // the chain id of the root chain (source of the validator set)
)
View Source
const (
	ParamUnstakingBlocks                    = "unstakingBlocks"                    // number of blocks a committee member must be 'unstaking' for
	ParamMaxPauseBlocks                     = "maxPauseBlocks"                     // maximum blocks a validator may be paused for before force-unstaking
	ParamNonSignSlashPercentage             = "nonSignSlashPercentage"             // how much a non-signer is slashed if exceeds threshold in window (% of stake)
	ParamMaxNonSign                         = "maxNonSign"                         // how much a committee member can not sign before being slashed
	ParamNonSignWindow                      = "nonSignWindow"                      // how frequently the non-sign-count is reset
	ParamDoubleSignSlashPercentage          = "doubleSignSlashPercentage"          // how much a double signer is slashed (% of stake)
	ParamMaxCommittees                      = "maxCommittees"                      // maximum number of committees a single validator may participate in
	ParamMaxCommitteeSize                   = "maxCommitteeSize"                   // maximum number of members a committee may have
	ParamEarlyWithdrawalPenalty             = "earlyWithdrawalPenalty"             // reduction percentage of non-compounded rewards
	ParamDelegateUnstakingBlocks            = "delegateUnstakingBlocks"            // number of blocks a delegator must be 'unstaking' for
	ParamMinimumOrderSize                   = "minimumOrderSize"                   // minimum sell tokens in a sell order
	ParamStakePercentForSubsidizedCommittee = "stakePercentForSubsidizedCommittee" // the minimum percentage of total stake needed to be a 'paid committee'
	ParamMaxSlashPerCommittee               = "maxSlashPerCommittee"               // the maximum validator slash per committee per block
	ParamDelegateRewardPercentage           = "delegateRewardPercentage"           // the percentage of the block reward that is awarded to the delegates
	ParamBuyDeadlineBlocks                  = "buyDeadlineBlocks"                  // the amount of blocks a 'buyer' has to complete an order they reserved
	ParamLockOrderFeeMultiplier             = "lockOrderFeeMultiplier"             // the fee multiplier of the 'send' fee that is required to execute a lock order
	ParamMinimumStakeForValidators          = "minimumStakeForValidators"          // minimum stake required to be a validator
	ParamMinimumStakeForDelegates           = "minimumStakeForDelegates"           // minimum stake required to be a delegate
	ParamMaximumDelegatesPerCommittee       = "maximumDelegatesPerCommittee"       // maximum number of delegates per committee
)
View Source
const (
	ParamSendFee               = "sendFee"               // transaction fee for MessageSend
	ParamStakeFee              = "stakeFee"              // transaction fee for MessageStake
	ParamEditStakeFee          = "editStakeFee"          // transaction fee for MessageEditStake
	ParamUnstakeFee            = "unstakeFee"            // transaction fee for MessageUnstake
	ParamPauseFee              = "pauseFee"              // transaction fee for MessagePause
	ParamUnpauseFee            = "unpauseFee"            // transaction fee for MessageUnpause
	ParamChangeParameterFee    = "changeParameterFee"    // transaction fee for MessageChangeParameter
	ParamDAOTransferFee        = "daoTransferFee"        // transaction fee for MessageDAOTransfer
	ParamCertificateResultsFee = "certificateResultsFee" // transaction fee for MessageCertificateResults
	ParamSubsidyFee            = "subsidyFee"            // transaction fee for MessageSubsidy
	ParamCreateOrderFee        = "createOrderFee"        // transaction fee for MessageCreateOrder
	ParamEditOrderFee          = "editOrderFee"          // transaction fee for MessageEditOrder
	ParamDeleteOrderFee        = "deleteOrderFee"        // transaction fee for MessageDeleteOrder
)
View Source
const (
	// Names for each Transaction Message (payload) type
	MessageSendName               = "send"
	MessageStakeName              = "stake"
	MessageUnstakeName            = "unstake"
	MessageEditStakeName          = "editStake"
	MessagePauseName              = "pause"
	MessageUnpauseName            = "unpause"
	MessageChangeParameterName    = "changeParameter"
	MessageDAOTransferName        = "daoTransfer"
	MessageCertificateResultsName = "certificateResults"
	MessageSubsidyName            = "subsidy"
	MessageCreateOrderName        = "createOrder"
	MessageEditOrderName          = "editOrder"
	MessageDeleteOrderName        = "deleteOrder"
)
View Source
const (
	ValidatorsPageName     = "validators"           // name for page of 'Validators'
	ConsValidatorsPageName = "consensus_validators" // name for page of 'Consensus Validators' (only essential val info needed for consensus)
)
View Source
const BlockAcceptanceRange = 4320

define some safe +/- tx indexer prune height

View Source
const CNPYContractAddress = `0x0000000000000000000000000000000000000001`

CNPYContractAddress: (CNPY) a fake contract address that allows tools to send/receive CNPY as if it's an ERC20

View Source
const CreateOrderSelector = "bc2e8e5f" // while the signature is createOrder(bytes), Canopy expects (selector + proto-bytes)
View Source
const (
	CurrentProtocolVersion = 1
)
View Source
const DeleteOrderSelector = "6c4650e7" // while the signature is deleteOrder(bytes), Canopy expects (selector + proto-bytes)
View Source
const EditOrderSelector = "74e78d6f" // while the signature is editOrder(bytes), Canopy expects (selector + proto-bytes)
View Source
const EditStakeSelector = "8c71a515" // while the signature is editStake(bytes), Canopy expects (selector + proto-bytes)
View Source
const EscrowPoolAddend = math.MaxUint16

EscrowPoolAddend is used to translate a chainId into the id for the 'swap' escrow pool Example: pools[chainId] -> stake pool && pools[chainId+EscrowPoolAddend] -> escrow pool for token swaps

View Source
const (
	ParamDAORewardPercentage = "daoRewardPercentage" // percent of rewards the DAO fund receives
)
View Source
const RLPIndicator = "RLP"

RLPIndicator is a human-readable indicator the tx is translated from RLP

View Source
const SendSelector = "a9059cbb" // transfer(address,uint256) # Canopy expects valid ABI encoding to be 100% compatible with send tooling
View Source
const StakeSelector = "2d1e0c02" // while the signature is stake(bytes), Canopy expects (selector + proto-bytes)
View Source
const StakedCNPYContractAddress = `0x0000000000000000000000000000000000000002`

StakedCNPYContractAddress: (stCNPY) a fake contract address that allows tools to stake, edit, and unstake CNPY as a delegator

View Source
const SubsidySelector = "16d68b09" // while the signature is subsidy(bytes), Canopy expects (selector + proto-bytes)
View Source
const SwapCNPYContractAddress = `0x0000000000000000000000000000000000000003`

SwapCNPYContractAddress: (swCNPY) a fake contract address that allows tools to create a sell order, edit a sell order, and delete a sell order

View Source
const UnstakeSelector = "3c3653e2" // while the signature is unstake(bytes), Canopy expects (selector + proto-bytes)

Variables

View Source
var (
	GovProposalVoteConfig_name = map[int32]string{
		0: "ACCEPT_ALL",
		1: "APPROVE_LIST",
		2: "REJECT_ALL",
	}
	GovProposalVoteConfig_value = map[string]int32{
		"ACCEPT_ALL":   0,
		"APPROVE_LIST": 1,
		"REJECT_ALL":   2,
	}
)

Enum value maps for GovProposalVoteConfig.

View Source
var (
	// the number of tokens in micro denomination that are initially (before halvenings) minted per block
	InitialTokensPerBlock = 80 * 1000000 // 80 CNPY
	// the number of blocks between each halvening (block reward is cut in half) event
	BlocksPerHalvening = 3150000 // ~ 2 years - 20 second blocks
)
View Source
var File_account_proto protoreflect.FileDescriptor
View Source
var File_genesis_proto protoreflect.FileDescriptor
View Source
var File_message_proto protoreflect.FileDescriptor
View Source
var File_validator_proto protoreflect.FileDescriptor
View Source
var ReservedIDs = []uint64{
	lib.UnknownChainId,
	lib.DAOPoolID,
}

ReservedIds ensures Validators can't stake for 'reserved ids'

Functions

func AccountPrefix

func AccountPrefix() []byte

- Prefixes are used to allow 'grouping' and organization in a schemaless key-value database environment

- Segments are used to allow 'sub-groupings' ex. CommitteeKey allows iteration over all committees (CommitteePrefix) or a specific committee (CommitteePrefix+CommitteeId)

- Iterating over a prefix enables operations over groups of similar datastructures (accounts, validators, params etc.)

- Length prefixed append is used to be able to easily separate the segments of a key

- BigEndianEncoding is used for uint64 to accommodate the 'lexicographical' sorting nature of the key-value database

func AddressFromKey

func AddressFromKey(k []byte) (crypto.AddressI, lib.ErrorI)

func CanopyIdsToEVMChainId

func CanopyIdsToEVMChainId(chainId, networkId uint64) uint64

CanopyIdsToEVMChainId() converts a chainId and networkId to an evm chain ID

func CheckNetAddress

func CheckNetAddress(netAddress string, isDelegate bool) lib.ErrorI

CheckNetAddress() validates the p2p address in the Message

func CommitteePrefix

func CommitteePrefix(id uint64) []byte

func CommitteesDataPrefix

func CommitteesDataPrefix() []byte

func DelegatePrefix

func DelegatePrefix(id uint64) []byte

func DownscaleTo6Decimals

func DownscaleTo6Decimals(amount *big.Int) uint64

DownscaleTo6Decimals converts from 18-decimal unit (Ethereum RPC) to 6-decimal (Canopy native)

func ErrAddressEmpty

func ErrAddressEmpty() lib.ErrorI

func ErrAddressSize

func ErrAddressSize() lib.ErrorI

func ErrDuplicateLockOrder

func ErrDuplicateLockOrder() lib.ErrorI

func ErrEmptyCertificateResults

func ErrEmptyCertificateResults() lib.ErrorI

func ErrEmptyConsParams

func ErrEmptyConsParams() lib.ErrorI

func ErrEmptyFeeParams

func ErrEmptyFeeParams() lib.ErrorI

func ErrEmptyGovParams

func ErrEmptyGovParams() lib.ErrorI

func ErrEmptySignature

func ErrEmptySignature() lib.ErrorI

func ErrEmptyValParams

func ErrEmptyValParams() lib.ErrorI

func ErrInsufficientFunds

func ErrInsufficientFunds() lib.ErrorI

func ErrInsufficientSupply

func ErrInsufficientSupply() lib.ErrorI

func ErrInvalidAmount

func ErrInvalidAmount() lib.ErrorI

func ErrInvalidBlockRange

func ErrInvalidBlockRange() lib.ErrorI

func ErrInvalidBuyerDeadline

func ErrInvalidBuyerDeadline() lib.ErrorI

func ErrInvalidCertificateResults

func ErrInvalidCertificateResults() lib.ErrorI

func ErrInvalidChainId

func ErrInvalidChainId() lib.ErrorI

func ErrInvalidCheckpoint

func ErrInvalidCheckpoint() lib.ErrorI

func ErrInvalidCloseOrder

func ErrInvalidCloseOrder() lib.ErrorI

func ErrInvalidERC20Tx

func ErrInvalidERC20Tx(err error) lib.ErrorI

func ErrInvalidKey

func ErrInvalidKey(key []byte) lib.ErrorI

func ErrInvalidLockOrder

func ErrInvalidLockOrder() lib.ErrorI

func ErrInvalidNetAddressLen

func ErrInvalidNetAddressLen() lib.ErrorI

func ErrInvalidNumCommittees

func ErrInvalidNumCommittees() lib.ErrorI

func ErrInvalidNumOfSamples

func ErrInvalidNumOfSamples() lib.ErrorI

func ErrInvalidOpcode

func ErrInvalidOpcode() lib.ErrorI

func ErrInvalidParam

func ErrInvalidParam(paramName string) lib.ErrorI

func ErrInvalidProposalHash

func ErrInvalidProposalHash() lib.ErrorI

func ErrInvalidProtocolVersion

func ErrInvalidProtocolVersion() lib.ErrorI

func ErrInvalidPublicKey

func ErrInvalidPublicKey(err error) lib.ErrorI

func ErrInvalidRLPTx

func ErrInvalidRLPTx(err error) lib.ErrorI

func ErrInvalidSignature

func ErrInvalidSignature() lib.ErrorI

func ErrInvalidStartPollHeight

func ErrInvalidStartPollHeight() lib.ErrorI

func ErrInvalidSubisdy

func ErrInvalidSubisdy() lib.ErrorI

func ErrInvalidTxMessage

func ErrInvalidTxMessage() lib.ErrorI

func ErrMaxBlockSize

func ErrMaxBlockSize() lib.ErrorI

func ErrMinimumOrderSize

func ErrMinimumOrderSize() lib.ErrorI

func ErrMismatchCertResults

func ErrMismatchCertResults() lib.ErrorI

func ErrNonSubsidizedCommittee

func ErrNonSubsidizedCommittee() lib.ErrorI

func ErrNotEmpty

func ErrNotEmpty() lib.ErrorI

func ErrOutputAddressEmpty

func ErrOutputAddressEmpty() lib.ErrorI

func ErrOutputAddressSize

func ErrOutputAddressSize() lib.ErrorI

func ErrParamKeyEmpty

func ErrParamKeyEmpty() lib.ErrorI

func ErrParamValueEmpty

func ErrParamValueEmpty() lib.ErrorI

func ErrPublicKeyEmpty

func ErrPublicKeyEmpty() lib.ErrorI

func ErrPublicKeySize

func ErrPublicKeySize() lib.ErrorI

func ErrReadGenesisFile

func ErrReadGenesisFile(err error) lib.ErrorI

func ErrRecipientAddressEmpty

func ErrRecipientAddressEmpty() lib.ErrorI

func ErrRecipientAddressSize

func ErrRecipientAddressSize() lib.ErrorI

func ErrRejectProposal

func ErrRejectProposal() lib.ErrorI

func ErrSlashNonExistentValidator

func ErrSlashNonExistentValidator() lib.ErrorI

func ErrStakeBelowMininum

func ErrStakeBelowMininum() lib.ErrorI

func ErrTxFeeBelowStateLimit

func ErrTxFeeBelowStateLimit() lib.ErrorI

func ErrTxSignBytes

func ErrTxSignBytes(err error) lib.ErrorI

func ErrUnauthorizedTx

func ErrUnauthorizedTx() lib.ErrorI

func ErrUnknownMessage

func ErrUnknownMessage(x lib.MessageI) lib.ErrorI

func ErrUnknownParam

func ErrUnknownParam() lib.ErrorI

func ErrUnknownParamSpace

func ErrUnknownParamSpace() lib.ErrorI

func ErrUnknownParamType

func ErrUnknownParamType(t any) lib.ErrorI

func ErrUnmarshalGenesis

func ErrUnmarshalGenesis(err error) lib.ErrorI

func ErrValidatorExists

func ErrValidatorExists() lib.ErrorI

func ErrValidatorIsADelegate

func ErrValidatorIsADelegate() lib.ErrorI

func ErrValidatorNotExists

func ErrValidatorNotExists() lib.ErrorI

func ErrValidatorNotPaused

func ErrValidatorNotPaused() lib.ErrorI

func ErrValidatorPaused

func ErrValidatorPaused() lib.ErrorI

func ErrValidatorUnstaking

func ErrValidatorUnstaking() lib.ErrorI

func ErrWrongStoreType

func ErrWrongStoreType() lib.ErrorI

func EvmChainIdToCanopyIds

func EvmChainIdToCanopyIds(evmChainId uint64) (chainId, networkId uint64)

EvmChainIdToCanopyIds() converts an EVM chainId to a Canopy chain id

func FilterAndSortPool

func FilterAndSortPool(x *[]*Pool)

filterAndSort() removes zero and nil elements from the pool slice and then sorts the slice by amount finally setting the result to the pointer from the parameter

func FormatParamSpace

func FormatParamSpace(paramSpace string) string

FormatParamSpace() converts a user inputted ParamSpace string into the proper ParamSpace name

func IdFromKey

func IdFromKey(k []byte) (uint64, lib.ErrorI)

func InvalidSellOrder

func InvalidSellOrder() lib.ErrorI

func KeyForAccount

func KeyForAccount(addr crypto.AddressI) []byte

func KeyForCommittee

func KeyForCommittee(chainId uint64, addr crypto.AddressI, stake uint64) []byte

func KeyForDelegate

func KeyForDelegate(chainId uint64, addr crypto.AddressI, stake uint64) []byte

func KeyForNonSigner

func KeyForNonSigner(a []byte) []byte

func KeyForOrder

func KeyForOrder(chainId uint64, orderId []byte) []byte

func KeyForParams

func KeyForParams(s string) []byte

func KeyForPaused

func KeyForPaused(maxPausedHeight uint64, address crypto.AddressI) []byte

func KeyForPool

func KeyForPool(n uint64) []byte

func KeyForRetiredCommittee

func KeyForRetiredCommittee(cId uint64) []byte

func KeyForUnstaking

func KeyForUnstaking(height uint64, address crypto.AddressI) []byte

func KeyForValidator

func KeyForValidator(addr crypto.AddressI) []byte

func LastProposersPrefix

func LastProposersPrefix() []byte

func NewCertificateResultsTx

func NewCertificateResultsTx(from crypto.PrivateKeyI, qc *lib.QuorumCertificate, rootChainId, networkId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewCertificateResultsTx() creates a CertificateResultsTransaction object in the interface form of TransactionI

func NewChangeParamTxString

func NewChangeParamTxString(from crypto.PrivateKeyI, space, key, value string, start, end, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewChangeParamTxString() creates a ChangeParamTransaction object (for strings) in the interface form of TransactionI

func NewChangeParamTxUint64

func NewChangeParamTxUint64(from crypto.PrivateKeyI, space, key string, value, start, end, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewChangeParamTxUint64() creates a ChangeParamTransaction object (for uint64s) in the interface form of TransactionI

func NewCloseOrderTx

func NewCloseOrderTx(from crypto.PrivateKeyI, order lib.CloseOrder, buyersReceiveAddress crypto.AddressI, amount, networkId, chainId, fee, height uint64) (lib.TransactionI, lib.ErrorI)

NewCloseOrderTx() completes the purchase of a sell order using a send-tx and the memo field

func NewCreateOrderTx

func NewCreateOrderTx(from crypto.PrivateKeyI, sellAmount, requestAmount, committeeId uint64, data lib.HexBytes, receiveAddress []byte, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewCreateOrderTx() creates a CreateOrderTransaction object in the interface form of TransactionI

func NewDAOTransferTx

func NewDAOTransferTx(from crypto.PrivateKeyI, amount, start, end, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewDAOTransferTx() creates a DAOTransferTransaction object in the interface form of TransactionI

func NewDeleteOrderTx

func NewDeleteOrderTx(from crypto.PrivateKeyI, orderId string, committeeId uint64, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewDeleteOrderTx() creates an DeleteOrderTransaction object in the interface form of TransactionI

func NewEditOrderTx

func NewEditOrderTx(from crypto.PrivateKeyI, orderId string, sellAmount, requestAmount, committeeId uint64, data lib.HexBytes, receiveAddress []byte, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewEditOrderTx() creates an EditOrderTransaction object in the interface form of TransactionI

func NewEditStakeTx

func NewEditStakeTx(signer crypto.PrivateKeyI, from, outputAddress crypto.AddressI, netAddress string, committees []uint64, amount, networkId, chainId, fee, height uint64, earlyWithdrawal bool, memo string) (lib.TransactionI, lib.ErrorI)

NewEditStakeTx() creates a EditStakeTransaction object in the interface form of TransactionI

func NewLockOrderTx

func NewLockOrderTx(from crypto.PrivateKeyI, order lib.LockOrder, networkId, chainId, fee, height uint64) (lib.TransactionI, lib.ErrorI)

NewLockOrderTx() reserves a sell order using a send-tx and the memo field

func NewPauseTx

func NewPauseTx(signer crypto.PrivateKeyI, from crypto.AddressI, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewPauseTx() creates a PauseTransaction object in the interface form of TransactionI

func NewProtocolVersion

func NewProtocolVersion(height uint64, version uint64) string

NewProtocolVersion() creates a properly formatted protocol version string

func NewSendTransaction

func NewSendTransaction(from crypto.PrivateKeyI, to crypto.AddressI, amount, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewSendTransaction() creates a SendTransaction object in the interface form of TransactionI

func NewStakeTx

func NewStakeTx(signer crypto.PrivateKeyI, from lib.HexBytes, outputAddress crypto.AddressI, netAddress string, committees []uint64, amount, networkId, chainId, fee, height uint64, delegate, earlyWithdrawal bool, memo string) (lib.TransactionI, lib.ErrorI)

NewStakeTx() creates a StakeTransaction object in the interface form of TransactionI

func NewStartPollTransaction

func NewStartPollTransaction(from crypto.PrivateKeyI, pollJSON json.RawMessage, networkId, chainId, fee, height uint64) (lib.TransactionI, lib.ErrorI)

NewStartPollTransaction() isn't an actual transaction type - rather it's a protocol built on top of send transactions to allow simple straw polling on Canopy. This model is plugin specific and does not need to be followed for other chains.

func NewSubsidyTx

func NewSubsidyTx(from crypto.PrivateKeyI, amount, committeeId uint64, opCode lib.HexBytes, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewSubsidyTx() creates a SubsidyTransaction object in the interface form of TransactionI

func NewTransaction

func NewTransaction(pk crypto.PrivateKeyI, msg lib.MessageI, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewTransaction() creates a Transaction object from a message in the interface form of TransactionI

func NewUnpauseTx

func NewUnpauseTx(signer crypto.PrivateKeyI, from crypto.AddressI, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewUnpauseTx() creates a UnpauseTransaction object in the interface form of TransactionI

func NewUnstakeTx

func NewUnstakeTx(signer crypto.PrivateKeyI, from crypto.AddressI, networkId, chainId, fee, height uint64, memo string) (lib.TransactionI, lib.ErrorI)

NewUnstakeTx() creates a UnstakeTransaction object in the interface form of TransactionI

func NewVotePollTransaction

func NewVotePollTransaction(from crypto.PrivateKeyI, pollJSON json.RawMessage, approve bool, networkId, chainId, fee, height uint64) (lib.TransactionI, lib.ErrorI)

NewVotePollTransaction() isn't an actual transaction type - rather it's a protocol built on top of send transactions to allow simple straw polling on Canopy. This model is plugin specific and does not need to be followed for other chains.

func NonSignerPrefix

func NonSignerPrefix() []byte

func OrderBookPrefix

func OrderBookPrefix(cId uint64) []byte

func PausedPrefix

func PausedPrefix(height uint64) []byte

func PoolPrefix

func PoolPrefix() []byte

func RLPToCanopyTransaction

func RLPToCanopyTransaction(txBytes []byte) (transaction *lib.Transaction, e lib.ErrorI)

RLPToCanopyTransaction() converts an RLP encoded transaction into a Canopy transaction

func RetiredCommitteesPrefix

func RetiredCommitteesPrefix() []byte

func SupplyPrefix

func SupplyPrefix() []byte

func TxHashFromJSON

func TxHashFromJSON(transactionJSON json.RawMessage) (txHash string, err lib.ErrorI)

TxHashFromJSON converts the json transaction into a proto tx hash

func UnstakingPrefix

func UnstakingPrefix(h uint64) []byte

func UpscaleTo18Decimals

func UpscaleTo18Decimals(amount uint64) *big.Int

UpscaleTo18Decimals converts a 6-decimal unit (Canopy native) to 18-decimal (Ethereum RPC)

func ValidatorPrefix

func ValidatorPrefix() []byte

Types

type Account

type Account struct {

	// address: the short version of a public key
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount: the balance of funds the account has
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ An account is a structure that holds funds and can send or receive transactions using a crypto key pair Each account has a unique address and a balance, think a bank account - but managed by the blockchain instead of a bank

func (*Account) Descriptor deprecated

func (*Account) Descriptor() ([]byte, []int)

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetAddress

func (x *Account) GetAddress() []byte

func (*Account) GetAmount

func (x *Account) GetAmount() uint64

func (*Account) MarshalJSON

func (x *Account) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the Account object

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

func (x *Account) ProtoReflect() protoreflect.Message

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

func (*Account) UnmarshalJSON

func (x *Account) UnmarshalJSON(bz []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for the Account object

type AccountPage

type AccountPage []*Account

func (*AccountPage) New

func (p *AccountPage) New() lib.Pageable

AccountPage satisfies the Page interface

type ActivePolls

type ActivePolls struct {
	Polls    map[string]map[string]bool `json:"activePolls"` // [poll_hash] -> [address hex] -> Vote
	PollMeta map[string]*StartPoll      `json:"pollMeta"`    // [poll_hash] -> StartPoll structure
}

ActivePolls is the in-memory representation of the polls.json file Contains a list of all active polls

func (*ActivePolls) CheckForPollTransaction

func (p *ActivePolls) CheckForPollTransaction(sender crypto.AddressI, memo string, height uint64) lib.ErrorI

CheckForPollTransaction() populates the poll.json file from embeds if the embed exists in the memo field

func (*ActivePolls) Cleanup

func (p *ActivePolls) Cleanup(height uint64)

Cleanup() adds polls to 'closed' section if past end height and removes any polls that are older than 4 weeks

func (*ActivePolls) NewFromFile

func (p *ActivePolls) NewFromFile(dataDirPath string) lib.ErrorI

NewFromFile() creates a new polls object from a file

func (*ActivePolls) NewPoll

func (p *ActivePolls) NewPoll(startPoll *StartPoll)

NewPoll() creates a new poll from the start poll embed

func (*ActivePolls) SaveToFile

func (p *ActivePolls) SaveToFile(dataDirPath string) lib.ErrorI

SaveToFile() persists the polls object to a json file

func (*ActivePolls) VotePoll

func (p *ActivePolls) VotePoll(sender crypto.AddressI, votePoll *VotePoll, height uint64)

VotePoll() upserts a vote to a specific poll

type CheckTxResult

type CheckTxResult struct {
	// contains filtered or unexported fields
}

CheckTxResult is the result object from CheckTx()

type ConsValidatorPage

type ConsValidatorPage []*lib.ConsensusValidator

func (*ConsValidatorPage) New

func (p *ConsValidatorPage) New() lib.Pageable

ConsValidatorPage satisfies the Page interface

type ConsensusParams

type ConsensusParams struct {

	// block_size: is the maximum allowed size of a block (not including the header)
	BlockSize uint64 `protobuf:"varint,1,opt,name=block_size,json=blockSize,proto3" json:"blockSize"` // @gotags: json:"blockSize"
	// protocol_version: is the minimum protocol standard that nodes must run to participate in the network
	ProtocolVersion string `protobuf:"bytes,2,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocolVersion"` // @gotags: json:"protocolVersion"
	// root_chain_id: the identifier of the root chain (source of the validator set)
	RootChainId uint64 `protobuf:"varint,3,opt,name=root_chain_id,json=rootChainId,proto3" json:"rootChainID"` // @gotags: json:"rootChainID"
	// retired: have the validators agreed to stop this chain and mark it as 'forever un-subsidized' in the base chain
	Retired uint64 `protobuf:"varint,4,opt,name=retired,proto3" json:"retired,omitempty"`
	// contains filtered or unexported fields
}

ConsensusParams is the parameter space that defines how nodes in the blockchain agree on the state of the ledger

func (*ConsensusParams) Check

func (x *ConsensusParams) Check() lib.ErrorI

Check() validates the consensus params

func (*ConsensusParams) Descriptor deprecated

func (*ConsensusParams) Descriptor() ([]byte, []int)

Deprecated: Use ConsensusParams.ProtoReflect.Descriptor instead.

func (*ConsensusParams) GetBlockSize

func (x *ConsensusParams) GetBlockSize() uint64

func (*ConsensusParams) GetProtocolVersion

func (x *ConsensusParams) GetProtocolVersion() string

func (*ConsensusParams) GetRetired

func (x *ConsensusParams) GetRetired() uint64

func (*ConsensusParams) GetRootChainId

func (x *ConsensusParams) GetRootChainId() uint64

func (*ConsensusParams) ParseProtocolVersion

func (x *ConsensusParams) ParseProtocolVersion() (*ProtocolVersion, lib.ErrorI)

ParseProtocolVersion() validates the format of the Protocol version string and returns the ProtocolVersion object

func (*ConsensusParams) ProtoMessage

func (*ConsensusParams) ProtoMessage()

func (*ConsensusParams) ProtoReflect

func (x *ConsensusParams) ProtoReflect() protoreflect.Message

func (*ConsensusParams) Reset

func (x *ConsensusParams) Reset()

func (*ConsensusParams) SetString

func (x *ConsensusParams) SetString(paramName string, value string) lib.ErrorI

SetString() update a string parameter in the structure

func (*ConsensusParams) SetUint64

func (x *ConsensusParams) SetUint64(paramName string, value uint64) lib.ErrorI

SetUint64() update a uint64 parameter in the structure

func (*ConsensusParams) String

func (x *ConsensusParams) String() string

type FeeParams

type FeeParams struct {

	// send_fee: is the fee amount (in uCNPY) for Message Send
	SendFee uint64 `protobuf:"varint,1,opt,name=send_fee,json=sendFee,proto3" json:"sendFee"` // @gotags: json:"sendFee"
	// stake_fee: is the fee amount (in uCNPY) for Message Stake
	StakeFee uint64 `protobuf:"varint,2,opt,name=stake_fee,json=stakeFee,proto3" json:"stakeFee"` // @gotags: json:"stakeFee"
	// edit_stake_fee: is the fee amount (in uCNPY) for Message Edit-Stake
	EditStakeFee uint64 `protobuf:"varint,3,opt,name=edit_stake_fee,json=editStakeFee,proto3" json:"editStakeFee"` // @gotags: json:"editStakeFee"
	// unstake_stake_fee: is the fee amount (in uCNPY) for Message Unstake
	UnstakeFee uint64 `protobuf:"varint,4,opt,name=unstake_fee,json=unstakeFee,proto3" json:"unstakeFee"` // @gotags: json:"unstakeFee"
	// pause_fee: is the fee amount (in uCNPY) for Message Pause
	PauseFee uint64 `protobuf:"varint,5,opt,name=pause_fee,json=pauseFee,proto3" json:"pauseFee"` // @gotags: json:"pauseFee"
	// unpause_fee: is the fee amount (in uCNPY) for Message Unpause
	UnpauseFee uint64 `protobuf:"varint,6,opt,name=unpause_fee,json=unpauseFee,proto3" json:"unpauseFee"` // @gotags: json:"unpauseFee"
	// change_parameter_fee: is the fee amount (in uCNPY) for Message Change Parameter
	ChangeParameterFee uint64 `protobuf:"varint,7,opt,name=change_parameter_fee,json=changeParameterFee,proto3" json:"changeParameterFee"` // @gotags: json:"changeParameterFee"
	// dao_transfer: is the fee amount (in uCNPY) for Message DAO transfer
	DaoTransferFee uint64 `protobuf:"varint,8,opt,name=dao_transfer_fee,json=daoTransferFee,proto3" json:"daoTransferFee"` // @gotags: json:"daoTransferFee"
	// certificate_results_fee: is the fee amount (in uCNPY) for Message Certificate Results
	CertificateResultsFee uint64 `protobuf:"varint,9,opt,name=certificate_results_fee,json=certificateResultsFee,proto3" json:"certificateResultsFee"` // @gotags: json:"certificateResultsFee"
	// subsidy_fee: is the fee amount (in uCNPY) for Message Subsidy
	SubsidyFee uint64 `protobuf:"varint,10,opt,name=subsidy_fee,json=subsidyFee,proto3" json:"subsidyFee"` // @gotags: json:"subsidyFee"
	// create_order_fee: is the fee amount (in uCNPY) for Message Create Order
	CreateOrderFee uint64 `protobuf:"varint,11,opt,name=create_order_fee,json=createOrderFee,proto3" json:"createOrderFee"` // @gotags: json:"createOrderFee"
	// edit_order_fee: is the fee amount (in uCNPY) for Message Edit Order
	EditOrderFee uint64 `protobuf:"varint,12,opt,name=edit_order_fee,json=editOrderFee,proto3" json:"editOrderFee"` // @gotags: json:"editOrderFee"
	// delete_order_fee: is the fee amount (in uCNPY) for Message Delete Order
	DeleteOrderFee uint64 `protobuf:"varint,13,opt,name=delete_order_fee,json=deleteOrderFee,proto3" json:"deleteOrderFee"` // @gotags: json:"deleteOrderFee"
	// contains filtered or unexported fields
}

FeeParams is the parameter space that defines various amounts for transaction fees

func (*FeeParams) Check

func (x *FeeParams) Check() lib.ErrorI

Check() validates the Fee params

func (*FeeParams) Descriptor deprecated

func (*FeeParams) Descriptor() ([]byte, []int)

Deprecated: Use FeeParams.ProtoReflect.Descriptor instead.

func (*FeeParams) GetCertificateResultsFee

func (x *FeeParams) GetCertificateResultsFee() uint64

func (*FeeParams) GetChangeParameterFee

func (x *FeeParams) GetChangeParameterFee() uint64

func (*FeeParams) GetCreateOrderFee

func (x *FeeParams) GetCreateOrderFee() uint64

func (*FeeParams) GetDaoTransferFee

func (x *FeeParams) GetDaoTransferFee() uint64

func (*FeeParams) GetDeleteOrderFee

func (x *FeeParams) GetDeleteOrderFee() uint64

func (*FeeParams) GetEditOrderFee

func (x *FeeParams) GetEditOrderFee() uint64

func (*FeeParams) GetEditStakeFee

func (x *FeeParams) GetEditStakeFee() uint64

func (*FeeParams) GetPauseFee

func (x *FeeParams) GetPauseFee() uint64

func (*FeeParams) GetSendFee

func (x *FeeParams) GetSendFee() uint64

func (*FeeParams) GetStakeFee

func (x *FeeParams) GetStakeFee() uint64

func (*FeeParams) GetSubsidyFee

func (x *FeeParams) GetSubsidyFee() uint64

func (*FeeParams) GetUnpauseFee

func (x *FeeParams) GetUnpauseFee() uint64

func (*FeeParams) GetUnstakeFee

func (x *FeeParams) GetUnstakeFee() uint64

func (*FeeParams) ProtoMessage

func (*FeeParams) ProtoMessage()

func (*FeeParams) ProtoReflect

func (x *FeeParams) ProtoReflect() protoreflect.Message

func (*FeeParams) Reset

func (x *FeeParams) Reset()

func (*FeeParams) SetString

func (x *FeeParams) SetString(_ string, _ string) lib.ErrorI

SetString() update a string parameter in the structure

func (*FeeParams) SetUint64

func (x *FeeParams) SetUint64(paramName string, value uint64) lib.ErrorI

SetUint64() update a uint64 parameter in the structure

func (*FeeParams) String

func (x *FeeParams) String() string

type GenesisState

type GenesisState struct {

	// time: the start time of the blockchain network
	Time uint64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"`
	// pools: a list of all the auto controlled accounts
	Pools []*Pool `protobuf:"bytes,2,rep,name=pools,proto3" json:"pools,omitempty"`
	// accounts: a list of all the user controlled accounts
	Accounts []*Account `protobuf:"bytes,3,rep,name=accounts,proto3" json:"accounts,omitempty"`
	// validators: a list of all the staked validators
	Validators []*Validator `protobuf:"bytes,4,rep,name=validators,proto3" json:"validators,omitempty"`
	// non_signers: a count of validators who haven't signed in some 'non-sign-window' of blocks
	// this field is not importable
	NonSigners []*NonSigner `protobuf:"bytes,5,rep,name=non_signers,json=nonSigners,proto3" json:"nonSigners"` // @gotags: json:"nonSigners"
	// double_signers: a list of those who 'double-signed' and the heights they double signed on
	// this field is not importable
	DoubleSigners []*lib.DoubleSigner `protobuf:"bytes,6,rep,name=double_signers,json=doubleSigners,proto3" json:"doubleSigners"` // @gotags: json:"doubleSigners"
	// order_books: is a list of active sell orders
	OrderBooks *lib.OrderBooks `protobuf:"bytes,7,opt,name=order_books,json=orderBooks,proto3" json:"orderBooks"` // @gotags: json:"orderBooks"
	// params: is a list of governance parameters and their respective values
	Params *Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"`
	// supply: keeps track of the total amount of tokens or funds available across the entire blockchain
	// this field is not importable (auto generated using pools, accounts, validators etc.)
	Supply *Supply `protobuf:"bytes,9,opt,name=supply,proto3" json:"supply,omitempty"`
	// committees_data: is current status information about the current status of all committees
	// this field is not importable
	Committees *lib.CommitteesData `protobuf:"bytes,10,opt,name=committees,proto3" json:"committees,omitempty"`
	// retired committees: a list of the chain ids that are permanently retired
	RetiredCommittees []uint64 `protobuf:"varint,11,rep,packed,name=retired_committees,json=retiredCommittees,proto3" json:"retiredComittees"` // @gotags: json:"retiredComittees"
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ GenesisState is an importable and exportable structure that is representative of the blockchain state at a certain height. The main use-cases for the Genesis state are acting as block 0 and analyzing the state db in json form. Please note that Block 0 is ofter referred to as the 'genesis' block

func (*GenesisState) Descriptor deprecated

func (*GenesisState) Descriptor() ([]byte, []int)

Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.

func (*GenesisState) GetAccounts

func (x *GenesisState) GetAccounts() []*Account

func (*GenesisState) GetCommittees

func (x *GenesisState) GetCommittees() *lib.CommitteesData

func (*GenesisState) GetDoubleSigners

func (x *GenesisState) GetDoubleSigners() []*lib.DoubleSigner

func (*GenesisState) GetNonSigners

func (x *GenesisState) GetNonSigners() []*NonSigner

func (*GenesisState) GetOrderBooks

func (x *GenesisState) GetOrderBooks() *lib.OrderBooks

func (*GenesisState) GetParams

func (x *GenesisState) GetParams() *Params

func (*GenesisState) GetPools

func (x *GenesisState) GetPools() []*Pool

func (*GenesisState) GetRetiredCommittees

func (x *GenesisState) GetRetiredCommittees() []uint64

func (*GenesisState) GetSupply

func (x *GenesisState) GetSupply() *Supply

func (*GenesisState) GetTime

func (x *GenesisState) GetTime() uint64

func (*GenesisState) GetValidators

func (x *GenesisState) GetValidators() []*Validator

func (*GenesisState) MarshalJSON

func (x *GenesisState) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the GenesisState object

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) ProtoReflect

func (x *GenesisState) ProtoReflect() protoreflect.Message

func (*GenesisState) Reset

func (x *GenesisState) Reset()

func (*GenesisState) String

func (x *GenesisState) String() string

func (*GenesisState) UnmarshalJSON

func (x *GenesisState) UnmarshalJSON(bz []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for the GenesisState object

type GovProposal

type GovProposal interface {
	proto.Message
	GetStartHeight() uint64
	GetEndHeight() uint64
	GetProposalHash() string
}

GovProposal is an interface that all proposals that may be polled for and voted on must conform to

type GovProposalVoteConfig

type GovProposalVoteConfig int32

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ GovProposalVoteConfig is the configuration for nodes to handle 'governance proposal transactions' like DAO Transfer or Change Parameter

const (
	// accept_all is the default mode for 'non-consensus' where all inbound governance proposals are accepted
	GovProposalVoteConfig_ACCEPT_ALL GovProposalVoteConfig = 0
	// approve_list is the default mode for Validators who are active in BFT. This refers to their local approve list in
	// their data directory
	GovProposalVoteConfig_APPROVE_LIST GovProposalVoteConfig = 1
	// reject_all is a mode that turns on if problems are detected during the consensus process, ensuring the proposal
	// process doesn't contribute to a chain halt
	GovProposalVoteConfig_REJECT_ALL GovProposalVoteConfig = 2
)

func (GovProposalVoteConfig) Descriptor

func (GovProposalVoteConfig) Enum

func (GovProposalVoteConfig) EnumDescriptor deprecated

func (GovProposalVoteConfig) EnumDescriptor() ([]byte, []int)

Deprecated: Use GovProposalVoteConfig.Descriptor instead.

func (GovProposalVoteConfig) Number

func (GovProposalVoteConfig) String

func (x GovProposalVoteConfig) String() string

func (GovProposalVoteConfig) Type

type GovProposalWithVote

type GovProposalWithVote struct {
	Proposal json.RawMessage `json:"proposal"`
	Approve  bool            `json:"approve"`
}

GovProposalWithVote is a wrapper over a GovProposal but contains an approval / disapproval boolean

type GovProposals

type GovProposals map[string]GovProposalWithVote

GovProposals is a list of GovProposalsWithVote keyed by the transaction hash of the underlying proposal transaction

func (GovProposals) Add

func (p GovProposals) Add(proposalTransaction json.RawMessage, approve bool) (err lib.ErrorI)

Add() adds a GovProposalWithVote to the list

func (GovProposals) Del

func (p GovProposals) Del(proposalTransaction json.RawMessage) (err error)

Del() removes a GovProposalWithVote from the list

func (*GovProposals) NewFromFile

func (p *GovProposals) NewFromFile(dataDirPath string) lib.ErrorI

NewFromFile() creates a new polls object from a file

func (*GovProposals) SaveToFile

func (p *GovProposals) SaveToFile(dataDirPath string) lib.ErrorI

SaveToFile() persists the polls object to a json file

type GovernanceParams

type GovernanceParams struct {

	// dao_reward_percent: is the percent of the block reward that is sent to the DAO
	DaoRewardPercentage uint64 `protobuf:"varint,1,opt,name=dao_reward_percentage,json=daoRewardPercentage,proto3" json:"daoRewardPercentage"` // @gotags: json:"daoRewardPercentage"
	// contains filtered or unexported fields
}

GovernanceParams is the parameter space that define the rules that enable decentralized and autonomous governing of the network

func (*GovernanceParams) Check

func (x *GovernanceParams) Check() lib.ErrorI

Check() validates the Governance params

func (*GovernanceParams) Descriptor deprecated

func (*GovernanceParams) Descriptor() ([]byte, []int)

Deprecated: Use GovernanceParams.ProtoReflect.Descriptor instead.

func (*GovernanceParams) GetDaoRewardPercentage

func (x *GovernanceParams) GetDaoRewardPercentage() uint64

func (*GovernanceParams) ProtoMessage

func (*GovernanceParams) ProtoMessage()

func (*GovernanceParams) ProtoReflect

func (x *GovernanceParams) ProtoReflect() protoreflect.Message

func (*GovernanceParams) Reset

func (x *GovernanceParams) Reset()

func (*GovernanceParams) SetString

func (x *GovernanceParams) SetString(_ string, _ string) lib.ErrorI

SetString() update a string parameter in the structure

func (*GovernanceParams) SetUint64

func (x *GovernanceParams) SetUint64(paramName string, value uint64) lib.ErrorI

SetUint64() update a uint64 parameter in the structure

func (*GovernanceParams) String

func (x *GovernanceParams) String() string

type MessageCertificateResults

type MessageCertificateResults struct {

	// qc: a super-majority signed quorum certificate from a recently completed BFT process (COMMIT_PROCESS phase)
	Qc *lib.QuorumCertificate `protobuf:"bytes,1,opt,name=qc,proto3" json:"qc,omitempty"`
	// contains filtered or unexported fields
}

MessageCertificateResults is a summary from the Leader of a recently completed BFT process in the form of a Quorum Certificate signed by a super-majority of the committee members at a given height. This message defines committee treasury pool recipients, slash recipients, sell orders actions, and checkpoints

func (*MessageCertificateResults) Check

Check() validates the Message structure

func (*MessageCertificateResults) Descriptor deprecated

func (*MessageCertificateResults) Descriptor() ([]byte, []int)

Deprecated: Use MessageCertificateResults.ProtoReflect.Descriptor instead.

func (*MessageCertificateResults) GetQc

func (MessageCertificateResults) MarshalJSON

func (x MessageCertificateResults) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageProposal

func (*MessageCertificateResults) Name

func (*MessageCertificateResults) New

func (*MessageCertificateResults) ProtoMessage

func (*MessageCertificateResults) ProtoMessage()

func (*MessageCertificateResults) ProtoReflect

func (*MessageCertificateResults) Recipient

func (x *MessageCertificateResults) Recipient() []byte

func (*MessageCertificateResults) Reset

func (x *MessageCertificateResults) Reset()

func (*MessageCertificateResults) String

func (x *MessageCertificateResults) String() string

func (*MessageCertificateResults) UnmarshalJSON

func (x *MessageCertificateResults) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageProposal

type MessageChangeParameter

type MessageChangeParameter struct {

	// parameter_space: is the organization path where the parameter is found (val, cons, fee, gov)
	ParameterSpace string `protobuf:"bytes,1,opt,name=parameter_space,json=parameterSpace,proto3" json:"parameterSpace"` // @gotags: json:"parameterSpace"
	// parameter_key: is the name of the parameter
	ParameterKey string `protobuf:"bytes,2,opt,name=parameter_key,json=parameterKey,proto3" json:"parameterKey"` // @gotags: json:"parameterKey"
	// parameter_value: is the uint64 or string value of the parameter
	ParameterValue *anypb.Any `protobuf:"bytes,3,opt,name=parameter_value,json=parameterValue,proto3" json:"parameterValue"` // @gotags: json:"parameterValue"
	// start_height: is the beginning height where the parameter must be sent
	// this field locks in a block-range when it's converted to JSON and allows Validators a deadline to vote
	StartHeight uint64 `protobuf:"varint,4,opt,name=start_height,json=startHeight,proto3" json:"startHeight"` // @gotags: json:"startHeight"
	// end_height: is the ending height where the parameter must be sent
	// this field locks in a block-range when it's converted to JSON and allows Validators a deadline to vote
	EndHeight uint64 `protobuf:"varint,5,opt,name=end_height,json=endHeight,proto3" json:"endHeight"` // @gotags: json:"endHeight"
	// signer: is the address of the sender / creator of the proposal
	// this field locks in an author of the transaction when it's converted to JSON
	Signer []byte `protobuf:"bytes,6,opt,name=signer,proto3" json:"signer,omitempty"`
	// proposal_hash: internal use only, tracks the hash of the proposal to check against the proposals.json file
	ProposalHash string `protobuf:"bytes,7,opt,name=proposal_hash,json=proposalHash,proto3" json:"proposalHash"` // @gotags: json:"proposalHash"
	// contains filtered or unexported fields
}

MessageChangeParameter is a governance proposal message used to modify a governance parameter This type of message must be manually pre-approved by +2/3rds of the Validators via their APPROVE_LIST In short, a 'proposer' generates the message JSON, communicates the JSON to Validators, Validators vote by populating their APPROVE_LIST which configures how they'll vote during the consensus process when a block includes this transaction in it.

func (*MessageChangeParameter) Check

func (x *MessageChangeParameter) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageChangeParameter) Descriptor deprecated

func (*MessageChangeParameter) Descriptor() ([]byte, []int)

Deprecated: Use MessageChangeParameter.ProtoReflect.Descriptor instead.

func (*MessageChangeParameter) GetEndHeight

func (x *MessageChangeParameter) GetEndHeight() uint64

func (*MessageChangeParameter) GetParameterKey

func (x *MessageChangeParameter) GetParameterKey() string

func (*MessageChangeParameter) GetParameterSpace

func (x *MessageChangeParameter) GetParameterSpace() string

func (*MessageChangeParameter) GetParameterValue

func (x *MessageChangeParameter) GetParameterValue() *anypb.Any

func (*MessageChangeParameter) GetProposalHash

func (x *MessageChangeParameter) GetProposalHash() string

func (*MessageChangeParameter) GetSigner

func (x *MessageChangeParameter) GetSigner() []byte

func (*MessageChangeParameter) GetStartHeight

func (x *MessageChangeParameter) GetStartHeight() uint64

func (MessageChangeParameter) MarshalJSON

func (x MessageChangeParameter) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageChangeParameter

func (*MessageChangeParameter) Name

func (x *MessageChangeParameter) Name() string

func (*MessageChangeParameter) New

func (*MessageChangeParameter) ProtoMessage

func (*MessageChangeParameter) ProtoMessage()

func (*MessageChangeParameter) ProtoReflect

func (x *MessageChangeParameter) ProtoReflect() protoreflect.Message

func (*MessageChangeParameter) Recipient

func (x *MessageChangeParameter) Recipient() []byte

func (*MessageChangeParameter) Reset

func (x *MessageChangeParameter) Reset()

func (*MessageChangeParameter) String

func (x *MessageChangeParameter) String() string

func (*MessageChangeParameter) UnmarshalJSON

func (x *MessageChangeParameter) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageChangeParameter

type MessageCreateOrder

type MessageCreateOrder struct {

	// chain_id: the id of the committee that is responsible for the 'counter asset' the uCNPY will swapped for
	ChainId uint64 `protobuf:"varint,1,opt,name=ChainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// data: a generic data field which can allow a committee to execute specific functionality for the swap
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data"` // @gotags: json:"data"
	// amount_for_sale: the amount of uCNPY listed for sale, transferred to escrow
	AmountForSale uint64 `protobuf:"varint,3,opt,name=AmountForSale,proto3" json:"amountForSale"` // @gotags: json:"amountForSale"
	// requested_amount: the amount of the 'counter asset' the buyer must send in order to complete a swap
	RequestedAmount uint64 `protobuf:"varint,4,opt,name=RequestedAmount,proto3" json:"requestAmount"` // @gotags: json:"requestAmount"
	// sellers_receive_address: the address of the seller where the 'counter asset' will be received
	SellerReceiveAddress []byte `protobuf:"bytes,5,opt,name=SellerReceiveAddress,proto3" json:"sellerReceiveAddress"` // @gotags: json:"sellerReceiveAddress"
	// sellers_send_address: the Canopy address the seller is selling and signing from
	SellersSendAddress []byte `protobuf:"bytes,6,opt,name=SellersSendAddress,proto3" json:"sellersSendAddress"` // @gotags: json:"sellersSendAddress"
	// OrderId: auto-populated by the state machine to assign the unique bytes to the order
	OrderId []byte `protobuf:"bytes,7,opt,name=OrderId,proto3" json:"OrderId,omitempty"`
	// contains filtered or unexported fields
}

MessageCreateOrder creates a new token swap 'sell order', removing tokens from the sender account and transferring them to an escrow pool while awaiting a buyer

func (*MessageCreateOrder) Check

func (x *MessageCreateOrder) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageCreateOrder) Descriptor deprecated

func (*MessageCreateOrder) Descriptor() ([]byte, []int)

Deprecated: Use MessageCreateOrder.ProtoReflect.Descriptor instead.

func (*MessageCreateOrder) GetAmountForSale

func (x *MessageCreateOrder) GetAmountForSale() uint64

func (*MessageCreateOrder) GetChainId

func (x *MessageCreateOrder) GetChainId() uint64

func (*MessageCreateOrder) GetData

func (x *MessageCreateOrder) GetData() []byte

func (*MessageCreateOrder) GetOrderId

func (x *MessageCreateOrder) GetOrderId() []byte

func (*MessageCreateOrder) GetRequestedAmount

func (x *MessageCreateOrder) GetRequestedAmount() uint64

func (*MessageCreateOrder) GetSellerReceiveAddress

func (x *MessageCreateOrder) GetSellerReceiveAddress() []byte

func (*MessageCreateOrder) GetSellersSendAddress

func (x *MessageCreateOrder) GetSellersSendAddress() []byte

func (*MessageCreateOrder) MarshalJSON

func (x *MessageCreateOrder) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageCreateOrder

func (*MessageCreateOrder) Name

func (x *MessageCreateOrder) Name() string

func (*MessageCreateOrder) New

func (x *MessageCreateOrder) New() lib.MessageI

func (*MessageCreateOrder) ProtoMessage

func (*MessageCreateOrder) ProtoMessage()

func (*MessageCreateOrder) ProtoReflect

func (x *MessageCreateOrder) ProtoReflect() protoreflect.Message

func (*MessageCreateOrder) Recipient

func (x *MessageCreateOrder) Recipient() []byte

func (*MessageCreateOrder) Reset

func (x *MessageCreateOrder) Reset()

func (*MessageCreateOrder) String

func (x *MessageCreateOrder) String() string

func (*MessageCreateOrder) UnmarshalJSON

func (x *MessageCreateOrder) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageCreateOrder

type MessageDAOTransfer

type MessageDAOTransfer struct {

	// address: is the recipient address and sender of this message
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount: is the amount of
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// start_height: is the beginning height where the parameter must be sent
	// this field locks in a block-range when it's converted to JSON and allows Validators a deadline to vote
	StartHeight uint64 `protobuf:"varint,4,opt,name=start_height,json=startHeight,proto3" json:"startHeight"` // @gotags: json:"startHeight"
	// end_height: is the ending height where the parameter must be sent
	// this field locks in a block-range when it's converted to JSON and allows Validators a deadline to vote
	EndHeight uint64 `protobuf:"varint,5,opt,name=end_height,json=endHeight,proto3" json:"startHeight"` // @gotags: json:"startHeight"
	// proposal_hash: internal use only, tracks the hash of the proposal to check against the proposals.json file
	ProposalHash string `protobuf:"bytes,6,opt,name=proposal_hash,json=proposalHash,proto3" json:"proposalHash"` // @gotags: json:"proposalHash"
	// contains filtered or unexported fields
}

MessageDAOTransfer is a governance proposal message used to send funds from the DAO pool to an account This type of message must be manually pre-approved by +2/3rds of the Validators via their APPROVE_LIST In short, a 'proposer' generates the message JSON, communicates the JSON to Validators, Validators vote by populating their APPROVE_LIST which configures how they'll vote during the consensus process when a block includes this transaction in it.

func (*MessageDAOTransfer) Check

func (x *MessageDAOTransfer) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageDAOTransfer) Descriptor deprecated

func (*MessageDAOTransfer) Descriptor() ([]byte, []int)

Deprecated: Use MessageDAOTransfer.ProtoReflect.Descriptor instead.

func (*MessageDAOTransfer) GetAddress

func (x *MessageDAOTransfer) GetAddress() []byte

func (*MessageDAOTransfer) GetAmount

func (x *MessageDAOTransfer) GetAmount() uint64

func (*MessageDAOTransfer) GetEndHeight

func (x *MessageDAOTransfer) GetEndHeight() uint64

func (*MessageDAOTransfer) GetProposalHash

func (x *MessageDAOTransfer) GetProposalHash() string

func (*MessageDAOTransfer) GetStartHeight

func (x *MessageDAOTransfer) GetStartHeight() uint64

func (MessageDAOTransfer) MarshalJSON

func (x MessageDAOTransfer) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageDAOTransfer

func (*MessageDAOTransfer) Name

func (x *MessageDAOTransfer) Name() string

func (*MessageDAOTransfer) New

func (x *MessageDAOTransfer) New() lib.MessageI

func (*MessageDAOTransfer) ProtoMessage

func (*MessageDAOTransfer) ProtoMessage()

func (*MessageDAOTransfer) ProtoReflect

func (x *MessageDAOTransfer) ProtoReflect() protoreflect.Message

func (*MessageDAOTransfer) Recipient

func (x *MessageDAOTransfer) Recipient() []byte

func (*MessageDAOTransfer) Reset

func (x *MessageDAOTransfer) Reset()

func (*MessageDAOTransfer) String

func (x *MessageDAOTransfer) String() string

func (*MessageDAOTransfer) UnmarshalJSON

func (x *MessageDAOTransfer) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageDAOTransfer

type MessageDeleteOrder

type MessageDeleteOrder struct {

	// order_id: is the number id that is unique to this committee to identify the order
	OrderId []byte `protobuf:"bytes,1,opt,name=OrderId,proto3" json:"orderID"` // @gotags: json:"orderID"
	// chain_id: the id of the committee that is responsible for the 'counter asset' the uCNPY will swapped for
	ChainId uint64 `protobuf:"varint,2,opt,name=ChainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// contains filtered or unexported fields
}

MessageDeleteOrder: deletes an un-claimed token swap 'sell order' If an order is already 'claimed' or 'bought', the order may not be deleted

func (*MessageDeleteOrder) Check

func (x *MessageDeleteOrder) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageDeleteOrder) Descriptor deprecated

func (*MessageDeleteOrder) Descriptor() ([]byte, []int)

Deprecated: Use MessageDeleteOrder.ProtoReflect.Descriptor instead.

func (*MessageDeleteOrder) GetChainId

func (x *MessageDeleteOrder) GetChainId() uint64

func (*MessageDeleteOrder) GetOrderId

func (x *MessageDeleteOrder) GetOrderId() []byte

func (*MessageDeleteOrder) MarshalJSON

func (x *MessageDeleteOrder) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageEditOrder

func (*MessageDeleteOrder) Name

func (x *MessageDeleteOrder) Name() string

func (*MessageDeleteOrder) New

func (x *MessageDeleteOrder) New() lib.MessageI

func (*MessageDeleteOrder) ProtoMessage

func (*MessageDeleteOrder) ProtoMessage()

func (*MessageDeleteOrder) ProtoReflect

func (x *MessageDeleteOrder) ProtoReflect() protoreflect.Message

func (*MessageDeleteOrder) Recipient

func (x *MessageDeleteOrder) Recipient() []byte

func (*MessageDeleteOrder) Reset

func (x *MessageDeleteOrder) Reset()

func (*MessageDeleteOrder) String

func (x *MessageDeleteOrder) String() string

func (*MessageDeleteOrder) UnmarshalJSON

func (x *MessageDeleteOrder) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageEditOrder

type MessageEditOrder

type MessageEditOrder struct {

	// order_id: is the number id that is unique to this committee to identify the order
	// not modifiable, used for order identification only
	OrderId []byte `protobuf:"bytes,1,opt,name=OrderId,proto3" json:"orderID"` // @gotags: json:"orderID"
	// chain_id: the id of the committee that is responsible for the 'counter asset' the uCNPY will swapped for
	// not modifiable, used for order identification only
	ChainId uint64 `protobuf:"varint,2,opt,name=ChainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// data: a generic data field which can allow a committee to execute specific functionality for the swap
	Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data"` // @gotags: json:"data"
	// amount_for_sale: the updated amount of uCNPY listed for sale, a reduction will return escrowed tokens to the seller's
	// send address
	AmountForSale uint64 `protobuf:"varint,4,opt,name=AmountForSale,proto3" json:"amountForSale"` // @gotags: json:"amountForSale"
	// requested_amount: the updated amount of the 'counter asset' the buyer must send in order to complete a swap
	RequestedAmount uint64 `protobuf:"varint,5,opt,name=RequestedAmount,proto3" json:"requestedAmount"` // @gotags: json:"requestedAmount"
	// sellers_receive_address: the address of the seller where the 'counter asset' will be received
	SellerReceiveAddress []byte `protobuf:"bytes,6,opt,name=SellerReceiveAddress,proto3" json:"sellerReceiveAddress"` // @gotags: json:"sellerReceiveAddress"
	// contains filtered or unexported fields
}

MessageEditOrder modifies an un-claimed token swap 'sell order', token amount may be increased or decreased as well as the recipient address If an order is already 'claimed' or 'bought', the order may not be modified

func (*MessageEditOrder) Check

func (x *MessageEditOrder) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageEditOrder) Descriptor deprecated

func (*MessageEditOrder) Descriptor() ([]byte, []int)

Deprecated: Use MessageEditOrder.ProtoReflect.Descriptor instead.

func (*MessageEditOrder) GetAmountForSale

func (x *MessageEditOrder) GetAmountForSale() uint64

func (*MessageEditOrder) GetChainId

func (x *MessageEditOrder) GetChainId() uint64

func (*MessageEditOrder) GetData

func (x *MessageEditOrder) GetData() []byte

func (*MessageEditOrder) GetOrderId

func (x *MessageEditOrder) GetOrderId() []byte

func (*MessageEditOrder) GetRequestedAmount

func (x *MessageEditOrder) GetRequestedAmount() uint64

func (*MessageEditOrder) GetSellerReceiveAddress

func (x *MessageEditOrder) GetSellerReceiveAddress() []byte

func (*MessageEditOrder) MarshalJSON

func (x *MessageEditOrder) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageEditOrder

func (*MessageEditOrder) Name

func (x *MessageEditOrder) Name() string

func (*MessageEditOrder) New

func (x *MessageEditOrder) New() lib.MessageI

func (*MessageEditOrder) ProtoMessage

func (*MessageEditOrder) ProtoMessage()

func (*MessageEditOrder) ProtoReflect

func (x *MessageEditOrder) ProtoReflect() protoreflect.Message

func (*MessageEditOrder) Recipient

func (x *MessageEditOrder) Recipient() []byte

func (*MessageEditOrder) Reset

func (x *MessageEditOrder) Reset()

func (*MessageEditOrder) String

func (x *MessageEditOrder) String() string

func (*MessageEditOrder) UnmarshalJSON

func (x *MessageEditOrder) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageEditOrder

type MessageEditStake

type MessageEditStake struct {

	// address: the short version of the public key, acting as a unique identify linked to the Validator structure
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// amount: the updated amount of tokens being staked. This must be greater than or equal to the previous staked amount
	// The user's account balance is reduced by the difference between the old and new staked amounts
	// (old.Staked_Tokens - message.amount)
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// committees: the update to the committees the validator is restaking their tokens for
	Committees []uint64 `protobuf:"varint,3,rep,packed,name=committees,proto3" json:"committees,omitempty"`
	// net_address: the update to the tcp peer-to-peer address of the peer
	NetAddress string `protobuf:"bytes,4,opt,name=net_address,json=netAddress,proto3" json:"netAddress"` // @gotags: json:"netAddress"
	// output_address: the update to the reward address, only the output address may edit this
	OutputAddress []byte `protobuf:"bytes,5,opt,name=output_address,json=outputAddress,proto3" json:"outputAddress"` // @gotags: json:"outputAddress"
	// compound: the update to the auto-compounding status
	Compound bool `protobuf:"varint,6,opt,name=compound,proto3" json:"compound,omitempty"`
	// signer: this field is needed so that the protocol may save the signer once they're identified by their public key
	// this is necessary because only the output address may edit the output field.
	Signer []byte `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"`
	// contains filtered or unexported fields
}

MessageStake is the Validator modification message, it allows an increase locking up a certain amount of tokens, a change to the committees, the p2p address, the output address, and auto-compounding status To leave fields un-edited, simply use the previous value

func (*MessageEditStake) Check

func (x *MessageEditStake) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageEditStake) Descriptor deprecated

func (*MessageEditStake) Descriptor() ([]byte, []int)

Deprecated: Use MessageEditStake.ProtoReflect.Descriptor instead.

func (*MessageEditStake) GetAddress

func (x *MessageEditStake) GetAddress() []byte

func (*MessageEditStake) GetAmount

func (x *MessageEditStake) GetAmount() uint64

func (*MessageEditStake) GetCommittees

func (x *MessageEditStake) GetCommittees() []uint64

func (*MessageEditStake) GetCompound

func (x *MessageEditStake) GetCompound() bool

func (*MessageEditStake) GetNetAddress

func (x *MessageEditStake) GetNetAddress() string

func (*MessageEditStake) GetOutputAddress

func (x *MessageEditStake) GetOutputAddress() []byte

func (*MessageEditStake) GetSigner

func (x *MessageEditStake) GetSigner() []byte

func (MessageEditStake) MarshalJSON

func (x MessageEditStake) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageEditStake

func (*MessageEditStake) Name

func (x *MessageEditStake) Name() string

func (*MessageEditStake) New

func (x *MessageEditStake) New() lib.MessageI

func (*MessageEditStake) ProtoMessage

func (*MessageEditStake) ProtoMessage()

func (*MessageEditStake) ProtoReflect

func (x *MessageEditStake) ProtoReflect() protoreflect.Message

func (*MessageEditStake) Recipient

func (x *MessageEditStake) Recipient() []byte

func (*MessageEditStake) Reset

func (x *MessageEditStake) Reset()

func (*MessageEditStake) String

func (x *MessageEditStake) String() string

func (*MessageEditStake) UnmarshalJSON

func (x *MessageEditStake) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageEditStake

type MessagePause

type MessagePause struct {

	// address: the short version of the public key, acting as a unique identify linked to the Validator structure
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

MessagePause is the Validator break message, it temporarily removes the Validator from active duty This allows operators a path to gracefully maintain their Validators without fully exiting

func (*MessagePause) Check

func (x *MessagePause) Check() lib.ErrorI

Check() validates the Message structure

func (*MessagePause) Descriptor deprecated

func (*MessagePause) Descriptor() ([]byte, []int)

Deprecated: Use MessagePause.ProtoReflect.Descriptor instead.

func (*MessagePause) GetAddress

func (x *MessagePause) GetAddress() []byte

func (MessagePause) MarshalJSON

func (x MessagePause) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessagePause

func (*MessagePause) Name

func (x *MessagePause) Name() string

func (*MessagePause) New

func (x *MessagePause) New() lib.MessageI

func (*MessagePause) ProtoMessage

func (*MessagePause) ProtoMessage()

func (*MessagePause) ProtoReflect

func (x *MessagePause) ProtoReflect() protoreflect.Message

func (*MessagePause) Recipient

func (x *MessagePause) Recipient() []byte

func (*MessagePause) Reset

func (x *MessagePause) Reset()

func (*MessagePause) String

func (x *MessagePause) String() string

func (*MessagePause) UnmarshalJSON

func (x *MessagePause) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessagePause

type MessageSend

type MessageSend struct {

	// from_address: is the sender of the funds
	FromAddress []byte `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"fromAddress"` // @gotags: json:"fromAddress"
	// to_address: is the recipient of the funds
	ToAddress []byte `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"toAddress"` // @gotags: json:"toAddress"
	// amount: is the amount of tokens in micro-denomination (uCNPY)
	Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ MessageSend is a standard transfer transaction, taking tokens from the sender and transferring them to the recipient

func (*MessageSend) Check

func (x *MessageSend) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageSend) Descriptor deprecated

func (*MessageSend) Descriptor() ([]byte, []int)

Deprecated: Use MessageSend.ProtoReflect.Descriptor instead.

func (*MessageSend) GetAmount

func (x *MessageSend) GetAmount() uint64

func (*MessageSend) GetFromAddress

func (x *MessageSend) GetFromAddress() []byte

func (*MessageSend) GetToAddress

func (x *MessageSend) GetToAddress() []byte

func (MessageSend) MarshalJSON

func (x MessageSend) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageSend

func (*MessageSend) Name

func (x *MessageSend) Name() string

func (*MessageSend) New

func (x *MessageSend) New() lib.MessageI

func (*MessageSend) ProtoMessage

func (*MessageSend) ProtoMessage()

func (*MessageSend) ProtoReflect

func (x *MessageSend) ProtoReflect() protoreflect.Message

func (*MessageSend) Recipient

func (x *MessageSend) Recipient() []byte

func (*MessageSend) Reset

func (x *MessageSend) Reset()

func (*MessageSend) String

func (x *MessageSend) String() string

func (*MessageSend) UnmarshalJSON

func (x *MessageSend) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageSend

type MessageStake

type MessageStake struct {

	// public_key: the public cryptographic identity of the Validator operator that is unique to a users
	// secret private key
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// amount: is the amount of tokens to be removed from the sender account and locked as a surety bond against bad
	// behavior
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// committees: is the list of committees the validator is restaking their tokens towards
	Committees []uint64 `protobuf:"varint,3,rep,packed,name=committees,proto3" json:"committees,omitempty"`
	// net_address: is the tcp peer-to-peer address of the peer
	NetAddress string `protobuf:"bytes,4,opt,name=net_address,json=netAddress,proto3" json:"netAddress"` // @gotags: json:"netAddress"
	// output_address: is the short version of the public key where reward and unstaking funds will be distributed to
	OutputAddress []byte `protobuf:"bytes,5,opt,name=output_address,json=outputAddress,proto3" json:"outputAddress"` // @gotags: json:"outputAddress"
	// delegate: signals whether the Validator is a delegate or not
	Delegate bool `protobuf:"varint,6,opt,name=delegate,proto3" json:"delegate,omitempty"`
	// compound: signals whether the Validator is auto-compounding or not
	Compound bool `protobuf:"varint,7,opt,name=compound,proto3" json:"compound,omitempty"`
	// signer: auto-populated by the state machine to assign the authorized signer who executed the transaction
	Signer []byte `protobuf:"bytes,8,opt,name=signer,proto3" json:"signer,omitempty"`
	// contains filtered or unexported fields
}

MessageStake is the Validator registration message, locking up a certain amount of tokens. Staking as a non-delegate is registering for active participation in the committee(s) consensus process(es), whereas delegate is passive participation that acts as a contribution to which committees are subsidized by the protocol. Either the operator or the sender may originate the stake transaction, but the funds are removed from the sender's account

func (*MessageStake) Check

func (x *MessageStake) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageStake) Descriptor deprecated

func (*MessageStake) Descriptor() ([]byte, []int)

Deprecated: Use MessageStake.ProtoReflect.Descriptor instead.

func (*MessageStake) GetAmount

func (x *MessageStake) GetAmount() uint64

func (*MessageStake) GetCommittees

func (x *MessageStake) GetCommittees() []uint64

func (*MessageStake) GetCompound

func (x *MessageStake) GetCompound() bool

func (*MessageStake) GetDelegate

func (x *MessageStake) GetDelegate() bool

func (*MessageStake) GetNetAddress

func (x *MessageStake) GetNetAddress() string

func (*MessageStake) GetOutputAddress

func (x *MessageStake) GetOutputAddress() []byte

func (*MessageStake) GetPublicKey

func (x *MessageStake) GetPublicKey() []byte

func (*MessageStake) GetSigner

func (x *MessageStake) GetSigner() []byte

func (MessageStake) MarshalJSON

func (x MessageStake) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageStake

func (*MessageStake) Name

func (x *MessageStake) Name() string

func (*MessageStake) New

func (x *MessageStake) New() lib.MessageI

func (*MessageStake) ProtoMessage

func (*MessageStake) ProtoMessage()

func (*MessageStake) ProtoReflect

func (x *MessageStake) ProtoReflect() protoreflect.Message

func (*MessageStake) Recipient

func (x *MessageStake) Recipient() []byte

func (*MessageStake) Reset

func (x *MessageStake) Reset()

func (*MessageStake) String

func (x *MessageStake) String() string

func (*MessageStake) UnmarshalJSON

func (x *MessageStake) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageStake

type MessageSubsidy

type MessageSubsidy struct {

	// address: is the sender of the funds
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// chain_id: is the id of the committee the funds are being sent to
	ChainId uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// amount: is the amount of funds that are taken from the sender and transferred to the recipient pool
	Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	// opcode: a generic code field to allow fund designation instructions
	Opcode []byte `protobuf:"bytes,4,opt,name=opcode,proto3" json:"opcode,omitempty"`
	// contains filtered or unexported fields
}

MessageSubsidy is an account to committee treasury pool transfer transaction At economic maturity without inflation, this is how the network continues to offer its Validation services

func (*MessageSubsidy) Check

func (x *MessageSubsidy) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageSubsidy) Descriptor deprecated

func (*MessageSubsidy) Descriptor() ([]byte, []int)

Deprecated: Use MessageSubsidy.ProtoReflect.Descriptor instead.

func (*MessageSubsidy) GetAddress

func (x *MessageSubsidy) GetAddress() []byte

func (*MessageSubsidy) GetAmount

func (x *MessageSubsidy) GetAmount() uint64

func (*MessageSubsidy) GetChainId

func (x *MessageSubsidy) GetChainId() uint64

func (*MessageSubsidy) GetOpcode

func (x *MessageSubsidy) GetOpcode() []byte

func (MessageSubsidy) MarshalJSON

func (x MessageSubsidy) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageSubsidy

func (*MessageSubsidy) Name

func (x *MessageSubsidy) Name() string

func (*MessageSubsidy) New

func (x *MessageSubsidy) New() lib.MessageI

func (*MessageSubsidy) ProtoMessage

func (*MessageSubsidy) ProtoMessage()

func (*MessageSubsidy) ProtoReflect

func (x *MessageSubsidy) ProtoReflect() protoreflect.Message

func (*MessageSubsidy) Recipient

func (x *MessageSubsidy) Recipient() []byte

func (*MessageSubsidy) Reset

func (x *MessageSubsidy) Reset()

func (*MessageSubsidy) String

func (x *MessageSubsidy) String() string

func (*MessageSubsidy) UnmarshalJSON

func (x *MessageSubsidy) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageSubsidy

type MessageUnpause

type MessageUnpause struct {

	// address: the short version of the public key, acting as a unique identify linked to the Validator structure
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

MessageUnpause is the Validator return message, it re-enlists the Validator to active duty

func (*MessageUnpause) Check

func (x *MessageUnpause) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageUnpause) Descriptor deprecated

func (*MessageUnpause) Descriptor() ([]byte, []int)

Deprecated: Use MessageUnpause.ProtoReflect.Descriptor instead.

func (*MessageUnpause) GetAddress

func (x *MessageUnpause) GetAddress() []byte

func (MessageUnpause) MarshalJSON

func (x MessageUnpause) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageUnpause

func (*MessageUnpause) Name

func (x *MessageUnpause) Name() string

func (*MessageUnpause) New

func (x *MessageUnpause) New() lib.MessageI

func (*MessageUnpause) ProtoMessage

func (*MessageUnpause) ProtoMessage()

func (*MessageUnpause) ProtoReflect

func (x *MessageUnpause) ProtoReflect() protoreflect.Message

func (*MessageUnpause) Recipient

func (x *MessageUnpause) Recipient() []byte

func (*MessageUnpause) Reset

func (x *MessageUnpause) Reset()

func (*MessageUnpause) String

func (x *MessageUnpause) String() string

func (*MessageUnpause) UnmarshalJSON

func (x *MessageUnpause) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageUnpause

type MessageUnstake

type MessageUnstake struct {

	// address: the short version of the public key, acting as a unique identify linked to the Validator structure
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

MessageUnstake is the Validator leave message, it begins the process of a Validator exiting the network The block when the funds will be returned may be found in the Validator structure after submitting this transaction

func (*MessageUnstake) Check

func (x *MessageUnstake) Check() lib.ErrorI

Check() validates the Message structure

func (*MessageUnstake) Descriptor deprecated

func (*MessageUnstake) Descriptor() ([]byte, []int)

Deprecated: Use MessageUnstake.ProtoReflect.Descriptor instead.

func (*MessageUnstake) GetAddress

func (x *MessageUnstake) GetAddress() []byte

func (MessageUnstake) MarshalJSON

func (x MessageUnstake) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for MessageUnstake

func (*MessageUnstake) Name

func (x *MessageUnstake) Name() string

func (*MessageUnstake) New

func (x *MessageUnstake) New() lib.MessageI

func (*MessageUnstake) ProtoMessage

func (*MessageUnstake) ProtoMessage()

func (*MessageUnstake) ProtoReflect

func (x *MessageUnstake) ProtoReflect() protoreflect.Message

func (*MessageUnstake) Recipient

func (x *MessageUnstake) Recipient() []byte

func (*MessageUnstake) Reset

func (x *MessageUnstake) Reset()

func (*MessageUnstake) String

func (x *MessageUnstake) String() string

func (*MessageUnstake) UnmarshalJSON

func (x *MessageUnstake) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for MessageUnstake

type NonSigner

type NonSigner struct {

	// address: shorter version of the operator public key of the non signer
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// counter: increments when a Validator doesn't sign a block and resets every non-sign-window
	Counter uint64 `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"`
	// contains filtered or unexported fields
}

NonSignerInfo is information that tracks the number of blocks not signed by the Validator within the Non-Sign-Window

func (*NonSigner) Descriptor deprecated

func (*NonSigner) Descriptor() ([]byte, []int)

Deprecated: Use NonSigner.ProtoReflect.Descriptor instead.

func (*NonSigner) GetAddress

func (x *NonSigner) GetAddress() []byte

func (*NonSigner) GetCounter

func (x *NonSigner) GetCounter() uint64

func (*NonSigner) ProtoMessage

func (*NonSigner) ProtoMessage()

func (*NonSigner) ProtoReflect

func (x *NonSigner) ProtoReflect() protoreflect.Message

func (*NonSigner) Reset

func (x *NonSigner) Reset()

func (*NonSigner) String

func (x *NonSigner) String() string

type NonSignerList

type NonSignerList struct {
	List []*NonSigner `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"`
	// contains filtered or unexported fields
}

NonSignerList is a list of information that tracks the number of blocks not signed by the Validator within the Non-Sign-Window

func (*NonSignerList) Descriptor deprecated

func (*NonSignerList) Descriptor() ([]byte, []int)

Deprecated: Use NonSignerList.ProtoReflect.Descriptor instead.

func (*NonSignerList) GetList

func (x *NonSignerList) GetList() []*NonSigner

func (*NonSignerList) ProtoMessage

func (*NonSignerList) ProtoMessage()

func (*NonSignerList) ProtoReflect

func (x *NonSignerList) ProtoReflect() protoreflect.Message

func (*NonSignerList) Reset

func (x *NonSignerList) Reset()

func (*NonSignerList) String

func (x *NonSignerList) String() string

type NonSigners

type NonSigners []*NonSigner

type ParamSpace

type ParamSpace interface {
	Check() lib.ErrorI
	SetString(paramName string, value string) lib.ErrorI // SetString() update a string parameter in the structure
	SetUint64(paramName string, value uint64) lib.ErrorI // SetUint64() update a uint64 parameter in the structure
}

ParamSpace is a distinct, isolated category within the overarching Params structure

type Params

type Params struct {

	// consensus: are parameters in the 'consensus' space
	// settings that define how nodes in the blockchain agree on the state of the ledger
	Consensus *ConsensusParams `protobuf:"bytes,1,opt,name=Consensus,proto3" json:"consensus"` // @gotags: json:"consensus"
	// validator: are parameters in the 'validator' space
	// settings that define the rules and criteria for validators in the blockchain network
	Validator *ValidatorParams `protobuf:"bytes,2,opt,name=Validator,proto3" json:"validator"` // @gotags: json:"validator"
	// fee: are parameters in the 'fee' space
	// settings that define the various amounts of transaction fees
	Fee *FeeParams `protobuf:"bytes,3,opt,name=Fee,proto3" json:"fee"` // @gotags: json:"fee"
	// governance: are parameters in the 'gov' space
	// settings that define the rules that enable decentralized and autonomous governing of the network
	Governance *GovernanceParams `protobuf:"bytes,4,opt,name=Governance,proto3" json:"governance"` // @gotags: json:"governance"
	// contains filtered or unexported fields
}

Params are are configurable settings in a blockchain or decentralized network that control various aspects of the system's operation and rules, such as transaction fees, block sizes, and validator behaviors. These parameters can be adjusted through validator consensus to adapt the network as needs change. Parameters are organized into 4 'parameter spaces' that are purely for organization and i/o optimization.

func DefaultParams

func DefaultParams() *Params

DefaultParams() returns the developer set params

func (*Params) Check

func (x *Params) Check() lib.ErrorI

Check() validates the Params object

func (*Params) Descriptor deprecated

func (*Params) Descriptor() ([]byte, []int)

Deprecated: Use Params.ProtoReflect.Descriptor instead.

func (*Params) GetConsensus

func (x *Params) GetConsensus() *ConsensusParams

func (*Params) GetFee

func (x *Params) GetFee() *FeeParams

func (*Params) GetGovernance

func (x *Params) GetGovernance() *GovernanceParams

func (*Params) GetValidator

func (x *Params) GetValidator() *ValidatorParams

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) ProtoReflect

func (x *Params) ProtoReflect() protoreflect.Message

func (*Params) Reset

func (x *Params) Reset()

func (*Params) String

func (x *Params) String() string

type Poll

type Poll map[string]PollResult

Poll is a list of PollResults keyed by the hash of the proposal

type PollResult

type PollResult struct {
	ProposalHash string    `json:"proposalHash"` // the hash of the proposal
	ProposalURL  string    `json:"proposalURL"`  // the url of the proposal
	Accounts     VoteStats `json:"accounts"`     // vote statistics for accounts
	Validators   VoteStats `json:"validators"`   // vote statistics for validators
}

PollResult is a structure that represents the current state of a 'Poll' for a 'Proposal'

type Pool

type Pool struct {

	// id: the unique identifier of the pool
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// amount: the balance of funds the pool has
	Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	// contains filtered or unexported fields
}

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

func (*Pool) Descriptor deprecated

func (*Pool) Descriptor() ([]byte, []int)

Deprecated: Use Pool.ProtoReflect.Descriptor instead.

func (*Pool) GetAmount

func (x *Pool) GetAmount() uint64

func (*Pool) GetId

func (x *Pool) GetId() uint64

func (*Pool) MarshalJSON

func (x *Pool) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the Pool object

func (*Pool) ProtoMessage

func (*Pool) ProtoMessage()

func (*Pool) ProtoReflect

func (x *Pool) ProtoReflect() protoreflect.Message

func (*Pool) Reset

func (x *Pool) Reset()

func (*Pool) String

func (x *Pool) String() string

func (*Pool) UnmarshalJSON

func (x *Pool) UnmarshalJSON(bz []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for the Pool object

type PoolPage

type PoolPage []*Pool

func (*PoolPage) New

func (p *PoolPage) New() lib.Pageable

PoolPage satisfies the Page interface

type ProtocolVersion

type ProtocolVersion struct {

	// height: the block number the protocol version becomes live
	Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// version: is an identifier for a specific set of rules and features in a blockchain or network protocol
	Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

The ProtocolVersion is a string that marks the particular version of rules governing how nodes communicate and validate data in a network. It enables nodes to stay synchronized, ensuring they follow the same standards

func (*ProtocolVersion) Descriptor deprecated

func (*ProtocolVersion) Descriptor() ([]byte, []int)

Deprecated: Use ProtocolVersion.ProtoReflect.Descriptor instead.

func (*ProtocolVersion) GetHeight

func (x *ProtocolVersion) GetHeight() uint64

func (*ProtocolVersion) GetVersion

func (x *ProtocolVersion) GetVersion() uint64

func (*ProtocolVersion) ProtoMessage

func (*ProtocolVersion) ProtoMessage()

func (*ProtocolVersion) ProtoReflect

func (x *ProtocolVersion) ProtoReflect() protoreflect.Message

func (*ProtocolVersion) Reset

func (x *ProtocolVersion) Reset()

func (*ProtocolVersion) String

func (x *ProtocolVersion) String() string

type SlashTracker

type SlashTracker map[string]map[uint64]uint64

SlashTracker is a map of address -> committee -> slash percentage which is used to ensure no committee exceeds max slash within a single block NOTE: this slash tracker is naive and doesn't account for the consecutive reduction of a slash percentage impact i.e. two 10% slashes = 20%, but technically it's 19%

func NewSlashTracker

func NewSlashTracker() *SlashTracker

func (*SlashTracker) AddSlash

func (s *SlashTracker) AddSlash(address []byte, chainId, percent uint64)

AddSlash() adds a slash for an address at by a committee for a certain percent

func (*SlashTracker) GetTotalSlashPercent

func (s *SlashTracker) GetTotalSlashPercent(address []byte, chainId uint64) (percent uint64)

GetTotalSlashPercent() returns the total percent for a slash

type StartPoll

type StartPoll struct {
	StartPoll string `json:"startPoll"`
	Url       string `json:"url,omitempty"`
	EndHeight uint64 `json:"endHeight"`
}

StartPoll represents the structure for initiating a new poll It is used to encode data into JSON format for storing in memo fields

type StateMachine

type StateMachine struct {
	ProtocolVersion uint64 // the version of the protocol this node is running
	NetworkID       uint32 // the id of the network this node is configured to be on

	Config  lib.Config   // the main configuration as defined by the 'config.json' file
	Metrics *lib.Metrics // the telemetry module

	LastValidatorSet map[uint64]map[uint64]*lib.ValidatorSet // reference to the last validator set saved in the controller
	// contains filtered or unexported fields
}

StateMachine the 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

func New

func New(c lib.Config, store lib.StoreI, metrics *lib.Metrics, log lib.LoggerI) (*StateMachine, lib.ErrorI)

New() creates a new instance of a StateMachine

func (*StateMachine) AccountAdd

func (s *StateMachine) AccountAdd(address crypto.AddressI, amountToAdd uint64) lib.ErrorI

AccountAdd() adds tokens to an Account

func (*StateMachine) AccountDeductFees

func (s *StateMachine) AccountDeductFees(address crypto.AddressI, fee uint64) lib.ErrorI

AccountDeductFees() removes fees from a specific address and adds them to the Canopy reward pool

func (*StateMachine) AccountSub

func (s *StateMachine) AccountSub(address crypto.AddressI, amountToSub uint64) lib.ErrorI

AccountSub() removes tokens from an Account

func (*StateMachine) AddToCommitteeSupplyForChain

func (s *StateMachine) AddToCommitteeSupplyForChain(chainId uint64, amount uint64) lib.ErrorI

AddToCommitteeSupplyForChain() adds to the committee staked supply count

func (*StateMachine) AddToDelegateSupply

func (s *StateMachine) AddToDelegateSupply(amount uint64) lib.ErrorI

AddToStakedSupply() adds to the staked supply count

func (*StateMachine) AddToDelegateSupplyForChain

func (s *StateMachine) AddToDelegateSupplyForChain(chainId uint64, amount uint64) lib.ErrorI

AddToDelegateSupplyForChain() adds to the delegate staked supply count

func (*StateMachine) AddToStakedSupply

func (s *StateMachine) AddToStakedSupply(amount uint64) lib.ErrorI

AddToStakedSupply() adds to the staked supply count (staked + delegated)

func (*StateMachine) AddToTotalSupply

func (s *StateMachine) AddToTotalSupply(amount uint64) lib.ErrorI

AddToTotalSupply() adds to the total supply count

func (*StateMachine) ApplyBlock

func (s *StateMachine) ApplyBlock(ctx context.Context, b *lib.Block, lastValidatorSet *lib.ValidatorSet, allowOversize bool) (
	header *lib.BlockHeader, txResults, oversized []*lib.TxResult, failed []*lib.FailedTx, err lib.ErrorI)

ApplyBlock processes a given block, updating the state machine's state accordingly The function: - executes `BeginBlock` - applies all transactions within the block, generating transaction results nad a root hash - executes `EndBlock` - constructs and returns the block header, and the transaction results NOTES: - this function may be used to validate 'additional' transactions outside the normal block size as if they were to be included - a list of failed transactions are returned

func (*StateMachine) ApplyTransaction

func (s *StateMachine) ApplyTransaction(index uint64, transaction []byte, txHash string, batchVerifier *crypto.BatchVerifier) (*lib.TxResult, lib.ErrorI)

ApplyTransaction() processes the transaction within the state machine, returning the corresponding TxResult.

func (*StateMachine) ApplyTransactions

func (s *StateMachine) ApplyTransactions(
	ctx context.Context, txs [][]byte, allowOversize bool) (results, oversized []*lib.TxResult, root []byte, blockTxs [][]byte, failed []*lib.FailedTx, n int, er lib.ErrorI)

ApplyTransactions() 1. Batch validate signatures for every transaction provided 2. Processes all transactions provided against the state machine 3. Allows ephemeral 'oversize' transaction processing without applying 'oversize txn' changes to the state 4. Returns the following for successful transactions within a block: <results, tx-list, root, count> 5. Returns all transactions that failed during processing

func (*StateMachine) ApproveProposal

func (s *StateMachine) ApproveProposal(msg GovProposal) lib.ErrorI

ApproveProposal() validates a 'GovProposal' message (ex. MsgChangeParameter or MsgDAOTransfer) - checks message sent between start height and end height - if APPROVE_ALL set or proposal on the APPROVE_LIST then no error - else return ErrRejectProposal

func (*StateMachine) BeginBlock

func (s *StateMachine) BeginBlock(lastValidatorSet *lib.ValidatorSet) lib.ErrorI

BeginBlock() is code that is executed at the start of `applying` the block

func (*StateMachine) CheckFee

func (s *StateMachine) CheckFee(fee uint64, msg lib.MessageI) (err lib.ErrorI)

CheckFee() validates the fee amount is sufficient to pay for a transaction

func (*StateMachine) CheckMessage

func (s *StateMachine) CheckMessage(msg *anypb.Any) (message lib.MessageI, err lib.ErrorI)

CheckMessage() performs basic validations on the msg payload

func (*StateMachine) CheckProtocolVersion

func (s *StateMachine) CheckProtocolVersion() (err lib.ErrorI)

CheckProtocolVersion() compares the protocol version against the governance enforced version

func (*StateMachine) CheckReplay

func (s *StateMachine) CheckReplay(tx *lib.Transaction, txHash string) lib.ErrorI

CheckReplay() validates the timestamp of the transaction Instead of using an increasing 'sequence number' Canopy uses timestamp + created block to act as a prune-friendly, replay attack / hash collision prevention mechanism

  • Canopy searches the transaction indexer for the transaction using its hash to prevent 'replay attacks'
  • The timestamp protects against hash collisions as it injects 'micro-second level entropy' into the hash of the transaction, ensuring no transactions will 'accidentally collide'
  • The created block acceptance policy for transactions maintains an acceptable bound of 'time' to support database pruning

func (*StateMachine) CheckSignature

func (s *StateMachine) CheckSignature(msg lib.MessageI, tx *lib.Transaction, batchSignatureVerifier *crypto.BatchVerifier) (crypto.AddressI, lib.ErrorI)

CheckSignature() validates the signer and the digital signature associated with the transaction object

func (*StateMachine) CheckTx

func (s *StateMachine) CheckTx(transaction []byte, txHash string, batchVerifier *crypto.BatchVerifier) (result *CheckTxResult, err lib.ErrorI)

CheckTx() validates the transaction object

func (*StateMachine) CloseOrder

func (s *StateMachine) CloseOrder(orderId []byte, chainId uint64) (err lib.ErrorI)

CloseOrder() sends the tokens from escrow to the 'buyer address' and deletes the order

func (*StateMachine) CommitteeIsRetired

func (s *StateMachine) CommitteeIsRetired(chainId uint64) (bool, lib.ErrorI)

CommitteeIsRetired checks if a committee is marked as 'retired' which prevents it from being subsidized for eternity

func (*StateMachine) ConformStateToParamUpdate

func (s *StateMachine) ConformStateToParamUpdate(previousParams *Params) lib.ErrorI

ConformStateToParamUpdate() ensures the state does not violate the new values of the governance parameters - Only MaxCommitteeSize, RootChainId, MinimumStakeForValidators & MinimumStakeForDelegates require an adjustment - MinSellOrderSize is purposefully allowed to violate new updates

func (*StateMachine) Copy

func (s *StateMachine) Copy() (*StateMachine, lib.ErrorI)

Copy() makes a clone of the state machine this feature is used in mempool operation to be able to maintain a parallel ephemeral state without affecting the underlying state machine

func (*StateMachine) Delete

func (s *StateMachine) Delete(key []byte) lib.ErrorI

Delete() deletes a key-value pair under a key

func (*StateMachine) DeleteAll

func (s *StateMachine) DeleteAll(keys [][]byte) (err lib.ErrorI)

DeleteAll() deletes all key-value pairs under a set of keys

func (*StateMachine) DeleteCommitteeMember

func (s *StateMachine) DeleteCommitteeMember(address crypto.AddressI, chainId, stakeForCommittee uint64) lib.ErrorI

DeleteCommitteeMember() removes the address from being a 'member' of the committee in the state

func (*StateMachine) DeleteCommittees

func (s *StateMachine) DeleteCommittees(address crypto.AddressI, totalStake uint64, committees []uint64) (err lib.ErrorI)

DeleteCommittees() deletes the membership and staked supply for each of an address' committees

func (*StateMachine) DeleteDelegate

func (s *StateMachine) DeleteDelegate(address crypto.AddressI, chainId, stakeForCommittee uint64) lib.ErrorI

DeleteDelegate() removes a delegate from the state using the delegate prefix

func (*StateMachine) DeleteDelegations

func (s *StateMachine) DeleteDelegations(address crypto.AddressI, totalStake uint64, committees []uint64) lib.ErrorI

DeleteDelegations() removes the delegate 'membership' for an address, removing from the list and updating the supply pools

func (*StateMachine) DeleteFinishedUnstaking

func (s *StateMachine) DeleteFinishedUnstaking() lib.ErrorI

DeleteFinishedUnstaking() deletes the Validator structure and unstaking keys for those who have finished unstaking

func (*StateMachine) DeleteOrder

func (s *StateMachine) DeleteOrder(orderId []byte, chainId uint64) (err lib.ErrorI)

DeleteOrder() deletes an existing order in the order book for a committee in the state db

func (*StateMachine) DeleteValidator

func (s *StateMachine) DeleteValidator(validator *Validator) lib.ErrorI

DeleteValidator() completely removes a validator from the state

func (*StateMachine) Discard

func (s *StateMachine) Discard()

func (*StateMachine) DistributeCommitteeReward

func (s *StateMachine) DistributeCommitteeReward(stub *lib.PaymentPercents, rewardPoolAmount, numberOfSamples uint64, valParams *ValidatorParams) (distributed uint64, err lib.ErrorI)

DistributeCommitteeReward() issues a single committee reward unit based on an individual 'Payment Stub'

func (*StateMachine) DistributeCommitteeRewards

func (s *StateMachine) DistributeCommitteeRewards() lib.ErrorI

DistributeCommitteeRewards() distributes the committee mint based on the PaymentPercents from the result of the QuorumCertificate

func (*StateMachine) EndBlock

func (s *StateMachine) EndBlock(proposerAddress []byte) (err lib.ErrorI)

EndBlock() is code that is executed at the end of `applying` the block

func (*StateMachine) ExportState

func (s *StateMachine) ExportState() (genesis *GenesisState, err lib.ErrorI)

ExportState() creates a GenesisState object from the current state

func (*StateMachine) ForceUnstakeMaxPaused

func (s *StateMachine) ForceUnstakeMaxPaused() lib.ErrorI

ForceUnstakeMaxPaused() forcefully unstakes validators who have reached MaxPauseHeight and removes their 'paused' key EXPLAINER: Addresses under the (max) paused prefix for the latest height indicate the validator has hit their 'max paused height' This key was set at an earlier height when the validators were initially paused Note: These validators remain paused because the key is not deleted unless they are un-paused

func (*StateMachine) ForceUnstakeValidator

func (s *StateMachine) ForceUnstakeValidator(address crypto.AddressI) lib.ErrorI

ForceUnstakeValidator() automatically begins unstaking the validator

func (*StateMachine) FundCommitteeRewardPools

func (s *StateMachine) FundCommitteeRewardPools() lib.ErrorI

FundCommitteeRewardPools() mints newly created tokens to protocol subsidized committees

func (*StateMachine) Get

func (s *StateMachine) Get(key []byte) (bz []byte, err lib.ErrorI)

Get() retrieves a key-value pair under a key NOTE: returns (nil, nil) if no value is found for that key

func (*StateMachine) GetAccount

func (s *StateMachine) GetAccount(address crypto.AddressI) (*Account, lib.ErrorI)

GetAccount() returns an Account structure for a specific address

func (*StateMachine) GetAccountBalance

func (s *StateMachine) GetAccountBalance(address crypto.AddressI) (uint64, lib.ErrorI)

GetAccountBalance() returns the balance of an Account at a specific address

func (*StateMachine) GetAccounts

func (s *StateMachine) GetAccounts() (result []*Account, err lib.ErrorI)

GetAccounts() returns all Account structures in the state

func (*StateMachine) GetAccountsPaginated

func (s *StateMachine) GetAccountsPaginated(p lib.PageParams) (page *lib.Page, err lib.ErrorI)

GetAccountsPaginated() returns a page of Account structures in the state

func (*StateMachine) GetAuthorizedSignersFor

func (s *StateMachine) GetAuthorizedSignersFor(msg lib.MessageI) (signers [][]byte, err lib.ErrorI)

GetAuthorizedSignersFor() returns the addresses that are authorized to sign for this message

func (*StateMachine) GetAuthorizedSignersForValidator

func (s *StateMachine) GetAuthorizedSignersForValidator(address []byte) (signers [][]byte, err lib.ErrorI)

GetAuthorizedSignersForValidator() returns the addresses that are able to sign messages on behalf of the validator

func (*StateMachine) GetBlockMintStats

func (s *StateMachine) GetBlockMintStats(chainId uint64) (daoCut uint64, totalMint uint64, mintAmountPerCommittee uint64, err lib.ErrorI)

GetBlockMintStats() gets the latest minting information for the blockchain

func (*StateMachine) GetCommitteeData

func (s *StateMachine) GetCommitteeData(targetChainId uint64) (*lib.CommitteeData, lib.ErrorI)

GetCommitteeData() is a convenience function to retrieve the committee data from the master list

func (*StateMachine) GetCommitteeMembers

func (s *StateMachine) GetCommitteeMembers(chainId uint64) (vs lib.ValidatorSet, err lib.ErrorI)

GetCommitteeMembers() retrieves the ValidatorSet that is responsible for the 'chainId'

func (*StateMachine) GetCommitteePaginated

func (s *StateMachine) GetCommitteePaginated(p lib.PageParams, chainId uint64) (page *lib.Page, err lib.ErrorI)

GetCommitteePaginated() returns a 'page' of committee members ordered from the highest stake to lowest

func (*StateMachine) GetCommitteeStakedSupplyForChain

func (s *StateMachine) GetCommitteeStakedSupplyForChain(chainId uint64) (p *Pool, err lib.ErrorI)

GetCommitteeStakedSupplyForChain() retrieves the committee staked supply count

func (*StateMachine) GetCommitteesData

func (s *StateMachine) GetCommitteesData() (list *lib.CommitteesData, err lib.ErrorI)

GetCommitteesData() gets a list of List from the state

func (*StateMachine) GetDelegateStakedSupplyForChain

func (s *StateMachine) GetDelegateStakedSupplyForChain(chainId uint64) (p *Pool, err lib.ErrorI)

GetFromDelegateStakedSupply() retrieves the delegate committee staked supply count

func (*StateMachine) GetDelegates

func (s *StateMachine) GetDelegates(chainId uint64) (vs lib.ValidatorSet, err lib.ErrorI)

GetDelegates returns the active delegates for a given chainId. If MaximumDelegatesPerCommittee (from governance params) is 0, it will return all delegates; otherwise it returns only the top N.

func (*StateMachine) GetDelegatesPaginated

func (s *StateMachine) GetDelegatesPaginated(p lib.PageParams, chainId uint64) (page *lib.Page, err lib.ErrorI)

GetDelegatesPaginated() returns a page of delegates

func (*StateMachine) GetDoubleSigners

func (s *StateMachine) GetDoubleSigners() (results []*lib.DoubleSigner, e lib.ErrorI)

GetDoubleSigners() returns all double signers save in the state IMPORTANT NOTE: this returns <address> -> <heights> NOT <pubic_key> -> <heights> CONTRACT: Querying uncommitted double signers is not supported

func (*StateMachine) GetFeeForMessageName

func (s *StateMachine) GetFeeForMessageName(name string) (fee uint64, err lib.ErrorI)

GetFeeForMessageName() returns the associated cost for processing a specific type of message based on the name

func (*StateMachine) GetLastProposers

func (s *StateMachine) GetLastProposers() (*lib.Proposers, lib.ErrorI)

GetLastProposers() returns the last Proposer addresses saved in the state

func (*StateMachine) GetMaxBlockSize

func (s *StateMachine) GetMaxBlockSize() (uint64, lib.ErrorI)

GetMaxBlockSize() returns the maximum size of a block

func (*StateMachine) GetMaxValidators

func (s *StateMachine) GetMaxValidators() (uint64, lib.ErrorI)

GetMaxValidators() returns the max validators per committee

func (*StateMachine) GetNonSigners

func (s *StateMachine) GetNonSigners() (results NonSigners, e lib.ErrorI)

GetNonSigners() returns all non-quorum-certificate-signers save in the state

func (*StateMachine) GetOrder

func (s *StateMachine) GetOrder(orderId []byte, chainId uint64) (order *lib.SellOrder, err lib.ErrorI)

GetOrder() gets the sell order from state

func (*StateMachine) GetOrderBook

func (s *StateMachine) GetOrderBook(chainId uint64) (b *lib.OrderBook, err lib.ErrorI)

GetOrderBook() retrieves the order book for a committee from the state db

func (*StateMachine) GetOrderBooks

func (s *StateMachine) GetOrderBooks() (b *lib.OrderBooks, err lib.ErrorI)

GetOrderBooks() retrieves the lists for all chainIds of open 'sell orders' from the state

func (*StateMachine) GetParams

func (s *StateMachine) GetParams() (*Params, lib.ErrorI)

GetParams() returns the aggregated ParamSpaces in a single Params object

func (*StateMachine) GetParamsCons

func (s *StateMachine) GetParamsCons() (ptr *ConsensusParams, err lib.ErrorI)

GetParamsCons() returns the current state of the governance params in the Consensus space

func (*StateMachine) GetParamsFee

func (s *StateMachine) GetParamsFee() (ptr *FeeParams, err lib.ErrorI)

GetParamsFee() returns the current state of the governance params in the Fee space

func (*StateMachine) GetParamsGov

func (s *StateMachine) GetParamsGov() (ptr *GovernanceParams, err lib.ErrorI)

GetParamsGov() returns the current state of the governance params in the Governance space

func (*StateMachine) GetParamsVal

func (s *StateMachine) GetParamsVal() (ptr *ValidatorParams, err lib.ErrorI)

GetParamsVal() returns the current state of the governance params in the Validator space

func (*StateMachine) GetPool

func (s *StateMachine) GetPool(id uint64) (*Pool, lib.ErrorI)

GetPool() returns a Pool structure for a specific ID

func (*StateMachine) GetPoolBalance

func (s *StateMachine) GetPoolBalance(id uint64) (uint64, lib.ErrorI)

GetPoolBalance() returns the balance of a Pool at an ID

func (*StateMachine) GetPools

func (s *StateMachine) GetPools() (result []*Pool, err lib.ErrorI)

GetPools() returns all Pool structures in the state

func (*StateMachine) GetPoolsPaginated

func (s *StateMachine) GetPoolsPaginated(p lib.PageParams) (page *lib.Page, err lib.ErrorI)

GetPoolsPaginated() returns a particular page of Pool structures in the state

func (*StateMachine) GetRetiredCommittees

func (s *StateMachine) GetRetiredCommittees() (list []uint64, err lib.ErrorI)

GetRetiredCommittees() returns a list of the retired chainIds

func (*StateMachine) GetRootChainId

func (s *StateMachine) GetRootChainId() (uint64, lib.ErrorI)

GetRootChainId() gets the latest root chain id from the state

func (*StateMachine) GetSubsidizedCommittees

func (s *StateMachine) GetSubsidizedCommittees() (paidIDs []uint64, err lib.ErrorI)

GetSubsidizedCommittees() returns a list of chainIds that receive a portion of the 'block reward' Think of these committees as 'automatically subsidized' by the protocol

func (*StateMachine) GetSupply

func (s *StateMachine) GetSupply() (*Supply, lib.ErrorI)

GetSupply() returns the Supply structure held in the state

func (*StateMachine) GetTotalEscrowed

func (s *StateMachine) GetTotalEscrowed(address crypto.AddressI) (total uint64, err lib.ErrorI)

GetTotalEscrowed() checks all order books for escrowed funds for a specific address

func (*StateMachine) GetValidator

func (s *StateMachine) GetValidator(address crypto.AddressI) (*Validator, lib.ErrorI)

GetValidator() gets the validator from the store via the address

func (*StateMachine) GetValidatorExists

func (s *StateMachine) GetValidatorExists(address crypto.AddressI) (bool, lib.ErrorI)

GetValidatorExists() checks if the Validator already exists in the state

func (*StateMachine) GetValidators

func (s *StateMachine) GetValidators() (result []*Validator, err lib.ErrorI)

GetValidators() returns a slice of all validators

func (*StateMachine) GetValidatorsPaginated

func (s *StateMachine) GetValidatorsPaginated(p lib.PageParams, f lib.ValidatorFilters) (page *lib.Page, err lib.ErrorI)

GetValidatorsPaginated() returns a page of filtered validators

func (*StateMachine) HandleByzantine

func (s *StateMachine) HandleByzantine(qc *lib.QuorumCertificate, vs *lib.ValidatorSet) (nonSignerPercent int, err lib.ErrorI)

HandleByzantine() handles the byzantine (faulty/malicious) participants from a QuorumCertificate

func (*StateMachine) HandleCertificateResults

func (s *StateMachine) HandleCertificateResults(qc *lib.QuorumCertificate, committee *lib.ValidatorSet) lib.ErrorI

HandleCertificateResults() is a handler for the results of a quorum certificate

func (*StateMachine) HandleCheckpoint

func (s *StateMachine) HandleCheckpoint(chainId uint64, results *lib.CertificateResult) (err lib.ErrorI)

HandleCheckpoint() handles the `checkpoint-as-a-service` root-chain functionality NOTE: this will index self checkpoints - but allows for nested-chain checkpointing too

func (*StateMachine) HandleCommitteeSwaps

func (s *StateMachine) HandleCommitteeSwaps(orders *lib.Orders, chainId uint64)

HandleCommitteeSwaps() when the committee submits a 'certificate results transaction', it informs the chain of various actions over sell orders - 'buy' is an actor 'claiming / reserving' the sell order - 'reset' is a 'claimed' order whose 'buyer' did not send the tokens to the seller before the deadline, thus the order is re-opened for sale - 'close' is a 'claimed' order whose 'buyer' sent the tokens to the seller before the deadline, thus the order is 'closed' and the tokens are moved from escrow to the buyer

func (*StateMachine) HandleDoubleSigners

func (s *StateMachine) HandleDoubleSigners(chainId uint64, params *ValidatorParams, doubleSigners []*lib.DoubleSigner) lib.ErrorI

HandleDoubleSigners() validates, sets, and slashes the list of doubleSigners

func (*StateMachine) HandleMessage

func (s *StateMachine) HandleMessage(msg lib.MessageI) lib.ErrorI

HandleMessage() routes the MessageI to the correct `handler` based on its `type`

func (*StateMachine) HandleMessageCertificateResults

func (s *StateMachine) HandleMessageCertificateResults(msg *MessageCertificateResults) lib.ErrorI

HandleMessageCertificateResults() is the proper handler for a `CertificateResults` message

func (*StateMachine) HandleMessageChangeParameter

func (s *StateMachine) HandleMessageChangeParameter(msg *MessageChangeParameter) lib.ErrorI

HandleMessageChangeParameter() is the proper handler for an `Change-Parameter` message

func (*StateMachine) HandleMessageCreateOrder

func (s *StateMachine) HandleMessageCreateOrder(msg *MessageCreateOrder) (err lib.ErrorI)

HandleMessageCreateOrder() is the proper handler for a `CreateOrder` message

func (*StateMachine) HandleMessageDAOTransfer

func (s *StateMachine) HandleMessageDAOTransfer(msg *MessageDAOTransfer) lib.ErrorI

HandleMessageDAOTransfer() is the proper handler for a `DAO-Transfer` message

func (*StateMachine) HandleMessageDeleteOrder

func (s *StateMachine) HandleMessageDeleteOrder(msg *MessageDeleteOrder) (err lib.ErrorI)

HandleMessageDeleteOrder() is the proper handler for a `DeleteOrder` message

func (*StateMachine) HandleMessageEditOrder

func (s *StateMachine) HandleMessageEditOrder(msg *MessageEditOrder) (err lib.ErrorI)

HandleMessageEditOrder() is the proper handler for a `EditOrder` message

func (*StateMachine) HandleMessageEditStake

func (s *StateMachine) HandleMessageEditStake(msg *MessageEditStake) lib.ErrorI

HandleMessageEditStake() is the proper handler for a `Edit-Stake` message (Validator already exists in the state)

func (*StateMachine) HandleMessagePause

func (s *StateMachine) HandleMessagePause(msg *MessagePause) lib.ErrorI

HandleMessagePause() is the proper handler for an `Pause` message

func (*StateMachine) HandleMessageSend

func (s *StateMachine) HandleMessageSend(msg *MessageSend) lib.ErrorI

HandleMessageSend() is the proper handler for a `Send` message

func (*StateMachine) HandleMessageStake

func (s *StateMachine) HandleMessageStake(msg *MessageStake) lib.ErrorI

HandleMessageStake() is the proper handler for a `Stake` message (Validator does not yet exist in the state)

func (*StateMachine) HandleMessageSubsidy

func (s *StateMachine) HandleMessageSubsidy(msg *MessageSubsidy) lib.ErrorI

HandleMessageSubsidy() is the proper handler for a `Subsidy` message

func (*StateMachine) HandleMessageUnpause

func (s *StateMachine) HandleMessageUnpause(msg *MessageUnpause) lib.ErrorI

HandleMessageUnpause() is the proper handler for an `Unpause` message

func (*StateMachine) HandleMessageUnstake

func (s *StateMachine) HandleMessageUnstake(msg *MessageUnstake) lib.ErrorI

HandleMessageUnstake() is the proper handler for an `Unstake` message

func (*StateMachine) Height

func (s *StateMachine) Height() uint64

func (*StateMachine) IncrementNonSigners

func (s *StateMachine) IncrementNonSigners(nonSignerPubKeys [][]byte) lib.ErrorI

IncrementNonSigners() upserts non-(QC)-signers by incrementing the non-signer count for the list

func (*StateMachine) Initialize

func (s *StateMachine) Initialize(store lib.StoreI) (genesis bool, err lib.ErrorI)

Initialize() initializes a StateMachine object using the StoreI

func (*StateMachine) IsFeatureEnabled

func (s *StateMachine) IsFeatureEnabled(requiredVersion uint64) bool

IsFeatureEnabled() checks if a feature is enabled based on the protocol version stored in the state compared to the required activation version

func (*StateMachine) IterateAndExecute

func (s *StateMachine) IterateAndExecute(prefix []byte, callback func(key, value []byte) lib.ErrorI) (err lib.ErrorI)

IterateAndExecute() creates an iterator and executes a callback function for each key-value pair

func (*StateMachine) Iterator

func (s *StateMachine) Iterator(key []byte) (lib.IteratorI, lib.ErrorI)

Iterator() creates and returns an iterator for the state machine's underlying store starting at the specified key and iterating lexicographically

func (*StateMachine) LoadBlock

func (s *StateMachine) LoadBlock(height uint64) (*lib.BlockResult, lib.ErrorI)

LoadBlock() loads an indexed block at a specific height

func (*StateMachine) LoadBlockAndCertificate

func (s *StateMachine) LoadBlockAndCertificate(height uint64) (cert *lib.QuorumCertificate, block *lib.BlockResult, err lib.ErrorI)

LoadBlock() loads an indexed block at a specific height

func (*StateMachine) LoadCertificate

func (s *StateMachine) LoadCertificate(height uint64) (*lib.QuorumCertificate, lib.ErrorI)

LoadCertificate() loads a quorum certificate (block, results + 2/3rd committee signatures)

func (*StateMachine) LoadCertificateHashesOnly

func (s *StateMachine) LoadCertificateHashesOnly(height uint64) (*lib.QuorumCertificate, lib.ErrorI)

LoadCertificateHashesOnly() loads a quorum certificate but nullifies the block

func (*StateMachine) LoadCommittee

func (s *StateMachine) LoadCommittee(chainId uint64, height uint64) (lib.ValidatorSet, lib.ErrorI)

LoadCommittee() loads the committee validators for a particular committee at a particular height

func (*StateMachine) LoadCommitteeData

func (s *StateMachine) LoadCommitteeData(height, targetChainId uint64) (*lib.CommitteeData, lib.ErrorI)

LoadCommitteeData() loads a historical (or clean latest) committee data from the master list

func (*StateMachine) LoadIsOwnRoot

func (s *StateMachine) LoadIsOwnRoot() (bool, lib.ErrorI)

LoadIsOwnRoot() returns if this chain is its own root (base)

func (*StateMachine) LoadLastProposers

func (s *StateMachine) LoadLastProposers(height uint64) (*lib.Proposers, lib.ErrorI)

LoadLastProposers() returns the last Proposer addresses saved in the state for a particular height

func (*StateMachine) LoadMinimumEvidenceHeight

func (s *StateMachine) LoadMinimumEvidenceHeight() (uint64, lib.ErrorI)

LoadMinimumEvidenceHeight() loads the minimum height the evidence must be to still be usable

func (*StateMachine) LoadRootChainId

func (s *StateMachine) LoadRootChainId(height uint64) (uint64, lib.ErrorI)

LoadRootChainId() loads the root chain id from the state at a certain height

func (*StateMachine) LoadRootChainInfo

func (s *StateMachine) LoadRootChainInfo(id, height uint64, lastValidatorSet ...*lib.ValidatorSet) (*lib.RootChainInfo, lib.ErrorI)

LoadRootChainInfo() returns the 'need-to-know' information for a nested chain

func (*StateMachine) LockOrder

func (s *StateMachine) LockOrder(lock *lib.LockOrder, chainId uint64) (err lib.ErrorI)

LockOrder() adds a recipient and a deadline height to an existing order and saves it to the state

func (*StateMachine) LotteryWinner

func (s *StateMachine) LotteryWinner(id uint64, validators ...bool) (lottery *lib.LotteryWinner, err lib.ErrorI)

LotteryWinner() selects a validator/delegate randomly weighted based on their stake within a committee

func (*StateMachine) MintToPool

func (s *StateMachine) MintToPool(id uint64, amount uint64) lib.ErrorI

MintToPool() adds newly created tokens to the Pool structure

func (*StateMachine) NewFromGenesisFile

func (s *StateMachine) NewFromGenesisFile() (err lib.ErrorI)

NewFromGenesisFile() creates a new beginning state from a file

func (*StateMachine) NewStateFromGenesis

func (s *StateMachine) NewStateFromGenesis(genesis *GenesisState) (err lib.ErrorI)

NewStateFromGenesis() creates a new beginning state using a GenesisState object There are purposefully non-included fields that are 'export only'

func (*StateMachine) OverwriteCommitteeData

func (s *StateMachine) OverwriteCommitteeData(d *lib.CommitteeData) lib.ErrorI

OverwriteCommitteeData() overwrites the committee data in state note: use UpsertCommitteeData for the safe committee upsert

func (*StateMachine) ParseBlockForLockAndCloseOrders

func (s *StateMachine) ParseBlockForLockAndCloseOrders(blocks ...*lib.BlockResult) (lockOrders map[string]*lib.LockOrder, closeOrders map[string]*lib.CloseOrder, coSends map[string]*MessageSend)

ParseCloseOrders() parses the blocks for memo commands to execute specialized 'close order' functionality

func (*StateMachine) ParseCloseOrder

func (s *StateMachine) ParseCloseOrder(tx *lib.Transaction) (co *lib.CloseOrder, ok bool)

ParseCloseOrder() parses a transaction for an embedded close order messages in the memo field

func (*StateMachine) ParseLockOrder

func (s *StateMachine) ParseLockOrder(tx *lib.Transaction, deadlineBlocks uint64) (bo *lib.LockOrder, ok bool)

ParseLockOrder() parses a transaction for an embedded lock order messages in the memo field

func (*StateMachine) ParsePollTransactions

func (s *StateMachine) ParsePollTransactions(b *lib.BlockResult)

ParsePollTransactions() parses the last valid block for memo commands to execute specialized 'straw polling' functionality

func (*StateMachine) PollsToResults

func (s *StateMachine) PollsToResults(polls *ActivePolls) (result Poll, err lib.ErrorI)

PollsToResults() coverts the polling objects to a compressed result based on the voting power

func (*StateMachine) PoolAdd

func (s *StateMachine) PoolAdd(id uint64, amountToAdd uint64) lib.ErrorI

PoolAdd() adds tokens to the Pool structure

func (*StateMachine) PoolSub

func (s *StateMachine) PoolSub(id uint64, amountToSub uint64) lib.ErrorI

PoolSub() removes tokens from the Pool structure

func (*StateMachine) ProcessRootChainOrderBook

func (s *StateMachine) ProcessRootChainOrderBook(book *lib.OrderBook, proposalBlock *lib.BlockResult) (lockOrders []*lib.LockOrder, closedOrders, resetOrders [][]byte)

ProcessRootChainOrderBook() processes the order book from the root-chain and cross-references blocks on this chain to determine actions that warrant committee level changes to the root-chain order book like: LockOrder, ResetOrder and CloseOrder

func (*StateMachine) ReadGenesisFromFile

func (s *StateMachine) ReadGenesisFromFile() (genesis *GenesisState, e lib.ErrorI)

ReadGenesisFromFile() reads a GenesisState object from a file

func (*StateMachine) Reset

func (s *StateMachine) Reset()

Reset() resets the state store and the slash tracker

func (*StateMachine) ResetCaches

func (s *StateMachine) ResetCaches()

ResetCaches() dumps the state machine caches

func (*StateMachine) ResetOrder

func (s *StateMachine) ResetOrder(orderId []byte, chainId uint64) (err lib.ErrorI)

ResetOrder() removes the recipient and deadline height from an existing order and saves it to the state

func (*StateMachine) RetireCommittee

func (s *StateMachine) RetireCommittee(chainId uint64) lib.ErrorI

RetireCommittee marks a committee as non-subsidized for eternity This is a useful mechanism to gracefully 'end' a committee

func (*StateMachine) RevIterator

func (s *StateMachine) RevIterator(key []byte) (lib.IteratorI, lib.ErrorI)

RevIterator() creates and returns an iterator for the state machine's underlying store starting at the end-prefix of the specified key and iterating reverse lexicographically

func (*StateMachine) Set

func (s *StateMachine) Set(k, v []byte) (err lib.ErrorI)

Set() upserts a key-value pair under a key

func (*StateMachine) SetAccount

func (s *StateMachine) SetAccount(account *Account) lib.ErrorI

SetAccount() upserts an account into the state

func (*StateMachine) SetAccounts

func (s *StateMachine) SetAccounts(accounts []*Account, supply *Supply) (err lib.ErrorI)

SetAccount() upserts multiple accounts into the state

func (*StateMachine) SetCommitteeMember

func (s *StateMachine) SetCommitteeMember(address crypto.AddressI, chainId, stakeForCommittee uint64) lib.ErrorI

SetCommitteeMember() sets the address as a 'member' of the committee in the state

func (*StateMachine) SetCommittees

func (s *StateMachine) SetCommittees(address crypto.AddressI, totalStake uint64, committees []uint64) (err lib.ErrorI)

SetCommittees() sets the membership and staked supply for all an addresses' committees

func (*StateMachine) SetCommitteesData

func (s *StateMachine) SetCommitteesData(list *lib.CommitteesData) lib.ErrorI

SetCommitteesData() sets a list of committee data in the state

func (*StateMachine) SetDelegate

func (s *StateMachine) SetDelegate(address crypto.AddressI, chainId, stakeForCommittee uint64) lib.ErrorI

SetDelegate() sets a delegate in state using the delegate prefix

func (*StateMachine) SetDelegations

func (s *StateMachine) SetDelegations(address crypto.AddressI, totalStake uint64, committees []uint64) lib.ErrorI

SetDelegations() sets the delegate 'membership' for an address, adding to the list and updating the supply pools

func (*StateMachine) SetLastProposers

func (s *StateMachine) SetLastProposers(keys *lib.Proposers) lib.ErrorI

SetLastProposers() saves the last Proposer addresses in the state

func (*StateMachine) SetOrder

func (s *StateMachine) SetOrder(order *lib.SellOrder, chainId uint64) (err lib.ErrorI)

SetOrder() sets the sell order in state

func (*StateMachine) SetOrderBook

func (s *StateMachine) SetOrderBook(b *lib.OrderBook) lib.ErrorI

SetOrderBook() sets the order book for a committee in the state db

func (*StateMachine) SetOrderBooks

func (s *StateMachine) SetOrderBooks(list *lib.OrderBooks, supply *Supply) lib.ErrorI

SetOrderBooks() sets a series of OrderBooks in the state db

func (*StateMachine) SetParams

func (s *StateMachine) SetParams(p *Params) lib.ErrorI

SetParams() writes an entire Params object into state

func (*StateMachine) SetParamsCons

func (s *StateMachine) SetParamsCons(c *ConsensusParams) lib.ErrorI

SetParamsCons() sets Consensus params into state

func (*StateMachine) SetParamsFee

func (s *StateMachine) SetParamsFee(f *FeeParams) lib.ErrorI

SetParamsFee() sets Fee params into state

func (*StateMachine) SetParamsGov

func (s *StateMachine) SetParamsGov(g *GovernanceParams) lib.ErrorI

SetParamsGov() sets Governance params into state

func (*StateMachine) SetParamsVal

func (s *StateMachine) SetParamsVal(v *ValidatorParams) lib.ErrorI

SetParamsVal() sets Validator params into state

func (*StateMachine) SetPool

func (s *StateMachine) SetPool(pool *Pool) (err lib.ErrorI)

SetPool() upserts a Pool structure into the state

func (*StateMachine) SetPools

func (s *StateMachine) SetPools(pools []*Pool, supply *Supply) (err lib.ErrorI)

SetPools() upserts multiple Pool structures into the state

func (*StateMachine) SetProposalVoteConfig

func (s *StateMachine) SetProposalVoteConfig(c GovProposalVoteConfig)

func (*StateMachine) SetRetiredCommittees

func (s *StateMachine) SetRetiredCommittees(chainIds []uint64) (err lib.ErrorI)

SetRetiredCommittees() sets a list of chainIds as retired

func (*StateMachine) SetStore

func (s *StateMachine) SetStore(store lib.RWStoreI)

func (*StateMachine) SetSupply

func (s *StateMachine) SetSupply(supply *Supply) lib.ErrorI

SetSupply() upserts the Supply structure into the state

func (*StateMachine) SetValidator

func (s *StateMachine) SetValidator(validator *Validator) (err lib.ErrorI)

SetValidator() upserts a Validator object into the state

func (*StateMachine) SetValidatorPaused

func (s *StateMachine) SetValidatorPaused(address crypto.AddressI, validator *Validator, maxPausedHeight uint64) lib.ErrorI

SetValidatorPaused() updates a Validator as 'paused' with a MaxPausedHeight (height at which the Validator is force-unstaked for being paused too long)

func (*StateMachine) SetValidatorUnpaused

func (s *StateMachine) SetValidatorUnpaused(address crypto.AddressI, validator *Validator) lib.ErrorI

SetValidatorUnpaused() updates a Validator as 'unpaused'

func (*StateMachine) SetValidatorUnstaking

func (s *StateMachine) SetValidatorUnstaking(address crypto.AddressI, validator *Validator, finishUnstakingHeight uint64) lib.ErrorI

SetValidatorUnstaking() updates a Validator as 'unstaking' and removes it from its respective committees NOTE: finish unstaking height is the height in the future when the validator will be deleted and their funds be returned

func (*StateMachine) SetValidatorUnstakingIfBelowMinimum

func (s *StateMachine) SetValidatorUnstakingIfBelowMinimum(validator *Validator, params *ValidatorParams) (bool, lib.ErrorI)

SetValidatorUnstakingIfBelowMinimum() updates a validator as 'unstaking' and removes it from its respective committees if it is below the minimum stake according to saved params

func (*StateMachine) SetValidators

func (s *StateMachine) SetValidators(validators []*Validator, supply *Supply) lib.ErrorI

SetValidators() upserts multiple Validators into the state and updates the supply tracker

func (*StateMachine) SetValidatorsPaused

func (s *StateMachine) SetValidatorsPaused(chainId uint64, addresses [][]byte)

SetValidatorsPaused() automatically updates all validators as if they'd submitted a MessagePause

func (*StateMachine) SlashAndResetNonSigners

func (s *StateMachine) SlashAndResetNonSigners(chainId uint64, params *ValidatorParams) (err lib.ErrorI)

SlashAndResetNonSigners() resets the non-signer tracking and slashes those who exceeded the MaxNonSign threshold

func (*StateMachine) SlashDoubleSigners

func (s *StateMachine) SlashDoubleSigners(chainId uint64, params *ValidatorParams, doubleSignerAddrs [][]byte) lib.ErrorI

SlashDoubleSigners() burns the staked tokens of double signers

func (*StateMachine) SlashNonSigners

func (s *StateMachine) SlashNonSigners(chainId uint64, params *ValidatorParams, nonSignerAddrs [][]byte) lib.ErrorI

SlashNonSigners() burns the staked tokens of non-quorum-certificate-signers

func (*StateMachine) SlashValidator

func (s *StateMachine) SlashValidator(validator *Validator, chainId, percent uint64, p *ValidatorParams) (err lib.ErrorI)

SlashValidator() burns a specified percentage of a validator's staked tokens

func (*StateMachine) SlashValidators

func (s *StateMachine) SlashValidators(addresses [][]byte, chainId, percent uint64, p *ValidatorParams) lib.ErrorI

SlashValidators() burns a specified percentage of multiple validator's staked tokens

func (*StateMachine) Store

func (s *StateMachine) Store() lib.RWStoreI

various self-explanatory 1 line functions below

func (*StateMachine) SubFromCommitteeStakedSupplyForChain

func (s *StateMachine) SubFromCommitteeStakedSupplyForChain(chainId uint64, amount uint64) lib.ErrorI

SubFromCommitteeStakedSupplyForChain() removes from the committee staked supply count

func (*StateMachine) SubFromDelegateStakedSupplyForChain

func (s *StateMachine) SubFromDelegateStakedSupplyForChain(chainId uint64, amount uint64) lib.ErrorI

SubFromDelegateStakedSupplyForChain() removes from the delegate committee staked supply count

func (*StateMachine) SubFromDelegateSupply

func (s *StateMachine) SubFromDelegateSupply(amount uint64) lib.ErrorI

SubFromDelegateSupply() removes from the delegated supply count

func (*StateMachine) SubFromStakedSupply

func (s *StateMachine) SubFromStakedSupply(amount uint64) lib.ErrorI

SubFromStakedSupply() removes from the staked supply count (staked + delegated)

func (*StateMachine) SubFromTotalSupply

func (s *StateMachine) SubFromTotalSupply(amount uint64) lib.ErrorI

SubFromTotalSupply() removes from the total supply count

func (*StateMachine) TimeMachine

func (s *StateMachine) TimeMachine(height uint64) (*StateMachine, lib.ErrorI)

TimeMachine() creates a new StateMachine instance representing the blockchain state at a specified block height, allowing for a read-only view of the past state

func (*StateMachine) TotalVDFIterations

func (s *StateMachine) TotalVDFIterations() uint64

func (*StateMachine) TxnWrap

func (s *StateMachine) TxnWrap() (lib.StoreI, lib.ErrorI)

TxnWrap() is an atomicity and consistency feature that enables easy rollback of changes by discarding the transaction if an error occurs

func (*StateMachine) UpdateCommittees

func (s *StateMachine) UpdateCommittees(address crypto.AddressI, oldValidator *Validator, newStakedAmount uint64, newCommittees []uint64) lib.ErrorI

UpdateCommittees() updates the committee information in state for a specific validator

func (*StateMachine) UpdateDelegations

func (s *StateMachine) UpdateDelegations(address crypto.AddressI, oldValidator *Validator, newStakedAmount uint64, newCommittees []uint64) lib.ErrorI

UpdateDelegations() updates the delegate information for an address, first removing the outdated delegation information and then setting the new info

func (*StateMachine) UpdateLastProposers

func (s *StateMachine) UpdateLastProposers(address []byte) lib.ErrorI

UpdateLastProposers() adds an address to the 'last proposers'

func (*StateMachine) UpdateParam

func (s *StateMachine) UpdateParam(paramSpace, paramName string, value proto.Message) (err lib.ErrorI)

UpdateParam() updates a governance parameter keyed by space and name

func (*StateMachine) UpdateValidatorStake

func (s *StateMachine) UpdateValidatorStake(val *Validator, newCommittees []uint64, amountToAdd uint64) (err lib.ErrorI)

UpdateValidatorStake() updates the stake of the validator object in state - updating the corresponding committees and supply NOTE: new stake amount must be GTE the previous stake amount

func (*StateMachine) UpsertCommitteeData

func (s *StateMachine) UpsertCommitteeData(new *lib.CommitteeData) lib.ErrorI

UpsertCommitteeData() updates or inserts a committee data to the committees data list

func (*StateMachine) ValidateGenesisState

func (s *StateMachine) ValidateGenesisState(genesis *GenesisState) (err lib.ErrorI)

ValidateGenesisState() validates a GenesisState object

func (*StateMachine) VerifyRLPBytes

func (s *StateMachine) VerifyRLPBytes(tx *lib.Transaction) lib.ErrorI

VerifyRLPBytes() implements special 'signature verification logic' that allows a MessageSend to be authenticated using a signed RLP transaction

type Supply

type Supply struct {

	// total: the total tokens existing in the system - minted tokens are added, burned tokens are removed
	Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	// staked: the total locked tokens in the protocol - this includes delegated
	Staked uint64 `protobuf:"varint,2,opt,name=staked,proto3" json:"staked,omitempty"`
	// delegated_only: the total locked tokens that are delegated only
	DelegatedOnly uint64 `protobuf:"varint,3,opt,name=delegated_only,json=delegatedOnly,proto3" json:"delegatedOnly"` // @gotags: json:"delegatedOnly"
	// committee_staked: a list of committees and their 'committed (staked + delegated)' tokens, sorted by stake
	CommitteeStaked []*Pool `protobuf:"bytes,4,rep,name=committee_staked,json=committeeStaked,proto3" json:"committeeStaked"` // @gotags: json:"committeeStaked"
	// committee_delegated_only: a list of committees and their 'delegated only' tokens, sorted by stake
	CommitteeDelegatedOnly []*Pool `protobuf:"bytes,5,rep,name=committee_delegated_only,json=committeeDelegatedOnly,proto3" json:"committeeDelegatedOnly"` // @gotags: json:"committeeDelegatedOnly"
	// contains filtered or unexported fields
}

A supply structure 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 NOTE: 'staked' includes delegations, to calculate stake without delegations, simply staked - delegated_only

func (*Supply) Descriptor deprecated

func (*Supply) Descriptor() ([]byte, []int)

Deprecated: Use Supply.ProtoReflect.Descriptor instead.

func (*Supply) GetCommitteeDelegatedOnly

func (x *Supply) GetCommitteeDelegatedOnly() []*Pool

func (*Supply) GetCommitteeStaked

func (x *Supply) GetCommitteeStaked() []*Pool

func (*Supply) GetDelegatedOnly

func (x *Supply) GetDelegatedOnly() uint64

func (*Supply) GetStaked

func (x *Supply) GetStaked() uint64

func (*Supply) GetTotal

func (x *Supply) GetTotal() uint64

func (*Supply) ProtoMessage

func (*Supply) ProtoMessage()

func (*Supply) ProtoReflect

func (x *Supply) ProtoReflect() protoreflect.Message

func (*Supply) Reset

func (x *Supply) Reset()

func (*Supply) Sort

func (x *Supply) Sort()

Sort() sorts the list of Pools for committees and delegations by amount (stake) high to low

func (*Supply) SortCommittees

func (x *Supply) SortCommittees()

SortCommittees() sorts the committees list by amount (stake) high to low

func (*Supply) SortDelegations

func (x *Supply) SortDelegations()

SortCommittees() sorts the delegations list by amount (stake) high to low

func (*Supply) String

func (x *Supply) String() string

type SupplyPoolType

type SupplyPoolType int
const (
	CommitteesWithDelegations SupplyPoolType = 0
	DelegationsOnly           SupplyPoolType = 1
)

type Validator

type Validator struct {

	// address: the short version of the public key of the operator of the service, corresponding to the 2
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// public_key: the public cryptographic identity of the operator of the service. This key must be an aggregable BLS
	// key for efficiency in the BFT process.
	PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// net_address: the tcp peer-to-peer address of the node to enable easy discovery of the peer for multi-consensus
	NetAddress string `protobuf:"bytes,3,opt,name=net_address,json=netAddress,proto3" json:"netAddress"` // @gotags: json:"netAddress"
	// staked_amount: the amount of tokens locked as a surety bond against malicious behavior. These tokens may be
	// increased by auto-compounding rewards or by an edit-stake command. This bond is returned to the output address
	// after executing an unstake command and waiting the unstaking period.
	StakedAmount uint64 `protobuf:"varint,4,opt,name=staked_amount,json=stakedAmount,proto3" json:"stakedAmount"` // @gotags: json:"stakedAmount"
	// committees: a list of ids of the committees the validator is offering Validation or Delegation services for
	Committees []uint64 `protobuf:"varint,5,rep,packed,name=committees,proto3" json:"committees,omitempty"`
	// max_paused_height: if the Validator is paused, this value tracks the maximum height it may be paused before it
	// automatically begins unstaking
	MaxPausedHeight uint64 `protobuf:"varint,6,opt,name=max_paused_height,json=maxPausedHeight,proto3" json:"maxPausedHeight"` // @gotags: json:"maxPausedHeight"
	// unstaking_height: if the Validator is unstaking, this value tracks the future block height a Validator's surety
	// bond will be returned
	UnstakingHeight uint64 `protobuf:"varint,7,opt,name=unstaking_height,json=unstakingHeight,proto3" json:"unstakingHeight"` // @gotags: json:"unstakingHeight"
	// output: the address where early-withdrawal rewards and the unstaking surety bond are transferred to
	Output []byte `protobuf:"bytes,8,opt,name=output,proto3" json:"output,omitempty"`
	// delegate: signals whether the Validator is a Delegate or not. If true, the Validator only passively participates
	// in Validation-as-a-Service by dedicating their funds to help the chain qualify for protocol subsidisation
	Delegate bool `protobuf:"varint,9,opt,name=delegate,proto3" json:"delegate,omitempty"`
	// compound: signals whether the Validator is auto-compounding (increasing their stake with new rewards) or
	// withdrawing rewards early to their output address as they come in
	Compound bool `protobuf:"varint,10,opt,name=compound,proto3" json:"compound,omitempty"`
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _

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 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.

func (*Validator) Descriptor deprecated

func (*Validator) Descriptor() ([]byte, []int)

Deprecated: Use Validator.ProtoReflect.Descriptor instead.

func (*Validator) GetAddress

func (x *Validator) GetAddress() []byte

func (*Validator) GetCommittees

func (x *Validator) GetCommittees() []uint64

func (*Validator) GetCompound

func (x *Validator) GetCompound() bool

func (*Validator) GetDelegate

func (x *Validator) GetDelegate() bool

func (*Validator) GetMaxPausedHeight

func (x *Validator) GetMaxPausedHeight() uint64

func (*Validator) GetNetAddress

func (x *Validator) GetNetAddress() string

func (*Validator) GetOutput

func (x *Validator) GetOutput() []byte

func (*Validator) GetPublicKey

func (x *Validator) GetPublicKey() []byte

func (*Validator) GetStakedAmount

func (x *Validator) GetStakedAmount() uint64

func (*Validator) GetUnstakingHeight

func (x *Validator) GetUnstakingHeight() uint64

func (*Validator) MarshalJSON

func (x *Validator) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the Validator object

func (*Validator) PassesFilter

func (x *Validator) PassesFilter(f lib.ValidatorFilters) (ok bool)

PassesFilter() returns if the Validator object passes the filter (true) or is filtered out (false)

func (*Validator) ProtoMessage

func (*Validator) ProtoMessage()

func (*Validator) ProtoReflect

func (x *Validator) ProtoReflect() protoreflect.Message

func (*Validator) Reset

func (x *Validator) Reset()

func (*Validator) String

func (x *Validator) String() string

func (*Validator) UnmarshalJSON

func (x *Validator) UnmarshalJSON(bz []byte) error

UnmarshalJSON() is the json.Unmarshaler implementation for the Validator object

type ValidatorPage

type ValidatorPage []*Validator

func (*ValidatorPage) New

func (p *ValidatorPage) New() lib.Pageable

ValidatorPage satisfies the Page interface

type ValidatorParams

type ValidatorParams struct {

	// unstaking_blocks: is the number of blocks a validator's staked tokens must remain locked and slashable after
	// sending 'unstake_validator'. Without unstaking blocks, validators could withdraw their stake right after attempting
	// malicious behavior, like double-signing or failing to validate correctly
	UnstakingBlocks uint64 `protobuf:"varint,1,opt,name=unstaking_blocks,json=unstakingBlocks,proto3" json:"unstakingBlocks"` // @gotags: json:"unstakingBlocks"
	// max_pause_blocks: is the maximum number of blocks a validator may be paused before being 'force unstaked'.
	// This is necessary to prevent dead validators from forever existing in the state
	MaxPauseBlocks uint64 `protobuf:"varint,2,opt,name=max_pause_blocks,json=maxPauseBlocks,proto3" json:"maxPauseBlocks"` // @gotags: json:"maxPauseBlocks"
	// double_sign_slash_percentage: is the percentage of staked tokens that are slashed when a Validator is caught
	// performing a double-sign (signing two different blocks for the same block height and round,
	// supporting conflicting versions of the blockchain)
	DoubleSignSlashPercentage uint64 `` // @gotags: json:"doubleSignSlashPercentage"
	/* 128-byte string literal not displayed */
	// non_sign_slash_percentage: is the percentage of staked tokens that are slashed when a Validator doesn't sign a
	// number of blocks over the max_non_sign threshold within the non_sign_window blocks.
	NonSignSlashPercentage uint64 `protobuf:"varint,4,opt,name=non_sign_slash_percentage,json=nonSignSlashPercentage,proto3" json:"nonSignSlashPercentage"` // @gotags: json:"nonSignSlashPercentage"
	// max_non_sign: is the maximum number of blocks a Validator may not sign before being slashed, a threshold system
	// provides lee-way for accidental non-sign faults
	MaxNonSign uint64 `protobuf:"varint,5,opt,name=max_non_sign,json=maxNonSign,proto3" json:"maxNonSign"` // @gotags: json:"maxNonSign"
	// non_sign_window: is the period of blocks in which a validator’s count of missed signatures (non-signs) is tracked
	// before it is reset. During this window, if a validator fails to sign blocks, the missed count is incremented
	// Once the window expires, the non-sign count is reset, providing the validator a chance to recover without immediate
	// penalties
	NonSignWindow uint64 `protobuf:"varint,6,opt,name=non_sign_window,json=nonSignWindow,proto3" json:"nonSignWindow"` // @gotags: json:"nonSignWindow"
	// max_committees: is the maximum number of committees a validator is allowed to stake for
	MaxCommittees uint64 `protobuf:"varint,7,opt,name=max_committees,json=maxCommittees,proto3" json:"maxCommittees"` // @gotags: json:"maxCommittees"
	// max_committee_size: is the maximum number of active validators a committee may have participating in BFT at any
	// one view
	MaxCommitteeSize uint64 `protobuf:"varint,8,opt,name=max_committee_size,json=maxCommitteeSize,proto3" json:"maxCommitteeSize"` // @gotags: json:"maxCommitteeSize"
	// early_withdrawal_penalty: is the percent reward deduction if NOT compounding validator rewards
	EarlyWithdrawalPenalty uint64 `protobuf:"varint,9,opt,name=early_withdrawal_penalty,json=earlyWithdrawalPenalty,proto3" json:"earlyWithdrawalPenalty"` // @gotags: json:"earlyWithdrawalPenalty"
	// delegate_unstaking_blocks: is the number of blocks a delegate validator's staked tokens must remain locked.
	// Since there's no slashing of delegates, this variable affects economic stability more than security
	DelegateUnstakingBlocks uint64 `protobuf:"varint,10,opt,name=delegate_unstaking_blocks,json=delegateUnstakingBlocks,proto3" json:"delegateUnstakingBlocks"` // @gotags: json:"delegateUnstakingBlocks"
	// minimum_order_size: is the minimum amount a 'sell order' must sell in order to be valid
	MinimumOrderSize uint64 `protobuf:"varint,11,opt,name=minimum_order_size,json=minimumOrderSize,proto3" json:"minimumOrderSize"` // @gotags: json:"minimumOrderSize"
	// stake_percent_for_subsidized_committee: is the minimum percentage of total stake that a committee must have
	// committed to it in order to be considered "subsidized" by the protocol
	StakePercentForSubsidizedCommittee uint64 `` // @gotags: json:"stakePercentForSubsidizedCommittee"
	/* 157-byte string literal not displayed */
	// max_slash_per_committee: is the maximum slash per committee per block that a validator may receive.
	// If the slash exceeds maximum, the validator will be auto-removed from the committee to protect all parties from
	// cascading failures.
	MaxSlashPerCommittee uint64 `protobuf:"varint,13,opt,name=max_slash_per_committee,json=maxSlashPerCommittee,proto3" json:"maxSlashPerCommittee"` // @gotags: json:"maxSlashPerCommittee"
	// delegate_reward_percentage: is the percentage of the block reward that is awarded to the delegates
	DelegateRewardPercentage uint64 `protobuf:"varint,14,opt,name=delegate_reward_percentage,json=delegateRewardPercentage,proto3" json:"delegateRewardPercentage"` // @gotags: json:"delegateRewardPercentage"
	// buy_deadline_blocks: amount of blocks a 'buyer' has to complete an order they 'reserved'
	BuyDeadlineBlocks uint64 `protobuf:"varint,15,opt,name=buy_deadline_blocks,json=buyDeadlineBlocks,proto3" json:"buyDeadlineBlocks"` // @gotags: json:"buyDeadlineBlocks"
	// lock_order_fee_multiplier: the fee multiplier of the 'send' fee that is required to execute a lock order
	LockOrderFeeMultiplier uint64 `protobuf:"varint,16,opt,name=lock_order_fee_multiplier,json=lockOrderFeeMultiplier,proto3" json:"lockOrderFeeMultiplier"` // @gotags: json:"lockOrderFeeMultiplier"
	// minimum_stake_for_validators: is the least amount a validator must stake to qualify as staked
	MinimumStakeForValidators uint64 `` // @gotags: json:"minimumStakeForValidators"
	/* 129-byte string literal not displayed */
	// minimum_stake_for_delegates: is the least amount a delegator must stake to qualify as staked
	MinimumStakeForDelegates uint64 `` // @gotags: json:"minimumStakeForDelegates"
	/* 126-byte string literal not displayed */
	// maximum_delegates_per_committee: is the maximum number of delegates that can be chose as lottery winners
	MaximumDelegatesPerCommittee uint64 `` // @gotags: json:"maximumDelegatesPerCommittee"
	/* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

ValidatorParams is the parameter space that defines the rules and criteria for validators in the blockchain

func (*ValidatorParams) Check

func (x *ValidatorParams) Check() lib.ErrorI

Check() validates the Validator params

func (*ValidatorParams) Descriptor deprecated

func (*ValidatorParams) Descriptor() ([]byte, []int)

Deprecated: Use ValidatorParams.ProtoReflect.Descriptor instead.

func (*ValidatorParams) GetBuyDeadlineBlocks

func (x *ValidatorParams) GetBuyDeadlineBlocks() uint64

func (*ValidatorParams) GetDelegateRewardPercentage

func (x *ValidatorParams) GetDelegateRewardPercentage() uint64

func (*ValidatorParams) GetDelegateUnstakingBlocks

func (x *ValidatorParams) GetDelegateUnstakingBlocks() uint64

func (*ValidatorParams) GetDoubleSignSlashPercentage

func (x *ValidatorParams) GetDoubleSignSlashPercentage() uint64

func (*ValidatorParams) GetEarlyWithdrawalPenalty

func (x *ValidatorParams) GetEarlyWithdrawalPenalty() uint64

func (*ValidatorParams) GetLockOrderFeeMultiplier

func (x *ValidatorParams) GetLockOrderFeeMultiplier() uint64

func (*ValidatorParams) GetMaxCommitteeSize

func (x *ValidatorParams) GetMaxCommitteeSize() uint64

func (*ValidatorParams) GetMaxCommittees

func (x *ValidatorParams) GetMaxCommittees() uint64

func (*ValidatorParams) GetMaxNonSign

func (x *ValidatorParams) GetMaxNonSign() uint64

func (*ValidatorParams) GetMaxPauseBlocks

func (x *ValidatorParams) GetMaxPauseBlocks() uint64

func (*ValidatorParams) GetMaxSlashPerCommittee

func (x *ValidatorParams) GetMaxSlashPerCommittee() uint64

func (*ValidatorParams) GetMaximumDelegatesPerCommittee

func (x *ValidatorParams) GetMaximumDelegatesPerCommittee() uint64

func (*ValidatorParams) GetMinimumOrderSize

func (x *ValidatorParams) GetMinimumOrderSize() uint64

func (*ValidatorParams) GetMinimumStakeForDelegates

func (x *ValidatorParams) GetMinimumStakeForDelegates() uint64

func (*ValidatorParams) GetMinimumStakeForValidators

func (x *ValidatorParams) GetMinimumStakeForValidators() uint64

func (*ValidatorParams) GetNonSignSlashPercentage

func (x *ValidatorParams) GetNonSignSlashPercentage() uint64

func (*ValidatorParams) GetNonSignWindow

func (x *ValidatorParams) GetNonSignWindow() uint64

func (*ValidatorParams) GetStakePercentForSubsidizedCommittee

func (x *ValidatorParams) GetStakePercentForSubsidizedCommittee() uint64

func (*ValidatorParams) GetUnstakingBlocks

func (x *ValidatorParams) GetUnstakingBlocks() uint64

func (*ValidatorParams) ProtoMessage

func (*ValidatorParams) ProtoMessage()

func (*ValidatorParams) ProtoReflect

func (x *ValidatorParams) ProtoReflect() protoreflect.Message

func (*ValidatorParams) Reset

func (x *ValidatorParams) Reset()

func (*ValidatorParams) SetString

func (x *ValidatorParams) SetString(_ string, _ string) lib.ErrorI

SetString() update a string parameter in the structure

func (*ValidatorParams) SetUint64

func (x *ValidatorParams) SetUint64(paramName string, value uint64) lib.ErrorI

SetUint64() update a uint64 parameter in the structure

func (*ValidatorParams) String

func (x *ValidatorParams) String() string

type ValidatorsList

type ValidatorsList struct {
	List []*Validator `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"`
	// contains filtered or unexported fields
}

ValidatorsList is stored as a single blob (instead of using prefixed keys) for the following reasons:

  • Filesystem database iterators (e.g., in LevelDB/BadgerDB) introduce significant overhead and are often slow, especially when reading or updating large sets of keys every block.

  • The total number of validators is expected to remain below 100,000, and each entry is relatively small (~200 bytes), making a full in-memory deserialization manageable and performant.

  • Validators are expected to participate in most committees, so the majority of the list is relevant to each context, and filtering from a single list is faster than multiple disk reads.

  • Storing separate, per-committee lists (especially if sorted and updated every block) would create substantial additional write and storage overhead compared to maintaining a single, compact list.

func (*ValidatorsList) Descriptor deprecated

func (*ValidatorsList) Descriptor() ([]byte, []int)

Deprecated: Use ValidatorsList.ProtoReflect.Descriptor instead.

func (*ValidatorsList) GetList

func (x *ValidatorsList) GetList() []*Validator

func (*ValidatorsList) ProtoMessage

func (*ValidatorsList) ProtoMessage()

func (*ValidatorsList) ProtoReflect

func (x *ValidatorsList) ProtoReflect() protoreflect.Message

func (*ValidatorsList) Reset

func (x *ValidatorsList) Reset()

func (*ValidatorsList) String

func (x *ValidatorsList) String() string

type VotePoll

type VotePoll struct {
	VotePoll string `json:"votePoll"`
	Approve  bool   `json:"approve"`
}

VotePoll represents the structure of a voting action on a poll It is used to encode data into JSON format for storing in memo fields

type VoteStats

type VoteStats struct {
	ApproveTokens     uint64 `json:"approveTokens"`    // power (tokens) that voted 'yay'
	RejectTokens      uint64 `json:"rejectTokens"`     // power (tokens)  that voted 'nay'
	TotalVotedTokens  uint64 `json:"totalVotedTokens"` // total power (tokens) that already voted
	TotalTokens       uint64 `json:"totalTokens"`      // total power (tokens)  that could possibly vote
	ApprovePercentage uint64 `json:"approvedPercent"`  // percent representation of power (tokens) that voted 'yay' out of total power
	RejectPercentage  uint64 `json:"rejectPercent"`    // percent representation of power (tokens) that voted 'nay' out of total power
	VotedPercentage   uint64 `json:"votedPercent"`     // percent representation of power (tokens) voted out of total power
}

VoteStats: are demonstrative statistics about poll voting

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL