backlog-md/backlog/tasks/task-009 - NLA-Oracle-Base-...

74 lines
3.1 KiB
Markdown

---
id: task-009
title: 'NLA Oracle - Base Sepolia deployment and integration'
status: In Progress
assignee: []
created_date: '2026-03-15 07:00'
labels:
- blockchain
- ai
- infrastructure
dependencies: []
priority: high
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Deploy and operate a Natural Language Agreements (NLA) oracle on Base Sepolia. The oracle uses AI (Anthropic Claude) to arbitrate blockchain escrows defined in plain English. Contracts are pre-deployed by Alkahest on Base Sepolia. The oracle container (`nla-oracle`) is running and listening for arbitration requests.
**Oracle address**: `0x2d2E0a49B733E3CBB2B6C04C417aa5E24cd2A70F`
**Repo**: `/opt/apps/natural-language-agreements`
**Container**: `nla-oracle`
**Network**: Base Sepolia (chain 84532)
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Oracle container deployed and running on Base Sepolia
- [x] #2 Secrets stored in Infisical (private key, Anthropic API key)
- [x] #3 Oracle starts from current block (avoids public RPC getLogs limit)
- [ ] #4 Fund oracle wallet with Base Sepolia ETH for gas
- [ ] #5 Create and test a demo escrow end-to-end
- [ ] #6 Explore integration with DefectFi / CRDT escrow project
- [ ] #7 Consider upgrading to paid RPC (Alchemy) for production reliability
- [ ] #8 Optionally add OpenAI provider as fallback alongside Anthropic
<!-- AC:END -->
## Notes
### Completed (2026-03-15)
- Cloned `arkhai-io/natural-language-agreements` to `/opt/apps/natural-language-agreements`
- Created Dockerfile (bun-based single-stage) and docker-compose.yml
- Patched oracle to use `fromBlock: currentBlock` to avoid public RPC 10k block limit
- Stored secrets in Infisical `/ai/` folder (`NLA_ORACLE_PRIVATE_KEY`, `ANTHROPIC_API_KEY`)
- Container `nla-oracle` running, polling every 10s on Base Sepolia
- Created demo script at `demo/demo.ts` — Content Creation Bounty use case
- Alice locks 1000 BOUNTY tokens, demands a blog post about regenerative economics
- Bob submits a blog post, oracle (Claude) evaluates and arbitrates
### Blocking: Fund 3 wallets with Base Sepolia ETH
| Wallet | Address | Needed |
|--------|---------|--------|
| Oracle | `0x2d2E0a49B733E3CBB2B6C04C417aa5E24cd2A70F` | ~0.005 ETH |
| Alice (demo) | `0x2E9d13530C3880edB42f2b18fC0Bdc7d527872Ae` | ~0.01 ETH |
| Bob (demo) | `0x739C83BEbdDb8A68c0a76f2F59E40729A7F184F9` | ~0.005 ETH |
Faucets: [Alchemy](https://www.alchemy.com/faucets/base-sepolia) or [Coinbase](https://portal.cdp.coinbase.com/products/faucet)
### Technical details
- Alkahest TrustedOracleArbiter: `0x3664b11BcCCeCA27C21BBAB43548961eD14d4D6D`
- ERC20EscrowObligation: `0x1Fe964348Ec42D9Bb1A072503ce8b4744266FF43`
- Public RPC `https://sepolia.base.org` has 10k block getLogs limit — handled via `fromBlock: currentBlock`
- Polling interval: 10s
- Demo state file: `demo/.demo-state.json`
### Run demo after funding
```bash
cd /opt/apps/natural-language-agreements
bun run demo/demo.ts create # deploy token + create escrow
bun run demo/demo.ts fulfill # Bob submits blog post
docker logs -f nla-oracle # watch Claude evaluate
bun run demo/demo.ts collect # Bob collects tokens
```