SHA-256 Algorithm – Encryption – BitcoinWiki

What does it mean to have a Bitcoin? How the Bitcoin protocol works - Full explanation here.

Stumbled upon this little gem a while ago and I wanted to share this with you all as it's helped me understand the whole concept of Bitcoin greatly. I hope this helps more people like it did for me, so I'm spreading the word via this transcription as this was originally produced in video format.
Many people have heard of Bitcoin; that it's a fully digital currency with no government to issue it, and that no banks need to manage accounts and verify transactions, and also that no one really knows who invented it - and yet many people don't know the answer to this question.
At least not in full; to get there, and to make sure that the technical details underlying the answer actually feel motivated, what we're going to do is - walk through step by step how you might have invented your own version of Bitcoin.
We will start with you keeping track of payments with your friends using a communal ledger, and then as you start to trust your friends and the world around you less and less, and if you're clever enough to bring in a few ideas from cryptography to help circumvent the need for trust - what you end up with is what's called a crypto currency.
You see Bitcoin is just the first implemented example of a crypto currency, and now there are thousands more on exchanges with traditional currencies, walking the path of inventing your own, can help to set the foundations for understanding some of the more recent players in the game, and recognizing when and why there's room for different design choices.
In fact one of the reasons I chose this topic is that in the last year there's been a huge amount of attention and investment, and well honestly - hype directed at these currencies and I'm not going to comment or speculate on the current or future exchange rates, but I think - we'd all agree that anyone looking to buy a crypto currency should really know what it is - and I don't just mean in terms of analogies with vague connections to gold mining, I mean an actual direct description of what the computers are doing, when we send, receive, and create crypto currencies.
One thing worth stressing by the way, is that even though you and I are going to dig into the details here, and that takes meaningful time, you don't actually need to know those details - if you just want to use the crypto currency, just like you don't need to know the details of what happens under the hood when you swipe a credit card - like any digital payment, there's lots of user friendly applications that let you just send and receive the currencies without thinking about what's going on.
The difference is that the backbone underlying this - is not a bank the verifies transactions, instead, it's a clever system of decentralized trust list verification based on some of the math born in cryptography.
But to start, I want you to actually set aside the thought of crypto currency and all that - just for a few minutes, we're going to begin the story with something more down to earth ledgers and digital signatures - if you and your friends exchange money pretty frequently, you know paying your share of the dinner bill and such, it can be inconvenient to exchange cash all the time, so you might keep a communal ledger that records all of the payments that you intend to make some point in the future.
You know Alice pays Bob twenty dollars, Bob pays Charlie forty dollars, things like that, this ledger is going to be something public and accessible to everyone like a website, where anyone can go and just add new lines. And let's say that at the end of every month you all get together, look at the list of transactions and settle up.
If you spent more than you received, you put that money in the pot, and if you received more than you spent, you take that money out.
So the protocol for being part of this very simple system might look like this - anyone can add lines to the ledger, and at the end of every month, you all get together and settle up.
Now one problem with a public ledger like this, is that anyone can add a line, so what's to prevent Bob from going and writing Alice pays Bob one hundred dollars without Alice approving?
How are we supposed to trust that all of these transactions are what the sender meant them to be?
Well, this is where the first bit of cryptography comes in - digital signatures, like handwritten signatures the idea here - is that Alice should be able to add something next to that transaction that proves that she has seen it, and that she's approved of it. And it should be infeasible for anyone else to forge that signature.
At first, it might seem like a digital signature shouldn't even be possible; I mean whatever data makes up that signature can just be read and copied by a computer, so how do you prevent forgeries?
Well, the way this works is that everyone generates what's called a public key private key pair, each of which looks like some string of bits, the private key is sometimes also called a secret key so that we can abbreviate it as S.K while abbreviating the public key is P.K.
Now as the name suggests - this secret keep it something you want to keep to yourself; in the real world, your handwritten signature looks the same no matter what document you're signing, but a digital signature is actually much stronger, because it changes for different messages, it looks like some string of ones and zeroes - commonly something like two hundred fifty-six bits, and altering the message even slightly completely changes what the signature on that message should look like.
Speaking a little more formally producing a signature involves a function that depends both on the message itself, and on your private key, the private key ensures that only you can produce that signature, and the fact that it depends on the message, means that no one can just copy one of your signatures, and then forge it on another message.
Hand in hand with this is a second function, used to verify that a signature is valid, and this is where the public key comes into play, all it does is output true or false to indicate if this was a signature produced by the private key, associated with the public key that you're using for verification.
I won't go into the details of how exactly both these functions work, but the idea is that it should be completely infeasible to find a valid signature - if you don't know the secret key, specifically there's no strategy better than just guessing and checking random signatures, which you can check using the public key that everyone knows.
Now think about how many signatures there are with a length of two hundred fifty-six bits, that's two to the power of two hundred fifty-six; this is a stupidly large number - to call it astronomically large, would be giving way too much credit to astronomy.
When you verify that a signature against a given message is valid, you can feel extremely confident that the only way someone could have produced it, is if they knew the secret key associated with the public key you used for verification.
Now making sure the people signed transactions on the ledger is pretty good; but there's one slight loophole - if Alice signs a transaction like Alice pays Bob one hundred dollars, even though Bob can't forge Alice's signature on a new message, he could just copy that same line as many times as he wants.
I mean that message signature combination remains valid - to get around this, what we do is make it so that when you sign a transaction, the message has to also include some sort of unique ID associated with that transaction, that way if Alice pays Bob one hundred dollars multiple times, each one of those lines on the ledger requires a completely new signature.
Alright great, digital signatures remove a huge aspect of trust in this initial protocol, but even still - if you were to really do this, you would be relying on an honor system of sorts, namely you're trusting that everyone will actually follow through, and settle up in cash at the end of each month.
What if for example Charlie racks up thousands of dollars in debt, and just refuses to show up, the only real reason to refer back to cash to settle up - is if some people I'm looking at you Charlie owe a lot of money; so maybe you have the clever idea that you never actually have to settle up in cash, as long as you have some way to prevent people from spending too much more than they take in.
Maybe what you do is start by having everyone pay a high a hundred dollars into the pot, and then have the first few lines of the ledger read "Alice gets one hundred dollars, Bob gets one hundred dollars, Charlie gets one hundred", etcetera.
Now just don't accept any transactions; where someone is spending more than they already have on that ledger, for example, if the first two transactions are Charlie pays Alice fifty dollars, and Charlie pays Bob fifty dollars, if he were to try to add Charlie pays you twenty dollars - that would be invalid, as invalid as if he had never signed it.
Notice, this means that verifying a transaction requires knowing the full history of transactions up to that point, and this is more or less also going to be true in crypto currencies.
Though there is a little room for optimization. What's interesting here is that this step removes the connection between the ledger and actual physical US dollars, in theory, if everyone in the world was using this ledger, you could live your whole life just sending and receiving money on this ledger, without ever having to convert to real US dollars.
In fact to emphasize this point, let's start referring to the quantities on the ledger as ledger dollars or LD for short; you are of course free to exchange ledger dollars for real US dollars, for example maybe Alice gives Bob a ten dollar bill in the real world, in exchange for him adding and signing the transaction, Bob pays Alice ten ledger dollars to this communal ledger.
But exchanges like that, they're not going to be guaranteed by the protocol it's now more analogous to how you might exchange dollars for Euros, or any other currency on the open market - it's just its own independent thing - this is the first important thing to understand about Bitcoin or any other crypto currency; what it is - is a ledger, the history of transactions is the currency of course, with Bitcoin money, doesn't enter the ledger with people buying and using cash.
I will get to how new money enters the ledger in just a few minutes; but before that, there's actually an even more significant difference between our current system of ledger dollars and how crypto currencies work.
So far I've said that this ledger is in some public place like a website where anyone can add new lines, but that would require trusting a central location, namely who hosts the website, who controls the rules of adding new lines, to remove that bit of trust, we will have everybody keep their own copy of the ledger, then when you want to make a transaction like Alice pays Bob a hundred ledger dollars, what you do is broadcast that out into the world for people to hear, and to record, on their own private ledgers.
But unless you do something more, this system is absurdly bad, how could you get everyone to agree on what the right ledger is, when Bob receives a transaction like Alice pays Bob ten ledger dollars, how can he be sure that everyone else received and believes that same transaction, that he'll be able to, later on, go to Charlie, and use those same ten ledger dollars to make a transaction?
Really - imagine yourself just listening to transactions being broadcast, how can you be sure that everyone else is recording the same transactions? And in the same order?
This is really the heart of the issue, this is an interesting puzzle, can you come up with a protocol for how to accept or reject transactions? And in what order? So that you can feel confident that anyone else in the world, who is following that same protocol has a personal ledger that looks the same as yours - this is the problem addressed in the original Bitcoin paper.
At a high level, the solution that Bitcoin offers, is to trust whichever ledger has the most computational work put into it - I'll take a moment to explain exactly what that means, it involves this thing called a cryptographic hash function, the general idea that we'll build to is - that if you use computational work as a basis for what to trust, you can make it so that fraudulent transactions and conflicting ledgers would require an infeasible amount of computation to bring about.
Again I'll remind you that this is getting well into the weeds beyond what anyone would need to know just to use a currency like this; but it's a really cool idea, and if you understand it, you understand the heart of Bitcoin and of other crypto currencies.
So first things first, what's a hash function? The inputs for one of these functions can be any kind of message or file, it really doesn't matter, and the output is a string of bits with some kind of fixed length like two hundred fifty-six bits.
This output is called the hash or the digest of the message, and the intent is that it looks random, it's not random, it always gives the same output for a given input - but the idea is that if you slightly change the input maybe editing just one of the characters, the resulting hash changes completely, in fact for the hash function that I'm showing here called "SHA-256" the way the output changes as you slightly change that input - is entirely unpredictable.
You see this is not just any hash function; it's a cryptographic hash function that means it's infeasible to compute in the reverse direction - if I show you some string of ones and zeroes, and ask you to find an input so that the SHA-256 hash of that input gives this exact string of bits, you will have no better method than to just guess and check.
You might think that if you just really dig into the details of how exactly this function works - you could reverse engineer the appropriate input without having to guess and check, but no one has ever figured out a way to do that - interestingly there's no cold hard rigorous proof that it's hard to compute in the reverse direction.
And yet a huge amount of modern security depends on cryptographic hash functions; and the idea that they have this property, if you were to look at what algorithms underlie the secure connection that your browser is making with Reddit right now; or that it makes with your bank, you will likely see the name SHA-256 show up in there.
For right now our focus will just be on how such a function can prove that a particular list of transactions is associated with a large amount of computational effort.
Imagine someone shows you a list of transactions, and they say hey "I found a special number, so that when you put that number at the end of this list of transactions and apply SHA-256 to the entire thing - the first thirty bits of that output are all zeros".
How hard do you think it was for them to find that number? Well for a random message the probability that a hash happens to start with thirty successive zeros - is one in two to the thirty, which is about one in a billion, and because SHA-256 is a cryptographic hash function - the only way to find a special number like that is just guessing and checking.
So this person almost certainly had to go through about a billion different numbers before finding that special one and once you know that number - it's really quick to verify, you just run the hash, and see that there are thirty zeros.
So in other words, you can verify that they went through a large amount of work; but without having to go through that same effort yourself - this is called a proof of work, and importantly all of this work is intrinsically tied to the list of transactions.
*If you change one of those transactions, even slightly it would completely change the hash, so you'd have to go through another billion guesses to find a new proof of work, a new number, that makes it so that the hash of the altered list, together with this new number starts with thirty zeros. *
So now think back to our distributed ledger situation, everyone is their broadcasting transactions; and we want to wait for them to agree on what the correct ledger is, as I said the core idea behind the original Bitcoin paper - is to have everyone trust whichever ledger has the most work put into it.
The way this works is to first organize a given ledger into blocks, where each block consists of a list of transactions together, with a proof of work - that is a special number so that the hash of the whole block starts with a bunch of zeros, for the moment let's say that it has to start with sixty zeroes. But later we will return back to a more systematic way you might want to choose that number.
In the same way that a transaction is only considered valid when it's signed by the sender; a block is only considered valid if it has a proof of work.
And also to make sure that there is a standard order to these blocks, we will make it so that a block has to contain the hash of the previous block at its header - that way if you were to go back and change any one of the blocks, or to swap the order of two blocks, it would change the block that comes after it, which changes that blocks hash, which changes the one that comes after it. and so on.
That would require redoing all of the work; finding a new special number for each of these blocks that makes their hashes start with sixty zeroes because blocks are chained together like this, instead of calling it a ledger - it's common to call it a blockchain.
As part of our updated protocol, we will now allow anyone in the world to be a block creator.
What that means - is that they're going to listen for transactions being broadcast, collect them into some block, and then do a whole bunch of work to find a special number that makes the hash of that block start with sixty zeros.
And once they find it, they broadcast out the block they found, to reward a block creator for all this work, when she puts together a block, we will allow her to include a very special transaction at the top of it - in which she gets say ten ledger dollars out of thin air - this is called the block reward, and it's an exception to our usual rules about whether or not to accept transactions.
It doesn't come from anyone, so it doesn't have to be signed, and it also means that the total number of ledger dollars in our economy increases with each new block.
Creating blocks is often called mining since it requires doing a lot of work, and it introduces new bits of currency into the economy, but when you hear or read about miners, keep in mind that what they're really doing is listening for transactions, creating blocks, broadcasting those blocks, and getting rewarded with new money for doing so.
From the miner’s perspective, each block is kind of like a miniature lottery, where everyone is guessing numbers as fast as they can - until one lucky individual finds a special number that makes the hash of the block start with many zeros, and they get the reward.
For anyone else who just wants to use this system to make payments, instead of listening for transactions, they all start listening just for blocks being broadcast by miners and updating their own personal copies of the block chain.
Now the key addition to our protocol is that if you hear two distinct block chains with conflicting transaction histories you defer to the longest one; the one with the most work put into it - if there's a tie, just wait until you hear an additional block that makes one of them longer, so even though there's no central authority and everyone is maintaining their own copy of the block chain - if everyone agrees to give preference to whichever block chain has the most work put into it, we have a way to arrive at decentralized consensus.
To see why this makes for a trustworthy system, and to understand at what point you should trust that a payment is legit, it's actually really helpful to walk through exactly what it would take to fool someone using this system.
Maybe Alice is trying to fool Bob with a fraudulent block, namely she tries to send him one that includes her paying him one hundred ledger dollars, but without broadcasting that block to the rest of the network, that way everyone else still thinks that she has those hundred ledger dollars.
To do this she would have to find a valid proof of work before all of the other miners each working on their own block.
And that could definitely happen, maybe Alice just happens to win this miniature lottery before everyone else, but Bob is still going to be hearing the broadcasts made by other miners - so to keep him believing this fraudulent block, Alice would have to do all of the work herself to keep adding blocks on this special fork in Bob's block chain.
It's different from what he's hearing from the rest of the miners, remember as per the protocol - Bob always trusts the longest chain that he knows about.
Alice might be able to keep this up for a few blocks - if just by chance she happens to find blocks more quickly than the rest of the miners on the network all combined, but unless she has close to fifty percent of the computing resources among all of the miners, the probability becomes overwhelming - that the block chain that all of the other miners are working on grows faster than the single fraudulent block chain that Alice is feeding to Bob.
So after enough time, Bob's just going to reject what he's hearing from Alice in favor of the longer chain, that everyone else is working on.
Notice that means that you shouldn't necessarily trust a new block that you hear immediately - instead you should wait for several new blocks to be added on top of it. If you still haven't heard of any longer block chains, you can trust that this block is part of the same chain that everyone else is using.
And with that, we've hit all the main ideas - this distributed ledger system based on the proof of work is more or less how the Bitcoin protocol works; and how many other crypto currencies work, there's just a few details to clear up.
Earlier I said that the proof of work might be to find a special number so that the hash of the block starts with sixty zeroes; or the way the actual Bitcoin protocol works is to periodically change that number of zeros.
So that it should take on average ten minutes to find a new block - so as there are more and more miners added to the network, the challenge actually gets harder and harder in such a way that this miniature lottery only has about one winner every ten minutes.
Many newer crypto currencies actually have much shorter block times than that, and all of the money in Bitcoin ultimately comes from some block reward.
In the beginning, these rewards were fifty Bitcoin per block - there's actually a great website you can go to - called block explorer that makes it easy to look through the Bitcoin block chain.
And if you look at the very first few blocks on the chain, they contain no transactions other than that fifty Bitcoin reward to the minor, but every two hundred and ten thousand blocks which is about every four years - that reward gets cut in half.
So right now the reward is twelve point five Bitcoin per block, and because this reward decreases geometrically over time - it means there will never be more than twenty-one million Bitcoin in existence.
However this doesn't mean that minors will stop earning money.
In addition to the block reward, miners can also pick up transaction fees the way this works is that whenever you make a payment, you can purely optional include a little transaction fee with it that's going to go to the minor of whichever block includes that payment.
The reason you might do that is to incentivize miners to actually include the transaction that you broadcast into the next block.
You see in Bitcoin each block is limited to about twenty-four hundred transactions which many critics argue is unnecessarily restrictive; for comparison Visa processes an average of about seventeen hundred transactions per second and they're capable of handling more than twenty-four thousand per second.
This comparatively slow processing on Bitcoin makes for higher transaction fees - since that's what determines which transactions miners choose to include in a new block.
All of this is far from a comprehensive coverage of crypto currencies, there are still many nuances and alternate design choices that I haven't even touched, but my hope is that this can provide an understanding for anyone looking to add a few more branches with further reading.
Like I said at the start, one of the motives behind this - is that a lot of money has started flowing towards crypto currencies, and even though I don't want to make any claims about whether that's a good or bad investment; I really do think that it's healthy for people getting into the game - to at least know the fundamentals of the technology.
Original source:
submitted by mariodeal to Bitcoin [link] [comments]

