The automated seed elevation system is fully implemented and configured. This document provides a complete overview of the system architecture, endpoints, and testing procedures.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AUTOMATED DAILY FLOW β
β Runs at 00:00 UTC Daily β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VERCEL CRON JOB β
β POST /api/admin/select-winner?autoElevate=true β
β Auth: Bearer <CRON_SECRET> β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββ΄ββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β STEP 1: Base Sepolia β β STEP 2: Eth Sepolia β
β β β β
β TheSeeds Contract β β AbrahamCovenant β
β .selectDailyWinner() β β .commitDailyWork() β
β β β β
β - Calculate scores β β AbrahamAuction β
β - Select winner β β .createAuction() β
β - Mark as winner β β β
β - Increment round β β - Mint NFT β
β - Start new period β β - Create 24h auction β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
File: vercel.json
{
"crons": [
{
"path": "/api/admin/select-winner?autoElevate=true",
"schedule": "0 0 * * *"
}
]
}Schedule: Daily at 00:00 UTC (midnight)
Authentication: Uses CRON_SECRET environment variable
# Base Sepolia (TheSeeds)
L2_SEEDS_CONTRACT=0x6b4086d8713477737294968fe397d308664a755a
BASE_SEPOLIA_RPC_URL=https://base-sepolia.g.alchemy.com/v2/...
NETWORK=baseSepolia
# Ethereum Sepolia (Abraham)
ABRAHAM_COVENANT_ADDRESS=0x5bd79b4bb138e39a42168e9d60e308c86f9dcf15
ABRAHAM_AUCTION_ADDRESS=0xb0eb83b00f0f9673ebdfb0933d37646b3315b179
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/...
# Private Keys
PRIVATE_KEY=<your-private-key>
# Authentication
ADMIN_KEY=father-abraham
CRON_SECRET=<your-cron-secret>Endpoint: POST /api/admin/select-winner?autoElevate=true
Description: Complete automated flow - selects winner, mints creation, starts auction
Authentication:
- Cron:
Authorization: Bearer <CRON_SECRET> - Manual:
X-Admin-Key: <ADMIN_KEY>
Response:
{
"success": true,
"data": {
"winningSeedId": 0,
"round": 1,
"txHash": "0x...",
"blockExplorer": "https://sepolia.basescan.org/tx/0x...",
"seed": {
"id": 0,
"creator": "0x...",
"ipfsHash": "ipfs://Qm...",
"blessings": 2
},
"abraham": {
"tokenId": 0,
"auctionId": 13,
"mintTxHash": "0x...",
"auctionTxHash": "0x...",
"mintExplorer": "https://sepolia.etherscan.io/tx/0x...",
"auctionExplorer": "https://sepolia.etherscan.io/tx/0x..."
},
"timestamp": "2025-12-09T13:29:24.000Z",
"message": "Winner selected and auto-elevated to Abraham creation. Daily auction started."
}
}Implementation: src/routes/admin.ts:339-589
Endpoint: POST /api/admin/select-winner
Description: Only selects winner on Base, doesn't elevate to Abraham
Authentication: X-Admin-Key: <ADMIN_KEY>
Response:
{
"success": true,
"data": {
"winningSeedId": 0,
"round": 1,
"seed": {...},
"message": "Winner selected successfully. New blessing period started.",
"nextStep": "To elevate to Abraham creation, call: POST /admin/elevate-seed?seedId=0"
}
}Endpoint: POST /api/admin/elevate-seed?seedId={id}
Description: Manually elevate a winning seed to Abraham creation
Authentication: X-Admin-Key: <ADMIN_KEY>
Query Parameters:
seedId: The ID of the winning seed to elevate (required)
Response:
{
"success": true,
"data": {
"seedId": 0,
"seed": {...},
"abraham": {
"tokenId": 0,
"auctionId": 13,
"mintTxHash": "0x...",
"auctionTxHash": "0x...",
"mintExplorer": "https://sepolia.etherscan.io/tx/0x...",
"auctionExplorer": "https://sepolia.etherscan.io/tx/0x..."
},
"timestamp": "2025-12-09T13:29:24.000Z",
"message": "Seed elevated to Abraham creation successfully. Daily auction started."
}
}Implementation: src/routes/admin.ts:777-927
Endpoint: GET /api/admin/winner-diagnostics
Description: Check if system is ready for winner selection
Authentication: X-Admin-Key: <ADMIN_KEY>
Response:
{
"success": true,
"ready": true,
"diagnostics": {
"currentRound": 1,
"seedsInRound": 5,
"timeRemaining": 0,
"votingPeriodEnded": true,
"currentLeader": {
"seedId": 0,
"score": "1414213562",
"blessings": "2"
},
"eligibleSeeds": 3,
"allSeedScores": [...]
}
}Endpoint: POST /api/admin/create-auction?tokenId={id}
Description: Create auction for already-minted token (recovery endpoint)
Authentication: X-Admin-Key: <ADMIN_KEY>
Query Parameters:
tokenId: Token ID to auction (required)durationInDays: Auction duration in days (optional, default: 1)minBidInEth: Minimum bid in ETH (optional, default: 0.01)
Use Case: When token was minted but auction creation failed
npx tsx scripts/testElevationFlowApi.tsWhat it does:
- Checks winner diagnostics
- Calls
/api/admin/select-winner?autoElevate=true - Verifies complete flow execution
- Displays all transaction details
File: scripts/testElevationFlowApi.ts
npx tsx scripts/testElevationFlow.tsWhat it does:
- Selects winner directly via contract
- Elevates winner via abrahamService
- Creates auction
- Verifies auction is active
File: scripts/testElevationFlow.ts
curl -H "X-Admin-Key: father-abraham" \
http://localhost:3000/api/admin/winner-diagnosticsnpx tsx scripts/checkVotingState.tsnpx tsx scripts/checkAbrahamCreations.tsnpx tsx scripts/checkAuction.ts <tokenId>npx tsx scripts/findWinningSeeds.tsFile: src/services/abrahamService.ts
Key Methods:
Lines: 446-560
Combines minting + auction creation into single operation:
- Calls
commitDailyWork(ipfsHash)β mints NFT - Calls
createDailyAuction(tokenId)β starts auction - Returns complete result with both transaction hashes
Lines: 210-335
Mints Abraham creation NFT on Sepolia covenant
Lines: 343-437
Creates 24-hour auction for minted token
Error: "Voting period not ended (12345s remaining)"
Solution: Wait until 24 hours have passed since last winner selection
Error: "No valid winner - no seeds in round"
Solution: Create seeds for current round before attempting selection
Error: "Seed has no IPFS hash - cannot elevate"
Solution: Ensure winning seed has valid IPFS hash before elevation
Error: "Already committed work today"
Solution: Wait until next UTC day (resets at 00:00 UTC)
Error: "Minted successfully but failed to create auction"
Solution: Use recovery endpoint:
curl -X POST -H "X-Admin-Key: father-abraham" \
"http://localhost:3000/api/admin/create-auction?tokenId=<tokenId>"1. Vercel cron triggers
ββ> POST /api/admin/select-winner?autoElevate=true
2. System checks:
β Voting period ended (24 hours)
β Seeds exist in current round
β At least one seed has blessings
β No previous winner in this round
3. Select winner on Base Sepolia:
ββ> TheSeeds.selectDailyWinner()
- Calculate sqrt(blessings) Γ time_decay
- Mark winner
- Increment round
- Start new 24h period
4. Elevate to Ethereum Sepolia:
ββ> AbrahamCovenant.commitDailyWork(ipfsHash)
- Mint NFT to covenant
- Store metadata
ββ> AbrahamAuction.createAuction(tokenId)
- Create 24h auction
- Set min bid 0.01 ETH
- Start immediately
5. Success Response:
ββ> Return complete transaction details
- Winner selection tx (Base)
- Mint tx (Sepolia)
- Auction tx (Sepolia)
- Cron jobs:
Authorization: Bearer <CRON_SECRET> - Manual calls:
X-Admin-Key: <ADMIN_KEY>
β οΈ Only 1 creation can be minted per UTC day- Enforced by
AbrahamCovenant.hasCommittedToday() - Resets at 00:00 UTC
- β IPFS hash must not be empty
- β Seed must be marked as winner
- β Voting period must have ended
- β At least one eligible seed must exist
- TheSeeds:
0x6b4086d8713477737294968fe397d308664a755a(Base Sepolia) - AbrahamCovenant:
0x5bd79b4bb138e39a42168e9d60e308c86f9dcf15(Eth Sepolia) - AbrahamAuction:
0xb0eb83b00f0f9673ebdfb0933d37646b3315b179(Eth Sepolia)
- contractService: Handles Base Sepolia interactions
- abrahamService: Handles Eth Sepolia interactions
Before deploying to production, verify:
- Cron job configured in vercel.json
- All environment variables set in Vercel
- CRON_SECRET configured and secure
- Wallet has sufficient ETH on both networks
- Contracts deployed and addresses correct
- Test endpoint with manual trigger
- Verify auction creation works
- Check diagnostics endpoint responds
- Monitor first automated execution
- Verify Vercel logs capture output
- Automated Flow Guide: AUTOMATED_FLOW.md
- Elevation Guide: ELEVATION_GUIDE.md
- Deployment Guide: DEPLOYMENT.md
The automated seed elevation system is fully configured and operational. The daily cron job will automatically:
- β Select winning seed from Base Sepolia
- β Mint Abraham creation on Ethereum Sepolia
- β Start 24-hour auction immediately
- β Log all transactions and results
No manual intervention required! π€