Nimiq Hub

The secure wallet integration API that lets your users sign transactions, manage accounts, and interact with the blockchain — without you ever touching their private keys.

JavaScript

Get started now

Request a payment and get the signed transaction

bash
pnpm add @nimiq/hub-api
bash
npm install @nimiq/hub-api
bash
yarn add @nimiq/hub-api
bash
<script src="https://cdn.jsdelivr.net/npm/@nimiq/hub-api@latest/dist/standalone/HubApi.standalone.umd.js"></script>
js
import HubApi from '@nimiq/hub-api'

const hubApi = new HubApi('https://hub.nimiq.com')

const result = await hubApi.checkout({
  appName: 'My Shop',
  recipient: 'NQ07 0000 0000 0000 0000 0000 0000 0000 0000',
  value: 1_000, // 0.01 NIM in Luna
})

console.log('Payment complete:', result.hash)
js
import HubApi from '@nimiq/hub-api'

const hubApi = new HubApi('https://hub.nimiq.com')

const result = await hubApi.signMessage({
  appName: 'My App',
  message: 'Sign in to My App',
})

console.log('Signed by:', result.signer)
// Verify signature on your server
js
import HubApi from '@nimiq/hub-api'

const hubApi = new HubApi('https://hub.nimiq.com')

const result = await hubApi.chooseAddress({
  appName: 'My App',
})

console.log('Address:', result.address)
console.log('Label:', result.label)
Why Use Hub API

Secure Wallet Integration Made Simple

The Hub provides a unified interface for all Nimiq wallet operations. Your users maintain full control of their keys while you get a simple, powerful API.

  • Zero Key Management

    Private keys never leave the secure Keyguard environment

  • Trusted by Users

    Same interface across all Nimiq apps

  • Multi-Chain Ready

    Support for Nimiq today; Bitcoin and Polygon flows require a privileged Hub origin

  • Simple Integration

    CDN or NPM — start in minutes

  • Type-Safe API

    Full TypeScript definitions included

  • Mobile Friendly

    Popup or redirect flows for all devices

Understanding Hub

How the Hub Architecture Works

Learn about the Hub-Keyguard relationship, request behaviors, and security model.

Read Core Concepts
Quick Start

Jump right in

Choose your integration path and start building.

Alternative

Need Lower-Level Control?

For advanced use cases requiring direct blockchain access, consider using the [Web Client](/web-client/) or [RPC API](/rpc/)

Hub Capabilities

Flexible integration options

Choose your integration style, access powerful methods, and support multiple chains

Security First

The Hub uses a separate secure origin (Keyguard) to store and manage private keys. Your application never has access to user keys — all signing happens in the isolated Keyguard environment.

Request Behaviors

Choose your integration style

Select how the Hub appears to your users

Request behaviour

  • Popup (Default)

    Opens in a centered popup window

  • Redirect

    Full-page redirect for mobile-friendly flows

  • IFrame

    Seamless integration for privileged origins

Core Methods

  • Payments

    Accept NIM with checkout() and signTransaction()

  • Authentication

    Sign messages for secure user login with signMessage()

  • Cashlinks

    Create shareable payment links with createCashlink()

Multi-Chain Support

  • Bitcoin

    Sign Bitcoin transactions with signBtcTransaction()

  • Polygon

    Sign EVM transactions with signPolygonTransaction()

  • Atomic Swaps

    Trustless cross-chain trading with setupSwap()