Skip to main content
This quickstart guide will help you create your first Hive blockchain transaction using WAX. Choose your preferred language to get started.

Installation

Install WAX using your preferred package manager:
npm install @hiveio/wax

Create your first transaction

1

Import and initialize WAX

import { createWaxFoundation, createHiveChain } from '@hiveio/wax';

// For offline operations (transaction building)
const wax = await createWaxFoundation();

// For online operations (broadcasting, API calls)
const chain = await createHiveChain();
2

Build a transaction

Create a transaction and add operations. This example creates a vote operation:
// Create a transaction
const tx = await wax.createTransaction();

// Add a vote operation
tx.pushOperation({
  vote: {
    voter: "alice",
    author: "bob",
    permlink: "example-post",
    weight: 10000  // 100% vote (10000 = 100%)
  }
});
The weight field accepts values from -10000 (100% downvote) to 10000 (100% upvote).
3

Sign the transaction

Sign the transaction with your wallet or signing provider:
// Sign with Beekeeper (recommended for development)
import { createBeekeeperSession } from '@hiveio/signers-beekeeper';

const session = await createBeekeeperSession();
const wallet = await session.createWallet("my-wallet");
const publicKey = await wallet.importKey("5JYourPrivateKeyHere...");

await tx.sign(wallet, publicKey);
Never hard-code private keys in production. Use environment variables or secure key management.
4

Broadcast to the network

Send your signed transaction to the Hive blockchain:
// Broadcast the transaction
const result = await chain.broadcast(tx.transaction);

console.log('Transaction broadcasted!');
console.log('Transaction ID:', result.id);
console.log('Block number:', result.block_num);

Next steps

TypeScript SDK Guide

Learn more about the TypeScript SDK

Transaction Building

Deep dive into transaction building

Signing Options

Explore different signing providers

API Reference

Browse the complete API reference

Common operations

Here are some other common operations you might want to try:
Transfer HIVE, HBD, or HIVE POWER between accounts:
tx.pushOperation({
  transfer: {
    from_account: "alice",
    to_account: "bob",
    amount: wax.hiveCoins(10),  // 10 HIVE
    memo: "Thanks for your help!"
  }
});
Publish content to the Hive blockchain:
tx.pushOperation({
  comment: {
    parent_author: "",
    parent_permlink: "blockchain",
    author: "alice",
    permlink: "my-first-post",
    title: "My First Post on Hive",
    body: "This is the content of my post...",
    json_metadata: JSON.stringify({
      tags: ["blockchain", "hive"],
      app: "my-app/1.0.0"
    })
  }
});
Use custom_json to follow another account:
tx.pushOperation({
  custom_json: {
    required_auths: [],
    required_posting_auths: ["alice"],
    id: "follow",
    json: JSON.stringify([
      "follow",
      {
        follower: "alice",
        following: "bob",
        what: ["blog"]
      }
    ])
  }
});

Get help

Core Concepts

Understand how WAX works under the hood

Examples

Browse complete working examples

Build docs developers (and LLMs) love