Data immutability in a blockchain¶
The blockchain process ensures that data cannot be deleted from the blockchain.
A user generates a transaction. Before sending the transaction, the user generates a digital signature for it using his account private key. This key is known only to the user. After signing, the transaction has a proofs
field with an electronic signature. Now the body of the transaction is certified, its immutability and belonging to the author (public key) is confirmed.
The user uses POST /transactions/broadcast and POST /transactions/signAndbroadcast requests to send the signed transaction to the API of the node to which he has access.
The node checks the signature, transaction structure, contract, etc. If all checks are correct, the node accepts (validates) the transaction.
The validated transaction goes to the node’s UTX pool. This node will then send information about the transaction to all other nodes with which it has a connection. Thus, every network node will have this transaction.
There are two options for a transaction in the UTX pool:
the transaction will be added to the block during the mining process, or
the transaction will be removed from the UTX pool and will not hit the block.
Each node on the blockchain knows the consensus parameters according to which it should release blocks. The node that is determined to be the leader (the round’s miner) selects those transactions from the UTX pool that it is ready to release in a block, checks them again and releases the block.
When releasing a block, the node links the previous block, which is stored in its database, and the new block, including the transactions it contains. To do this, the node specifies in the body of the new released block the signatures of the previous block. Thus the signature of the new block is calculated from the data containing all the transactions of the current block and the signature of the previous block.
If an attacker tries to delete or modify the data of any transaction, the signature of the block it is part of will change. During node synchronization, the block will be sent out to other network members, fail verification and be rejected as invalid.