ZetaChain Node

repository·main·Indexed 42 days ago

https://github.com/zeta-chain/node

Core node implementation for ZetaChain, featuring the zetae2e CLI for cross-chain testing between ZetaChain, Bitcoin, and EVM networks, the ZetaTool CLI for tracking CCTX status and database statistics, and a Docker-based Local Net environment for development and resilience testing.

Tokens
272.4K
Snippets
893
Records
1.1K
Agent score
51%

What's inside ZetaChain

  1. Overview of the `e2e` testing suite

    main
    The e2e suite is a comprehensive set of end-to-end tests designed to validate ZetaChain network integration, specifically focusing on cross-chain interactions between ZetaChain, Bitcoin, and EVM (Ethereum Virtual Machine) networks. It ensures the reliability of ZetaChain's cross-chain functionalities.
  2. Overview of the fungible module

    main

    The fungible module manages the deployment and lifecycle of fungible tokens from connected blockchains (referred to as "foreign coins") on ZetaChain.

    Key functionalities include:

    • Foreign Coin Deployment: When a foreign coin is deployed, the module automatically deploys a ZRC20 contract, creates a liquidity pool, adds liquidity, and registers the coin in the module's state.
    • System Contract Deployment: Handles the deployment of system contracts, Uniswap, and wrapped ZETA.
    • Omnichain Interactions: Enables depositing to and calling omnichain smart contracts on ZetaChain from connected chains using DepositZRC20AndCallContract and DepositZRC20.

    Foreign coins are represented as ZRC20 tokens on ZetaChain. The module relies heavily on the protocol contracts.

  3. Overview of Zetaclient TSS

    main
    The zetaclient/tss package provides a high-level API for signing arbitrary digests using a Threshold Signature Scheme (TSS). It wraps the go-tss library, which in turn relies on tss-lib. This allows for secure, distributed signing of cryptographic inputs.
  4. Use the Gov Precompile to interact with Cosmos SDK governance

    main

    The Gov precompile provides an EVM interface to the Cosmos SDK governance module. It allows smart contracts to submit proposals, manage deposits, vote, and query governance state.

    Precompile Address: 0x00000000000000000000000000000000000000805

    IGov gov = IGov(0x00000000000000000000000000000000000000805);
  5. Use ZetaTool CLI functionalities

    main

    ZetaTool provides three primary commands for interacting with the ZetaChain node and its data:

    • get-ballot: Retrieves the inbound ballot (CCTX) identifier. You must provide the inbound hash and the chain ID.
    • track-cctx: Monitors the status of a Cross-Chain Transaction (CCTX). You must provide the inbound hash and the chain ID.
    • db-stats: Displays detailed statistics regarding the application database.
  6. Query distribution module commands

    main

    The distribution module provides various querying commands to inspect validator commissions, community pools, rewards, and more. Use zetacored query distribution [flags] to access the subcommands.

    Available Subcommands:

    • commission: Query validator commission.
    • community-pool: Query the amount of coins in the community pool.
    • delegator-validators: Execute the DelegatorValidators RPC method.
    • delegator-withdraw-address: Execute the DelegatorWithdrawAddress RPC method.
    • params: Query current distribution parameters.
    • rewards: Query all distribution delegator rewards.
    • rewards-by-validator: Query all distribution delegator from a particular validator.
    • slashes: Query distribution validator slashes.
    • validator-distribution-info: Query validator distribution info.
    • validator-outstanding-rewards: Query outstanding (un-withdrawn) rewards for a validator and their delegations.
    zetacored query distribution [flags]
  7. Use the Distribution Precompile

    main

    The Distribution precompile provides an EVM interface to the Cosmos SDK x/distribution module at address 0x0000000000000000000000000000000000000801. It allows smart contracts to interact with staking rewards, validator commissions, and the community pool. It supports querying rewards and performing operations like claiming, withdrawing, and funding.

    Key Features:

    • Reward Management: Claim and withdraw delegator rewards or validator commissions.
    • Community Pool: Fund the community pool or query its balance.
    • Address Compatibility: Supports both hex and bech32 address formats (automatically converted for Cosmos SDK compatibility).
    • Authorization: Most methods require the caller to be the specific delegator or validator involved in the operation.
    address distributionPrecompile = 0x0000000000000000000000000000000000000801;
  8. Use the Zetachain x Sui Gateway minimized package for upgrade tests

    main

    The e2e/contracts/sui/protocol-contracts-sui-upgrade package provides a minimized version of the Sui gateway project specifically for testing gateway upgrades.

    This package is required when running the sui client upgrade command because the upgrade process necessitates the presence of the complete gateway package for re-publishing.

    This version is derived from the protocol-contracts-sui repository but includes a specific helper function to verify the upgrade status.

  9. Use the Staking Precompile

    main

    The Staking precompile provides an EVM interface to the Cosmos SDK staking module. It allows smart contracts to perform staking operations such as validator management, delegation, undelegation, and redelegation.

    Precompile Address: 0x0000000000000000000000000000000000000800

    // Access the precompile via its fixed address
    StakingI staking = StakingI(0x0000000000000000000000000000000000000800);
  10. What is the P256 Precompile?

    main
    The P256 precompile implements secp256r1 (also known as P-256 or prime256v1) elliptic curve signature verification as defined in EIP-7212. It allows smart contracts to verify signatures from devices and systems using the secp256r1 curve, such as WebAuthn authenticators, secure enclaves, and hardware security modules (HSMs).
  11. Overview of ZetaChain simulation testing

    main
    ZetaChain simulation tests evaluate how the blockchain application behaves under real-life circumstances by generating and sending randomized messages. The primary objectives are to detect and debug failures that could potentially halt a live chain. The simulator provides logs, statistics about operations, and the ability to export the latest application state.
  12. Overview of the emissions module

    main

    The emissions module orchestrates the distribution of rewards to observers, validators, and TSS (Threshold Signature Scheme) signers.

    Key behaviors:

    • Validator Rewards: Currently, rewards are distributed to validators every block.
    • TSS and Observer Rewards: Undistributed amounts for TSS signers and observers are held in their respective pools until distribution occurs.
    • Lifecycle: Reward distribution is implemented within the begin blocker of the blockchain lifecycle.