LearnBitcoin

Bitcoin Dev Archive 2014

python-bitcoinlib v0.1 release - a low-level Python2/3 interface to the Bitcoin protocol

8 messages, 15 Mar 2014. Started by Peter Todd.

Peter Todd (3), Jeff Garzik (3), Drak (2)

Permalink Original thread on gnusha.org

Peter Todd permalink original

I noticed that the ngccbase Colored Coin client(1) added a python-bitcoinlib dependency, specifically my fork. In addition there is also now a rudementary python-bitcoinlib package in archlinux.

So with that in mind I'm releasing v0.1, perhaps somewhat arbitrarily:

    https://github.com/petertodd/python-bitcoinlib/tree/v0.1

This Python2/3 library provides an easy interface to the bitcoin data structures and protocol. The approach is low-level and "ground up", with a focus on providing tools to manipulate the internals of how Bitcoin works in a Pythonic way, without straying far from the Bitcoin Core implementation.

The current status of the library as of v0.1 is that the support for data-structures related to transactions, scripting, addresses, and keys are all quite usable and the API is probably not going to change that much. Bitcoin Core RPC support is included and automatically converts the JSON to/from Python objects when appropriate. EvalScript(), VerifyScript(), and SignatureHash() are all functional and pass all the Bitcoin Core unittests, as well as a few that are still yet to be merged.(2) You'll find some examples for signing pay2script-hash and p2sh txouts in the examples/ directory; I personally used the transaction signing functionality to make up a set of unittests related to OP_CODESEPARATOR and FindAndDelete() recently. Finally my dust-b-gone script(3) is another good example, specifically of the RPC functionality.

I personally haven't had any need for the p2p network related code for some time, so I'm sure it's not in a good state and it lacks unittests; Bloom filters for one are missing the merkle-block support to actually make them useful. But the RPC support makes up for that for many uses.

This release and others in the future are signed by my PGP key, as well as every publicly pushed commit. You can verify the key via WoT, my bitcointalk account, signing history in the Bitcoin Core repo, and mailing list records among other sources.

Disclaimer: This is alpha code in a language not known for type-safety.
            I wouldn't personally use python-bitcoinlib for anything
            other than experiments and neither should you.
1) https://github.com/bitcoinx/ngcccbase
2) https://github.com/bitcoin/bitcoin/pull/3861
3) https://github.com/petertodd/dust-b-gone

- -- 'peter'[:-1]@petertodd.org 000000000000000097649e8d66395b3cb4527263409adf628c76cc56af0434fe

Peter Todd in reply to Peter Todd permalink original

On Sat, Mar 15, 2014 at 09:43:40AM -0400, Peter Todd wrote:

Quoted text (6 lines)
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> I noticed that the ngccbase Colored Coin client(1) added a
> python-bitcoinlib dependency, specifically my fork. In addition there is
> also now a rudementary python-bitcoinlib package in archlinux.

Also, for those who don't know the history of python-bitcoinlib, credit where credit is due: my fork is based on Jeff Garzik's implementation(1) and the bulk of the code structure is his work, modulo "pythonizing" that I have done.

1) https://github.com/jgarzik/python-bitcoinlib
Jeff Garzik in reply to Peter Todd permalink original

Thanks -- though credit is really due to ArtForz, who kicked off this project with his half-a-node: http://pastebin.com/ZSM7iHZw

On Sat, Mar 15, 2014 at 10:34 AM, Peter Todd <pete@petertodd•org> wrote:

Quoted text (18 lines)
> On Sat, Mar 15, 2014 at 09:43:40AM -0400, Peter Todd wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> I noticed that the ngccbase Colored Coin client(1) added a
>> python-bitcoinlib dependency, specifically my fork. In addition there is
>> also now a rudementary python-bitcoinlib package in archlinux.
>
> Also, for those who don't know the history of python-bitcoinlib, credit
> where credit is due: my fork is based on Jeff Garzik's implementation(1)
> and the bulk of the code structure is his work, modulo "pythonizing"
> that I have done.
>
> 1) https://github.com/jgarzik/python-bitcoinlib
>
> --
> 'peter'[:-1]@petertodd.org
> 000000000000000090aa23d86521312897686912946b38e93a71a98a8c287d4a
Jeff Garzik in reply to Peter Todd permalink original

