Bitcoin Forum

Bitcoin => Wallet software => Topic started by: Sam Rushing on July 08, 2011, 08:38:19 PM



Title: Caesure - a Python Bitcoin Client
Post by: Sam Rushing on July 08, 2011, 08:38:19 PM
I've started a new bitcoin client in Python.

https://github.com/samrushing/caesure

-Sam


Title: Re: Caesure - a Python Bitcoin Client
Post by: wumpus on July 08, 2011, 09:10:19 PM
Great, I'll certainly be following this. A native Python client is nice, as it means not having to compile the bitcoin c++ client on a VPS, and it will be easier to integrate with Python (web) applications :)


Title: Re: Caesure - a Python Bitcoin Client
Post by: Sam Rushing on July 08, 2011, 10:10:11 PM
Yup, one of my goals is to cut down on outside dependencies as much as possible - especially packages that require compiling C extensions.  Right now it runs completely standalone, all that's needed is a Python install and a shared openssl library.  The networking is done via the asyncore/asynchat modules, and openssl is accessed via ctypes.


Title: Re: Caesure - a Python Bitcoin Client
Post by: zwierzak on July 09, 2011, 01:28:17 AM
So with this in future I can replace bitcoind+JSON or this is just API for bitcoind?


Title: Re: Caesure - a Python Bitcoin Client
Post by: Martin P. Hellwig on July 09, 2011, 02:21:49 AM
So with this in future I can replace bitcoind+JSON or this is just API for bitcoind?

As far as I can read the code (I am sure that Sam will refactor the code ones he is happy with the functionality, so it is easier to read/maintain/extend for mere mortals  ;) ), this is aimed to be a full implementation of the reference c++ bitcoin implementation.

So in other words, where you used to run the bitcoin client downloaded from bitcoin.org, you can alternatively use his python one instead.

Good to see I am not the only one working on a Python implementation, a little bit of competition is a good thing :-)

Cheers Sam, good work!


Title: Re: Caesure - a Python Bitcoin Client
Post by: wumpus on July 09, 2011, 08:29:56 AM
So with this in future I can replace bitcoind+JSON or this is just API for bitcoind?
The goal is to replace a full client, there are tons of JSON-API bindings for Python already :)


Title: Re: Caesure - a Python Bitcoin Client
Post by: zwierzak on July 09, 2011, 11:19:08 PM
Maybe your https setup is broken ?
I end up with this msg :

sh-4.1# git clone https://github.com/samrushing/caesure
Initialized empty Git repository in /opt/caesure/.git/
error:  while accessing https://github.com/samrushing/caesure/info/refs

"git clone" works well for me with http:// though )
Report to github, not us. We can't do anything with this.


Title: Re: Caesure - a Python Bitcoin Client
Post by: Sam Rushing on July 10, 2011, 11:12:29 PM
To Sam Rushing :

Maybe your https setup is broken ?
I end up with this msg :

sh-4.1# git clone https://github.com/samrushing/caesure
Initialized empty Git repository in /opt/caesure/.git/
error:  while accessing https://github.com/samrushing/caesure/info/refs

"git clone" works well for me with http:// though )

Just try:
   $ git clone git://github.com/samrushing/caesure.git
 


Title: Re: Caesure - a Python Bitcoin Client
Post by: mikegogulski on July 12, 2011, 11:34:33 AM
Bump for sheer awesome sauce, and because Sam used to buy beer for me when I was still underage.


Title: Re: Caesure - a Python Bitcoin Client
Post by: alkor on July 12, 2011, 10:28:15 PM
There was also this effort to create an alternative bitcoin client in python, but it was never completed:

https://github.com/phantomcircuit/bitcoin-alt

I think the hard part was to do the scripting.


Title: Re: Caesure - a Python Bitcoin Client
Post by: Lis on July 14, 2011, 07:32:29 AM
please correct:
file bitcoin.py
line 90
s = ('%x' % base58_decode (s[1:])).decode ('hex_codec')  =>  s = ('%048x' % base58_decode (s[1:])).decode ('hex')

if hash160 has zero on the left side then function has problem

===
good job, thanks


Title: Re: Caesure - a Python Bitcoin Client
Post by: Sam Rushing on July 15, 2011, 12:50:25 AM
please correct:

if hash160 have zero at the start, function is having problems

Thanks, Fremen Lis.  It's on the way in.

-Sam


Title: Re: Caesure - a Python Bitcoin Client
Post by: etotheipi on September 15, 2011, 12:04:22 AM
I have my own python library I started building from Sam's code a few months ago.  I have all calculations implemented (including scripting!) but not networking.  Perhaps we should team up.  Though I suspect you (Sam) may not like the fact I replaced all your BTC classes with my own:  I did it for the fun of implementing the stuff myself in my own way, and learned a LOT.  I know from my job that the best way to understand a system is to try implementing it yourself--and holy hell I've learned a lot from this process...

