Skip to main content
The Beekeeper signer provides integration with the Beekeeper in-browser wallet, enabling secure key management and transaction signing within your web application.

Overview

Beekeeper is a lightweight, in-browser wallet that stores encrypted keys locally. It provides session-based key management, allowing users to sign transactions without exposing private keys to your application.

Installation

Install the Beekeeper signer package:
npm install @hiveio/wax-signers-beekeeper
You must also install @hiveio/beekeeper separately, as it is a peer dependency.
npm install @hiveio/beekeeper

Basic usage

Here’s how to use the Beekeeper signer with WAX:
import { createHiveChain } from "@hiveio/wax";
import BeekeeperProvider from "@hiveio/wax-signers-beekeeper";
import beekeeperFactory from "@hiveio/beekeeper";

// Initialize Beekeeper
const bk = await beekeeperFactory();
const chain = await createHiveChain();

// Create a session and wallet
const session = bk.createSession("salt");
const { wallet } = await session.createWallet("w0");
const publicKey = await wallet.importKey("5JkFnXrLM2ap9t3AmAxBJvQHF7xSKtnTrCTginQCkhzU5S7ecPT");

// Create the signer provider
const provider = BeekeeperProvider.for(wallet, "myaccount", "active", chain);

// Create and sign transaction
const tx = await chain.createTransaction();
tx.pushOperation({
  vote: {
    voter: "myaccount",
    author: "author",
    permlink: "post-permlink",
    weight: 10000
  }
});

// Sign with Beekeeper
await provider.signTransaction(tx);

// Broadcast the transaction
await chain.broadcast(tx);

Session management

Beekeeper uses sessions to manage keys securely:
import beekeeperFactory from "@hiveio/beekeeper";

const bk = await beekeeperFactory();

// Create a new session with a unique salt
const session = bk.createSession("unique-session-salt");

// Create or open a wallet
const { wallet } = await session.createWallet("my-wallet");

// Import keys
const postingKey = await wallet.importKey("5J...");
const activeKey = await wallet.importKey("5K...");

// List all public keys in the wallet
const keys = await wallet.getPublicKeys();

Signing transactions

The Beekeeper provider handles transaction signing:
const provider = BeekeeperProvider.for(wallet, "username", "active", chain);

// The provider automatically signs with the appropriate key
await provider.signTransaction(tx);

// You can also manually specify a public key
await provider.signTransaction(tx, publicKey);

Key features

In-browser storage

Keys are encrypted and stored locally in the browser.

Session-based

Temporary sessions that expire, enhancing security.

Multiple wallets

Support for multiple wallets within a single session.

Key management

Import, export, and manage multiple private keys.

Security considerations

Beekeeper stores encrypted keys in browser storage. While secure, users should:
  • Use strong session salts
  • Close sessions when done
  • Avoid using Beekeeper on shared computers

Example: Complete workflow

import { createHiveChain } from "@hiveio/wax";
import BeekeeperProvider from "@hiveio/wax-signers-beekeeper";
import beekeeperFactory from "@hiveio/beekeeper";

async function voteWithBeekeeper() {
  // Initialize
  const bk = await beekeeperFactory();
  const chain = await createHiveChain();
  
  // Setup wallet
  const session = bk.createSession("my-salt-" + Date.now());
  const { wallet } = await session.createWallet("voting-wallet");
  const publicKey = await wallet.importKey(process.env.POSTING_KEY!);
  
  // Create provider
  const provider = BeekeeperProvider.for(
    wallet,
    "voter-account",
    "posting",
    chain
  );
  
  // Build transaction
  const tx = await chain.createTransaction();
  tx.pushOperation({
    vote: {
      voter: "voter-account",
      author: "author-account",
      permlink: "great-post",
      weight: 10000
    }
  });
  
  // Sign and broadcast
  await provider.signTransaction(tx);
  const result = await chain.broadcast(tx);
  
  console.log("Transaction ID:", result.id);
}

Next steps

Transactions

Learn more about building transactions.

Signing guide

Explore advanced signing techniques.

Build docs developers (and LLMs) love