How to transactions work on the blockchain?
Ref - https://andersbrownworth.com/blockchain/
User side
- User first creates a
public/private
keypair - They create a
transaction
that 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
sign
the transaction using their private key - They send the
raw transaction
,signature
and theirpublic key
to a node on the blockchain.
Miner
- Hashes the original message to generate a
hash
- Verifies the
signature
using the userspublic key
and thehash
generated 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