All Ethereum node communicate with each other through Ethereum Protocol. same way storing or accessing data.

16176125451508

Private Network: Ethereum can set up a Private Network,在私有网络中,可以使用 PoW 或者 PoA 算法。也就是可以搭建私有的以太坊联盟链。

参考:自己动手部署以太坊联盟链.md

Main Network、Testnet Network and Developer Network

  1. Main Network Persistent;Real-Blockchain;Costs Money
  2. Testnet Network Persistent, but can be deleted; Real-Blockchain;Beta Release. Test Smart Contracts, Protocol Updates
    1. Ropsten
    2. Rinkeby
    3. Gorli
  3. Developer Network Unit Testing;Fast;Non-Persistent Ganache

If you are testing on Ganache, at least before you going production,It's also very important you should test on the real network.

全节点和轻节点

首先要从「创始块」——中本聪 的论文说起,他在文中提到 SPV(Simplified Payment Verification),SPV 借助 Merkle Proof 机制,只需要保存最长区块链的所有块头的情况下,就能够验证对一笔支付交易是否在存在。相比较于全节点,实现 SPV 的客户端称为轻节点(Light Node)。

MetaMask & Infrua

deploy metamask,get ether from Test Network(usually Ropsten, Goerli Test Network) Steps: metamask

MetaMask, faucet.metamask.io, EtherScan 等是如何与区块链进行交互的。

  • MetaMask 通过与 Infura 服务连接,该服务通过运行 go-ethereum, parity 维护本地区块链节点,然后与区块链进行交互。

  • 浏览器访问的网站后端,存储着发送者的私钥与本地区块链节点,从而与区块链进行交互。

  • xx.etherscan.io 的后端服务器,部署存储 xx 网络的区块链节点,从而可以查看该区块链网络的交易变动。 etherscan

  • You need a blockchain node to interact with the Blockchain,either your own node,or hosted node.

  • The Blockchain is the single source of truth.

  • There are infrastructure providers to abstract running Blockchains away from developers, users to make the onboarding quite easy.

Development Environment

在 Remix 的 “DEPLOY & RUN TRANSACTIONS”,我们看到三种 ENVIRONMENT,分别为:JavaScript VM、Injected Web3、Web3 Provider。

三者的区别:

  1. Deploy & Run

  2. Difference between Javascript VM vs injected w3 vs web3 provider

  3. Remix Ethereum where goes the contract?

Web3 中指定测试网络的 chainid:用来防止重放攻击,在 EIP-155 中提出的。比如 chainid=1 是主网,因为是本地测试网络,所以随便取了一个 116。

详述 ethereum 中 ChainID 和 NetworkID

Mining on real Blockchains, even test-networks, can take a while. It's not very convenient for Development.

Ganache

Ganache is a Blockchain and a Wallet. Two in one. Anyone can connect to it using a Web3 Provider Method either via http RPC or WebSockets.

采用 MetaMask 自定义 RPC,添加 Ganache 的虚拟钱包地址,Remix-ide 选择 Injected-Web3 或 Web3-Provider.