Functions, Hash Functions, Cryptography - Discussion

The terms and conditions you are usually accepting are for the platform not the contracts in particular there is nothing preventing you from interacting with these contracts manually or creating your own interface to do it. Also most of the times these contracts are open source so you are always able to check their source code to verify them. :slight_smile:

1 Like

thank you Alko89 i got your point. :white_check_mark:

I am trying to understand this:

  1. Calculate the output of the following function
f(x) = {

x^2 if x is even       does the symbol after the x mean and? is the two mean squared? if x is 2 then 2 squared for 4?

x+10 if x is odd        if x is 7 = 17....why do they say if x is odd?

and then what is c? if x is 0....which function is the 0 applying too?

I don't feel so smart today.

}

What will be the output for the following inputs?

  • a) f(2)
  • b) f(7)
  • c) f(0)
1 Like

It is a symbol for exponent(raised to the power). X^2 means X raised to the power 2, or you can call it X squared 2.

1 Like

It is part of the question, if the value of x is odd then f(x) = x + 10, if it is even f(x) = x^2.

1 Like

0 is an even number.

1 Like

thank you for Maki, aah i get it, if they gave you the value of x and it was an odd number then you apply it to that x + 10 equation. if it was odd then you apply it to the x^2 equation…

1 Like

Correct, if it is even you apply it to the x^2 equation.

2 Likes

The reason why bitcoin is called cryptocurrency is because it makes use of cryptography in the design of bitcoin. Private is like our passsword and Public key is like our account no.
The hash functions add extra protection on our public keys.

3 Likes

None of us know how long we have to live. Just keep doing what you came into physical existence to do.

Thanks for sharing the video! I just watched a little of this video and the guy says that once a Bitcoin has been spent it gets greyed out and the blockchain gets updated. I noticed that when he greyed out the Bitcoin he altered a previous blockchain. My understanding from IOT is that recorded blocks on the blockchain are immutable so maybe he should have shown it a different way?

1 Like

Its been so long since I watched the video I forgot how it was presented :sweat_smile: but you’re right. Once the once you use your UTXO in a tx it is marked as spent, by this I mean that it has a been referenced in a new tx and therefore cannot be used again. :slight_smile:

2 Likes

Hi, I’ve been learning about tx and UTXOs, but I don’t understand the part in which you have to spend all the UTXO. If you have a UTXO with 0.4 btc and another UTXO with 0.5 btc, and you want to buy a bike with 0.7 btc, why can’t you just send 0.7 and keep the extra 0.2 instead of making a transaction with the 0.9 btc that you have and having to send the 0.2 back to you?

If someone knows the answer I would like to hear it thx :slight_smile:

1 Like

Because it would make the blockchain mutable since you would have to update the value in the block to reflect the change.

3 Likes

Hopefully other countries take China’s place so hash doesn’t go down.

Question:

You have to spend the entire input in a transaction. Does that mean you have to spend ALL inputs in your wallet? Or just ALL of the individual inputs that give you enough to cover the output + fee?

i.e.

You have 5 inputs in your wallet:
.2
.4
.5
.7
.9

You have an output of 1.3

Do you have to send all 5 of those inputs?
Or do you send ALL of a few inputs (.7, .5 and .2)?

Thanks

You don’t have to spend all, you just have to send the amount that is enough to cover your transaction.

  • Data / Transaction / Random # Generation ; # Between 1 & 2*256th Power / Function = (((Private Key)))

  • Private Key (X) Elliptic Curve = (Y) ; (((Public Key))) converted Binary.

  • Public Key + Hashed SHA256 (x) 2 = (((Public Key))) + Public Key + Hashed RIPEMD160 (X) 2 = (((Public Key))) COMPRESSED. to 32bit number

  • Address = COMPRESSED Public Key + Base 58 / Version Bit 00 (x) SHA256 (X) RIPEMD160.

1 Like

Hi,

I’ve just started my next lesson and it brought me here, so I don’t really have any questions at the moment, but I’m enjoying the course and going through it. I’ll be back again im sure of it :slight_smile: until then happy studies!

With a merkel tree, you take slices of something that you want to hash. Let’s suppose, there is n number of slices and you hash each slice. Each slice will be a certain size or less. You will have n number of hashes. You pair the adjacent hashes, you combine them, and hash each combination of pair adjacent hashes. You keep doing this process until you get only one hash. This hash is called the merkel root. Each level of the merkel tree that you ascend has about half of the number of hashes that the level below it has. If any level has an odd number of hashes then the remaining hash will be brought up to a level that has an odd number of hashes that way it can be paired up with the remaining hash of that level.