Bitcoin Forum
December 14, 2024, 03:23:32 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question on public keys  (Read 236 times)
Little Lily (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 4


View Profile
July 08, 2024, 09:51:28 AM
Merited by NotATether (2)
 #1

I've been on this forum for quite a while now and i decided to go through the rules and a few other Post in the meta and beginners and help section. I have been reading through for some time now and I discovered introductions are not fancied much here. So instead of making the normal introduction most newbies usually make, I decided to  introduce myself with something with a bit of  better quality after I have done some readings here.

Firstly I don't know if this is the right section to post this.

I have been doing some proof reading about creation of wallets and I have a couple of questions.
From some posts I read here I got to understand that public keys are created by a bitcoin wallet before the addresses are created. In the post they made mention of a process called hashing of the public keys to create addresses but I don't fully understand how it works.

I also came across a post saying wallets can be created offline for safety purposes but if that is so, how possible is it for the same public keys to be generated twice? From the length and numbers of accepted characters in a public key, I know the permutations are almost infinite but what are the chances of a wallet generating a public key twice?
Zaguru12
Hero Member
*****
Offline Offline

Activity: 910
Merit: 971



View Profile WWW
July 08, 2024, 10:21:05 AM
 #2

Addresses are just the shorter version of public keys gotten through compression of the key using the hash function as you have stated. The public key is long and has many characters that look similar, the compression to address was just to Make it smaller and also easier to write down. You can read through learnme.com to know about keys and addresses.

I also came across a post saying wallets can be created offline for safety purposes but if that is so, how possible is it for the same public keys to be generated twice? From the length and numbers of accepted characters in a public key, I know the permutations are almost infinite but what are the chances of a wallet generating a public key twice?

Yes you can create wallet or generate your keys without having to connect to the internet.
No you cannot generate same public key from two different private key. Because the private key is a 1:1 to a public key. That is a private key creates a unique public key that cannot be created from another private key.

 As for the possible collision of addresses (public key hashes) it is possible that a private key can generate similar addresses since there are more possible private keys (2256) than the possible number of addresses (2160), but the combination needed for this is huge and not easily possible as it seems.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits.
..........UNLEASH..........
THE ULTIMATE
GAMING EXPERIENCE
DUELBITS
FANTASY
SPORTS
████▄▄█████▄▄
░▄████
███████████▄
▐███
███████████████▄
███
████████████████
███
████████████████▌
███
██████████████████
████████████████▀▀▀
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
.
▬▬
VS
▬▬
████▄▄▄█████▄▄▄
░▄████████████████▄
▐██████████████████▄
████████████████████
████████████████████▌
█████████████████████
███████████████████
███████████████▌
███████████████▌
████████████████
████████████████
████████████████
████▀▀███████▀▀
/// PLAY FOR  FREE  ///
WIN FOR REAL
..PLAY NOW..
hosseinimr93
Legendary
*
Offline Offline

Activity: 2618
Merit: 5741



View Profile
July 08, 2024, 11:02:18 AM
 #3

Addresses are just the shorter version of public keys gotten through compression of the key using the hash function as you have stated. The public key is long and has many characters that look similar, the compression to address was just to Make it smaller and also easier to write down.
An address isn't just a shorter version of a public key.
A coin sent to a public key is different from a coin sent to an address. They have different locking scripts.

Also note that an address isn't necessarily the hash of a public key. A bitcoin address can be the hash of a script.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
SilverCryptoBullet
Full Member
***
Offline Offline

Activity: 250
Merit: 103



View Profile
July 08, 2024, 11:08:15 AM
 #4

So instead of making the normal introduction most newbies usually make, I decided to  introduce myself with something with a bit of  better quality after I have done some readings here.
Newbies don't need to make introductions to show their quality. They need study on Bitcoin and the forum, it's enough.

Quote
From some posts I read here I got to understand that public keys are created by a bitcoin wallet before the addresses are created. In the post they made mention of a process called hashing of the public keys to create addresses but I don't fully understand how it works.
Keys, addresses, wallets
Wallet software creates private key randomly and through Eliptic Curve Multiplication to create public key. After that, from public key and Hashing function, it creates public address.

Hashing functions include SHA256 and RIPEMD-160, call Double-Hash or HASH160.

Quote
I also came across a post saying wallets can be created offline for safety purposes but if that is so, how possible is it for the same public keys to be generated twice?
If you have a private key, you can get a public key and a public address, multiple times, it's called wallet recovery. Without this ability (recovery), it's risky to use Bitcoin because if you lose your wallet or private key, you lose your bitcoin.
Little Lily (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 4


View Profile
July 08, 2024, 01:51:33 PM
 #5

An address isn't just a shorter version of a public key.
A coin sent to a public key is different from a coin sent to an address. They have different locking scripts.

Also note that an address isn't necessarily the hash of a public key. A bitcoin address can be the hash of a script.
I was initial restricted from posting
So does this mean that hashing must be involved weather a public keys are used or a script is used.
hosseinimr93
Legendary
*
Offline Offline

Activity: 2618
Merit: 5741



View Profile
July 08, 2024, 03:55:18 PM
 #6

So does this mean that hashing must be involved weather a public keys are used or a script is used.
Right.

Whenever you generate an address, you first genrate a private key and a public key.
To receive bitcoin from someone, you can give them your public key, but that's not common these days and to receive bitcoin from people, we give them a bitcoin address. With giving a bitcoin address to someone, you acutally tell them what locking script you want to be used for your coins.

We have some standard locking scripts and each of them corresponds to a different type of address.
For example, a P2PKH address (an address starting with 1) contains public key hash and and a P2SH address (an address starting with 3) contains a script hash.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
Iamgoat
Member
**
Offline Offline

Activity: 89
Merit: 29


View Profile
July 09, 2024, 09:52:59 AM
 #7

An address isn't just a shorter version of a public key.
A coin sent to a public key is different from a coin sent to an address. They have different locking scripts.

Also note that an address isn't necessarily the hash of a public key. A bitcoin address can be the hash of a script.
From the little knowledge I acquired from here now. What could then be the major difference between the public key and your bitcoin address aside from bitcoin address being a compressed version of a public key. I realized bitcoin address are most oftentimes even shorter than the private key, they are just between 26 to 35 alphanumeric. The private key is never to be shared with others but to be kept privately for your own use. Most preferably, off the internet or the computers. But the public key is meant to be shared as well as the bitcoin address.

Another question I wanted to ask alongside is, aside from the use of QR Codes to make it easy for people to scan other people's bitcoin addresses, can't they be further compressed to be a little more or less than 10 digits, so people can easily memorize it off hands for their every day transactions since the use of Bitcoin has risen significantly around the world?
tranthidung
Legendary
*
Offline Offline

Activity: 2478
Merit: 4304


Farewell o_e_l_e_o


View Profile WWW
July 09, 2024, 10:16:31 AM
 #8

I realized bitcoin address are most oftentimes even shorter than the private key, they are just between 26 to 35 alphanumeric. The private key is never to be shared with others but to be kept privately for your own use.
About Keys (Private keys, Public keys) & Addresses.

Quote
Most preferably, off the internet or the computers. But the public key is meant to be shared as well as the bitcoin address.
Reason that private keys must be kept in private is if you share your private keys, your bitcoins will be stolen and gone forever. Bitcoin transactions are irreversible so that if your bitcoins were moved, no way to ask for reverse/ refund. Except if you ask police to arrest the thief to get your bitcoin back, it's nearly impossible and complicated.

There are two famous sayings to sum up
  • It's not your private key, it's not your bitcoin.
  • Never share your Bitcoin private keys.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
hosseinimr93
Legendary
*
Offline Offline

Activity: 2618
Merit: 5741



View Profile
July 09, 2024, 11:42:52 AM
Last edit: July 09, 2024, 12:08:32 PM by hosseinimr93
 #9

What could then be the major difference between the public key and your bitcoin address aside from bitcoin address being a compressed version of a public key.
Your address is not the compressed version of your public key. Your address represents the locking script, not the public key.


I realized bitcoin address are most oftentimes even shorter than the private key, they are just between 26 to 35 alphanumeric.
Again wrong.

P2WPKH addresses are 42 characters long.
P2WSH and P2TR addresses are 62 characters long.


But the public key is meant to be shared as well as the bitcoin address.
Your public key is revealed whenever you make a transaction.
There is no need to share your public key with others if they want to send you bitcoin.


Another question I wanted to ask alongside is, aside from the use of QR Codes to make it easy for people to scan other people's bitcoin addresses, can't they be further compressed to be a little more or less than 10 digits, so people can easily memorize it off hands for their every day transactions since the use of Bitcoin has risen significantly around the world?
You can't have such a short address, if you want it to be standard.

▄▄███████▄▄
▄██████████████▄
▄██████████████████▄
▄████▀▀▀▀███▀▀▀▀█████▄
▄█████████████▄█▀████▄
███████████▄███████████
██████████▄█▀███████████
██████████▀████████████
▀█████▄█▀█████████████▀
▀████▄▄▄▄███▄▄▄▄████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀
.
 MΞTAWIN  THE FIRST WEB3 CASINO   
.
.. PLAY NOW ..
fillippone
Legendary
*
Online Online

Activity: 2380
Merit: 17000


Fully fledged Merit Cycler - Golden Feather 22-23


View Profile WWW
July 11, 2024, 09:23:15 PM
Merited by SilverCryptoBullet (1)
 #10

I also came across a post saying wallets can be created offline for safety purposes but if that is so, how possible is it for the same public keys to be generated twice? From the length and numbers of accepted characters in a public key, I know the permutations are almost infinite but what are the chances of a wallet generating a public key twice?

It is possible sure.
as it: if you were asked to pick two atoms in the universe, is it possible to select the same atom twice?

The theoretical possibility exists; yes, in reality, you can ignore this possibility and trust a good entropy generator to generate a random number to secure your intergenerational wealth.
Of course, things change if your entropy generator isn't so good, and actually, you pick those atoms only from a very specific region in the universe.

You can read something about this here:
There are 2^256 private keys out there: how big is that number?

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
SilverCryptoBullet
Full Member
***
Offline Offline

Activity: 250
Merit: 103



View Profile
July 12, 2024, 02:31:08 AM
Merited by fillippone (3)
 #11

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04_keys.adoc

There is a tip in Mastering Bitcoin book too.
Quote
The size of Bitcoin’s private key space (2256) is an unfathomably large number. It is approximately 1077 in decimal. For comparison, the visible universe is estimated to contain 1080 atoms.
fillippone
Legendary
*
Online Online

Activity: 2380
Merit: 17000


Fully fledged Merit Cycler - Golden Feather 22-23


View Profile WWW
July 12, 2024, 07:39:48 PM
 #12

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04_keys.adoc

There is a tip in Mastering Bitcoin book too.
Quote
The size of Bitcoin’s private key space (2256) is an unfathomably large number. It is approximately 1077 in decimal. For comparison, the visible universe is estimated to contain 1080 atoms.

This is why I referenced the numbers of atoms in the universe in my above example.
The point was also do describe how our brain is not wired to understand the exponents.
Another example
10^5 seconds ago it was 1 day ago
10^7 seconds ago was 4 months ago
10^9 seconds ago was 31 years  ago
10^18 seconds ago was twice the age of the universe

My linked post is full of such examples

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
SilverCryptoBullet
Full Member
***
Offline Offline

Activity: 250
Merit: 103



View Profile
July 13, 2024, 03:22:31 AM
 #13

This is why I referenced the numbers of atoms in the universe in my above example.
You can use this graphic to simplify your lecture. People can get impression with graphics than pure texts for reading.

Faisal2202
Hero Member
*****
Offline Offline

Activity: 1428
Merit: 513


Payment Gateway Allows Recurring Payments


View Profile WWW
July 15, 2024, 04:54:41 PM
 #14

I also came across a post saying wallets can be created offline for safety purposes but if that is so, how possible is it for the same public keys to be generated twice? From the length and numbers of accepted characters in a public key, I know the permutations are almost infinite but what are the chances of a wallet generating a public key twice?
Welcome to this forum. I hope you find it enjoyable and beneficial. I'm glad you chose to ask a question that not only revisits the topic for those already familiar with it but also introduces it to those who are new. I have a great topic for you to read that I came across some time ago. It's incredibly helpful, especially if you read all the replies. While one member might make a mistake or error in their post, others often provide corrections.

This will enhance your knowledge and help you think critically when searching for and creating tutorial posts, should you ever wish to do so.

Public keys and Addresses - Are there striking similarities or difference. After reading this thread you must no collision is not possible because the possibility of collision is 2128.

..cryptomus..   
  
.
lllllllllllllllllll CRYPTO
PAYMENT GATEWAY
▄█▀▀██▄░░░▄█████▄░░░▄▀████▄
██░▀▄██░░░██▄░▄██░░░██▄▀▀▀█
██░▀▄██░░░███▄███░░░███░░▄█
▀▀▀▀▀░░░░░▀▀▀▀▀░░░░░▀▀▀▀▀
▄▄▄▄▄░░░░░▄▄▄▄▄░░░░░▄▄▄▄▄
███▀▄██░░░██▀░▀██░░░██▀▀▀▀█
██▀▄███░░░██░░░██░░░█▄███░█
▀█▄▄▄█▀░░░▀██▄██▀░░░▀█▄▄▄█▀

▄█████▄░░░▄█▀▀██▄░░░▄█████▄
█▀░█░▀█░░░█░▀░▀▀█░░░██▄░▄██
█▄█▄█▄█░░░███░▀▄█░░░███▄███
▀▀▀▀▀░░░░░▀▀▀▀▀░░░░░▀▀▀▀▀
ACCEPT
CRYPTO
PAYMENTS
..GET STARTED..
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!