Code Examples

Comprehensive examples showcasing real-world Omne blockchain applications. From simple payments to complex DeFi protocols, learn by doing.

Quick Start Examples

💳 Simple Transfer

Send OMNE tokens between accounts with automatic fee calculation.

import { OmneClient, Account } from '@omne/sdk' const client = new OmneClient({ network: 'testnet' }) const account = await Account.fromPrivateKey(privateKey) const result = await client.transfer({ from: account.address, to: 'omne1recipient...', amount: '1000000', // 1 OMNE memo: 'Payment for services' }) console.log('Transaction:', result.hash)

📊 Balance Check

Query account balances and transaction history.

import asyncio from omne_sdk import OmneClient async def check_balance(): client = OmneClient(network='testnet') balance = await client.get_balance('omne1address...') print(f"Balance: {balance.amount} {balance.denom}") # Get transaction history history = await client.get_transactions('omne1address...') for tx in history: print(f"{tx.type}: {tx.amount} at {tx.timestamp}") asyncio.run(check_balance())

🔐 Multi-Signature

Create transactions requiring multiple signatures for enhanced security.

package main import ( "github.com/omne-foundation/omne-go-sdk/client" "github.com/omne-foundation/omne-go-sdk/multisig" ) func main() { // Create 2-of-3 multisig account accounts := []*account.Account{account1, account2, account3} multisigAddr := multisig.CreateAddress(accounts, 2) // Create transaction tx := &transactions.TransferTx{ FromAddress: multisigAddr, ToAddress: "omne1recipient...", Amount: "5000000", // 5 OMNE } // Sign with required accounts signedTx := multisig.Sign(tx, account1, account2) result, _ := client.Broadcast(ctx, signedTx) }

📡 Real-time Events

Subscribe to blockchain events and real-time notifications.

// Subscribe to new blocks const blockStream = client.subscribeToBlocks() blockStream.on('block', (block) => { console.log(`New block #${block.height}`) console.log(`Transactions: ${block.txCount}`) }) // Subscribe to account transactions const txStream = client.subscribeToTransactions(accountAddress) txStream.on('transaction', (tx) => { console.log(`${tx.type}: ${tx.amount} OMNE`) if (tx.type === 'receive') { console.log(`Received payment from ${tx.sender}`) } })

Example Categories

Featured Integration

E-commerce Payment Gateway

Complete payment processing solution with React frontend and Node.js backend.

Production Ready
Real-time payment confirmation
Automatic refund processing
Multi-currency support
Webhook notifications

Community Examples

NFT Marketplace

Community

Full-featured NFT marketplace with minting, trading, and royalty distribution.

by @blockchain_devView Code →

DAO Governance

Community

Decentralized autonomous organization with proposal voting and treasury management.

by @dao_builderView Code →

Development Resources

🛠️ Developer Tools

  • • Testnet faucet for free tokens
  • • Block explorer for debugging
  • • Transaction simulator
  • • Gas estimation tool

📚 Learning Path

  • • Start with simple transfers
  • • Learn smart contract deployment
  • • Explore DeFi patterns
  • • Build production applications

🤝 Community Support

  • • Discord developer channel
  • • Weekly developer calls
  • • GitHub discussions
  • • Example contribution program