Skip to main content

Run the Drosera Operator Node 💻

Running the Drosera Operator Node is a simple process. This guide will walk you through the steps to run the Operator Node, enabling you to begin executing Traps and earning rewards.

The Operator Node can quickly be started using the following the command:

drosera-operator node --eth-rpc-url <rpc-url> --eth-private-key <private-key> --network-public-address <public-address>

The network-public-address is required for the Operator to be discoverable by other nodes. The public address can either be an IP address or a domain name. If a domain name is used, the domain must resolve to the public IP address of the Operator.

note

Access to an EOA private key is required as of now. Remoting signing via AWS KMS and GCP will be supported in the future.

If the Operator Node is configured correctly, you should see the following output:

INFO drosera_operator::node: Operator Node successfully spawned!

Configuration​

The Operator Node can be configured using CLI arguments, a toml config file, or with environment variables. A combination of either can also be used. The order of precedence is as follows:

  • Command line arguments
  • TOML configuration file ./drosera.toml
  • Environment variables / .env file

CLI Arguments​

ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--eth-chain-idderived from eth rpcThe chain id
--eth-private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--db-file-path./data/drosera.dbThe path to the database file to use for persistence when not in dev mode
--dev-modefalseRuns the Operator node without persisting data
--block-polling-interval-ms1000The number of milliseconds to wait between polling for new blocks
--disable-dnr-confirmationfalse"Disabes the DNR confirmation. Only set this if you are running this node behind a NAT, and you are receiving a 'Failed to confirm DNR' error message. Verify the public address setting is correct and any firewall walls are opened for the configured ports before turning this setting on.
--log-levelinfoThe log level for the Operator Node (info, warn, error, trace, debug). You can also specify directives similar to the RUST_LOG env variable. e.g. "info,drosera_services::network::p2p=debug".
--log-formatfullThe log format for the Operator Node (full, compact, pretty, json)
--log-outputstdoutThe log output for the Operator Node (stdout, file)
-vThe verbosity level to use for instrumentation. -v = warn, -vv = info, -vvv = debug, -vvvv = trace
--otel-export-endpoint""The OpenTelemetry Collector endpoint to send metrics and trace data too
--otel-export-metadata{}The OpenTelemetry Collector metadata to send with metrics and trace data. e.g. Authorization Headers
--otel-resource-attributes""Add resource attribute labels to all collected OpenTelemetry metrics, traces and logs. e.g. "operator_address=0x530719E8fe572C909945Deb045e491865FF2bab0,operator_name=cobra"
--network-listen-address0.0.0.0The network interface to bind the Operators HTTP and P2P server to
--network-public-addressThe public IP address of the Operator node
--network-p2p-port31313The TCP port to bind the P2P server to
--network-public-p2p-port31313The public TCP port the operator will broadcast as its external port for p2p networking. This is needed for the use of network proxies. The port of the proxy server where the p2p traffic will be routed to, by other peers, is set here. Default is --network-p2p-port
--network-http-port31314The TCP port to bind the HTTP server to
--network-public-http-port31313The public TCP port the operator will broadcast as its external port for it's rpc server. This is needed for the use of network proxies. The port of the proxy server where the RPC traffic will be routed to, by other peers, is set here. Default is --network-http-port
--network-secret-key--eth-private-keyThe secret key used to sign messages sent over the network and generating a peer id
--network-p2p-discovery-seconds300The number of seconds to wait between P2P discovery
--network-p2p-register-ttl-seconds7200The number of seconds before the registration TTL expires and when to refresh registration to become discoverable
--network-p2p-min-register-ttl-seconds7200The minimum number of seconds a peer registration TTL can be set to
--network-p2p-max-register-ttl-seconds7200The maximum number of seconds a peer registration TTL can be set to
--helpDisplay the help menu
--versionDisplay the version of the Operator Node

TOML Configuration​

The Operator Node can be configured using a TOML configuration file. The configuration file should be named drosera.toml and placed in the root directory of the Operator Node. The configuration file should be formatted as follows:

drosera_address = 0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8
db_file_path = "./data/drosera.db"
block_polling_interval_ms = 1000
dev_mode = false

[eth]
private_key = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
chain_id = 17000
rpc_url = "http://localhost:8545"

[network]
public_address = "localhost" # or 127.0.0.1
listen_address = 0.0.0.0
p2p_port = 31313
http_port = 31314
p2p_discovery_seconds = 300
p2p_register_ttl_seconds = 7200
p2p_min_register_ttl_seconds = 7200
p2p_max_register_ttl_seconds = 7200

[instrumentation]
log_level = "info"
log_format = "full"
log_out = "stdout"
otel_export_endpoint = "http://localhost:4317"
otel_export_metadata = { authorization = "Basic ..." }
otel_resource_attributes = { operator_address = "0x530719E8fe572C909945Deb045e491865FF2bab0", operator_name = "cobra" }

Environment Variables​

All of the CLI arguments can be set as environment variables. The environment variables should be prefixed with DRO- and use uppercase letters. For example, the --eth-rpc-url argument would be set as DRO-ETH-RPC-URL. The - indicates a new level in the hierarchy.

Example configuration:

export DRO-DROSERA_ADDRESS=0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8
export DRO-DB_FILE_PATH=./data/drosera.db
export DRO-BLOCK_POLLING_INTERVAL_MS=1000
export DRO-ETH-RPC_URL=http://localhost:8545
export DRO-ETH-CHAIN_ID=17000
export DRO-ETH-PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export DRO-NETWORK-RPC_PORT=31314
export DRO-NETWORK-P2P_PORT=31313
export DRO-INSTRUMENTATION-LOG_LEVELL=info
export DRO-INSTRUMENTATION-OTEL_EXPORT_ENDPOINT=http://localhost:4317