hive-tx v7
GitHub npm

Reference

Environments

hive-tx runs in Node.js, browsers, workers, and serverless runtimes.

Module formats

The package is ESM and also ships CommonJS:

  • ESM: import { PrivateKey } from 'hive-tx'
  • CommonJS: const { PrivateKey } = require('hive-tx')

Use 7.2.1 or later with CommonJS: the 7.2.0 CommonJS build is broken.

Node.js

Node.js 20 or later. The library uses the built-in fetch and AbortSignal.timeout.

Browser and CDN

Load dist/index.mjs. It is a single file with the crypto code inside, so there are no extra chunks to fetch.

Serverless

The build has no runtime dependencies, so a Lambda or a Worker loads it without bs58 or @noble/* in node_modules.

Invocations that share a process share config; do not change config.nodes per invocation.

Tests

Jest 30 loads hive-tx in the Node environment:

const { PrivateKey } = require('hive-tx')

test('derives a posting key', () => {
  const pub = PrivateKey.fromLogin('alice', 'x', 'posting').createPublic().toString()
  expect(pub.startsWith('STM')).toBe(true)
})

ESM Jest works too, with NODE_OPTIONS=--experimental-vm-modules and a .mjs test file.