Blockchain (4) - Functioning of the Blockchain Network
Blockchain is suitable for transactional databases where history needs to be recorded, and historical records cannot be changed. The transaction represents the interaction between counterparties in the network, i.e. a transfer of an asset from one user to another, when crypto-assets are involved.
If the blockchain user sends information about the transaction to the network, this usually contains the sender's address, public key, digital signature, transaction input and output data. Input is a list of digital assets that the sender transfers. Output is the recipient, or multiple recipients, of the crypto-assets.
Regardless of the format of the transaction data, it is important to verify the validity and authenticity of the transaction. The transaction is valid if the formal criteria of the blockchain network are met. The transaction is authentic if the sender is authenticated, as well as his ownership of the crypto-assets he wants to transfer. The transaction is usually signed by the sender's private key and can be verified at any time by the respective public key. This authentication method is called Asymmetric Cryptography or Public Key Cryptography.
Asymmetric Cryptography
Asymmetric cryptography uses a pair of digital keys that are mathematically linked for encrypting and/or decrypting. The private key cannot be derived from the public key. Usually the user encrypts the data with his private key and decrypts them with his public key. Naturally, users must ensure that their private keys remain confidential.
Such a system of asymmetric cryptography will ensure a confidential relationship between network users who do not known or do not trust each other. In the blockchain network, asymmetric cryptography works as follows:
● The private key is used to digitally sign the transaction
● The public key is used to derive addresses (from whom to whom)
● The public key is also used to verify a digital signature that has been generated by the private key
Addressing and Key Management
The network user address is the public information within the network. Blockchain networks can use different methods to obtain an address, for example from a public key using hash functions, a string of characters is generated, which can then be converted to another form, e.g. a QR Code. This way, when creating a transaction, the network user sends crypto-assets to another user who is identified by his QR Code. Network users can create several public keys and thus ensure their pseudo-anonymity.
The user's private key is confidential and must be carefully stored so that no one can get to it, especially in public (permissionless) blockchain networks. This is usually achieved by using digital wallets, software or hardware versions (e.g. USB Flash Disk). Digital wallets can also store other types of data, such as public keys, addresses, or any other secure information.
If the user loses his or her private key, or someone steals it, the crypto-assets are lost. The thief becomes the new owner. It is therefore clear that extra care must be taken to ensure the secure storage of the private key. Some users make use of third (trusted) parties services, called "Key Escrow Service", for this purpose.
Blocks
The user of a blockchain network sends his transaction to the network. This can be done using a web application, smartphone or a standalone software application, such as digital wallet (if applicable). The pending transaction is seen by all participants in the network, but the validation happens only when some of the publishing nodes include it in a new block. In PoW cryptocurrency networks, the process of creating such a new block is called mining. Before including a transaction in the new block, the validity and authenticity must be confirmed.
Each blockchain network can define its own custom conditions and data for creating blocks. They often contain the following information:
● Block Header:
- Block number (sometimes referred to as Block Height)
- Hash of the previous block
- Hash representation of block data (different networks use different methods)
- Date and time (timestamp)
- Block size
- One-off arbitrary number, called nonce
● Block data:
- List of transactions and/or records of events in the network
- Other data within the network
Chain of blocks (blockchain)
The individual blocks are mutually connected and contain data from the previous block. Together they form a string of blocks– blockchain. All network users have information about all the blocks. If any data in any block were changed, all of the following blocks would have changed, and network users would easily identify a false block. Such a change would be subsequently rejected.
More on Bearning Fintech Workshops