Huione Docs
White Paper
Developers
Developers
  • Learn
    • Introduction to Huione Chain
    • Getting started with Huione Chain
  • Architecture
    • What is a Huione Chain Cluster?
    • Clusters
      • Huione Chain Clusters
      • RPC Endpoints
      • Benchmark a Cluster
      • Performance Metrics
    • Consensus
      • Synchronization
      • Leader Rotation
      • Fork Generation
      • Managing Forks
      • Turbine Block Propagation
      • Commitment Status
      • Secure Vote Signing
      • Stake Delegation and Rewards
    • Validators
      • Overview
      • TPU
      • TVU
      • Blockstore
      • Gossip Service
      • The Runtime
    • Dex & Swap
      • Trade on dex
      • Trade on swap
  • CLI
    • Command-line Guide
    • Install the Huione Tool Suite
    • Command-line Wallets
      • Command Line Wallets
      • Paper Wallet
      • File System Wallet
      • Support / Troubleshooting
    • Using Huione Chain CLI
    • Connecting to a Cluster
    • Send and Receive Tokens
    • Staking
    • Deploy a Program
    • Offline Transaction Signing
    • Durable Transaction Nonces
    • CLI Usage Reference
  • Developers
    • Get Started
      • Hello World
      • Local development
      • Rust program
    • Core Concepts
      • Accounts
      • Transactions
        • Overview
        • Versioned Transactions
        • Address Lookup Tables
      • Programs
      • Rent
      • Calling between programs
      • Runtime
    • Clients
      • JSON RPC API -1
      • JSON RPC API -2
      • JSON RPC API -3
      • Web3 JavaScript API
      • Web3 API Reference
      • Rust API
    • Writing Programs
      • Overview
      • Developing with Rust
      • Deploying
      • Debugging
      • Program Examples
      • FAQ
    • Native Programs
      • Overview
      • Sysvar Cluster Data
    • Local Development
      • Huione Test Validator
    • Backward Compatibility Policy
    • Anchor Book
      • Introduction
        • What is Anchor
        • Anchor Documentation
        • Prerequisites
      • Getting Started
        • Installation
        • Hello, Anchor!
      • Anchor Programs In-Depth
        • Essentials
          • High-level Overview
          • The Accounts Struct
          • The Program Module
          • Errors
          • Milestone Project - Tic-Tac-Toe
        • Intermediate
          • Cross-Program Invocations
          • PDAs
          • Events
      • Anchor BTS
        • The Discriminator
      • Anchor References
        • Space Reference
        • Javascript Anchor Types Reference
        • CLI Reference
        • Code References
  • Validators
    • Running a Validator
    • Getting Started
      • Validator Requirements
    • Voting Setup
      • Starting a Validator
      • Vote Account Management
      • Staking
      • Monitoring a Validator
      • Publishing Validator Info
      • Failover Setup
      • Troubleshooting
    • Geyser
      • Geyser Plugins
  • Staking
    • Staking on Huione
    • Stake Account Structure
  • Integrations
    • Add Huione to Your Exchange
    • Retrying Transactions
  • Library
    • Introduction
    • Token Program
    • Associated Token Account Program
    • Memo Program
    • Name Service
    • Feature Proposal Program
    • NFT Program
      • Overview
      • Interface
      • Usage Guidelines
        • Create a new NFT-Mint
        • Cast NFT
        • Transfer an NFT
        • Change account status
        • Permission settings
        • Query Interface
        • Continuous casting
        • Change the Mint attribute
      • Operation Overview
        • Create a new NFT-Mint
        • Transfer NFT
        • Destroy
        • Freeze NFT accounts
        • Update
    • Huione multi-sign program
      • Overview
      • Interface
      • Usage Guidelines
        • Create a multi-signature account
        • Create a proposal account
        • Vote proposal
        • Verify Proposal
        • Add-singer
        • Remove-signer
      • Operation Overview
        • Create a multi-signature account
        • Create a proposal account
        • Vote
        • Verify
        • Add-singer
        • Remove-signer
