The system automatically selects a daily winner from TheSeeds (Base Sepolia), elevates it to an Abraham Creation (Ethereum Sepolia), and starts a 24-hour auction β all without manual intervention.
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 (Bearer token)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DAILY AUTOMATED EXECUTION (00:00 UTC) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. VERCEL CRON JOB TRIGGERS β
β POST /api/admin/select-winner?autoElevate=true β
β Auth: Bearer <CRON_SECRET> β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. PRE-FLIGHT CHECKS β
β β Voting period ended? (24 hours passed) β
β β Seeds exist in current round? β
β β At least one seed has blessings? β
β β No previous winner in this round? β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ
β All checks pass? β
βββββββββββ¬ββββββββββ
β
βββββββββββββββββ΄ββββββββββββββββ
β NO β YES
βΌ βΌ
βββββββββββββββ βββββββββββββββββββ
β Return 400 β β Proceed to β
β with error β β winner selectionβ
βββββββββββββββ βββββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. SELECT WINNER (Base Sepolia) β
β Contract: TheSeeds.selectDailyWinner() β
β - Calculates sqrt(per-user blessings) Γ time_decay β
β - Selects seed with highest score β
β - Marks seed.isWinner = true β
β - Sets seed.winnerInRound = currentRound β
β - Increments round number β
β - Emits WinnerSelected event β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 4. FETCH WINNER DATA β
β - Get seed details from TheSeeds contract β
β - Extract: id, ipfsHash, creator, blessings β
β - Validate: ipfsHash is not empty β οΈ CRITICAL β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 5. ELEVATE TO ABRAHAM CREATION (Ethereum Sepolia) β
β β
β STEP 1/2: MINT CREATION β
β Contract: AbrahamCovenant.commitDailyWork(ipfsHash) β
β - Validates ipfsHash not empty β
β - Checks not already committed today β
β - Stores: _tokenURIs[tokenId] = ipfsHash β
β - Mints: _safeMint(covenantAddress, tokenId) β
β - Emits: NFTMinted(tokenId, covenant) β
β β
β STEP 2/2: CREATE AUCTION β
β Contract: AbrahamAuction.createAuction() β
β - Token: newly minted tokenId β
β - Duration: 86400 seconds (24 hours) β
β - Start: block.timestamp (immediate) β
β - Min Bid: 0.01 ETH β
β - Emits: AuctionCreated(auctionId, tokenId) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 6. RESPONSE & LOGGING β
β β
Winner ID, Round, IPFS Hash β
β β
Token ID, Auction ID β
β β
Transaction hashes (Base + Sepolia) β
β β
Etherscan explorer links β
β π All logged to Vercel logs for monitoring β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AUCTION NOW LIVE - 24 HOURS β
β Users can bid on Sepolia via AbrahamAuction contract β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
POST /api/admin/select-winner?autoElevate=true
Authorization: Bearer <CRON_SECRET>Endpoint: admin.ts:339-577
Authentication:
- Vercel sends
Authorization: Bearer <CRON_SECRET> - Middleware checks
CRON_SECRETenvironment variable - Falls back to
X-Admin-Keyfor manual triggers
Contract: TheSeeds @ 0x6b4086d8713477737294968fe397d308664a755a
Function: selectDailyWinner()
Algorithm:
- Check voting period ended (24 hours)
- Find all seeds in current round
- Calculate blessing score for each:
score = Ξ£ sqrt(blessings_per_user) Γ time_decay_factor - Select seed with highest score
- Mark as winner, increment round
Service: contractService.ts:672-832
Diagnostics: Available at /api/admin/winner-diagnostics
Critical Checks:
// 1. Seed exists
const seed = await contractService.getSeed(winningSeedId);
// 2. Has IPFS hash (CRITICAL!)
if (!seed.ipfsHash || seed.ipfsHash.trim() === "") {
throw new Error("No IPFS hash - cannot elevate");
}
// 3. Abraham service configured
if (!abrahamService.isConfigured()) {
throw new Error("Abraham service not configured");
}Validation: admin.ts:452-470
Contract: AbrahamCovenant @ 0x5bd79b4bb138e39a42168e9d60e308c86f9dcf15
Function: commitDailyWork(string ipfsHash)
Process:
- Verify not already committed today
- Calculate current day number
- Store metadata:
_tokenURIs[tokenId] = ipfsHash - Mint to covenant:
_safeMint(address(this), tokenId) - Update daily work tracking
- Emit
NFTMinted(tokenId, covenantAddress)
Service: abrahamService.ts:209-303
Logging:
π STEP 1/2: Minting Abraham creation on Sepolia...
IPFS Hash being committed: "ipfs://Qm..."
β
MINTING SUCCESS
Token ID: 0
Tx Hash: 0x...
Explorer: https://sepolia.etherscan.io/tx/0x...
Contract: AbrahamAuction @ 0xb0eb83b00f0f9673ebdfb0933d37646b3315b179
Function: createAuction(tokenId, startTime, duration, minBid)
Parameters:
tokenId: from Step 4startTime: 0 (immediate)duration: 86400 (24 hours)minBid: 10000000000000000 (0.01 ETH)
Process:
- Verify covenant owns token
- Verify covenant approved auction contract
- Create auction struct
- Link tokenId β auctionId
- Emit
AuctionCreated(auctionId, tokenId, ...)
Service: abrahamService.ts:306-392
Logging:
π STEP 2/2: Creating daily auction...
Token ID: 0
Duration: 1 day
Min Bid: 0.01 ETH
β
AUCTION CREATION SUCCESS
Auction ID: 13
Tx Hash: 0x...
Explorer: https://sepolia.etherscan.io/tx/0x...
{
"success": true,
"data": {
"winningSeedId": 0,
"round": 1,
"txHash": "0x...",
"blockExplorer": "https://sepolia.basescan.org/tx/0x...",
"seed": {
"id": 0,
"creator": "0x641f...",
"ipfsHash": "ipfs://QmTiAN3G6xvgnE6hEgUMbs8T2zCZzuwEm1zPvvn4iQgKNa",
"blessings": 2,
"isWinner": true,
"winnerInRound": 1
},
"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."
}
}{
"success": false,
"error": "No valid winner - no seeds in round or all have blessing score of 0",
"diagnostics": { ... }
}Status: 400
{
"success": false,
"error": "Voting period not ended (12345s remaining)"
}Status: 400
{
"success": false,
"error": "Seed 0 has no IPFS hash - cannot elevate to Abraham creation"
}Status: 400
{
"success": false,
"error": "Winner selected but elevation failed: Already committed work today",
"step": "elevation",
"nextStep": "Retry elevation with: POST /admin/elevate-seed?seedId=0"
}Status: 500
{
"success": false,
"error": "Minted successfully but failed to create auction: ...",
"data": {
"tokenId": 0,
"mintTxHash": "0x...",
"nextStep": "Use POST /api/admin/create-auction?tokenId=0"
}
}Status: 500
Recovery: Use /api/admin/create-auction?tokenId=0
- 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
- Uses
PRIVATE_KEYwallet for transactions - Ensure sufficient ETH on both:
- Base Sepolia (winner selection)
- Ethereum Sepolia (minting + auction)
View automated execution logs at:
https://vercel.com/[your-project]/deployments
Search for:
π ELEVATION STARTED
β
MINTING SUCCESS
β
AUCTION CREATION SUCCESS
π ELEVATION COMPLETE
curl -X POST -H "X-Admin-Key: father-abraham" \
"http://localhost:3000/api/admin/select-winner?autoElevate=true"# Winner readiness
curl -H "X-Admin-Key: father-abraham" \
http://localhost:3000/api/admin/winner-diagnostics
# Abraham status
npx tsx scripts/checkAbrahamCreations.ts
# Find winning seeds
npx tsx scripts/findWinningSeeds.ts- Check Vercel cron configuration
- Verify
CRON_SECRETis set in Vercel env vars - Check deployment logs for errors
- Run diagnostics:
GET /api/admin/winner-diagnostics - Verify seeds exist in current round
- Check voting period has ended
- Ensure at least one seed has blessings
- Check already committed today:
npx tsx scripts/checkAbrahamCreations.ts - Verify IPFS hash is not empty
- Check wallet has enough ETH on Sepolia
- Review contract owner/permissions
- Verify token was minted successfully
- Check covenant approved auction contract
- Manually create auction:
POST /api/admin/create-auction?tokenId=X
======================================================================
π ELEVATION STARTED - 2025-12-10T00:00:15.000Z
======================================================================
Seed ID: 5
Round: 3
IPFS Hash: ipfs://QmXYZ...
Creator: 0xABC...
Blessings: 42
π STEP 1/2: Minting Abraham creation on Sepolia...
IPFS Hash being committed: "ipfs://QmXYZ..."
β
MINTING SUCCESS
Token ID: 2
Tx Hash: 0xDEF...
π STEP 2/2: Creating daily auction...
Token ID: 2
Duration: 1 day
Min Bid: 0.01 ETH
β
AUCTION CREATION SUCCESS
Auction ID: 15
Tx Hash: 0xGHI...
======================================================================
π ELEVATION COMPLETE - 2025-12-10T00:00:45.000Z
======================================================================
β
Winner Selected: Seed ID 5 (Round 3)
β
Creation Minted: Token ID 2
β
Auction Created: Auction ID 15
======================================================================
-
TheSeeds (Base Sepolia):
- Seed marked
isWinner = true - Round incremented
- New 24-hour period started
- Seed marked
-
AbrahamCovenant (Sepolia):
- New token minted
- Metadata stored in
_tokenURIs - Owner: Covenant contract
-
AbrahamAuction (Sepolia):
- New auction created
- Status: Active
- Duration: 24 hours
Every day at 00:00 UTC:
- β Winner selected from previous day's seeds
- β Creation minted on Ethereum Sepolia
- β 24-hour auction starts immediately
- β Users can bid throughout the day
- β Next day: New winner selected, new auction starts
The system runs automatically without manual intervention! π€