New API Endpoint: List xPub, yPub, zPub UTXOs

New API Endpoint: List xPub, yPub, zPub UTXOs

Blockchain xPub yPub zPub Announcements

Crypto APIs Team

Feb 3, 2022 • 2 min

Crypto APIs has just launched a new informative API for working with HD Wallets (xPub, yPub, zPub)

The List HD Wallet UTXOs (Unspent Transaction Outputs) endpoint is part of Blockchain Data and gives developers quick and easy access to HD Wallet data by providing the extended public key of the already synced HD Wallet.

The results returned by the API endpoint can include the public address, the UTXO amount value, whether the UTXO has been used from another unconfirmed transaction, whether the transaction is confirmed or unconfirmed, and the transaction ID.

The update is an expansion to our existing HD Wallet API endpoints which include:

  • Sync HD Wallet (xPub, yPub, zPub): To get HD wallet details or transactions it must first be synced. In addition to the initial sync, we perform consistent updates to the synced HD wallets.
  • Get HD Wallet (xPub, yPub, zPub) Details: This useful endpoint gives you the most important data without the need for endless calculations. Once the HD Wallet is synced using the above endpoint, we keep it up-to-date and calculate the details in advance.
  • List HD Wallet (xPub, yPub, zPub) Transactions: This endpoint will list HD Wallet transactions with details such as the hash and the height of the block when the transaction was initially mined, the timestamp, and recipient and sender address(es) with the respective amounts. 

Why HD Wallet API Endpoints are Essential

By design Hierarchical Deterministic Wallets (HD Wallets) have a lot of addresses and transactions, meaning that pulling the data on demand is a heavy operation. 

Add into the equation transactions on a UTXO based blockchain such as Bitcoin, Doge, or Dash, and things get even more complicated. 

The reason for this is the fact that a UTXO based ledger has no account/wallet at the protocol level. Instead, transactions are composed of a series of inputs and outputs, and the coins are stored as a list of unspent transaction outputs (a.k.a UTXOs).

How UTXOs Work

The easiest way to explain how the UTXO system works is to think of cash bills. They can’t be divided and each value has to be consumed as a whole.

For example, let’s say you have a $10, $20, and a $50 bill. 

Purchase Scenario #1
You want to purchase an item that costs $10. 
You use the $10 bill. 
One transaction input of the $10 bill. 
One transaction output (recipient gets a $10 bill).

Purchase Scenario #2
The item costs $30
You use the $10 and the $20.
Multiple inputs.
One output - the recipient gets $30.

Purchase Scenario #3
The item costs $55
You pay using the $10 and the $50 which totals $60. 
The recipient takes $55 and gives you $5 back.
Multiple inputs ($10 & $50) and multiple outputs ($55 and $5).

The bills you spend and receive back (outputs) will be used to make future payments, at which point they will become inputs. Until then, they are unspent, ie. Unspent Transaction Outputs (UTXO).

In order to calculate how much cryptocurrency you own, you will need to keep track of all the UTXOs for every single transaction. Crypto APIs HD Wallet API endpoints make that process much less labor-intensive and more cost-effective. 

Related articles