Struct NetworkArgs
pub struct NetworkArgs {Show 32 fields
pub discovery: DiscoveryArgs,
pub trusted_peers: Vec<TrustedPeer>,
pub trusted_only: bool,
pub bootnodes: Option<Vec<TrustedPeer>>,
pub dns_retries: usize,
pub peers_file: Option<PathBuf>,
pub identity: String,
pub p2p_secret_key: Option<PathBuf>,
pub p2p_secret_key_hex: Option<B256>,
pub no_persist_peers: bool,
pub nat: NatResolver,
pub addr: IpAddr,
pub port: u16,
pub max_outbound_peers: Option<usize>,
pub max_inbound_peers: Option<usize>,
pub max_peers: Option<usize>,
pub max_concurrent_tx_requests: u32,
pub max_concurrent_tx_requests_per_peer: u8,
pub max_seen_tx_history: u32,
pub max_pending_pool_imports: usize,
pub soft_limit_byte_size_pooled_transactions_response: usize,
pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
pub max_capacity_cache_txns_pending_fetch: u32,
pub net_if: Option<String>,
pub tx_propagation_policy: TransactionPropagationKind,
pub tx_ingress_policy: TransactionIngressPolicy,
pub disable_tx_gossip: bool,
pub propagation_mode: TransactionPropagationMode,
pub required_block_hashes: Vec<BlockNumHash>,
pub network_id: Option<u64>,
pub netrestrict: Option<String>,
pub enforce_enr_fork_id: bool,
}Expand description
Parameters for configuring the network more granularity via CLI
Arguments to setup discovery service.
Comma separated enode URLs of trusted peers for P2P connections.
–trusted-peers enode://abcd@192.168.0.1:30303
Connect to or accept from trusted peers only
Comma separated enode URLs for P2P discovery bootstrap.
Will fall back to a network-specific default if not specified.
Amount of DNS resolution requests retries to perform when peering.
The path to the known peers file. Connected peers are dumped to this file on nodes
shutdown, and read on startup. Cannot be used with --no-persist-peers.
Custom node identity
Secret key to use for this node.
This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used.
Hex encoded secret key to use for this node.
This will also deterministically set the peer ID. Cannot be used together with
--p2p-secret-key.
Do not persist peers.
NAT resolution method (any|none|upnp|publicip|extip:<IP>)
Network listening address
Network listening port
Maximum number of outbound peers. default: 100
Maximum number of inbound peers. default: 30
Maximum number of total peers (inbound + outbound).
Splits peers using approximately 2:1 inbound:outbound ratio. Cannot be used together with
--max-outbound-peers or --max-inbound-peers.
Max concurrent GetPooledTransactions requests.
Max concurrent GetPooledTransactions requests per peer.
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
Max number of transactions to import concurrently.
Experimental, for usage in research. Sets the max accumulated byte size of transactions to pack in one response. Spec’d at 2MiB.
Experimental, for usage in research. Sets the max accumulated byte size of transactions to request in one request.
Since RLPx protocol version 68, the byte size of a transaction is shared as metadata in a
transaction announcement (see RLPx specs). This allows a node to request a specific size
response.
By default, nodes request only 128 KiB worth of transactions, but should a peer request more, up to 2 MiB, a node will answer with more than 128 KiB.
Default is 128 KiB.
Max capacity of cache of hashes for transactions pending fetch.
Name of network interface used to communicate with peers.
If flag is set, but no value is passed, the default interface for docker eth0 is tried.
Transaction Propagation Policy
The policy determines which peers transactions are gossiped to.
Transaction ingress policy
Determines which peers’ transactions are accepted over P2P.
Disable transaction pool gossip
Disables gossiping of transactions in the mempool to peers. This can be omitted for personal nodes, though providers should always opt to enable this flag.
Sets the transaction propagation mode by determining how new pending transactions are propagated to other peers in full.
Examples: sqrt, all, max:10
Comma separated list of required block hashes or block number=hash pairs.
Peers that don’t have these blocks will be filtered out.
Format: hash or block_number=hash (e.g., 23115201=0x1234…)
Optional network ID to override the chain specification’s network ID for P2P connections
Restrict network communication to the given IP networks (CIDR masks).
Comma separated list of CIDR network specifications. Only peers with IP addresses within these ranges will be allowed to connect.
Example: –netrestrict “192.168.0.0/16,10.0.0.0/8”
Enforce EIP-868 ENR fork ID validation for discovered peers.
When enabled, peers discovered without a confirmed fork ID are not added to the peer set until their fork ID is verified via EIP-868 ENR request. This filters out peers from other networks that pollute the discovery table.
Source§
Source
Returns the resolved IP address.
Source
Returns the resolved bootnodes if any are provided.
Source
Returns the max inbound peers (2:1 ratio).
Source
Returns the max outbound peers (1:2 ratio).
Source
Configures and returns a TransactionsManagerConfig based on the current settings.
Source
Build a NetworkConfigBuilder from a Config and a EthChainSpec, in addition to
the values in this option struct.
The default_peers_file will be used as the default location to store the persistent peers
file if no_persist_peers is false, and there is no provided peers_file.
Configured Bootnodes are prioritized, if unset, the chain spec bootnodes are used Priority order for bootnodes configuration:
- –bootnodes flag
- Network preset flags (e.g. –holesky)
- default to mainnet nodes
Source
If no_persist_peers is false then this returns the path to the persistent peers file path.
Source
Sets the p2p port to zero, to allow the OS to assign a random unused port when the network components bind to a socket.
Source
Sets the p2p and discovery ports to zero, allowing the OD to assign a random unused port when network components bind to sockets.
Source
Change networking port numbers based on the instance number, if provided.
Ports are updated to previous_value + instance - 1
§Panics
Warning: if instance is zero in debug mode, this will panic.
Source
Resolve all trusted peers at once
Source
Load the p2p secret key from the provided options.
If p2p_secret_key_hex is provided, it will be used directly.
If p2p_secret_key is provided, it will be loaded from the file.
If neither is provided, the default_secret_key_path will be used.
Source
Creates an IP filter from the netrestrict argument.
Returns an error if the CIDR format is invalid.
§
§
Causes self to use its Binary implementation when Debug-formatted.
§
Causes self to use its Display implementation when
Debug-formatted.
§
Causes self to use its LowerExp implementation when
Debug-formatted.
§
Causes self to use its LowerHex implementation when
Debug-formatted.
§
Causes self to use its Octal implementation when Debug-formatted.
§
Causes self to use its Pointer implementation when
Debug-formatted.
§
Causes self to use its UpperExp implementation when
Debug-formatted.
§
Causes self to use its UpperHex implementation when
Debug-formatted.
§
§
Available on crate feature propagate-header only.
Propagate a header from the request to the response. Read more
§
Available on crate feature add-extension only.
§
Available on crate feature map-request-body only.
Apply a transformation to the request body. Read more
§
Available on crate feature map-response-body only.
Apply a transformation to the response body. Read more
§
Available on crate features compression-br or compression-deflate or compression-gzip or compression-zstd only.
Compresses response bodies. Read more
§
Available on crate features decompression-br or decompression-deflate or decompression-gzip or decompression-zstd only.
Decompress response bodies. Read more
§
Available on crate feature trace only.
High level tracing that classifies responses using HTTP status codes. Read more
§
Available on crate feature trace only.
High level tracing that classifies responses using gRPC headers. Read more
§
Available on crate feature follow-redirect only.
Available on crate feature sensitive-headers only.
Available on crate feature sensitive-headers only.
Available on crate feature sensitive-headers only.
Available on crate feature set-header only.
Insert a header into the request, if the header is not already present. Read more
Available on crate feature set-header only.
Insert a header into the response, if the header is not already present. Read more
§
Available on crate feature request-id only.
Add request id header and extension, using x-request-id as the header name. Read more
§
Available on crate feature request-id only.
Propgate request ids from requests to responses. Read more
§
Available on crate feature request-id only.
Propgate request ids from requests to responses, using x-request-id as the header name. Read more
§
Available on crate feature catch-panic only.
Catch panics and convert them into 500 Internal Server responses. Read more
§
§
Calls .tap() only in debug builds, and is erased in release builds.
§
Calls .tap_mut() only in debug builds, and is erased in release
builds.
§
Calls .tap_borrow() only in debug builds, and is erased in release
builds.
§
Calls .tap_borrow_mut() only in debug builds, and is erased in release
builds.
§
Calls .tap_ref() only in debug builds, and is erased in release
builds.
§
Calls .tap_ref_mut() only in debug builds, and is erased in release
builds.
§
Calls .tap_deref() only in debug builds, and is erased in release
builds.
§
Calls .tap_deref_mut() only in debug builds, and is erased in release
builds.
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 488 bytes