This library does all scripting except for a few OP_codes, but it does do OP_CHECKSIG, meaning that the library can successfully verify and sign transactions (https://bitcointalk.org/index.php?topic=29416.0) (using Lis' raw ECDSA-in-python module).  I wanted to get some networking implemented, and was actually planning to just pull your code in, but maybe you'd be interested in contributing to this library and doing it yourself...? 

I've been caught up the last couple months trying to implement a C++/SWIG backend because python is slow as dirt.   Unfortunately I've been getting nowhere, and finding I need to do some more planning and reorganization before I'll get it right.  So right now, I don't have anyway to scan the blockchain or maintain a wallet.   But I have grand plans for doing so, and am anxious to get  this functionality  (https://bitcointalk.org/index.php?topic=41958) implemented!

If you're interested, the project is here:

https://github.com/etotheipi/PyBtcEngine

The file unittest.py might show you how to use the library as implemented... it tests just about every method in my library, including OP_CHECKSIG.    PM me if you have any interest in teaming up!


Title: Re: Caesure - a Python Bitcoin Client
Post by: DiThi on October 24, 2011, 01:20:11 PM
For optimizing python I suggest two alternatives:

PyPy: It's a python JIT compiler written in python. It supports ctypes and a lot of standard libraries natively, and has a wrapper for regular c-python extension modules.

Cython: A python-derived languaje for making python extension modules. I use it a lot, is like writing in python and C/C++ at the same time (but all with python syntax).

There's another one that I didn't know about until recently, Shed Skin: A (restricted subset of) python to c++ compiler. I think is kinda pypy's RPython translator but it seems better for interfacing with C++ code.

By the way, a complete python implementation of bitcoin is an awesome idea! It's the way to go to develop new features, specially if you have tools like those I mentioned. Python code is so much easier to understand and modify!


Title: Re: Caesure - a Python Bitcoin Client
Post by: etotheipi on October 24, 2011, 08:50:03 PM
Haha, thanks for the suggestion, but it's a little too late for me.  I already have like 7,000 lines of C++ code, imported into python through SWIG.  However, I do python development in other projects, too, so I may keep your recommendations in mind.

I had never used SWIG before starting this effort, and now that I have battled it and come out victorious, I'm quite impressed with it.  It understands most of the "nominal" C++ programming structures, and usually does a good job of mapping every C++ function and class (with methods) to identical python calls.  There's a few quirks with it, but i got most of it ironed with one afternoon of frustration. 

But no need to pollute Sam's thread with this any longer.  Just throwing it out my positive recommendation for SWIG.  It's been a lifesaver for BTC client development in python.


Title: Re: Caesure - a Python Bitcoin Client
Post by: giszmo on May 18, 2013, 05:38:57 AM
Hi. Looking for some PyQT bitcoin client I found your project. Seriously dropping Windows support? I guess Windows is here to stay at least for some more years.
Last commit 2 months ago? How's your motivation?


Title: Re: Caesure - a Python Bitcoin Client
Post by: peapodamus on June 29, 2013, 03:38:55 AM
I am pleased to see Python being used for a wallet like this, esp. with a nice admin panel in it :D


Title: Re: Caesure - a Python Bitcoin Client
Post by: Chaoskampf on July 08, 2013, 04:47:18 PM
How's the progress on this? I see the last commit was back in March. Any idea on when a stable release will be available?


Title: Re: Caesure - a Python Bitcoin Client
Post by: sdp on September 28, 2013, 06:02:22 PM
Many python decoding functions including those for locale support will interpret a number starting with a zero specially : as an octal number.  Take a look at some of my interface changes for Electrum in its d.ddd branch.  You can find my fork at:

github.com/shawnpringle/electrum

Basically it nicely puts the thousand separators in for you when writing and when it displays numbers.  The thousand separators are pulled from the system default.  In the US, this is by default a comma but that can be changed to any character you wish.  It seems anyone who likes separators don't like commas.



Title: Re: Caesure - a Python Bitcoin Client
Post by: DiamondCardz on September 29, 2013, 08:53:02 PM
Haha, thanks for the suggestion, but it's a little too late for me.  I already have like 7,000 lines of C++ code, imported into python through SWIG.  However, I do python development in other projects, too, so I may keep your recommendations in mind.

I had never used SWIG before starting this effort, and now that I have battled it and come out victorious, I'm quite impressed with it.  It understands most of the "nominal" C++ programming structures, and usually does a good job of mapping every C++ function and class (with methods) to identical python calls.  There's a few quirks with it, but i got most of it ironed with one afternoon of frustration. 

But no need to pollute Sam's thread with this any longer.  Just throwing it out my positive recommendation for SWIG.  It's been a lifesaver for BTC client development in python.


Hi. Looking for some PyQT bitcoin client I found your project. Seriously dropping Windows support? I guess Windows is here to stay at least for some more years.
Last commit 2 months ago? How's your motivation?

I think the OP left bitcointalk over 2 years ago. His last action was in July of 2011. As for the commits, maybe he is still working on it, but he's not going to reply to your questions here.


Title: Re: Caesure - a Python Bitcoin Client
Post by: bernard75 on October 27, 2013, 01:35:50 AM
An updated PyQT bitcoin client would be awesome.
I will start on a fork tomorrow.