Demos Network Specifications
  • Introduction
    • What is Demos Network
    • Demos Network Architecture
  • FAQ
  • Cookbook
    • Project setup
      • Run the project (MacOS)
      • Run the project (Windows)
        • WSL 2 Setup on Windows (10 and 11 only)
        • Issue Troubleshooting
      • Run the project (Ubuntu)
  • SDK
    • Getting Started
    • WebSDK
      • Authentication
        • FIDO2 Passkeys
          • Under the Hood: FIDO2 Passkeys
      • NodeCalls
      • Transactions
        • Creating a transaction
        • Signing a transaction
        • Broadcasting a transaction
      • L2PS SDK
        • The l2ps module
        • Interacting with the L2PS
        • L2PS Messaging System
      • Instant Messaging
        • What is the Instant Messaging Protocol?
        • Architecture Overview
        • Encryption
        • Quickstart
        • Message Types
        • API Reference
        • FAQ
    • Cross Chain
      • General layout of the XM SDKs
      • EVM
      • BTC
      • Solana
      • MultiversX (EGLD)
      • NEAR
      • IBC
      • TON
      • XRPL
      • The XMScript
      • Identities
    • Demoswork
    • Cookbook
      • Demoswork
        • Creating work steps
        • Conditional Operation
        • Base Operation
        • Signing and broadcasting
      • Transactions
        • Crosschain Transaction
        • Native Transactions
      • SWAP
        • Crosschain SWAP
    • Web2
      • Quick Start
      • DAHR API Reference
        • Types
      • Making Requests
      • Identities
        • Twitter
        • GitHub
    • API Reference
    • Bridges
      • Rubic Bridge Test
    • Post Quantum Cryptography
  • Backend
    • Internal Mechanisms
      • Network Time Synchronization
      • Cross Context Identities
    • Global Change Registry
      • GCR Structure
      • How is GCR Synced?
    • Consensus Mechanism
      • Unparalleled Scalability
      • Decentralization in PoR-BFT
      • Enhanced Security
      • Comparative Advantage
      • Addressing Potential Criticisms
      • Conclusion
    • Communications Stack
    • L2PS (Subnet) Framework
      • How are L2PS transactions handled?
    • Miscellaneous
      • Browsing the Postgres DB via psql
    • Bridges
      • Rubic Bridge
    • Developers Testbed
      • Setting up the environment
      • Setting up the repository
      • Installing dependencies
      • Node Configuration
      • Running the node
  • Frontend
    • Demos Providers Discovery Mechanism
Powered by GitBook
On this page
  • Blocks
  • Get last block number
  • Get last block hash
  • Get block by number
  • Get block by hash
  • Transactions
  • Get transaction by hash
  • Get all transactions
  • Addresses
  • Get address info
  • Peer information
  • Get node identity
  • Get peer list
  • Get Mempool
  • API Reference
  1. SDK
  2. WebSDK

NodeCalls

In DEMOS, a NodeCall is a request that reads the blockchain state. NodeCall methods on the WebSDK are denoted by the "get" prefix. eg. getLastBlockNumber

Blocks

Get last block number

Retrieves the number of the latest block in the blockchain.

const blockNo = await demos.getLastBlockNumber()
console.log("Last block No: ", blockNo)

Get last block hash

Retrieves the hash of the latest block in the blockchain.

const latestBlockHash = await demos.getLastBlockHash();
console.log("Latest block hash:", latestBlockHash);

Get block by number

Retrieves a block by its number.

const blockNumber = 1000;
const blockData = await demos.getBlockByNumber(blockNumber);
console.log("Block data:", blockData);

Get block by hash

Retrieves a block by its hash.

const blockHash = "0x1234...";
const blockData = await demos.getBlockByHash(blockHash);
console.log("Block data:", blockData);

Transactions

Get transaction by hash

Retrieves a transaction by its hash.

const txHash = "0xabcd...";
const txData = await demos.getTxByHash(txHash);
console.log("Transaction data:", txData);

Get all transactions

Retrieves all transactions in the blockchain.

const allTransactions = await demos.getAllTxs();
console.log("All transactions:", allTransactions);

Addresses

Get address info

Retrieves information about a specific address on the blockchain.

const address = "0x1234...";
const addressInfo = await demos.getAddressInfo(address);
console.log("Address info:", addressInfo);

Peer information

Get node identity

Retrieves the identity information of the connected node.

const peerIdentity = await demos.getPeerIdentity();
console.log("Peer identity:", peerIdentity);

Get peer list

Retrieves the list of peers connected to the RPC node.

const peerList = await demos.getPeerlist();
console.log("Peer list:", peerList);

Get Mempool

Retrieves the current mempool (pending transactions) of the node.

const mempool = await demos.getMempool();
console.log("Mempool:", mempool);

API Reference

PreviousUnder the Hood: FIDO2 PasskeysNextTransactions

Last updated 5 months ago

https://kynesyslabs.github.io/demosdk-api-ref/variables/websdk.demos.html