Modern debugger for blockchain transactions.
Clone the repository and run the automated build script:
git clone https://github.com/walnuthq/stylusdb.git
cd stylusdb
./build.sh
The script will:
- Install all required dependencies automatically
- Download and build LLDB if needed (macOS only, cached for future builds)
- Build stylusdb
- Optionally install it system-wide
Download the latest installer from GitHub Releases:
- Download the appropriate package for your system:
- Apple Silicon (M1/M2/M3):
StylusDB-0.1.0-macOS-aarch64.pkg
- Intel:
StylusDB-0.1.0-macOS-x86_64.pkg
- Apple Silicon (M1/M2/M3):
- Double-click the package to install
- Follow the installation wizard
The package includes:
stylusdb
- Main debuggerrust-stylusdb
- Rust debugging wrapperpretty-print-trace
- Trace visualization tool- All required LLDB/LLVM libraries
After installation, run /usr/local/bin/stylusdb
to start using the debugger
You can also install the package from the terminal:
# Download the package (choose the right one for your architecture)
# For Apple Silicon (M1/M2/M3):
curl -L -O https://github.com/walnuthq/stylusdb/releases/download/v0.1.0/StylusDB-0.1.0-macOS-aarch64.pkg
# Or for Intel:
# curl -L -O https://github.com/walnuthq/stylusdb/releases/download/v0.1.0/StylusDB-0.1.0-macOS-x86_64.pkg
# Install the package (requires admin password)
sudo installer -pkg StylusDB-0.1.0-macOS-aarch64.pkg -target /
# Verify installation
/usr/local/bin/stylusdb --version
Install Python colorama for pretty-printed traces:
python3 -m venv myvenv
source ./myvenv/bin/activate
pip3 install colorama
Click to expand manual build instructions
brew install llvm@19 lit swig ninja cmake
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 19
sudo apt-get install -y cmake ninja-build llvm-19-dev liblldb-19-dev lldb-19 swig
wget https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-19.1.7.zip
unzip llvmorg-19.1.7.zip
cd llvm-project-llvmorg-19.1.7/ && mkdir build_lldb && cd build_lldb
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
-DLLVM_ENABLE_ASSERTIONS=ON -DLLDB_INCLUDE_TESTS=OFF -DLLDB_ENABLE_PYTHON=1 -GNinja
ninja
cd /path/to/stylusdb
mkdir build && cd build
cmake -GNinja .. \
-DLLVM_DIR=/opt/homebrew/opt/llvm@19/lib/cmake/llvm \
-DLLVM_BUILD_ROOT=/path/to/llvm-project-llvmorg-19.1.7/build_lldb \
-DLLVM_SRC=/path/to/llvm-project-llvmorg-19.1.7/ \
-DLLVM_TABLEGEN_EXE=/opt/homebrew/opt/llvm@19/bin/llvm-tblgen \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" \
-DLLVM_LIB_PATH=/opt/homebrew/opt/llvm@19/lib/libLLVM.dylib
sudo ninja && sudo ninja install
cd /path/to/stylusdb
mkdir build && cd build
cmake -GNinja .. \
-DLLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm \
-DLLVM_BUILD_ROOT=/usr/lib/llvm-19 \
-DLLVM_SRC=/usr/include/llvm-19 \
-DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations"
sudo ninja && sudo ninja install
StylusDB is integrated with cargo-stylus to provide advanced debugging capabilities for Stylus smart contracts on Arbitrum. For complete documentation, see the Stylus Debugger Guide.
Trace user function calls in a transaction to understand the execution flow:
# Basic usage - traces your contract functions
cargo stylus usertrace \
--tx=0x88b0ad9daa0b701d868a5f9a0132db7c0402178ba44ed8dec4ba76784c7194fd \
--endpoint=$RPC_URL
Output:
=== STYLUS FUNCTION CALL TREE ===
└─ #1 stylus_hello_world::__stylus_struct_entrypoint::h09ecd85e5c55b994 (lib.rs:33)
input = size=4
<anon> = stylus_sdk::host::VM { 0=<unavailable> }
└─ #2 stylus_hello_world::Counter::increment::h5b9fb276c23de4f4 (lib.rs:64)
self = 0x000000016fdeaa78
└─ #3 stylus_hello_world::Counter::set_number::h5bd2c4836637ecb9 (lib.rs:49)
self = 0x000000016fdeaa78
new_number = ruint::Uint<256, 4> { limbs=unsigned long[4] { [0]=1, [1]=0, [2]=0, [3]=0 } }
# Include SDK calls
cargo stylus usertrace --tx <TX_HASH> --endpoint=$RPC_URL --verbose-usertrace
# Trace specific external crates
cargo stylus usertrace --tx <TX_HASH> --endpoint=$RPC_URL \
--trace-external-usertrace="std,core,other_contract"
Use StylusDB for interactive debugging sessions:
# Basic replay with stylusdb
cargo stylus replay --debugger stylusdb --tx <TX_HASH> --endpoint=$RPC_URL
This will:
- Launch StylusDB
- Load your contract's debug symbols
- Stop at breakpoints you can set
- Allow stepping through code and inspecting variables with contract programming sugar (e.g. pretty-print
uint256
and other well-known types)
Debug transactions involving multiple contracts:
cargo stylus replay --debugger stylusdb --tx <TX_HASH> \
--contracts 0x123...:./contractA,0x456...:./contractB \
--endpoint=$RPC_URL
In the debugger:
(stylusdb) stylus-contract breakpoint 0x456... ContractB::some_function
Set breakpoint on ContractB::some_function in contract 0x456... (ID: 1, 1 locations)
(stylusdb) continue
Debug transactions that call both Stylus and Solidity contracts:
cargo stylus replay --debugger stylusdb --tx <TX_HASH> \
--addr-solidity=0xda52b25ddb0e3b9cc393b0690ac62245ac772527 \
--endpoint=$RPC_URL
When execution reaches a Solidity contract:
(stylusdb)
════════ Solidity Contract Call ════════
Contract: 0xda52b25ddb0e3b9cc393b0690ac62245ac772527
Function selector: 0xd09de08a (increment())
NOTE: This is a Solidity contract - skipping to next contract
You can also use StylusDB directly without cargo-stylus:
# Start interactive debugger
/usr/local/bin/stylusdb
# Common commands
(stylusdb) target create ./target/release/my_contract.so
(stylusdb) breakpoint set --name user_entrypoint
(stylusdb) run
(stylusdb) continue
(stylusdb) quit
The automated build script handles this, but if building manually, ensure LLDB libraries are copied to /usr/local/lib/
.
Install the development packages:
sudo apt-get install liblldb-19-dev lldb-19
See LICENSE file for details.