Sounds great. I'm glad to see this with a more active maintainer. Maintaining -three- client libs was a bit much for me.

On Sat, Mar 15, 2014 at 9:43 AM, Peter Todd <pete@petertodd•org> wrote:

Quoted text (66 lines)
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> I noticed that the ngccbase Colored Coin client(1) added a
> python-bitcoinlib dependency, specifically my fork. In addition there is
> also now a rudementary python-bitcoinlib package in archlinux.
>
> So with that in mind I'm releasing v0.1, perhaps somewhat arbitrarily:
>
>     https://github.com/petertodd/python-bitcoinlib/tree/v0.1
>
> This Python2/3 library provides an easy interface to the bitcoin data
> structures and protocol. The approach is low-level and "ground up", with
> a focus on providing tools to manipulate the internals of how Bitcoin
> works in a Pythonic way, without straying far from the Bitcoin Core
> implementation.
>
> The current status of the library as of v0.1 is that the support for
> data-structures related to transactions, scripting, addresses, and keys
> are all quite usable and the API is probably not going to change that
> much. Bitcoin Core RPC support is included and automatically converts
> the JSON to/from Python objects when appropriate.  EvalScript(),
> VerifyScript(), and SignatureHash() are all functional and pass all the
> Bitcoin Core unittests, as well as a few that are still yet to be
> merged.(2) You'll find some examples for signing pay2script-hash and
> p2sh txouts in the examples/ directory; I personally used the
> transaction signing functionality to make up a set of unittests related
> to OP_CODESEPARATOR and FindAndDelete() recently. Finally my dust-b-gone
> script(3) is another good example, specifically of the RPC
> functionality.
>
> I personally haven't had any need for the p2p network related code for
> some time, so I'm sure it's not in a good state and it lacks unittests;
> Bloom filters for one are missing the merkle-block support to actually
> make them useful. But the RPC support makes up for that for many uses.
>
> This release and others in the future are signed by my PGP key, as well
> as every publicly pushed commit. You can verify the key via WoT, my
> bitcointalk account, signing history in the Bitcoin Core repo, and
> mailing list records among other sources.
>
> Disclaimer: This is alpha code in a language not known for type-safety.
>             I wouldn't personally use python-bitcoinlib for anything
>             other than experiments and neither should you.
>
> 1) https://github.com/bitcoinx/ngcccbase
> 2) https://github.com/bitcoin/bitcoin/pull/3861
> 3) https://github.com/petertodd/dust-b-gone
>
> - --
> 'peter'[:-1]@petertodd.org
> 000000000000000097649e8d66395b3cb4527263409adf628c76cc56af0434fe
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.14 (GNU/Linux)
>
> iQGrBAEBCACVBQJTJFkFXhSAAAAAABUAQGJsb2NraGFzaEBiaXRjb2luLm9yZzAw
> MDAwMDAwMDAwMDAwMDA3OGEyNGUxNTBlNTc2ZGVjZWUyYWQzMGNhMmE2YTRhMmM3
> NGVkYmJkNjM2NDViNjcvFIAAAAAAFQARcGthLWFkZHJlc3NAZ251cGcub3JncGV0
> ZUBwZXRlcnRvZC5vcmcACgkQJIFAPaXwkftZiwgAk8YVN9t76tKIKcWKyrGgv8yk
> UZGZkkrowED0lyhMXfmviezeWhjvHZgQrwha2hAuik36WEBN1jnv9wuJ6g9tnxGY
> PyG8n1SV2rtQ/QIJyL6wOuqL3UZi6d6IdZ/udVmyGwz+XhE89AwitR0++MvxkPNv
> i9R3Gw5Z1CnS2W0jGpAT88k3q3pqEzbYutP/FaylL2+6MuSUGwHUoY8dqcRkwkw1
> eIrd2W33x4NvuxYPLnHR64uE0B8KoreZOyyskMdeMsKtZNflkfgfMiD10xnw2PGx
> z8S42wPbrI5ZYLL1OLdRfuKMdQ4qOyF4jfV+QRZWQ5t5Qh1akVWmz7ffFHGo0Q==
> =k1pi
> -----END PGP SIGNATURE-----
Drak in reply to Jeff Garzik permalink original

