Why change the nonce instead of just rehashing?


The hashing function used in Bitcoin is deterministic, that is hashing the same input, i.e., block header, will always result in the same output. This is necessary so that others can also check that a Proof-of-Work is valid.

This means that in order to compute a new hash the input to the hash function needs to be altered. The easiest way to alter the input is changing the nonce since this is a free-form field that may take any value. Other ways to modify the input is for example swapping transactions or modifying the coinbase transaction, which would require that the merkle root be recomputed in the header. The timestamp is also a popular choice, however its values are limited by a range of acceptable times.

In case you are wondering why we don't simply rehash the output of the previous hashing function to get the next value: this would destroy the proof-of-work mechanism, which requires an easy to verify proof that the issuer has performed some work. The key here is...

0 0

Yes, you're correct. Without the nonce, we could still generate valid blocks. However, to get a different hash we need to change the input for the hash. The input for the hash is the block header.

If there were no nonce, we would have to change something else about the block header for each try. That would only leave the timestamp or the Merkle root. Other header items are fixed.
The timestamp is icky, because we would like it to show the actual time. So, we'd have to change the Merkle root.

The Merkle root calculated by hashing all transactions in the Merkle tree where they are listed. If we change e.g. the Coinbase or the order of the transactions in the tree, we could also gain another different combination to try. But to do so, we'd have to recalculate the Merkle root.

Rather, we put a nonce in the header directly that allows us to use the same block candidate for a number of different hashing attempts.

Hence, the nonce is used to introduce...

0 0

My understanding is that at a certain point, once hardware passed the 4 GH/s level, the 4 billion possible values for the nonce became insufficient in bitcoin mining, because a good rig could exhaust them all in less than a second, and then had to wait until the next second for the timestamp value to change and then try the next 4 billion.

The thing I don't get, though, is why they couldn't adjust the timestamp in increments of less than one second? What about milliseconds and nanoseconds? Why not adjust that input instead of the nonce range?

Edit: Is it that the timestamp has a fixed format that ends at seconds, and changing this would be more difficult / less efficient than simply appropriating space from the coinbase...

0 0

There's a difference between what is called a "golden nonce" in the context of the source and a valid block header hash.

To reduce payout variance, miners group into pools and share their income proportionally to their hashpower.

To determine each miner's hashpower, pools use a share system: when you are mining and find a block header of high difficulty (with lots of heading zeroes) but not high enough to be above the current target, you send it to the pool. These difficult-but-not-enough headers are called "shares".

Since finding them is way more frequent than blocks (miners often send several of them per second), no matter how small your hashpower is, it will still be taken in account at payout time even if you're unlucky. The more shares you send, the more hashpower you have, the bigger the share of the pool's income you will get.

They are not broadcast to the bitcoin network, since they would be immediately rejected there and are of no value to...

0 0

The block hash has to be below a certain value and the block hash depends (among others) on the nonce and on the Merkle root.

The Merkle root depends on the sequence of transactions. Note that it's a sequence, not a set, meaning the order is important.

Different miners choose many different lists of transactions. For every list of transactions with the other fields which go into the block hash, chances are there is no 32 bit nonce which will make the block hash low enough to qualify as a new block on the blockchain. So miners add a transaction, or remove one, or permute some to get a different Merkle root all the time.

I'll just calculate the time an AntMiner S9 with a hash rate of 14 TH/s takes to go through all the numbers in a 32 bit field (2^32 hashes) for you:

2^32 H / (14 TH/s) = 2^32 / 14 / 10^12 * s = 0.30678 ms

To answer your second question: Network traffic takes longer than 0.3 ms. To give you an impression on it: In fiberoptic cables,...

0 0

I set out to test the claim: "Every nonce has an equal chance of winning."

So, I plotted, with gnuplot, the nonce values vs. hashes for all the valid blocks in the blockchain:

(Also, in the last plot, you can really visualize the change in the difficulty and even see where the difficulty was decreased.)

It makes sense that the nonces found are skewed toward 0 because this is a selection effect: most everyone starts searching for nonces starting at 0, so the lower nonces are found first, even though there may be also higher nonces that could produce a winning block:

