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-backup-rpc-urlA backup Ethereum RPC if the primary RPC node becomes unresponsive. This arg is optional
--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
--gas-reimbursement-requiredfalseWhether or not gas reimbursement is required to submit a claim. Omitting this flag will default to false.
--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.
--listen-address0.0.0.0The network interface to bind the Operators RPC and P2P server to
--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-external-p2p-addressThe external address to reach the Operator node at for p2p communications
--network-external-rpc-address${network-external-p2p-address}The external address to reach the Operator node's rpc server. Useful for proxies. Default is the network external p2p address. If provided and starts with either http or https, the value will be used as is by the seed node to retrieve liveness data. Otherwise, if a dns or ip is provided without a protocol, http is assumed and the server port will be appended.
--network-p2p-port31313The TCP port to bind the P2P server to
--network-secret-key--eth-private-keyThe secret key used to sign messages sent over the network and generating a peer id
--server-port31314The TCP port to bind the rpc server to
--server-concurrency-limit100The maximum number of concurrent requests the RPC server can handle
--server-connection-limit500The maximum number of concurrent connections the RPC server can handle
--server-requests-per-second 10The maximum number of requests per second the RPC server accepts before rate limiting. Only applicable if rate limit by ip is turned on.
--server-rate-limit-by-iptrueEnable rate limiting by IP address
--server-burst-size10The maximum number of requests that can be bursted before rate limiting within the requests per second window. Only applicable if rate limit by ip is turned on.
--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
listen_address = "127.0.0.1"

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

[network]
p2p_port = 31313
secret_key = ""
external_p2p_address = ""

[server]
port = 31314
concurrency_limit = 100
connection_limit = 500
requests_per_second = 10
rate_limit_by_ip = false
burst_size = 10

[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 namespacing.

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__BACKUP_RPC_URL=http://localhost:8545
export DRO__ETH__CHAIN_ID=17000
export DRO__ETH__PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export DRO__SERVER__PORT=31314
export DRO__NETWORK__P2P_PORT=31313
export DRO__INSTRUMENTATION__LOG_LEVELL=info
export DRO__INSTRUMENTATION__OTEL_EXPORT_ENDPOINT=http://localhost:4317