Title: Replicate listunspent for multi-sig outputs Post by: monsterer on November 10, 2013, 01:20:51 PM Hi guys,
Can you confirm if this method is valid to replicate the functionality of bitcoind's listunspent command (use case is multi-sig address outputs): Assumption: unspent outputs are transaction outputs which do not appear as transaction inputs. * getblock { iterate through all txs { * getrawtransaction { add each output to a set (index txid + N) named txouts add each input to a set (index txid + vout) named txins } } } iterate through all txouts { if txout is not in set txins, add to new set unspent } unspent should be the set of all unspent outputs? Cheers, Paul. Title: Re: Replicate listunspent for multi-sig outputs Post by: monsterer on November 12, 2013, 01:34:45 PM anyone?
Title: Re: Replicate listunspent for multi-sig outputs Post by: dudeami on November 12, 2013, 01:57:01 PM If you go through the whole blockchain and record every transaction as you plan, you'll probably run into some sort of memory issue. You do have the right approach, though something like this would save you some memory (using JS in a psuedocode kinda way :p):
Code: var utxos = {}; // Make an object/list So basically, you are only storing the transactions that are unspent. Note this approach may be inaccurate due to doublespends and the like. Title: Re: Replicate listunspent for multi-sig outputs Post by: monsterer on November 15, 2013, 10:38:21 AM Thanks, I appreciate your reply :)
|