Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Bitcoin in perl

by cavac (Chaplain)
on Sep 11, 2012 at 17:47 UTC ( #993025=note: print w/ replies, xml ) Need Help??


in reply to Bitcoin in perl

That's a very interesting project. I played with the idea of parsing all past bitcoin transactions into a PostgreSQL database to fool around with the dataset and test some theories.

I didn't have the time and energy to really find out how to parse the blocks and such. Could i parse all the transaction data with your modules?

Warning: completly reimplementing a complete bitcoin client in pure Perl isn't something i would recommend. While 99% of the port would make sense to me (hey, i wrote my own webserver in Perl...), i really recommend that you use existing cryptographic libraries whereever possible. Cryptography is very, very, very hard to get right and extremly easy to mess up. You may ask "kroeckx" from the Debian team who did a little patch for the Debian team, which has had a few unintended side effects.

You can find quite a few examples of why cryptography either works perfectly or not at all on the net. For example, the yearly Chaos Communications Congress has quite a few examples including this one which also explains a few things about bitcoin.

"I know what i'm doing! Look, what could possibly go wrong? All i have to pull this lever like so, and then press this button here like ArghhhhhaaAaAAAaaagraaaAAaa!!!"


Comment on Re: Bitcoin in perl
Re^2: Bitcoin in perl
by grondilu (Pilgrim) on Sep 11, 2012 at 20:18 UTC

    Yes, normally you should be able to parse the transaction data. It has only been tested with a few blocks but normally everything can be red. It even recognises transaction scripts and tries to decompile them. For instance, it will see if the embedded data is pure ASCII text. That's how for instance the times headline can be explicitely seen when you read the genesis block.

    So, assuming your transaction is in the binary string $tx, the following code should work, but you'll have to convert it into Bitcoin::DataStream first (I haven't made that automatic)

    use Bitcoin::Transaction; use YAML; my $stream = new Bitcoin::DataStream $tx; say +Dump Bitcoin::Transaction->new($stream);

    I did use cryptographic libraries for digests, but I've found no perl library for ECDSA, and I've found using C libraries with XS or something much too complicated for me.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993025]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-09-19 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (149 votes), past polls