Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Bitcoin in perl

by cavac (Deacon)
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!!!"

Replies are listed 'Best First'.
Re^2: Bitcoin in perl
by grondilu (Friar) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993025]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2018-04-24 05:56 GMT
Find Nodes?
    Voting Booth?