Skip to main content

ChainErrors

Blockchain error decoder for EVM and Solana — decode reverts, panics, custom errors, and program failures.

ChainErrors is part of ChainKit, a monorepo of blockchain primitives for Rust, TypeScript, Python, Go, and Java.


Features

Feature Status
EVM Error(string) revert decoding ✅
EVM Panic(uint256) decode with meanings ✅
EVM custom error decoding (40+ bundled) ✅
Solana System Program errors (0-17) ✅
Solana SPL Token errors (0-17) ✅
Solana Anchor framework errors (100-5000+) ✅
Solana program log parsing ✅
Confidence scoring (0.0 – 1.0) ✅
Human-readable suggestions ✅
Golden fixture test suite ✅

Quick Start

Rust

[dependencies]
chainerrors-core = "0.1.0"
chainerrors-evm  = "0.1.0"
chainerrors-solana = "0.1.0"
use chainerrors_evm::EvmErrorDecoder;
use chainerrors_core::ErrorDecoder;

let decoder = EvmErrorDecoder::new();

// Decode a revert string
let data = hex::decode("08c379a0...").unwrap();
let result = decoder.decode(&data, None).unwrap();
println!("{result}");
// → "reverted: Not enough tokens"

// Decode a panic
let panic_data = hex::decode("4e487b71...0011").unwrap();
let result = decoder.decode(&panic_data, None).unwrap();
println!("{result}");
// → "panic 0x11: arithmetic overflow"
use chainerrors_solana::SolanaErrorDecoder;
use chainerrors_core::ErrorDecoder;

let decoder = SolanaErrorDecoder::new();

// Decode a system program error
let result = decoder.decode_error_code(
    1,
    Some("11111111111111111111111111111111"),
    None,
).unwrap();
println!("{result}");
// → "AccountAlreadyInUse(code=1)"

// Decode from program logs
let result = decoder.decode_log(
    "Program failed: custom program error: 0xbc4",
    None,
).unwrap();
println!("{result}");
// → "AccountNotInitialized(code=3012)"

TypeScript (Node.js)

npm install @chainfoundry/chainerrors
import { decodeEvmError } from '@chainfoundry/chainerrors';

const result = decodeEvmError('0x08c379a0...');
console.log(result.kind);    // "revert_string"
console.log(result.message); // "Not enough tokens"

Python

pip install chainerrors
from chainerrors import decode_evm_error

result = decode_evm_error("0x08c379a0...")
print(result["kind"])     # "revert_string"
print(result["message"])  # "Not enough tokens"

CLI

cargo install chainerrors-cli

chainerrors decode --data 0x08c379a0...
# → Error(string): "Not enough tokens"

chainerrors decode --data 0x4e487b710000...0011
# → Panic(uint256): arithmetic overflow (0x11)

EVM Error Types

Revert Strings (0x08c379a0)

require(balance >= amount, "Insufficient balance")
→ Error(string): "Insufficient balance"

Panic Codes (0x4e487b71)

Code Meaning
0x01 assert() violation
0x11 Arithmetic overflow
0x12 Division by zero
0x21 Invalid enum conversion
0x32 Array out of bounds
0x51 Zero-initialized function pointer

Bundled Custom Errors (40+)

ERC-20: InsufficientBalance, InvalidSender, InvalidReceiver, InsufficientAllowance ERC-721: InvalidOwner, NonexistentToken, IncorrectOwner, InsufficientApproval OpenZeppelin: OwnableUnauthorizedAccount, AccessControlUnauthorizedAccount, ReentrancyGuardReentrantCall, EnforcedPause Uniswap V3: T, LOK, TLU, TLM, TUM, AS, M0, M1, IIA, SPL, F0, F1, L, LS, LA EIP-4626: ExceededMaxDeposit/Mint/Withdraw/Redeem SafeERC20: FailedOperation, FailedDecreaseAllowance


Solana Error Types

System Program (18 errors)

