Author

Topic: Is there a REAL guide for starting from the PRINCIPLES? (Read 1956 times)

member
Activity: 65
Merit: 10
The choice to check if a hash is BELOW the target is arbitrary.  Satoshi could have just as easily decided to make valid hashes ABOVE the target.

So the game could have been to find a hash higher than a target beginning with FFF..... or FFFFF.... etc.

It's amazing how understanding one tiny detail can open up bigger knowledge. So I see understanding almost like exponentiation; one leads to another, leads to another, leads to another...

That details (of the target being arbitrary) was nagging me, thanks for clearing it up. Now I can move on...
donator
Activity: 1218
Merit: 1079
Gerald Davis
But what about my other question?...
Could we use another leading number for the target (assuming the protocol was redesigned to accept it)?
Quote
would it be just as difficult if the target started with 8s instead of 0s?

Yes however (potential hash) < (target) it simple, easy (well relatively easy) to explain, and gets the job done.  There is no way to do it in a more difficult or complex manner.  You could for example look at some other characteristic of the blockhash (like the number of sequential same digits i.e. a hash containing 4444444444 is higher difficulty than one containing 999999999.  You gain nothing by doing that (or looking at the number of 8s) over simply comparing two hash values.

The choice to check if a hash is BELOW the target is arbitrary.  Satoshi could have just as easily decided to make valid hashes ABOVE the target.   

The target is simply a way to split the SHA-256 hash space into valid and invalid hashes.  The lower the target the fewer valid hashes there are and thus it will on average require more attempts to find a valid hash.

Forget cryptography for a second lets say you ran a store and wanted to give away 1 prize per day on average.  Right now you have roughly 20 customers one method you could use is to have a bucket with 1,000 numbers on it.  You could then daily publish the "magic number".  Each customer after a sale could draw one number from the bucket.  If it is smaller than the "magic number" then they win, otherwise they lose.  Now since you want to award on average one prize per day and you have roughly 20 customers per day you could start the magic number at 50.  (1/20*1000 = 50).  Note the magic number is arbitrary and depends on:
a) how often you want to award a prize (daily)
b) how many attempts will be made per unit of time (20 customers per day)
c) how many potential numbers there are (1,000)

If you used this system somedays you might award 4 or 5 prizes and some days you might award none.  You could even go weeks without awarding a prize but in the long run (say over a year) the average number of prizes awarded would be 1 per day. 

However what happens if the number of customers changes?  If you don't get 20 customers a day then your magic number is incorrect and your won't award prizes at the right frequency.  You could however once every two weeks look at all the sales in the last two weeks and divided by 14 to get the average customers per day.   You then could change the magic number to be = (numbers in the bucket) / (number of customers in prior two weeks / 14).

That is all Bitcoin is doing.   The goal of Bitcoin is that regardless of the amount of hashpower used one block will be found on average every ten minutes.  The protocol estimates the amount of haspower every 2016 blocks (by looking at how long it took) and adjusts the difficulty to make is easier or harder to find blocks in the future.
hero member
Activity: 602
Merit: 500
When I started this thread I was just hoping to get links to some good reads...but it took a turn into the unknown  Roll Eyes

I don't think that's ADD, I think that is how everyone is who takes 'understanding' seriously.
For myself though, I 'understand' bitcoin, as well as I need to, because I accept my high-level ignorance in favor of a more practical understanding. I read some of the early treatises of bitcoin explanations (you might want to dig into the forum archives, people were more interested in discussing the low-level bitcoin foibles in '09, '10), and recognized my limitations on understanding and caring.
Once you find your own level of acceptance I think that will help with bitcoin adoption. There are many reductions of bitcoin, and very few of them require understanding of SHA-256 protocol in-depth, simply acceptance that it does what it needs to.


Hope that is somehow helpful.
member
Activity: 65
Merit: 10
When I started this thread I was just hoping to get links to some good reads...but it took a turn into the unknown  Roll Eyes
legendary
Activity: 1708
Merit: 1010
it's hard for me to 'grok' concepts unless I start from the bottom. But I consider myself disabled in anyway.

You mean that you need to understand why you're doing particular things rather than just following a recipie, and I can relate.  However, I actually some background in cryptology and economics; and it took me weeks to wrap my brain around Bitcoin's elegant protocol.  I think that he's right, you might not have the technical background to understand from "first principles".

When I say principles I'm not talking about physics/electrical engineering. I have been doing computer programming for many years so I feel I'm competent enough. For example computers can be explained from first principal to user-facing apps in a handful of pages and still get the reader to comfort level where he can start creating apps.

