HiveXPH SDKhivexph-sdk
NPM
Developer toolkit for Hive Custom JSON and Hive Engine transactions.

Issuance

Token issuer

The tokens contract exposes three operations. Backend calls take an alias; Keychain calls take a username. Both emit the same contract action.

Try it: create a token

Create a token

Creating a token costs BEE and every symbol on Hive Engine is unique, so create() always runs two checks first: the signing account's BEE balance against the sidechain creation fee, and whether the symbol already exists. A failing check throws INSUFFICIENT_BEE or TOKEN_ALREADY_EXISTS before Keychain opens or a private key is resolved — the non-refundable fee is never spent on a creation that cannot succeed.

Only token name, token symbol, decimal precision and max supply are required to create a token. Website is optional and can be added or updated later in TribalDex Token Manager.

TypeScript
// Browser — Keychain signs with the active authority
await hive.keychainIssuer.token.create({
  username: "alice",
  symbol: "MYTOKEN",      // uppercase letters, max 10
  name: "My Token",       // max 50 letters, digits and spaces
  precision: 3,           // 0 to 8
  maxSupply: "1000000",   // always a string
  url: "https://mytoken.gg", // optional
});

// Backend — the configuration alias signs
await hive.issuer.token.create({
  from: hive.accounts.treasury,
  symbol: "MYTOKEN",
  name: "My Token",
  precision: 3,
  maxSupply: "1000000",
});

// Read-only: what the checks see, without creating anything
const check = await hive.keychainIssuer.token.checkCreate({ username: "alice", symbol: "MYTOKEN" });
// { fee: "100", balance: "8.45434186", hasEnoughBee: false, symbolExists: false, ok: false, issues: [...] }

// Offline payload preview — no network, no checks
hive.keychainIssuer.token.buildCreate({ symbol: "MYTOKEN", name: "My Token", precision: 3, maxSupply: "1000000" });

Important

Pass skipChecks: true only when you have already verified the balance and the symbol yourself. Without the checks a doomed creation still costs the BEE fee.

Backend API

TypeScript
await hive.issuer.token.issue({ from: hive.accounts.treasury, symbol: "MYTOKEN", account: "bob", quantity: "10" });
await hive.issuer.token.transfer({ from: hive.accounts.treasury, symbol: "MYTOKEN", account: "bob", quantity: "5" });
// Burn = transfer to the burn destination. Defaults to the Hive account "null".
await hive.issuer.token.burn({ from: hive.accounts.treasury, symbol: "MYTOKEN", quantity: "1" });
// Custom burn destination
await hive.issuer.token.burn({ from: hive.accounts.treasury, symbol: "MYTOKEN", quantity: "1", account: "graveyard" });

// Offline previews
hive.issuer.token.buildIssue({ from: hive.accounts.treasury, symbol: "MYTOKEN", account: "bob", quantity: "10" });

Keychain API

TypeScript
await hive.keychainIssuer.token.issue({
  username: "alice",
  symbol: "MYTOKEN",
  account: "bob",
  quantity: "10",
});

// Build only — inspect before prompting the user
const action = hive.keychainIssuer.token.buildBurn({ symbol: "MYTOKEN", quantity: "1" });
// -> tokens.transfer to "null" (pass account: "graveyard" to override)

Keychain calls never accept an alias and never read an environment variable — the browser account signs itself.

Parameters

Token operation input
ParameterTypeRequiredDescription
fromstringYesBackend only: configuration account alias that signs.
usernamestringYesKeychain only: Hive account signing in the extension.
symbolstringYesHive Engine token symbol.
accountstringYesDestination account (mint and transfer).
account (burn)stringNoOptional burn destination. Defaults to the Hive account "null".
quantitystringYesAmount as a string — never a float.
memostringNoOptional memo attached to the contract payload.
idstringNoOverrides the ssc-mainnet-hive custom_json id.

Create parameters

Token creation input
ParameterTypeRequiredDescription
symbolstringYesToken symbol. Should be uppercase, maximum 10 characters, and must not exist yet.
namestringYesToken name. Maximum of 50 characters are allowed.
precisionnumberYesDecimal precision. Must be between 0 and 8.
maxSupplystringYesMax supply. Must be between 1 and 9007199254740991.
urlstringNoOptional website, maximum 255 characters. It can be updated later in TribalDex Token Manager.
skipChecksbooleanNoSkips the BEE balance and existing symbol preflight. Off by default.