💰
Megapot
  • Overview
    • About Megapot
    • How to play
    • How to provide liquidity
    • How to refer users
    • Earn as a liquidity provider
    • About the Team
    • Megapoints
  • Deep dive
    • Components
    • System Diagram
    • Smart Contract
    • Provably Fair
  • Developers
    • Start Here
    • Add jackpot to your site
      • Custom Integration
        • Getting Started
        • Contract Functions
        • Jackpot Page
        • LP Deposit Page
        • History Page
      • React UI Kit
        • MegapotProvider
        • Jackpot
        • useJackpot
    • Sybil-resistant incentives
    • Launch jackpot in your token
    • Developer Reference
      • Testnet & Mainnet
      • Contract Overview & Functions
      • Megapot API
      • Megapot Examples
      • How to Earn Fees
      • Brand Kit
  • Appendix
    • VIP Program
    • FAQ
    • About Megapot
  • Terms of Service
  • Privacy Policy
  • Responsible Gaming
Powered by GitBook
On this page
  • Megapot API
  • API Key
  • Usage
  • Endpoints
  • Active Jackpot Stats
  • User Ticket History
  • Jackpot Info
  • Jackpot History
  1. Developers
  2. Developer Reference

Megapot API

PreviousContract Overview & FunctionsNextMegapot Examples

Last updated 8 days ago

Megapot API

This helper API allows for quick access to jackpot data. It's useful for anyone adding our jackpot to their site, offering tickets as an incentive, or launching a custom jackpot in their token.

API Key

To use the Megapot API, you will need an API key. Get one by contacting us on our .

Usage

Simply attach the API key to your url params or in a request header for access to the below endpoints.

URL Params

An easy to use method which allows you to append the api key to your request URL using ?apikey=<your api key>

Example: https://api.megapot.io/api/v1/jackpot-round-stats/active?apikey=<your api key>

Request Headers

You can also add your api key to your client's request headers. This is the preferred method as it will keep the api key out of your url and most logging services.

Use the header apikey: <your api key> for these requests. See the Axios example below:

axios.get('https://api.megapot.io/api/v1/jackpot-round-stats/active', {
  headers: {'apikey': 'your api key'},
});

Endpoints

  • Current jackpot info: Get the current Megapot prize pool, end time, and more. Highly performant.

  • User ticket history: Get all of a user's Megapot ticket purchases

  • Jackpot info: Get all info for a given jackpot contract

  • Jackpot history: Get all ticket purchases and wins for a given jackpot contract

Active Jackpot Stats

Retrieve stats about the active Megapot jackpot round. Highly performant since we cache this data and update it per minute.

{
    "prizeUsd": "1005045.74",
    "endTimestamp": "1748541293000",
    "oddsPerTicket": "1435780",
    "ticketPrice": 1000000,
    "ticketsSoldCount": 13,
    "lastTicketPurchaseBlockNumber": 30833334,
    "lastTicketPurchaseCount": 1,
    "lastTicketPurchaseTimestamp": "1748456015000",
    "lastTicketPurchaseTxHash": "0x277fa1121692019f4277d3b45900746b067ce4a5218d19649a1509733cc4a8ab",
    "lpPoolTotalBps": "1005045743901",
    "userPoolTotalBps": "9100000",
    "feeBps": 3000,
    "referralFeeBps": 1000,
    "activeLps": 235,
    "activePlayers": 9,
}

Response Data

  • prizeUsd: The amount in USDC of the current jackpot prize pool.

  • endTimestamp: At what time the jackpot is able to be run. NOTE The jackpot is ran manually through cron jobs, the exact time may differ. This time is when the contract will allow the jackpot to be processed.

  • oddsPerTicket: This is the odds a single ticket will win. 1 in oddsPerTicket. You can divide this number by the amount of tickets purchased to get the odds for all tickets purchased by a user.

  • ticketPrice: The amount in Szabo units. USDC uses 6 decimals, 1_000_000 is the same as 1 USDC.

  • ticketsSoldCount: Amount of tickets purchased by users so far this round.

  • lastTicketPurchaseBlockNumber: Block number of the latest ticket purchase.

  • lastTicketPurchaseCount: Amount of tickets purchased in the latest ticket purchase.

  • lastTicketPurchaseTimestamp: Timestamp of the latest ticket purchase.

  • lastTicketPurchaseTxHash: Transaction hash of the latest ticket purchase.

  • lpPoolTotalBps: The amount of USDC in Szabo units of the current jackpot. prizeUsd is derived from this value (prizeUsd / 10 ** 6)

  • userPoolTotalBps: The amount of USDC in Szabo units from ticket purchases this round.

  • feeBps: The amount of fees in basis points taken from each ticket sale to pay LPs/Referrers.

  • referralFeeBps: The amount of fees in basis points a referrer will earn per ticket sale. If a ticket purchase is referred, a value of 1000 means 10% goes to the referrer and 20% to the LPs. The LP fees is determined by the feeBps - referralFeeBps.

  • activeLps: The amount of LPs wallets currently active this round.

  • activePlayers: Unique player wallets currently active this round.

