How does cryptocurrency work? Transactions are sent between peers using software called "cryptocurrency wallets." The person creating the transaction uses the wallet software to transfer balances from one account (AKA a public address) to another. To transfer funds, knowledge of a password (AKA a private key) associated with the account is needed. Transactions made between peers are encrypted and then broadcast to the cryptocurrency"s network and queued up to be added to the public ledger. Transactions are then recorded on the public ledger via a process called "mining" (explained below). All users of a given cryptocurrency have access to the ledger if they choose to access it, for example by downloading and running a copy of the software called a "full node" wallet (as opposed to holding their coins in a third party wallet like Coinbase). The transaction amounts are public, but who sent the transaction is encrypted (transactions are pseudo-anonymous). Each transaction leads back to a unique set of keys. Whoever owns a set of keys, owns the amount of cryptocurrency associated with those keys (just like whoever owns a bank account owns the money in it). Many transactions are added to a ledger at once. These "blocks" of transactions are added sequentially by miners. That is why the ledger and the technology behind it are called "block chain." It is a "chain" of "blocks" of transactions.TIP: I"ve just described how Bitcion works and how many other coins work too. However, some altcoins use unique mechanics. For example some coins offer fully private transactions and some don"t use blockchain at all.
How does blockchain work? The blockchain is like a decentralized bank ledger, in both cases the ledger is a record of transactions and balances. When a cryptocurrency transaction is made, that transaction is sent out to all users hosting a copy of the blockchain. Specific types of users called miners then try to solve a cryptographic puzzle (using software) which lets them add a "block" of transactions to the ledger. Whoever solves the puzzle first gets a few "newly mined" coins as a reward (they also get transaction fees paid by those who created the transactions). Sometimes miners pool computing power and share the new coins. The algorithm relies on consensus. If the majority of users trying to solve the puzzle all submit the same transaction data, then it confirms that the transactions are correct. Further, the security of the blockchain relies cryptography. Each block is connected to the data in the last block via one-way cryptographic codes called hashes which are designed to make tampering with the blockchain very difficult. Offering new coins as rewards, the difficulty of cracking the cryptographic puzzles, and the amount of effort it would take to add incorrect data to the blockchain by faking consensus or tampering with the blockchain, helps to ensure against bad actors.