August 15, 2018

What is Block chain

[Block chain]

❑ Blockchain : The computer using P2P based distributed DB. Or the technology to make up this computer.
* P2P based distributed data storage creates data(blocks) and interconnects them using a consensus algorithm.
* Four major functions : Cryptocurrency, Smart Contract, Smart Asset, DAO.
❑ Side chain : A technology that allows trading of assets that exist in different block chains.
❑ On chain : Using Blockchain.
❑ Off chain : Not using Blockchain.
❑ Lightning Network(LN) : The technology allows sending and receiving cryptocurrencies immediately without mining.
* If a payment channel is written to a block, a transaction is not required to be written to the block because the off-chain verification method is used.
❑ Raiden network : It means Etherium's lightning network.
❑ A block is a storage. The gathered blocks are called distributed DB..
❑ The cryptocurrency issuance is made by recording in a block according to a specific format created by a dedicated program.
❑ Crypt wallet is a dedicated program.
❑ the data types of the bitcoin blockchain and the Ethereum blockchain are different. So each network's data is not compatible.
❑ The condition for data integrity in a blockchain.
❍ The format of the recorded data is correct.
❍ It is equal if comparing my data to data of other blocks.
❑ The member of the blockchain network.
❍ Node(miner) : A server in the blockchain network. Run DAPP. Create blocks(Transaction approval, distributed consensus, Storing transaction history.).
* Master node : The node that performs additional functions(anonymization, governance participation, etc.).
❍ Client(user) : Server users(Transaction creation, transaction history verification.).
❑ If a client creates a transaction, nodes share and execute the transaction through a distributed consensus.
❑ The blockchain node has two DBs.
❍ Transaction DB.
❍ Application(Smart contract) DB : It stores the latest state (variables) of the smart contract.
❑ Smart contract : Software. Application. DApp.
❑ The state of a smart contract : A variable used in a smart contract.
❑ Interface for using smart contracts.
❍ Transaction : Write, Modify. Delete. It is recorded in transaction DB. It changes the state of a smart contract.
❍ Query : Read.  It is not recorded in transaction DB. It reads the state of a smart contract.
At present, Transaction is slower than regular DB, but Query can be faster than regular DB.
❑ If the miner succeeds in mining, the miner receives transaction fee and compensation for the block issuance and.
❑ The miner creates a block first by processing a transaction that has a higher fee to increase mining compensation.
❑ A simple calculation has small fee, and a complex calculation has high fee.
❑ Transaction is a signed data package.
❑ Fork : Version update of a blockchain software.
* Miners update mining software and users update user software(wallet etc.).
❑ Hard fork : Creating a new main net.
❍ At a specific time, it copies blocks applied the old rule and connects the blocks to which the new rule is applied for constructing a new blockchain network.
❍ All miners/users should update their software.
❍ Service is not available during the update.
❑ Soft fork
❍ At a specific time, it connects the blocks applied the new rule to blocks which the old rule is applied.
❍ miners should update their software, but users don't need that.
❍ Service is available during the update.
❑ Test net : A blockchain network for testing before launching the main net..
❑ Main net : A block-chain network with an independent environment that is platform/transaction/wallet etc.
❑ Private blockchain : A closed blockchain network(Intranet).
❑ Public blockchain : A opened blockchain network(Internet).
❑ Token : A cryptocurrency application implemented in an existing main net.
* The tokens on Ethereum network are implemented in Solidity language.
❑ Coin : A cryptocurrency application implemented in its independent main net.
* Ethereum coin was implemented in languages other than Solidity(C++, GO).
❑ ICO(Initial Coin Offering) : Supporting the fund by appealing the blockchain technology. It is similar to IPO in that it distributes tokens to sponsors.
❑ ICO is usually implemented using Ethereum smart contract.
In "etherscan.io", you can find the corresponding ICO DApp by searching with the address.
* Investments and token distributions are made transparent and real time.
❑ Typical blockchain network building process.
1. Issue tokens in existing blockchain network.
* e.g. Issue ERC-20 tokens in Ethereum network.
2. Raise the fund through ICO and distributes tokens to participants.
3. Launch the test net for preparing the main net.
* In general, development status is disclosed to GitHub.
4. Launch the main net and issue coins.
5. Exchange the issued tokens and the coins.
❑ PoW(Proof Of Work) : Being the node by solving the hash problem.
❑ PoS(Proof Of Stake) : Being the node by having coins(stake).
❑ DPoS(Delegated Proof Of Stake) : It is the same as PoS but nodes are selected by electing.
The nodes of the DPoS are called delegated node or witness etc.




[Bitcoin]

❑ nBits : Filling the left side of the hash value with zeros. It affects mining difficulty because, If the miner's hash value is smaller than the hash value adjusted by nBits, mining will be achieved.
❑ Bitcoin script
❍ The first smart contract.
❍ Loop cannot be used(If a loop is allowed, the infinite loop occurs.).
❑ In the bitcoin network, the decentralized application called bitcoin is the main application.




[Ethereum]

❑ A block chain platform specialized in smart contract.
* Ethereum smart contract is written in Solidity language and becomes EVM Bytecode after being compiled.
❑ Solidity : The object-oriented programming language capable of developing Ethereum DAPP..
❑ Web3.js : The JavaScript library that interacts with an Ethereum smart contract.
❑ All cryptocurrency(token) issued on the Ethereum network are smart contracts.
* EOS token and crypto kitty are all just DApp.
❑ Ethereum combines transaction DB and smart contract DB for high compression ratio.
❑ Examples of Etherium's most famous smart contract is DAO(Decentralized Autonomous Organization)
* DAO tokens enable the company to make decisions.
* DAO smart contracts were attacked by hackers because of vulnerabilities.
❑ EVM(Ethereum Virtual Machine) : The node drives EVM and can run EVM Bytecode.
❑ GAS : The fee incurred when EVM Bytecode is executed.
* Unlike Ethereum coin, it maintains a constant price.
* Ethereum coin is used for GAS payments.
* The miner can determine the gas quantity to reject the transaction of the lower fee.
* Max fee : GAS limit * GAS price.
❍ GAS Limit : The max gas quantity that transaction generates.
* As a result of transactions, it is possible to use less gas than GAS Limit("GAS Used By Txn" displays this.).
❍ GAS Price(unit : wei).
* 1 Wei = 1/10^18 ETH
* 1 Kwei = 1/10^15 ETH
* 1 Mwei = 1/10^12 ETH
* 1 Gwei = 1/10^9 ETH
❑ Ethereum uses a node search protocol based on the Kadelima protocol.
❑ DApp distribution.
❍ TestRPC(Ganache) : Virtual environment. ETH can be issued without mining. The smart contract distributed can be deleted.
❍ TestNet : Ethereum network for testing. The difficulty of mining is low.
❍ MainNet : The actual Ethereum network that consumes gas when a transaction occurs.
❑ Ethereum's smart contract/wallet address length is 20 Bytes.
❑ ERC(Ethereum Request for Comment) : The standard recommended for cryptocurrency DApp of Etereum network.
❍ ERC-20(https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md)
❍ ERC-721(https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md)
- Each token cannot be split into decimal points.
- Each token has an ID.