xrpl-go
Each rule under rules/ is self-contained: a short prose summary of the failure mode and the idiomatic fix, with links to the relevant package source under Peersyst/xrpl-go and a runnable example under examples/. Use the index below to jump to the rule that fits the task.
This skill is not an API reference. For exhaustive type signatures, see pkg.go.dev/github.com/Peersyst/xrpl-go. For XLS protocol specs, use the companion xrpl-standards skill — when work touches AMM, MPT, NFToken, Credentials, Batch, etc., load both skills.
Read first: Security
These four rules are non-negotiable. Funds have been lost over every one of them.
security-partial-payment — always credit meta.DeliveredAmount, never the transaction Amount on incoming payments. Partial-payment inflation is the canonical XRPL exchange exploit.
security-validate-meta — a preliminary tesSUCCESS from SubmitTxBlob does not mean the tx was applied. Wait for Validated == true on the TxResponse.
security-lastledgersequence — never skip client.Autofill(&flatTx) before signing. Autofill is what sets LastLedgerSequence, Sequence, Fee, and NetworkID.
security-validate-destination-tag — check the destination's LsfRequireDestTag flag before sending; xrpl-go does not.
What to read when
Map the user's task to the rules to consult before writing code.
| User's task or phrase |
Read these rules |
| "Credit an incoming payment", "watch for payments", "deposit handler" |
security-partial-payment, security-validate-meta, ws-lifecycle |
| "Sign and submit", "send a transaction", "send XRP" |
tx-autofill-and-sign, tx-submitandwait, security-lastledgersequence, tx-handle-tec-codes |
| "Set up an exchange deposit address", "custodial account" |
security-validate-destination-tag, wallet |
| "Generate a wallet", "key management" |
wallet |
| "Connect to rippled", "websocket", "subscribe to a stream" |
client, ws-lifecycle |
| "Balance math", "convert XRP / drops", "IOU value" |
amounts |
| "Retry a failed tx", "tec error" |
tx-handle-tec-codes, tx-idempotent-retry, tx-submitandwait |
| "List trust lines / NFTs / offers", "account_lines", "account_objects" |
read-pagination-marker |
| "Audit our xrpl-go integration" |
Read all security-* rules first, then amounts, wallet, and ws-lifecycle. |
Full rule index
Impact tags below match each rule file's frontmatter (CRITICAL, HIGH, MEDIUM).
Security
security-partial-payment — CRITICAL — Read meta.DeliveredAmount, not the transaction Amount
security-validate-meta — CRITICAL — Wait for TxResponse.Validated == true before crediting
security-lastledgersequence — CRITICAL — Always client.Autofill(&flatTx) before signing
security-validate-destination-tag — CRITICAL — Honor LsfRequireDestTag on the destination account
Amounts & numbers
amounts — CRITICAL — Drops + currency.XrpToDrops for XRP, pkg/big-decimal for IOUs, never float64; respect the 15-digit IOU mantissa
Client & connection
client — HIGH — rpc.Client for one-shots, websocket.Client for streams; share the client, don't construct per call
ws-lifecycle — HIGH — Register handlers, Connect, Subscribe; on shutdown Disconnect. Never call Connect() inside a handler. Don't block in handlers.
Wallet & signing
wallet — CRITICAL — wallet.New(crypto.ED25519()) by default; never log Seed / PrivateKey; SetRegularKey for hot wallets
Transactions & submission
tx-autofill-and-sign — HIGH — tx.Flatten() → client.Autofill(&flatTx) → wallet.Sign(flatTx) → client.SubmitTxBlobAndWait(blob, false)
tx-submitandwait — HIGH — Prefer SubmitTxBlobAndWait / SubmitTxAndWait over SubmitTxBlob / SubmitTx
tx-handle-tec-codes — HIGH — Branch on meta.TransactionResult: tec* is applied-but-failed (fee burned, sequence consumed)
tx-idempotent-retry — HIGH — Reuse Sequence or a TicketSequence on retry; do not blindly re-Autofill
read-pagination-marker — MEDIUM — Loop on Marker for paginated Get* requests
How to use a rule file
Once you have picked a rule from the table above, read its file:
Read <skill-dir>/rules/<rule-name>.md
<skill-dir> resolves to wherever the skill is installed — ~/.claude/skills/xrpl-go/ for a user-level Claude Code install, .claude/skills/xrpl-go/ for a project-level install, /mnt/skills/user/xrpl-go/ on claude.ai, or a plugin-managed path. Don't hard-code the directory; rely on the path the host resolves.
Each rule file contains:
- Frontmatter —
title, impact (CRITICAL / HIGH / MEDIUM), tags, and where applicable xrpl_go_source, upstream_docs, example. Fields with no good link are omitted; treat any of these as optional metadata.
- Why it matters — one or two sentences explaining the failure mode.
- The fix — a prose summary of the idiomatic Go pattern, naming the exact xrpl-go types and helpers involved.
- Notes — edge cases, related amendments, version caveats.
- See also — explicit links back to the relevant xrpl-go package source and a runnable example under
examples/.
Runnable examples
The rules in this skill explain what to do and why. When you need a runnable, end-to-end example — how to actually construct, sign, and submit a transaction — go to the xrpl-go examples directory. They are maintained alongside the library and stay current with the API. Prefer them over inventing example code.
Companion skill: xrpl-standards
If the task touches a specific XLS amendment (AMM, MPT, NFToken, Credentials, Batch, DID, Clawback, Permissioned DEX, etc.), load the xrpl-standards skill alongside this one. That skill holds the raw spec text — field definitions, transaction formats, ledger objects, failure conditions — that this skill deliberately does not duplicate.
Authoritative external resources
1---2name: xrpl-go3description: Apply opinionated rules and security patterns to Go code that uses the Peersyst/xrpl-go client library to interact with the XRP Ledger. Use when users want to write a new XRPL integration in Go, review or refactor existing xrpl-go code, sign or submit a transaction, construct or credit a payment, subscribe to ledger or transaction streams, work with issued currencies, AMM, NFToken, escrow, or payment channels, query account or ledger state, or audit an xrpl-go integration for security issues like partial-payment inflation, missing LastLedgerSequence, missing DestinationTag, or unsafe key management.4license: MIT5---67# xrpl-go89Each rule under `rules/` is self-contained: a short prose summary of the failure mode and the idiomatic fix, with links to the relevant package source under [`Peersyst/xrpl-go`](https://github.com/Peersyst/xrpl-go) and a runnable example under [`examples/`](https://github.com/Peersyst/xrpl-go/tree/main/examples). Use the index below to jump to the rule that fits the task.1011This skill is not an API reference. For exhaustive type signatures, see [pkg.go.dev/github.com/Peersyst/xrpl-go](https://pkg.go.dev/github.com/Peersyst/xrpl-go). For XLS protocol specs, use the companion [`xrpl-standards`](../xrpl-standards) skill — when work touches AMM, MPT, NFToken, Credentials, Batch, etc., load both skills.1213## Read first: Security1415These four rules are non-negotiable. Funds have been lost over every one of them.1617- [`security-partial-payment`](rules/security-partial-payment.md) — **always credit `meta.DeliveredAmount`, never the transaction `Amount`** on incoming payments. Partial-payment inflation is the canonical XRPL exchange exploit.18- [`security-validate-meta`](rules/security-validate-meta.md) — a preliminary `tesSUCCESS` from `SubmitTxBlob` does not mean the tx was applied. Wait for `Validated == true` on the `TxResponse`.19- [`security-lastledgersequence`](rules/security-lastledgersequence.md) — never skip `client.Autofill(&flatTx)` before signing. Autofill is what sets `LastLedgerSequence`, `Sequence`, `Fee`, and `NetworkID`.20- [`security-validate-destination-tag`](rules/security-validate-destination-tag.md) — check the destination's `LsfRequireDestTag` flag before sending; xrpl-go does not.2122## What to read when2324Map the user's task to the rules to consult before writing code.2526| User's task or phrase | Read these rules |27|---|---|28| "Credit an incoming payment", "watch for payments", "deposit handler" | `security-partial-payment`, `security-validate-meta`, `ws-lifecycle` |29| "Sign and submit", "send a transaction", "send XRP" | `tx-autofill-and-sign`, `tx-submitandwait`, `security-lastledgersequence`, `tx-handle-tec-codes` |30| "Set up an exchange deposit address", "custodial account" | `security-validate-destination-tag`, `wallet` |31| "Generate a wallet", "key management" | `wallet` |32| "Connect to rippled", "websocket", "subscribe to a stream" | `client`, `ws-lifecycle` |33| "Balance math", "convert XRP / drops", "IOU value" | `amounts` |34| "Retry a failed tx", "tec error" | `tx-handle-tec-codes`, `tx-idempotent-retry`, `tx-submitandwait` |35| "List trust lines / NFTs / offers", "account_lines", "account_objects" | `read-pagination-marker` |36| "Audit our xrpl-go integration" | Read all `security-*` rules first, then `amounts`, `wallet`, and `ws-lifecycle`. |3738## Full rule index3940Impact tags below match each rule file's frontmatter (`CRITICAL`, `HIGH`, `MEDIUM`).4142### Security43- [`security-partial-payment`](rules/security-partial-payment.md) — `CRITICAL` — Read `meta.DeliveredAmount`, not the transaction `Amount`44- [`security-validate-meta`](rules/security-validate-meta.md) — `CRITICAL` — Wait for `TxResponse.Validated == true` before crediting45- [`security-lastledgersequence`](rules/security-lastledgersequence.md) — `CRITICAL` — Always `client.Autofill(&flatTx)` before signing46- [`security-validate-destination-tag`](rules/security-validate-destination-tag.md) — `CRITICAL` — Honor `LsfRequireDestTag` on the destination account4748### Amounts & numbers49- [`amounts`](rules/amounts.md) — `CRITICAL` — Drops + `currency.XrpToDrops` for XRP, `pkg/big-decimal` for IOUs, never `float64`; respect the 15-digit IOU mantissa5051### Client & connection52- [`client`](rules/client.md) — `HIGH` — `rpc.Client` for one-shots, `websocket.Client` for streams; share the client, don't construct per call53- [`ws-lifecycle`](rules/ws-lifecycle.md) — `HIGH` — Register handlers, `Connect`, `Subscribe`; on shutdown `Disconnect`. Never call `Connect()` inside a handler. Don't block in handlers.5455### Wallet & signing56- [`wallet`](rules/wallet.md) — `CRITICAL` — `wallet.New(crypto.ED25519())` by default; never log `Seed` / `PrivateKey`; `SetRegularKey` for hot wallets5758### Transactions & submission59- [`tx-autofill-and-sign`](rules/tx-autofill-and-sign.md) — `HIGH` — `tx.Flatten()` → `client.Autofill(&flatTx)` → `wallet.Sign(flatTx)` → `client.SubmitTxBlobAndWait(blob, false)`60- [`tx-submitandwait`](rules/tx-submitandwait.md) — `HIGH` — Prefer `SubmitTxBlobAndWait` / `SubmitTxAndWait` over `SubmitTxBlob` / `SubmitTx`61- [`tx-handle-tec-codes`](rules/tx-handle-tec-codes.md) — `HIGH` — Branch on `meta.TransactionResult`: `tec*` is applied-but-failed (fee burned, sequence consumed)62- [`tx-idempotent-retry`](rules/tx-idempotent-retry.md) — `HIGH` — Reuse `Sequence` or a `TicketSequence` on retry; do not blindly re-`Autofill`63- [`read-pagination-marker`](rules/read-pagination-marker.md) — `MEDIUM` — Loop on `Marker` for paginated `Get*` requests6465## How to use a rule file6667Once you have picked a rule from the table above, read its file:6869```text70Read <skill-dir>/rules/<rule-name>.md71```7273`<skill-dir>` resolves to wherever the skill is installed — `~/.claude/skills/xrpl-go/` for a user-level Claude Code install, `.claude/skills/xrpl-go/` for a project-level install, `/mnt/skills/user/xrpl-go/` on claude.ai, or a plugin-managed path. Don't hard-code the directory; rely on the path the host resolves.7475Each rule file contains:7677- **Frontmatter** — `title`, `impact` (CRITICAL / HIGH / MEDIUM), `tags`, and where applicable `xrpl_go_source`, `upstream_docs`, `example`. Fields with no good link are omitted; treat any of these as optional metadata.78- **Why it matters** — one or two sentences explaining the failure mode.79- **The fix** — a prose summary of the idiomatic Go pattern, naming the exact xrpl-go types and helpers involved.80- **Notes** — edge cases, related amendments, version caveats.81- **See also** — explicit links back to the relevant xrpl-go package source and a runnable example under [`examples/`](https://github.com/Peersyst/xrpl-go/tree/main/examples).8283## Runnable examples8485The rules in this skill explain *what* to do and *why*. When you need a runnable, end-to-end example — how to actually construct, sign, and submit a transaction — go to the [xrpl-go examples directory](https://github.com/Peersyst/xrpl-go/tree/main/examples). They are maintained alongside the library and stay current with the API. Prefer them over inventing example code.8687| Task | Example |88|---|---|89| Send XRP (RPC + WS variants) | [`send-xrp`](https://github.com/Peersyst/xrpl-go/tree/main/examples/send-xrp), [`send-payment`](https://github.com/Peersyst/xrpl-go/tree/main/examples/send-payment) |90| Partial payment | [`partial-payment`](https://github.com/Peersyst/xrpl-go/tree/main/examples/partial-payment) |91| Subscribe to ledger / transaction streams | [`subscription`](https://github.com/Peersyst/xrpl-go/tree/main/examples/subscription) |92| Multi-signing | [`multisigning`](https://github.com/Peersyst/xrpl-go/tree/main/examples/multisigning) |93| Use Tickets for parallel submission | [`use-tickets`](https://github.com/Peersyst/xrpl-go/tree/main/examples/use-tickets) |94| Regular key / disable master | [`set-regular-key`](https://github.com/Peersyst/xrpl-go/tree/main/examples/set-regular-key) |95| Account / ledger queries | [`queries`](https://github.com/Peersyst/xrpl-go/tree/main/examples/queries), [`ledger`](https://github.com/Peersyst/xrpl-go/tree/main/examples/ledger) |96| Batch transactions | [`batch`](https://github.com/Peersyst/xrpl-go/tree/main/examples/batch) |97| Issued currency / clawback | [`token-issuance`](https://github.com/Peersyst/xrpl-go/tree/main/examples/token-issuance), [`clawback`](https://github.com/Peersyst/xrpl-go/tree/main/examples/clawback) |98| NFTs | [`nft`](https://github.com/Peersyst/xrpl-go/tree/main/examples/nft) |99| MPT | [`mptoken`](https://github.com/Peersyst/xrpl-go/tree/main/examples/mptoken) |100| Faucet | [`faucet`](https://github.com/Peersyst/xrpl-go/tree/main/examples/faucet) |101102## Companion skill: xrpl-standards103104If the task touches a specific XLS amendment (AMM, MPT, NFToken, Credentials, Batch, DID, Clawback, Permissioned DEX, etc.), load the [`xrpl-standards`](../xrpl-standards) skill alongside this one. That skill holds the raw spec text — field definitions, transaction formats, ledger objects, failure conditions — that this skill deliberately does not duplicate.105106## Authoritative external resources107108- **xrpl-go API reference**: https://pkg.go.dev/github.com/Peersyst/xrpl-go109- **xrpl-go source**: https://github.com/Peersyst/xrpl-go110- **xrpl-go examples**: https://github.com/Peersyst/xrpl-go/tree/main/examples111- **Protocol docs**: https://xrpl.org/docs112- **Standards (XLS)**: load the [`xrpl-standards`](../xrpl-standards) skill