miden-faucet

Crates.iomiden-faucet
lib.rsmiden-faucet
version0.10.1
created_at2024-04-27 10:09:45.786294+00
updated_at2025-07-15 01:04:30.451944+00
descriptionMiden node token faucet
homepagehttps://miden.xyz
repositoryhttps://github.com/0xMiden/miden-node
max_upload_size
id1222474
size391,818
Bobbin Threadbare (bobbinth)

documentation

README

Miden node

This crate contains a binary for running a Miden rollup faucet.

Running the faucet

  1. Run a local node using the docker image. From the "miden-node" repo root run the following commands:
make docker-build-node
make docker-run-node
  1. Install the faucet:
make install-faucet
  1. [Optional] Create faucet account (skip this step if you want to use an account from the genesis). This will generate authentication keypair and generate and write public faucet account data with its keypair into the file specified in output-path:
miden-faucet create-faucet-account \
  --output-path <path to faucet.mac> \
  --token-symbol MIDEN \
  --decimals 6 \
  --max-supply 100000000000000000

[!TIP] This account will not be created on chain yet, creation on chain will happen on the first minting transaction.

  1. Create the default faucet configuration file. Specify the path to the faucet account file created on the previous step in the -f flag (if you want to use an account from the genesis, specify the path to the faucet.mac file generated by the make-genesis command of the Miden node):
miden-faucet init -f <path to faucet.mac>
  1. Start the faucet server:
miden-faucet start

After a few seconds you may go to http://localhost:8080 and see the faucet UI.

Faucet security features:

The faucet implements several security measures to prevent abuse:

  1. Proof of Work requests:
  • Users must complete a computational challenge before their request is processed.
  • The challenge difficulty increases with the load. The load is measured by the amount of challenges that were submitted but still haven't expired.
  • Rate limiting: if an account submitted a challenge, it can't submit another one until the previous one is expired. The challenge lifetime duration is fixed and set when running the faucet.
  • API Keys: the faucet is initialized with a set of API Keys that can be distributed to developers. The difficulty of the challenges requested using the API Key will increase only with the load of that key, it won't be influenced by the overall load of the faucet.
  1. Requests batching:
  • Maximum batch size: 100 requests
  • Requests are processed in batches to optimize performance
  • Failed requests within a batch are handled individually
  1. Account rollbacks:
  • Faucet maintains the last 1000 account states for potential rollbacks

  • Is used in case a desync is detected

License

This project is MIT licensed.

Commit count: 776

cargo fmt