Build Next-Gen Green Web3 on Verdis
Verdis is a world-class Layer-1 blockchain ecosystem engineered with Substrate and Rust. Featuring native Delegated Proof-of-Stake (DPoS), built-in AMM DEX, protocol carbon credit registries, deflationary tokenomics, and high-performance WASM smart contracts with zero net environmental impact.
-
Connect to the Verdis Network EndpointEstablish a secure JSON-RPC or WebSocket connection to the Verdis node cluster using JavaScript/TypeScript (`@polkadot/api`), Rust (`subxt`), or HTTP curl.
const { ApiPromise, WsProvider } = require('@polkadot/api'); async function connectVerdis() { // Connect to official Verdis WebSocket RPC endpoint const provider = new WsProvider('wss://rpc.verdischain.com'); const api = await ApiPromise.create({ provider }); // Fetch chain metadata and system specs const [chain, nodeName, nodeVersion] = await Promise.all([ api.rpc.system.chain(), api.rpc.system.name(), api.rpc.system.version() ]); console.log(`Connected to ${chain} running ${nodeName} v${nodeVersion}`); return api; } connectVerdis().catch(console.error);
-
Generate Account & Keyring (SS58 Format 909)Verdis accounts use `sr25519` schnorrkel signature scheme with custom SS58 prefix `909`. Always derive accounts safely using standard BIP-39 mnemonics.JavaScript / Account Keyring Derivation
const { Keyring } = require('@polkadot/api'); const { mnemonicGenerate, cryptoWaitReady } = require('@polkadot/util-crypto'); async function createVerdisAccount() { await cryptoWaitReady(); // Initialize Keyring with Verdis SS58 prefix 909 const keyring = new Keyring({ type: 'sr25519', ss58Format: 909 }); // Generate new 12-word seed phrase const mnemonic = mnemonicGenerate(); const pair = keyring.addFromUri(mnemonic, { name: 'Verdis Dev Pair' }); console.log(`Generated Mnemonic: "${mnemonic}"`); console.log(`Verdis SS58 Address: ${pair.address}`); return { pair, mnemonic }; }
-
Request Testnet VRDX from FaucetFund your freshly derived address with testnet VRDX tokens to execute extrinsics and deploy smart contracts.cURL / Faucet Request Endpoint
# Request 100 testnet VRDX tokens to your SS58 address curl -X POST https://rpc.verdischain.com/faucet \ -H "Content-Type: application/json" \ -d '{"address": "YOUR_VERDIS_SS58_ADDRESS", "amount": 100}'
-
Submit a VRDX Transfer ExtrinsicConstruct, sign, and submit a balance transfer on Verdis using `balances.transferKeepAlive`.JavaScript / Sign and Send Transfer
async function sendVRDX(api, senderPair, recipientAddress, amountVRDX) { // Convert VRDX to Planck units (1 VRDX = 1,000,000,000 Planck) const decimals = api.registry.chainDecimals[0] || 9; const amountPlanck = BigInt(amountVRDX) * (10n ** BigInt(decimals)); // Create balance transfer keep-alive call const tx = api.tx.balances.transferKeepAlive(recipientAddress, amountPlanck); // Sign and watch extrinsic submission const unsub = await tx.signAndSend(senderPair, ({ status, events, dispatchError }) => { console.log(`Transaction Status: ${status.type}`); if (status.isInBlock) { console.log(`Included in Block: ${status.asInBlock.toHex()}`); } else if (status.isFinalized) { console.log(`Finalized in Block: ${status.asFinalized.toHex()}`); unsub(); } if (dispatchError) { if (dispatchError.isModule) { const decoded = api.registry.findMetaError(dispatchError.asModule); console.error(`Module Error: ${decoded.section}.${decoded.name}`); } else { console.error(`Dispatch Error: ${dispatchError.toString()}`); } } }); }
| RPC Method | Parameters | Return Type | Description |
|---|---|---|---|
| chain_getBlock Chain |
hash?: Hash | SignedBlock | Get header and body extrinsics for a specific block hash or latest block. |
| chain_getHeader Chain |
hash?: Hash | Header | Get header info (number, parentHash, stateRoot, extrinsicsRoot, digest). |
| chain_getBlockHash Chain |
blockNumber?: BlockNumber | Hash | Get block hash corresponding to a specific block height. |
| chain_getFinalizedHead Chain |
none | Hash | Get the hash of the latest block finalized by GRANDPA consensus. |
| chain_subscribeAllHeads Chain |
none | SubscriptionId | Subscribe to all block headers received by node. |
| chain_subscribeNewHeads Chain |
none | SubscriptionId | Subscribe to new best block header notifications. |
| chain_subscribeFinalizedHeads Chain |
none | SubscriptionId | Subscribe to GRANDPA finalized header notifications. |
| chain_unsubscribeNewHeads Chain |
subId: SubscriptionId | bool | Unsubscribe from new block header notifications. |
| state_getStorage State |
key: StorageKey, hash?: Hash | StorageData (Hex) | Read scale-encoded storage value from runtime storage trie at given hash. |
| state_getRuntimeVersion State |
hash?: Hash | RuntimeVersion | Get spec name, spec version, authoring version, and API version. |
| state_getMetadata State |
hash?: Hash | Metadata (Hex) | Fetch full runtime metadata describing pallets, calls, events, and storage. |
| state_queryStorageAt State |
keys: Vec<StorageKey>, at?: Hash | Vec<StorageChangeSet> | Query storage entries across multiple keys at a specific block. |
| state_subscribeStorage State |
keys: Vec<StorageKey> | SubscriptionId | Subscribe to real-time storage modifications for specified storage keys. |
| state_call State |
method: String, data: Bytes | Bytes | Execute a read-only runtime API call without modifying state. |
| state_getChildKeys State |
childKey: StorageKey, prefix: StorageKey | Vec<StorageKey> | Query child storage keys for contracts or child tries. |
| state_getStorageHash State |
key: StorageKey, hash?: Hash | Hash | Get blake2 hash of storage value at given key. |
| system_health System |
none | Health | Return node health state: `{ isSyncing: bool, peers: usize, shouldHavePeers: bool }`. |
| system_name System |
none | String | Get node implementation name ("Verdis Node"). |
| system_version System |
none | String | Get release binary version string ("1.4.0-verdis"). |
| system_networkState System |
none | NetworkState | Return network P2P state, libp2p multiaddresses, and connected peer IDs. |
| system_chain System |
none | String | Returns chain name ("Verdis Testnet"). |
| system_properties System |
none | ChainProperties | Returns `{ ss58Format: 909, tokenSymbol: "VRDX", tokenDecimals: 9 }`. |
| system_peers System |
none | Vec<PeerInfo> | Detailed list of connected P2P peers, roles, and latency. |
| system_addReservedPeer System |
peer: String | void | Add multiaddress as a reserved peer node in libp2p overlay. |
| system_nodeRoles System |
none | Vec<NodeRole> | Return active roles of this node (Full, Light, Authority). |
| author_submitExtrinsic |
extrinsic: Bytes | Hash | Submit hex-encoded signed transaction payload into local tx pool. |
| author_submitAndWatchExtrinsic |
extrinsic: Bytes | SubscriptionId | Submit transaction and stream status updates (Ready, InBlock, Finalized). |
| author_pendingExtrinsics |
none | Vec<Bytes> | Return list of all unconfirmed transactions currently queued in mempool. |
| author_removeExtrinsic |
bytes: Vec<ExtrinsicOrHash> | Vec<Hash> | Remove specified extrinsics from local transaction queue. |
| author_rotateKeys |
none | Bytes | Generate new BABE / GRANDPA session keys in node keystore for validator rotation. |
| author_hasKey |
publicKey: Bytes, keyType: String | bool | Check if node keystore possesses private key for public key. |
| author_hasSessionKeys |
sessionKeys: Bytes | bool | Verify validator session key ownership in local keystore. |
| amm_dex_getPool AMM DEX |
assetA: AssetId, assetB: AssetId | PoolInfo | Query reserves, total LP shares, and swap fee for a liquidity pool. |
| amm_dex_getAllPools AMM DEX |
none | Vec<PoolInfo> | Return complete directory of active AMM trading pairs on Verdis. |
| amm_dex_getPrice AMM DEX |
assetIn: AssetId, assetOut: AssetId, amountIn: Balance | QuoteResult | Calculate spot price quote, expected output amount, and price impact. |
| amm_dex_getLiquidity AMM DEX |
provider: AccountId, poolId: PoolId | LPBalance | Query liquidity provider position, LP token balance, and share percentage. |
| amm_dex_quoteAddLiquidity AMM DEX |
assetA: AssetId, assetB: AssetId, amountADesired: Balance | QuoteAddResult | Calculate required counter-asset amount for balanced liquidity deposit. |
| amm_dex_quoteRemoveLiquidity AMM DEX |
poolId: PoolId, lpAmount: Balance | QuoteRemoveResult | Calculate underlying asset amounts returned when burning LP tokens. |
| eco_getCarbonOffset Eco |
account?: AccountId | CarbonMetrics | Fetch cumulative carbon offset in kg CO2e for an account or entire network. |
| eco_getGreenScore Eco |
validator: AccountId | GreenScore (0-100) | Calculate validator sustainability rating based on renewable power & green stakes. |
| eco_getReforestationProjects Eco |
status?: ProjectStatus | Vec<ProjectInfo> | List verified global reforestation projects funded by Verdis protocol gas fee burns. |
| eco_getProjectDetails Eco |
projectId: u32 | ProjectDetails | Detailed statistics, GPS coordinates, and verification proofs for an Eco project. |
| babe_epochAuthorship BABE |
none | HashMap<AuthorityId, Vec<Slot>> | Returns expected slot assignment for validators in current BABE epoch. |
| grandpa_roundState GRANDPA |
none | ReportedRoundState | Returns voting round status, prevotes, and precommits for GRANDPA finality gadget. |
| grandpa_subscribeJustifications GRANDPA |
none | SubscriptionId | Subscribe to stream of GRANDPA finality justification proofs. |
Verdis WebSocket API relies on JSON-RPC 2.0 pub/sub messaging. Clients subscribe to specific notification topics and receive real-time updates as state mutates.
const WebSocket = require('ws'); const ws = new WebSocket('wss://rpc.verdischain.com'); ws.on('open', () => { console.log('WebSocket connection established to Verdis RPC'); // Subscribe to new best block headers const subscribeHeader = { jsonrpc: '2.0', id: 1, method: 'chain_subscribeNewHeads', params: [] }; ws.send(JSON.stringify(subscribeHeader)); }); ws.on('message', (data) => { const payload = JSON.parse(data); if (payload.method === 'chain_newHead') { const header = payload.params.result; const blockNum = parseInt(header.number, 16); console.log(`🌿 New Verdis Block #${blockNum} | State Root: ${header.stateRoot}`); } });
Query Account Balance & Staking Info
const { ApiPromise, WsProvider } = require('@polkadot/api'); async function getAccountBalance(ss58Address) { const api = await ApiPromise.create({ provider: new WsProvider('wss://rpc.verdischain.com') }); // Query System.Account frame storage const { data: { free, reserved, frozen } } = await api.query.system.account(ss58Address); // Convert Planck (10^-9) to native VRDX const freeVRDX = Number(free.toBigInt()) / 1e9; const reservedVRDX = Number(reserved.toBigInt()) / 1e9; console.log(`Account: ${ss58Address}`); console.log(`Free Balance: ${freeVRDX.toFixed(4)} VRDX`); console.log(`Reserved / Staked: ${reservedVRDX.toFixed(4)} VRDX`); }
Query AMM DEX Pools & Green Carbon Metrics
async function fetchDexAndEcoData() { // Query custom AMM DEX and Eco RPC methods const pools = await callVerdisRpc('amm_dex_getAllPools', []); const ecoOffset = await callVerdisRpc('eco_getCarbonOffset', []); console.log('Active Verdis AMM Liquidity Pairs:', pools); console.log(`Total Verdis Protocol CO2 Offset: ${ecoOffset.total_co2_kg} kg`); } async function callVerdisRpc(method, params) { const response = await fetch('https://rpc.verdischain.com', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }) }); const data = await response.json(); return data.result; }
Deploy WASM Smart Contract (`pallet-contracts`)
const { CodePromise, ContractPromise } = require('@polkadot/api-contract'); const fs = require('fs'); async function deployWasmContract(api, deployerPair) { // Load compiled ink! WASM bytecode and ABI json metadata const wasm = fs.readFileSync('./target/ink/flipper.wasm'); const abi = JSON.parse(fs.readFileSync('./target/ink/flipper.json')); // Prepare CodePromise for pallet-contracts const code = new CodePromise(api, abi, wasm); // Set gas limits & storage deposit limits const gasLimit = api.registry.createType('WeightV2', { refTime: 3000000000, proofSize: 100000 }); const storageDepositLimit = null; // Instantiate smart contract const tx = code.tx.new({ gasLimit, storageDepositLimit }, true); await tx.signAndSend(deployerPair, ({ status, contract }) => { if (status.isInBlock) { console.log(`Contract deployed at address: ${contract.address.toString()}`); } }); }
Setting Up a Local Node
Compile `verdis-chain` from Rust source and launch a single-node development network.
cd verdis-chain
cargo build --release
./target/release/verdis-chain --dev --tmp
Connecting to Testnet
Join the 10-node Verdis testnet using raw chain spec (`verdis-testnet-raw.json`).
--chain verdis-testnet-raw.json \
--bootnodes /ip4/147.182.200.12/tcp/30333/p2p/12D3KooW... \
--port 30333 --rpc-port 9944
Building a Simple dApp
Connect React/Vue frontend apps to Verdis extension wallets and query state in real-time.
await web3Enable('My Verdis App');
const accounts = await web3Accounts();
Interacting with Smart Contracts
Compile ink! smart contracts to WASM bytecode and upload to `pallet-contracts`.
cargo contract build --release
cargo contract upload --suri //Alice
# Run node as a active validator with raw spec file ./verdis-chain \ --chain verdis-testnet-raw.json \ --validator \ --name "Verdis-Validator-Node-01" \ --base-path /var/lib/verdis-data \ --port 30333 \ --rpc-port 9944 \ --ws-port 9944 \ --rpc-cors all \ --rpc-methods Safe \ --telemetry-url "wss://telemetry.verdischain.com/submit 0" # Generate Keypairs using Subkey tool for Verdis (SS58 Format 909) subkey generate --scheme sr25519 --network verdis # Inspect Public Key & SS58 Address subkey inspect --scheme sr25519 "YOUR_MNEMONIC_PHRASE_HERE" # Cargo Contract CLI Commands cargo contract new my_token cargo contract build --release cargo contract test
Substrate Runtime
WASM-compiled state machine ensuring forkless upgrades and instant extrinsic dispatch.
BABE / GRANDPA
BABE block production every 6s slot paired with GRANDPA deterministic finality gadget.
Eco Engine
Integrated carbon footprint tracking, automated reforestation treasury, and green scoring.
AMM DEX
Constant product $x \cdot y = k$ liquidity pools with eco-fee routing directly on-chain.
Pallet Directory:
// Click 'Execute RPC Call' to run live request...