Episode 8 - Accounts and Keys
Accounts are a way of representing users on the blockchain. Just like we have accounts in banks, generally represented by account numbers or IBANs, we have accounts in blockchains too. In a blockchain, accounts are generally a representation of a user’s cryptographic public key.
Recall from the Transactions and Signing episodes of the podcast — transactions are signed by the users. Signing in a blockchain is done using public-key cryptography.
In public-key cryptography, a user has two keys — one public and the other secret. For simplicity, let’s say that these keys are mathematically obtained random strings that are associated with each other based on logic. This logic could be different for different cryptographic algorithms. Some of them are based on prime numbers and some are based on points on a function curve.
Using these keys, the user can associate their identity with their transactions by signing them. The public key is shared on the blockchain as part of the transaction. The transaction data is signed using the private key of the user and the resulting signature could be verified using the public key of the same user.
The account of a user is represented by either hashing or encoding their public-key in one way or the other. Different blockchains represent accounts differently, using various hash functions.
Accounts are used to hold balances of tokens or cryptocurrencies, on a blockchain. Users could then spend these balances by signing the transactions using the associated private key of the account. Spending a balance means sending it to some other user’s account, using transactions. This way, any kind of user — buyer, seller, etc. could have their accounts and could send tokens to each other. If you do not have an account and the associated keys, you can’t send transactions to a blockchain and hence can’t propose an update to the state of the blockchain.