In this chapter, you will understand the whole process of API calls related to Transaction.

Table of Contents

  1. Prerequisite
  2. Encode an Ethereum Transaction (e.g token transfer)
  3. Decrypt the Ethereum Key JSON
  4. Sign the Ethereum Transaction
  5. Broadcast the Ethereum Transaction
  6. Confirm the Ethereum Transaction
  7. Next step


  1. Complete Connect to FsTK Engine API & Get account information (last 2 chapters)
  2. Confirm existed crypto assets (owned by current user)
  3. Confirm sufficient Ether (ETH) for ETH gas fee.

Encode a Ethereum Transaction (e.g. token transfer)

In any of following API calls, please remember to assign access token to authorization in http request header.

  • Using GraphQL (Insomnia recommended)


    id is the id of transferring token. Token id of current user can be reviewed in get me (in tokenBalancessection).

    to is the Ethereum address the token will be transferred to.

    value is the transferring amount. Please remember the unit is wei. e.g. In order to transfer 1 token, valueshould be "1000000000000000000". and in another way, value of "123456789123456789" means 0.123456789123456789 Token.

  • Using cURL
  • Response

    Please notice that erc20Transfer is for mutation erc20Transfer in response. Different encode requests will have different strings but structure of response object remains identical.

    In response’s transaction, object will be used to sign payload, submitToken is also required for broadcasting signed transaction.

    Please remember that response will vary after each call, please use the latest response for next steps.

    e.g. Response like

    means the transaction will fail. We suggest to skip the following steps and check related resources of Transaction are correct first. e.g. ETH balance, FST Service Gas balance, Token balance, Voucher balance, … etc..

Decrypt the Ethereum Key JSON

Please notice the difference between password and passphrase in FsTK system. password is required to sign in Tokeneden; passphrase is required to decrypt Ethereum key JSON and sign the transaction.

Word usage may be different in other libraries, i.e. passphrase means password.

To start with, use get me to fetch ethereumKey like the following:

This is current user’s Ethereum key JSON, which includes encrypted private key (by passphrase). This can be safely stored but remain private unless necessary.

Owning private key means owning the Ethereum Account. Please securely store Ethereum key JSON and passphrase.

WARNING: If the passphrase of Ethereum key JSON is lost, the private key is lost and FsTK does not have users’ Ethereum key JSON passphrase

  • Using JavaScript (Node.js)

    Install eth-key-lib

    This is the module import of ES6. If your node.js does not support it, please refer to Webpack (target = "node") and the followings:

    Minimal webpack.config.js

    Minimal package.json

    Install command line (please let index.js be the program entry point)

    If working on windows, please refer to node-gyp on windows.

  • Using Java

    Please refer to Web3j
    Notice that loadCredentials in WalletUtils method with this overload:

    In another way, as web3j only provides File import, please pay attention to OS storage or use in-memory-fs in Java

    Please to refer to Web3j sample codes

  • Using C#

    Please refer to Nethereum
    Please refer to Nethereum sample codes

    Please use Account.PrivateKey to fetch private key from Account.

Sign the Ethereum Transaction

  • Using JavaScript
  • Using Java

    Please refer to Web3j
    Notice that signMessage in TransactionEncoder, and please use the overload below since the chainId must be included in the signature process

    Please refer to Web3j sample codes

  • Using C#

    Please refer to Nethereum
    Please refer to SignTransaction in TransactionSigner, and please use the overload below since the chainIdmust be included in the signature process

    Please refer to the section Nethereum.Web3.Accounts.AccountSignerTransactionManager.SignTransaction

Broadcast the Ethereum Transaction

  • Using GraphQL (Insomnia recommended)


    data is the object from signing transaction with current user’s private key. In another word, signedTransaction is the hex string

    submitToken is submitToken from Encode Ethereum Transaction.

  • Using cURL
  • Response

    transactionHash can be used to check whether transaction is confirmed in the next steps.

Confirm the Ethereum Transaction

  • Using GraphQL (Insomnia recommended)


    txHash is the transaction hash.

    Notice that transaction hash is unique on chain, but it may repeat when representing different transactions on different chain.

  • Using cURL
  • Response

    When remain in confirmations becomes 0, the transaction is confirmed.

    Notice that a confirmed transaction may not succeed. As on Blockchain, failed transaction is also a consensus. Please use Infura with ETH-JSON-RPC to fetch status (success/failure of transaction).

Next step

Congratulation, you have completed Quick start.

For more detailed info, please refer to Guide, or please redirect to FST Network Github.