Actions
Overview
Actions are used to send messages between ledger accounts. They are similar to transfers but don't contain an amount. Instead, Actions contain one of two types of payload:
- Payment requests (request-to-pay)
- Remote procedure calls (RPCs)
Payment requests
A business requests a payment from a customer by sending them an invoice. The company creates an action with the target set to the account from which they want to request money, the customer's account. M10 created a payload for a business (e.g. merchant) to request a payment (request-to-pay) from a customer which is defined in a protobuf.
Notice that the above model includes a PaymentRequestStatus
enum so that the requester and requestee can keep track of the request's current status.
RPC
Another everyday use case for actions is an on-ledger Remote Procedure Call (RPC). For example: Imagine that an FX program runs on the ledger, and you want to get a quote for an FX swap between two currencies. You would send an action to the FX provider's ledger account with a quote request message. The FX provider responds back with an action to your ledger account that you observe for actions.
Observations
Observations are a key building block of the ledger. They are a way to receive a stream of events relating to a particular type. Actions are most valuable when observed in real time. Using the RPC example, observations notify the FX provider when an action is received in its ledger account.
When observations and actions are combined, they operate in a manner similar to a distributed queue, such as Kafka. This integration offers the capability to establish a starting transaction ID for observation, followed by a continuous stream of all actions that have transpired since that transaction ID. This feature ensures at-least-once semantics (a guarantee that a message will be delivered to its intended recipient one or more times) for messages delivered on the ledger, all without the necessity of an external service.
Model
The data model for M10 actions is defined in transaction.proto
:
API Requests
Invoke
The invoke
action means send a message from one account to another account.
- Rust
- TypeScript
- Dart
- CLI
List (Find)
The list
action means retrieve actions according to a filter, such as:
- From a specific account ID
- Target/To a specific account ID
- Based on a context ID
- Rust
- TypeScript
- Dart
- CLI
Get
The get
action means you get information about an action previously invoked.
- Rust
- TypeScript
- Dart
- CLI
Observe
The observe
action lists all actions and transfers to your own account.
Actions can be filtered based on the from
account.
It is recommended to use a separate client instance for streaming.
Required filter parameters:
- Name
- Involved accounts
- Rust
- TypeScript
- Dart
- CLI
To submit requests over HTTP/1 instead of HTTP/2 with the SDKs, use the http option.