Skip to main content

Quicknode integration

You can easily use GasHawk on your Quicknode endpoint by activating the module on the Quicknode Marketplace.

JSON RPC methods

When active for your endpoint, additional RPC methods are provided. The following methods can be used:

gh_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions. The transaction will be enqueued to the from account's GasHawk queue and broadcasted when the GasHawk algorithm detects a suitable moment within the deadline (default: 24 h, configurable through the untilDate parameter. You can also modify the default deadline in the GasHawk dashboard -> Settings).

Parameters

  1. DATA, The signed transaction data.
  2. CONFIG?, Additional configuration for this particular transaction (stringified JSON, double-quoted property names, escaped, all keys are optional) (optional)
CONFIG: {
untilDate?: Date
};
params: [
"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"{\"untilDate\":\"2023-10-11T21:35:15.393Z\"}",
];

Returns

DATA, 32 Bytes - the transaction hash.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_sendRawTransaction","params":[{see above}],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

gh_getTransactionStatusByHash

Responds with the internal status and the deadline of the provided transaction hash.

Parameters

  1. DATA, 32 Bytes - hash of a transaction
params: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"];

Returns

Object - A transaction status object:

  • state: STRING, one of Pending, Submitted, Mined, Finalized, Failed.
  • untilDate: DATE_STRING - ISO-string of the deadline timestamp (UTC).

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_getTransactionStatusByHash","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": {
"state": "Pending",
"untilDate": "2023-09-30T10:27:46.666Z"
}
}

gh_deleteTransaction

Removes a transaction from the GasHawk queue.

Parameters

  1. DATA, 32 Bytes - hash of a transaction
params: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"];

Returns

Object - A transaction status object:

  • status: STRING, "success".

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_deleteTransaction","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": {
"status": "success"
}
}

gh_getNextValidNonce

Responds with the next valid nonce that can be used in a new transaction, aware of the existing transactions in the GasHawk queue of the address (similar to eth_getTransactionCount).

Parameters

  1. DATA, 20 Bytes - address.
params: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"];

Returns

QUANTITY - integer of the number of transactions sent from this address, including pending transactions in the GasHawk queue.

Example

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xa7" // 167
}

RPC errors

Whenever an RPC method could not be successfully called, expect the response to be in the form:

{
"id":1,
"jsonrpc": "2.0",
"error": {
code: <ERROR_CODE>
message: <ERROR_MESSAGE>
data?: <ERROR_DETAILS>
}
}

Note:

  • ERROR_DETAILS is not always present.
  • The HTTP status code is one of 400, 404 or 500 - depending on the kind of error.

Table of possible errors

ERROR_CODEERROR_MESSAGEIdentifier
-32700Parse errorPARSE_ERROR
-32600Invalid requestINVALID_REQUEST
-32601Method not foundMETHOD_NOT_FOUND
-32602Invalid paramsINVALID_PARAMS
-32603Internal errorINTERNAL_ERROR
-32001Insufficient header information (quicknode_id / endpoint_id)INSUFFICIENT_HEADERS
-32002Could not find quicknode accountQUICKNODE_ID_NOT_REGISTERED
-32003Could not find quicknode endpointENDPOINT_ID_NOT_REGISTERED
-32004Could not find http_url of endpointNO_ENDPOINT_HTTP_URL
-32004Could not execute methodERROR_EXECUTING_METHOD
-32005Transaction is already broadcastedTX_ALREADY_BROADCASTED
-32006Transaction not foundTX_NOT_FOUND