btc-validation

4 views
Skip to first unread message

Sidney Zhang

unread,
Jan 31, 2014, 5:15:12 AM1/31/14
to Bitcoin...@googlegroups.com
Hi guys,

I wrote a small package for validation for fun. It is still under my github account because I expect extensive refactoring or even being merged into another cryptocoinjs package altogther.

code
https://github.com/sidazhang/btc-validation/blob/master/lib/validation.js

Brooks, I know we have spoken about this and you intended for this functionality to be within btc-blockchain. I wrote this small package to get most of the functionalities down first and then we can see how to merge it into btc-blockchain. There are a few areas where we need to make database or api calls. Alternatively, it might actually make sense for this to be a stand alone package which receives prevOuts etc as arguments . I will keep chipping away at this

Sidney Zhang

unread,
Jan 31, 2014, 5:42:00 AM1/31/14
to Bitcoin...@googlegroups.com

The following validations required data from storage

Reject if we already have matching tx in the pool, or in a block in the main branch
Reject if any other tx in the pool uses the same transaction output as one used by this tx
For each input, look in the main branch and the transaction pool to find the referenced output transaction. If the output transaction is missing for any input, this will be an orphan transaction. Add to the orphan transactions, if a matching transaction is not in there already
For each input, if the referenced output has already been spent by a transaction in the main branch, reject this transaction

However, all of these information could be provided up front, we can query for matching tx + prevOuts in one call and can get all of these information. So I think it is not unreasonable to make the query up front and pass it in as an argument
Reply all
Reply to author
Forward
0 new messages