Author

Topic: Convert key to addr/sign with php or python (no bitcoin core / remote API) (Read 877 times)

legendary
Activity: 2097
Merit: 1068
There's a good article at the following URL which describes what you want, he also broadcasts a transaction to the network without a Bitcoin client.

http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html

If I was going to do this I'd do it in C and probably use PolarSSL which is now renamed to mbedTLS since the ARM CPU manufacturers took it over.
legendary
Activity: 1135
Merit: 1161
You can take a look here: https://github.com/vbuterin/pybitcointools  This is a Python library that, as far as I know, can do all you need.  I do not know, though, whether or not it is "trustworthy" or how thoroughly it was tested and all that - gmaxwell's comment is a good one.
staff
Activity: 4172
Merit: 8419
Is there a trustworthy piece of code or library that can do this?
Trustworthy? Not as far as I am aware of.  There are various pieces of software which have never been subject to peer review, have no tests, have no comments, could not possibly be free of timing sidechannels, etc. Several times people have posted things in this subforum which were outright backdoored (I'd link, but I delete the posts); exploiting the fact that most people don't have the time or patience to audit them. (Of course, all this can also be said for the various cloud services, plus they have a whole host of additional potential weaknesses.)

I wouldn't expect to find one any time soon, writing software in PHP and Python is incompatible with avoiding timing sidechannels or leaving around private key data in memory (not to mention slow); so it's not a first choice for the development of conscientious cryptographic software; and it takes a tremendous amount of work to produce something that deserves confidence.

Signing is even harder, as there have been a large number of implementations out there which were outright broken; using non-cryptographic RNGs that leave the private keys exposed to recovery.  If you didn't require the software be PHP/Python, only callable from it, bitcoin-tx command-line tool in Bitcoin Core can be used for signing, and doesn't require having anything running.
legendary
Activity: 1176
Merit: 1001
Suppose on my website, I have a private key. Whether in base58 / WIF format, or hex, whatever, I have the 256 bits.

Now I want to convert this server side to an address. Preferably in PHP, but Python would work as well. I do NOT have a Bitcoin core client running there, and it can NOT depend on a remote API like blocktrail.com or blockchain.info or blockcypher.com etc. I need to do this purely server side.

Is there a trustworthy piece of code or library that can do this?

--- Mod merged from another post ----

Similar to my question about converting private keys to addresses, I also would like to create and sign a transaction on my webserver. Again preferably in PHP, but Python would work as well. I do NOT have a Bitcoin core client running there, and it can NOT depend on a remote API like blocktrail.com or blockchain.info or blockcypher.com etc. I need to do this purely server side.

Suppose I have a private key + address along with all its spendable outputs (i.e. unspent outputs with txids etc), and a 2nd address where I want to send some coins. So all required data is there. How would I got about creating the tx, signing it, so I can manually push it to the network later?

Is there a trustworthy piece of code or library that can do this? I guess something like BitcoinJS, but in PHP or Python?
Jump to: