SignLens

The SignLens API

The API the SignLens extension uses is open to try: send a Solana transaction, get its explanation as JSON. No key, no sign-up. What it is for.

Explain a transaction

POST https://api.signlens.dev/v2/explain, with a JSON body and Content-Type: application/json:

curl https://api.signlens.dev/v2/explain \
  -H 'Content-Type: application/json' \
  -d '{"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDoPNSg/gB3f2Qk4kW/vfGYT2/sMTPySWftlVhtuDXJcUCafOnxoRGYS85JbwrRgtqlC8ZZZeNgwYvV3CJxFQiAQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgIBACMGAgG7HXwEidPzx+CSI58Y4AW+qo9qYvAtl7KeMprzY4yjNw==",
       "own_keys": ["BqHRmuFYxr8jCPc3N7ebMfnJJKYcSnoaqknXQ2x1Tx9A"]}'
FieldWhat it is
transactionThe transaction to explain, in base64: its signatures and its message, signed or not. The only field you must send.
own_keysThe user's own addresses, at most 8. The explanation says "you" for them, and the engine derives their token accounts, so that it can tell the user's accounts from a stranger's.
loaded_writable, loaded_readonlyThe addresses the transaction's lookup tables load, in the message's order, as you read them from an RPC. Without them an instruction that names a loaded address cannot be fully explained.
localeThe languages the user prefers, as BCP 47 tags in order, at most 8. The explanation is worded in the first one SignLens has, and in English otherwise.
renderSet to true to get text, the whole explanation as plain text, for a wallet that shows text only.
simulationWhat you saw when you simulated the transaction: whether it failed, and each account's balance change. The engine holds it against what the bytes say and reports a disagreement; it can never improve the verdict.
token_accountsThe token accounts among the accounts of the transaction, as you read them from an RPC, each with its mint. The engine tells from them which are the user's. How to fill it.
contactsThe user's address book, at most 64 names and addresses, so that transfers name who is paid and lookalikes of a contact are found. A stand-in can be sent in place of each name.
token_hintsSymbols and decimals for tokens the verified list lacks, shown as "claimed, unverified".
accountsAccounts an earlier answer asked for in wanted_accounts, such as a multisig proposal, as your RPC returned them.

Every field but transaction is optional. A field the API does not know is an error, so that a misspelt one is not silently dropped. A request is at most 512 KiB.

Token accounts you read

If you read the transaction's accounts from an RPC, for a simulation or a balance preview, send what you found:

"token_accounts": {
  "read": [
    { "address": "<a token account>", "mint": "<its mint>" }
  ],
  "unread": []
}
read
Each account that is a token account, of the Token program or of Token-2022, with the mint it holds. At most 256.
unread
Each account you asked for and could not read, at most 256. The engine will try to derive whether any of them is the user's.

Read every account the transaction names, the ones its lookup tables load included; the signers and the programs it calls can be left out. An account that is not a token account goes in neither list.

A mint you send is checked, not trusted: an account is called the user's only when its address follows from the user's address and that mint. The user's accounts of tokens no list names are known as theirs this way too.

The answer

A document with "schema": "signlens-explanation/2":

{
  "schema": "signlens-explanation/2",
  "verdict": "block",
  "summary": {
    "text": "Give the owner authority over ARX9…Evfz to DbRK…ERgS"
  },
  "findings": [
    {
      "code": "TOKEN_ACCOUNT_GIVEN_AWAY",
      "severity": "critical",
      "message": {
        "text": "Gives YOUR token account to DbRK…ERgS; the new owner controls every token in it and you cannot get it back"
      }
    }
  ]
}
verdict
ok, warn or block. Block means a critical finding, or an instruction the engine cannot explain, such as one of a program it has no description of.
summary
One line saying what the transaction does.
findings
What the user should read before signing, each with a stable code and a severity: critical, high, warning or info.
effects
What the transaction does, as sentences and as values: what is sent, received, approved, created, closed or handed over.
actions, sections
Each instruction decoded, with its program and fields, then the signers, the fee and how long the signature stays valid.
locale
The language the document is worded in, and how many messages fell back to English.
raw.digest
The SHA-256 of the message that was explained, to check that the answer is about the bytes you sent.

Each message has its text and its parts, in which an amount, a token or an address is a value of its own, so that a wallet can draw it its own way.

Limits

Errors

An error is {"schema": "signlens-api-error/1", "error": {"code": "…", "message": "…"}}, with status 400 for a request the engine refuses and 429 for one past a limit. Act on the code; the message is written to be shown.

What is running

GET https://api.signlens.dev/v1/health answers the engine's version, the build, how many programs its descriptions cover and the languages it carries.

What is kept

For each request the API logs the time, the verdict, the finding codes, the program names and a hash of the transaction's message, not the transaction. The privacy page has the rest.

Building a wallet? Write to contact@signlens.dev.