These snippets show the shape of the common calls in the IXO MultiClient SDK
(@ixo/impactxclient-sdk) and the IXO Matrix Client SDK (@ixo/matrixclient-sdk). Adapt them to
your own code. The step-by-step explanation is in Developer workflows, and
exact field shapes come from the
chain proto definitions.
Illustrative example. This page is not a runnable project. You supply the signer, the tokens and the identifiers listed under What you supply, and nobody has published a tested run of the whole sequence. The package versions are not pinned to a tested release. Build against a test network, never against mainnet.
If you want a path you can run and test from start to finish today, use the decision oracle guide. It has unit tests, a dry run against a real claim, and a preview of the decision.
Setup
npm install @ixo/impactxclient-sdk @ixo/matrixclient-sdkimport {
ixo,
createQueryClient,
createSigningClient,
} from "@ixo/impactxclient-sdk";
import {
createMatrixApiClient,
createMatrixRoomBotClient,
createMatrixStateBotClient,
createMatrixClaimBotClient,
} from "@ixo/matrixclient-sdk";
// Take both from your environment. Use endpoints for the same test network.
const RPC_ENDPOINT = process.env.RPC_ENDPOINT!; // testnet: https://testnet.ixo.earth/rpc/
const MATRIX_BASE_URL = process.env.MATRIX_BASE_URL!; // testnet: https://testmx.ixo.earth
const queryClient = await createQueryClient(RPC_ENDPOINT);
const signingClient = await createSigningClient(RPC_ENDPOINT, offlineSigner);The RPC endpoint and the Matrix homeserver must belong to the same network. The hosts for each
network are listed in Networks and endpoints.
On the development homeserver the bots are at /bots/room, /bots/state and /bots/claim on the
same host. For another network, confirm the bot URLs with whoever operates your deployment, and set
MATRIX_ROOM_BOT_URL, MATRIX_STATE_BOT_URL and MATRIX_CLAIM_BOT_URL to match.
What you supply
The snippets use these names without declaring them. Each one is yours to provide.
| Name | What it is | Where it comes from |
|---|---|---|
offlineSigner | A signer for your account | See Creating signers in the SDK README |
signerAddress | The ixo1… address of that signer | Your signer |
matrixAccessToken | Your Matrix access token | Your Matrix login. See the authentication matrix |
ucanToken | A UCAN that proves you may act on the entity | A delegation from a controller of the entity |
telemetryFile | The file content to upload | Your application |
recipientAddress | The account that receives minted tokens | Your application |
collectionId, adminAddress, oracleAddress, tokenContractAddress | The claim collection, its admin account, the evaluating oracle, and your token contract | The collection and contract you created, on the same network |
The identifiers in the snippets, such as did:ixo:entity:protocol123 and bafkreih..., are
placeholders. Replace every one.
Digital twin: create an entity
const createEntity = async (signerAddress: string) => {
const message = {
typeUrl: "/ixo.entity.v1beta1.MsgCreateEntity",
value: ixo.entity.v1beta1.MsgCreateEntity.fromPartial({
ownerAddress: signerAddress,
entityType: "asset",
context: [
ixo.iid.v1beta1.Context.fromPartial({
key: "class",
val: "did:ixo:entity:protocol123",
}),
],
verification: [],
controller: [],
service: [],
linkedResource: [],
accordedRight: [],
linkedEntity: [],
linkedClaim: [],
}),
};
return signingClient.signAndBroadcast(signerAddress, [message], "auto");
};
const entities = await queryClient.ixo.entity.v1beta1.entityList();Source an entity room (IXO Matrix)
Each domain has an encrypted Matrix room, its data room. Source it by the entity's DID with the room bot, which creates the room if needed and invites the caller.
const matrixRoomBotClient = createMatrixRoomBotClient({
homeServerUrl: MATRIX_BASE_URL,
botUrl: process.env.MATRIX_ROOM_BOT_URL!,
accessToken: matrixAccessToken,
});
const sourceRoomResponse = await matrixRoomBotClient.room.v1beta1.sourceRoomAndJoin(
"did:ixo:entity:abc...xyz",
ucanToken,
);
const roomId = sourceRoomResponse.roomId;The ucanToken carries the caller's capability to act on the entity. The optional accessToken is the user's Matrix client-server access token, used only for the local join and never sent to the bot server. See Matrix authentication.
Upload telemetry into the data room
const matrixApiClient = createMatrixApiClient({
homeServerUrl: MATRIX_BASE_URL,
accessToken: matrixAccessToken,
});
const upload = await matrixApiClient.media.v1beta1.upload(
"telemetry-2025-04.json",
"application/json",
telemetryFile,
);
const mxcUri = upload.content_uri;Read or set room state via the State Bot
Use the State Bot to attach structured profile or settings data to an entity room.
const matrixStateBotClient = createMatrixStateBotClient({
homeServerUrl: MATRIX_BASE_URL,
botUrl: process.env.MATRIX_STATE_BOT_URL!,
accessToken: matrixAccessToken,
});
const stateData = await matrixStateBotClient.state.v1beta1.queryState(
roomId,
"impactsX",
"profile",
ucanToken,
);
await matrixStateBotClient.state.v1beta1.setState(
roomId,
"impactsX",
"profile",
JSON.stringify({ displayName: "Solar Farm Alpha", capacityKw: 5000 }),
ucanToken,
);Always read state before overwriting. The State Bot does not merge. It replaces the value at the path you set.
Claim sequence: submit, evaluate, mint
The sequence for a digital MRV outcome. Each numbered step is a separate transaction. Step 3 records a decision, so run it only when you hold a real one.
const collectionId = "12";
const adminAddress = "ixo1...";
const oracleAddress = "ixo1oracle...";
const tokenContractAddress = "ixo1contract...";
// 1. Submit a claim referencing evidence stored in the data room
const submitClaimMsg = {
typeUrl: "/ixo.claims.v1beta1.MsgSubmitClaim",
value: ixo.claims.v1beta1.MsgSubmitClaim.fromPartial({
creator: signerAddress,
claimId: "bafkreih...",
collectionId,
adminAddress,
}),
};
await signingClient.signAndBroadcast(signerAddress, [submitClaimMsg], "auto");
// 2. Optional Claim Bot helpers (off-chain co-ordination)
const matrixClaimBotClient = createMatrixClaimBotClient({
homeServerUrl: MATRIX_BASE_URL,
botUrl: process.env.MATRIX_CLAIM_BOT_URL!,
accessToken: matrixAccessToken,
});
const claimRecord = await matrixClaimBotClient.claim.v1beta1.queryClaim(
collectionId,
"bafkreih...",
ucanToken,
);
// 3. Evaluate after the Agentic Oracle has produced a verification
const evaluateMsg = {
typeUrl: "/ixo.claims.v1beta1.MsgEvaluateClaim",
value: ixo.claims.v1beta1.MsgEvaluateClaim.fromPartial({
creator: signerAddress,
claimId: "bafkreih...",
collectionId,
oracle: oracleAddress,
adminAddress,
status: 1, // 1 = approved, 2 = rejected. Set it from the decision. Never hardcode it
reason: 0,
verificationProof: "bafkrei-proof-cid",
amount: [],
}),
};
await signingClient.signAndBroadcast(signerAddress, [evaluateMsg], "auto");
// 4. Mint outcome tokens against the approved claim
const mintMsg = {
typeUrl: "/ixo.token.v1beta1.MsgMintToken",
value: ixo.token.v1beta1.MsgMintToken.fromPartial({
minter: signerAddress,
contractAddress: tokenContractAddress,
owner: recipientAddress,
mintBatch: [
ixo.token.v1beta1.MintBatch.fromPartial({
name: "CARBON",
index: "bafkreih...",
amount: "3600",
collection: "did:ixo:entity:collection456",
tokenData: [],
}),
],
}),
};
await signingClient.signAndBroadcast(signerAddress, [mintMsg], "auto");Where the decision comes from
Step 3 above writes a decision to the chain. It does not make one. The check that produces the decision is a separate service.
If you use a decision oracle built with @ixo/decision-oracle, you do not write MsgEvaluateClaim
yourself. The oracle gets the decision from the decision engine, and records it on chain with the
engine's signed receipt as the verificationProof. See
Decision oracle.
Write MsgEvaluateClaim by hand only when you run your own evaluation service. In that case:
- Set
statusfrom the result of your evaluation. The protocol's values are0pending,1approved,2rejected,4invalidated and5flagged. The chain no longer accepts3(disputed) on a new evaluation: a dispute is its own record. See How claim disputes work on chain. - Handle a rejection and an undecided claim as carefully as an approval. A claim you cannot decide can be flagged, which fires no payment and can be re-evaluated later.
- Your account needs an
EvaluateClaimAuthorizationon the collection, or the chain refuses the message. See Custom authorisations for IXO Claims.