how does a bitcoin wallet function during transactions

7 replies 356 views
im_altSenior Member
Posts: 130 · Reputation: 817
#1Mar 23, 2024, 10:13 PM
I've been trying to wrap my head around how bitcoin wallets operate. It’s mentioned that the private key doesn't show up publicly on the blockchain, so how does the system recognize it? I figure it’s only used for creating digital signatures that unlock generated outputs. Also, I'm curious about the security aspect of creating our own random number on our computer to generate the private key. Is that a safe method?
3 Reply Quote Share
cryptobridgeSenior Member
Posts: 221 · Reputation: 1481
#2Mar 25, 2024, 11:46 PM
The network doesn't need your private key, it recognized it from the signature and the public key. When someone send you Bitcoin, that Bitcoin is lock on that public key hash and only a valid signature can unlock that Bitcoin. To spend the Bitcoin, the network doesn't need your private key, so instead your private key produce a signature and a public key that match the scriptpubkey, once they match each other the network allows that Bitcoin to be spend to another wallet address, this way your private key isn't sacrifice on the network and nobody will see it. It's safe if you do it but randomness and entropy is very important. Why not make use of the laptop as an airgap device, no internet, no Bluetooth and then create a safe seed phrase to have addresses and their private keys. This helps you manage your private keys properly instead of bunch of keys.
0 Reply Quote Share
wizard404Full Member
Posts: 86 · Reputation: 276
#3Mar 26, 2024, 03:01 AM
The bitcoin wallet manages your keys, check you funds on the blockchain, constructs transactions, sign and broadcast it to the network
3 Reply Quote Share
pixel2014Hero Member
Posts: 857 · Reputation: 4132
#4Mar 26, 2024, 04:45 AM
With the help of digital signature, you can sign a bitcoin transaction without letting anyone see your private key. I think that is the question you asked? You can read about this to know more about digital signature in bitcoin transaction: https://learnmeabitcoin.com/beginners/guide/digital-signatures/ If you know what you are doing, it is safe. But I will advise you to use a reputed wallet instead of generating your own entropy or private key on your own.
2 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#5Mar 26, 2024, 10:06 AM
To truly understand that, you need to understand the concept behind Asymmetric Cryptography. In this type of cryptography we have a key pair (a public key and a private key) and one-way mathematical functions (eg. EC multiplication where you can compute a public key from a private key but you cannot compute the private key by having the public key). That irreversibility means you can safely share your public key, and this is important for verification step below. When you want to prove you are the owner of a private key, you have to produce something called "digital signature" using one of those mathematical functions (in this case ECDSA). This signature can be verified by anyone who has the message (in this case the transaction) and your public key. Satoshi took these concepts and created a stack-based Forth-like language known as "bitcoin scripts" that act as smart contracts. They contain certain commands and conditions that need to be met for them to "pass" and your transaction to be valid. "learnmeabitcoin" link above explains them well enough. Usually it is a simple single signature verification using ECDSA with the public key you provide in the signature script. That way your coins are only spendable by you, assuming you are the only one holding the private key.
0 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#6Mar 26, 2024, 12:59 PM
I just want to remind that private key is also used to generate public key and public key is used to generate address. Proper wallet use secure RNG (e.g. /dev/urandom). Usually it's more secure/safe compared with people who try to generate their own private key.
2 Reply Quote Share
im_altSenior Member
Posts: 130 · Reputation: 817
#7Mar 26, 2024, 02:55 PM
Thank you so much for identifying this. it really opened my mind to every other comment from this thread. I’m learning a lot from this forum. now I can say have understood what bitcoin does when we make a transaction just from this thread. Im really happy I’m getting the right information with less stress. thank you all
2 Reply Quote Share
paul.stakeHero Member
Posts: 651 · Reputation: 3798
#8Mar 28, 2024, 06:32 AM
The ECC (elliptic curve cryptography) questions are the best kind of questions. Learnmeabitcoin and Mastering Bitcoin are two good places to learn more about the ECC that is used in bitcoin. It's generally considered safe to use RNG like /dev/urandom and most reputable wallet software use that, but if you're extremely paranoid with random number generation, you can use a dice. There are many airgapped devices that allow you to import the results of dice rolls (or coin tosses) to create your seed phrase. One of them is seed signer, and I've written a review about it in here. Coldcard also supports dice rolls, IIRC.
0 Reply Quote Share

Related topics