Bitcoin Forum
May 14, 2024, 08:45:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Ckey to WIF  (Read 149 times)
pbies (OP)
Full Member
***
Offline Offline

Activity: 246
Merit: 126



View Profile
June 04, 2023, 11:16:00 PM
 #1

How to convert unencrypted ckey to Wallet Import Format?

I am looking for a Python or JavaScript solution.

Let's say I have ckey in bytes format or hex, need to convert it to WIF as bytes or string.

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 14900K and RTX 4090
1715676309
Hero Member
*
Offline Offline

Posts: 1715676309

View Profile Personal Message (Offline)

Ignore
1715676309
Reply with quote  #2

1715676309
Report to moderator
1715676309
Hero Member
*
Offline Offline

Posts: 1715676309

View Profile Personal Message (Offline)

Ignore
1715676309
Reply with quote  #2

1715676309
Report to moderator
1715676309
Hero Member
*
Offline Offline

Posts: 1715676309

View Profile Personal Message (Offline)

Ignore
1715676309
Reply with quote  #2

1715676309
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
PowerGlove
Hero Member
*****
hacker
Offline Offline

Activity: 511
Merit: 4061



View Profile
June 05, 2023, 12:29:12 AM
Merited by seoincorporation (3), pbies (1)
 #2

How to convert unencrypted ckey to Wallet Import Format?
I wrote a Python script late last year that can convert raw scalars into addresses (and WIFs), here it is: [Code] Generating addresses from scratch (Python 3.6+).

If you have a raw scalar (e.g. 0xb46ed3fbb61ed98b2f8791fc9c79ba382e187140a7326ca03d7204d705a6586d), then you can supply it to the script, like this:

Code:
$ python3 make_address.py 0xb46ed3fbb61ed98b2f8791fc9c79ba382e187140a7326ca03d7204d705a6586d

That will output the following (WIFs highlighted):

       +------+--------------------+
       | Type | Legacy, Compressed |
    +--+------+--------------------+---------------+
    | Address | 1L5hbU5BnNC9PWdJLqQUdUTC1FqvCZG1go |
+---+---------+------------------------------------+-----------------------+
| Private Key | p2pkh:L3GSzNCJjj4z1UmSkPUxc8aUrnJ6VbGsKq3kxyVWkEdVXM8S1pnF |
+-------------+------------------------------------------------------------+
       +------+---------------+
       | Type | Native SegWit |
    +--+------+---------------+----------------------------+
    | Address | bc1q69xlp2mjka4w0nywe4eps97gk3ryu968p98amh |
+---+---------+--------------------------------------------+----------------+
| Private Key | p2wpkh:L3GSzNCJjj4z1UmSkPUxc8aUrnJ6VbGsKq3kxyVWkEdVXM8S1pnF |
+-------------+-------------------------------------------------------------+
pbies (OP)
Full Member
***
Offline Offline

Activity: 246
Merit: 126



View Profile
June 05, 2023, 02:20:08 AM
 #3

...

Thank you very much!

Works like a charm!

BTC: bc1qmrexlspd24kevspp42uvjg7sjwm8xcf9w86h5k
I have 9900K and 1080 Ti, gathering funds for new desktop PC for Bitcoin operations - 14900K and RTX 4090
Greg Tonoski
Member
**
Offline Offline

Activity: 115
Merit: 68


View Profile
October 05, 2023, 08:45:52 AM
 #4

For JavaScript: SeedTool -> Single Address Tool. https://github.com/BitcoinQnA/seedtool
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!