Operation Object and Its Structure

In the ImFACT Network, a transaction is referred to as an operation.

When you call an operation-construction method such as transfer(), the SDK does not immediately submit a transaction to the network. Instead, it returns an Operation instance.

For example:

const rawOperation = mitum.currency.transfer(sender, receiver, currencyID, amount);
console.log(rawOperation);

The transfer() method returns an Operation<TransferFact> instance.

This object represents a raw, unsigned transaction. It must be signed before it can be submitted to the network.


Signing and Sending an Operation

After creating an operation, you must sign it:

const op = mitum.currency.transfer(sender, receiver, currencyID, amount);
const signedOperation = mitum.operation.sign(privatekey, op);

const info = await mitum.operation.send(signedOperation);

Only after signing can the operation be sent to the network.


Converting an Operation to JSON

The Operation instance provides a toHintedObject() method, which converts the operation into its JSON representation.

The SDK also provides a low-level signing method: mitum.signer.sign()

This allows you to sign the JSON-formatted operation directly if needed.


General Structure of an Operation

Every operation in the ImFACT Network has the following core structure:

  • It always contains a fact

  • It always contains a top-level _hint

  • It may contain items, depending on the operation type

  • It contains signs after being signed

Example (simplified):


Key Structural Concepts

1. fact

The fact represents the core intent of the transaction. It contains the actual data that defines what the operation does (e.g., sender, receiver, amounts).

Some operation types include items, while others may not. The presence of items depends on the specific operation type.


2. _hint

Every operation and fact contains a _hint value.

The _hint uniquely identifies the operation type and version. It is used internally by the ImFACT Network to determine how the operation should be interpreted and validated.


3. Operation Hash vs Fact Hash (Important)

Unlike many blockchains that use a transaction hash as the primary lookup key, the ImFACT Network uses the fact hash for querying operations.

This means:

  • The operation contains a top-level hash

  • The fact also contains its own hash

  • When retrieving an operation from the network, the fact hash is used as the query key

This distinction is important when tracking transaction status or querying operation results.

Last updated