Would it make sense to pull that stuff in and add Peter with commit access since your repo is top of the fork tree.

Drak

On 15 March 2014 16:47, Jeff Garzik <jgarzik@bitpay•com> wrote:

Quoted text (90 lines)
> Sounds great.  I'm glad to see this with a more active maintainer.
> Maintaining -three- client libs was a bit much for me.
>
> On Sat, Mar 15, 2014 at 9:43 AM, Peter Todd <pete@petertodd•org> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > I noticed that the ngccbase Colored Coin client(1) added a
> > python-bitcoinlib dependency, specifically my fork. In addition there is
> > also now a rudementary python-bitcoinlib package in archlinux.
> >
> > So with that in mind I'm releasing v0.1, perhaps somewhat arbitrarily:
> >
> >     https://github.com/petertodd/python-bitcoinlib/tree/v0.1
> >
> > This Python2/3 library provides an easy interface to the bitcoin data
> > structures and protocol. The approach is low-level and "ground up", with
> > a focus on providing tools to manipulate the internals of how Bitcoin
> > works in a Pythonic way, without straying far from the Bitcoin Core
> > implementation.
> >
> > The current status of the library as of v0.1 is that the support for
> > data-structures related to transactions, scripting, addresses, and keys
> > are all quite usable and the API is probably not going to change that
> > much. Bitcoin Core RPC support is included and automatically converts
> > the JSON to/from Python objects when appropriate.  EvalScript(),
> > VerifyScript(), and SignatureHash() are all functional and pass all the
> > Bitcoin Core unittests, as well as a few that are still yet to be
> > merged.(2) You'll find some examples for signing pay2script-hash and
> > p2sh txouts in the examples/ directory; I personally used the
> > transaction signing functionality to make up a set of unittests related
> > to OP_CODESEPARATOR and FindAndDelete() recently. Finally my dust-b-gone
> > script(3) is another good example, specifically of the RPC
> > functionality.
> >
> > I personally haven't had any need for the p2p network related code for
> > some time, so I'm sure it's not in a good state and it lacks unittests;
> > Bloom filters for one are missing the merkle-block support to actually
> > make them useful. But the RPC support makes up for that for many uses.
> >
> > This release and others in the future are signed by my PGP key, as well
> > as every publicly pushed commit. You can verify the key via WoT, my
> > bitcointalk account, signing history in the Bitcoin Core repo, and
> > mailing list records among other sources.
> >
> > Disclaimer: This is alpha code in a language not known for type-safety.
> >             I wouldn't personally use python-bitcoinlib for anything
> >             other than experiments and neither should you.
> >
> > 1) https://github.com/bitcoinx/ngcccbase
> > 2) https://github.com/bitcoin/bitcoin/pull/3861
> > 3) https://github.com/petertodd/dust-b-gone
> >
> > - --
> > 'peter'[:-1]@petertodd.org
> > 000000000000000097649e8d66395b3cb4527263409adf628c76cc56af0434fe
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.14 (GNU/Linux)
> >
> > iQGrBAEBCACVBQJTJFkFXhSAAAAAABUAQGJsb2NraGFzaEBiaXRjb2luLm9yZzAw
> > MDAwMDAwMDAwMDAwMDA3OGEyNGUxNTBlNTc2ZGVjZWUyYWQzMGNhMmE2YTRhMmM3
> > NGVkYmJkNjM2NDViNjcvFIAAAAAAFQARcGthLWFkZHJlc3NAZ251cGcub3JncGV0
> > ZUBwZXRlcnRvZC5vcmcACgkQJIFAPaXwkftZiwgAk8YVN9t76tKIKcWKyrGgv8yk
> > UZGZkkrowED0lyhMXfmviezeWhjvHZgQrwha2hAuik36WEBN1jnv9wuJ6g9tnxGY
> > PyG8n1SV2rtQ/QIJyL6wOuqL3UZi6d6IdZ/udVmyGwz+XhE89AwitR0++MvxkPNv
> > i9R3Gw5Z1CnS2W0jGpAT88k3q3pqEzbYutP/FaylL2+6MuSUGwHUoY8dqcRkwkw1
> > eIrd2W33x4NvuxYPLnHR64uE0B8KoreZOyyskMdeMsKtZNflkfgfMiD10xnw2PGx
> > z8S42wPbrI5ZYLL1OLdRfuKMdQ4qOyF4jfV+QRZWQ5t5Qh1akVWmz7ffFHGo0Q==
> > =k1pi
> > -----END PGP SIGNATURE-----
>
>
>
> --
> Jeff Garzik
> Bitcoin core developer and open source evangelist
> BitPay, Inc.      https://bitpay.com/
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
Jeff Garzik in reply to Drak permalink original

