Rua: I will give a lecture tomorrow. I will post 2333 of the content I combed for the first time. Blockchain entry.
Features of blockchain
- Distributed decentralization
- Trust-free system
- Tamper-resistant and encryption security
Decentralization
No central node
Blockchain
Is a non-relational distributed database that can only be searched and inserted without an administrator.
The main function is to store information. Everyone can assume that the server is added to the blockchain network and become a node. Each node is equal. You can store information to any node because they are synchronized.
Smart contract
Smart contract is the encapsulation of block data business logic.
Smart contract can be understood as: Stored Procedure + database structure.
Accessing a smart contract is like accessing a stored procedure. Variables defined in the contract cannot be directly accessed and must be operated by functions. A smart contract is like defining a table structure, but you cannot directly select, update, or delete operations. You must use the functions defined in the smart contract. [Database operations can only be performed using stored procedures]
Getting started
You can add IP addresses and port numbers, and complete a transaction using simple APIs.
Remarks
Blockchain development is totally different from smart contract development. Chain and coin. Currency hypes are a group of investors who only focus on market conditions and may sell virtual currencies themselves. People in the chain hope to contribute to the industry through technology.
Blockchain is only a storage security design architecture. Security Problems exist at the user layer, application layer, and logic layer.
- High-frequency transactions
- Coin stealing
- Upload false data
Blockchain Application
Decentralized security, traceable, and tamper-resistant
Currently, the bottom layer of blockchain is only suitable for low-frequency and high-value businesses. Credit Investigation, assets, real estate, etc.
6-layer blockchain Model
Data layer, network layer, consensus layer, incentive layer, contract layer, and application layer.
- The data layer encapsulates the chain structure of the underlying data blocks and asymmetric encryption technology in modern cryptography.
- The network layer includes P2P Networking, data transmission, and data verification. [Automatic networking function]
- The Consensus layer determines the accounting method [proof work] And how to extend the long chain.
- The incentive layer combines some economic factors, such as motivating miners and punishing malicious nodes [Bitcoin and ethereum are not] to ensure a virtuous cycle of system development.
- Contract layer smart contract
- Develop some apps at the application layer, similar to the top layer of OSI
Consensus Mechanism
Proof work is like Bitcoin mining mechanism. Miners package existing transactions not recorded on the network into a block, and then continuously traverse and try to find a random number, this makes the hash value of the random number added to the new block meet certain difficulty conditions. Finding a random number that meets the conditions is equivalent to determining the newest block of the blockchain and obtaining the current round of Accounting permission of the blockchain.
Modern Cryptography Hash Function
Hash and hash functions are algorithms used to create fingerprints for data.
Get a fixed-length string by passing the original text of any length through a function.
A good hash algorithm rarely produces conflicts.
Asymmetric encryption
Asymmetric encryption is a key-secret method. Asymmetric encryption algorithms require two keys: public key and private key ). A public key is a pair of private keys. If a public key is used to encrypt data, only the corresponding private key can be used for decryption. If a private key is used to encrypt data, only the corresponding public key can be decrypted.
The most common ones are RSA and ECC.
- Difficulty in factorization large Integers
- Elliptic Curve Cryptography
Some data
Bitcoin 7tx/s
Ethereum 30tx/s
Smart contract example
IDE: https://remix.ethereum.org/
For example:
Etherecoin value: https://otc.huobi.com/#/trade
Introduction to blockchain and smart Contract & Security-1-blockchain Concept