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

Transactions

Hive Keychain

The Keychain API is completely separate from configurations, aliases and environment variables. It takes a raw username and the extension signs with the user's own key.

Open the Keychain playground

Detect the extension

TypeScript
if (!hive.keychain.isAvailable()) {
  // The extension injects asynchronously — re-check shortly after mount.
}

Note

Keychain injects window.hive_keychain after page load. Check once on mount and once again after a short delay.

Sign in

TypeScript
const result = await hive.keychain.requestSignIn({
  username: "alice",
  message: "Sign in to my-application: nonce-123456",
  authority: "posting",
});

console.log(result.signature);

Use an app-generated challenge message, store or verify the returned signature in your own app, and generate a new challenge for each sign-in attempt.

Send a transaction

TypeScript
const result = await hive.keychain.customJson({
  username: "alice",
  id: "my-application",
  action: "claim",
  metadata: { rewardId: "123" },
  authority: "posting",
  message: "Claim reward",
});

A rejected popup throws with code KEYCHAIN_REJECTED; a missing extension throws KEYCHAIN_UNAVAILABLE.

Transfers: native and Layer 2

One call covers both layers. "HIVE" / "HBD" is a native Layer 1 transfer; any other symbol is a Hive Engine token and the SDK routes it to Keychain's token transfer request. The memo is carried verbatim in both cases.

TypeScript
// Layer 1
await hive.keychain.requestTransfer({
  username: "alice",
  to: "treasury",
  amount: "1.000",
  currency: "HIVE",
  memo: JSON.stringify({ action: "buy_pack", metadata: { packs: 1 } }),
});

// Layer 2 — same call, token symbol as currency
await hive.keychain.requestTransfer({
  username: "alice",
  to: "treasury",
  amount: "5",
  currency: "SCRAP",
  memo: JSON.stringify({ action: "buy_pack", metadata: { packs: 1 } }),
});

Hive Engine contract actions via Keychain

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

await hive.keychainIssuer.nft.transfer({
  username: "alice",
  account: "bob",
  nfts: [{ symbol: "HERO", ids: ["1", "2"] }],
});

Compared to backend

BackendHive Keychain
Runs inServer runtimeBrowser
Account inputAccount aliasusername
Signing keyEnvironment variableUser wallet
SigningConfigured private keyKeychain extension
ApprovalNone — automatedUser approves each request
Broadcasthive.rpcKeychain extension
Entry pointhive.issuerhive.keychain

These are two separate transaction APIs. Neither one wraps the other, and there is no execution-mode switch between them.