Model Marketplace Contracts
Panda turns any panda.ml model into a monetizable, on-chain asset. Three contracts cover the spectrum from pay-per-call inference to fully tokenized models traded on an exchange.
| Contract | Monetization model |
|---|---|
| PaidModel | Charge a flat fee per prediction; the creator withdraws revenue. |
| TokenizedModel | Issue a bonding-curve token; holders get free inference plus revenue dividends. |
| ModelExchange | An order-book DEX where tokenized-model tokens trade against PANDA. |
All three are deployable from the playground (Model Marketplace category), each with an in-editor tutorial. For the economic overview and decision guide, see Model Marketplace; for the paid-inference rationale, see Paid Inference; for tokenization, see Tokenized Models.
PaidModel
A creator deploys a trained model, sets a price per call, users pay to call predict(), and the creator withdraws accumulated earnings. Usage is tracked on-chain.
State highlights
model_dict, model_name, is_trained, creator, price_per_call, creator_balance, total_revenue, total_calls, user_calls, user_spent.
Methods
| Method | Kind | Description |
|---|---|---|
deploy(model_name, price_per_call, description) | constructor | Sets the creator, name, and price. Emits PaidModelDeployed. |
train(x, y) | call | Creator trains a LogisticRegression on-chain. Emits ModelTrained. |
upload_model(model_dict) | call | Creator uploads a pre-trained model (must contain __panda_ml_model__). Emits ModelUploaded. |
predict(x, payment) | call | Requires payment >= price_per_call; runs inference, credits the creator, tracks per-user usage. Emits InferencePaid. Returns predictions. |
withdraw(amount) | call | Creator withdraws earnings (0 = all). Emits Withdrawal. |
set_price(new_price) | call | Creator updates the price. Emits PriceChanged. |
get_price() | query | Current price per call. |
get_stats() | query | Name, creator, trained flag, price, total calls/revenue, creator balance, unique users. |
get_user_stats(user) | query | call_count and total_spent for a user. |
get_model_info() | query | Metadata (name, description, model type, creator, price) without weights. |
Marketplace / rent surface — read by the panda.model.Model SDK proxy (see SDK Types):
| Method | Kind | Description |
|---|---|---|
metadata() | query | Model metadata in the shape the Model.meta proxy reads (kind, name, price, accuracy, creator). |
fund(amount) | call | Add prepaid inference credits to the model's balance (Model.funds.fund). Emits ModelFunded. |
get_balance() | query | Current prepaid credit balance (Model.funds.balance). |
pay_rent(amount) | call | Top up the model's rent reserve by amount blocks (Model.rent.pay). Emits RentPaid. |
rent_status(current_block=-1) | query | blocks_remaining / status. Pass current_block for an accurate reading (@query gets no ctx); omit to compute against the last active block. Read by Model.rent.due. |
TokenizedModel
Combines on-chain inference with a tradeable PRC-20 token backed by a quadratic bonding curve. Token holders get free inference and a pro-rata share of inference revenue. 60% of supply is minted to the creator; 40% is sold via the curve.
Bonding curve: price = base_price * (sold / total) ** 2 (integer math, multiply-before-divide).
Methods
| Method | Kind | Description |
|---|---|---|
deploy(model_name, model_dict, token_name, token_symbol, total_supply, base_price, inference_fee, description) | constructor | Validates the model, mints 60% to the creator, reserves 40% for the curve. Emits ModelTokenized. |
buy(amount, payment) | call | Buys tokens from the curve at the current price. Emits TokensBought. |
sell_tokens(amount) | call | Sells tokens back to the curve. Emits TokensSold. |
predict(x, payment) | call | Free for holders; non-holders pay inference_fee. Emits Inference. |
claim_dividends() | call | Claims your pro-rata share of accumulated revenue. Emits DividendClaimed. |
train(new_model_dict) | call | Creator replaces the model. Emits ModelUpdated. |
propose_update / vote_update / execute_update | call | Token-weighted governance to update the model. |
get_price() | query | Current bonding-curve price. |
get_holdings(owner) | query | Token balance for an owner. |
get_stats() | query | Supply, curve state, revenue, inference count, price. |
The playground template exposes a focused subset (
buy,predict,claim_dividends,get_price,get_holdings,get_stats) so the mechanics are easy to follow. The full contract addssell_tokens, OHLC history, and governance.
ModelExchange
An order-book DEX for tokenized-model tokens. Models must be listed before trading. Orders are matched by price-time priority, and matched trades update OHLC candles (100-block epochs) and volume stats. The exchange does not custody tokens — it records and matches orders.
Methods
| Method | Kind | Description |
|---|---|---|
deploy() | constructor | Sets the owner. |
list_model_token(model_contract, token_symbol, token_name, description) | call | Registers a model for trading. Returns the listing id. Emits ModelListed. |
place_order(listing_id, side, price, amount) | call | Places a buy/sell order and attempts a match. Emits OrderPlaced (and Trade on a match). Returns the order id. |
cancel_order(order_id) | call | Cancels your open order. Emits OrderCancelled. |
get_listing(listing_id) | query | Listing metadata. |
get_all_models() | query | Every listed model. |
get_orderbook(listing_id) | query | Open buys and sells. |
get_trending(top_k) | query | Listings ranked by cumulative volume. |
The competition-to-marketplace flywheel
These contracts compose: a model proven in a data-science competition can be deployed as a PaidModel, upgraded to a TokenizedModel to raise capital and share revenue, and its token listed on the ModelExchange for price discovery. See Model Marketplace for the full flywheel.
Try it
- Playground: open the Playground, choose Paid Model, Tokenized Model, or Model Exchange (DEX) under Model Marketplace, and follow the tutorial.
- Guides: Paid Inference, Tokenized Models, Model Marketplace.
- SDK: the first-class
panda.model.Modelhandle is documented in SDK Types.