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
  • Step 1: Gas fee confirmation
  • Step 2: Broadcasting the validity data
  1. SDK
  2. WebSDK
  3. Transactions

Broadcasting a transaction

The DEMOS transaction broadcasting system works as a 2 step process.

Step 1: Gas fee confirmation

The confirmation process starts by a client sending the transaction to the node. The node analyses the workload and returns information on how much gas is needed to execute your transaction.

const validityData = await demos.confirm(tx)

console.log("Validity data: ", validityData)

The information is wrapped in a validity data object, which looks something like this:

{
  valid: true,
  reference_block: 63754,
  message: '[Native Tx Validation] Transaction signature verified\n',
  gas_operation: {
    operator: 'pay_gas',
    actor: '[object Object]',
    params: {
      amount: '10112.6664',
    },
    hash: '1150ffa293be58b3537fbc5c41c97ab3686a0360c85d64903dd0ecc3337ce713',
    nonce: 0,
    timestamp: 1726757110915,
    status: 'pending',
    fees: {
      network_fee: 0,
      rpc_fee: 0,
      additional_fee: 0,
    },
  },
  transaction: {
    // ...
  },
}

The response is an object containing the status code, the response or an error message if one occured and your transaction. If you are comfortable with the amount of gas to be used (gas_operation.params.amount), you can proceed to broadcasting the tx.

Your public key and public key signature are sent along with the request for verification. You need to have your KeyPair connected to the demos object.

Step 2: Broadcasting the validity data

To execute your transaction, send back the validity data to the node.

const res2 = await demos.broadcast(validityData)
PreviousSigning a transactionNextL2PS SDK

Last updated 8 months ago