For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

Install the Native Core Python SDK, create an API wallet, and place your first order.

The Native Core Python SDK (native-core-python-sdk, import native_core) is a thin, typed, synchronous client over Native Core's two REST endpoints: POST /info for reads and POST /trade for writes. This page takes you from pip install to a resting order you place and cancel yourself.

Install

Requires Python 3.10+. The runtime dependencies are requests, eth-account, and eth-utils (no web3, no pydantic).

pip install native-core-python-sdk

Get an API wallet

The SDK trades with an API wallet: a protocol-level agent key scoped only to placing and cancelling orders. It can never move funds — deposits, withdrawals, and the approval itself are signed by your main wallet in the web app, not by the SDK. You create the API wallet once, in the Native web app:

  1. Connect your main wallet. Open the Native web app — that link opens the API wallets panel directly — and connect the wallet that will own the trading account.

  2. Deposit to create the account. Deposit a supported asset from your main wallet. Your trading account is created on the first deposit.

  3. Create the API wallet. Open the API wallets panel and choose Create API wallet. Your main wallet signs a single approveAgent, and the app returns a one-time connection bundle that contains the agent's private key.

  4. Save the bundle. The private key is shown once. Copy the whole bundle and save it to a file — bundle.json is what the quickstart below loads.

A leaked API wallet key can trade your balance but can never withdraw or move funds off Native, so it is safe to run in a bot. Revoke or rotate it in the app any time.

Exact panel labels in the app may differ from the names here. The web app's API wallet is the protocol's agent, and the web app's Account is the protocol's owner (your main wallet). The SDK uses the owner address only locally to resolve the agent — it never goes on the wire; the API recovers the signer from the signature.

The connection bundle

The bundle is a small JSON object. Hand it to the SDK as a file path, a dict, or a JSON string.

agentPrivateKey is the only value you must keep secret. accountAddress is used only locally to resolve the agent. agentEpoch is optional — the SDK re-resolves the live epoch on every construction, so a stale value in the bundle does no harm.

Quickstart

Load the bundle, confirm the API wallet is approved, place a resting GTC bid well below the market so it does not fill, verify it rests, then cancel it. This runs on mainnet against a funded account with a valid bundle.json.

The wire fields behind POST /trade and POST /info, transaction signing, and decimal/unit rules are documented in the API reference: ../post-trade.md, ../post-info.md, ../transaction-signing.md, and ../decimals-units.md.

Next steps

Core ConceptsAPI ReferenceExamples

Last updated