User Ticket History

Get a user's ticket purchases for the Megapot Jackpot

[
    {
        "recipient": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "referrer": "0x898a26a26f3d8ca5df65d85fcf15cce33af89766",
        "buyer": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "transactionHash": "0xb633e0b22d66faf0ddd430201485dbbe09f926233c594536d25e2d2f5d96c1bf",
        "blockNumber": 27162323,
        "ticketsPurchasedTotalBps": 7000,
        "ticketsPurchased": 1
    },
    {
        "recipient": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "referrer": "0x898a26a26f3d8ca5df65d85fcf15cce33af89766",
        "buyer": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "transactionHash": "0xff36d67d7a0d0c2fb2b177d5cf492c53b30fe8838c860883151610845a989b3e",
        "blockNumber": 27162362,
        "ticketsPurchasedTotalBps": 7000,
        "ticketsPurchased": 1
    },
    {
        "recipient": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "referrer": "0x0000000000000000000000000000000000000000",
        "buyer": "0x2a5f9443719899537fa51f5061cba8c8096719d2",
        "transactionHash": "0x38e252f4c1fdd2bb0fecce7fa4d8dfbefa8669db675116d2040426e6629c8896",
        "blockNumber": 27454909,
        "ticketsPurchasedTotalBps": 7000,
        "ticketsPurchased": 1
    }
]

Jackpot Info

Get current jackpot data for a given contract address. This is slower than the active jackpot stats API, as this one fetches it live from the contract on your behalf.

{
    "data": {
        "address": "0xbEDd4F2beBE9E3E636161E644759f3cbe3d51B95",
        "result": {
            "allFeesTotal": "109500000",
            "allowPurchasing": true,
            "entropyCallbackLock": false,
            "fallbackWinner": "0x2a5f9443719899537Fa51f5061cBA8c8096719d2",
            "feeBps": 3000,
            "getJackpotFee": "32406457200001",
            "jackpotLock": false,
            "lastJackpotEndTime": 1744823661,
            "lastWinnerAddress": "0x0000000000000000000000000000000000000000",
            "lpFeesTotal": "91900031",
            "lpLimit": 200,
            "lpPoolCap": "1",
            "lpPoolTotal": "353254604424",
            "minLpDeposit": "250000000",
            "owner": "0xF417533b9885E106dAe3336568D3823bA474CB88",
            "pendingOwner": "0x0000000000000000000000000000000000000000",
            "protocolFeeAddress": "0x0000000000000000000000000000000000000000",
            "protocolFeeClaimable": "0",
            "protocolFeeThreshold": "10000000000",
            "referralFeeBps": 1000,
            "referralFeesTotal": "17600000",
            "roundDurationInSeconds": 86280,
            "ticketCountTotalBps": 2555000,
            "ticketPrice": "1000000",
            "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
            "tokenDecimals": 6,
            "userLimit": 1500,
            "userPoolTotal": "255500000"
        }
    }
}

Jackpot History

Get jackpot & ticket purchase history for a given contract address

[
    {
        "jackpot": {
            "blockNumberStart": 29103514,
            "blockNumberEnd": 29146710,
            "time": "1745082767",
            "winningTicket": "577773086",
            "winAmount": "371234149839",
            "txHash": "0x47b64953edb8248ac3f3529f20b1c1e462f3be4d49494ed7804f6a0b58dbe89c",
            "ticketPurchasedTotalBps": 2744000,
            "ticketPurchasedCount": 392
        },
        "ticketPurchases": [
            {
                "blockNumber": 29103607,
                "recipient": "0x8d1135a82837e61aad796d8ff358bd07587751e3",
                "referrer": "0x0000000000000000000000000000000000000000",
                "buyer": "0x8d1135a82837e61aad796d8ff358bd07587751e3",
                "ticketsPurchasedTotalBps": 7000,
                "txHash": "0x18d0fc5a6115da92698430aa657ac4c180a05bdeac68aaaf9e89c4dadac04636"
            },
            {
                "blockNumber": 29103691,
                "recipient": "0x5ec4bde8ba38fb02e15acf711474a529b31e4e5a",
                "referrer": "0x0000000000000000000000000000000000000000",
                "buyer": "0x9bd9caf29b76e98d57fc3a228a39c7efe8ca0eaf",
                "ticketsPurchasedTotalBps": 7000,
                "txHash": "0x081257d1a564ea9fc4e53f7d9fe4e0ad6619bb5ca8a00dff106b9b6b32d88a3e"
            }
        ]
    }
]

Developer Telegram
https://api.megapot.io/api/v1/jackpot-round-stats/active
https://api.megapot.io/api/v1/contracts/0xbEDd4F2beBE9E3E636161E644759f3cbe3d51B95/{walletAddress}
https://api.megapot.io/api/v1/contracts/{contractAddress}
https://api.megapot.io/api/v1/contracts/{contractAddress}/jackpot-history