Docs
Using Flush,
and your own node
How to use Flush with flush-cli, and the interfaces a Flush node serves when you run it yourself. The full references are in the repository: using-flush.md and node-api.md.
01 Networks
| Network | Slot on eCash | State | Branch |
|---|---|---|---|
| Mainnet -chain=ecash | 46 | Live: slot 46 activated in eCash block 978,331 (Flush 8.3.3 and later). | main |
The coin is ECX, eCash's coin, deposited into Flush and withdrawn back. Blocks come every 15 seconds when validators produce them. A trade is soft in a block of stake, BMM-confirmed once an eCash block commits to it, and final after three anchors, about half an hour.
On mainnet every rule applies from the first block. The examples below use slot 46. Its ECX are real and the network is young: start with small amounts.
02 ECX in
A BIP300 deposit on eCash into Flush's slot. Your Flush wallet gives a deposit address that names the slot and ends in a checksum. Deposit to it with Backbone, the enforcer's CreateDepositTransaction or BitWindow. A plain send to the escrow is not a deposit. The ECX appears with the Flush block that includes it.
flush-cli getdepositaddress # s46_<address>_<checksum>
backbone-cli createsidechaindeposit 46 "s46_<address>_<checksum>" 10 # on eCash, with Backbone
flush-cli getbalance03 Tokens
Assets are sent like coins. A plain asset takes two steps: a hidden reservation, then the registration, which creates the supply and a control coin. Its holder can mint more, change the data, pass control on, or fix the supply for good. Tickers are 2 to 12 letters and digits. Pool shares, positions and orders are tokens too.
flush-cli listmyassets
flush-cli sendasset "flx1q..." GOLD 12.5
flush-cli reserveasset GOLD # hidden: nobody sees the ticker coming
# 6 blocks later (reveal_depth in getbitassetsinfo):
flush-cli registerasset GOLD 1000000 2 '{"info":"One gram of gold"}'04 Launch
A launch sells a new token from a curve the chain holds. By default the supply is a billion tokens of 6 decimals; a launch may choose its supply, decimals (0 to 12) and curve fee (0.3 % to 5 %, 1.15 % by default). 3/4 of the supply is sold on the curve, whose price rises nine-fold from the first unit to the last. The curve always holds the ECX to buy back every token it sold.
When buyers have paid 100 ECX into the curve, the launch graduates: the raised ECX and the last 1/4 of the supply become a full-range position in a concentrated pool with ECX, at a 1 % fee, that nobody holds. That liquidity is locked for good. The creator may take an allocation of up to 10 %, minted at graduation, and may keep the control coin (the supply is then mintable, and marked so).
flush-cli reserveasset MOON
# 6 blocks later:
flush-cli launchtoken MOON '{"display_name":"To the moon","first_buy":1}'
flush-cli quotelaunch MOON 5
flush-cli buyfromlaunch MOON 5 # 5 ECX in, the fee included; slippage 1 % by default
flush-cli selltolaunch MOON 1000000
flush-cli getlaunch MOON # progress, price, fees, the split
flush-cli claimlaunch MOON # the creator's part of the feesFees and the split
| Where | Fee | Who gets it |
|---|---|---|
| A trade on a launch curve | the launch's, 1.15 % by default | 25 % the chain's security · 75 % the launch's split |
| The graduated, locked position | 1 % | 60 % the launch's split · 40 % the chain's security |
| A swap in any other pool | its tier: 0.01, 0.05, 0.3 or 1 % | 85 % liquidity providers · 15 % the chain's security |
The split is fixed in the launch transaction: 1 to 5 entries in basis points of the 75 %, summing to 10,000. creator (claimed with claimlaunch), burn (bought back and burned each block), and up to three addresses, paid by the chain once 0.001 ECX is owed. With no split, all of it goes to the creator.
flush-cli launchtoken MOON '{"fee_split":[{"to":"creator","bps":7500},{"to":"flx1q...","bps":2500}]}'05 Trade
Every trade is an order that waits for the end of its block. All orders through the same pool or book in a block trade at one price. You set the least you accept; if the block's price gives less, everything you paid comes back in that block. A route goes through up to 4 pools. Pools are constant product, stable, weighted or concentrated; order books take limit orders that fill at the end of blocks, never worse than their limit.
flush-cli getswapquote ECX 1 GOLD # every pool of the pair, and the best route
flush-cli swapasset ECX 1 GOLD # slippage 0.5 % by default
flush-cli swaproute '["GOLD","ECX","SILVER"]' 10
flush-cli createpool USDX 1000 USDY 1000 '{"curve":"stable","fee":0.05,"amp":200}'
flush-cli addpoolliquidity "<pool id>" '{"GOLD":10,"ECX":0.5}'
flush-cli openposition "<pool id>" 0.98 1.02 '{"USDX":500,"USDY":500}'
flush-cli placeorder GOLD 10 ECX 0.05 # a limit order, about a week by default
flush-cli settleorder "<order id>" true # cancel it06 Withdraw
The coins leave your wallet at once and are paid on eCash in a bundle that eCash miners vote on: more than 6,048 votes within 12,096 blocks, at least about six weeks on eCash mainnet. Until the withdrawal is in a bundle you can take it back.
flush-cli createwithdrawal "<eCash address>" 1.5 # 0.0001 ECX to eCash miners by default
flush-cli listwithdrawals
flush-cli refundwithdrawal "<txid>" <vout> # while it is in no bundle07 Staking
Validators bond ECX to a key. On mainnet: at least 0.25 ECX a bond from Flush 8.3.4, at least 3 active validators for blocks of stake from 30 October 2026, 18:17 UTC (4 before), at most 100. On mainnet (Flush 8.3.8) a bond counts about 33 hours after it is anchored, and within one to two hours during the bootstrap until 1 November 2026, 23:17 UTC. Unbonded coins come back after 1,008 anchors, about seven days. Blocks of stake go on without BMM for up to 16 hours on mainnet, then halt until a commitment lands.
flushd -validatorkeyfile=/path/to/keys.txt # one 32-byte secret key in hex per line
flush-cli getstakinginfo
flush-cli createbond "<validator x-only pubkey>" 10
flush-cli createunbond "<validator x-only pubkey>"08 Your own node
What flushd (or flush-app) serves. Everything but P2P binds to localhost by default.
| Interface | Turned on by | Port | Auth |
|---|---|---|---|
| JSON-RPC what flush-cli speaks; wallets at /wallet/<name> | on in flushd; server=1 for the app | 8254 | the cookie file, or -rpcauth |
| Public DEX API REST /api/v1, gRPC, gRPC-Web, Connect; no wallet | -publicapi=<port> | the one given | none; rate limits, CORS by origin |
| REST Bitcoin Core's, read-only | -rest | the RPC port | none |
| P2P | on by default | 8255 | none |
The JSON-RPC controls the node and its wallets: keep it on the machine. Use the public API for anything outside it.
flush-cli help # every method
flush-cli help swapasset # its arguments, result and examples
curl -s -u "$(cat ~/.flush/.cookie)" -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getdexinfo","params":[]}' http://127.0.0.1:8254/09 The public API
A node serves its DEX itself: launches, pools, books, positions, trades, candles, holders, quotes, unsigned actions for a wallet to sign, and the broadcast of signed transactions. One service, flush.dex.v1.DexService, on one port: REST/JSON under /api/v1, and gRPC, gRPC-Web and the Connect protocol. It never reads or calls a wallet. It is off by default.
flushd -publicapi=49100 # 127.0.0.1:49100 and [::1]:49100
curl -s http://127.0.0.1:49100/api/v1/status
curl -s 'http://127.0.0.1:49100/api/v1/launches?filter=near&limit=10'
curl -s -H 'Content-Type: application/json' -d '{"id":"MOON"}' \
http://127.0.0.1:49100/flush.dex.v1.DexService/GetLaunch # Connect, JSON To serve it to others, behind a reverse proxy on the same machine:
flushd -publicapi=49100 -publicapiorigin=https://example.org \
-publicapiproxy=127.0.0.1 -publicapiproxyheader=X-Real-IP # behind nginx on the same machine This site reads one such node. It is one instance of the API, not a different one: any node can serve the same routes.
| Area | Routes under /api/v1 (GET unless marked) |
|---|---|
| The chain | status · stats · fees |
| Launches | launches · launches/stats · launches/log · launches/{id} and its trades, candles, holders, quote, logo |
| Assets | assets · assets/{id} · assets/{id}/logo · tickers/{ticker} · verifications |
| Pools | pools · pools/{id} · pools/{asset}/{asset} and their trades, candles, ticks · positions/{id} · books/{base}/{quote} |
| Addresses | addresses/{address}/holdings, portfolio, trades · addresses/portfolio |
| Trades | trades/{txid} |
| Quotes | quote/swap · quote/deposit · quote/withdraw · quote/position |
| Builds | build/{buy, sell, swap, deposit, withdraw, launch, register, curve, pool, auction, order, position, reposition, settle, bid, collect, claim, pegin, pegout} |
| Writes | POST broadcast · POST logos · logos/{sha256} |
gRPC also serves grpc.health.v1.Health, and server reflection with -publicapireflection. Parameters, replies, rate limits and security: public-api.md.
10 RPC methods
Flush's own methods, by area, from flush-cli help of Flush 8.2.0. Each one's purpose and arguments are in node-api.md; the rest are Bitcoin Core's.
| Area | Node | Wallet |
|---|---|---|
| Assets | getasset · getassethistory · getassetlogo · getbitassetsinfo · getassetindexinfo · listassets · searchassets · decodeassettx · getverifications | reserveasset · registerasset · releaseassetreservation · mintasset · fixassetsupply · updateasset · setassetdisplayname · setassetlogo · transferassetcontrol · sendasset · burnasset · releaseasset · listmyassets · searchmyassets · listassetactivity · listassettransactions · listholdingaddresses · verifyasset |
| Launches | getlaunchstats · listlaunches · getlaunch · quotelaunch · getlaunchlog | launchtoken · curveasset · buyfromlaunch · selltolaunch · claimlaunch |
| Pools, swaps, routes | getdexinfo · listpools · searchpools · getpool · previewpool · getswapquote · quoteswap · quoteroute · quotepoolliquidity · simulateclearing · getpoolcurve · getpoolcandles · getpooltwap | createpool · addliquidity · addpoolliquidity · removeliquidity · removepoolliquidity · swapasset · swaproute · swappools |
| Positions | previewposition · getposition · getpoolticks | openposition · changeposition · listpositions |
| Order books | getbook · getorder | placeorder · settleorder · listorders |
| Dutch auctions | listauctions · searchauctions · getauction · quotebid | createauction · bidauction · collectauction |
| Oracles | listoracles · getoraclevalue · getoraclecontract | registeroracle · publishoracle · createoraclecontract · settleoraclecontract |
| Peg and mainchain | getmainchaininfo · syncmainchain · getpeginfo · listwithdrawals · getwithdrawalbundle · checkpegbalance · getsidechainstate | getdepositaddress · createwithdrawal · refundwithdrawal |
| Merged mining, anchors | setbmm · getbmminfo · requestbmmblock · createbmmblock · getanchorinfo · getanchorticket · getanchorbidpolicy · setanchorbidpolicy | – |
| Staking | getposinfo · getstakinginfo · getvalidators · getvalidator · getleaderschedule · setstaking · signbondpop · listevidence · submitevidence | createbond · createunbond · listbonds |