Why are the hashes distributed this way, though?:

2-D histogram of hashes and nonces (logarithmic color scale):...

0 0

In Part 1 we took a look at the incentives involved in Bitcoin mining and how they are used guarantee a single transaction history needed to prevent bitcoins from being double spent. In this post we will take more a technical look at the cryptography involved and how it is used to secure the network. As I said previously, Bitcoin is very accessible. While we will be discussing cryptographic concepts, it shouldn’t discourage you from continuing further.

Cryptographic Hash Functions

Before moving forward we should take a moment to learn about hash functions since they are used all throughout the Bitcoin protocol. To put it simply, a hash function is just a mathematical algorithm that takes an input and turns it into an output. For example, suppose we have an algorithm which just adds all the digits in the input string together. If our input is 1234 we would get an output of 10.

1234 ==> 10

Simple enough. However, there are certain properties of really good hash...

0 0
0 0

In a constituency with the lowest turnout in the country, Labour veteran Alan Johnson knows he needs a big pitch for Stoke-on-Trent voters.

“There are three big events; there’s the EU referendum, the American election and the Stoke-on-Trent byelection,” he tells rows of students assembled at Stoke sixth-form college.

Gareth Snell, Labour’s candidate in the town’s upcoming byelection, is standing beside Johnson on the podium. Snell faces a similar fight against the same forces of rising populism that elected Trump, Johnson says, in the shape of Ukip leader Paul Nuttall.

“It is not hyperbole to say this is crucial in Stoke. Ukip have one MP, their leader is standing in this election,” he tells the group, straining to be heard above the noise from the nearby lunch tables. “He doesn’t care about Stoke, and Gareth is steeped in this area, his kids go to school here. Gareth’s vision is for what happens to cities like Stoke after Brexit. Your decision is about where...

0 0

Practically, for double hashing, I use table size 2^N, and two hash functions, computes values h1(position) and h2(step). Step must be odd, for comply condition

gcd(table_sz, step) == 1

When this condition complied, probation index iterates all cells in the table.

Thereafter, I just iterate table with indexes (pos), (pos+step), (pos + step + step), and so on, modulo to table_size.

Main loop of program seems like:

do { pos = (pos + step) & (TAB_SIZE - 1); } while(table[pos] have collision);

See simple example of implementation here:


interesting implementation, when you have TAB_SIZE = 2^16. In this case, you can define variables (pos, step) as unsigned short, and do not need apply mask (TAB_SIZE - 1); Instead, you just write:

pos +=...
0 0

The WordPress admin should use nonces instead of checking referers to prevent CSRF attacks because of the improved usabililty provided by nonces.

Patch includes replacement check_admin_referer() function that uses nonces instead of verifying referers. check_admin_referer() now accepts a nonce action as an optional parameter, which is used to verify the incoming nonce.

Several new functions in functions.php create and verify nonces and facilitate their use. For example, to modify a url to add a nonce, call wp_nonce_url($url, $action), where $action is the action to be verified by the nonce.

The patch makes modifications only to employ a nonce for deletion of posts when js is disabled on the Manage Posts page. Also, the inline-upload.php has been modified slightly so that urls it generates are more nonce-friendly. (inline-upload.php calls check_admin_referer() even when no input is expected!)

Plugins should not be affected by...

0 0

Note from Alex: This is taken from my ebook The Ex-Girlfrend Solution. It helps to lay the foundation for the rest of my teachings by discussing how getting over an ex before getting back together with her can actually be very beneficial to both you and her.

It is almost impossible for me to count the amount of guys I have spoken to about their ex-girlfriends over the years, but it sure is a lot. If I should do a recap, the theme that has occurred the most is this:

Girl dumps Guy, Guy is confused, Girl is equally confused so she keeps calling him, Guy misinterprets the calls and wants her back, Girl finds someone new and Guy is hurt all over again.

This happens very often, and it is a terrible situation. The situation has many variations, but it usually ends the same way. And the worst part of it all is that the man in this has absolutely no power and no control. The girl is in charge, and the man is left to be her marionette puppet.

