1 unstable release
new 0.0.1 | Jan 8, 2025 |
---|
#7 in #stealth
46KB
518 lines
stealth-gas-cli
a command line tool for client side cryptographic operations for a Stealth Gas Station service that wraps the eth-stealth-gas-tickets rust library.
Installation
cargo install stealth-gas-cli
Supported Networks
- Holesky Ethereum (chain id: 17000)
(more soon)
Usage
step 1: fetch the coordinator pubkey and other public parameters (this is just for convenience you can fetch this onchain yourself as well)
stealth-gas params --rpc-url https://ethereum-holesky-rpc.publicnode.com
step 2: generate unsigned tickets
stealth-gas new --k 0xCoordinatorPubKey --n 10 --o unsigned_tickets.json
now user can extract the msg data from each unsigned ticket and craft a buyGasTickets() transaction on the StealthGasStation contract (see contract repo for a helper script to do this)
step 3: after buying gas tickets (wait for finalization), scan the chain for blind signatures that match your unsigned tickets
stealth-gas scan --rpc-url https://ethereum-holesky-rpc.publicnode.com -c 0xGasStationAddress -i unsigned_tickets.json -s 1000000 --o finalizeable.json
step 4: finalize the blind signatures to generate redeemable gas tickets
stealth-gas finalize --rpc-url https://ethereum-holesky-rpc.publicnode.com --i finalizeable.json --o signed_tickets.json
with finalized gas tickets user can now send a SpendRequest to the coordinator server and redeem any number of finalized gas tickets, pointing the funds to the address of their choosing.
example:
curl -X POST http://coordinatorURL.com/spend -H "Content-Type: application/json" -d '{ "signatures": [<SignedTickets>], "spends": [{"amount": "2000000000000000", "receiver": "0xYourAddress"}]}'
here we redeem two signed tickets (of 0.001 ETH each) and send all the result to 0xYourAddress. If 0xYourAddress is anonymous, then redeemer retains privacy because no one knows which ticket was redeemed (not even the coordinator).
Dependencies
~20–28MB
~481K SLoC