Simulate
Fork the chain at the tip or at any past block, run transactions, Clarity code and reads in a session, and advance bitcoin and Stacks blocks.
Simulations
Run transactions against current or historical mainnet state, read how they executed, and share the result with a link.
stxer is tooling for Stacks developers:
https://api.stxer.xyz (mainnet) and https://testnet-api.stxer.xyz (testnet). JSON over HTTPS, no API key.stxer npm package, typed TypeScript wrappers for the API.With curl, start a session forked at the current mainnet tip and evaluate some Clarity in it:
curl -s -X POST https://api.stxer.xyz/devtools/v2/simulations \
-H 'content-type: application/json' -d '{}'
# {"id":"cf7654e25f1fc629bf6060489a643e03"}
curl -s -X POST https://api.stxer.xyz/devtools/v2/simulations/cf7654e25f1fc629bf6060489a643e03 \
-H 'content-type: application/json' \
-d '{"steps":[{"Eval":["SP212Y5JKN59YP3GYG07K3S8W5SSGE4KH6B5STXER","","SP000000000000000000002Q6VF78.pox-4","(stx-get-balance tx-sender)"]}]}'
# {"steps":[{"Eval":{"Ok":"01000000000000000000000000055c9200"}}]}Open https://stxer.xyz/simulations/mainnet/<id> to see it in the inspector.
With the SDK:
import { SimulationBuilder } from 'stxer'
const id = await SimulationBuilder.new({ network: 'mainnet' })
.withSender('SP212Y5JKN59YP3GYG07K3S8W5SSGE4KH6B5STXER')
.addEvalCode('SP000000000000000000002Q6VF78.pox-4', '(stx-get-balance tx-sender)')
.run()
// Simulation will be available at: https://stxer.xyz/simulations/mainnet/<id>Next: the quickstart walks through a full session, and Limits explains fair use.