What are operations
Operations are the fundamental building blocks of Hive blockchain transactions. Each operation represents a specific action you want to perform on the blockchain, such as transferring funds, voting on content, or updating account settings.Think of operations as instructions that modify the blockchain state. When bundled into a transaction and broadcast, they execute atomically.
Protocol buffers
WAX uses Protocol Buffers (protobuf) as the canonical format for representing operations and blockchain types. These definitions come directly from the Hive blockchain source code.Why Protocol Buffers?
Type Safety
Strong typing ensures your operations are correctly structured before they reach the blockchain
Efficiency
Compact binary serialization reduces bandwidth and storage requirements
Cross-Language
Single source of truth works across TypeScript, Python, and C++
Validation
Built-in validation ensures operations meet protocol requirements
Source location
All protocol definitions originate from the Hive blockchain repository:Operation structure
Every operation follows a consistent structure with required and optional fields:- TypeScript
- Python
Common operations
Here are the most frequently used operations:Vote operation
Upvote or downvote content on the blockchain.- TypeScript
- Python
voter: Account casting the voteauthor: Author of the contentpermlink: Unique identifier for the contentweight: Vote strength from -10000 (100% downvote) to 10000 (100% upvote)
Transfer operation
Transfer HIVE or HBD between accounts.- TypeScript
- Python
from: Sender account nameto: Recipient account nameamount: Asset amount (HIVE or HBD)memo: Optional message (max 2048 characters, can be encrypted)
When a memo starts with
#, WAX automatically encrypts it using the accounts’ memo keys.Comment operation
Create posts and comments.- TypeScript
- Python
Custom JSON operation
Execute custom application logic.- TypeScript
- Python
Operation naming conventions
TypeScript
In TypeScript, operations use the_operation suffix when pushed to transactions:
Python
In Python, the proto classes use the base name, but the runtime expects the_operation suffix:
Complex operations
WAX provides high-level builders for operations that require multiple fields or complex logic:Account update operation
- TypeScript
- Python
Recurrent transfer operation
- TypeScript
- Python
Creating custom operation builders
You can create your own operation builders for reusable operation patterns:- TypeScript
- Python
ts/wasm/lib/detailed/operation_base.ts
Operation validation
Operations are validated at multiple levels:Protocol-level validation
The C++ core validates:- Field types and formats
- Account name validity
- Asset precision and amounts
- String length limits
- Required field presence
Application-level validation
Your code should validate:- Business logic requirements
- User permissions
- Balance sufficiency
- Rate limiting
- TypeScript
- Python
Asset types
Many operations work with asset types (HIVE, HBD, VESTS):- TypeScript
- Python
Operation categories
Operations are organized into several categories:Account operations
Account operations
account_createaccount_updateaccount_update2account_witness_voteaccount_witness_proxy
Transfer operations
Transfer operations
transfertransfer_to_vestingtransfer_to_savingstransfer_from_savingsrecurrent_transfer
Content operations
Content operations
commentvotedelete_commentcomment_options
Market operations
Market operations
limit_order_createlimit_order_create2limit_order_cancelconvertcollateralized_convert
Witness operations
Witness operations
witness_updatewitness_set_propertiesfeed_publish
Governance operations
Governance operations
create_proposalupdate_proposal_votesremove_proposal
Next steps
Signing
Learn how to sign transactions with operations
Transactions
Understand transaction structure and lifecycle
API Reference
Browse all available operations
Examples
See operations in action