Don’t make...

0 0

Don’t read this post while eating.

In college I spent part of a summer at John Denver’s Windstar program in Colorado. We ate macrobiotic food, slept in teepees, practiced Aikido, and were treated to lectures by Buckminster Fuller — inside the teepees. Windstar had a pithy water-conservation saying for the toilets: “If it’s yellow, let it mellow; if it’s brown, flush it down.” Which is certainly one way of handling it.

I was recently in Amsterdam, and the Dutch have a more ingenious way of handling “it.” Instead of one flush lever, there are two — one large and one small — for two different volumes of water, depending on what the job calls for. When I figured out why there were two levers, I had one of those confusingly satisfying “Why didn’t someone think of that before?” moments. A few of my other favorites:

Countdown clocks on pedestrian “walk” signs. How stupid was it for us all to bet our lives on when the sign was going to change? The 60-mile long Breast...
0 0

What about a revolution makes a leftist party any less likely to be corrupted than if it came to power by vote? If you want corrupted leftist parties which came to power through revolution, I can name plenty.

By instituting socialism immediately, by creating workers unions and the likes, you are giving that "Socialist party" barely any power at all. Socialism is de facto highly decentralized and the power is directly in each workers hands through direct democracy where the nation votes. Unless you are a monarchist or the like, I don't imagine people giving up their voting power is likely to occur and so almost everyone in a socialist revolution would be socialist anyway, unless you were a member of the capitalist class.

Revolutions grant the political party in charge near-total power, which, more often than not, they choose to use hunting down and executing their political opponents or perceived political opponents.

Most people don't think that way. Give the...

0 0

Это ваша лента, где вы будете проводить большую часть времени, получая мгновенные уведомления о том, что интересует именно вас.

Наведите на изображение профиля и нажмите кнопку чтения, чтобы перестать читать любую учетную запись.

Самый быстрый способ поделиться чьим-либо твитом с вашими читателями — ретвитнуть его. Нажмите значок со стрелочками, чтобы мгновенно сделать это.

Поделитесь своими мыслями о любом твите, просто ответив на него. Найдите тему, которая вам интересна, и вступайте в беседу.

Мгновенно узнавайте о том, что обсуждают люди прямо сейчас.

Читайте больше учетных записей, чтобы получать мгновенные обновления о том, что вас больше всего интересует.

Читайте самые последние беседы на любую тему, мгновенно появляющиеся в вашей ленте.

Следите за тем, как разворачиваются лучшие...

0 0

“If you do not create change, change will create you.” ~Unknown

We are often resistant to change, and we don’t realize that change itself is constant.

Even if you resist or avoid it, it will enter your life just the same. When you initiate the change yourself, it’s pretty easy to adapt to it, since it’s a wanted one.

But are the unplanned and unexpected changes bad? What if all changes were good by default?

I have been embracing change since a young age. During my life I have lived in five countries and in over twenty-five apartments, changed five schools and about five different careers.

At first it is a bit difficult and annoying, but after a while you get used to the change so much that if it doesn’t come for a while, you end up moving the furniture at home in order to feel something changing.

Changes connected with moving from country to country impacted my personality. Thanks to them I became more flexible and open-minded. Now...

0 0

We're with you. In some ways, the headline above gives us a sinking feeling, too. It seems like the words "fail" and "habits" go hand-in-hand — don't we all have at least one tendency (and often more) that we obsess about and wish we could change, but just can't manage to drop?

As it happens, SmartyPants is a company that's also fairly obsessed with finding the best solutions in health and wellness. We decided to dig into the research and figure out how to turn our bad habits into good ones once and for all.

Here are the things about human nature that keep us failing to change. Clear these five hurdles, and you're well on your way.

We think we can figure it out as we go

Going to just "wing it" and expect to totally revamp your drinking habits? It doesn't work that way. Research shows that specific plans are easier to achieve. For each behavior you want to change, devise a set of specific, realistic goals that help get you there. Maybe that's "I'm...

0 0