Blockchain Development (12) Introduction to Public Chain, Alliance Chain, Private Chain and Network Configuration

The basis of the decentralized consensus of the Ethereum
network is the peer-to-peer network of participating nodes, and the nodes maintain and ensure the security of the blockchain network. See mining.
Ethereum Network Statistics
EthStats.net is a dashboard of real-time data on the Ethereum network. This dashboard displays important information such as current blocks, hash table difficulty, gas price and gas cost. The nodes shown on the page are just a selection of actual nodes on the network. Anyone can add their node on the EthStats dashboard. The Eth-Netstats README on Github describes how to connect.
EtherNodes.com presents current and historical data on node counts and other information on the Ethereum mainnet and Morden testnet.
Client implementation distribution on the current real-time network – real-time data on EtherChain.
Public, Private and Consortium Chains
Most Ethereum projects today rely on Ethereum as a public chain, and the public chain can access more users, network nodes, currencies and markets. However, there are often reasons to prefer private or consortium chains (within a group of trusted actors). For example, many companies in the banking space want Ethereum as a platform for their private chains.
The following is an excerpt from the blog post "On Public and Private Chains", which explains the difference in permissioning between the three blockchains:

  • Public chain: Anyone in the world can read and send transactions. All hope to see themselves included if they are legitimate. Anyone in the world can participate in the consensus formation process - deciding what blocks to add to the chain and what the status quo is. As an alternative to centralized or quasi-centralized trust, public chains are protected by a crypto-economy, which is a combination of economic incentives and cryptographic graph verification, using mechanisms similar to proof-of-work or proof-of-stake, following the general principle that people influence The degree to which consensus is formed is proportional to the amount of economic resources they can influence. This type of blockchain is often considered "completely decentralized".
  • Consortium chain: The consensus formation process is controlled by a pre-selected series of nodes. For example, imagine a group of 15 financial institutions, each of which operates a node. In order for a block to be valid, 10 of them must sign that block. The right to read the blockchain may be public, or limited to participants, and there are mixed paths, such as the block's root hash table and the application programming interface are exposed together, so that public members can make a certain amount of queries and recover a portion Cryptographic proof of blockchain state. This type of blockchain is considered "partially decentralized".
    Private chain: Writing permission remains centralized for an organization. Read permissions may be public or restricted to any degree. Applications are likely to include database management, auditing, etc. within a single company, so public readability is not necessary at all in many cases, but in other cases people want public readability.
  • Private chains/consortium chains may have nothing to do with public chains, and they still benefit the overall Ethereum ecosystem by investing in Ethereum software development. Over time, this translates into software improvements, knowledge sharing, and job opportunities.
    How to connect
    Geth keeps trying to connect to other nodes on the network until it has an endpoint. It will also accept connections from other nodes if you have UPnP available on your router or if you are running Ethereum on an internet facing server.
    Geth finds peers through a discovery protocol. In the discovery protocol, nodes chat with each other to discover other nodes on the network. Initially, geth uses a series of helper nodes whose endpoints are documented in the source code.
    Checking Connections and ENODE Identity
    To check how many peer endpoints a client has connected to on the interactive console, the net module has two properties that provide information that tells you the number of peer endpoints and which node you are listening on.
> net.listening
true
> net.peerCount
4

To learn more about connecting peer endpoints, such as IP addresses, port numbers, and supported protocols, use the peers() function of the administrator object. admin.peers() will return a list of peer endpoints that are connected so far.

> admin.peers
[{
ID: 'a4de274d3a159e10c2c9a68c326511236381b84c9ec52e72ad732eb0b2b1a2277938f78593cdbe734e6002bf23114d434a085d260514ab336d4acdc312db671b',
Name: 'Geth/v0.9.14/linux/go1.4.2',
Caps: 'eth/60',
RemoteAddress: '5.9.150.40:30301',
LocalAddress: '192.168.0.28:39219'
}, {
ID: 'a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c',
Name: 'Geth/v0.9.15/linux/go1.4.2',
Caps: 'eth/60',
RemoteAddress: '52.16.188.185:30303',
LocalAddress: '192.168.0.28:50995'
}, {
ID: 'f6ba1f1d9241d48138136ccf5baa6c2c8b008435a1c2bd009ca52fb8edbbc991eba36376beaee9d45f16d5dcbf2ed0bc23006c505d57ffcf70921bd94aa7a172',
Name: 'pyethapp_dd52/v0.9.13/linux2/py2.7.9',
Caps: 'eth/60, p2p/3',
RemoteAddress: '144.76.62.101:30303',
LocalAddress: '192.168.0.28:40454'
}, {
ID: 'f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0',
Name: '++eth/Zeppelin/Rascal/v0.9.14/Release/Darwin/clang/int',
Caps: 'eth/60, shh/2',
RemoteAddress: '129.16.191.64:30303',
LocalAddress: '192.168.0.28:39705'
} ]

