Bitcoin Forum
May 16, 2024, 12:53:29 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: Extracting Privat Key from PEM File on: January 17, 2021, 07:23:15 PM
From the old topic it's a PUBLIC key not a PRIVATE key. Why did you change it?

I don't want to post my private Key online so anyone can take my BTC.  Roll Eyes


Thx for this code with Python HCP. This was what I need.

This gives an cool formated output to see everthing bedder:
Code:
openssl asn1parse -in privatekey.pem

Hex-dump is the Private Key

I found a Code from https://gist.github.com/Jun-Wang-2018/3105e29e0d61ecf88530c092199371a7#file-bitcoin_from_private_key_to_wif-py to convert HEX to WIF:

Code:
# From private key(hex) to Wallet Import Format(WIF)
# Reference: https://medium.freecodecamp.org/how-to-create-a-bitcoin-wallet-address-from-a-private-key-eca3ddd9c05f
#            https://docs.python.org/2/library/hashlib.html
import codecs  #If not installed: "pip3 install codecs"
import hashlib
# PK0 is a demo private key.
PK0 = "3cd0560f5b27591916c643a0b7aa69d03839380a738d2e912990dcc573715d2c"
PK1 = '80'+ PK0
PK2 = hashlib.sha256(codecs.decode(PK1, 'hex'))
PK3 = hashlib.sha256(PK2.digest())
checksum = codecs.encode(PK3.digest(), 'hex')[0:8]
PK4 = PK1 + str(checksum)[2:10]  #I know it looks wierd

# Define base58
def base58(address_hex):
    alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
    b58_string = ''
    # Get the number of leading zeros
    leading_zeros = len(address_hex) - len(address_hex.lstrip('0'))
    # Convert hex to decimal
    address_int = int(address_hex, 16)
    # Append digits to the start of string
    while address_int > 0:
        digit = address_int % 58
        digit_char = alphabet[digit]
        b58_string = digit_char + b58_string
        address_int //= 58
    # Add ‘1’ for each 2 leading zeros
    ones = leading_zeros // 2
    for one in range(ones):
        b58_string = '1' + b58_string
    return b58_string

WIF = base58(PK4)
print(WIF)
2  Bitcoin / Development & Technical Discussion / Extracting Privat Key from PEM File on: January 15, 2021, 01:48:40 PM
Hello there,

I have a problem with extracting an Privat Key from an old wallet (*.pfx).

In 2011 I convert a Wallet in this (OpenSSL PEM) format. In an old Post i can see the answer, but my programming skill is weak: https://bitcointalk.org/index.php?topic=2631.0

1. I use OpenSSL for receiving the Privat Key:
openssl pkcs12 -in mywallet.pfx -nocerts -out privatekey.pem -nodes

2. Open the *.pem (I used the public key from the Topic above  Wink ):
-----BEGIN PRIVATE KEY-----
MIH1MIGuBgcqhkjOPQIBMIGiAgEBMCwGByqGSM49AQECIQD/////////////////
///////////////////+///8LzAGBAEABAEHBEEEeb5mfvncu6xVoGKVzocLBwKb
/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIh
AP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABJJ6TBhmiWm4
Y1ACBVJVn0oyG9Ay5IzEZq8cPyrs1PERl963YQh5UrGOT0NodynfHswkz8bUpaJW
FsowR/l9wXc=
-----END PRIVATE KEY-----


As I understand it, I have to do the following steps :

- computes the sha256 of the key ;
- computes the rmd160 of this hash ;
- add a byte at the begin for the version number (?) ;
- add four bytes at the end for the check sum ;
- encode the result in base58 ;


How can I do that with CMD and Editor? Is this the right way to get the correct bitcoin address?

Thanks for help.
3  Bitcoin / Project Development / Re: Large Bitcoin Collider (Collision Finders Pool) on: December 28, 2017, 10:05:37 PM
First time using this also and having a hard time finding the info anywhere.

I manually downloaded everything to get it working, checked the updates and it's all up to date, whenever I run the LBC -x it works just fine ut when I run it for real it always fails saying one of several different error messages which randomly seem to rotate each time I try.

I have tried adding an --id I've tried adding --secret in a variety of different ways as described in the manual and other ways to test, this is the first time using this, no modifications to any files or anything but it always says error that the server doesn't like us with Answer, secret is wrong or malformed request or perm withdrawn or challenge failed or error 0x567 or gen checksum.

Nothing seems to work and I have no idea why.

Any ideas to make this work?

Logfile from LBC make it more simple...

Hi, folks!
Please help to noob ))
What is the proper command to send a secret to server? Give me an example please.
Trying this
./LBC -no_update -cpus 7 -secret ******,
but get
Invalid secret format/characters.

PS Secret is given for the first time.


$ LBC -id Hoolakawoola -s x:somesecret

x is a random old secret and somesecret the new given one...
https://lbc.cryptoguru.org/man/user
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!