What is a public key and private key in blockchain?

Answer

Blockchain uses asymmetric cryptography (public-key cryptography) for identity and transaction signing. (1) Private key — a randomly generated 256-bit number that serves as your secret identity on the blockchain. It's used to sign transactions, proving you authorize a transfer. Anyone with your private key has complete control over your funds. Must be kept absolutely secret. In Ethereum, it's a 32-byte hex number; (2) Public key — mathematically derived from the private key using Elliptic Curve Cryptography (secp256k1). Can be freely shared — allows others to verify your signatures but cannot be used to derive your private key (one-way function); (3) Address — derived from the public key by hashing (Keccak-256) and taking the last 20 bytes. Ethereum addresses are 42 hex characters starting with 0x. Transaction flow: sender signs the transaction with private key → network verifies signature using public key → transaction executes if valid.