https://github.com/crytic/anchorx-ray

Node module for scanning and visualize Solana accounts

https://github.com/crytic/anchorx-ray

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Node module for scanning and visualize Solana accounts

Basic Info
  • Host: GitHub
  • Owner: crytic
  • License: agpl-3.0
  • Language: HTML
  • Default Branch: main
  • Size: 531 KB
Statistics
  • Stars: 29
  • Watchers: 2
  • Forks: 2
  • Open Issues: 2
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Solana Program Account Scanner

Overview

This script scans and extracts account information for Solana programs based on their Interface Definition Language (IDL) files. It uses the @coral-xyz/anchor and @solana/web3.js libraries to interact with the Solana blockchain, identify different types of accounts, and decode account data.

Features

  • Loads IDL files from target/idl/.
  • Scans all accounts associated with detected programs.
  • Identifies account types: Wallets, PDAs, Data Accounts, and Programs.
  • Decodes account data using the BorshAccountsCoder.
  • Saves all extracted information to accounts.json.
  • Display it

Example

Prerequisites

Ensure you have the following installed: - Node.js (>=16.x recommended) - Anchor framework (for building Solana programs) - Solana CLI (for interacting with the blockchain)

Installation

sh npm install anchorx-ray

Configuration

If your test don't use the same rpc url, you can change in the .env file: RPC_URL=<YOUR_RPC> If no RPC URL is provided, the script defaults to http://127.0.0.1:8899 (local Solana test validator).

Usage

Run the script in your Anchor project: sh npx anchorx-ray

This will: 1. Load all IDL files from target/idl/. 2. Fetch programs owned by the accounts from the RPC. 3. Identify and categorize these accounts using IDL and some other computations. 4. Save the results in accounts.json. 5. Open a visualization at http://localhost:3000/ in the browser.

Account Type Identification

The script categorizes accounts as: - Program Account: The executable program itself. - Wallet: A system account owned by the Solana System Program. (normally it will not happen for the moment since only accounts owned by the program are taken from the RPC) - PDA (Program Derived Address): A non-executable program-owned address. - Data Account: A regular program-owned account storing data. - Other: Any account that doesn’t fit the above categories.

Output Format

The output is saved in accounts.json and contains details like: json [ { "name": "example_program", "address": "ABC123...", "owner": "11111111111111111111111111111111", "lamports": 1000000, "executable": true, "dataSize": 0, "accountType": "Program", "decodedData": null } ]

And it will open a diagram showing all accounts used in the tests (program + accounts owned by the program)

Troubleshooting

  • No IDL files found: Ensure you have built your Anchor program using anchor build.
  • Failed to fetch accounts: Check your RPC URL and network connection.
  • Only one program is shown in the diagram: Ensure you have run tests.

For developers

If you want to update a part of the script, 1. Clone the repo sh gh repo clone crytic/anchorx-ray 2. Install dependencies sh npm install 3. Do your modifications 4. Then sh npm run build

Owner

  • Name: Crytic
  • Login: crytic
  • Kind: organization
  • Email: opensource@trailofbits.com
  • Location: New York, NY

Blockchain Security, by @trailofbits

GitHub Events

Total
  • Issues event: 1
  • Watch event: 22
  • Issue comment event: 1
  • Public event: 1
  • Push event: 6
  • Pull request event: 2
  • Fork event: 2
  • Create event: 1
Last Year
  • Issues event: 1
  • Watch event: 22
  • Issue comment event: 1
  • Public event: 1
  • Push event: 6
  • Pull request event: 2
  • Fork event: 2
  • Create event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 7
  • Total Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.286
Past Year
  • Commits: 7
  • Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.286
Top Committers
Name Email Commits
Coriolan Pinhas c****s@t****m 5
Josselin Feist j****t@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 3
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gonzaotc (2)
  • Ectario (1)
Pull Request Authors
  • montyly (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

package-lock.json npm
  • 177 dependencies
package.json npm
  • @types/bn.js ^5.1.6 development
  • @types/express ^5.0.0 development
  • @types/open ^6.1.0 development
  • ts-node ^10.9.2 development
  • @coral-xyz/anchor ^0.30.1
  • @solana/web3.js ^1.98.0
  • anchorx-ray ^0.1.0
  • dotenv ^16.4.7
  • express ^4.21.2
  • open ^10.1.0