Gas Operations

The Opinion CLOB SDK uses a hybrid execution model. Order matching occurs off-chain via CLOB infrastructure (gas-free), while direct smart contract operations require BNB for transaction fees.

Gas-Free Operations

These operations are authenticated via EIP712 cryptographic signatures and submitted to the Opinion API. No gas is required.

Supported Operations:

  • Market data queries (getMarkets, getOrderbook, getLatestPrice, etc.)

  • Order management (placeOrder, cancelOrder, placeOrdersBatch, etc.)

  • Position tracking (getMyBalances, getMyPositions, getMyTrades)

Gas-Required Operations

These operations modify blockchain state and require BNB native token for gas fees.

Operation
Approx. Gas
Description

enableTrading

~100,000

One-time ERC20/ERC1155 approvals

split

~150,000

Convert collateral to outcome tokens

merge

~120,000

Convert outcome tokens back to collateral

redeem

~180,000

Claim winning payouts after resolution

Enable Trading

One-time approval to allow the exchange to use your tokens. Result is cached.

The return type is TransactionResult:

Split

Convert collateral (USDT) into outcome token pairs (YES + NO).

Parameters:

  • marketId (number) - The market ID

  • amount (bigint) - Amount in wei

  • checkApproval (boolean, default true) - Auto-call enableTrading() if needed

Merge

Convert outcome token pairs back to collateral.

Parameters:

  • marketId (number) - The market ID

  • amount (bigint) - Amount in wei

  • checkApproval (boolean, default true) - Auto-call enableTrading() if needed

Redeem

Claim winnings from resolved markets.

Parameters:

  • marketId (number) - The market ID (must be in RESOLVED status)

  • checkApproval (boolean, default true) - Auto-call enableTrading() if needed

Gas Cost Estimation

At typical BNB Chain conditions (0.05 Gwei gas price, ~$600/BNB):

Operation
Approximate Cost

enableTrading

~$0.003

split

~$0.0045

merge

~$0.004

redeem

~$0.005

Use Case
Recommended BNB

Initial setup

0.001 BNB (~$0.60)

Active trading

0.01 BNB (~$6.00)

High-frequency

0.1 BNB (~$60.00)

Optimization Strategy

1

Enable trading once

Approval is cached, so you only need to call enableTrading() one time.

2

Split in bulk

Create a large token inventory in one transaction to reduce the number of on-chain operations.

3

Trade via CLOB

All order placement and cancellation are gas-free when performed via the CLOB off-chain infrastructure.

4

Merge/Redeem when needed

Only perform merge or redeem when exiting positions or after market resolution.