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 theshouldRespond
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 isfalse
.whitelist
: A list of operator addresses that are allowed to opt into the trap. ["0x..", "0x.."].
CLI Argumentsâ
Argument | Default | Description |
---|---|---|
--config-path (-c) | Looks in current and parent directories | The path to the drosera.toml file |
--non-interactive (-n) | False | Determines 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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-amount | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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-amount | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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-number | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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-number | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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 | |
--operators | The 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â
Argument | Default | Description |
---|---|---|
--eth-rpc-url | The node used for querying and sending transactions | |
--drosera-rpc-url | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The 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 | |
--limit | The new bloom boost limit as a percentage in basis points i.e 10000 bps = 100%, 3100 bps = 31%. Default is 0 bps (0%) |