Get Test QNT on Ethereum Sepolia network

Fund your blockchain account with test QNT tokens.

What you will learn

In this tutorial, we will run through how to use the smart contract invoke write API to get test QNT on the Ethereum Sepolia testnet.

This tutorial enables you to request testnet QNT tokens to be added to your blockchain account from the testnet QNT faucet:

  • This guide's API calls and transactions occur within the testnet environment. No funds with financial value will be transferred
  • You can adapt the sample code in this tutorial to serve as a framework for your development and create transactions that transfer financial value.

Prerequisites

  • Have an Ethereum account, with the private key hosted in Overledger's CTA Transaction Signing Responder
  • Currently have less than 500 testnet QNT tokens assigned to your Ethereum account
  • Obtain an authorization token
    You must obtain an authorisation token to interact with Overledger's API and call any endpoint. This token will authenticate your requests and grant you access to the necessary endpoints. Please follow the authentication process provided by Overledger to get your authorisation token.

Prepare a transaction to get QNT tokens from the QNT faucet

You must call the 'getTestQNT' function on the testnet QNT faucet contract, in order to receive testnet QNT.

🚧

The provided signingAccountId must have less than 500 testnet QNT in order to receive 500 testnet QNT from the faucet. If the signingAccountId has greater than or equal to 500 testnet QNT, then this transaction request will fail

Provide a signingAccountId, that corresponds to a private key hosted in Overledger's Authorise. This signingAccountId will:

  • pay the fee for the transaction (in the testnet the fee has no financial value)
  • receive the testnet QNT tokens, upon successful completion of this transaction
curl --request POST \
     --url https://api.sandbox.overledger.io/api/preparations/transactions/smart-contracts/write \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
		 --header 'API-Version: 3.0.0' \
     --data '
{
  "location": {
    "technology": "ethereum",
    "network": "ethereum sepolia testnet"
  },
  "signingAccountId": "0x1789d90438333751fDCcA0D03d8952168b99eF02",
  "functionName": "getTestQNT",
  "smartContractId": "0xCe8623CD5945dEcC23eC62D4A48aB90FF5D54825"
}
'
{
    "requestId": "281131e1-2503-4c83-9006-4a440ddc8037",
    "location": {
        "technology": "ethereum",
        "network": "ethereum sepolia testnet"
    },
    "dltFee": {
        "amount": "0.01411248273619168",
        "unit": "ETH"
    },
    "nativeData": {
        "nonce": 1,
        "chainId": 11155111,
        "chain": "testnet",
        "hardfork": "london",
        "to": "0xCe8623CD5945dEcC23eC62D4A48aB90FF5D54825",
        "gas": "58304",
        "maxFeePerGas": "242049992045",
        "maxPriorityFeePerGas": "1000000000",
        "value": "0",
        "data": "0x9c258dc3"
    }
}

Sign transaction

The second step takes the response payload from the prepare step and signs the transaction using the transaction signing key id as the keyId.

To the above preparation response, add a gatewayFee object, if it does not exist, and make a call to the signing endpoint:

"gatewayFee": {
        "amount": "0",
        "unit": "QNT"
    }
curl --request POST \
     --url https://api.sandbox.overledger.io/api/transaction-signing-sandbox \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
		 --header 'API-Version: 3.0.0' \
     --data '

{
   "transactionSigningResponderName": "CTA",
   "keyId": "0x4f84ac29b182e0e474Ea3fc17950200BB4765F31",
   "requestId": "281131e1-2503-4c83-9006-4a440ddc8037",
    "location": {
        "technology": "ethereum",
        "network": "ethereum sepolia testnet"
    },
    "dltFee": {
        "amount": "0.01411248273619168",
        "unit": "ETH"
    },
    "nativeData": {
        "nonce": 1,
        "chainId": 11155111,
        "chain": "testnet",
        "hardfork": "london",
        "to": "0xCe8623CD5945dEcC23eC62D4A48aB90FF5D54825",
        "gas": "58304",
        "maxFeePerGas": "242049992045",
        "maxPriorityFeePerGas": "1000000000",
        "value": "0",
        "data": "0x9c258dc3"
    },
     "gatewayFee": {
        "amount": "0",
        "unit": "QNT"
    }
}
{
    "requestId": "281131e1-2503-4c83-9006-4a440ddc8037",
    "signed": "0x02f87283aa36a701843b9aca0085385b4dc56d82e3c094ce8623cd5945decc23ec62d4a48ab90ff5d5482580849c258dc3c080a0511eede2ad5af2d08c4b697115045eeb813e9a3b4953835e0c0c318c5f69d63ea03c282e4fcb303c32771da32a86084d3fa364dbdbd1df868d389e5ea66e460a0e"
}

Execute transaction on Sepolia testnet

The third step submits the signed payload to the blockchain using the requestId returned in the prepare step.

Make a call to the execution endpoint.

  • requestId refers to the requestId received in Signing response.
  • signedTransaction refers to the signed field in the Signing response.

πŸ“˜

The mapping between 'signed' and 'signedTransaction' is required as Overledger V2 APIs use 'signed' and Overledger V3 APIs use the more descriptive 'signedTransaction' wording.

curl --request POST \
     --url https://api.sandbox.overledger.io/api/executions/transactions \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
		 --header 'API-Version: 3.0.0' \
     --data '
{
    "requestId": "281131e1-2503-4c83-9006-4a440ddc8037",
    "signedTransaction": "0x02f87283aa36a701843b9aca0085385b4dc56d82e3c094ce8623cd5945decc23ec62d4a48ab90ff5d5482580849c258dc3c080a0511eede2ad5af2d08c4b697115045eeb813e9a3b4953835e0c0c318c5f69d63ea03c282e4fcb303c32771da32a86084d3fa364dbdbd1df868d389e5ea66e460a0e"
}
{
    "location": {
        "technology": "ethereum",
        "network": "ethereum sepolia testnet"
    },
    "requestId": "281131e1-2503-4c83-9006-4a440ddc8037",
    "transactionId": "0x99a54526a6fe760d55265606b82a33630740b3a41f69904f077ef09ac6303cc2",
    "status": {
        "value": "PENDING",
        "description": "The transaction has been successfully broadcasted to the network. The status will next be updated after a sufficient block number has been reached. At this point we can be confident that the transaction will be successful or will have failed."
    },
    "timestamp": "1711034876"
}

Your transaction is then submitted to the blockchain.

The response status of pending indicates that the transaction has been successfully submitted to the blockchain but has yet to be added to it.