Remote accounts

A contract, wallet or program on another chain controls its own XE account and commands it with Hyperlane messages.

A remote account is an XE account whose only controller is a sender on another chain: a contract, an ordinary EVM wallet or a Solana program. It has no key, no keyset and no delegates. The controller commands it by sending a Hyperlane message to the account's own address.

See a wallet on Base pay someone on XE

#The address

text
remoteAccount = sha256("xe/remote-account/v1" ‖ origin u32 ‖ sender(32) ‖ lineage u32)    // lineage 0

sender is whoever calls the Mailbox: an EVM address left-padded to 32 bytes, or a Solana program id. No ed25519 key or keyset can derive this address, so nobody can sign for it. The same address on two chains owns two different XE accounts, because the origin is in the hash.

solidity
bytes32 account = XE.remoteAccount(84532, address(this)); // Base Sepolia, lineage 0
typescript
import { remoteAccountOf } from "@xe-network/composer"; const account = remoteAccountOf(84532, "0xYourWalletOrContract");
rust
let account = xe_solana_sdk::remote_account(xe_solana_sdk::SOLANA_DEVNET_DOMAIN, &program_id);

#Commands

Every message from the controller to its account is a command. The relayer carries it to XE inside a block on the account's chain. Every node checks the message against the origin's ISM (Trust model), then executes it as an ordinary XE block.

The body starts with a 23-byte header. All integers are big-endian.

OffsetSizeField
04magic "XERA"
41version 0x01
51op
61flags: 0x01 receipt on success, 0x02 receipt on failure, 0x04 wait for funds
78deadline, unix seconds; 0 = none
158receipt gas limit; 0 = none
23…op payload
OpNameExecutes on XE as
0x01paysend (XE or XUSD, memo up to 64 bytes)
0x02leaselease of compute, paid in XUSD up to maxCost
0x03dispatchdispatch to any chain, with the account as sender
0x04set_representativea vote-weight change, off unless the DAO's sys.remote policy allows it
0x05–0x07lease_cancel, lease_force_settle, lease_renewthe lease steps
0x08fundeda payment out of one specific deposit (XE Pay)
0x20route_transferan asset sent to another chain
0x30service_requesta request to XE Services (Contracts using XE)
0x33service_subscriberecurring service rounds
0x40swap_openan XE Swap at a maker's quote
0x50credit_redeemcompute credits

#From an EVM wallet

Any EVM wallet can run its own XE account: it signs one transaction to the Mailbox. Here it pays 1 XE to a merchant on XE.

typescript
import { encodePay, remoteAccountOf, FLAGS } from "@xe-network/composer";import { mailboxDispatchToXeCalldata, quoteDispatchToXeCalldata } from "@xe-network/protocol/interop"; const account = remoteAccountOf(84532, wallet.address);const body = encodePay(  { to: merchant, amount: 1_000_000n, asset: "XE", memo: "order 1042" }, // 1 XE = 1,000,000 micro-units  { flags: FLAGS.receiptOnFailure, deadline: BigInt(Math.floor(Date.now() / 1000) + 3600) },); const args = { xeDomain: 22599, recipient: account, body, merkleTreeHook: "0x86fb9F1c124fB20ff130C41a79a432F770f67AFD" };const fee = await publicClient.call({ to: MAILBOX, data: quoteDispatchToXeCalldata(args) }); // 0 on Base Sepoliaawait wallet.sendTransaction({ to: MAILBOX, data: mailboxDispatchToXeCalldata(args), value: fee });

The account must hold the XE first. Anyone can fund it: send XE or XUSD to the account's address on XE. Anyone may publish the matching receive, with no signature, because a receive only credits the account.

#From a contract

Inherit XEClient and use its helpers. They pay the Mailbox fee from the contract's balance, refuse what XE would fail as malformed, and return the command id.

solidity
import {XE} from "./xe/XE.sol";import {XEClient} from "./xe/XEClient.sol";import {XEChains} from "./xe/XEChains.sol"; contract Payroll is XEClient {    constructor() XEClient(XEChains.baseSepoliaXESim()) {}     function payContributor(bytes32 xeAccount, uint64 units) external payable /* your access control */ {        bytes32 commandId = _xePay(            xeAccount, units, XE.ASSET_XUSD, "october",            XE.Options({flags: XE.RECEIPTS, deadline: uint64(block.timestamp + 1 days), receiptGasLimit: 120_000})        );    }     function _onXEResult(XE.Receipt memory r) internal override {        if (r.code == XE.CODE_EXECUTED) { /* paid, in XE block r.executedIn */ }        else { /* failed: r.code is INSUFFICIENT_FUNDS, EXPIRED, ... */ }    }}

The full helper list and the receive side are on Contracts using XE.

#Receipts

A command may ask for a receipt on success, on failure, or both. The receipt is a 72-byte message from the remote account back to its controller:

OffsetSizeField
04magic "XERR"
41version 0x01
51the command's op
62code: 0 executed, or a failure code
832the command id (the Hyperlane message id)
4032the XE block that executed or failed the command

Failure codes: 1 MALFORMED, 2 EXPIRED, 3 INVALID_PARAMS, 4 INSUFFICIENT_FUNDS, 5 LEASE_TERMS, 6 OUTBOX_FULL. Module ops use 0x0100 and up: 0x0108 FUNDING, 0x0130 SERVICE_TERMS, 0x0140 SWAP_TERMS.

A command that can't execute for a reason the chain alone decides is consumed by a remote_call block carrying the failure code. A command whose fate depends on anything else waits. With WAIT_FOR_FUNDS, a payment waits for the balance instead of failing.

#Rules to design around

  • The Mailbox caller owns the account. Every caller of a shared dispatcher contract shares that dispatcher's one XE account, and any of them can command it. XE.sol's functions are internal so a contract always dispatches as itself.
  • Commands are asynchronous and unordered. They execute in the order they land on the account's chain, and only when someone relays them. Wait for one receipt before sending a command that depends on it.
  • Deadlines are coarse. XE accepts block timestamps within about an hour, so set deadlines in hours.
  • Proxies. The account belongs to the proxy, which is the Mailbox caller. XEClient binds its account in the constructor, so it's for non-upgradeable contracts. An upgradeable contract uses the XE library directly and writes its own handle with the same checks.
  • Relayers in this direction are paid off-band. XE charges nothing. Pay a relayer on your chain, or send it an occasional pay command. process is permissionless, so you can relay your own commands.
  • Inbound trust. A compromised validator set for your origin controls every remote account of that origin until the XE DAO rotates it. On these testnets that set is one Hyperlane key.