Transactions
Backend transactions
Backend operations are unattended: no popup, no user approval. An alias resolves to an account and key at call time, the SDK signs the transaction internally, and the RPC client broadcasts.
The flow
server.ts
const result = await hive.issuer.token.transfer({
from: hive.accounts.treasury, // account reference, not a string
symbol: "MYTOKEN",
account: "bob", // destination
quantity: "5",
memo: "payout",
});
result.success; // boolean
result.transactionId; // broadcast transaction idSecurity
Never expose this path to the browser. The module that constructs a configuration with
keyEnv must stay in server-only code.Offline previews
Every issuer operation has a build* counterpart that returns the exact payload without resolving keys or touching the network — ideal for tests, audit logs and confirmation screens.
TypeScript
const preview = hive.issuer.token.buildTransfer({
from: hive.accounts.treasury,
symbol: "MYTOKEN",
account: "bob",
quantity: "5",
});
preview.alias; // "treasury"
preview.account; // resolved Hive account
preview.id; // resolved application id (custom_json id)
preview.json; // serialized contract action
preview.operation; // ["custom_json", { ... }]How signing works
Signing is internal and not configurable. The SDK resolves the alias key from the environment, serializes the transaction, hashes it with the Hive chain id and produces a canonical ECDSA signature in pure JavaScript — no native modules, no key storage.
TypeScript
const hive = new HiveClient({
accounts: { treasury: { account: "my-app", keyEnv: "TREASURY_ACTIVE_KEY" } },
});
// keyEnv is read only at this moment, then discarded
await hive.issuer.token.transfer({ from: hive.accounts.treasury, /* ... */ });