Bitcoin Forum
November 12, 2024, 04:31:04 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   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 186 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?
odolvlobo
Legendary
*
Offline Offline

Activity: 4494
Merit: 3417



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: 3430
Merit: 3172


Playbet.io - Crypto Casino and Sportsbook


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

███████████████
█████████████████████
██████▄▄███████████████
██████▐████▄▄████████████
██████▐██▀▀▀██▄▄█████████
████████▌█████▀██▄▄██████
██████████████████▌█████
█████████████▀▄██▀▀██████
██████▐██▄▄█▌███████████
██████▐████▀█████████████
██████▀▀███████████████
█████████████████████
███████████████

.... ..Playbet.io..Casino & Sportsbook.....Grab up to  BTC + 800 Free Spins........
████████████████████████████████████████
██████████████████████████████████████████████
██████▄▄████████████████████████████████████████
██████▐████▄▄█████████████████████████████████████
██████▐██▀▀▀██▄▄██████████████████████████████████
████████▌█████▀██▄▄█████▄███▄███▄███▄█████████████
██████████████████▌████▀░░██▌██▄▄▄██████████████
█████████████▀▄██▀▀█████▄░░██▌██▄░░▄▄████▄███████
██████▐██▄▄█▌██████████▀███▀███▀███▀███▀█████████
██████▐████▀██████████████████████████████████████
██████▀▀████████████████████████████████████████
██████████████████████████████████████████████
████████████████████████████████████████
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7374


Top Crypto Casino


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'])

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
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!