Get UTXOs
The getUtxos method retrieves the Unspent Transaction Outputs (UTXOs) for one or more MNEE addresses. UTXOs represent the spendable MNEE tokens associated with an address and are essential for constructing new transactions.
Usage
Basic Usage
const address = '1G6CB3Ch4zFkPmuhZzEyChQmrQPfi86qk3';
// Returns up to 10 UTXOs by default
const utxos = await mnee.getUtxos(address);
console.log('UTXOs:', utxos);For convenience, you can also call getEnoughUtxos() or getAllUtxos()
With Pagination
const address = '1G6CB3Ch4zFkPmuhZzEyChQmrQPfi86qk3';
// Get first page with 20 UTXOs
const page1 = await mnee.getUtxos(address, 0, 20);
console.log('First 20 UTXOs:', page1);
// Get second page
const page2 = await mnee.getUtxos(address, 1, 20);
console.log('Next 20 UTXOs:', page2);
// Get UTXOs in ascending order (oldest first)
const ascUtxos = await mnee.getUtxos(address, 0, 50, 'asc');
console.log('Oldest UTXOs first:', ascUtxos);Multiple Addresses
Parameters
address: Single Bitcoin address or array of addresses
page (optional): Page number starting from 0
size (optional): Number of UTXOs per page (default: 10)
order (optional): Sort order - 'asc' for oldest first, 'desc' for newest first (default: 'desc')
Response
The method returns a Promise that resolves to an array of MNEEUtxo objects. Each UTXO contains detailed information about the MNEE tokens, including BSV21 protocol data and cosigner information.
Sample Response
UTXO Properties
Main Properties
outpoint: The full UTXO identifier in format
txid:voutheight: The block height when this UTXO was created
idx: The output index within the transaction
owners: Array of addresses that can spend this UTXO
satoshis: The BSV satoshis in this output (not MNEE amount)
score: A sortable score based on height and index
BSV21 Data (data.bsv21)
data.bsv21)amt: The amount of MNEE tokens in atomic units (100,000 = 1 MNEE)
dec: Number of decimal places (5 for MNEE)
icon: The icon address for the token
id: The token ID
op: The operation type (typically "transfer")
sym: The token symbol ("MNEE")
Cosigner Data (data.cosign)
data.cosign)address: The cosigner address for this UTXO
cosigner: The cosigner public key
Common Use Cases
Calculate Total Spendable Balance
Get All UTXOs with Pagination
Find UTXOs Above a Certain Amount
Prepare UTXOs for Multi-Source Transfer
Filter UTXOs by Operation Type
Performance Considerations
The API returns only 10 UTXOs by default - specify a larger
sizeparameter if you need moreFor addresses with many UTXOs, use pagination to retrieve all of them:
Important Notes
Default limit is 10 UTXOs - Always specify the
sizeparameter if you need moreIf an address has more UTXOs than your page size, use pagination to retrieve all of them
For just checking balance, use the
balance()method which is more efficientUTXOs are sorted by score (based on height and index) in descending order by default
See Also
Balance - Get balance without UTXO details (more efficient for balance checks)
Transfer Multi - Use UTXOs for multi-source transfers
Get Enough UTXOs - Get just enough UTXOs for and address and amount
Get All UTXOs - Get all UTXOs for a given address
Last updated