Functions, Hash Functions, Cryptography - Discussion

yes it is
but for verifying a newly made block, to check that it is made using hash of previous block ,we need to get back to the input( hash of previous block) given the output. if not, how is it verified?

You don’t need to rehash the previous block, unless you want to verify it. The part of the block that gets hashed is the block header, which consists of the version, previous block hash, merkle root of transactions, timestamp and nonce.

This data is stored in the block and anytime you want to calculate its hash again, you just input this data and will get the desired block hash as the output.

To construct a new block you take the output of the previous block and combined with the rest of the data do it all over again. :slight_smile:

3 Likes

thank you very much.
useful explanation :smiley:

I have a question. It may be very obvious but I am still a beginner and I was just a little confused.

If you use your private key to sign transactions can’t people just see your private key and then proceed to steal your coin and account?

No, because of the way signatures work. The signature returns a new number that is related to the private key but it does not expose it. A good explanation on how public key cryptography works is at the start of the privacy course in our academy :slight_smile:

1 Like

Being new to this and having no technical or programming experience, it appears that I just need a foundation of knowing that cryptocurrency is all about 1) Functions, 2) Hash Functions and 3) Cryptography. I’m sure I will be here asking plenty of questions.

1 Like

Thanks for this , this actually made it easier to get my head around the # .

1 Like

A very secure random generator creates you private key. A public key is created using cryptography ā€œeliptic curveā€ hashing from that distinct private key. Then the public key is run through the SHA-256 and RIPEMD160 processes to create an address which is using to receive BTC (or send once received at the address). The address is verified by sending a ā€œsignatureā€ which is another hash based on the private key, transaction data specific to the the sender, receiver and the transaction itself. This new ā€œsignatureā€ is now send with the public keys for verify and accept the BTC at the previously generated address. While the public key is now visible without the additional SHA-256 and RIPEMD160 hashes, it is associated only with the newly created address. Once BTC is received at that new address, it can be removed from that address, making a direct attack on the unhashed public key a very small window of opportunity. For maximum security, the new address should be used once. For example, do not receive 10 BTC and send 2 from that new address, leaving 8 BTC in that new address. The address would be relying ONLY on the Eliptical Curve hashing of your private key into the public key. And they would be no time constraint on possible hacking if the address was used a second time. Always using a new address is the best practice.

1 Like

Public key is run through these hash functions :slight_smile:

The reason public keys are hashed is basically just to save on storage because the hash is smaller in size than the public key and where would you remove the funds once received? There is no need once they are there, unless your private key is compromised.

Oooops I wrote private instead of public. Thanks.

About moving funds out of the address. My understanding is very shakey on this. I was wondering if the address which was used to receive the BTC is actually a wallet address. At present, I understand that, sending some of the BTC from that wallet address, would reduce security somewhat. And that to maintain 100% of all hashes securing the remaining 9 BTC, it would be best to select a new address and move the 9 BTC to that address after sending 1 of 10 BTC from the original address. Of course, if the amount of BTC remaining was 0.0001, the reduced security would not worth worrying about. If it was 9,000 BTC at that address, then worth the effort. My goal is mainly personal investment and CORRECTLY teaching others so they don’t lose anything or get hacked. Am I close enough, in my understanding now? Thanks for correcting me. If I was younger, I would be taking the full programming course.

Reusing addresses may impact privacy, mostly if someone knows your address, one can track your funds. But it doesn’t impact security :slight_smile:

1 Like

I hadn’t even considered privacy, even though I generally watch that. Excellent point.

Raquel

1m

So it generates a Hash of a public key to protect the prĆ­vate key, because there are Connect. So it Change the public address each time we make a transaction. To protect the prĆ­vate key, it generales a signature (elĆ­ptic curve+a number). Is this correct ??

And is this how a cold wallet works ? Because it change BTC address for each transaction.

No, the main reason to hash the public key is to save on storage, hash is smaller (20 bytes) than the public key (65 bytes) :slight_smile:

Hardware wallets are HD (hierarchical deterministic) wallets, that means they use a master key (fancy name for root private key) to generate new private keys and addresses they are described in BIP32

1 Like

Oki more clear now, thanks for the explanation :smiley:

In blockchain demo - coinbase transactions.- Having the miners to verify that the transaction is real because we have the funds, do we make the funds in our porfolio public ?

I’m not sure I understand the question. Transactions get verified by every node that receives the transaction before they even become part of a block.

The funds are stored in addresses that are public, but unless someone makes a connection to a physical person they are basically private. This is what we mean when we say the Bitcoin blockchain is pseudo anonymous.

The issue is that most people today buy their coins on exchanges where they did KYC, so there is a connection to the addresses they withdrew to.

1 Like

Thanks for answering the question, I didn’t know that KYC could compromise the accounts. It’s a good boost to use DEX :sparkles:

That is basically the reason why KYC was made mandatory for exchanges :stuck_out_tongue: DEXes are great, but they are quite hard to use as a FIAT on/off ramp. There is Bisq exchange that is quite interesting.

1 Like

Thanks for the info, I will check it :smiley: