What is Smart Contract
NCKU GDSC Smart Contact study group ( Week 1 )
reference : 「在 2022 年,我們該如何寫智能合約」 on iThome
D1 - D10
Introduction to blockchain ( Ethereum )
D1 : What is block
and chain
-
Feature :
- can't by modify
- decentralized
-
Block :
- Transaction :
A block contains many transaction . Transaction can be classcify by Create
and Execute
.
- Action :
- Create :
Deployment of Smart Contract
- Execute :
- Recieving Ether
- Interact with Samrt Contract
- Properties :
- Recipient :
- Address ( The address of recipient )
- Value
- Nonce :
- Signature :
Sign by private key of sender
- Value :
amount of Ether
- data
- The most important , send data to contract
- Gas Limit
- maxPriorityFeePerGas
- maxFeePerGas
-
Chain :
- The order of Transaction
- Connecting the block
-
Gas :
- Why :
Every transaction require computation resources . Base on Fee-For-Service System
, the sender account has to pay the fee.
- Gas ? :
the Unit that describe computation resources ( describe the any operation cost running on EVM (Ethereum Virtual Machine)
)
- GasLimit :
The max amount of gas that sender can pay in this transaction . ( Note that , if the GasLimit < the gas that the transaction needs , the transaction will fail( revert
) )
-
Fee :
- BaseFee :
- Prioroty Fee :
- Max Fee:
- Max Fee = Fee per Gas
- Fee per Gas = BaseFee + Priority Fee
- The transaction tool will calculate itself
- Total Fee :
- Total Fee = Max Fee * Used Gas
-
Account :
- Balance
- Call
- can interact with Smart Contract
- EOA ( Externally-owned account ) :
- just like our personal acount
- Balance
- Nonce
- Is able to :
- recive/sende Ether :
- interact with Contract Account
- Contract Account :
- Balance
- Nonce
- Codehash
- storageRoot / storageHash
- Is able to :
- recive/send Ether :
- will only start by EOA
-
NetWork :
- Chain ID :
- MainNet
- TestNet :
-
Consensus :
-
Miner / Validator :
-
PoW :
-
PoS :
-
Intro to Ethereum Stack :
-
EIP ( Ethereum Improvement Proposals ) :
-
ERC ( Ethereum Request for Comments )
-
Example of Smart Contract