Skip to content

Commit 25f8617

Browse files
authored
Merge pull request #6519 from Jiloc/chore/move-stacks-inspect-to-contrib
chore: move `stacks-inspect` to contrib
2 parents 73ff46c + bacd4e6 commit 25f8617

File tree

7 files changed

+223
-197
lines changed

7 files changed

+223
-197
lines changed

Cargo.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ members = [
1111
"libsigner",
1212
"stacks-signer",
1313
"stacks-node",
14+
"contrib/stacks-inspect"
1415
]
1516

1617
exclude = ["contrib/tools/config-docs-generator"]

contrib/stacks-inspect/Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "stacks-inspect"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
stackslib = { package = "stackslib", path = "../../stackslib", default-features = false }
8+
clarity = { path = "../../clarity", default-features = false }
9+
libstackerdb = { path = "../../libstackerdb", default-features = false }
10+
stacks-common = { path = "../../stacks-common", default-features = false }
11+
rusqlite = { workspace = true }
12+
serde_json = { workspace = true }
13+
slog = { workspace = true }
14+
15+
[target.'cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))'.dependencies]
16+
tikv-jemallocator = { workspace = true }
17+
18+
[dev-dependencies]
19+
mutants = "0.0.3"

contrib/stacks-inspect/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# stacks-inspect
2+
3+
A multifunction inspection CLI for Stacks chain data and networking.
4+
5+
Highlights:
6+
- Decode primitives: Bitcoin headers/txs/blocks, Stacks blocks/microblocks, P2P net messages
7+
- Chain queries: ancestors, MARF lookups, tenure info, PoX anchor evaluation
8+
- Mining helpers: `try-mine`, `tip-mine`, sortition (anti-MEV) analysis
9+
- Shadow chain tools: build, patch, repair, and verify shadow chainstate
10+
- Replay: re-execute blocks and microblocks for diagnostics
11+
12+
Build:
13+
```bash
14+
cargo build -p stacks-inspect
15+
```
16+
17+
Basic usage:
18+
```bash
19+
# Show version
20+
./target/debug/stacks-inspect --version
21+
22+
# Example: decode a bitcoin header from file
23+
./target/debug/stacks-inspect decode-bitcoin-header <HEIGHT> <PATH>
24+
25+
# Example: analyze anti-MEV behavior over a height range
26+
./target/debug/stacks-inspect analyze-sortition-mev <burn_db> <sort_db> <chainstate_db> <start> <end> [miner advantage ...]
27+
```
28+
29+
For detailed commands and flags, run:
30+
```bash
31+
./target/debug/stacks-inspect --help
32+
```
33+
34+
Notes:
35+
- Some commands expect mainnet data paths by default and may require specific network contexts.
36+
- Operations that write data (e.g., shadow chain tools) are destructive—use copies of data directories when experimenting.

0 commit comments

Comments
 (0)