Demos › Smart Contracts

Smart Contracts as REST APIs

Any read function on any EVM smart contract becomes a plain HTTP endpoint. No Web3 library, no RPC key, no MetaMask. Your consumer calls a URL and gets JSON back. The API owner's Opsalis handles the blockchain side and earns per call.

From Solidity to JSON

Consumer Premises
Your App
Your Opsalis
Control Center
On your premises
▼ Request ▲ Response
Opsalis Global Network
🔒 Encrypted 🔗 Automatic Payment 🌐 5 Delivery Methods
Proprietary fully encrypted protocol with automatic payment settlement
▼ Request ▲ Response
Owner Premises
Their Opsalis
Control Center
Smart Contract
(Any EVM Chain)
On their premises

What is the Opsalis control center? A single Docker container you run on your own machine — a laptop, a Raspberry Pi, a cloud server. It connects you to the Opsalis Global Network. Through its built-in web console, you browse services, register your own, manage your wallet, and monitor your earnings. Installation takes minutes. It is completely free, forever.

docker run -d --name my-opsalis -p 3000:3000 -p 3002:3002 opsalis/wrapper:latest

The Opsalis Global Network uses a proprietary fully encrypted protocol. All traffic is end-to-end encrypted. Settlement is automatic.

What the owner did: installed their Opsalis control center, registered a service on the Opsalis network through the web console, set their price, and started earning USDC on every call. The Opsalis Global Network handles the rest.

How to use this service

Any developer worldwide can consume this service from their own Opsalis control center. Here is the complete flow from installation to first price feed call:

1

Install your Opsalis control center

One Docker command on any machine -- your laptop, a Raspberry Pi, a cloud VM.

$ docker run -d --name my-opsalis -p 3000:3000 -p 3002:3002 opsalis/wrapper:latest
2

Browse the catalog

Open your web console at https://localhost:3002/panel. Go to the Catalog tab. Search for the service you need -- use keywords, tags, or browse by category.

3

Preview with demo samples

Click on any service to see its full description, available endpoints, and sample data. Try it in the Swagger sandbox -- demo samples are free, no payment needed. See exactly what the price feed response looks like before you spend a cent.

4

Fund your wallet

Go to the Finance tab. Deposit USDC and a small amount of ETH for gas. Your control center shows both balances and alerts you when they are low.

5

Call it from your code

Copy your consumer secret from Settings. Use the service UUID from the catalog. Make your first real call -- no Web3 library, no wallet, just HTTP:

$ curl -X POST https://localhost:3000/internal/call \ -H "Authorization: Bearer YOUR_CONSUMER_SECRET" \ -H "Content-Type: application/json" \ -d '{"api_id_public": "SERVICE_UUID", "path": "/ETH-USD", "method": "GET", "params": {"decimals": "4"}}'

Or generate an SDK in your preferred language (Python, TypeScript, Go, Rust, Kotlin, and more) -- the web console generates ready-to-use client code with the UUID pre-filled.

6

You are in business

Every call settles automatically in USDC. You pay the service owner's price. No invoices, no payment terms, no chargebacks. Your Finance tab shows every transaction.

Read a Price Feed

POST /internal/call — price feed routed through the Opsalis Global Network
Waiting
Select a price pair and click Run Demo
Live call through the Opsalis Global Network. Install your own Opsalis to make unlimited calls.

How Payment Works

Every API call triggers an automatic micro-payment. The owner earns USDC. The process is invisible to the consumer — just HTTP.

1

Consumer calls the endpoint

HTTP GET to localhost:3000. Your Opsalis looks up the API owner's Opsalis address from the catalog.

2

Request through the Opsalis Global Network

Your Opsalis sends a signed request to the API owner's Opsalis through the Opsalis network's proprietary encrypted protocol.

3

API owner's Opsalis reads the contract

Their Opsalis calls eth_call on their RPC, formats the result as JSON, and returns it.

4

Automatic payment

The OpsalisRouter contract transfers USDC from consumer to owner automatically. Permanent 5% protocol fee. Owner keeps 95%.

Any Read Function

Any view or pure function on any EVM chain can become an Opsalis API. Examples:

Contract Function Use Case
Chainlink AggregatorV3 latestRoundData() Price feeds
Uniswap V3 Pool slot0() Token prices
ERC-20 Token balanceOf(address) Wallet balances
ENS Registry resolver(bytes32) Name resolution
Any DAO proposals(uint256) Governance data

