Bitcoin Forum
December 16, 2017, 09:27:42 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Is there minimal cpp code which can generate bitcoin WIF and address from sha256  (Read 329 times)
btctousd81
Sr. Member
****
Offline Offline

Activity: 266


View Profile WWW
December 03, 2017, 10:19:10 AM
 #1

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.


1513459662
Hero Member
*
Offline Offline

Posts: 1513459662

View Profile Personal Message (Offline)

Ignore
1513459662
Reply with quote  #2

1513459662
Report to moderator
1513459662
Hero Member
*
Offline Offline

Posts: 1513459662

View Profile Personal Message (Offline)

Ignore
1513459662
Reply with quote  #2

1513459662
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
aplistir
Member
**
Offline Offline

Activity: 112


View Profile
December 03, 2017, 11:20:44 AM
 #2


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.

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
btctousd81
Sr. Member
****
Offline Offline

Activity: 266


View Profile WWW
December 03, 2017, 11:31:25 AM
 #3


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.,

aplistir
Member
**
Offline Offline

Activity: 112


View Profile
December 03, 2017, 12:00:03 PM
 #4

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.

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
btctousd81
Sr. Member
****
Offline Offline

Activity: 266


View Profile WWW
December 03, 2017, 12:15:54 PM
 #5

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

aplistir
Member
**
Offline Offline

Activity: 112


View Profile
December 03, 2017, 12:39:42 PM
 #6


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

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
btctousd81
Sr. Member
****
Offline Offline

Activity: 266


View Profile WWW
December 03, 2017, 01:54:39 PM
 #7


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

aplistir
Member
**
Offline Offline

Activity: 112


View Profile
December 04, 2017, 09:02:28 AM
 #8

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...

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!