onename vs cryptoproof vs world-citizenship: identity wars.
Looking for community opinions on some different approaches to using the blockchain for ID purposes. Full disclosure, cryptoproof is mine.
onename: Data is encoded into the bitcoin blockchain which is interpreted by the onename software to construct a database deterministically by scanning the btc blockchain in sequence resulting in all of blockstacks (the blockchain application stack onename is built on) nodes sharing an identical copy.
cryptoproof: Accepts extended master public keys from users who wish to associate themselves with the derivable subkey addresses. When another user submits one of these addresses to the website, cryptoproof reveals who the key is associated with.
world-citizenship: Embeds a trail of evidence that are immutable and unfalsifiable involving the merkle root, PGP Signature and corresponding SHA-256 digests.
submitted by derrend to Bitcoin [link] [comments]

Butterfly Labs 50 Gh/s ASIC Bitcoin Miner SHA-256 How to buy & setup the Antminer S9 bitcoin and bitcoin cash SHA-256 miner - Still Profitable? Antminer S3 (Bitcoin;SHA-256;440GH/s) Mining Rig What is a Bitcoin hash and SHA-256 - YouTube HashFlare how to setup pools on SHA-256 mine Bitcoins.

SHA-256 and bitcoin mining. SHA-256 and bitcoin mining. An example using python; SHA-256; Optimizations; Hardware; Vocabulary. Big and small endian; Hash digest; Links ; There is a lottery in bitcoin network that takes place every ~10 minutes. The lottery winner submits a new block to blockchain (if the majority of the network agrees with it) and awards with bitcoins (25 initally, halve every ... The Sha-256 algorithm is based on the Merkle-Damgard construction method, according to which the initial index is divided into blocks immediately after the change is made, and those, in turn, into 16 words. SHA-256 is used in several different parts of the Bitcoin network: Mining uses SHA-256 as the proof-of-work algorithm. Bitcoin Mining Algorithm Sha256 Bitcoin . Bitcoin Mining Algorithm Sha256 . Dec 14, 2017 DTN Staff. twitter. pinterest. google plus. facebook. Crypto Mining: Sha-256 Or Scrypt A Guide For Miners ... The SHA256 is the main processing part in Bitcoin mining, to date the difficulty of which is extremely high and still increases relentlessly. Hence, it is essential to improve the speed of the SHA256 cores in the Bitcoin mining system. In this paper, we propose a two-level pipeline hardware architecture for the SHA256 processing. The first-level pipeline helps the system reduce the number of ... The SHA-256 algorithm relies on the Merkle-Damgard construction method, which stipulates that the initial index be divided up into blocks as soon as the change is made, and those, in turn, into 16 words. The Bitcoin network uses the SHA-256 algorithm for proof of work in mining and to make bitcoin addresses more private and secure.

[index] [34095] [20791] [12541] [48251] [23827] [51109] [32488] [12582] [40187] [25757]

Butterfly Labs 50 Gh/s ASIC Bitcoin Miner SHA-256

The SHA-256 algorithm is used to mine bitcoin, ... By making use of these application-specific integrated circuits, mining bitcoin has become a very expensive process. These machines require a lot ... Zcash Mining Bitcoin SHA-256 Blackcoin Scrypt Litecoin - Duration: 3:45. FilmShack 1,901 views. 3:45. How To Make A Concrete Countertop, It's Easier Than You Think - Duration: 11:09. ... Mining Bitcoin with Excel - Duration: 7:17. Knowledge 181,876 views. 7:17. Pawn Stars: 20 SUPER RARE HIGH VALUE ITEMS ... What is a Bitcoin hash and SHA-256 - Duration: 1:54. Ofir Beigel 64,406 ... This video explains the concept of hashing and SHA-256 for newbies. For the complete text guide visit: Join our 7-day Bitcoin crash cou... This video goes over the setup and buying of the Antminer S9 bitcoin and bitcoin cash miner from Bitmain. It will actually mine any SHA-256 coin. Bitmain Twi...