I want to avoid physically importing addresses into a wallet. I want to write a UTXO indexing system on a per-address basis.
I often wonder how a wallet can keep track of all of its addresses' UTXOs, seeing as transaction outputs can become spent and are therefore no longer spendable.
My concept, as it stands, is to record every vout
, of an incoming transaction, against its corresponding address.
So now we have a database of addresses, each with a relation to some txId
and vout
index that holds the address.
From there, gettxout can be used on each of an address's transactions corresponding to its vout
index.
If gettxout
responds empty the address's vout
has been spent, so is not deemed spendable and does not contribute to calculating the address's balance.
If gettxout
responds with a result, the address's vout
remains unspent, so is spendable and contributes to the address's balance.
This would obviously only work for addresses where this indexing approach has been implemented. Is this a good idea?
TLDR; how would one go about building a custom index, on top of a Bitcoin node, to track UTXOs, belonging to addresses, given that any vout
can become spent?
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments