How to transactions work on the blockchain?
Ref - https://andersbrownworth.com/blockchain/
User side
- User first creates a
public/privatekeypair - They create a
transactionthat they want to do (send Rs 50 to Alice). The transaction includes all necessary details like the recipient’s address, the amount and some blockchain specific parameters (for eg - latestBlockHash in case of solana) - They hash the
transaction - They
signthe transaction using their private key - They send the
raw transaction,signatureand theirpublic keyto a node on the blockchain.
Miner
- Hashes the original message to generate a
hash - Verifies the
signatureusing the userspublic keyand thehashgenerated in step 1 - Transaction validation - The miner/validator checks additional aspects of the transaction, such as ensuring the user has sufficient funds
- If everything checks out, adds the transaction to the block