How to use JavaScript SDK V2 for offline signing

Multi-language SDKs available.


With the Overledger SDK, you can sign transactions offline, providing a layer of flexibility to your blockchain applications. Let's dive in and discover how to use the Overledger SDK for signing transactions.


Before diving into the process of signing transactions using the Overledger SDK, we recommend visiting our JavaScript SDK page. This page provides essential information on how to install the SDK and covers the basics of working with the Overledger SDK. By familiarizing yourself with the installation process and getting a foundational understanding of the SDK's functionalities, you'll be better equipped to follow the signing instructions provided here.

How to Sign requests?

If you've successfully completed the steps outlined in the "Before You Start" section and have configured your SDK accordingly, you're now ready to sign your request. Below is a code example that demonstrates how to sign your request using the Overledger SDK. This code snippet takes the payload from our preparation API's and signs the transaction using a private key that you previously set up in your .env file:

const OverledgerSDK = require('@quantnetwork/overledger-bundle').default;
const DltNameOptions = require('@quantnetwork/overledger-types').DltNameOptions;
// Importing an example preparedTransaction from the Overledger Preparation API
const preparedTransaction = <your-prepare-response-here>;
// Constructing the Overledger library
const overledger = new OverledgerSDK({
  dlts: [{ dlt: DltNameOptions.ETHEREUM }],
  provider: { network: 'testnet' },
  envFilePassword: 'password
// Setting our private key from the encrypted .env file
  .setAccount({secret: process.env.PARTY_A_ETHEREUM_SECRET});

// Wraping the main function in an async block to be able to call the sign function
(async () => {
  try {
    // Signing the prepared transaction
    let signedTransaction = (await overledger.sign(DltNameOptions.ETHEREUM, preparedTransaction)).signedTransaction;
    // Building the Overledger Execution API request
    let executeTransactionRequest = {
      requestId: preparedTransaction.requestId,
      signed: signedTransaction
  } catch (e) {
    console.error('error', e);

Now that you have obtained your signed response, you can proceed to execute your signed request using our Execute API.