Computer

The Computer class is the main client API for the Bitcoin Computer. Methods are grouped below. Prefer the query helpers under Query outputs over the deprecated query.

Basic

You can build almost all smart contracts with these.

Method Description
constructor Creates an instance of class Computer
new Creates a smart object from a smart contract
getOUTXOs Unspent smart-object revisions (preferred replacement for query)
sync Computes the state of a smart object from a revision (or an effect from a tx id)

Modules

Deploy JavaScript modules (preferably via taproot) to avoid redundant on-chain storage for smart contracts, keep using expressions tiny, and minimize on-chain technical dust / hygiene dust costs. See Fees for details and best practices.

Method Description
deploy Deploys a JavaScript module on the blockchain
load Loads and evaluates a module (returns exports)
getModules Lists module deploys indexed by the node
getModule Fetches one indexed module row (including source ept)
getInscription Static helper: parse a taproot BC module witness from raw tx hex

Query outputs

Query the node’s Output table. All of these accept a TXOQuery (see getTXOs). verbosity: 0 (default) returns revision strings; verbosity: 1 returns full rows.

Method Description
getTXOs Transaction outputs matching the query
getUTXOs Unspent outputs (isSpent: false)
getOTXOs Smart-object outputs (isObject: true)
getOUTXOs Unspent smart objects (isObject: true, isSpent: false)

Advanced encode / decode

For applications that need control over signing, UTXOs spent, custom scripts, or collaborative transaction building.

Method Description
encode Encodes a JavaScript expression into a Bitcoin transaction
encodeNew Encodes a constructor call into a Bitcoin transaction
encodeCall Encodes a function call into a Bitcoin transaction
decode Parses a transition transaction (exp / env / mod); not for module deploys
fund Adds inputs/change so a transaction can pay fees
delete Spends the given smart-object revisions (destroys those UTXOs)

History

Access historical versions of on-chain objects and related graph data.

Method Description
first Return the first revision (object id) for a revision
prev Return the previous revision
next Return the next revision
latest Return the latest revision
last Latest revision if spent; otherwise undefined
spendingInput Input that spent a given revision
getAncestors Ancestor transaction ids (or hex map) for a location

Wallet

Access the client-side wallet and node connection.

Method Description
sign Signs a Bitcoin transaction
broadcast Broadcasts a Bitcoin transaction
send Sends satoshis to an address
faucet Fund an address on regtest
listTxs Sent and received transactions for an address
rpc Call Bitcoin RPC methods via the node
getAddress Wallet address
getBalance Confirmed, unconfirmed, and total balance in sats
getChain Chain (LTC, BTC, …)
getNetwork Network (mainnet, testnet, regtest)
getUrl URL of the connected Bitcoin Computer Node
getMnemonic BIP39 mnemonic
getPassphrase Wallet passphrase
getPath BIP32 derivation path
getPrivateKey Private key (hex/WIF string form used by the wallet)
getPublicKey Public key (hex)
getFee Fee rate in sat/byte
setFee Set fee rate in sat/byte
getVersion Static: library version string
isUnspent Whether a revision is still unspent on the chain

Indexer readiness

After broadcast, the node may take a short time to index outputs. Use these when you need strong read consistency before sync / getOUTXOs.

Method Description
isIndexed Whether the node has committed Output rows for a tx
waitForIndexed Poll until indexed (or timeout)

Real-time (SSE)

Method Description
subscribe Updates for a smart-object id
streamTXOs Stream outputs matching a filter
streamMempoolCleanup Notifications when stale mempool rows are removed

Deprecated

Still present for backward compatibility; prefer the replacements.

Method Prefer instead
query getOUTXOs
getUtxos getUTXOs with { address, isObject: false } (wallet-level helper)