Get started › Quickstart
Steps 1–4 only read data — no wallet, no fees. Step 5 sends a real transaction.
1. Read the BTCw price
curl -s https://btcw.tech/api/price
Returns price_usd, OracleAMM's actual buy/sell prices (bid_usd/ask_usd) and the price age. Always check stale:
once the price is older than max_age_seconds (300), OracleAMM stops filling trades. See Read prices.
2. List what you can swap
curl -s https://btcw.tech/api/v2/swap/assets
202 assets: native BTCw (placeholder address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE), USDw and 200 price-tracker tokens (100 crypto, 100 US stocks). Every asset has 18 decimals.
3. Get a quote
# swap 0.001 BTCw for USDw — amount is an integer in base units (18 decimals)
curl -s "https://btcw.tech/api/v2/swap/quote?from=native&to=0x3b5BD179CA6Aab4DAF0f842829776843ABe6e727&amount=1000000000000000"
The response includes amountOut, minAmountOut (after 1% slippage), fees and the route. Add &sender=0xYourWallet to also receive
a ready-to-sign tx. Details: Wallet swap integration.
4. Or ask the contract directly
If you don't want to trust any server, eth_call OracleAMM:
import { JsonRpcProvider, Contract, parseEther, formatEther } from "ethers";
const p = new JsonRpcProvider("https://rpc.btcw.tech", 482120);
const amm = new Contract("0xd953d53414a81eb6AC5a4edE73d13992181aF51E",
["function quoteSellBtcw(uint256) view returns (uint256)"], p);
console.log(formatEther(await amm.quoteSellBtcw(parseEther("0.001"))), "USDw");
cast call 0xd953d53414a81eb6AC5a4edE73d13992181aF51E "quoteSellBtcw(uint256)(uint256)" 1000000000000000 --rpc-url https://rpc.btcw.tech
5. Send a transaction
- Add the network to your wallet — parameters on Network, or use the "Add network" button on the home page.
- Hold a little BTCw for gas (minimum gas price 0.001 gwei — a swap costs less than 0.000001 BTCw).
- Send the
txfrom step 3 viaeth_sendTransaction, or follow Swap via contracts.
To try step 5 without spending real funds: anvil --fork-url https://rpc.btcw.tech gives you a chain fork with 10 accounts, each holding 10,000 BTCw.
See Test on a chain fork.