No Web3 Library Needed

# Read ETH/USD price — no Web3 library needed # SERVICE_UUID: copy from your catalog. YOUR_CONSUMER_SECRET: from Settings tab. $ curl -X POST https://localhost:3000/internal/call \ -H "Authorization: Bearer YOUR_CONSUMER_SECRET" \ -H "Content-Type: application/json" \ -d '{"api_id_public": "SERVICE_UUID", "path": "/latestAnswer", "method": "GET", "params": {"pair": "ETH-USD", "decimals": "4"}}' # Response: { "pair": "ETH-USD", "price": 3247.82, "decimals": 8, "round_id": 110680464442257310000, "started_at": 1743204000, "updated_at": 1743204823, "answered_in": 110680464442257310000 } # BTC/USD — same pattern, different path param: # "params": {"pair": "BTC-USD", "decimals": "4"}
// JavaScript — no ethers.js, no viem, no Web3.js // SERVICE_UUID: copy from your catalog. YOUR_CONSUMER_SECRET: from Settings tab. const res = await fetch('https://localhost:3000/internal/call', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_CONSUMER_SECRET', 'Content-Type': 'application/json', }, body: JSON.stringify({ api_id_public: 'SERVICE_UUID', path: '/latestAnswer', method: 'GET', params: { pair: 'ETH-USD', decimals: '4' }, }), }); const { price, updated_at } = await res.json(); console.log(`ETH: $${price}`); console.log(`Updated: ${new Date(updated_at * 1000).toISOString()}`); // Works in Node.js, Deno, browser, or any HTTP client. // Your Opsalis handles the RPC call and charges $0.0001 per read.
# Python — plain requests # SERVICE_UUID: copy from your catalog. YOUR_CONSUMER_SECRET: from Settings tab. import requests pairs = ["ETH-USD", "BTC-USD", "LINK-USD"] for pair in pairs: r = requests.post( "https://localhost:3000/internal/call", headers={"Authorization": "Bearer YOUR_CONSUMER_SECRET"}, json={"api_id_public": "SERVICE_UUID", "path": "/latestAnswer", "method": "GET", "params": {"pair": pair, "decimals": "4"}}, ) data = r.json() print(f"{data['pair']}: ${data['price']:.2f}") # ETH-USD: $3247.82 # BTC-USD: $68120.50 # LINK-USD: $14.73
# Register any EVM contract read function as a REST endpoint # Run this once from your Raspberry Pi / server $ curl -X POST http://localhost:3001/api/register-contract \ -H "Content-Type: application/json" \ -d '{ "name": "Chainlink ETH/USD", "chain_id": 1, "contract": "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70", "function": "latestRoundData", "abi_fragment": "function latestRoundData() view returns (uint80,int256,uint256,uint256,uint80)", "return_map": { "1": "price", "3": "updated_at" }, "price_divisor": 100000000, "price_usdc": "0.0001", "description": "Chainlink ETH/USD price feed on the blockchain" }' # Call it via /internal/call once registered: # POST https://localhost:3000/internal/call # {"api_id_public": "SERVICE_UUID", "path": "/latestAnswer", "method": "GET"}

Replicate This on Your Raspberry Pi

Raspberry Pi + Docker + a free RPC endpoint = a Chainlink price feed server earning per call. No prior blockchain experience needed.

1

Start your Opsalis node

$ docker run -d --name opsalis -p 3000:3000 -p 3001:3001 \ -v opsalis-data:/data opsalis/wrapper:latest
2

Register the Chainlink contract

Open your web console at https://localhost:3002/panel → "Register Smart Contract". Paste the contract address, chain ID, and ABI fragment. Set your price per call.

3

Call it with plain HTTP

$ curl -X POST https://localhost:3000/internal/call \ -H "Authorization: Bearer YOUR_CONSUMER_SECRET" \ -d '{"api_id_public":"SERVICE_UUID","path":"/latestAnswer","method":"GET"}' {"pair":"ETH-USD","price":3247.82,"updated_at":1743204823}
4

Earn per call

Once other Opsalis instances discover yours in the catalog, every HTTP GET earns you USDC — paid automatically. You can monitor earnings in your web console.