Paid Functions

Monetize Smart Contracts — On-Chain API Economy

Turn any read-only smart contract function into a paid API endpoint. Fees enforced at the protocol level. Resellers earn commissions. Developers build revenue streams. Welcome to the on-chain API economy — where every function call is a transaction.

Smart Contracts as Paid Services

Read-only functions as paid endpoints, co-signature reseller model, and async billing — all protocol-native

  • Read-only functions as paid endpoints — any smart contract can designate specific read-only functions as "paid." When a caller invokes a paid function, the fee is automatically deducted and sent to the contract owner. No payment gateway, no subscription service, no middleman — just protocol-enforced payment for value.
  • Fees stored in contract state — fee configuration (price per call, currency, discount tiers) lives directly in the smart contract's state. The contract owner updates pricing through a standard transaction. Transparent, auditable, immutable until changed by the authorized key.
  • Co-signature reseller model — third parties can become resellers by co-signing function calls. The reseller adds their signature to the call, and the protocol automatically splits the fee between the contract owner and the reseller. An entire distribution network, trustlessly on-chain.
  • Async billing & result caching — for expensive computations, callers can request async execution. The result is cached on-chain and delivered when ready. Subsequent calls for the same parameters hit the cache — pay once, read many times. Ideal for data feeds, analytics, and reporting.
  • SDK integration — the ATSHI SDK provides first-class support for paid functions. Discover available endpoints, check pricing, call with automatic payment, and handle results — all in a few lines of code. Build paid APIs as easily as you build free ones.

How Paid Functions Work

1. Define Paid Function Contract owner marks a read-only function as paid, sets price per call
2. Caller Invokes SDK attaches payment to the function call — seamless for the developer
3. Fee Collection Protocol deducts fee and routes to contract owner (and reseller if applicable)
4. Result Delivered Function executes and returns result — cached for subsequent identical calls

Reseller Model

Co-Signature Reseller co-signs the call — protocol splits fee automatically between owner & reseller
Distribution Network Unlimited resellers, each with custom commission rates defined in contract state

Why On-Chain Paid Functions Are Revolutionary

APIs have always required trust. Paid Functions replace trust with protocol enforcement.

💰

New Revenue Streams

Every smart contract becomes a potential revenue source. Data providers, oracle operators, analytics services — anyone with valuable on-chain logic can monetize it per-call without building payment infrastructure.

Revenue
🔒

Trustless Payments

No invoices, no payment disputes, no chargebacks. The protocol enforces payment at the moment of the function call. You get paid before the result is delivered. Every time. Guaranteed by mathematics.

Security
🌐

Reseller Network

Build a global distribution network with zero trust required. Resellers co-sign calls and earn commissions automatically. No contracts, no negotiations, no payment reconciliation. Just deploy and earn.

Distribution
💻

Developer-Friendly

The SDK makes paid functions feel like regular API calls. Discover endpoints, check prices, attach payment, and handle results — all in familiar code patterns. No blockchain expertise required on the caller side.

Developer Experience

Result Caching

Expensive computations are cached on-chain. The first caller pays full price; subsequent callers with identical parameters get the cached result at a fraction of the cost. Efficient, fair, and automatic.

Performance
📊

Transparent Pricing

All fees are stored in the contract state and publicly auditable. No hidden charges, no surprise rate hikes. Callers see the exact cost before invoking. Price changes are on-chain transactions — fully transparent.

Transparency

ATSHI Paid Functions vs. The Alternatives

Traditional APIs require trust and intermediaries. ATSHI Paid Functions require neither.

Feature Chainlink Functions AWS Lambda Traditional APIs ATSHI Paid Functions
Payment Enforcement LINK token pre-fund Credit card / billing API keys / invoices Protocol-enforced per-call
Middleman Chainlink network AWS Payment processor None — direct
Reseller Model None None native Manual affiliates Co-signature native
Result Caching None on-chain CloudFront (off-chain) CDN / Redis On-chain native
Revenue Transparency Partial (on-chain) Opaque billing Opaque Fully on-chain
Decentralization Partially (DON) Centralized Centralized Fully decentralized
Commission Splits None None Manual setup Automatic on-chain

Build the On-Chain API Economy — Start Earning Today

Turn your smart contracts into revenue-generating services. Set your price, deploy your function, recruit resellers, and let the protocol handle payments. The API economy just went trustless.