Skip to main content

Overview

The bids API handles all bidding operations in SolBid games. Users can place new bids, end games, and retrieve bid information including PDAs for blockchain operations.

Place bid

curl -X POST https://api.solbid.com/api/bid \
  -H "Content-Type: application/json" \
  -H "userId: 123" \
  -d '{
    "gameId": 1,
    "bidPda": "CxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsY",
    "amount": 2000000,
    "playerPda": "DxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsZ",
    "creatorPublicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "bidCount": 2,
    "txId": "6k8t9L0nO4qR5sU7wY9zA2bD4eF5gH6iJ7kL8mN9oP0qR1s"
  }'
Places a new bid in an active game. Creates a player record if the user hasn’t participated in this game before, or updates existing player data.

Headers

userId
string
required
Authenticated user’s ID for authorization

Request body

gameId
number
required
Game ID to place the bid in (positive integer)
bidPda
string
required
Bid’s Program Derived Address on Solana (base58 encoded)
amount
number
required
Bid amount in lamports (positive integer)
playerPda
string
required
Player’s Program Derived Address on Solana (base58 encoded)
creatorPublicKey
string
required
Player’s Solana wallet public key (base58 encoded)
bidCount
number
required
Sequential bid count for this player (positive integer)
txId
string
required
Solana transaction ID for the bid

Response

message
string
Success message
gameData
object
Updated game information
{
  "message": "Game updated successfully",
  "gameData": {
    "id": 1,
    "gameId": "1",
    "pda": "8xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsV",
    "initialBidAmount": 1000000,
    "highestBid": 2000000,
    "lastBidTime": "2026-03-02T21:00:00.000Z",
    "totalBids": 6,
    "lastBidderId": "CxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsY",
    "prizePool": 8000000,
    "gameEnded": false,
    "players": [
      {
        "id": 2,
        "playerPubkey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
        "pda": "DxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsZ",
        "totalBidAmount": 2000000,
        "bidCount": 2,
        "royaltyEarned": 0,
        "safe": false,
        "role": "PLAYER",
        "bid": {
          "pda": "CxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsY",
          "amount": 2000000,
          "timestamp": "2026-03-02T21:00:00.000Z",
          "txId": "6k8t9L0nO4qR5sU7wY9zA2bD4eF5gH6iJ7kL8mN9oP0qR1s"
        },
        "user": {
          "id": 123,
          "name": "PlayerTwo",
          "imageUrl": "https://example.com/avatar2.jpg"
        }
      }
    ]
  }
}
Each bid increments the game’s total bid count and adds to the prize pool.

Get bid PDAs

curl "https://api.solbid.com/api/bid?id=1"
Retrieves all Program Derived Addresses (PDAs) and public keys for players and bids in a specific game. Used for on-chain operations.

Query parameters

id
string
required
Game ID to fetch PDAs for

Response

message
string
Success message
playersPda
array
Array of player PDAs
bidsPda
array
Array of bid PDAs
playersPubkey
array
Array of player wallet public keys
{
  "message": "PDAs and public keys fetched successfully",
  "playersPda": [
    "9xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsW",
    "DxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsZ"
  ],
  "bidsPda": [
    "AxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsX",
    "CxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsY"
  ],
  "playersPubkey": [
    "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  ]
}

End game

curl -X PUT https://api.solbid.com/api/bid \
  -H "Content-Type: application/json" \
  -H "userId: 123" \
  -d '{
    "gameId": 1,
    "amount": 3000000,
    "playerPda": "ExKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsA",
    "creatorPublicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "bidCount": 10,
    "bidPda": "FxKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsB",
    "txId": "7m9u0M1pP5rS6tV8xZ0aB3cE5fG6hI7jK8mN9oP0qR1sT2u",
    "playerData": [
      {
        "playerId": 1,
        "total_bid_amount": 5000000000,
        "royalty_earned": 500000,
        "bid_count": 5,
        "safe": true
      },
      {
        "playerId": 2,
        "total_bid_amount": 3000000000,
        "royalty_earned": 200000,
        "bid_count": 3,
        "safe": false
      }
    ]
  }'
Ends a game by placing the final bid and updating all player statistics with final data from the blockchain. This marks the game as ended and assigns winner/finisher roles.

Headers

userId
string
required
Authenticated user’s ID for authorization

Request body

gameId
number
required
Game ID to end
amount
number
required
Final bid amount in lamports
playerPda
string
required
Finisher’s player PDA
creatorPublicKey
string
required
Finisher’s wallet public key
bidCount
number
required
Final bid count
bidPda
string
required
Final bid PDA
txId
string
required
Solana transaction ID
playerData
array
required
Array of all player final statistics from blockchain

Response

message
string
Success message
{
  "message": "Game and players updated successfully"
}
When ending a game:
  • The game’s gameEnded field is set to true
  • All player statistics are updated with final blockchain data
  • The finisher is assigned the FINISHER role
  • The player with bidCount - 1 is assigned the WINNER role
  • Lamports are converted to USDC for storage

Build docs developers (and LLMs) love