-
Notifications
You must be signed in to change notification settings - Fork 232
Deployment of ckb
Joining a ckb network is simply a matter of getting ckb up and running, but if you want to connect as many nodes as possible, you will need to do some simple configuration of the default ckb configuration and deployment environment.
The default configuration of the network section in ckb.toml
is as follows:
[network]
listen_addresses = ["/ip4/0.0.0.0/tcp/8115"]
public_addresses = []
max_peers = 125
max_outbound_peers = 8
whitelist_only = false
whitelist_peers = []
bootnode_mode = false
reuse_port_on_linux = true
public_addresses
: user can manually fill in the public address of the deployment machine, which will be propagated on the ckb network as much as possible so that other nodes can connect to your node through these addresses
max_peers
and max_outbound_peers
:determines the maximum number of nodes that the deployment node can connect to and the maximum number of nodes that it can actively connect to. If your environment is post-nat, that means that the probability that the number of nodes you can connect to is equal to max_outbound_peers
. Because your node cannot provide a valid public address, the success rate of nat penetration is relatively low, and it is difficult for other nodes to connect to your node voluntarily.
whitelist_only
and whitelist_peers
:When whitelist mode is enabled, only nodes in the list are allowed to connect.
bootnode_mode
: When bootnode mode is enabled, the node will randomly disconnect half of the nodes that remain connected when the connection limit is reached
reuse_port_on_linux
: In linux environments, the socket SO_REUSEPORT
option is enabled by default, which can effectively enhance the probability of the node being discovered in the whole network.
If deployed on a cloud service, it is recommended to open the corresponding port with listen_addresses
to allow other nodes to connect actively
It is recommended to adjust the relevant configurations to connect to more nodes. However, that more nodes connected means more resources to be consumed
On the Linux platform, we enabled the socket SO_REUSEPORT
option by default to help nodes discover within the network more efficiently. But we don't recommend starting ckb node by docker container with a mapping port model(issue), because it may happen that the outgoing port is randomly mapped.
If you insist on using docker, then we recommend starting docker with host network mode, like this:
docker run -d --network host -v {LOCAL_DATA_DIR}:/var/lib/ckb nervos/ckb:{VERSION} run