Well, I'm not a programmer myself but understand computers and how they function to that level.  Particularly with regard to GNU/Linux from the kernal, posix commandline tools, to Xservers, to window managers up to the GUI suites.  I question whether either the cryptographic functions, nor the economic theories, that Bitcoin is based upon could be explained in a handful of pages.  Everything seems simple enough, once you're on this side of the enigma, but this is not a topic that many people can ever understand.  Satoshi was a polymath.
member
Activity: 65
Merit: 10
it's hard for me to 'grok' concepts unless I start from the bottom. But I consider myself disabled in anyway.

You mean that you need to understand why you're doing particular things rather than just following a recipie, and I can relate.  However, I actually some background in cryptology and economics; and it took me weeks to wrap my brain around Bitcoin's elegant protocol.  I think that he's right, you might not have the technical background to understand from "first principles".

When I say principles I'm not talking about physics/electrical engineering. I have been doing computer programming for many years so I feel I'm competent enough. For example computers can be explained from first principle to user-facing apps in a handful of pages and still get the reader to comfort level where he can start creating apps prepare what he needs to start creating apps in the most efficient way.
legendary
Activity: 1708
Merit: 1010
it's hard for me to 'grok' concepts unless I start from the bottom. But I consider myself disabled in anyway.

You mean that you need to understand why you're doing particular things rather than just following a recipie, and I can relate.  However, I actually some background in cryptology and economics; and it took me weeks to wrap my brain around Bitcoin's elegant protocol.  I think that he's right, you might not have the technical background to understand from "first principles".
legendary
Activity: 1708
Merit: 1010
Shame I'm willing to pay for a decent ebook.


Well, you do have a point.  So once you know what you need to know, write that ebook.
member
Activity: 65
Merit: 10
The hash of password1 will always be the same, and the hash of password999 will always be the same, so the question doesn't make sense.
You're right, my question was poorly worded there. Fair enough.

But what about my other question?...
Could we use another leading number for the target (assuming the protocol was redesigned to accept it)?
Quote
would it be just as difficult if the target started with 8s instead of 0s?


Quote
I'm curious as to why you want to start from first principles? Doesn't really sound like you have the background to do such a thing. Not meaning to sound insulting or anything.
I think I have ADD (a learning disability, I think) so it's hard for me to 'grok' concepts unless I start from the bottom. But I don't consider myself disabled in anyway.
hero member
Activity: 602
Merit: 500
Take the hash of password + nonce for nonces 1 through 1000 (or until you get board).
DeathAndTaxes, I took you up on your offer but took a shortcut Cheesy here we have it...Honestly I have no idea which hash is larger or smaller...

password1
0b14d501a594442a01c6859541bcb3e8164d183d32937b851835442f69d5c94e
password999
29fe5f91a54c416bd44a48640b7b286a205cc1bd85741fa2a599e6d41ed5884b

So is it possible that the hash of password1 could be LESS than hash of password999 or viceaversa?

I mean why zeroes, would it be just as difficult if the target started with 8s instead of 0s?

The hash of password1 will always be the same, and the hash of password999 will always be the same, so the question doesn't make sense. The two hashes will always be what they are, and if one is less than the other (depending how you are defining less) that is what they will always be.

I'm curious as to why you want to start from first principles? Doesn't really sound like you have the background to do such a thing. Not meaning to sound insulting or anything.
member
Activity: 65
Merit: 10
Take the hash of password + nonce for nonces 1 through 1000 (or until you get board).
DeathAndTaxes, I took you up on your offer but took a shortcut Cheesy here we have it...Honestly I have no idea which hash is larger or smaller...

password1
0b14d501a594442a01c6859541bcb3e8164d183d32937b851835442f69d5c94e
password999
29fe5f91a54c416bd44a48640b7b286a205cc1bd85741fa2a599e6d41ed5884b

So is it possible that the hash of password1 could be LESS than hash of password999 or viceaversa?

I mean why zeroes, would it be just as difficult if the target started with 8s instead of 0s?
donator
Activity: 1218
Merit: 1079
Gerald Davis
http://www.xorbin.com/tools/sha256-hash-calculator

Here is a hash calculator.

Take the hash of password + nonce for nonces 1 through 1000 (or until you get board).

Write down the outputs and let me know if they are increasing or decreasing in any predictable pattern.  If you could predict the output of SHA-256 it wouldn't be a cryptographic hashing function and it would have security ramifications that go far beyond Bitcoin.
member
Activity: 65
Merit: 10
The SHA-256 hash of
Code:
password
will ALWAYS be
Code:
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8

