Randcast users can leverage our tool to manage their subscription and consumer contracts, read and filter historical requests and fulfillment results, and estimate the gas cost of the callback function, all in one place.
Note: This is our recommended method to interact with Randcast, but we also offer additional methods, such as direct contract interaction, in the .
create a <WORK_DIR> as the directory for Randcast CLI on your host, e.g. /home/ubuntu/randcast-cli
prepare a user_config.yml under <WORK_DIR> of your host. Please see the for reference.
Note: we recommend directly setting account identity in user_config.yml rather than passing an env variable to docker.
use -H to set a file to save history commands.
--network=host(optional config for local chains)
If you want the Randcast CLI container to access a local chain on the host (ex: Anvil), you can use the above flag. This will allow the container to access ports on the localhost such as "".
Steps
Note: Always use [COMMAND] -h to get help.
Create a subscription:
ARPA User CLI〉send cs <CHAIN_ID>
Get subscriptions(<SUB_ID>):
ARPA User CLI〉randcast mss <CHAIN_ID>
my subscriptions: [
1,
]
Write and deploy a consumer contract. Here we use forge from Foundry to complete this step.
Note that --rpc-url is needed unless you are performing tests using a local chain:
Query historical randomness requests paid by the subscription
Note: it is possible to add an optional filter to filter by consumer address or by status (pending / success / failed). You can view these options by running randcast rs --help.