From ritual-dapp-skills
Estimates block times and converts blocks to seconds for Ritual dApps. Guides TTL, lock durations, scheduler frequency, and polling window settings.
npx claudepluginhub ritual-foundation/ritual-dapp-skills --plugin ritual-dapp-skillsThis skill uses the workspace's default tool permissions.
Use a conservative planning baseline of **~350ms per block** when you do not have fresh measurements from your target deployment.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Processes PDFs: extracts text/tables/images, merges/splits/rotates pages, adds watermarks, creates/fills forms, encrypts/decrypts, OCRs scans. Activates on PDF mentions or output requests.
Share bugs, ideas, or general feedback.
Use a conservative planning baseline of ~350ms per block when you do not have fresh measurements from your target deployment.
1 block ~= 0.35s100 blocks ~= 35s300 blocks ~= 105s (~1m45s)500 blocks ~= 175s (~2m55s)5,000 blocks ~= 1,750s (~29m10s)10,000 blocks ~= 3,500s (~58m20s)100,000 blocks ~= 35,000s (~9h43m)70,000 blocks ~= 24,500s (~6h48m)For one day:
blocksPerDay ~= ceil(86,400 / 0.35) = 246,858Before choosing production TTL/lock/scheduler values, estimate block time from recent chain data on your target RPC.
RPC_URL="${RPC_URL:-https://rpc.ritualfoundation.org}"
SAMPLE=60
LATEST=$(cast block-number --rpc-url "$RPC_URL")
OLDER=$((LATEST - SAMPLE))
LATEST_TS=$(cast block "$LATEST" --rpc-url "$RPC_URL" --json | jq -r '.timestamp')
OLDER_TS=$(cast block "$OLDER" --rpc-url "$RPC_URL" --json | jq -r '.timestamp')
uv run --quiet python3 - <<'PY' "$LATEST_TS" "$OLDER_TS" "$SAMPLE"
import sys
latest_ts = int(sys.argv[1], 0)
older_ts = int(sys.argv[2], 0)
sample = int(sys.argv[3])
avg_sec = (latest_ts - older_ts) / sample
print(f"Estimated block time: {avg_sec:.4f}s ({avg_sec*1000:.1f}ms)")
PY
If your measured value is materially different from 350ms, use the measured value in formulas below.
seconds = blocks * blockTimeSeconds
blocks = ceil(seconds / blockTimeSeconds)
Examples at blockTimeSeconds = 0.35:
ceil(3600 / 0.35) = 10,286 blocksceil(86400 / 0.35) = 246,858 blocksceil(900 / 0.35) = 2,572 blocksApply these conversions consistently in:
ttl / maxPollBlock windowsfrequency and interval tables