Post
Topic
Board Bitcoin Discussion
Merits 1 from 1 user
Re: Public key question
by
BlackHatCoiner
on 11/01/2021, 07:21:20 UTC
⭐ Merited by mocacinno (1)
If you're asking the technical details then I will quote you a part of my old post:

1) We generate a 256-bit private key.
Code:
18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725

2) We, then, perform ECDSA to get our public key (compressed):
Code:
0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352
(Compressed means only the x coordinate. We don't have to carry the y since it can be calculated from y2 = x3 + 7. Since y2 returns 2 different values, we use the prefix 02 or 03 in front of the compressed public key to determine if y is odd or even)

3) We hash that compressed public key with SHA-256:
Code:
0b7c28c9b7290c98d7438e70b3d3f7c848fbd7d1dc194ff83f4f7cc9b1378e98

4) After that, we perform RIPEMD-160 hashing to the SHA-256 result:
Code:
f54a5851e9372b87810a8e60cdd2e7cfd80b6e31

5) Add version byte in front of RIPEMD-160 hash (00 for Main Network):
Code:
00f54a5851e9372b87810a8e60cdd2e7cfd80b6e31

6) Again, SHA-256 to the previous result:
Code:
ad3c854da227c7e99c4abfad4ea41d71311160df2e415e713318c70d67c6b41c

7) We hash the SHA-256 result with SHA-256 again:
Code:
c7f18fe8fcbed6396741e58ad259b5cb16b7fd7f041904147ba1dcffabf747fd

8) The first 4 bytes of the last SHA-256 result is address' checksum:
Code:
c7f18fe8

9) Extend the RIPEMD-160 hash from part 5 with these 4 bytes:
Code:
00f54a5851e9372b87810a8e60cdd2e7cfd80b6e31c7f18fe8

10) Convert this to base58 and here you go:
Code:
1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs
[from bitcoin.it]

If you just want to find an online converter then: [here you go]

And privatekey in WIF format , I hhave tried online tools but nothing .

Again, I'm quoting:
A WIF is nothing but the original hex private key encoded in base58 plus some other technical stuff like version byte and checksum. This code shows exactly how we end up with a WIF:

Code:
privatekey = "e1398ffab41618b4c63313912d2c407e57c60feeb799544503e0aeca8c5aede1"
extended = "80" + privatekey + "01"
extendedchecksum = extended + checksum(extended)
wif = base58_encode(extendedchecksum)

// wif is "L4mX2hsUq4LFbMmAomWHCARAuMkzTuAZjmGCQsvmny1aahRE1Aie"

You can read more about the WIF here: https://learnmeabitcoin.com/technical/wif

I hope I helped you.