Skip to main content

Install events-into-amazon-sqs plugin into headless wallet

Goal

This article will guide you to install the events-into-amazon-sqs plugin into Hathor headless wallet.

The events-into-amazon-sqs plugin is part of the external notification feature: it forwards wallet events — such as new transactions and balance updates for the wallets the headless instance manages — to an Amazon SQS queue, where your own services can consume them. For more on this feature and the full event payload, see Hathor external notifications.

Requirements

  • Hathor headless wallet \ge v0.41.0
  • An existing Amazon SQS queue and its URL.
  • Valid AWS credentials available in the environment where the wallet runs. The aws-sdk resolves credentials from the standard chain — AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY environment variables, a shared credentials file, or an IAM role (for EC2/ECS/EKS). The IAM identity must have sqs:SendMessage permission on the target queue. See Configuring the AWS SDK for JavaScript.

Step-by-step

  1. Install dependency.
  2. Configure and enable the plugin.

Step 1: install dependency

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Run the command to install the dependency:
npm install aws-sdk@^2.1226.0

Step 2: configure and enable the plugin

:::warning Protect your seed phrase

The examples below show --seed_default / HEADLESS_SEED_DEFAULT inline for clarity. A seed phrase passed as a CLI argument or a plain environment variable can be exposed in shell history, docker inspect output, and process listings. For production, inject the seed at runtime via a secrets manager (AWS Secrets Manager, Docker secrets, or an environment file with restricted permissions) rather than hardcoding it.

:::

If you installed Hathor headless wallet from source code, you must modify both the src/config.js file and the command to start the application, to respectively enable and configure the plugin:

  1. Open the command line from the directory where you installed Hathor headless wallet.
  2. Open the src/config.js file.
  3. Add 'sqs' to the array of values of the enabled_plugins property to enable the plugin.

If you are enabling multiple plugins, value shall be an array of plugin ids: enabled_plugins: ['PluginId1', 'PluginId2', ...].

At the end of this substep, the config.js file will be as follows:

hathor-wallet-headless/src/config.js
module.exports = {

...

enabled_plugins: ['sqs'],

plugin_config: {},

...

};
  1. Append the --plugin_sqs_region <aws_region> parameter into the command to start the wallet application, replacing the <aws_region> placeholder with the AWS region code of the Amazon SQS.

  2. Append the --plugin_sqs_queue_url <queue_url> parameter into the command to start the wallet application, replacing the <queue_url> placeholder with the URL of the Amazon SQS queue.

  3. (Optional) When developing, you may want to run a local queue. In this case, do this substep to point the aws-sdk to a local instance. Append the --plugin_sqs_endpoint_url <endpoint_url> parameter, replacing the <endpoint_url> placeholder with the endpoint of your local queue instance.

At the end of this step, the command to start the wallet application will be as follows:

npm start -- --plugin_sqs_region <aws_region> --plugin_sqs_queue_url <queue_url>

Verify the plugin is active

After starting the wallet with the plugin enabled:

  1. Check the startup logs. The wallet logs that the sqs plugin was loaded during initialization. If AWS credentials are missing or invalid, the plugin logs an authentication error here — this is the most common failure point.
  2. Trigger an event. Send a transaction to one of the wallets the headless instance manages (see Send a transfer).
  3. Confirm delivery. Check that a message arrived in the queue, for example with the AWS CLI:
aws sqs receive-message --region <aws_region> --queue-url <queue_url>

If no message arrives, verify the IAM identity has sqs:SendMessage on the queue and that the region and queue URL match.

Task completed

You have installed the events-into-amazon-sqs plugin in your instance of Hathor headless wallet.

The events-into-amazon-sqs plugin is part of the external notification feature. For how to use this plugin or install other plugins of this feature, see Hathor external notifications.

Was this page helpful?