I am happy to do whatever makes the new maintainer and users most happy. That includes giving the new maintainer commit privs in my repo.

On Sat, Mar 15, 2014 at 1:12 PM, Drak <drak@zikula•org> wrote:

Quoted text (99 lines)
> Would it make sense to pull that stuff in and add Peter with commit access
> since your repo is top of the fork tree.
>
> Drak
>
>
> On 15 March 2014 16:47, Jeff Garzik <jgarzik@bitpay•com> wrote:
>>
>> Sounds great.  I'm glad to see this with a more active maintainer.
>> Maintaining -three- client libs was a bit much for me.
>>
>> On Sat, Mar 15, 2014 at 9:43 AM, Peter Todd <pete@petertodd•org> wrote:
>> > -----BEGIN PGP SIGNED MESSAGE-----
>> > Hash: SHA256
>> >
>> > I noticed that the ngccbase Colored Coin client(1) added a
>> > python-bitcoinlib dependency, specifically my fork. In addition there is
>> > also now a rudementary python-bitcoinlib package in archlinux.
>> >
>> > So with that in mind I'm releasing v0.1, perhaps somewhat arbitrarily:
>> >
>> >     https://github.com/petertodd/python-bitcoinlib/tree/v0.1
>> >
>> > This Python2/3 library provides an easy interface to the bitcoin data
>> > structures and protocol. The approach is low-level and "ground up", with
>> > a focus on providing tools to manipulate the internals of how Bitcoin
>> > works in a Pythonic way, without straying far from the Bitcoin Core
>> > implementation.
>> >
>> > The current status of the library as of v0.1 is that the support for
>> > data-structures related to transactions, scripting, addresses, and keys
>> > are all quite usable and the API is probably not going to change that
>> > much. Bitcoin Core RPC support is included and automatically converts
>> > the JSON to/from Python objects when appropriate.  EvalScript(),
>> > VerifyScript(), and SignatureHash() are all functional and pass all the
>> > Bitcoin Core unittests, as well as a few that are still yet to be
>> > merged.(2) You'll find some examples for signing pay2script-hash and
>> > p2sh txouts in the examples/ directory; I personally used the
>> > transaction signing functionality to make up a set of unittests related
>> > to OP_CODESEPARATOR and FindAndDelete() recently. Finally my dust-b-gone
>> > script(3) is another good example, specifically of the RPC
>> > functionality.
>> >
>> > I personally haven't had any need for the p2p network related code for
>> > some time, so I'm sure it's not in a good state and it lacks unittests;
>> > Bloom filters for one are missing the merkle-block support to actually
>> > make them useful. But the RPC support makes up for that for many uses.
>> >
>> > This release and others in the future are signed by my PGP key, as well
>> > as every publicly pushed commit. You can verify the key via WoT, my
>> > bitcointalk account, signing history in the Bitcoin Core repo, and
>> > mailing list records among other sources.
>> >
>> > Disclaimer: This is alpha code in a language not known for type-safety.
>> >             I wouldn't personally use python-bitcoinlib for anything
>> >             other than experiments and neither should you.
>> >
>> > 1) https://github.com/bitcoinx/ngcccbase
>> > 2) https://github.com/bitcoin/bitcoin/pull/3861
>> > 3) https://github.com/petertodd/dust-b-gone
>> >
>> > - --
>> > 'peter'[:-1]@petertodd.org
>> > 000000000000000097649e8d66395b3cb4527263409adf628c76cc56af0434fe
>> > -----BEGIN PGP SIGNATURE-----
>> > Version: GnuPG v1.4.14 (GNU/Linux)
>> >
>> > iQGrBAEBCACVBQJTJFkFXhSAAAAAABUAQGJsb2NraGFzaEBiaXRjb2luLm9yZzAw
>> > MDAwMDAwMDAwMDAwMDA3OGEyNGUxNTBlNTc2ZGVjZWUyYWQzMGNhMmE2YTRhMmM3
>> > NGVkYmJkNjM2NDViNjcvFIAAAAAAFQARcGthLWFkZHJlc3NAZ251cGcub3JncGV0
>> > ZUBwZXRlcnRvZC5vcmcACgkQJIFAPaXwkftZiwgAk8YVN9t76tKIKcWKyrGgv8yk
>> > UZGZkkrowED0lyhMXfmviezeWhjvHZgQrwha2hAuik36WEBN1jnv9wuJ6g9tnxGY
>> > PyG8n1SV2rtQ/QIJyL6wOuqL3UZi6d6IdZ/udVmyGwz+XhE89AwitR0++MvxkPNv
>> > i9R3Gw5Z1CnS2W0jGpAT88k3q3pqEzbYutP/FaylL2+6MuSUGwHUoY8dqcRkwkw1
>> > eIrd2W33x4NvuxYPLnHR64uE0B8KoreZOyyskMdeMsKtZNflkfgfMiD10xnw2PGx
>> > z8S42wPbrI5ZYLL1OLdRfuKMdQ4qOyF4jfV+QRZWQ5t5Qh1akVWmz7ffFHGo0Q==
>> > =k1pi
>> > -----END PGP SIGNATURE-----
>>
>>
>>
>> --
>> Jeff Garzik
>> Bitcoin core developer and open source evangelist
>> BitPay, Inc.      https://bitpay.com/
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/13534_NeoTech
>> _______________________________________________
>> Bitcoin-development mailing list
>> Bitcoin-development@lists•sourceforge•net
>> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
Peter Todd in reply to Drak permalink original