Faster blockchain downloads The Ethereum
blockchain is automatically downloaded when the Ethereum client is launched. The time it takes to download the Ethereum blockchain varies depending on the client, client settings, connection speed, and number of endpoints available. Below are some options for faster access to the Ethereum blockchain.
Using geth
If you're using a geth client, here's what you can do to speed up the download time of Ethereum blocks. If you perform an Ethereum fast sync with the --fast flag, past transaction data will not be preserved.
Note: You cannot use this flag after performing all or part of the normal sync operation, i.e. you cannot download any part of the Ethereum blockchain before using this command. Check out this Ethereum Stack.Exchange answer to learn more.
Here are some flags to use when you want to sync clients faster.
The --fast
flag enables fast synchronization via state downloads instead of downloading the entire block data. This can also drastically reduce the size of the blockchain. Note: --fast will only run if the blockchain is synced from scratch and the first time the blockchain is downloaded for security reasons. Check out the Reddit post to learn more.
--cache=1024
Gigabytes of memory allocated to the internal cache (minimum 16MB / database). The default is 16MB, so depending on how much memory your computer has, increasing it to 256, 512, 1024 (1GB) or 2048 (2GB) will make a difference.
The --jitvm
flag activates the JIT VM.
Complete console command example:

geth --fast --cache=1024 --jitvm console

For more discussion on fast syncs and blockchain download times, check out this Reddit post.

Export/Import Blockchain
If you have synced your entire Ethereum node, you can export the blockchain data from the fully synced node and import it to the new node. You can do this by exporting all nodes in geth with the geth export filename command, and importing the blockchain into the nodes with geth import filename.
Static Nodes, Trusted Nodes and Start Nodes
Geth supports a feature called static nodes, if you have specific endpoints you will always want to connect with static nodes. If disconnected, static nodes connect again. You can configure permanent static nodes by putting the following into /static-nodes.json (this should be in the same folder as chaindata and keystone)

[
"enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303",
"enode://pubkey@ip:port"
]

You can also add static nodes at runtime via Javascript using admin.addPeer().

> admin.addPeer("enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae

Frequently Asked Questions about Connections
Sometimes you may not be able to connect. The most common reasons are:

  • The local time is incorrect. To participate in the Ethereum network, an accurate clock is required. Check how the OS synchronizes the clock (e.g. sudo ntpdate -s time.nist.gov ), even if it is only 12 seconds faster it may result in a 0 endpoint.
  • Some firewall configurations may block UDP traffic. Connections can be configured manually using the static node function or admin.addPeer() on the console.

To start geth without the discovery protocol, you can use the --nodiscover parameter. You only want to do this when running test nodes or experimental test networks with fixed nodes.
Let's summarize how to connect to other nodes. The following is a simple method:
You can connect to other nodes through the admin.addPeer() method. To connect two nodes, the network must be connected and the same networkid must be specified.
Suppose there are two nodes: node 1 and node 2, the networkid is 1108, you can connect from node 1 to node 2 through the following steps.
First of all, you need to know the enode information of node 2. Execute the following command in the js console of node 2 to view the enode information:

> admin.nodeInfo.enode  
"enode://9e86289ea859ca041f235aed87a091d0cd594b377cbe13e1c5f5a08a8a280e62d4019ac54063ed6a1d0e3c3eaedad0b73c40b99a16a176993f0373ffe92be672@[::]:30304"  

Then execute admin.addPeer() in the js console of node one to connect to node two:

> admin.addPeer("enode://9e86289ea859ca041f235aed87a091d0cd594b377cbe13e1c5f5a08a8a280e62d4019ac54063ed6a1d0e3c3eaedad0b73c40b99a16a176993f0373ffe92be672@127.0.0.1:30304")  

The parameter of ddPeer() is the enode information of node 2. Be careful to replace [::] in enode with the IP address of node 2. After the connection is successful, node 2 will start to synchronize the blocks of node 1. After the synchronization is completed, any node will start mining, and the other node will automatically synchronize the block, send transactions to any node, and the other node will also receive the transaction.
You can view other connected nodes information through admin.peers, and you can view the number of connected nodes through net.peerCount.
In addition to the above methods, you can also specify the --bootnodes option when starting a node to connect to other nodes.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325350208&siteId=291194637