RPC Reference
OPP_NET exposes a JSON-RPC 2.0 API at rpc.opnet.dev/<network>. Methods prefixed with btc_ are handled by the metashrew indexer (opshrew views). Methods prefixed with bitcoin_ are proxied to the underlying bitcoind via btcrpc-proxy.
Endpoints
| Network | URL |
|---|---|
| Mainnet | https://rpc.opnet.dev/mainnet |
| Testnet4 | https://rpc.opnet.dev/testnet4 |
| Regtest | https://rpc.opnet.dev/regtest |
Chain State
btc_blockNumber
Returns the latest indexed block height.
// Request
{"jsonrpc":"2.0","method":"btc_blockNumber","params":[],"id":1}
// Response
{"jsonrpc":"2.0","result":"0x16b2","id":1} // hex-encoded heightbtc_chainId
Returns the 32-byte chain ID (network genesis hash or OP_NET chain identifier).
// Response
{"jsonrpc":"2.0","result":"0x0000017f85106b1f...","id":1}btc_getBlockByNumber
Returns block metadata by height. Params: [height_hex]
Returns: block_hash, timestamp, tx_count, opnet_tx_count, gas_used.
btc_getBlockByHash
Returns block metadata by hash. Params: [block_hash_hex]
Contracts
btc_call
Simulate a read-only contract call without persisting state.
// Request
{"jsonrpc":"2.0","method":"btc_call","params":{
"to": "contract_address_32bytes_hex",
"calldata": "selector_and_args_hex"
},"id":1}
// Response
{"jsonrpc":"2.0","result":"0x...exit_data...","id":1}btc_getCode
Get contract WASM bytecode. Params: [contract_address_hex]
btc_getStorageAt
Read a 32-byte storage slot. Params: [contract_address_hex, key_hex]
btc_getDeployer
Get the deployer's x-only public key for a contract. Params: [contract_address_hex]
btc_contractCount
Total number of deployed contracts. No params.
// Response
{"jsonrpc":"2.0","result":"0x0fb2","id":1} // 4018 contractsbtc_contractAtIndex
Get contract address by sequential index. Params: [index] (number or hex)
Transactions
btc_getTransactionByHash
Get transaction info. Params: [tx_hash_hex]
Returns: height, tx_index, tx_type, contract_address.
btc_getTransactionReceipt
Get execution receipt. Params: [tx_hash_hex]
Returns: status, gas_used, exit_data, events.
Traces
btc_getTrace
Full execution trace for a transaction. Params: [tx_hash_hex]
Returns: callType, target, caller, calldata, success, gasUsed, exitData, storageWrites, events, subCalls.
btc_getBlockTraces
All traces for a block. Params: [height_hex]
Mining / Epochs
btc_getEpochTemplate
Get the current epoch's PoW challenge. No params.
Returns: epoch_number, target_checksum.
btc_submitEpoch
Validate a PoW solution (read-only). Params: [epoch_number, salt_hex, pubkey_hex]
btc_getEpochByNumber
Get epoch data. Params: [epoch_number]
Gas
btc_gas
Gas info for latest block (or specific height). Params: [height_hex?]
Bitcoin Core (Proxied)
Methods prefixed with bitcoin_ are proxied directly to the underlying bitcoind via btcrpc-proxy. These include:
bitcoin_getblockcountbitcoin_getblockhashbitcoin_getblockbitcoin_getrawtransactionbitcoin_sendrawtransactionbitcoin_estimatesmartfeebitcoin_getmempoolinfo- ...and all other Bitcoin Core JSON-RPC methods
The bitcoin_ prefix is stripped before forwarding. For example, bitcoin_getblockcount is forwarded asgetblockcount.
UTXOs (via Esplora)
btc_getUTXOs
Get UTXOs for a Bitcoin address. Params: [address]
Returns normalized format: transactionId, outputIndex, value, scriptPubKey.
Osprey REST API
osprey provides a REST API for the block explorer and protocol analytics. All endpoints are served under rpc.oppnet.dev/<network>/explorer/api/v1.
Explorer Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /blocks | List recent blocks with OP_NET metadata |
| GET | /tx/{txid} | Transaction details including contract interactions |
| GET | /tx/{txid}/trace | Full execution trace tree (calls, subcalls, storage writes) |
| GET | /address/{addr} | Address activity: contract deployments, interactions, transfers |
| GET | /contracts | List all deployed contracts with metadata |
| GET | /stats | Network statistics: total contracts, transactions, gas usage |
OppSwap Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /swap/pools | All liquidity pools with reserve data |
| GET | /swap/tokens | Token list with prices and metadata |
| GET | /swap/volume | Volume analytics (24h, 7d, 30d) |
SLOHM Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /slohm/overview | Protocol dashboard: OHM price, index, TVL, APY |
| GET | /slohm/rebases | Rebase history with distribute amounts and index changes |
| GET | /slohm/bonds | Active bond markets with prices, capacity, and vesting terms |
| GET | /slohm/treasury/history | Treasury balance over time: reserves, risk-free value, backing per OHM |
# Example: fetch recent blocks from the explorer
curl https://rpc.oppnet.dev/regtest/explorer/api/v1/blocks
# Example: get trace for a transaction
curl https://rpc.oppnet.dev/regtest/explorer/api/v1/tx/abc123.../trace
# Example: get all OppSwap pools
curl https://rpc.oppnet.dev/regtest/explorer/api/v1/swap/pools