btc-parser module

6 views
Skip to first unread message

Sidney Zhang

unread,
Jan 14, 2014, 7:50:43 PM1/14/14
to Bitcoin...@googlegroups.com
I am thinking about creating a separate module that handles the parsing of all blockchain / network messages. And eventually also handle the writing of messages.

When I finish this, maybe then we can migrate btc-p2p and its parsing using the parser modules. I am envisioning it to return javascript objects.

Question: 

What would be more useful, for example if I parse a block, should the values be a buffer or should the values be I encode the buffers into hex strings.

{
   'block_hash': Buffer
}

{
   'block_hash': String
}

Brooks Boyd

unread,
Jan 14, 2014, 11:57:32 PM1/14/14
to Sidney Zhang, Bitcoin...@googlegroups.com
I think "parsing network messages" and "writing of messages" is what the btc-p2p module is aiming to do as well; it constructs the VERSION messages required as part of the initial handshake specific to Bitcoin network communication, and I've been just adding in parsing the txn/blocks to return javascript objects (or rather, emit events, with javascript objects as payloads).

Since hashes are binary data, I'd vote to store them in a Buffer. If you need it in hex form, call the "toString('hex')" method on the buffer.

Brooks


--
You received this message because you are subscribed to the Google Groups "Bitcoin Hackers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to BitcoinHacker...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sidney Zhang

unread,
Jan 15, 2014, 1:35:30 AM1/15/14
to Bitcoin...@googlegroups.com, Sidney Zhang
haha, man you have done everything. I was figuring out how to best contribute to this project. I thought btc-p2p did more just constructing messages but upon further inspections I guess that seemed to be right.
Reply all
Reply to author
Forward
0 new messages