Pay-As-You-Go Contract Setup
Create Pay-As-You-Go (PAYG) Contract
#!/bin/bash
# Variables (update these as needed)
PROVIDER_PUBKEY="<provider-pubkey>" # Provider's registered public key
PROVIDER_API="<provider-api-host>:26657" # Provider's arkeod API endpoint
SERVICE="<service-name>" # Service string advertised by provider
CONTRACT_TYPE=1 # 1 = Pay-As-You-Go
CONTRACT_DEPOSIT=<deposit-amount> # Number of tokens to deposit
CONTRACT_DURATION=<duration-in-blocks> # Contract duration
CONTRACT_RATE="<rate>" # Example: "200uarkeo"
CONTRACT_SETTLEMENT=<settlement-duration> # Settlement window (blocks)
CONTRACT_QPM=<qpm> # Queries per minute limit
CONTRACT_AUTH=0 # 0 = STRICT, 1 = OPEN
CONTRACT_DELEGATE="" # Delegate pubkey (optional)
CLIENT_KEY="<your-client-key>" # Your client key name (local keyring)
KEYRING_BACKEND="test" # Use "file" or "os" for production
FEES="200uarkeo" # Transaction fee
# --- Get your client pubkey in Bech32 format ---
CLIENT_RAW_PUBKEY=$(arkeod keys show "$CLIENT_KEY" --output json --keyring-backend="$KEYRING_BACKEND" | jq -r .pubkey | jq -r .key)
CLIENT_PUBKEY=$(arkeod debug pubkey-raw "$CLIENT_RAW_PUBKEY" -t secp256k1 | grep 'Bech32 Acc:' | sed "s|Bech32 Acc: ||g")
echo "Provider pubkey: $PROVIDER_PUBKEY"
echo "Client pubkey: $CLIENT_PUBKEY"
# --- Open PAYG contract on-chain ---
arkeod tx arkeo open-contract \
"$PROVIDER_PUBKEY" \
"$SERVICE" \
"$CLIENT_PUBKEY" \
"$CONTRACT_TYPE" \
"$CONTRACT_DEPOSIT" \
"$CONTRACT_DURATION" \
"$CONTRACT_RATE" \
"$CONTRACT_QPM" \
"$CONTRACT_SETTLEMENT" \
"$CONTRACT_AUTH" \
"$CONTRACT_DELEGATE" \
--from="$CLIENT_KEY" \
--fees="$FEES" \
--keyring-backend="$KEYRING_BACKEND" \
--node tcp://$PROVIDER_API \
-yConfig Pay-As-You-Go (PAYG) Contract
View Pay-As-You-Go (PAYG) Contract
Test Pay-As-You-Go (PAYG) Contract
Close Pay-As-You-Go (PAYG) Contract
Last updated