5 unstable releases

0.5.4 Jan 25, 2022
0.5.0 Dec 7, 2021
0.4.0 Aug 3, 2021
0.3.1 May 31, 2021
0.3.0 Apr 30, 2021

#1 in #serum

Download history 659/week @ 2024-03-13 592/week @ 2024-03-20 666/week @ 2024-03-27 660/week @ 2024-04-03 564/week @ 2024-04-10 658/week @ 2024-04-17 653/week @ 2024-04-24 585/week @ 2024-05-01 639/week @ 2024-05-08 1072/week @ 2024-05-15 645/week @ 2024-05-22 1344/week @ 2024-05-29 722/week @ 2024-06-05 461/week @ 2024-06-12 543/week @ 2024-06-19 453/week @ 2024-06-26

2,269 downloads per month
Used in 25 crates (14 directly)


6.5K SLoC


Deploying the DEX

Using the do.sh script from the repository's top level directory,

Run unit tests

./do.sh test dex

Compile the dex binary

./do.sh build dex

Deploy the dex to the configured solana cluster

DEX_PROGRAM_ID="$(solana deploy dex/target/bpfel-unknown-unknown/release/serum_dex.so | jq .programId -r)"

Run the fuzz tests

cd dex
cargo install cargo-fuzz
cargo fuzz run multiple_orders

Using the crank client utility

cd crank

# read the autogenerated help text
cargo run -- help

# supported options are localnet, mainnet, testnet, devnet

# verify that you have SOL balances for gas
solana balance -k $KEYPAIR

# run the demo script (this is mostly a smoke test)
cargo run -- $CLUSTER whole-shebang $KEYPAIR $DEX_PROGRAM_ID

# list a market with the default tick size and minimum quantity.
# if both assets have 6 decimals, this will be a quantity of 1 and a tick size of 0.01
cargo run -- $CLUSTER list-market $KEYPAIR $DEX_PROGRAM_ID --coin-mint $COIN_MINT --pc-mint $PRICE_CURRENCY_MINT

First-time setup

# Building the dex
sudo apt-get install -y pkg-config build-essential python3-pip jq
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.4.14/install/solana-install-init.sh | sh -s - v1.4.14
export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH"

git clone https://github.com/project-serum/serum-dex
cd serum-dex
./do.sh update
./do.sh build dex

# run a solana cluster. in a new shell:
git clone https://github.com/solana-labs/solana --branch v1.4.14
cd solana
sudo apt-get install -y libssl-dev libudev-dev zlib1g-dev llvm clang
cargo build --release
export RUST_LOG=solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=info,solana_bpf_loader=debug,solana_rbpf=debug
NDEBUG=1 ./run.sh

# Deploy the dex to our cluster (in the old shell)
solana config set -u
solana-keygen new
solana airdrop 100
DEX_PROGRAM_ID="$(solana deploy dex/target/bpfel-unknown-unknown/release/serum_dex.so | jq .programId -r)"

# run the demo script (this is mostly a smoke test)
cargo run -- $CLUSTER whole-shebang $KEYPAIR $DEX_PROGRAM_ID


~447K SLoC