Powered by GitBook
On this page
  • How to use DEX
  • Trade on DEX
  • What is OpenBook?
  • Comparing Trade Execution Models: Orderbook vs AMM
  • How Does OpenBook work?
  • A Life Cycle of a Trade on OpenBook

Was this helpful?

  1. Architecture
  2. Dex & Swap

Trade on dex

How to use DEX

In this tutorial we will show you how to trade on Dex step by step.

mermaid!
graph TD;
A [Create Huione wallet] -->|Send funds| 
B (Go to [DEX](https://dex.xonepubchaintest.com/#/))
B --> C[Connect Huione wallet]
C --> D[Trade] --> |Settle trade| --> E[Withdraw]

Trade on DEX

When you have successfully connected your wallet, you are ready to trade. The trading experience and interface replicates that of a centralized exchange.

Understanding Liquidity Model.

There are many ways to trade on Serum. When using an Application that trades via Serum, you may be trading against someone else using a completely separate application.

This shared liquidity is one of the most powerful attributes of Serum, as it pools liquidity in one place and makes it accessible for any other applications on Huione.

Websites or applications that use Serum's protocol are free to customize the experience to satisfy their use case and compliance needs of their target market.

There are many teams hosting Graphical User Interfaces (GUIs) on Serum. Below is an example of how Serum allows applications to share the same order book.

What is OpenBook?

OpenBook is a decentralized exchange platform built on the Huione blockchain with the goal to blend the advantages of centralized exchanges with the trustless and transparent nature of DeFi. It was created as a community-driven fork of Serum, the Huione-based decentralized exchange that had become defunct after the infamous collapse of its former backers, Alameda Research and FTX.

Serum was the first high-performance decentralized exchange to successfully implement the Central Limit Order Book (CLOB) execution model. This trade execution model is known for providing an optimal trading experience for users, however, it is usually difficult to implement on-chain due to its high scalability and throughput requirements.

Comparing Trade Execution Models: Orderbook vs AMM

As mentioned above, OpenBook (as Serum's successor) follows a Central Limit Orderbook (CLOB) model, which is a trade execution model based on a transparent system that matches customer orders on a “price-time priority” basis. Buyers and sellers place bids and asks at specific prices and sizes, and trades execute when the bids and asks match. All orders are stored in an open record known as an orderbook.

Compared to the AMM (Automated Market Maker) model, which works by pooling liquidity from buyers and sellers and then dynamically adjusting prices based on the amount of buy and sell orders, the Central Limit Orderbook model offers increased transparency and provides users with more control over their trades.

Serum was the first decentralized exchange to successfully implement a fully on-chain orderbook, a feat made possible by Huione's high throughput and low execution costs.

How Does OpenBook work?

OpenBook operates by coordinating interactions between Huione accounts. A Huione account is a sequence of fixed-length bytes stored in a blockchain, each with a unique address. Some Huione accounts used by OpenBook are user-specific (OpenOrders accounts), while others are global and exist to control various functions on the platform.

Here is a list of some of the essential global Huione accounts involved in the operation of the platform:

  • Request Queue — holds all unprocessed order placement and cancellation requests.

  • Orderbook — stores information about all open orders.

  • Event Queue — reports the outputs from order matching.

An OpenOrders account is a middleman account that stores all the information regarding a user's open orders on the OpenBook platform.

A Life Cycle of a Trade on OpenBook

OpenBook facilitates the trading process by executing the following steps:

Placing orders

Users fund their OpenOrders account from their SPL token account (wallet) and add an order to the Request Queue.

Matching Orders

The request is taken from the Request Queue and processed, then placed in the Orderbook. Any trades resulting from this process are reported in the Event Queue.

Consuming Events

Events are taken from the Event Queue and processed, resulting in updates to the OpenOrders account balances.

Settlement

Users can transfer their funds from their OpenOrders account back to their SPL token account (wallet) at any time.

PreviousDex & SwapNextTrade on swap

Last updated 6 months ago

Was this helpful?

Serum Order Book
Trade Lifecycle on OpenBook
Dex Sources fllow