Skip to main content

Drosera CLI ðŸ–Ĩïļ

The Drosera CLI is a command line tool used to create, manage, and monitor Traps on the Drosera Network. It utilizes a configuration file to manage your Traps and their configurations. It can be installed by following the getting started guide here.

Configuration​

Drosera.toml​

The drosera.toml file is used to configure the Drosera CLI. The file is used to define the traps that are being mananged and the response contracts that are triggered when a trap is triggered.

[traps]

[traps.hello_world]
path = "out/HelloWorldTrap.sol/HelloWorldTrap.json"
response_contract = "0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8"
response_function = "pause(uint256)"
cooldown_period_blocks = 33
min_number_of_operators = 1
max_number_of_operators = 2
block_sample_size = 10
  • traps: The section where all the traps are defined.
  • traps.<name>: The name of the trap.
  • path: The path to the trap's JSON file that contains the ABI and bytecode.
  • response_contract: The address of the contract to call when a response is triggered.
  • response_function: The function signature to call on the response contract.
  • cooldown_period_blocks: The number of blocks to wait before triggering another response.
  • min_number_of_operators: The minimum number of operators to execute the trap and trigger a response.
  • max_number_of_operators: The maximum number of operators that can opt into the trap.
  • block_sample_size: The number of blocks required by the shouldRespond function to make a decision.
  • private_trap: A boolean value that determines if the trap is private or public. Private traps can only be opted-into by trap-whitelisted operators. Default is false.
  • whitelist: A list of operator addresses that are allowed to opt into the trap. ["0x..", "0x.."].

CLI Arguments​

ArgumentDefaultDescription
--config-path (-c)Looks in current and parent directoriesThe path to the drosera.toml file
--non-interactive (-n)FalseDetermines if a user prompt is required before creating or updating traps

Commands​

The CLI command options can be configured using CLI arguments, the drosera.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

NOTE: Make sure to run the CLI from the same directory as the drosera.toml file. The DROSERA_PRIVATE_KEY environment variable is required to deploy the trap. You can also set it in the drosera.toml file as private_key = "0x..".

config​

Displays the current configuration file.

plan​

Displays the traps that will be created or updated based on the configuration file.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with

dryrun​

Runs all traps in the drosera.toml file on a local ad-hoc operator, testing the collect and shouldRespond functions. This is also run for you automatically in the apply command.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with

apply​

Creates or updates traps based on the configuration file. If an address field is specified in the configuration file, the trap is updated. If the address field is not specified, the trap is created and the address of the deployed Trap Config address is set in the config file by the CLI.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.

hydrate​

Hydrate the specified trap. This is how you incetivize operators to monitor your trap. This sends DRO to the traps' trap_rewards contract.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to hydrate. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--dro-amountThe amount of DRO you want to hydrate your trap with. Amount is expected in human form (not on-chain form)

bloomboost​

Bloom boost the specified trap. This is how you boost a trap's emergency response execution with ETH to entice block builders to include the tx in the mempool. This sends ETH to the traps' trap_rewards contract.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to boost. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--eth-amountThe amount of ETH you want to boost your trap with. Amount is expected in ETHER (not WEI)

dispute​

Dispute an optimistic claim using a ZK proof. A Bonsai API Key and Bonsai URL are required, otherwise local proving can be performed if your machine has docker and x86_64 architecture.

export BONSAI_API_KEY=
export BONSAI_API_URL="https://api.bonsai.xyz/"
Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to dispute. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--block-numberThe block number to peform a dispute on

zkclaim​

Perform ZK incident response for a trap. A Bonsai API Key and Bonsai URL are required, otherwise local proving can be performed if your machine has docker and x86_64 architecture.

export BONSAI_API_KEY=
export BONSAI_API_URL="https://api.bonsai.xyz/"

Args​

ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to claim. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--block-numberThe block number to peform claim

kick-operator​

Kick one or more operators from a trap so they are no longer opted in. If you do not also remove the operator from the trap's whitelist, they will simply be able to opt back in.

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to kick operators from. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--operatorsThe address of one or more operators to kick from the given trap. Ex: --operators 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f

set-bloomboost-limit​

Update the percentage of a trap's ETH balance that can be used for bloom boosting a response action. Default value is 0 bps (0%).

Args​
ArgumentDefaultDescription
--eth-rpc-urlThe node used for querying and sending transactions
--drosera-rpc-urlThe url of the seed node or operator to send the trap bytecode to
--eth-chain-idderived from the ethereum rpcThe chain id
--private-keyThe private key used to sign transactions
--drosera-addressderived from chain idThe address of the main Drosera proxy contract to interact with
--non-interactivefalseNormally the command will prompt you for final approval before executing. This will bypass that check.
--trap-addressThe address of the on-chain trap (config) to kick operators from. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file
--limitThe new bloom boost limit as a percentage in basis points i.e 10000 bps = 100%, 3100 bps = 31%. Default is 0 bps (0%)