On Sat, Mar 15, 2014 at 05:12:42PM +0000, Drak wrote:

Quoted text (2 lines)
> Would it make sense to pull that stuff in and add Peter with commit access
> since your repo is top of the fork tree.

I've noticed it looks like people actually using my 'pythonize' code have been linking directly to my tree in things like documentation and build scripts, so the URL is probably not a problem.

I did open a pull-req on the bitcoin.org repo to change that URL however: https://github.com/bitcoin/bitcoin.org/pull/346

Drak in reply to Peter Todd permalink original

Yes. I think the problem is your fork has been under more development and upstream has stalled. The problem with this is it becomes unclear which repo is the main one as it really has become a fork and of course then development really does fork properly which is a shame because it doesn't nurture community contributions around the project which is really important.

Drak

On 15 March 2014 17:22, Peter Todd <pete@petertodd•org> wrote:

Quoted text (16 lines)
> On Sat, Mar 15, 2014 at 05:12:42PM +0000, Drak wrote:
> > Would it make sense to pull that stuff in and add Peter with commit
> access
> > since your repo is top of the fork tree.
>
> I've noticed it looks like people actually using my 'pythonize' code
> have been linking directly to my tree in things like documentation and
> build scripts, so the URL is probably not a problem.
>
> I did open a pull-req on the bitcoin.org repo to change that URL
> however: https://github.com/bitcoin/bitcoin.org/pull/346
>
> --
> 'peter'[:-1]@petertodd.org
> 0000000000000000ef4a047ecc7077b7855626b9c9bf07e528e0c6ace2da30a8
>