Pura's platform layer lets you connect any domain-specific capacity signal to the core BPE engine. You register a domain adapter, normalize your capacity data to a standard 0-10,000 range, and immediately gain access to cross-domain reputation scoring and multi-protocol routing.
You need: a wallet with Base Sepolia ETH and test tokens.
npm install @puraxyz/sdk viemimport { createWalletClient, createPublicClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { baseSepolia } from 'viem/chains'
import { getAddresses } from '@puraxyz/sdk'
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)
const wallet = createWalletClient({ account, chain: baseSepolia, transport: http() })
const public_ = createPublicClient({ chain: baseSepolia, transport: http() })
const addrs = getAddresses(84532)The UniversalCapacityAdapter accepts any domain-specific capacity signal and normalizes it to a 0-10,000 basis-point range that the core BPE engine understands. Your domain might be GPU compute capacity, file storage availability, bandwidth metering, or anything else that has variable supply.
import { normalizeCapacity, routeAttestation } from '@puraxyz/sdk/actions/platform'
// Your domain identifier
const domainId = '0x' + Buffer.from('gpu-compute').toString('hex').padEnd(64, '0') as `0x${string}`
// Normalize a raw capacity signal from your domain
// The adapter converts domain-specific units to the 0-10000 BPS range
const rawSignal = '0x...' as `0x${string}` // your domain's raw capacity encoding
const normalized = await normalizeCapacity(public_, addrs, domainId, rawSignal)
console.log('Normalized capacity:', normalized, '/ 10000')Once your domain is registered, route EIP-712 signed attestations from your domain's participants into the core BPE system:
// Sign an attestation in your domain's format, then route it
const attestation = '0x...' as `0x${string}` // signed attestation bytes
await routeAttestation(wallet, addrs, domainId, attestation)The adapter verifies the attestation signature, normalizes the capacity, and feeds it into the core CapacityRegistry where it participates in EWMA smoothing and pool distribution like any other capacity signal.
Every participant that registers in your domain automatically accumulates reputation on the ReputationLedger. Reputation is portable across all Pura domains with two properties:
import { getAggregateReputation, getStakeDiscount, getAccountDomains }
from '@puraxyz/sdk/actions/platform'
const rep = await getAggregateReputation(public_, addrs, account.address)
console.log('Cross-domain reputation:', rep)
const discount = await getStakeDiscount(public_, addrs, account.address, domainId)
console.log('Stake discount from reputation:', discount, '/ 10000')
const domains = await getAccountDomains(public_, addrs, account.address)
console.log('Active in domains:', domains)A participant who has earned reputation in the Lightning domain can stake less when entering your custom domain, and vice versa.
The CrossProtocolRouter selects between Superfluid (streaming), Lightning (instant), and on-chain (settlement) based on payment amount, speed requirements, and available liquidity.
import { isProtocolAvailable } from '@puraxyz/sdk/actions/platform'
// Check which protocols are available for routing
// 0 = Superfluid, 1 = Lightning, 2 = On-chain
const sfAvailable = await isProtocolAvailable(public_, addrs, 0)
const lnAvailable = await isProtocolAvailable(public_, addrs, 1)
console.log('Superfluid:', sfAvailable, '| Lightning:', lnAvailable)Here is how the pieces fit together for a GPU compute platform:
gpu-compute domain with a capacity adapter that maps GPU TFLOPS to 0-10,000 BPS