Smart Contract as API

Call any smart contract function via a standard REST endpoint. DeFi price feeds, NFT metadata, governance votes — all accessible through simple HTTP calls.

How It Works

CONSUMER REST call getLatestPrice P2P OPSALIS Route + Settle USDC on Base P2P OWNER WRAPPER Contract RPC NYC Server RPC CHAINLINK PRICE FEED Base Sepolia Chain 84532 JSON response with on-chain price data

Consumer makes a standard REST call. The owner's wrapper reads from a Chainlink price feed on Base Sepolia and returns the data as JSON.

Why Smart Contract APIs?

Billions of dollars in DeFi data live on-chain, but accessing it requires blockchain-specific tooling — RPC providers, ABI parsing, hex decoding. Most developers just want a REST endpoint that returns JSON. Opsalis makes that possible.

Expose any smart contract as a REST API. DeFi data, NFT metadata, governance votes — all accessible via simple HTTP calls. The owner's wrapper reads from the blockchain and returns clean JSON. Consumers never need to install Web3 libraries or manage RPC connections.

Real-world example: a financial dashboard pulls ETH/USD prices from a Chainlink price feed registered on Opsalis. One REST call, one JSON response, settled in USDC — no Ethereum node required on the consumer side.

Live Demo — Call a Smart Contract via REST

Chainlink Price Feed Query

Click "Run Demo" to call the smart contract via REST and see the on-chain price data returned as JSON.

Code Samples

curl -X POST https://opsalis.com/api/demo/api/bb-smart-contract \
  -H "Content-Type: application/json" \
  -H "X-Consumer-Key: demo-public-key-2026" \
  -d '{
    "function": "getLatestPrice",
    "pair": "ETH/USD",
    "chain": 84532
  }'
const response = await fetch('https://opsalis.com/api/demo/api/bb-smart-contract', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Consumer-Key': 'demo-public-key-2026'
  },
  body: JSON.stringify({
    function: 'getLatestPrice',
    pair: 'ETH/USD',
    chain: 84532
  })
});

const data = await response.json();
console.log('ETH/USD Price:', data.price);
console.log('Block:', data.blockNumber);
import requests

response = requests.post(
    'https://opsalis.com/api/demo/api/bb-smart-contract',
    headers={
        'Content-Type': 'application/json',
        'X-Consumer-Key': 'demo-public-key-2026'
    },
    json={
        'function': 'getLatestPrice',
        'pair': 'ETH/USD',
        'chain': 84532
    }
)

data = response.json()
print(f"ETH/USD Price: {data['price']}")
print(f"Block: {data['blockNumber']}")

Self-Host: Expose Your Own Smart Contract

1

Install Opsalis

Pull the free Docker container onto your own server. No cloud dependency.

docker pull opsalis/control-center:latest
docker run -d --name opsalis -p 3000:3000 opsalis/control-center:latest
2

Create a Contract Wrapper

Write a thin wrapper that reads from your smart contract via RPC and returns JSON. Point it at any EVM chain — Ethereum, Base, Polygon, Arbitrum.

# Example: Node.js wrapper reading Chainlink price feed
# Your wrapper exposes a REST endpoint that Opsalis routes to
node contract-wrapper.js --chain base-sepolia --contract 0x...
3

Register Your API

Open the Opsalis web console and register your wrapper endpoint. Set per-call pricing in USDC.

# In the Opsalis web console:
# 1. Go to APIs → Register New API
# 2. Set endpoint: http://localhost:8080/price-feed
# 3. Set price: 0.001 USDC per call
# 4. Enable on the marketplace
4

Go Live

Your smart contract data is now available as a REST API on the Opsalis marketplace. Consumers call it with standard HTTP — no Web3 required on their side.