Bitcoin Forum
May 04, 2024, 02:42:43 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to convert xprv to wif or (hex) 1,2,3 address index (python)  (Read 165 times)
stalker00075 (OP)
Newbie
*
Offline Offline

Activity: 54
Merit: 0


View Profile
June 01, 2022, 06:27:06 PM
Last edit: June 01, 2022, 07:14:00 PM by stalker00075
 #1

how to convert xprv to wif or (hex) 1,2,3 address index (python)

i try this script?

https://github.com/lyndsysimon/bip32utils

k.txt :
Code:
xprv9u4S6TaiPQdMnT6uRJXQCxW69c3dRK7QEWJzq8iTFGXi1RcfjomN1H13dvci2wLBhQYkYEk4GngfpL1F9fbBqcWWu6qWRPQbuR5wmHLgRm4
xprv9wRuwjCQVQgMUaDTMhNS819LTEHUV7zfZ219Cr5tfziUKW7ucDVrVsM1camgGbWV6waQGZCNZwRyfJD8h7XYUVHoyNS5JmFxAdDfLnstxN2
...

I want to use this command to select xprv  one by one and convert to wif or privkey(hex)

cat k.txt |  bip32gen  -i xprv -f - -o wif -F -  0 1

Code:
L23QxT1kkPrXVagUPaFgr3RxAv46QJamgkgfu724bkT8TLCfVwda
KxzGwpbbisCcuNK5dJt33jPJVrpDpe1st6qES2PSF2TWu8LCofyQ


But it only works if there are only 1 xprv in the dictionary  / please help me how to make it possible to convert many

maybe some other similar script or this one like that?
1714790563
Hero Member
*
Offline Offline

Posts: 1714790563

View Profile Personal Message (Offline)

Ignore
1714790563
Reply with quote  #2

1714790563
Report to moderator
You get merit points when someone likes your post enough to give you some. And for every 2 merit points you receive, you can send 1 merit point to someone else!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714790563
Hero Member
*
Offline Offline

Posts: 1714790563

View Profile Personal Message (Offline)

Ignore
1714790563
Reply with quote  #2

1714790563
Report to moderator
odolvlobo
Legendary
*
Offline Offline

Activity: 4298
Merit: 3214



View Profile
June 01, 2022, 08:34:26 PM
 #2

But it only works if there are only 1 xprv in the dictionary  / please help me how to make it possible to convert many

https://codefather.tech/blog/bash-loop-through-lines-file/

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2955


Block halving is coming.


View Profile WWW
June 01, 2022, 11:58:24 PM
 #3

I tried to search and it seems there is no direct guide to making a python script to bulk convert xprv to wif key or hex.

Why not try to play with this python that I found on Github.

- https://github.com/ELHARAKA/MassPrivatekeysToWIF

Just take note only run this offline I do not know if this one is safe I just found it on Google when I search for a guide. Or you can get some idea there and build your own python script,.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6727


bitcoincleanup.com / bitmixlist.org


View Profile WWW
June 02, 2022, 08:00:34 AM
Merited by ABCbits (1)
 #4

You can make a wrapper script around bip32gen, in a single file using `os.spawnl` to create a bip32gen subprocess and wait for it to exit. The wrapper will just read the list of keys from a file and loop through them.
Note: Make sure you make the script wrapper executable.
Code:
#!/usr/bin/python3
import os

keys = []
file = open('keys.txt' 'r')
for l in file:
    keys.append(l.strip('\n'))
for k in keys:
    os.spawnl(os.P_WAIT, '/path/to/bip32gen', ['cmd', 'options', 'as', 'list'])

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
stalker00075 (OP)
Newbie
*
Offline Offline

Activity: 54
Merit: 0


View Profile
June 02, 2022, 08:35:23 AM
 #5

You can make a wrapper script around bip32gen, in a single file using `os.spawnl` to create a bip32gen subprocess and wait for it to exit. The wrapper will just read the list of keys from a file and loop through them.
Note: Make sure you make the script wrapper executable.
Code:
#!/usr/bin/python3
import os

keys = []
file = open('keys.txt' 'r')
for l in file:
    keys.append(l.strip('\n'))
for k in keys:
    os.spawnl(os.P_WAIT, '/path/to/bip32gen', ['cmd', 'options', 'as', 'list'])



I did through bash as advised odolvlobo
but it turned out the speed is very low 23 xprv per second and I have a dictionary for 1 million xprv

anyway thank you for checking
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!