An overview of the Purebet API

The API has 4 main functions required for betting on Purebet through code: seeing events and odds; seeing pending bets of a wallet; placing an order; cancelling an order. Placing and cancelling an order require users to make on-chain transactions to the Solana blockchain. Usually this is done via a wallet interface like Phantom on a UI, but can be done using a keypair wallet generated by the Solana web3 SDK.

The Purebet API is a simple REST API that works with a wide variety of programming languages. The Purebet API does not handle signing any transaction so that transactions can be signed however the user wishes.

When the endpoint for placing or cancelling a bet is called, the API response returns an array of numbers. This is a wire of a transaction which can be deserialized and signed using the Solana web3 SDK.

Each Purebet market has an id. This id is made up of 2 values, id1 and id2. It is essentially a base256 counting system. Both ids need to be used at all times. Incorrect id1-id2 combinations will result in errors being returned.

Examples of how to use each function can be found at https://replit.com/@purebet/api-example. You can see the JS code by clicking the <> button on the top right. We will prepare a github repo of example JS and Python code in time (feel free to contribute to this - ping us on Discord).

You can get help on using the API in our discord server in the dev-chat channel: https://discordapp.com/channels/904758233233752094/1068883224224333885

Last updated