Author

Topic: Recommended python library for beginners? (Read 188 times)

hero member
Activity: 518
Merit: 625
Pizza Maker 2023 | Bitcoinbeer.events
December 29, 2022, 02:41:16 PM
#9
Hi
Im new to Bitcoin development. Decided to work with Python as seems to have the largest ecosystem when it comes to Bitcoin. I am a bit confused about the various different Python Bitcoin libraries though. From my research, here are the main 4:

https://github.com/petertodd/python-bitcoinlib

https://github.com/jgarzik/python-bitcoinrpc

https://github.com/1200wd/bitcoinlib

https://github.com/ofek/bit

Do all of these do roughly the same thing? In general I would like a high level library, to do basic things like send transactions (as a way to learn Bitcoin development, I want to build a demo exchange). The `bit` library seems to be the most high level. What would people recommend?

Thanks




All of these libraries are Python libraries for working with Bitcoin, but they have different capabilities and focus on different aspects of Bitcoin development.

python-bitcoinlib is a comprehensive library for working with Bitcoin, providing support for parsing and serializing transactions and blocks, creating and signing transactions, and more. It also provides support for working with various network protocols, such as the Bitcoin P2P network and the Bitcoin JSON-RPC API.

python-bitcoinrpc is a library for accessing the Bitcoin JSON-RPC API, which allows you to interact with a Bitcoin daemon running on a local or remote host. It provides a high-level interface for querying and modifying the Bitcoin blockchain, as well as for managing the wallet.

bitcoinlib is another comprehensive Bitcoin library that provides support for parsing and serializing transactions and blocks, creating and signing transactions, and interacting with the Bitcoin P2P network and JSON-RPC API. It also includes support for working with testnets and regtest environments.

bit is a high-level Python library for working with Bitcoin. It provides a simple interface for creating, signing, and broadcasting transactions, as well as for querying the blockchain and managing addresses and wallets.

In general, if you're just starting out with Bitcoin development and want a high-level library for sending transactions and interacting with the blockchain, you might want to consider using bit. It provides a simple interface that is easy to use, and it should be sufficient for many basic Bitcoin development tasks. However, if you need more advanced functionality or want to work with lower-level details of the Bitcoin protocol, you might want to consider using one of the other libraries instead.
staff
Activity: 3500
Merit: 6152
December 27, 2022, 09:36:36 AM
#8
Someone just released[1][2] an open-source exchange (BTC <-> XMR), you may want to check it out[1]. It uses python-bitcoinrpc.

[1] https://github.com/jackmurray90/tradeapi
[2] https://bitcointalksearch.org/topic/fryx-finance-an-open-source-xmrbtc-exchange-5432028
member
Activity: 65
Merit: 27
December 27, 2022, 04:10:04 AM
#7
Thanks, going with bit.
You can refer to this topic if you're going to include all address types to your deposit options since native SegWit address (bc1) is not documented in the library or their dev guide page (dev guide):
  • bitcointalk.org/index.php?topic=5431352.msg61498631#msg61498631

Reading it will save you time later.

Thank you, good info.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
December 27, 2022, 12:41:25 AM
#6
Thanks, going with bit.
You can refer to this topic if you're going to include all address types to your deposit options since native SegWit address (bc1) is not documented in the library or their dev guide page (dev guide):
  • bitcointalk.org/index.php?topic=5431352.msg61498631#msg61498631

Reading it will save you time later.
member
Activity: 65
Merit: 27
December 26, 2022, 03:03:57 PM
#5
What would people recommend?

For quick experiment/testing, i would recommend bit since it's easy to use. I also use bit for short example. Although for more serious usage, python-bitcoinlib is better choice since it's more up-to-date and it's created by one of Bitcoin Core developer.

Thanks, going with bit.
member
Activity: 65
Merit: 27
December 25, 2022, 09:36:07 AM
#4
I would choose this one if you are only interested in signatures and transactions: https://pypi.org/project/bitcoin/

I don't think this is a good choice. The library's last release was in 2016, and it also has some disadvantages, especially for someone trying to build an exchange:

Code:
### Disadvantages:

Not a full node, has no idea what blocks are

Relies on centralized service (blockchain.info) for blockchain operations, although operations do have backups (eligius, blockr.io)

Yeah, not having a release since 2016 is why i steered clear of this one. It also looks quite low-level. I want something high level so i can have a high level understanding of bitcoin development quickly, and then moving onto a high level understanding of lightning development. Im am not interested in going too low-level.
staff
Activity: 3500
Merit: 6152
December 25, 2022, 09:10:46 AM
#3
I would choose this one if you are only interested in signatures and transactions: https://pypi.org/project/bitcoin/

I don't think this is a good choice. The library's last release was in 2016, and it also has some disadvantages, especially for someone trying to build an exchange:

Code:
### Disadvantages:

Not a full node, has no idea what blocks are

Relies on centralized service (blockchain.info) for blockchain operations, although operations do have backups (eligius, blockr.io)
jr. member
Activity: 84
Merit: 1
PandoraCash.com anonymous money
December 25, 2022, 08:55:42 AM
#2
I would choose this one if you are only interested in signatures and transactions: https://pypi.org/project/bitcoin/
member
Activity: 65
Merit: 27
December 25, 2022, 08:16:53 AM
#1
Hi
Im new to Bitcoin development. Decided to work with Python as seems to have the largest ecosystem when it comes to Bitcoin. I am a bit confused about the various different Python Bitcoin libraries though. From my research, here are the main 4:

https://github.com/petertodd/python-bitcoinlib

https://github.com/jgarzik/python-bitcoinrpc

https://github.com/1200wd/bitcoinlib

https://github.com/ofek/bit

Do all of these do roughly the same thing? In general I would like a high level library, to do basic things like send transactions (as a way to learn Bitcoin development, I want to build a demo exchange). The `bit` library seems to be the most high level. What would people recommend?

Thanks
Jump to: