MindMap Gallery ethers.js
A must-have library for the web3 front-end. The provider in ethers is an abstraction of the read-only connection to the eth network. You can read blockchain status such as accounts, blocks, transaction information, event logs, and execute read-only code through calls.
Edited at 2024-11-25 18:55:18This template shows the structure and function of the reproductive system in the form of a mind map. It introduces the various components of the internal and external genitals, and sorts out the knowledge clearly to help you become familiar with the key points of knowledge.
This is a mind map about the interpretation and summary of the relationship field e-book, Main content: Overview of the essence interpretation and overview of the relationship field e-book. "Relationship field" refers to the complex interpersonal network in which an individual influences others through specific behaviors and attitudes.
This is a mind map about accounting books and accounting records. The main contents include: the focus of this chapter, reflecting the business results process of the enterprise, the loan and credit accounting method, and the original book of the person.
This template shows the structure and function of the reproductive system in the form of a mind map. It introduces the various components of the internal and external genitals, and sorts out the knowledge clearly to help you become familiar with the key points of knowledge.
This is a mind map about the interpretation and summary of the relationship field e-book, Main content: Overview of the essence interpretation and overview of the relationship field e-book. "Relationship field" refers to the complex interpersonal network in which an individual influences others through specific behaviors and attitudes.
This is a mind map about accounting books and accounting records. The main contents include: the focus of this chapter, reflecting the business results process of the enterprise, the loan and credit accounting method, and the original book of the person.
ethers.js
concept
Provider
The provider in ethers is an abstraction of the read-only connection to the eth network. Can read blockchain status such as accounts, blocks, transaction information, event logs, and execute read-only code through call
Signer
Encapsulates all operations on the account.
The account has a private key stored somewhere
Either stored in memory using wallet
Either through IPC layer protection (for example, metamask proxies web page-related operations through a browser plug-in, protecting the private key from being directly accessed by the web page, and only operations allowed by the user will be executed.
Contract
Is a program deployed to the blockchain that contains code and allocated read-write storage
Read operations can be performed after connecting to the Provider.
You can perform modification operations after connecting to Signer
Transaction
Any modification to the status on the blockchain requires a transaction
Fee is needed to calculate, update and store information.
Transaction rollback also requires payment of fees. The validator needs to try to run the transaction to confirm the rollback and store the reason for the failed rollback.
Classification
ether transfer
Deploy contract
Modify contract status
Receipt
When the transaction is submitted, it will be queued in the memory pool and wait for the Validator to confirm whether to process the transaction.
The modification of the transaction will only be executed once when it is packaged into the blockchain, and a receipt will be generated. The receipt contains detailed transaction information, including the block, the fee and gas actually used, the events generated, and whether it was successful/rolled back.
unit
wei
smallest unit
Named after Wei Dai, the creator of b-money, the predecessor of Bitcoin
gwei
The most commonly used unit, gas fees generally use gwei units
ENS
Ethereum Name Service. A bit like dns, used to map human-readable names such as "alice.eth" to eth addresses/cryptocurrency addresses/content hashes/metadata.
application
connecteth
Connect metamask/other injection providers
The metamask plug-in will inject objects under window
Read-only access to eth (provider
Write operation authorization through private key (signer
When performing a write operation that requires authorization or requesting a private key address, metamask will pop up a window for the user to confirm.
Connect to custom rpc, such as development nodes or third-party services
Use JsonRpcProvider directly (follow link-jsonrpc protocol)
JsonRpCProvider.getSigner connect account
Unit conversion
Interacting with the blockchain
read status
Prerequisite: Provider is required
Current account status
History log
Contract code
Related operations
Send transaction
Prerequisite: Signer is required
For example, when sending a request to MetaMask, you can choose to agree or reject the operation in metamask.
contract
Is a meta-class, dynamically generated based on the incoming ABI at runtime
Create contract
abi
Binaries are required to interact with the Ethereum network
Multiple representations
solidity compiler uses JSON dump
Human-readable solidity function signatures
"function decimals() view returns (string)"
Read-only method. pure and view
Status modification method
Listen for events
Query historical events
If you query a large range of blockchains, it may be very, very slow or even report an error or truncate without prompting, which is determined by its backend.
Signature information
question
1. Is there a difference between fee and gas?
2. The relationship between Provider, metamask wallet and ethers
Provider is the connection provider for eth. Metamask has a built-in provider. Ethers can perform read-only queries on eth by using the built-in provider of metamask.
3. Conversion between units
study materials
https://www.wtf.academy/docs/ethers-101/
https://docs.ethers.org/v6/getting-started/#starting-blockchain