Skip to content

Account abstraction and BridgeAA

How an account with no private key can execute a call on the destination chain, and what it checks before it does.

You will learn / You need

You will learn: what a CrossChainIntent is, what the relayer signs, the four checks bridge_authenticator runs and in which order, and what the ACL maps. You need: Relayers and cross-chain calls.

The problem

On the destination chain the transaction sender should be a fixed on-chain identity, so the target call can tell it came from the bridge. An ordinary address is controlled by whoever holds its private key. The relayer would then be both the signer and the identity, and anyone with the key could act as the bridge.

IOTA account abstraction lets an object be a transaction sender, with a Move function as its authenticator instead of a key. BridgeAA (stealth_name_service/Move/bridge_abstract_account/sources/bridge_abstract_account.move) is such an account. It has no private key. A transaction sent from it is valid only if bridge_authenticator accepts it. The relayer holds a key, but that key does not control the account: it can only sign intents that the authenticator then verifies.

The intent

A CrossChainIntent describes one Move call. The Rust mirror is in stealth_name_service/backend/testing_backend/src/bridge/intent.rs, and the field order is the contract:

Field Meaning
source_chain_id Chain id of the chain that emitted the request
source_sender Address that called bridge_source::request
target_chain_id Chain id of the chain that should execute the call
target_package Package address of the call
target_module Module name, ASCII bytes
target_function Function name, ASCII bytes
args BCS-encoded (Binary Canonical Serialization) arguments, positional
type_args BCS-encoded type tags, positional

The CrossChainRequest event carries the same fields plus a request_id. The relayer builds the intent from the event with intent_from_event() in src/bridge/event.rs. It takes the chain ids from its own configuration (BRIDGE_SOURCE_CHAIN_ID, BRIDGE_TARGET_CHAIN_ID) and rejects an event that names a different source or target chain before any signature exists. request_id is not part of the intent: it is only used to correlate requests.

What the relayer signs

The relayer signs a message made of three parts, concatenated: the domain tag bridge_abstract_account::CrossChainIntent::v1, the 32-byte address of the target BridgeAA, and the BCS bytes of the intent (signing_message() in intent.rs). The tag and the account address bind a signature to this contract and this account, so it cannot be replayed against another one. The transaction then carries the intent bytes and the signature as the authenticator's inputs.

The four checks

bridge_authenticator aborts unless every check passes. They run in this order:

flowchart TD
    A["Intents present,<br/>one signature each"] --> B["Decode intent<br/>(strict BCS, no trailing bytes)"]
    B --> C{"target_chain_id =<br/>this account's chain id?"}
    C -- no --> X1["abort: EWrongTargetChain (4)"]
    C -- yes --> D{"(source_chain_id, source_sender)<br/>in the ACL?"}
    D -- no --> X2["abort: ESenderNotInAcl (1)"]
    D -- yes --> E{"Signature valid for the<br/>ACL entry's key?"}
    E -- no --> X3["abort: EInvalidSignature (2)"]
    E -- yes --> F{"PTB has a Move call<br/>matching the intent?"}
    F -- no --> X4["abort: ENoMatchingCall (3)"]
    F -- yes --> OK["Authenticated:<br/>the call runs as the account"]
  1. Target chain. target_chain_id must equal the chain id stored in the account.
  2. ACL (access control list). The pair (source_chain_id, source_sender) must have an entry.
  3. Signature. The signature must verify over the message above with the key in that entry (ed25519, scheme 0, or secp256k1, scheme 1).
  4. Matching call. The transaction must contain a Move call with the same package, module, function, type arguments and argument bytes as the intent.

Before these, an empty intent list aborts (ENoIntents, 6) and so does a count mismatch between intents and signatures (ELengthMismatch, 0). Checks 1 to 3 run per intent, then check 4 runs per intent. The matching call may be one of several commands: the authenticator requires that some call matches, so a transaction can carry more commands, as bridge_acl_add does.

Abort codes

A request from a sender that is not in the ACL fails check 2 and aborts with ESenderNotInAcl (code 1). Every abort code is listed in Move API and abort codes.

The ACL

The ACL maps who may originate to who vouches:

  • Key: AclKey { source_chain_id, source_sender }, the chain and the address that called bridge_source::request.
  • Value: AclEntry { pk_bytes, scheme }, the public key of the relayer that signs for that sender, and its scheme.

An entry for a sender names the relayer key whose signatures the account accepts. Only the account itself can add or remove entries, and create requires at least one entry, so an account cannot be created locked. Managing the ACL shows how to add senders.

Why only pure arguments are matched

The authenticator compares each intent argument to the matching call argument by raw bytes, and only for pure inputs. A call argument that is an object or the result of another command makes the call non-matching. A pure input is bytes in the transaction, so the comparison is exact; an object argument has no such bytes to compare. The consequence is that a bridged call must be all-pure, which is why bridge_target::record takes only values, and why bridge_source::acknowledge_pure exists beside acknowledge, which takes a &SourceConfig.

Legacy: the abstract_account path

Deprecated

The older path (ENABLE_AA, /api/SendAAPTB, aa_init, the AA_* variables and an abstract_account package) is deprecated. Its Move source is not in this repository. Use the BridgeAA path in this page; start at One-time bridge setup. The old path is described in Legacy: the abstract_account path.

Next

Agreement: the consensus committee shows how to put several relayer nodes in front of the one key.