In the blockchain people keep saying that all of the transactions are listed. Then why are they hashed? What's the point of hashing them if you can't check the blockchain afterwards.
There are some misunderstandings here. First, transactions are hashed in several ways for different purposes, but actually they are kept in the original in the blockchain: As you said, this is needed to check the blockchain later, or to provide the information to other participants for them to catch up with the network.
So, when and to what purpose are they hashed, then?
Transaction Identifier (txid)
Standard transactions range in size from roughly 192 bytes to 100,000 bytes, although the smallest possible transaction is 61 bytes, and the largest one ever seen was 999,657 bytes. Anyway, I think we can agree that some of them can be unwieldy to send around in full, just to reference them. ;)
This is where transaction IDs come in. The transaction ID is the digest of performing the SHA-256 hashing function twice on the serialized transaction. The resulting digest or hash is always 256 bits (hence the name), which can be represented with 32 bytes. Using the txid to reference transactions is obviously much less bandwidth intensive which is why this is how peers exchange information about transactions: when a peer learns about a new transaction, this will be in form of an
INVENTORY message that presents him a list of txids, to which the node may respond by requesting the unseen transactions with the corresponding txids.
Transactions in a block have a fixed order. This can be used to create a Merkle tree from the transactions. Merkle trees are useful in that they allow lightweight nodes to confirm the membership of a transaction in a block without having full knowledge of the block's content. The Merkle tree is created by hashing transactions pairwise iteratively until only a single hash results. This Merkle root can be used to represent all transactions in a block and prevents anyone from changing the block's content.
Proof of work
A third application of hashing in Bitcoin is the consensus mechanism 'proof of work'. Bitcoin's central innovation is using the blockchain to create consensus about the order of transactions in the system. To that end, miners collect unconfirmed transactions into block templates for which they then evaluate whether they resolve to a valid block. These block templates consist of a block header (which among other information collects the aforementioned Merkle root) that is subjected to a doubly applied SHA-256 function. If the result surpasses the difficulty, a new valid block has been found.
We need to make sure that only the owner of funds may spend them. This is solved by the owner signing a transaction with the corresponding private key for each input that they are spending. However, there's another application for hashes in there as well (hat tip to Pieter for pointing it out): for each input a "signature hash" is produced which is a digest of all inputs and outputs of the transaction. As this is what the sender signs, they not only authenticate themselves as the rightful owner, but also commit the signature to exactly this transaction. Thus the signature is useless even to spend another transaction output from the same address, and it is impossible for third parties to redirect payments.
While private key and public key together make a point on an ECDSA curve, the address is actually also derived by hashing: It is a RIPEMD-160 hash of the public key. This allows the public key to remain unknown until received money is spent from an address for the first time.
The point of hashing
As we can see, while addresses are indeed kept in full in the blockchain, hashing allows us to:
- Save bandwidth in transaction relay
- Verify transaction confirmations without knowing full blocks
- Limit block discovery and introduce digital scarcity
- Protect transactions from being altered by third parties
- Protect sensible information, while proving our possession of it
I think you need to do a little more reading.
What you're suggesting is like saying "Hey, I know what my current balance in my checking account is, so why not just throw away all the previous history".
That may be fine, until you need to figure out whether or not someone cashed a check 6 months ago.
Hashing is cryptographically signing the transaction, it's not reducing the transaction to ONLY a hash. It's the transaction itself, along with the previous transactions hash, hashed together to form a new hash, which is verified by comparing the previous hash and the transaction.