What Are Operations?
In Hive, operations represent specific actions like voting, transferring funds, publishing content, or updating account settings. Each operation has:- A unique name (e.g.,
vote,transfer,comment) - A structured body containing the operation’s parameters
- Specific authority requirements (which key type is needed)
Operation Structure
All operations follow the same tuple format:The tuple format
[name, body] is Hive’s protocol-level structure. hive-tx preserves this for compatibility while adding TypeScript type safety.Type-Safe Operations
hive-tx provides full TypeScript types for all operations. When you calladdOperation(), you get autocomplete and type checking:
Type Inference
TheaddOperation method uses conditional types to ensure the body matches the operation name:
src/Transaction.ts:59
vote operation must have VoteOperation structure, a transfer must have TransferOperation, etc.
Common Operations
Voting
Upvote or downvote content:src/types.ts:45
Vote Weight Explained
Vote Weight Explained
Vote weight ranges from
-10000 to 10000:10000= 100% upvote5000= 50% upvote0= Remove vote-10000= 100% downvote (flag)
Transfer
Send HIVE or HBD between accounts:src/types.ts:62
Comment (Post/Reply)
Publish posts or replies:src/types.ts:52
Custom JSON
Execute custom operations for apps and games:src/types.ts:153
required_posting_auths) or Active key (if using required_auths)
All Available Operations
The complete operation types are defined intypes.ts:
Social Operations
Social Operations
Financial Operations
Financial Operations
transfer- Send HIVE/HBDtransfer_to_vesting- Power up HIVE to HPwithdraw_vesting- Start power downtransfer_to_savings- Move to savingstransfer_from_savings- Withdraw from savings (3-day delay)claim_reward_balance- Claim pending rewards
Market Operations
Market Operations
limit_order_create- Place buy/sell orderlimit_order_create2- Advanced order with exchange ratelimit_order_cancel- Cancel existing orderconvert- Convert HBD to HIVE (3.5 day delay)collateralized_convert- Instant conversion with collateral
Account Operations
Account Operations
account_create- Create new account (paid)account_create_with_delegation- Create with delegated HPcreate_claimed_account- Create from claimed ticketclaim_account- Claim subsidized account creationaccount_update- Update account authoritiesaccount_update2- Enhanced account update
Governance Operations
Governance Operations
account_witness_vote- Vote for a witnessaccount_witness_proxy- Set witness vote proxyupdate_proposal_votes- Vote on DHF proposalswitness_update- Update witness settingswitness_set_properties- Set witness properties
Advanced Operations
Advanced Operations
delegate_vesting_shares- Delegate HP to another accountcomment_options- Set post payout options and beneficiariesset_withdraw_vesting_route- Route power down to another accountescrow_transfer- Three-party escrow transactionrecurrent_transfer- Set up recurring payments
Operation Type Reference
View the full type definitions in the source:src/types.ts:409
src/types.ts:45
Full Type Definitions
View all operation types in the source code
Using Assets
Many operations requireAsset values. You can use:
String Format
Simplest approach - use properly formatted strings:Asset Class
For calculations and conversions:Authority Requirements
Each operation requires specific key types:| Operation Type | Required Authority |
|---|---|
vote, comment, custom_json (posting) | Posting key |
transfer, account_update | Active key |
account_create, witness_update | Active key |
owner authority changes | Owner key |
Multiple Operations in One Transaction
You can batch multiple operations together:Next Steps
Transactions
Learn the full transaction lifecycle
Keys & Signatures
Understand authority and signing
Type Definitions
Browse all operation types
Build a Voting App
Practical operation examples
vote- Upvote or downvote contentcomment- Create posts or repliesdelete_comment- Delete a post/commentcustom_json- Custom app operations