Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide python bindings #5

Open
vpereira opened this issue May 30, 2016 · 6 comments
Open

Provide python bindings #5

vpereira opened this issue May 30, 2016 · 6 comments

Comments

@vpereira
Copy link

vpereira commented May 30, 2016

Hi, since the python-blkmaker is outdated (and it looks unmaintained), wouldn't be a good idea to add python bindings to the libblkmaker?

@luke-jr
Copy link
Member

luke-jr commented May 30, 2016

I've been pondering this for a week or so, actually, but I'm not sure if C code with Python bindings is sufficiently usable in Python code, or if python-blkmaker should be updated. Nor do I have any experience with writing Python bindings that get installed properly. (Is this something perhaps you could contribute?)

@vpereira
Copy link
Author

vpereira commented May 30, 2016

I was looking into that right now... Normally You don't have to write python at all (http://intermediate-and-advanced-software-carpentry.readthedocs.io/en/latest/c++-wrapping.html) I wrote in the past some FFI classes and ctype interfaces to access C code from python code.. Let's see what I can do with Pyrex..

Or maybe I can help updating the python-blkmaker.. what do you prefer?

BTW, this python "miner" getblocktemplate implementation looks good and works even with testnet (all tested with bitcoind 0.12.1) https://github.com/vsergeev/ntgbtminer/blob/master/ntgbtminer.py

@luke-jr
Copy link
Member

luke-jr commented May 30, 2016

IMO in an ideal world, there would be a pure-Python python-blkmaker and also libblkmaker Python bindings that are interchangeable, but that may take too much time to maintain.

The main advantage of python-blkmaker is that users/developers don't need to compile a C library. The main advantage of bindings would be a more common codebase.

Gentoo downstream tells me the preferred way to do bindings would be a separate repo for the bindings themselves, using distutils/setuptools for their install.

Updating python-blkmaker at this point would require porting:

  • a221293 Refactor construction of block submissions to allow for results from get_mdata
  • e3465d3 Refactor blkmk_assemble_submission2_ to work with either extranonce/mdata or dataid/data
  • 58aa6a3 Refactor to eliminate blkmk_assemble_submission_ wrapper
  • 7bf7e80 Bugfix: Expose blkmk_submitm_jansson for submitting results for blkmk_get_mdata
  • c94e438 Bugfix: Always avoid data/mdata size conflict in blkmk_append_coinbase_safe2 since nothing else checks merkle_only (nor has it available to check)

I've pushed a more recently updated python-blkmaker to https://github.com/luke-jr/python-blkmaker for now.

@luke-jr
Copy link
Member

luke-jr commented May 30, 2016

There, finished updating python-blkmaker...

@luke-jr luke-jr changed the title provide python binds Provide python bindings May 30, 2016
@vpereira
Copy link
Author

great! One advantage to have the Python wrapper is to use it to unit test the whole lib. Unit test in python is way easier than in C.

@luke-jr
Copy link
Member

luke-jr commented May 30, 2016

Yes, I'd still welcome Python bindings for that reason. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants