Only this pageAll pages
Powered by GitBook
1 of 23

W Chain Network

Welcome to W Chain

Loading...

Loading...

Working with a Node

Loading...

Loading...

Loading...

Consensus

Loading...

W Swap

Loading...

Loading...

Loading...

Advanced Features

Loading...

Loading...

Loading...

Loading...

Loading...

Tutorial

Loading...

Loading...

Loading...

Key Features That Make W Chain

Mainnet and Testnet:

  • The W Chain Mainnet is our fully operational network, where real-world applications are deployed securely and efficiently.

  • The W Chain Testnet is a safe testing environment for developers to experiment, deploy, and fine-tune applications before launching on the Mainnet.

Hybrid Blockchain: W Chain’s hybrid model offers the best of both worlds—public blockchain for transparency and community-driven applications, and private blockchain for businesses that need tighter control over their data and operations.

High Performance: W Chain is built to handle thousands of transactions per second (TPS), ensuring that no matter the scale, your business can run smoothly without interruptions or delays.

Scalability: Our architecture is designed to grow with you. Whether you're a startup or a global enterprise, W Chain can scale to meet your needs with ease.

DeFi-Ready: Developers can quickly deploy decentralized finance applications, from staking mechanisms to complex lending and borrowing protocols.

Web3 Wallet Setup

As a full pledged EVM compatible network, you can interact with W Chain Network using all popular Web3 Wallet app. (i.e. Rabby, Metamask, Rainbow, Phantom, etc).

Add the following Network Information to your Wallet App. Depends on your app choice, it may fall under "Add Custom Network" section.

  • Network name: W Chain

  • RPC URL: https://rpc.w-chain.com

  • ChainID: 171717

  • Currency Symbol: WCO

  • Decimals: 18 (if asked)

  • Block explorer URL:

  • Network name: W Chain Testnet

  • RPC URL:

  • ChainID: 71117

  • Currency Symbol:

WCO
  • Block explorer URL: https://scan-testnet.w-chain.com

  • https://scan.w-chain.com
    https://rpc-testnet.w-chain.com

    Node

    Overview

    In a Proof-of-Stake (PoS) Ethereum Virtual Machine (EVM) compatible blockchain, nodes form the foundational infrastructure that ensures the network’s functionality, security, and decentralization. Nodes are broadly classified into two categories—Validator Nodes and Non-Validator Nodes—each fulfilling specific roles within the ecosystem. This section provides a high-level introduction to these node types and their contributions to a PoS EVM network, setting the stage for detailed exploration in subsequent sections.

    Node Types and Roles

    Validator Node

    Validator Nodes are active participants in the PoS consensus mechanism. By staking a required amount of cryptocurrency, these nodes are responsible for validating transactions, proposing new blocks, and finalizing them through a process known as "sealing." They play a critical role in maintaining the network’s security and integrity, earning staking rewards and transaction fees in return for their efforts.

    Non-Validator Node

    Non-Validator Nodes, identified by a seal: false configuration, do not engage in the consensus process or block production. Operating as full nodes or light nodes, they focus on synchronizing with the blockchain, verifying transactions and blocks for local use, and relaying data across the network. These nodes enhance accessibility, support decentralized data propagation, and provide infrastructure for applications and users without the resource-intensive demands of validation.

    Network Contribution

    Validator Nodes drive the core operations of block creation and consensus, ensuring the blockchain progresses securely and consistently. Non-Validator Nodes complement this by bolstering network resilience, enabling data availability, and facilitating broader participation. Together, they create a balanced and robust PoS EVM environment.

    Audit Reports

    Audit Category
    Audit Files

    W Chain L1 Blockchain Audit Report

    W-Chain-Audit-Report.pdf

    W Coin Migration Portal Audit Report

    W Coin Migration Audit Report.pdf

    Introduction and Overview

    Welcome to W Chain

    W Chain is a next-generation blockchain platform designed to bring trust, transparency, and efficiency to global payments and decentralized finance (DeFi). By combining the strengths of public and private blockchain technologies, W Chain provides businesses, developers, and users with a flexible and secure foundation to build innovative applications that scale with their needs.

    What is W Chain?

    W Chain is a hybrid blockchain platform that blends the openness and transparency of public blockchains with the control and security of private networks. This unique architecture ensures that businesses can operate with confidence, knowing they have the flexibility to maintain privacy where needed, while also benefiting from the decentralization of a public chain.

    Our vision is simple: to create a world where financial transactions are fast, secure, and accessible to everyone, everywhere. Whether you’re sending cross-border payments, developing cutting-edge DeFi applications, or securing enterprise data, W Chain empowers you to do it all efficiently and cost-effectively.

    Trade

    This guide explains how to use the Trade page of W Swap. The interface is a familiar Uniswap V2-style experience adapted for W Chain (native token WCO) with the same core flow: connect a wallet, select tokens, approve if required, set slippage, and confirm the trade.

    Overview

    • Network: W Chain (EVM-compatible; native gas token WCO)

    Purpose: Trade between supported ERC‑20 tokens on W Chain

  • Model: a constant-product AMM (x·y = k)

  • Key actions: Token selection, allowance approval, slippage and deadline configuration, transaction confirmation

  • Prerequisites

    • A supported EVM wallet such as Rabby (recommended) or MetaMask installed in your browser.

    • Some WCO to pay gas fees on W Chain.

    • Bridged or existing assets on W Chain. If your assets are on Ethereum or BNB Chain, you can use the Bridge page to bring them to W Chain first.

    Connect Your Wallet

    1. Open W Swap and click Connect Wallet.

    2. Select your wallet—Rabby (recommended) offers enhanced transaction safety; MetaMask is also supported.

    3. Switch to W Chain in your wallet when prompted. If W Chain is not added, the app can suggest adding it automatically.

    Select Tokens and Amounts

    1. On the Trade page, use the token selectors for From and To.

    2. Choose a token from the list or paste a contract address for custom tokens.

    3. Enter the From amount; the interface quotes the estimated output and route.

    4. Review:

      • Price Impact: Expected slippage due to trade size vs. pool depth.

      • Minimum Received: Accounted for slippage tolerance.

      • Route: The path across pools the trade will take.

    Notes on Wrapped Native Token:

    • Some interfaces label the wrapped native token as WETH historically. On W Chain, the native token is WCO, and its wrapped form may be shown as Wrapped WCO (WWCO). Treat any “WWCO or WETH” entry as the wrapped version of WCO used in pools.

    Allowance Approval (If Required)

    Many ERC‑20 tokens require an on-chain approval before they can be spent by the router.

    1. If you see an Approve button, click it to submit an approval transaction.

    2. Wait for confirmation in your wallet and the explorer.

    3. Once approved, the Swap button becomes available.

    Settings: Slippage and Deadline

    • Slippage Tolerance: Adjust in the settings panel to control acceptable price movement. A typical range is 0.1%–1% for liquid pools; higher for illiquid assets.

    • Transaction Deadline: Prevents stuck trades; the swap reverts if not included before the deadline.

    • Expert Mode: If available, use with caution; it disables some safety checks.

    Execute the Trade

    1. Click Trade (the button may be labeled Swap in the UI).

    2. Review the summary in the confirmation modal.

    3. Confirm in your wallet and wait for the transaction to be mined.

    4. Track the transaction via the link to scan.w-chain.com provided by the DApp.

    Troubleshooting

    • Insufficient Liquidity: Try smaller amounts or a different route.

    • Approval Failed: Reopen your wallet, confirm permissions, and retry.

    • High Price Impact Warning: Reduce trade size or split into smaller trades.

    • Transaction Reverted: Increase slippage tolerance slightly or check token allowances.

    • Stuck/Pending: Consider increasing gas settings in your wallet and resubmitting.

    Safety Tips

    • Only paste token addresses from trusted sources.

    • Double-check the Minimum Received value matches expectations.

    • Keep some WCO for gas; trades will fail if your gas balance is 0.

    FAQs

    • Can I trade from Ethereum or BNB Chain directly? No, first bridge supported assets to W Chain using the Bridge page, then trade on W Chain.

    • Why do I see Approve before Trade? ERC‑20 tokens require a one-time allowance for the router to spend your tokens.

    • Where do I view my transaction? Use the explorer link (e.g., https://scan.w-chain.com/tx/<hash>).

    Smart contract

    W Chain utilizes the Ethereum Virtual Machine (EVM) in the backend. Smart contracts are written in Solidity and they can function on W Chain as they do on Ethereum. To deploy a smart contract, you send a transaction containing your bytecode without specifying any recipients. After the contract is deployed, it will be available to all users of the W Chain network.

    You don't have to write and deploy your smart contract manually like that, there many tools or frameworks that will help you write, test and deploy your smart contracts in better ways.

    Foundry

    Foundry is an open-source, modern development framework designed for writing, testing, and deploying Solidity smart contracts for Ethereum and other EVM-compatible blockchains. Written in Rust, it offers a fast, efficient, and developer-friendly environment with tools like Forge for compiling, testing, and deploying contracts, Cast for interacting with the blockchain via the command line, and Anvil for running a local Ethereum node for testing.

    Foundry emphasizes simplicity, speed, and modularity, allowing developers to write robust tests in Solidity, debug contracts easily, and integrate with existing Ethereum tools. Its focus on a test-driven development approach and seamless integration with Git makes it a popular choice for building secure and scalable decentralized applications.

    We recommend Foundry, as it natively use Solidity in its scripting, testing and deploying functionalities. You will never need to switch between different programming languages, use Solidity everywhere!

    Here is the recommended settings for your foundry.toml:

    Using this settings, you will be able to use the RPC in your CLI commands. Here are some examples:

    Hardhat

    Hardhat is an open-source, flexible, and extensible development environment for writing, compiling, testing, and deploying Solidity smart contracts for Ethereum and EVM-compatible blockchains. Built with JavaScript and Node.js, it provides a robust framework for developers to create, debug, and deploy smart contracts efficiently.

    Key features include the Hardhat Network for local blockchain testing, a powerful task runner for automating workflows, and support for plugins to extend functionality. Hardhat’s intuitive API, detailed error reporting, and integration with tools like TypeScript and Ethers.js make it ideal for both beginners and experienced developers building secure, scalable decentralized applications.

    Compared to Foundry, Hardhat will require you to switch contexts between Solidity and Javascript/TypeScript. This benefits developers with good Javascript background as it will use familiar testing modules, and share same contexts with Ethers JS, building early connection to UI/Frontend side of the dApp.

    Here is a settings you can start from:

    Verifying Smart Contract

    We recommend you to use Foundry or Hardhat to build, deploy and to verify the source code on W Chain Block Explorer. If there's any situation you want to manually verify a smart contract, you can send the POST request to W Chain Block Explorer's API. Here's an example:

    It's very important to ensure the exact code format, source code, compiler version, constructor arguments (if any), optimizations configs and EVM version.

    W Swap Trade Volume API

    This document describes the W Swap Trade Volume API endpoint that returns the last 24 hours of traded volume (in USD) for a specific trading pair.

    Endpoint

    • Method: GET

    [profile.default]
    src = "src"
    out = "out"
    libs = ["lib"]
    solc = '0.8.19'
    optimizer = true
    optimizer_runs = 10_000
    
    [etherscan]
    wchain = { key = "verifyContract", chain = 171717, url = 'https://scan.w-chain.com/api' }
    wchain-test = { key = "verifyContract", chain = 71117, url = 'https://scan-testnet.w-chain.com/api' }
    
    [rpc_endpoints]
    wchain = "https://rpc.w-chain.com"
    wchain-test = "https://rpc-testnet.w-chain.com"
    cast send 0x6807dc923806fE8Fd134338EABCA509979a7e0cB --value 1ether --rpc-url wchain --private-key $PRIVATE_KEY
    cast balance 0x6807dc923806fE8Fd134338EABCA509979a7e0cB --rpc-url wchain
    forge create src/SomeContract.sol:MyContract --rpc-url wchain --verify --chain 171717 --private-key $PRIVATE_KEY
    module.exports = {
      networks: {
        w_chain_testnet: {
          url: "https://rpc-testnet.w-chain.com",
          accounts: [process.env.PRIVATE_KEY],
        },
        w_chain: {
          url: "https://rpc.w-chain.com",
          accounts: [process.env.PRIVATE_KEY],
        }
      },
      etherscan: {
        apiKey: "free-key",
        customChains: [
          {
            network: "W Chain Testnet",
            chainId: 71117,
            urls: {
              apiURL: "https://scan-testnet.w-chain.com/api",
              browserURL: "https://scan-testnet.w-chain.com"
            }
          },
          {
            network: "W Chain",
            chainId: 171717,
            urls: {
              apiURL: "https://scan.w-chain.com/api",
              browserURL: "https://scan.w-chain.com"
            }
          }
        ]
      }
    };
    curl --location 'https://scan.w-chain.com/api?module=contract&action=verifysourcecode' \
    --form 'contractaddress="0xYourContractAddress"' \
    --form 'sourceCode="// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.17; contract Storage { uint256 number; function store(uint256 num) public { number = num; } function retrieve() public view returns (uint256){ return number; } }"' \
    --form 'contractname="Storage"' \
    --form 'codeformat="solidity-single-file"' \
    --form 'compilerversion="v0.8.17+commit.8df45f5f"' \
    --form 'optimizationUsed="1"' \
    --form 'runs="200"' \
    --form 'constructorArguements=""' \
    --form 'evmversion="london"' \
    --form 'licenseType="3"'
    URL: https://oracle.w-chain.com/api/w-swap/volume/:id

    Purpose

    • Returns the 24-hour aggregated USD volume for the specified trading pair.

    • Also returns the pair name for convenience.

    Request

    • Path parameter id (number): The trade_pairs.id of the pair.

    Example

    Success Response

    • Status: 200 OK

    • Body:

    Field Details

    • vol24h (number): Total swap volume in USD over the past 24 hours.

    • pair (string): The human-readable pair name from trade_pairs.name.

    Error Responses

    • 400 Bad Request: Missing id path parameter.

    • 404 Not Found: Pair not found (no matching trade_pairs.id).

    How Volume Is Calculated

    • Source table: trade_pair_swap_events.

    • Aggregation: Sum of usd_value for rows where:

      • pair_id equals the requested id.

      • timestamp is within the last 24 hours (gt now - 24h and lte now).

    • USD valuation:

      • Stablecoins (USDT, USDC, and bridged variants) use a 1:1 USD mapping.

      • WCO is valued using its CoinGecko USD price.

    • Caching: Results are cached for ~60 seconds to reduce load.

    trade_pairs Reference

    The following pairs (from trade_pairs) are relevant for W Swap operations and USD valuation logic. The usd_value_from column indicates which token is used to determine USD value during swaps: 0 means token0, 1 means token1.

    id
    name
    platform
    pair_address
    token0_address
    token1_address
    token0_decimals
    token1_decimals
    fee
    usd_value_from
    wave_pid

    1

    WAVE/WCO

    0

    0x35264f0e8cd7a32341f47dbfbf2d85b81fd0ef0a

    Note on wave_pid

    The wave_pid sequence skips 3 because in Wave Farm, pool ID 3 is a WCO Single Stake pool (not an LP pool). Therefore, LP-related pairs continue with 4, 5, 6, etc.

    Usage Examples

    cURL

    JavaScript (fetch)

    Implementation Notes

    • Internals use a 60-second cache to avoid excessive DB queries.

    • If there are no swap events in the last 24h for the given pair, vol24h returns 0.

    • Authentication is not required for this public endpoint.

    Related Endpoints

    • GET /api/w-swap/lp-value/:id — returns latest pair price and LP price (in USD).

    WCO Supply Information API

    Overview

    The WCO Supply Information API provides real-time data about the WCO token supply distribution, including circulating supply, locked supply, and burned tokens. This endpoint is essential for understanding the tokenomics and current state of WCO tokens in circulation.

    Endpoint Details

    URL: https://oracle.w-chain.com/api/wco/supply-info Method: GET Cache: 2 minutes TTL Authentication: None required

    Response Structure

    The API returns a comprehensive JSON response with the following structure:

    Understanding the Response

    Summary Section

    The summary section provides human-readable WCO token amounts:

    • initial_supply_wco: The total initial supply of WCO tokens at genesis

    • locked_supply_wco: Total tokens locked in various contracts (staking, vesting, etc.)

    • burned_supply_wco: Total tokens sent to the burn address (0x0000...)

    Raw Data Section

    The raw section contains precise wei-denominated values and detailed breakdowns:

    • units: Explains the denomination system (1 WCO = 10^18 wei)

    • *_supply_wei: Exact token amounts in wei (smallest unit)

    • locked_supply_breakdown: Individual balances of each locked address

    Methodology Section

    Provides transparency about data collection and calculation methods:

    • formula: Mathematical formula used for circulating supply calculation

    • data_sources: Technical details about data retrieval methods

    • address_labels: Human-readable labels for contract addresses

    Calculation Methodology

    Circulating Supply Formula

    Locked Supply Categories

    1. Validators Staking Contract: Tokens staked by validators for network security

    2. Vesting Contracts: Tokens allocated to team, advisors, and other stakeholders with time-based release schedules

    Data Collection Process

    1. Multicall3 Integration: Uses efficient batch calls to query multiple address balances simultaneously

    2. Real-time Queries: Balances are fetched directly from the W-Chain RPC provider

    3. Precision Handling: All calculations use BigInt to maintain precision with large numbers

    4. Error Handling: Implements safeguards against negative circulating supply due to chain anomalies

    Use Cases

    For Developers

    • DeFi Integration: Use circulating supply data for market cap calculations

    • Analytics Dashboards: Display real-time tokenomics information

    • Trading Applications: Incorporate supply metrics into trading algorithms

    For Researchers

    • Tokenomics Analysis: Study token distribution and unlock schedules

    • Market Research: Analyze supply dynamics and their market impact

    • Verification: Independently verify supply calculations using provided methodology

    For Exchanges

    • Market Data: Provide accurate circulating supply for market cap calculations

    • Compliance: Maintain transparency about token supply for regulatory purposes

    Data Freshness and Caching

    • Cache Duration: 2 minutes (120 seconds)

    • Update Frequency: Data refreshes automatically every 2 minutes

    • Real-time Accuracy: Balances reflect the most recent blockchain state within cache window

    Verification Guide

    To independently verify the supply data:

    1. Query Individual Addresses: Use any W-Chain RPC endpoint to query balances of addresses listed in methodology.address_labels

    2. Sum Locked Balances: Add up all balances from validators staking and vesting contracts

    3. Query Burn Address: Check balance of 0x0000000000000000000000000000000000000000

    Error Handling

    The API implements robust error handling:

    • Network Issues: Automatic retries for RPC calls

    • Invalid Responses: Graceful handling of malformed blockchain responses

    • Negative Supply Protection: Clamps circulating supply to zero if calculation results in negative value

    Rate Limiting

    No explicit rate limiting is applied, but the 2-minute cache reduces the load on underlying blockchain infrastructure. For high-frequency applications, respect the cache TTL to optimize performance.

    Support

    For technical support or questions about this API:

    • Check the verification methodology to ensure correct interpretation

    • Review the raw data section for precise calculations

    • Consult the W-Chain documentation for blockchain-specific details

    GET https://oracle.w-chain.com/api/w-swap/volume/2
    {
      "vol24h": 12345.67,
      "pair": "USDT/WCO"
    }
    {
      "statusCode": 400,
      "statusMessage": "Missing id parameter"
    }
    {
      "statusCode": 404,
      "statusMessage": "Pair not found"
    }
    curl -s "http://<host>/api/w-swap/volume/2"
    // Fetch 24h volume for pair id 2 (USDT/WCO)
    const resp = await fetch('/api/w-swap/volume/2');
    if (!resp.ok) throw new Error('Request failed');
    const data = await resp.json();
    // data.vol24h is a number in USD; data.pair is the pair name
    Other tokens may currently resolve to 0 USD unless specifically supported.

    0x42abfb13b4e3d25407ffa9705146b7cb812404a0

    0xedb8008031141024d50ca2839a607b2f82c1c045

    18

    18

    300

    1

    0

    2

    USDT/WCO

    0

    0xd4e9176d5189dbb24f40e5c6c45bb1682dcb3324

    0x40cb2cccf80ed2192b53fb09720405f6fe349743

    0xedb8008031141024d50ca2839a607b2f82c1c045

    6

    18

    300

    0

    1

    3

    USDC/WCO

    0

    0x00d91ce419c068e36928fd8e9379b11d0011f052

    0x643ec74ed2b79098a37dc45dcc7f1abfe2ade6d8

    0xedb8008031141024d50ca2839a607b2f82c1c045

    6

    18

    300

    0

    2

    4

    SOL/WCO

    0

    0x9556d7afa868cb8b25657d34f3e0d46929f9d710

    0xd4f93cacd6d607789c8ecf1dddeba8b0c4d915a8

    0xedb8008031141024d50ca2839a607b2f82c1c045

    18

    18

    300

    1

    4

    5

    DOGE/WCO

    0

    0x8b5f11ea77641b208fb53b4b91b2825db64b8c32

    0x6cdfda79787caa4ad1a95456095bedc95abd2d75

    0xedb8008031141024d50ca2839a607b2f82c1c045

    8

    18

    300

    1

    5

    6

    XRP/WCO

    0

    0x24f07de79398f24c9d4dd60a281a29843e43b7fd

    0x4560d5eb0c32a05fa59acd2e8d639f84a15a2414

    0xedb8008031141024d50ca2839a607b2f82c1c045

    18

    18

    300

    1

    6

    circulating_supply_wco: Tokens available for trading and transactions

    burned_supply_breakdown: Details of tokens sent to burn address

    verification: Instructions for independently verifying the data

    Apply Formula: Subtract locked and burned amounts from initial supply

  • Compare Results: Your calculation should match the API response

  • {
      "timestamp": "2024-01-15T10:30:00.000Z",
      "cache": {
        "ttl_seconds": 120,
        "note": "This endpoint is cached for 2 minutes"
      },
      "summary": {
        "initial_supply_wco": "1000000000",
        "locked_supply_wco": "250000000.123456789",
        "burned_supply_wco": "5000000.987654321",
        "circulating_supply_wco": "744999999.888888890"
      },
      "raw": {
        "units": {
          "native": "WCO",
          "base": "wei",
          "wei_per_wco": "1000000000000000000"
        },
        "initial_supply_wei": "1000000000000000000000000000",
        "locked_supply_wei": "250000000123456789000000000",
        "burned_supply_wei": "5000000987654321000000000",
        "circulating_supply_wei": "744999999888888890000000000",
        "locked_supply_breakdown": [
          {
            "address": "0x1234...",
            "label": "validators-staking",
            "balance_wei": "200000000000000000000000000",
            "balance_wco": "200000000.0"
          },
          {
            "address": "0x5678...",
            "label": "vesting:team",
            "balance_wei": "50000000123456789000000000",
            "balance_wco": "50000000.123456789"
          }
        ],
        "burned_supply_breakdown": {
          "address": "0x0000000000000000000000000000000000000000",
          "label": "evm-zero-address",
          "balance_wei": "5000000987654321000000000",
          "balance_wco": "5000000.987654321"
        }
      },
      "methodology": {
        "formula": "circulating = initial_genesis_supply - (sum of locked addresses balances) - burned_balance",
        "data_sources": {
          "rpc_provider": "WCHAIN_RPC_PROVIDER",
          "multicall3_contract": "aggregate3 + getEthBalance"
        },
        "address_labels": {
          "validators_staking": "0x1234...",
          "vesting_contracts": {
            "team": "0x5678...",
            "advisors": "0x9abc..."
          },
          "burn_address": "0x0000000000000000000000000000000000000000"
        },
        "verification": {
          "how_to_verify": "Query each address balance on-chain or via any RPC, and confirm calculations match the formula."
        }
      }
    }
    Circulating Supply = Initial Supply - Locked Supply - Burned Supply

    Proof of Stake

    Proof of Stake (PoS) is a consensus mechanism used by blockchain networks like W Chain to secure the network and validate transactions. Unlike Proof of Work (PoW), which relies on miners solving complex cryptographic puzzles, PoS allows network participants (known as validators) to produce and validate new blocks based on the amount of cryptocurrency they hold and are willing to “stake” (lock up) as collateral.

    The PoS mechanism reduces energy consumption compared to PoW, while also incentivizing participants to act honestly since they have a financial stake in the network.

    How PoS Works in W Chain

    In W Chain’s PoS implementation, validators are selected based on their staked tokens, and they are responsible for producing and validating blocks. Validators earn rewards for their work but can also face penalties if they act dishonestly or fail to perform their duties.

    Here’s how the PoS mechanism functions in W Chain:

    1. Validators Stake Tokens: To become a validator, participants must lock up (or stake) a minimum amount of W Chain tokens in a staking contract.

    2. Block Validation: Validators are chosen to produce blocks based on the amount of tokens they have staked and their past performance. Once selected, the validator proposes a new block to be added to the blockchain.

    3. Rewards and Penalties: Validators earn rewards for producing valid blocks. However, if they attempt to manipulate the network or act maliciously, they risk losing part or all of their staked tokens.

    Staking in W Chain

    Staking is the process by which participants lock up their W Chain tokens to become validators. Validators are essential for maintaining the network's security and producing new blocks. The more tokens a validator stakes, the higher their chances of being selected to validate blocks and earn rewards.

    Benefits of Staking:

    • Earning Rewards: Validators earn rewards for producing blocks and validating transactions.

    • Network Security: Staking ensures that validators are financially motivated to act honestly, securing the network.

    • Participation in Consensus: Validators play a key role in maintaining consensus and ensuring the blockchain operates smoothly.

    Unstaking in W Chain

    Unstaking is the process of withdrawing staked tokens from the validator set. Validators can only unstake all of their tokens at once. After unstaking, they are no longer eligible to validate blocks or earn rewards.

    Important Considerations:

    • Validators must unstake all tokens at once; partial unstaking is not allowed.

    • After unstaking, validators no longer participate in block production or receive rewards.

    Epochs and Validator Responsibilities

    Epochs are a critical concept in W Chain’s PoS implementation. They define specific time frames (measured in blocks) during which a particular set of validators is responsible for block production.

    How Epochs Work:

    1. Epoch Duration: Each epoch lasts for a set number of blocks. The duration can be configured by node operators during the genesis block creation.

    2. Validator Set Update: At the end of each epoch, the validator set is updated. Validators query the ValidatorSet Smart Contract to retrieve the new set of validators for the next epoch.

    3. New Epoch Start: After the epoch block is produced, a new epoch begins with the updated validator set.

    Why Epochs Are Important:

    • Validator Rotation: Epochs ensure that the validator set is regularly updated, providing fairness and decentralization. New validators can join, and inactive or dishonest validators are removed.

    • Staking and Unstaking: Validators can only join or leave the set at the end of an epoch, ensuring the stability of the network during each epoch.

    Validator Responsibilities

    Validators are responsible for:

    1. Block Production: Validators propose new blocks to be added to the blockchain. This requires maintaining a consistent connection to the network and following the consensus rules.

    2. Validating Transactions: Validators must ensure that all transactions in the proposed block are valid according to the network rules.

    3. Staking and Security: Validators need to maintain their stake and ensure their node is operating correctly. Misbehavior or downtime can result in penalties or removal from the validator set.

    Penalties and Slashing:

    • Validators who act maliciously or fail to perform their duties may lose a portion of their staked tokens through a process called slashing. This incentivizes validators to act honestly and secure the network.

    Proof of Stake Workflow in W Chain

    1. Become a Validator:

    • Stake the required minimum number of W Chain tokens.

    • The validator becomes part of the validator set and is eligible to propose blocks.

    1. Participate in Consensus:

    • Validators are randomly selected to propose blocks based on the amount of staked tokens and their past performance.

    • Validators validate transactions and propose a block to the network.

    Earn Rewards:

    • Validators earn W Chain token rewards for each valid block they produce.

    1. Unstaking:

    • Validators can choose to unstake their tokens, at which point they are removed from the validator set and cease participating in block production.

    Non-Validator Node Setup

    A Non-Validator Node is a node that does not participate in the consensus process or block production. This often used by developers, dApps, exchanges, or individuals who need to query the blockchain.

    This section will guide you through setting up a Non-Validator Node on W Chain.

    Step 1: Prepare the System

    Before starting, ensure your system meets the minimum requirements for running a node:

    • vCPUs: 2 or more

    Bridge

    Bridge supported assets between W Chain and other networks using W Swap’s Bridge page. This guide covers supported chains and tokens, approvals, transaction statuses, and best practices.

    Overview

    • Networks Supported: Ethereum, BNB Chain, and W Chain

    Memory: At least 8GB

  • Disk Space: At least 200 GB (SSD or NVMe recommended for optimal performance)

  • Operating System: Ubuntu 20.04, 22.04, or 24.04

  • Internet Connection: A broadband connection with at least 5Mbps upload/download speed.

  • It's possible to run a node from a local dedicated server, but it's recommended to run it on a professional cloud providers such as AWS, Digital Ocean, Azure or GCP.

    Step 2: Install Dependencies

    Make sure you have up-to-date version of Ubuntu, Git and NPM installed.

    Some system may have different package manager, here we use apt, the most commonly used

    Step 3: Prepare Directory

    Step 4: Download files from latest Release

    To initiate a Node, you need the latest binary and genesis.json. It always available at W Chain's Github Repository for W chain Node.

    You need to select the suitable binary based on your Operating System and architecture. You can contact your Cloud Computing Provider if you are not sure about yours.

    In this guide, we will use the most common one: Linux (amd64), as it's widely used in AWS EC2 instances.

    Download BInary File

    In this example we are using v.1.0.6

    You can download the latest binary file using wget or curl

    After the download complete, print your directory contents to get the downloaded file name:

    The file name will be in this format: "w-chain-node_" + version tag + system + "_" + architecture + ".tar.gz". Extract the file:

    Rename the file (Optional, but important for better UX):

    Download genesis.json

    You don't need to change anything from this genesis.json, just make sure it exists in the same directory with your binary file.

    Step 5: Verify Files

    Make sure both binary file and genesis.json is correctly downloaded and in stored in same directory.

    Turn the binary file into executable:

    Verify the version:

    [VERSION INFO] Release version = 1.0.6

    Step 6: Initialize Keys and Blockchain Data Directories

    This command will initialize data directory and validator keys:

    Step 7: Create Server Config

    The node is basically a server that will run 24/7, responding to queries and persisting blocks to database. Instead of passing the configs as flags to server command, it's strongly recommended to store the server configs in a json/yaml file.

    Run this command (in /w-chain directory) to generate server config template:

    You will see a file, default-config.json created.

    Now, we will edit this config file to adjust with your actual server configuration.

    You can use any supported text editor, in this example we use nano.

    This config below assuming you are following previous steps convention on directory creation. It also recommended to use absolute path, which can be different from system to system (usually /home/user/w-chain)

    genesis.json location

    Path to Data Directory

    Ports

    NAT Address is your server/instance's Public IP

    Minimum Gas Price accepted and Seal flag

    For Non-Validator Node, Seal must be false. Per v1.0.6 Min Gas Price in W Chain Network is 8 Gwei

    Step 9: Create a System Service

    To keep your Node instance running as a background service, you need to define the service. Run this on your terminal (inside your server/instance).

    The text editor will open a blank page. Copy-paste the texts below into it:

    Then save and exit the text editor.

    Once again, this is assuming you are following the directory and filename convention from previous steps. Your system may have different absolute path and different user, please adjust as needed.

    Step 10: Enable and Run the Node Service

    After installing new service, you have to reload the service daemon and enable the service.

    Then start the service:

    Congratulations! Your node is now running and will start to catch up with the network, this may take few days, depends on the block-height and the I/O performance of your node.

    Important Commands to Maintain and Monitor Your Node

    Service

    Logging

  • Native Tokens: ETH (Ethereum), BNB (BNB Chain), WCO (W Chain)

  • Purpose: Move supported assets cross‑chain to trade or provide liquidity on W Chain

  • Finality: A validator-based process confirms bridge transfers; funds are minted or released when votes reach quorum

  • Supported Assets

    • From Ethereum → W Chain:

      • USDT

      • USDC

    • From BNB Chain → W Chain:

      • bUSDT

      • bUSDC

      • XRP (BEP‑20)

    • From W Chain → Ethereum or BNB Chain:

      • Tokens mirrored on W Chain including USDT, USDC, and Binance‑peg variants (bUSDT, bUSDC), plus XRP, DOGE, SOL for BNB Chain direction.

    Note:

    • Token availability depends on the selected From/To networks. The Bridge page filters assets accordingly.

    • On W Chain, bridged tokens have distinct addresses; always verify the token symbol and address shown in the UI.

    Chain IDs and Explorer Links

    • Chain IDs:

      • Ethereum Mainnet: 1

      • BNB Chain Mainnet: 56

      • W Chain Mainnet: 171717

    • Explorers (used by the DApp):

      • Ethereum: https://etherscan.io/tx/<hash>

      • BNB Chain: https://bscscan.com/tx/<hash>

      • W Chain: https://scan.w-chain.com/tx/<hash>

    Testnets (if applicable):

    • Sepolia (Ethereum): 11155111

    • BNB Chain Testnet: 97

    • W Chain Testnet: 71117 (Explorer: https://scan-testnet.w-chain.com/tx/<hash>)

    Prerequisites

    • A supported EVM wallet (e.g., Rabby—recommended for enhanced safety—or MetaMask).

    • Gas on the source chain (ETH for Ethereum, BNB for BNB Chain, WCO for W Chain).

    • The token you want to bridge in your source chain wallet.

    Bridging Steps

    1. Open the Bridge page and connect your wallet.

    2. In From, choose the source network (Ethereum / BNB Chain / W Chain). In To, choose the destination.

    3. Select a supported asset for the chosen route; use the token selector or search.

    4. Enter the amount to bridge. The UI shows any limits/fees and estimated arrival.

    5. If prompted, click Approve to grant the bridge contract permission to transfer your token.

    6. Click Bridge and confirm in your wallet.

    7. Track status in the Confirm modal and Bridge History. Typical statuses include:

      • Transaction Initialized

      • Transaction Pending

    Arrival and Claiming:

    • No manual claim step is generally required. Funds are credited on the destination chain once validators finalize the transfer.

    • The DApp provides explorer links for both source and destination transactions.

    Fees and Timing

    • Fees vary by route and token. They are displayed before you confirm the bridge.

    • Timing depends on source chain congestion and validator finalization. Expect longer times during network congestion.

    Bridge History

    • Use Bridge History to review previous transfers, current status, and retry or reference transaction hashes as needed.

    Troubleshooting

    • Approval Required: Approve the specific token on the source chain before bridging.

    • Unsupported Route: Switch networks or choose a supported asset for the selected From/To pair.

    • Pending Too Long: Check the explorer links and try again during lower congestion; ensure adequate gas.

    • Rejected/Failed: Review wallet prompts, increase gas settings if necessary, and retry.

    Safety Tips

    • Only bridge tokens listed by the DApp; do not paste arbitrary addresses.

    • Confirm the From and To networks are correct before submitting.

    • Maintain sufficient gas on both sides if you plan to interact immediately after bridging.

    FAQs

    • Can I bridge directly to trade? Yes—bridge first to W Chain, then use the Trade page.

    • Do I need to claim funds? No, funds arrive automatically after validator finalization.

    • Where do I find transaction links? In the modal and history, linking to etherscan.io, bscscan.com, and scan.w-chain.com.

    Liquidity

    Provide and manage liquidity in constant-product AMM pools on W Chain. This guide covers creating positions, understanding LP tokens and fees, and safely removing liquidity.

    Overview

    • Network: W Chain (EVM-compatible; native gas token WCO)

    • Model: a constant-product AMM (x·y = k)

    • LP Tokens: Minted to represent your position; burned when removing liquidity

    • Fees: 0.25% per trade paid to LPs (accrues within pool reserves)

    Prerequisites

    • A supported wallet (e.g., Rabby or Metamask) connected to W Chain.

    • Sufficient WCO for gas.

    • The two assets you want to deposit. If assets are on Ethereum or BNB Chain, bridge them first.

    Add Liquidity

    1. Open Liquidity or Add Liquidity page.

    2. Select the token pair (Token A and Token B). You may paste contract addresses for custom tokens.

    3. Enter an amount for one token; the UI computes the corresponding amount for the other token based on current pool price.

    Notes:

    • If a pool does not exist yet, your deposit sets the initial price. Carefully choose amounts to avoid unintended pricing.

    • For new pools, higher slippage tolerance may be needed; the UI will guide you.

    Remove Liquidity

    1. Navigate to your position (e.g., Pool page or Your Liquidity).

    2. Choose the position and select Remove.

    3. If prompted, approve the router to spend your LP tokens (Approve LP).

    Fees and Rewards

    • Each trade pays a 0.25% liquidity fee to LPs, accruing inside the pool as additional reserves.

    • Your portion of fees is implicit in the increased value of your LP tokens.

    • Realization occurs when you withdraw liquidity (your redeemed amounts include fee accrual).

    Risks and Best Practices

    • Impermanent Loss: Price divergence between tokens can reduce your position value vs. holding.

    • Slippage: Large deposits/withdrawals can move price; consider splitting actions.

    • Smart Contract Risk: Use official UI and verified token addresses.

    • Gas Costs: Keep WCO for approvals, adds, and removals.

    Troubleshooting

    • Approve Required: Approve both tokens before adding liquidity; approve LPs before removing.

    • Insufficient Balance: Confirm balances on W Chain and consider bridging if needed.

    • Transaction Reverted: Increase slippage tolerance or reduce deposit size.

    FAQs

    • How do I earn fees? Fees accumulate in the pool; your LP token share entitles you to a proportional claim when you withdraw.

    • Can I add single-sided liquidity? a constant-product AMM requires balanced deposits; use a swap first if needed.

    • Where can I see my positions? Use the Pool or Your Liquidity view in the DApp.

    ./w-chain-node secrets init --data-dir main-chain --insecure
    ./w-chain-node secrets init --data-dir test-chain --insecure
    "data_dir": "/home/ubuntu/w-chain/main-chain", 
    "data_dir": "/home/ubuntu/w-chain/main-chain", 
    sudo systemctl start w-chain-node.service
    sudo systemctl stop w-chain-node.service
    sudo systemctl restart w-chain-node.service
    journalctl -u w-chain-node
    journalctl -u w-chain-node -f
    sudo apt update && sudo apt upgrade -y
    sudo apt install git -y && sudo apt install npm -y
    cd ~
    mkdir w-chain
    cd w-chain
    curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/w-chain-node_v1.0.6_linux_amd64.tar.gz
    ls -lh
    tar -xzf w-chain-node_v1.0.6_linux_amd64.tar.gz
    mv w-chain-node-linux-amd64 w-chain-node
    curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/genesis.json
    chmod +x w-chain-node
    ./w-chain-node version
    ./w-chain-node server export --type json
    ls -lh
    sudo nano default-config.json
    "chain_config": "/home/ubuntu/w-chain/genesis.json",
    "grpc_addr": "127.0.0.1:9632", 
    "jsonrpc_addr": "0.0.0.0:8545", 
    "network": {
        ...
        "libp2p_addr": "0.0.0.0:1478", 
        "nat_addr": "12.34.567.890",
        ...
    }
    "price_limit": 800000000000,
    "seal": false
    sudo nano /etc/systemd/system/w-chain-node.service
    [Unit]
    Description=W Chain Validator Node
    After=network.target
    StartLimitIntervalSec=1
    
    [Service]
    Type=simple
    User=ubuntu
    ExecStart=/home/ubuntu/w-chain/w-chain-node server --config /home/ubuntu/w-chain/default-config.json
    
    [Install]
    WantedBy=multi-user.target
    sudo systemctl daemon-reload
    sudo systemctl enable w-chain-node.service
    sudo systemctl start w-chain-node.service
    DOGE (BEP‑20)
  • SOL (BEP‑20)

  • Transaction Submitted

  • Transaction Awaiting Validators Votes

  • Transaction Successful (funds arrive on destination)

  • Transaction Failed or Rejected

  • Approve spending for each token if prompted (Approve Token A / Approve Token B).
  • Review details:

    • Pool Share: Estimated percentage of the pool you’ll own.

    • Prices: Implied exchange rates after your deposit.

    • Slippage/Min Received: Relevant when creating the initial pool or large deposits.

  • Click Supply (or Add Liquidity) and confirm in your wallet.

  • After confirmation, you receive LP tokens representing your position.

  • Select the percentage to remove (e.g., 25%, 50%, 100%).

  • Review expected amounts of Token A and Token B.

  • Click Remove, confirm in your wallet, and wait for the transaction to finalize.

  • No Positions Visible: Ensure correct wallet and network (W Chain) are selected.

    B2B Address Notification Service

    Coin & Token Transfer Watcher

    This document explains how to use the Watched Addresses system to receive real-time webhook notifications for W Chain coin (WCO) transfers and ERC-20 token transfers involving your registered addresses.

    The system provides:

    • A CRUD API to manage watched addresses and webhook URLs

    Real-time POST webhooks on transfers matching your watch rules

  • Automatic retries with exponential backoff on delivery failures

  • All user-facing addresses and hashes in API responses and webhooks are 0x-prefixed. Internally, addresses are stored lowercase without the 0x prefix.

    Authentication

    All endpoints require an API key via the HTTP Authorization header:

    • Authorization: Bearer YOUR_API_KEY

    If the key is valid, the server resolves your watcher_id and authorizes the request. If invalid or missing, the server returns 401 Unauthorized.

    Base Path

    • Base URL: https://oracle.w-chain.com/api

    Address Normalization

    • Input (create/update): You may send addresses with or without the 0x prefix. The server normalizes by stripping 0x if present and storing lowercase hex without 0x.

    • Output (list/get/update responses and webhooks): All addresses and transaction hashes are 0x-prefixed for consistency with wallets and explorers.

    Endpoints

    Create a watched address

    • Method: POST

    • Path: /notifications/watched-addresses

    • Body fields:

      • address (string, required): Address with or without 0x; must be 40 hex characters when normalized

      • watch_coin (boolean, optional, default true): Watch native coin (WCO) transfers

      • watch_token (boolean, optional, default true): Watch ERC-20 token transfers

      • webhook_url (string, required): HTTPS URL to receive webhooks

    Example:

    Success response (200):

    List watched addresses

    • Method: GET

    • Path: /notifications/watched-addresses

    Example:

    Success response (200):

    Get a watched address by ID

    • Method: GET

    • Path: /notifications/watched-addresses/:id

    Example:

    Success response (200):

    Update a watched address

    • Method: PATCH

    • Path: /notifications/watched-addresses/:id

    • Body: Any subset of the create fields (address, watch_coin, watch_token, webhook_url)

    Example:

    Success response (200):

    Delete a watched address

    • Method: DELETE

    • Path: /notifications/watched-addresses/:id

    Example:

    Success response (200):

    Webhook Delivery

    When a transfer involving any of your watched addresses occurs, we send a POST request with JSON to the webhook_url configured for that watched address.

    • Method: POST

    • Headers:

      • Content-Type: application/json

      • Authorization: Bearer <api_key> this is the same API Key used by the Watcher identity, should be used to ensure the authenticity of the webhook request

    • Timeout: 10 seconds. If your endpoint does not respond within 10 seconds, it is treated as a failure and retried.

    Payload fields

    These fields are sent in the request body. Values are formatted for user-facing consumption as described.

    • id (number): Internal notification ID

    • watched_addresses_id (string, UUID): The watched_addresses row ID

    • watcher_id (number): Your watcher ID

    • hash (string): 0x-prefixed transaction hash

    • type (string enum): COIN_TRANSFER or TOKEN_TRANSFER

    • sender (string): 0x-prefixed sender address

    • receiver (string): 0x-prefixed receiver address. For contract creations or transactions without a to, this may be an empty string.

    • amount (number | null):

      • COIN_TRANSFER: Amount is in wei, as a JSON number. Note: very large values may exceed JavaScript’s exact integer range; handle carefully if you require exact arithmetic.

      • TOKEN_TRANSFER: Raw token units as a JSON number (decimals not applied). Fetch the token’s decimals and normalize on your side if needed.

    • asset (string):

      • COIN_TRANSFER: The literal string WCO

      • TOKEN_TRANSFER: 0x-prefixed token contract address

    • timestamp (string): Timestamp of notification row creation as produced by Postgres (timestamp without time zone). Treat as a textual timestamp; convert/timezone as desired on your side.

    • webhook_url (string): The target URL (provided for your reference)

    • api_key (string | null): The API key stored for your watcher, if any (also sent via the Authorization header)

    • next_retry_at (string | null): Scheduled time for the next retry (if previously failed), else null

    Example payload:

    Retry Policy (Exponential Backoff)

    If a webhook delivery fails (non-2xx response, timeout, or network error), the system schedules a retry using the following backoff (minutes):

    • 1, 3, 10, 15, 60

    On the Nth failure, the Nth interval is used; after the 5th failure, retries continue every 60 minutes.

    • retry_count increments on each failure.

    • next_retry_at is set to now + interval.

    • On a successful 2xx response, processed_at is set and the notification will not be retried further.

    The retry worker selects unprocessed notifications whose next_retry_at is due.

    Implementation Notes

    • Address formatting

      • Inputs accept with or without 0x; stored lowercase without 0x internally.

      • API responses (create/list/get/update) return addresses with 0x.

      • Webhook payload prefixes hash, sender, receiver, and (for tokens) asset with 0x.

    • Receiver may be empty string

      • For coin transfers where to is null (e.g., contract creation), receiver is emitted as an empty string.

    • Amount type

      • Currently sent as a JSON number. If exact precision is required in your system, convert or handle carefully to avoid precision loss in JavaScript environments.

    • Asset field

      • WCO for native coin transfers; otherwise the token contract address (0x-prefixed) for token transfers.

    • Timeouts

      • Webhook POSTs time out in 10 seconds (treated as failure).

    • Authorization header on webhook

      • If an API key is present for the watcher, the webhook request to your server includes Authorization: Bearer <api_key>.

    Example Receiver (Pseudocode)

    Troubleshooting

    • 401 Unauthorized on API calls

      • Ensure Authorization: Bearer YOUR_API_KEY is present and valid.

    • Webhook not received

      • Confirm your server is reachable over HTTPS and returns 200 within 10 seconds.

      • Check if retries are scheduled by inspecting your logs or querying notifications with processed_at IS NULL and next_retry_at in the past.

    • Amount precision issues

      • The amount is sent as a JSON number; for exact arithmetic, convert or handle using big number libraries on your side.

    Change Log

    • 2025-09: Added asset to notification schema and payload. For coin transfers set to WCO; for token transfers set to the token contract address.

    • 2025-09: Standardized 0x-prefix formatting in API responses and webhook payloads (hash, sender, receiver, token asset).

    curl -X POST https://oracle.w-chain.com/api/notifications/watched-addresses \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
            "address": "0xabc1234567890abcdefabc1234567890abcdef0",
            "watch_coin": true,
            "watch_token": true,
            "webhook_url": "https://yourapp.example.com/watched-address-webhook"
          }'
    {
      "success": true,
      "data": {
        "id": "...",
        "watcher_id": 123,
        "address": "0xabc1234567890abcdefabc1234567890abcdef0",
        "watch_coin": true,
        "watch_token": true,
        "webhook_url": "https://yourapp.example.com/watched-address-webhook",
        "created_at": "...",
        "updated_at": "..."
      }
    }
    curl -X GET https://oracle.w-chain.com/api/notifications/watched-addresses \
      -H "Authorization: Bearer YOUR_API_KEY"
    {
      "success": true,
      "data": [
        {
          "id": "...",
          "watcher_id": 123,
          "address": "0xabc1234567890abcdefabc1234567890abcdef0",
          "watch_coin": true,
          "watch_token": true,
          "webhook_url": "https://yourapp.example.com/watched-address-webhook",
          "created_at": "...",
          "updated_at": "..."
        }
      ]
    }
    curl -X GET https://oracle.w-chain.com/api/notifications/watched-addresses/ID_HERE \
      -H "Authorization: Bearer YOUR_API_KEY"
    {
      "success": true,
      "data": {
        "id": "...",
        "watcher_id": 123,
        "address": "0xabc1234567890abcdefabc1234567890abcdef0",
        "watch_coin": true,
        "watch_token": true,
        "webhook_url": "https://yourapp.example.com/watched-address-webhook",
        "created_at": "...",
        "updated_at": "..."
      }
    }
    curl -X PATCH https://oracle.w-chain.com/api/notifications/watched-addresses/ID_HERE \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "watch_token": false }'
    {
      "success": true,
      "data": {
        "id": "...",
        "watcher_id": 123,
        "address": "0xabc1234567890abcdefabc1234567890abcdef0",
        "watch_coin": true,
        "watch_token": false,
        "webhook_url": "https://yourapp.example.com/watched-address-webhook",
        "created_at": "...",
        "updated_at": "..."
      }
    }
    curl -X DELETE https://oracle.w-chain.com/api/notifications/watched-addresses/ID_HERE \
      -H "Authorization: Bearer YOUR_API_KEY"
    { "success": true }
    {
      "id": 12345,
      "watched_addresses_id": "a1b2c3d4-1111-2222-3333-abcdefabcdef",
      "watcher_id": 678,
      "hash": "0x3fa9e1...c1d2",
      "type": "TOKEN_TRANSFER",
      "sender": "0x1111111111111111111111111111111111111111",
      "receiver": "0x2222222222222222222222222222222222222222",
      "amount": 2500000000000000000,
      "asset": "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "timestamp": "2025-09-10 08:00:00.000000",
      "webhook_url": "https://yourapp.example.com/watched-address-webhook",
      "api_key": "YOUR_API_KEY_OR_NULL",
      "next_retry_at": null
    }
    import express from 'express';
    const app = express();
    app.use(express.json());
    
    app.post('/watched-address-webhook', (req, res) => {
      // Optionally verify Authorization header matches what you expect
      // const auth = req.headers['authorization'];
    
      const n = req.body; // See payload fields above
    
      // Handle idempotency if you store notifications (e.g., by `n.id`)
    
      if (n.type === 'COIN_TRANSFER') {
        // n.asset === 'WCO'
        // n.amount is wei (number); beware precision in JS
      } else if (n.type === 'TOKEN_TRANSFER') {
        // n.asset is token contract address (0x-prefixed)
        // n.amount is raw units; fetch token decimals to normalize
      }
    
      res.status(200).send('ok');
    });
    
    app.listen(3000);

    Validator Node Setup

    This section will guide you through setting up a Validator Node on W Chain.

    Step 1: Prepare the System

    Before starting, ensure your system meets the minimum requirements for running a node:

    • vCPUs: 4 or more

    • Memory: At least 16GB

    • Disk Space: At least 1TB (SSD or NVMe recommended for optimal performance)

    • Operating System: Ubuntu 20.04, 22.04, or 24.04

    • Node JS v.22 and NPM v10 or newer

    • Internet Connection: A broadband connection with at least 5Mbps upload/download speed.

    It's possible to run a node from a local dedicated server, but it's recommended to run it on a professional cloud providers such as AWS, Digital Ocean, Azure or GCP.

    Step 2: Install Dependencies

    Make sure you have up-to-date version of Ubuntu, Git and NPM installed.

    Some system may have different package manager, here we use apt, the most commonly used

    Step 3: Prepare Directory

    Step 4: Download files from latest Release

    To initiate a Node, you need the latest binary and genesis.json. It always available at .

    You need to select the suitable binary based on your Operating System and architecture. You can contact your Cloud Computing Provider if you are not sure about yours.

    In this guide, we will use the most common one: Linux (amd64), as it's widely used in AWS EC2 instances.

    Download BInary File

    In this example we are using v.1.0.6

    You can download the latest binary file using wget or curl

    After the download complete, print your directory contents to get the downloaded file name:

    The file name will be in this format: "w-chain-node_" + version tag + system + "_" + architecture + ".tar.gz". Extract the file:

    Rename the file (Optional, but important for better UX):

    Download genesis.json

    You don't need to change anything from this genesis.json, just make sure it exists in the same directory with your binary file.

    Step 5: Verify Files

    Make sure both binary file and genesis.json is correctly downloaded and in stored in same directory.

    Turn the binary file into executable:

    Verify the version:

    [VERSION INFO] Release version = 1.0.6

    Step 6: Initialize Keys and Blockchain Data Directories

    This command will initialize data directory and validator keys:

    You will see the newly created public keys printed like this:

    You can copy-paste it to some quick note to be used in next steps. We will also need the Private Key of this newly created Public Key.

    You will see a single line of string. This is the Private Key.

    Same as above, copy the Private Key and store it somewhere safe, we will use it in next step.

    When you are done, exit the text editor, no need to save anything. And go back to root directory of your Node:

    Step 7: Create Server Config

    The node is basically a server that will run 24/7, responding to queries and persisting blocks to database. Instead of passing the configs as flags to server command, it's strongly recommended to store the server configs in a json/yaml file.

    Run this command (in /w-chain directory) to generate server config template:

    You will see a file, default-config.json created.

    Now, we will edit this config file to adjust with your actual server configuration.

    You can use any supported text editor, in this example we use nano.

    This config below assuming you are following previous steps convention on directory creation. It also recommended to use absolute path, which can be different from system to system (usually /home/user/w-chain)

    genesis.json location

    Path to Data Directory

    Ports

    This setup is meant for a Consensus purpose only, thus we disable the RPC function by removing the jsonrpc address.

    Network section

    Minimum Gas Price accepted and Seal flag

    For Validator Node, Seal must be true. Per v1.0.6 Min Gas Price in W Chain Network is 8 Gwei

    Step 9: Staking Contract

    To join W Chain Network as a Validator Node, each node must stake at least 10,000,000 (10 Million) WCO. This is to ensure the Node operators to act honestly and follow the consensus, as any malicious act will result to stake slashing (rogue node will lose a part of its staked WCO).

    Running Node in W Chain Network also offer a lucrative Staking Reward, which explained in more details in this section.

    Clone Staking Contract Script from W Chain Repository

    It should create new directory: staking-contract. Enter the directory and install the node dependencies

    The process will only take few seconds, run this command next:

    This will copy the template .env and open it in a text editor, you will see this:

    Replace your_private_key_here with the actual Private Key you copied . Do not change anything else, save and exit the text editor.

    Step 10: Load up the Stake

    (Optional) You can import the Private Key to a wallet app for your convenience.

    The next important step is to fund the Validator address (Public Key) with WCO. Please remember, you need some WCO for gas fee, too! Ideally, you should have at least 10,000,001 WCO inside this address.

    After you fund the address, go to /staking-contract directory and run the stake script:

    Wait for the script to process, if everything is correct, you will get the transaction hash returned.

    Next, we will register BLS Public Key (obtained ). Run this command:

    This is an example, use your actual BLS Public Key

    Wait for the script to process the on-chain call, if everything is correct, you will get the transaction hash returned.

    You can use isValidator method (npm run cli isValidator <address>) to verify if your Public Key is now registered as Validator.

    After you done the stake and registerBLSPublicKey, your Validator Node is ready to run!

    Step 11: Create a System Service

    To keep your Node instance running as a background service, you need to define the service. Run this on your terminal (inside your server/instance).

    The text editor will open a blank page. Copy-paste the texts below into it:

    Then save and exit the text editor.

    Once again, this is assuming you are following the directory and filename convention from previous steps. Your system may have different absolute path and different user, please adjust as needed.

    Step 12: Enable and Run the Node Service

    After installing new service, you have to reload the service daemon and enable the service.

    Then start the service:

    Congratulations! Your node is now running and will start to catch up with the network, this may take few days, depends on the block-height and the I/O performance of your node.

    Important Commands to Maintain and Monitor Your Node

    Service

    Logging

    W Chain's Github Repository for W chain Node
    back in Step 6
    from Step 6

    WPoints Public API

    Overview

    The Points API provides comprehensive access to user points data within the W-Chain ecosystem. These endpoints allow you to retrieve points information for individual users, leaderboards, and comparative analytics across different time periods and categories.

    Base URL

    https://oracle.w-chain.com/api/points

    Authentication

    All Points API endpoints are publicly accessible and do not require authentication.

    Common Parameters

    Month Format

    When specifying months in API calls, use the format: YYYY-MM

    • Example: 2024-01 for January 2024

    • Example: 2024-12 for December 2024

    User Parameter

    User addresses should be provided as Ethereum-compatible addresses (0x prefixed hex strings).


    Endpoints

    1. Monthly Leaderboard

    Endpoint: GET /leaderboard Cache: 5 minutes Description: Retrieves the points leaderboard for a specific month, showing all users ranked by their total points.

    Parameters

    Parameter
    Type
    Required
    Description

    Example Request

    Example Response

    Response Fields

    • user: Ethereum address of the user

    • points: Total points earned by the user in the specified month

    Notes

    • Results are automatically sorted by points in descending order (highest first)

    • Only includes users who earned points during the specified month


    2. User Points Details

    Endpoint: GET /user Cache: 5 minutes Description: Retrieves detailed points information for a specific user in a given month, including individual point entries with categories and transaction hashes.

    Parameters

    Parameter
    Type
    Required
    Description

    Example Request

    Example Response

    Response Fields

    • category: The category/type of activity that earned the points

    • points: Number of points earned for this specific activity

    • created_at: ISO timestamp when the points were awarded

    Notes

    • Results are ordered by creation date (most recent first)

    • Provides granular view of all point-earning activities


    3. User Points by Category

    Endpoint: GET /user-by-category Cache: 30 seconds Description: Retrieves aggregated points for a specific user grouped by category for a given month.

    Parameters

    Parameter
    Type
    Required
    Description

    Example Request

    Example Response

    Response Fields

    • category: The category/type of activity

    • points: Total points earned in this category for the specified month

    Notes

    • Results are sorted by points in descending order (highest category first)

    • Provides a summary view of user's point distribution across activities


    4. Current Month User Points

    Endpoint: GET /user-by-current-month Cache: 1 minute Description: Retrieves the total points for a specific user in the current month.

    Parameters

    Parameter
    Type
    Required
    Description

    Example Request

    Example Response

    Response Fields

    • points: Total points earned by the user in the current month

    Notes

    • Automatically uses the current month (no month parameter needed)

    • Useful for real-time dashboards and current progress tracking


    5. Points Comparison vs Last Month

    Endpoint: GET /vs-last-month Cache: 1 minute Description: Compares a user's points between the current period and the corresponding period in the previous month, with intelligent date range handling.

    Parameters

    Parameter
    Type
    Required
    Description

    Example Request

    Example Response

    Response Fields

    Current Period:

    • current.points: Points earned in the current period

    • current.period.start: Start date of current comparison period

    • current.period.end: End date of current comparison period

    Last Month Period:

    • lastMonth.points: Points earned in the corresponding previous period

    • lastMonth.period.start: Start date of previous comparison period

    • lastMonth.period.end: End date of previous comparison period

    Comparison Analytics:

    • comparison.difference: Absolute difference in points (current - last month)

    • comparison.percentageChange: Percentage change from last month (rounded to 2 decimal places)

    • comparison.isFullMonthComparison: Boolean indicating if comparing full months or partial periods

    Intelligent Date Range Logic

    The endpoint uses smart date range comparison:

    1. Late in Month (Day >= 28): Compares full months

      • Current: Full current month

      • Previous: Full previous month

    2. Early/Mid Month (Day < 28): Compares equivalent date ranges

    Use Cases

    • Progress Tracking: Monitor user engagement trends

    • Gamification: Show improvement or decline in user activity

    • Analytics: Understand user behavior patterns over time


    Error Handling

    All endpoints return appropriate HTTP status codes and error messages:

    400 Bad Request

    Returned when required parameters are missing or invalid.

    404 Not Found

    Returned when no points data is found for the specified criteria.

    Caching Strategy

    Each endpoint implements intelligent caching to balance data freshness with performance:

    Endpoint
    Cache Duration
    Reasoning

    Rate Limiting

    No explicit rate limiting is enforced, but clients should respect the cache durations to optimize performance and reduce server load.

    Data Categories

    Common point categories include:

    • trading: Points earned from trading activities

    • staking: Points from staking WCO tokens

    • liquidity_provision: Points from providing liquidity to pools

    Best Practices

    For Developers

    1. Cache Awareness: Respect cache durations in your application logic

    2. Error Handling: Implement proper error handling for 400/404 responses

    3. Date Formatting: Always use YYYY-MM format for month parameters

    4. Address Validation: Validate Ethereum addresses before making API calls

    For Analytics

    1. Trend Analysis: Use /vs-last-month for growth tracking

    2. Category Insights: Use /user-by-category to understand user behavior

    3. Leaderboard Tracking: Monitor /leaderboard for competitive analysis

    For User Interfaces

    1. Real-time Updates: Use /user-by-current-month for live progress displays

    2. Historical Data: Use /user for detailed activity timelines

    3. Comparative Views: Use /vs-last-month for progress indicators

    Support

    For technical support or questions about the Points API:

    • Verify parameter formats match the documentation

    • Check error messages for specific guidance

    • Ensure user addresses are valid Ethereum addresses

    • Consult the caching information for data freshness expectations

    Public Price API

    Overview

    The W-Chain Price API provides real-time price data for tokens within the W-Chain ecosystem. Currently supporting WCO and WAVE tokens, this API delivers USD-denominated prices with caching for optimal performance. Future token additions will follow the same endpoint structure and response format.

    Base URL

    https://oracle.w-chain.com/api/price

    Authentication

    All Price API endpoints are publicly accessible and do not require authentication.

    Common Response Format

    All price endpoints return a consistent JSON structure:

    Response Fields

    • price: Current price of the asset in USD (number)

    • asset: Token symbol/identifier (string)

    • base_currency: Always "USD" for price denomination (string)


    Supported Tokens

    1. WCO Token Price

    Endpoint: GET /wco Cache: 1 minute Description: Retrieves the current USD price of WCO token from the latest price feed data.

    Example Request

    Example Response

    Data Source

    • Source: Internal price feed database (price_feed_wco table)

    • Update Frequency: Real-time price feed updates

    • Precision: Full decimal precision as stored in database

    • Fallback

    Technical Implementation

    • Queries the most recent price entry from price_feed_wco table

    • Implements 60-second caching to reduce database load

    • Orders by timestamp descending to get latest price

    • Handles database errors gracefully


    2. WAVE Token Price

    Endpoint: GET /wave Cache: Inherits from WCO cache (1 minute) Description: Retrieves the current USD price of WAVE token, calculated using WCO price and WAVE/WCO trading pair data.

    Example Request

    Example Response

    Price Calculation

    WAVE USD price is calculated using the formula:

    Where:

    • WAVE_WCO_Rate: Latest trading pair price from pair ID 1

    • WCO_USD_Price: Current WCO price from /api/price/wco

    Data Sources

    • Primary: Trading pair data (pair ID: 1) for WAVE/WCO rate

    • Secondary: WCO USD price from internal price feed

    • Dependencies: Requires both WCO price and trading pair data

    Technical Implementation

    • Makes internal API call to /api/price/wco for WCO price

    • Fetches latest WAVE/WCO pair price using getLatestPairPricesById(1)

    • Multiplies pair rate by WCO USD price for final WAVE USD price


    Future Token Support

    Additional tokens will be added following the same patterns:

    Endpoint Structure

    Response Format

    All future tokens will maintain the same response structure:

    Implementation Patterns

    New tokens will follow one of these implementation patterns:

    1. Direct Price Feed (like WCO):

      • Dedicated price feed table

      • Direct USD pricing

      • Simple database query


    Error Handling

    Database Errors

    When price data cannot be retrieved:

    Missing Dependencies

    For calculated prices (like WAVE), if dependencies are unavailable:

    • Returns appropriate error response

    • Logs error details for debugging

    • Maintains API consistency

    Caching Strategy

    WCO Token

    • Cache Key: api_price_wco

    • TTL: 60 seconds

    • Strategy: Database query caching

    • Invalidation: Time-based expiration

    WAVE Token

    • Cache Dependency: Inherits from WCO caching

    • Additional Caching: Trading pair data may have separate caching

    • Effective TTL: Minimum of dependent cache TTLs

    Benefits

    • Reduces database load

    • Improves response times

    • Maintains data freshness

    • Handles high-frequency requests efficiently

    Rate Limiting

    No explicit rate limiting is enforced, but the caching mechanism naturally throttles database queries. Clients should:

    • Respect cache durations

    • Avoid excessive polling

    • Implement client-side caching for frequently accessed data

    Use Cases

    For DeFi Applications

    • Portfolio Valuation: Calculate total portfolio value in USD

    • Trading Interfaces: Display current market prices

    • Yield Farming: Calculate APY and rewards in USD terms

    • Liquidity Pools: Price LP tokens and calculate impermanent loss

    For Analytics Platforms

    • Market Data: Real-time price tracking and charts

    • Market Cap Calculations: Combine with supply data for market cap

    • Price Alerts: Trigger notifications on price movements

    • Historical Analysis: Track price trends over time

    For Wallets and Exchanges

    • Balance Display: Show USD values of token holdings

    • Trading Pairs: Price discovery for trading interfaces

    • Order Books: Reference pricing for limit orders

    • Fee Calculations: Calculate transaction fees in USD

    Data Freshness

    WCO Price Updates

    • Source: Real-time price feed system

    • Frequency: Continuous updates based on market activity

    • Latency: Sub-minute from price feed to API (with caching)

    WAVE Price Updates

    • Source: Trading pair activity on W-Chain DEX

    • Frequency: Updates with each trade in WAVE/WCO pair

    • Latency: Depends on WCO price freshness + pair data updates

    Best Practices

    For Developers

    1. Handle Null Prices: Always check for null price values

    2. Implement Fallbacks: Have backup pricing sources when possible

    3. Cache Appropriately: Respect API cache durations in your application

    4. Error Handling

    For High-Frequency Applications

    1. Batch Requests: Group multiple price requests when possible

    2. WebSocket Alternative: Consider WebSocket connections for real-time updates

    3. Local Caching: Implement application-level caching

    4. Rate Management: Avoid overwhelming the API with requests

    For Financial Applications

    1. Precision Handling: Use appropriate decimal precision for financial calculations

    2. Timestamp Tracking: Track when prices were last updated

    3. Audit Trails: Log price data usage for compliance

    4. Backup Systems: Implement redundant price sources

    Integration Examples

    JavaScript/TypeScript

    Python

    Monitoring and Observability

    Health Checks

    • Monitor API response times

    • Track cache hit/miss ratios

    • Alert on price data staleness

    • Monitor database connectivity

    Key Metrics

    • Response Time: API endpoint latency

    • Cache Efficiency: Cache hit percentage

    • Data Freshness: Time since last price update

    • Error Rate: Failed requests percentage

    Support and Troubleshooting

    Common Issues

    1. Null Prices: Check if price feed is active and database is accessible

    2. Stale Data: Verify cache TTL settings and price feed updates

    3. WAVE Price Errors: Ensure both WCO price and trading pair data are available

    4. High Latency: Check database performance and network connectivity

    Getting Help

    • Verify endpoint URLs and request format

    • Check for network connectivity issues

    • Review error messages in API responses

    • Monitor W-Chain network status for underlying issues


    This API documentation covers the current implementation of WCO and WAVE price endpoints. As new tokens are added to the W-Chain ecosystem, they will follow similar patterns and be documented with the same level of detail.

    sudo apt update && sudo apt upgrade -y
    sudo apt install git -y && sudo apt install npm -y
    cd ~
    mkdir w-chain
    cd w-chain
    curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/w-chain-node_v1.0.6_linux_amd64.tar.gz
    ls -lh
    tar -xzf w-chain-node_v1.0.6_linux_amd64.tar.gz
    mv w-chain-node-linux-amd64 w-chain-node
    curl -L -O https://github.com/w-chain/node/releases/download/v1.0.6/genesis.json
    chmod +x w-chain-node
    ./w-chain-node version
    ./w-chain-node secrets init --data-dir main-chain --insecure
    ./w-chain-node secrets init --data-dir test-chain --insecure
    [SECRETS OUTPUT]
    Public key (address) = 0x9C107AA6471e3...E9c6EdE083b8f5
    BLS Public key       = 0x800f1157a49bb59f5e5d790...fe349fa19a3c323f518a4bd4aa963
    Node ID              = 16Uiu2HAmVbykGW...DUpLgTw7NbDVbKf1Me4D
    cd ~/w-chain/main-chain/consensus
    nano validator.key
    cd ~/w-chain/test-chain/consensus
    nano validator.key
    cd ../../
    ./w-chain-node server export --type json
    ls -lh
    sudo nano default-config.json
    "chain_config": "/home/ubuntu/w-chain/genesis.json",
    "data_dir": "/home/ubuntu/w-chain/main-chain", 
    "data_dir": "/home/ubuntu/w-chain/main-chain", 
    "grpc_addr": "127.0.0.1:9632", 
    "jsonrpc_addr": "", 
    "network": {
        ...
        "libp2p_addr": "0.0.0.0:1478",
        ...
    }
    "price_limit": 800000000000,
    "seal": true
    cd ~/w-chain
    git clone https://github.com/w-chain/staking-contract.git
    cd ~/w-chain/staking-contract
    npm i
    cp .env.example .env
    sudo nano .env
    #JUST ADD YOUR PRIVATE KEY HERE
    PRIVATE_KEY=your_private_key_here
    
    # KEEP THIS AS IS
    CONTRACT_ADDRESS=0xfAc510D5dB8cadfF323D4b979D898dc38F3FB6dF
    RPC_URL=https://rpc.w-chain.com
    cd ~/w-chain/staking-contract
    npm run cli stake 10000000
    npm run cli registerBLSPublicKey 0x800f1157a49bb59f5e5d790...fe349fa19a3c323f518a4bd4aa963
    sudo nano /etc/systemd/system/w-chain-node.service
    [Unit]
    Description=W Chain Validator Node
    After=network.target
    StartLimitIntervalSec=1
    
    [Service]
    Type=simple
    User=ubuntu
    ExecStart=/home/ubuntu/w-chain/w-chain-node server --config /home/ubuntu/w-chain/default-config.json
    
    [Install]
    WantedBy=multi-user.target
    sudo systemctl daemon-reload
    sudo systemctl enable w-chain-node.service
    sudo systemctl start w-chain-node.service
    sudo systemctl start w-chain-node
    sudo systemctl stop w-chain-node
    sudo systemctl restart w-chain-node
    journalctl -u w-chain-node
    journalctl -u w-chain-node -f
    hash: Transaction hash associated with the point-earning activity
  • Current: Month start to current date

  • Previous: Same date range in previous month

  • Example: If today is Jan 19, compares Jan 1-19 vs Dec 1-19

  • /vs-last-month

    1 minute

    Comparison data needs to be relatively fresh

    referral: Points from referring new users
  • governance: Points from participating in governance

  • bridge: Points from using cross-chain bridge functionality

  • month

    string

    Yes

    Month in YYYY-MM format

    month

    string

    Yes

    Month in YYYY-MM format

    user

    string

    Yes

    User's Ethereum address

    month

    string

    Yes

    Month in YYYY-MM format

    user

    string

    Yes

    User's Ethereum address

    user

    string

    Yes

    User's Ethereum address

    user

    string

    Yes

    User's Ethereum address

    /leaderboard

    5 minutes

    Leaderboard changes relatively slowly

    /user

    5 minutes

    Detailed history is relatively stable

    /user-by-category

    30 seconds

    Category summaries may update more frequently

    /user-by-current-month

    1 minute

    Current month data changes more frequently

    : Returns
    null
    if no price data available
    Inherits caching behavior from WCO endpoint

    Calculated Price (like WAVE):

    • Based on trading pair data

    • Calculated against base token (typically WCO)

    • Derived USD pricing

    : Implement robust error handling for network issues

    Dependency Health: WCO price availability for WAVE calculations

    GET https://oracle.w-chain.com/api/points/leaderboard?month=2024-01
    [
      {
        "user": "0x1234567890123456789012345678901234567890",
        "points": 15750
      },
      {
        "user": "0x0987654321098765432109876543210987654321",
        "points": 12300
      },
      {
        "user": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
        "points": 8900
      }
    ]
    GET https://oracle.w-chain.com/api/points/user?month=2024-01&user=0x1234567890123456789012345678901234567890
    [
      {
        "category": "trading",
        "points": 500,
        "created_at": "2024-01-15T14:30:00.000Z",
        "hash": "0xabc123def456789..."
      },
      {
        "category": "staking",
        "points": 250,
        "created_at": "2024-01-14T09:15:00.000Z",
        "hash": "0xdef789abc123456..."
      },
      {
        "category": "liquidity_provision",
        "points": 1000,
        "created_at": "2024-01-13T16:45:00.000Z",
        "hash": "0x123456789abcdef..."
      }
    ]
    GET https://oracle.w-chain.com/api/points/user-by-category?month=2024-01&user=0x1234567890123456789012345678901234567890
    [
      {
        "category": "trading",
        "points": 5500
      },
      {
        "category": "liquidity_provision",
        "points": 3200
      },
      {
        "category": "staking",
        "points": 1800
      },
      {
        "category": "referral",
        "points": 750
      }
    ]
    GET https://oracle.w-chain.com/api/points/user-by-current-month?user=0x1234567890123456789012345678901234567890
    {
      "points": 8750
    }
    GET https://oracle.w-chain.com/api/points/vs-last-month?user=0x1234567890123456789012345678901234567890
    {
      "current": {
        "points": 8750,
        "period": {
          "start": "2024-01-01T00:00:00.000Z",
          "end": "2024-01-19T23:59:59.999Z"
        }
      },
      "lastMonth": {
        "points": 6200,
        "period": {
          "start": "2023-12-01T00:00:00.000Z",
          "end": "2023-12-19T23:59:59.999Z"
        }
      },
      "comparison": {
        "difference": 2550,
        "percentageChange": 41.13,
        "isFullMonthComparison": false
      }
    }
    {
      "statusCode": 400,
      "statusMessage": "Missing month parameter"
    }
    {
      "statusCode": 404,
      "statusMessage": "Points not found"
    }
    {
      "price": 1.2345,
      "asset": "TOKEN_SYMBOL",
      "base_currency": "USD"
    }
    GET https://oracle.w-chain.com/api/price/wco
    {
      "price": 0.0234,
      "asset": "WCO",
      "base_currency": "USD"
    }
    GET https://oracle.w-chain.com/api/price/wave
    {
      "price": 1.4567,
      "asset": "WAVE",
      "base_currency": "USD"
    }
    WAVE_USD_Price = WAVE_WCO_Rate × WCO_USD_Price
    GET /api/price/{token_symbol}
    {
      "price": number,
      "asset": "TOKEN_SYMBOL",
      "base_currency": "USD"
    }
    {
      "price": null,
      "asset": "TOKEN_SYMBOL",
      "base_currency": "USD"
    }
    // Fetch single token price
    async function getTokenPrice(symbol) {
      try {
        const response = await fetch(`https://oracle.w-chain.com/api/price/${symbol.toLowerCase()}`);
        const data = await response.json();
        return data.price;
      } catch (error) {
        console.error(`Error fetching ${symbol} price:`, error);
        return null;
      }
    }
    
    // Fetch multiple token prices
    async function getPortfolioValue(holdings) {
      const prices = await Promise.all([
        fetch('https://oracle.w-chain.com/api/price/wco').then(r => r.json()),
        fetch('https://oracle.w-chain.com/api/price/wave').then(r => r.json())
      ]);
      
      let totalValue = 0;
      holdings.forEach(holding => {
        const price = prices.find(p => p.asset === holding.symbol)?.price || 0;
        totalValue += holding.amount * price;
      });
      
      return totalValue;
    }
    import requests
    import asyncio
    import aiohttp
    
    def get_token_price(symbol):
        """Fetch token price synchronously"""
        try:
            response = requests.get(f'https://oracle.w-chain.com/api/price/{symbol.lower()}')
            response.raise_for_status()
            return response.json()['price']
        except requests.RequestException as e:
            print(f"Error fetching {symbol} price: {e}")
            return None
    
    async def get_multiple_prices(symbols):
        """Fetch multiple token prices asynchronously"""
        async with aiohttp.ClientSession() as session:
            tasks = []
            for symbol in symbols:
                url = f'https://oracle.w-chain.com/api/price/{symbol.lower()}'
                tasks.append(session.get(url))
            
            responses = await asyncio.gather(*tasks)
            prices = {}
            
            for response, symbol in zip(responses, symbols):
                if response.status == 200:
                    data = await response.json()
                    prices[symbol] = data['price']
                else:
                    prices[symbol] = None
            
            return prices

    Step 8: Utilizing Blockchain Backup File

    Joining a blockchain network will require a new node to sync with other existing nodes, this can take days even weeks, depends on how long the network already running so far. We have prepared backup files to jump start the process for you.

    This backup file will be updated from time to time to ensure new node operators will have closer starting point to sync their new nodes to W Chain Network

    Download and unpack Trie

    Download and unpack Blockchain

    Downloading and unpacking the Blockchain backup file will take some time, depends on your internet connection speed and Storage I/O rate

    After this step, you should have 2 new directories (blockchain and trie), in addition to the existing consensus and libp2p.

    Aligning permission and directory ownership

    This will print your current working directory (i.e. /home/ubuntu/w-chain/main-chain), copy it.

    you will see something like this:

    based on the example above, we can see the user and user group is ubuntu:ubuntu (this may vary, depends on your system). Now, that we know the user and user group, we can align the permission:

    Now, your blockchain data is ready!

    Step 8: Utilizing Blockchain Backup File

    Joining a blockchain network will require a new node to sync with other existing nodes, this can take days even weeks, depends on how long the network already running so far. We have prepared backup files to jump start the process for you.

    This backup file will be updated from time to time to ensure new node operators will have closer starting point to sync their new nodes to W Chain Network

    Download and unpack Trie

    Download and unpack Blockchain

    Downloading and unpacking the Blockchain backup file will take some time, depends on your internet connection speed and Storage I/O rate

    After this step, you should have 2 new directories (blockchain and trie), in addition to the existing consensus and libp2p.

    Aligning permission and directory ownership

    This will print your current working directory (i.e. /home/ubuntu/w-chain/main-chain), copy it.

    you will see something like this:

    based on the example above, we can see the user and user group is ubuntu:ubuntu (this may vary, depends on your system). Now, that we know the user and user group, we can align the permission:

    Now, your blockchain data is ready!

    # In the ./w-chain directory
    cd main-chain
    # In the ./w-chain directory
    cd main-chain
    curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/trie.tar.gz
    tar -xzf trie.tar.gz && rm trie.tar.gz
    curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/blockchain.tar.gz
    tar -xzf blockchain.tar.gz && rm blockchain.tar.gz
    pwd
    ls -ld /w-chain/main-chain
    drwxr-x--- 6 ubuntu ubuntu 4096 Apr 12 14:08 /data/w-chain/main-chain
    sudo chown -R ubuntu:ubuntu /home/ubuntu/w-chain/main-chain
    curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/trie.tar.gz
    tar -xzf trie.tar.gz && rm trie.tar.gz
    curl -L -O https://w-chain-data.s3.eu-north-1.amazonaws.com/20250908/blockchain.tar.gz
    tar -xzf blockchain.tar.gz && rm blockchain.tar.gz
    pwd
    ls -ld /w-chain/main-chain
    drwxr-x--- 6 ubuntu ubuntu 4096 Apr 12 14:08 /data/w-chain/main-chain
    sudo chown -R ubuntu:ubuntu /home/ubuntu/w-chain/main-chain