Skip to main content

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:

Common operations

Here are the most frequently used operations:

Vote operation

Upvote or downvote content on the blockchain.
Fields:
  • voter: Account casting the vote
  • author: Author of the content
  • permlink: Unique identifier for the content
  • weight: Vote strength from -10000 (100% downvote) to 10000 (100% upvote)

Transfer operation

Transfer HIVE or HBD between accounts.
Fields:
  • from: Sender account name
  • to: Recipient account name
  • amount: 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.

Custom JSON operation

Execute custom application logic.

Operation naming conventions

Operation names differ between the protocol definition and the runtime usage. Be aware of the _operation suffix.

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

Recurrent transfer operation

Creating custom operation builders

You can create your own operation builders for reusable operation patterns:
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

Asset types

Many operations work with asset types (HIVE, HBD, VESTS):

Operation categories

Operations are organized into several categories:
  • account_create
  • account_update
  • account_update2
  • account_witness_vote
  • account_witness_proxy
  • transfer
  • transfer_to_vesting
  • transfer_to_savings
  • transfer_from_savings
  • recurrent_transfer
  • comment
  • vote
  • delete_comment
  • comment_options
  • limit_order_create
  • limit_order_create2
  • limit_order_cancel
  • convert
  • collateralized_convert
  • witness_update
  • witness_set_properties
  • feed_publish
  • create_proposal
  • update_proposal_votes
  • remove_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