Paymaster

Overview

The Paymaster API enables gas-sponsored transactions on the Zetrix blockchain by allowing users to delegate transaction fee payments to a managed Paymaster account.

This API is designed to:

  • Remove the requirement for end users to hold ZTX for gas fees.

  • Provide secure and fair paymaster rotation.

  • Ensure correct nonce management across concurrent transactions.

  • Improve transaction reliability through tracking and recovery mechanisms.

The Paymaster service acts as an intermediary between client applications and the Zetrix blockchain, handling nonce allocation, paymaster selection, transaction submission, and failure recovery.


Transaction Flow

  1. Generate Blob Client requests the Paymaster API to generate an unsigned transaction blob.

  2. Client Signs Blob The unsigned blob is signed locally using the user’s private key.

  3. Submit Blob The signed blob is submitted back to the Paymaster API for paymaster signing and on-chain submission.

  4. Transaction Tracking & Recovery The system tracks the transaction status and performs automatic recovery if a transaction is dropped or stuck.

Paymaster API Specification

Generate Blob

Authorization

Authorization must be sent with all client requests. The Bearer Access Token needed to authenticate and authorize user to access the API

Request

CURL Command

Type
Params
Values

HEAD

Authorization

string

POST

operations[]

  • amount

  • inputStr

  • fromAddress

  • type

  • toAddress

  • precision

  • payload

Array[]

  • String

  • String

  • String

  • String

  • String

  • String

  • String

amount

amount is amount that need to be transfer to other wallet.

inputStr

inputStr is general field for memos.

type

type is type of transaction, below is the list of type:

  1. Create Account

  2. Transfer

  3. Call Contract

  4. Create Contract

  5. Set Metadata

  6. Account Set Privilege

  7. Upgrade Contract Content

  8. Upgrade Contract Owner

toAddress

toAddress is wallet account address to receive transactions.

precision

precision is precision is decimal places for amount transfer, default is 6

payload

precision is precision is decimal places for amount transfer, default is 6

Function

To Generate a blob for a given transaction data.

Request Body

The body is in json format.

Here body transfer is the transaction data. For specific json format and parameters, see transaction structure. Example:

Response

Submit Blob

Submit signed blob for create transaction

Authorization

Authorization must be sent with all client requests. The Bearer Access Token needed to authenticate and authorize user to access the API

Request

CURL Command

Type
Params
Values

HEAD

Authorization

String

POST

blob

String

POST

hash

String

POST

listSigners[]

  • signBlob

  • publicKey

Array[]

String]

String

POST

paymasterAddress

String

blob

blob is transaction blob that need to signed

hash

hash is transaction hash

signBlob

signBlob is generated blob that have been signed by user wallet private key

publicKey

publicKey is user wallet public key

paymasterAddress

paymasterAddress is wallet address of paymaster resulted from /tx/generate-blob

Function

To submit a blob for execute transaction.

Request Body

The body is in json format.

Here body transfer is the transaction data. For specific json format and parameters, see transaction structure. Example:

Response

Paymaster Smart Contract

Generate Blob

Authorization

Authorization must be sent with all client requests. The Bearer Access Token needed to authenticate and authorize user to access the API

Request

CURL Command

Type
Params
Values

HEAD

Authorization

String

address

String

method

String

inputParameters

  • to

  • value

Array[]

String

String

sourceAddress

String

address

address is contract address

method

method is invoke method in smart contract to interact inputParameters

inputParameters is input data that required for invoke method

sourceAddress

inputParameters is owner of smart contract

Function

To generate a blob from a given transaction data.

Request Body

The body is in json format

Here body transfer is the transaction data. For specific json format and parameters, see Transaction Structure. Example:

Response

Submit Invoke Blob

Authorization

Authorization must be sent with all client requests. The Bearer Access Token needed to authenticate and authorize user to access the API

Request

CURL Command

Type
Params
Values

HEAD

Authorization

String

POST

blob

String

POST

hash

String

POST

listSigners[]

  • signBlob

  • publicKey

Array[]

String]

String

POST

initiator

String

blob

blob is transaction blob that need to signed

hash

hash is transaction hash

signBlob

signBlob is generated blob that have been signed by user wallet private key

publicKey

publicKey is user wallet public key

initiator

initiator is wallet address of paymaster resulted from /contract/generate-blob

Function

To submit a blob to execute a transaction.

Request Body

The body is in json format

Here body transfer is the transaction data. For specific json format and parameters, see Transaction Structure. Example:

Response

Last updated