Author

Topic: Is there minimal cpp code which can generate bitcoin WIF and address from sha256 (Read 661 times)

full member
Activity: 378
Merit: 197
Quote from: btctousd81
i have created another paste, which wont get removed after 1 year., i hope you dont mind. so that ppl can benefit from this even after a year.

https://pastebin.com/6yw2BtDM

Cool. Of course I don't mind, just a pity that I didn't write "python 2.7" to the comments in the beginning of the code.
But I guess it is obivious, because the print commands do not have parentheses in them...
sr. member
Activity: 434
Merit: 270

Here is my version of the python code:
https://pastebin.com/19y9pUg5
It works for me. My Python version is 2.7.13

It generates 10 Addresses every time it is run. For the first address it also displays the 256 bit random number and public key

In the end there is some commented code, to make an uncompressed address,  and where you can manually add your own random number and it makes address form that


Thanks, i ll give it a go.,

i have created another paste, which wont get removed after 1 year., i hope you dont mind. so that ppl can benefit from this even after a year.

https://pastebin.com/6yw2BtDM
full member
Activity: 378
Merit: 197

Here is my version of the python code:
https://pastebin.com/19y9pUg5
It works for me. My Python version is 2.7.13

It generates 10 Addresses every time it is run. For the first address it also displays the 256 bit random number and public key

In the end there is some commented code, to make an uncompressed address,  and where you can manually add your own random number and it makes address form that
sr. member
Activity: 434
Merit: 270
I just re-read my comment and realized that it can be understood that I have made my own c++ implementation. BUT I meant I have just edited the python code, not converted it to c++.

Here is a link with some c++ code: https://stackoverflow.com/questions/17672696/generating-bitcoin-address-from-ecdsa-public-key

Edit: Also tried to post my version of the python code, but the forum prevented me from posting it. Quite surprising. But doesnt matter, because you were not looking for python code anyway.
Code:
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

i have already seen that code.,
but can't make it to work.,

you can always upload your code snippets to pastebin.com
full member
Activity: 378
Merit: 197
I just re-read my comment and realized that it can be understood that I have made my own c++ implementation. BUT I meant I have just edited the python code, not converted it to c++.

Here is a link with some c++ code: https://stackoverflow.com/questions/17672696/generating-bitcoin-address-from-ecdsa-public-key

Edit: Also tried to post my version of the python code, but the forum prevented me from posting it. Quite surprising. But doesnt matter, because you were not looking for python code anyway.
Code:
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
sr. member
Activity: 434
Merit: 270

I do not have a cpp code, but here is a python code that can do what you want.
https://davanum.wordpress.com/2014/03/17/generating-a-bitcoin-private-key-and-address/

It is quite readable even if you are not familiar with python. You could try to convert it to C.  Smiley

I have also edited that and made my own version, that can do addresses with compressed public keys. I can post it here if you are interested.

please do , i am really interested.,

thanks

i am specifically looking for c,cpp because of performance issue.,

 i have php code and it takes around 34 seconds to generate 128 pairs of private key and btc address.,
and if i add compressed address generaton too, then it takes 67 seconds.,
its very slow., so i am looking for fastest method out there.,

i am even looking at how can i use secp256k1 for the same.,
full member
Activity: 378
Merit: 197

I do not have a cpp code, but here is a python code that can do what you want.
https://davanum.wordpress.com/2014/03/17/generating-a-bitcoin-private-key-and-address/

It is quite readable even if you are not familiar with python. You could try to convert it to C.  Smiley

I have also edited that and made my own version, that can do addresses with compressed public keys. I can post it here if you are interested.
sr. member
Activity: 434
Merit: 270
Is there minimal cpp code which can generate bitcoin WIF and address from sha256 private key?

I am trying to generate Bitcoin WIF key Bitcoin Addresses from sha256 HEX private key.

but all i see there are bulky libraries and software packages.

I am looking for lightweight small, fast, cpp code which can generate

I need this
Code:
WIF KEY : 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
Bitcoin Address : 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
Bitcoin Address Compressed : 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

i have this
Code:
sha256 HEX key : 0000000000000000000000000000000000000000000000000000000000000001


Thanks for your time.

Jump to: