The distribution of both Blast Points and Blast Gold can be done using the offchain Points API.

The integration of the Points API is divided into 2 parts:

Onchain: Configuring the operator address for the contract during deployment.

Offchain: Interacting with the Points API to fetch points balances and transferring points to users.

1

Configuring the points operator address for the contract

Any contracts that expect to accumulate Blast points or gold should call configurePointsOperator to be compatible with the points API.

We recommend calling it on construction/proxy initialization.

Contracts can earn points by holding ETH, WETH, or USDB, or by being designated recipients in another contract’s interactions with the points API.

interface IBlastPoints {
  function configurePointsOperator(address operator) external;
  function configurePointsOperatorOnBehalf(address contractAddress, address operator) external;
}

// EXAMPLE dAPP
contract Dapp {
  constructor(address _pointsOperator) {
    // be sure to use the appropriate testnet/mainnet BlastPoints address
    // BlastPoints Testnet address: 0x2fc95838c71e76ec69ff817983BFf17c710F34E0
    // BlastPoints Mainnet address: 0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800

    IBlastPoints(BlastPointsAddress).configurePointsOperator(_pointsOperator);
  }
}

That’s it, the operator is now configured and we can move onto the offchain steps!

Interacting with the Points API

The points API is authenticated and requires the bearerToken to be present in headers as Authorization: Bearer ${bearerToken}.

We will get the bearerToken from the authentication flow.

1

Obtaining a challenge

Requesting a challenge and message. Message to be signed by the operator private key following the ERC-191 standard

2

Obtaining a bearer token

Using the message signed by the operator private key we can now obtain a bearerToken which then can be used to access authenticated routes on the Points API.

3

Get contract's points balance

Get the contract’s points balance to see how many points can be distributed.

The response will contain the points balances for both Blast Points (PHASE2_POINTS) and Blast Gold (PHASE2_GOLD).

4

Submitting a batch of point transfers

Submit a batch with details indicating which and how many points to transfer to a user.

Operators cannot submit a batch to transfer PHASE2_POINTS and PHASE2_GOLD points simultaneously.

secondsToFinalize should be greater than equal to 3600 for mainnet. If not provided the default is 86400.

Check Points API Parameters for the respective network for more information.

If you need idempotency you can generate your own batchIds and use this API endpoint.

5

Fetching a single batch

Fetching the submitted batch to check the status of the point transfers.

Alternatively, you can fetch all batches associated with your contractAddress using this API endpoint.

That’s all you need to successfully transfer points to the users of your smart contract!