Always, always, always.

I know this but what confuses me is that we are looking for a value that is LESS than a "target". This suggests to me that the hash value will INCREASE or DECRESE depending on the nounce. When something is increasing, or decresing, it has a predictable quality doesn't it? This is that part that REALLY puzzles me.

Or to put it in another way, if the output of the hash function is completely unpredictable, wouldn't it be possible for the first nounce I try will be less than the target and the 1000th one be over the target?
member
Activity: 65
Merit: 10
Thanks for the replies so far. Stephen, I actually read that ebook the other day an I thought it was useless for me, it just didn't have any valuable info in it for me. I felt like more like a glancing over than an intoduction. But I think it maybe helpful to complete freshie but I doubt that too.

As for you're answers to my other questions, it was helpful. I understand now we are comparing the binary values. This is the kind of info I hoped to find in an introductory writing. So I guess I'll have to just piece together bits of knowledge and learn that way. Shame I'm willing to pay for a decent ebook.


donator
Activity: 1218
Merit: 1079
Gerald Davis
Quote
Wait a minute, if a hash if unpredictable, how can it be quantified and thus be "smaller" than a given amount.

Well that might make understanding things difficult.  Hashes are never unpredictable.

The SHA-256 hash of
Code:
password
will ALWAYS be
Code:
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8

Always, always, always.  Today, tomorrow, 100,000 years in the future.  On any OS, any hardware, anywhere on the planet the hash of password will always be the number above.  If ever the SHA-256 of password wasn't the number above it would mean a catastrophic failure of SHA-256.  It would render Bitcoin useless overnight.  How could you verify tx and blocks if the hash you computed was different than what the creator computed?

"wait number?".  Yes the otuput of a hash function is a number.  Rather than try to represent than number as binary (it would be a sequences of 1s and 0s 256 digits long) or base 10 (a useless representation as no computer works on base 10 and no human can compute numbers that large in any reasonable timeframe)  they are often represented as strings (either in hexadecimal as above) or in other encoded formats (base58).
legendary
Activity: 2506
Merit: 1010
I'm trying to find an article or ebook that explains everything in detail.

Free download:

Introduction to Bitcoin Mining
 - https://www.coindl.com/page/item/201

For example i see this a lot: mining is to find nouce so that sha256(sha256(data+nounce)) < difficulty. Wait a minute, if a hash if unpredictable,
It is not unpredictable.   sha256(sha256(data+nonce)) will determine the same result every time.  What is unpredictable without doing the work is which nonces will result in a hash that results in a low enough value.

how can it be quantified and thus be "smaller" than a given amount. I though a hash was just a random set of strings (not a number Huh).

Strings have binary representations.  Binary representations can be compared.    So there is no difference between a string and a number.  

The example in this Bitcoin wiki article shows an example of multiple nonces until a low enough hash is found:
 - https://en.bitcoin.it/wiki/Proof_of_work


And if a miner solved a block with only one txn(say #404) in it and another miner solves a block with ten in it which also includes txn #404, then what, will that txn be in both blocks?

Yup, but only one block will end up winning, as eventually the longest chain will include one of those blocks and orphan the others.   A miner should work off the block greatest height.  If multiple blocks are at this height, whichever block arrives first is the one to mine against.
member
Activity: 65
Merit: 10
I want to start mining but I'm not the type to just go along with what everone else is doing. I don't feel confortable with just going to buy some video cards without understanding the principles. Yes I've looked at the "Beginner's Guide" but that's not helpful at all for me because it assumes that I'm just a crowd follower. Just look at the first link under "3. How To Get Started With Mining" The first link is "What is Pool Mining" ...um... you see where I'm going with this? Undecided

 I'm trying to find an article or ebook that explains everything in detail. For example i see this a lot: mining is to find nouce so that sha256(sha256(data+nounce)) < difficulty. Wait a minute, if a hash if unpredictable, how can it be quantified and thus be "smaller" than a given amount. I though a hash was just a random set of strings (not a number Huh)... And if a miner solved a block with only one txn(say #404) in it and another miner solves a block with ten in it which also includes txn #404, then what, will that txn be in both blocks?

These are just an example of the many ways I'm confused about this. There has to be a good resource out there (no I'm not talking about the Wiki - which is good but too fragmented) and I'm hoping somebody can point me to it. Sorry for the rant...
Jump to: