How do cryptocurrencies use cryptography?
The beginner’s guide to cryptography
When the Bitcoin protocol went live in 2009, the world was presented with a new type of currency system which is secured and issued in a completely different way to traditional money.
Fiat currencies like the U.S Dollar or Japanese Yen are secured by trust in the legacy banking system and issued by each country’s respective central bank. Any new currency enters circulation based on a flexible monetary policy decided by each domestic government. In a sense, fiat currencies are backed by trust in the financial power of individual countries and the militaries that protect that power.
Ultimately, Bitcoin operates on a predetermined, computer-controlled monetary policy that no single person, company, or government can change. Rather than placing trust in government or institutions, Bitcoin users place trust in the cryptography and protocol’s transparent set of rules that allow it to reliably operate regardless of its market price or market sentiment.
What is cryptography?
Cryptography is the study of encrypting and decrypting information. In short, it is the practice of altering a message so that only the sender and intended recipient or recipients can understand it.
If an encrypted message were to be intercepted by someone other than the intended recipient, cryptography would make it nearly impossible for the interceptor to understand what information it contained
One of the earliest examples of cryptography dates back to the 7th century B.C when ancient Greeks wrapped leather strips with secret messages written on them around sticks – an encryption method known as scytale. Once unwound, the leather strip would have a scrawl of letters along it that only a person with a similar stick of equal diameter could decipher.
During war time, cryptography has played a vital role in securing communications that may be intercepted between distributed forces. In World War II, the use of cryptography to decipher encrypted Nazi radio transmissions from the Enigma cipher machine proved pivotal in bringing an end to the invasion in Europe.
Fast forward to today and cryptography now plays a fundamental role in the security and issuance of cryptocurrencies like bitcoin.
Cryptography is a important component of cryptocurrencies, used to:
- Create crypto wallet key pairs
- Issue new bitcoin through the mining process
- Digitally sign transaction messages
How does cryptography help Bitcoin?
The total sum of computational resources directed at mining bitcoin is what helps to secure the network against cyber attacks. This is known collectively as a network’s “hash rate.” The more miners on the network, the higher the hash rate and the greater the amount of computational power needed to overwhelm the network by a 51% majority.
A 51% attack is one of the biggest threats to public blockchain networks. Malicious agents who are able to pool enough resources to control at least 51% of a blockchain’s hash rate gain the ability to block inbound transactions, change the ordering of transactions and double spend funds. However, by making the process computationally difficult, the bitcoin network prevents bad actors from taking control of the network.
SHA-256 hashing is also responsible for making blockchain-based transactions immutable.
Once transactions are bundled into new blocks and verified by all other volunteers in the network, each transaction message is hashed using the SHA-256 cryptographic algorithm.
These already hashed transactions are then systematically hashed together in pairs to create something known as a “Merkle Tree.” Pairs of transactions are hashed together until eventually all transactions within the block are represented by a single hash value. This single value becomes the Merkle Root and is stored in the block header.
Because hashes are deterministic – meaning the same input will always create the same unique output value – any attempt by bad actors to alter a block of transactions will result in an entirely new Merkle Root value. Other volunteers in the system would be able to see the altered Merkle Root compared to the valid block and reject it, unanimously preventing corruption.
The deterministic nature of cryptographic algorithms allow network users to transact bitcoin without the need for a trusted intermediary to verify and process payments.
By staying decentralized removing human involvement, transactions can be processed significantly faster and fees are often much cheaper than traditional banking solutions.
What cryptography does Bitcoin use?
Generating private and public keys
Bitcoin uses elliptic curve cryptography (ECC) and the Secure Hash Algorithm 256 (SHA-256) to generate public keys from their respective private keys.
A public key is used to create a crypto wallet address for receiving inbound transactions while the private key is needed to sign transactions and prove ownership of funds.
You can think of the private key like your bank PIN number and the public key like your bank account number. A hacker needs both to do something untoward to your finances.
The private key is the crucial part of the key pair and is stored in a crypto wallet. Technically, a crypto wallet stores a person’s access to their crypto funds – not the actual cryptocurrency itself. The funds themselves are simply data entries recorded on the blockchain and can be identified and unlocked using the keys stored in your wallet.
Elliptic curve cryptography
ECC is the use of a special mathematical curve that is horizontally symmetrical. If you draw any line through this curve, it will intersect the shape up to a maximum of three times. ECC is an important part of cryptocurrency and is what allows users to generate a public key.
To generate a Bitcoin key pair, you must first create a private key.
A bitcoin private key is a randomly generated 256-bit number (between 1 and 2²⁵⁶, or two to the power of two hundred and fifty six – an incredibly large number!). On services like Kraken, this number is created automatically when setting up a new crypto wallet.
The public key is then generated from this number using elliptic curve multiplication. This involves taking a starting point on an elliptic curve (known as a generator point) and multiplying it by the random private key number to produce a new point on the curve.
This new point becomes the public key with specific x and y coordinates. Finding the private key while knowing the public key is almost impossible because of how difficult it would be to guess a random 256-bit number. There’s approximately a one in 150,000 billion billion billion billion billion billion billion billion chance of getting it right.
Theoretically speaking, it would take a quantum computer with more than 13,000,000 physical qubits to find this number in a day. To date, one the world’s most advanced quantum computers, the IBM Eagle processor, possesses only 127 qubits (or 0.00097% of the amount of required qubits).
In other words, the systems used by cryptocurrencies are, at least for now, completely secure.
To create a bitcoin wallet address, x and y coordinates are put through the SHA-256 algorithm.
This cryptographic hash function was developed and published by the United States National Security Agency (NSA) in 2001, and essentially turns any input (in this case, the public key coordinates) into a unique, fixed-length 256 bit code.
This code is presented in 64-character hexadecimal format, containing a mixture of numbers 0 to 9 and letters A-F.
The ECC and SHA-256 cryptographic functions are known as “trapdoor” or “deterministic” functions. This means they only work one way and cannot be reversed to reveal the original inputs.
While it’s possible to create a public key from a private key, it’s impossible to reverse the process and reveal the private key. The same goes for trying to discover what public key was used to create a bitcoin wallet address. Only the public key holder has that information and can use it to prove ownership of the bitcoin wallet address.
Need a better way to understand this? Imagine someone had mixed together a variety of different colored paints from a selection of, as we noted before, 150,000 billion billion billion billion billion billion billion billion options to create one unique color.
If you knew the exact quantities of the right paints you would be able to reproduce the exact same color. But what if you didn’t? Trying to reverse the process would be nearly impossible.
This is, in essence, how these trapdoor cryptographic functions work and what allow their inputs to be unrecognizable when compared to the output.
Why does cryptography matter?
Cryptography plays an essential role in not just securing cryptocurrency networks from corruption, but also providing an irrefutable means of proving ownership of funds without forcing users to give up their sensitive private key information.
Without it, cryptocurrency networks would be likely forced to rely on trusted, centralized intermediaries to secure its information and facilitate payments— something that completely contradicts the decentralized nature of public blockchain-based cryptocurrencies.
Now that you understand the technology powering cryptocurrencies, it’s time to get started with the most transparent and trusted digital asset exchange.
Issuing new bitcoin
New units of bitcoin enter into circulation through a process called mining.
Mining is part of the proof-of-work consensus mechanism employed by Bitcoin’s blockchain to select honest participants to add new blocks of data.
It does this through the use of SHA-256 hashing. Thousands of network volunteers – known as mining nodes – compete against one another using computers that are purpose built to generate trillions of hashes per second.
Miners first take the block header – the part that contains all the top level information about the block including its timestamp, the target value for miners to beat and other key components – from the most recent block in the chain and adjust the number of something called a nonce.
Nonce is a mnemonic that represents a number only used once. It is the part of a block header that can be changed to create a new hashed value.
The aim of the cryptography-based mining competition is simple. Miners use their machines to automatically adjust the nonce number in the block header and run it through the SHA-256 hashing algorithm to produce a value.
Whichever miner produces a value that has the same or more zeros at the front of it compared to the target value wins the competition. If the value doesn’t beat the target value, miners adjust the nonce number again, rehash the block header and produce a new value.
This process is repeated until someone is successful.
Newly minted bitcoin is awarded to each successful miner based on a fixed issuance schedule pre-programmed into Bitcoin’s source code by its creator, Satoshi Nakamoto.
Cryptography plays a vital role in processing bitcoin transactions and keeping the network secure through the ming process. You can check out Kraken Learn Center’s article What is Bitcoin Mining? to learn more.
Digital signatures are crucial for allowing senders to prove they own the corresponding private key to a specific public key without having to reveal their private key to someone.
Bitcoin uses an elliptic curve digital signature algorithm (ECDSA) to cryptographically approve and send transactions from a crypto wallet.
This involves the sender taking a hashed transaction message – which comprises the recipient’s wallet address, the amount of BTC being sent, any fees attached and where the bitcoin originally came from – adding their private key to it and creating a digital signature using another one-way mathematical process.
More specifically, it involves a process similar to the aforementioned creation of a public key from a private key, with the addition of a few extra steps.
A random number is created (similar to a private key), which is then multiplied with the same generator point used to create the wallet’s public key, to create a new point on an elliptic curve. Let’s call this Point A.
The X coordinate of Point A is then multiplied with the sender’s private key and added to the hashed transaction message. All of this is then divided by the random number generated at the start to produce a new value. This value serves as the digital signature.
To verify the digital signature, the recipient derives two points on an elliptic curve. First, the message is divided by the digital signature value to get the generator point. Then, the X coordinate of the generator point is divided by the digital signature value to reveal the second point on the curve.
Finally, plotting a line through these two points produces a third and final point on the elliptic curve. This final point should have exactly the same X coordinate as Point A, thereby proving the digital signature was created using the correct corresponding private key.
Thankfully, a digital crypto wallet performs all of this verification process automatically, without any input needed from the user.
Kraken's crypto guides
- What is 0x? (ZRX)
- What is 1inch? (1INCH)
- What is Aave? (AAVE)
- What Is Aavegotchi? (GHST)
- What is Acala? (ACA)
- What is Akash? (AKT)
- What is Akropolis? (AKRO)
- What is Algorand? (ALGO)
- What is Ampleforth? (AMPL)
- What is Ankr? (ANKR)
- What is Aragon? (ANT)
- What is Arweave? (AR)
- What is Audius? (AUDIO)
- What is Augur? (REP)
- What is Avalanche? (AVAX)
- What is Axie Infinity? (AXS)
- What is Badger DAO (BADGER)?
- What is Balancer? (BAL)
- What is Bancor? (BNT)
- What is Band Protocol? (BAND)
- What is Basic Attention Token? (BAT)
- What is Bifrost? (BNC)
- What is BitTorrent? (BTT)
- What is Bitcoin? (BTC)
- What is Taproot?
- What is the Bitcoin white paper?
- What is Bitcoin Cash? (BCH)
- What is Reddit's BRICK token?
- What is Cardano? (ADA)
- What is Cartesi? (CTSI)
- What is Celo? (CELO)
- What is Celsius? (CEL)
- What is Centrifuge? (CFG)
- What is Chainlink? (LINK)
- What is Chiliz? (CHZ)
- What is Compound? (COMP)
- What Is Convex? (CVX)
- What is Cosmos? (ATOM)
- What is Covalent? (CQT)
- What is Curve? (CRV)
- What is Dai? (DAI)
- What is Dash? (DASH)
- What is Decentraland? (MANA)
- What is Decred? (DCR)
- What is DigiByte? (DGB)
- What is district0x? (DNT)
- What is Dogecoin? (DOGE)
- What is EOSIO? (EOS)
- What is Elrond? (EGLD)
- What is Energy Web Token? (EWT)
- What is Enjin? (ENJ)
- What is Enzyme Finance? (MLN)
- What is Ethereum? (ETH)
- What is Ethereum Classic? (ETC)
- What is Ethereum Name Service? (ENS)
- What is Fantom? (FTM)
- What is Filecoin? (FIL)
- What is Flow? (FLOW)
- What is Gala Games? (GALA)
- What is Genshiro? (GENS)
- What Is GensoKishi Metaverse? (MV token)
- What is Gnosis? (GNO)
- What is Golem? (GNT)
- What is Handshake? (HNS)
- What is Hedera Hashgraph? (HBAR)
- What is Icon? (ICX)
- What is Injective? (INJ)
- What is Internet Computer Protocol? (ICP)
- What is Karura? (KAR)
- What is Kava? (KAVA)
- What is Keep Network? (KEEP)
- What is Kintsugi? (KINT)
- What is Kusama? (KSM)
- What is Kyber Network? (KNC)
- What is Lisk? (LSK)
- What is Litecoin? (LTC)
- What Is Livepeer? (LPT)
- What is Loopring? (LRC)
- What is MakerDAO? (MKR)
- What is Mina Protocol? (MINA)
- What is Mirror Protocol (MIR)?
- What is Monero? (XMR)
- What is Reddit's MOON token?
- What is Moonriver? (MOVR)
- What is Nano? (NANO)
- What is NEAR Protocol? (NEAR)
- What is Neo? (NEO)
- What is NuCypher? (NU)
- What is Numeraire? (NMR)
- What is OMG Network? (OMG)
- What is Ocean Protocol? (OCEAN)
- What is Orca? (ORCA)
- What is Orchid? (OXT)
- What is Origin? (OGN)
- What is Oxygen (OXY)?
- What is Paxos Gold? (PAXG)
- What is Perpetual Protocol? (PERP)
- What is Phala Network? (PHA)
- What is Polkadot? (DOT)
- What is Polygon? (MATIC)
- What is Qtum? (QTUM)
- What is Quant? (QNT)
- What is RMRK? (RMRK)
- What is Rarible? (RARI)
- What is Ravencoin? (RVN)
- What is Raydium? (RAY)
- What is Ren? (REN)
- What is Revain? (REV)
- What is Ripple? (XRP)
- What is Secret Network? (SCRT)
- What is Serum? (SRM)
- What is Shiden? (SDN)
- What is Siacoin? (SC)
- What is Solana? (SOL)
- What is Songbird? (SGB)
- What is Star Atlas? (ATLAS)
- What is Stellar? (XLM)
- What is Storj? (STORJ)
- What is SushiSwap? (SUSHI)
- What is Swipe? (SXP)
- What is Synthetix? (SNX)
- What is THORChain? (RUNE)
- What is Tether? (USDT)
- What is Tezos? (XTZ)
- What is The Graph? (GRT)
- What is The Sandbox? (SAND)
- What is Theta? (THETA)
- What is Tron? (TRX)
- What is USD Coin? (USDC)
- What is Uniswap? (UNI)
- What is VeChain? (VET)
- What is Waves? (WAVES)
- What is Woo Network? (WOO)
- What is Wrapped Bitcoin? (wBTC)
- What is Yam Protocol? (YAM)
- What is Zcash? (ZEC)
- What is Zilliqa? (ZIL)
- What is tBTC?
- What is yearn.finance? (YFI)