Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kynesys.xyz/llms.txt

Use this file to discover all available pages before exploring further.

Native Transactions

You can send DEM using the Demos sdk as shown below:

1. Connect to the network

import { Demos } from "@kynesyslabs/demosdk/websdk"

// Connect to the network
const rpc = "https://node2.demos.sh"
const demos = new Demos()
await demos.connect(rpc)

// Create and connect your wallet
const mnemonic = demos.newMnemonic()
await demos.connectWallet(mnemonic)

2. Create a transaction

You can now create a transaction by passing the address and the amount to demos.transfer. The amount can be either a bigint in OS (preferred, full precision; 1 DEM = 10^9 OS) or a legacy number in whole DEM (deprecated, removed in v4).
import { denomination } from "@kynesyslabs/demosdk"

// 2a. Preferred — bigint OS via the denomination helper
const tx = await demos.transfer(
    "0x6690580a02d2da2fefa86e414e92a1146ad5357fd71d594cc561776576857ac5",
    denomination.demToOs(100),  // 100 DEM → 100_000_000_000n OS
)

// 2b. Equivalent — raw bigint OS literal
const tx2 = await demos.transfer(
    "0x...",
    100_000_000_000n,
)

// 2c. Legacy — number in whole DEM (deprecated)
const tx3 = await demos.transfer("0x...", 100)
The transaction returned by demos.transfer is signed using the wallet connected to the demos object.
demos.transfer is an alias to demos.pay. See Amounts & Denominations for the full denomination reference, including getNetworkInfo fork detection and the SubDemPrecisionError guard.

3. Broadcasting the transaction

// Confirm the transaction
const validityData = await demos.confirm(tx)
console.log("Validity data", validityData)

// Broadcast the transaction
const broadcastRes = await demos.broadcast(validityData)
console.log("Broadcast result", broadcastRes)