Skip to main content

ENS external schemas

Kurabase resolves a normalized ENS name through the Universal Resolver and uses it as an external SQL schema. Ordinary reads use a standard quoted identifier:

SELECT * FROM "some.eth".posts;

The gateway reconstructs the target Kurabase contract at the same data-chain block as the local query. External rows use that instance's anonymous RLS context: a local service_role or owner never inherits foreign authority.

The JavaScript SDK uses the same PostgREST profile mechanism:

const { data, error } = await kurabase
.schema('some.eth')
.from('posts')
.select('*')

Enable resolution​

Set a Universal Resolver address on the gateway. KURA_ENS_RPC_URL is optional: when omitted, name resolution uses KURA_RPC_URL. It is useful when an L2 data instance resolves names through an Ethereum RPC.

# The stable ENS Universal Resolver on Ethereum Mainnet and Sepolia.
KURA_ENS_UNIVERSAL_RESOLVER=0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe
# Optional, must be an operator-controlled HTTPS RPC URL.
KURA_ENS_RPC_URL=https://your-ethereum-rpc.example

For the hackathon demo, use Ethereum Sepolia for the ENS record. If data lives on another chain, configure the Ethereum RPC separately and treat the ENS lookup and data-chain blocks as distinct observations.

The discovery endpoint is public because ENS records are public:

GET /meta/v1/ens/kura.eth

It returns the normalized name, resolved address, resolver address, ENS RPC chain ID and the resolver read block. It does not grant gateway delegation, administrator access, or a user session.

Cross-instance management DML​

A privileged gateway can execute one direct INSERT, UPDATE, or DELETE against an ENS-discovered target through POST /admin/v1/sql:

INSERT INTO "community.eth".profiles (id, display_name)
VALUES (42, 'Ada')
RETURNING id, display_name;

This is not authority derived from the local instance. The same gateway signer must be independently owner/developer or a currently delegated privileged gateway at community.eth's resolved contract. Kurabase rebuilds that target at the request's pinned data-chain block, evaluates its own KuraSQL integrity rules, and commits its WritePlan using the target revision. The response names the resolved target in schemas and returns its transaction hash.

An application user/session signed for the local contract cannot be replayed against another EIP-712 verifying contract. Therefore this first path is management DML only; it is not a PostgREST/SDK application write route. One statement writes one target instance. Target DDL, migrations, cross-instance functions, multi-contract atomic transactions and cross-chain writes remain unsupported.

Current limits​

  • Only already-normalized lowercase ASCII .eth names are accepted. Unicode ENSIP-15 normalization is not claimed yet.
  • The gateway calls the ENS Universal Resolver's addr(bytes32) path. It does not follow CCIP-Read callback URLs; a resolver that needs CCIP-Read fails closed.
  • Direct privileged management DML is supported as described above. DDL, migrations and views against an ENS schema remain unsupported. A local table can instead declare a stable address-bound external foreign key; the gateway never persists a mutable ENS name as that constraint's target.
  • The current external projection replays from genesis. It is suitable for the demo/testnet slice; production needs deployment metadata and bounded event indexing.

ENS supplies a mutable address lookup, never write authority. The SQL response includes schemas[name] metadata with the resolved contract, resolver and the data-chain snapshot used for that request.