AccountAlreadyInitialized, AccountAlreadyInUse, AccountDataTooSmall, AccountNotRentExempt, InsufficientFundsForFee, InvalidAccountDataLength, and more.

SPL Token (18 errors)

NotRentExempt, InsufficientFunds, InvalidMint, MintMismatch, OwnerMismatch, UninitializedState, AccountFrozen, and more.

Anchor Framework (40+ errors)

  • Instruction (100-103): InstructionMissing, InstructionDidNotDeserialize
  • Constraint (2000-2020): ConstraintMut, ConstraintHasOne, ConstraintSigner, ConstraintSeeds, ConstraintOwner
  • Account (3000-3017): AccountDiscriminatorMismatch, AccountNotInitialized, AccountOwnedByWrongProgram, InvalidProgramId

Program Log Parsing

"Program XYZ failed: custom program error: 0xbc4" → Code(3012) → AccountNotInitialized
"Program log: Error: insufficient funds" → Message("insufficient funds")
"Error Code: AccountNotInitialized. Error Number: 3012." → Code(3012)

Architecture

chainerrors/
├── crates/
│   ├── chainerrors-core/     # ErrorDecoder trait, DecodedError, ErrorKind, registry
│   ├── chainerrors-evm/      # EvmErrorDecoder — revert, panic, custom errors
│   └── chainerrors-solana/   # SolanaErrorDecoder — system, token, anchor, logs
├── bindings/
│   ├── node/                 # TypeScript via napi-rs
│   ├── python/               # Python via PyO3/maturin
│   ├── go/                   # Go via cgo
│   └── java/                 # Java via JNI
└── cli/                      # chainerrors-cli binary

Tests

cd chainerrors && cargo test --workspace
# 72 tests: 7 core + 17 evm + 10 golden + 35 solana + 3 doc-tests

License

MIT — see LICENSE

Contact

Built by @darshan_aqua — questions, feedback, and contributions welcome.

Metadata

Release files for chainfoundry-chainerrors 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for chainfoundry-chainerrors 0.1.0
File
chainfoundry_chainerrors-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ ARM64 Details

Total release size: 1.7 MB

Release files / chainfoundry_chainerrors-0.1.0-cp311-cp311-win_amd64.whl

Download URL chainfoundry_chainerrors-0.1.0-cp311-cp311-win_amd64.whl
Size 282.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
702411c6caa21d7b6befa1fc3dc7d99fea8b71c94d911061f657c25b30832ad0
BLAKE2b-256 checksum
How to use checksums
54f0caaecd7690223b7617d1ffc07953d4c1c23091cc250d28c282676f1c160e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 330.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6cdb5194626fb4a67259afd5b98c5516c5202837ed4fb113c31b867acd695581
BLAKE2b-256 checksum
How to use checksums
a4ae3464346a46e635c7eacb8e206697852f561a1d69cabb0a93f6fd71694a2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL chainfoundry_chainerrors-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 346.2 kB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
c13b3fd3a552e5bd0e559e920728a60b3129ca5e32cd5038cdb04af111ac98bd
BLAKE2b-256 checksum
How to use checksums
46cbe9b7463e70be154e62df396c2a0eb2c26f8183b7b98e7a4a1ec7a8deb9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 361.1 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3f7f33af36979ac90899965c214d01c74edd3b762c11d4131c894c6b6bc00a69
BLAKE2b-256 checksum
How to use checksums
71cc9a172e94b29a2f3d2fb985a0a425022f25d5301330f7eedbcf8926ef9d97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL chainfoundry_chainerrors-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 346.0 kB
Tags CPython 3.8 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
e2191b9a2ddebe575ae24532f3fb8445b56a50f4e6a552bfce2862d4236a73ac
BLAKE2b-256 checksum
How to use checksums
64459a0576dbf7554c8b364689dacabb0f0f3b46d6b1ef24f10da535e89997af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Security for chainfoundry-chainerrors 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for chainfoundry_chainerrors-0.1.0-cp311-cp311-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page