An Electrum wallet plugin for composing Stacks blockchain transactions via Bitcoin OP_RETURN encoding, as defined in SIP-001 and SIP-007.
Compose Stacks transactions via Bitcoin OP_RETURN outputs:
- Leader VRF Key Registration: Register a VRF proving key for Stacks mining
- Leader Block Commit: Commit Stacks blocks to the burnchain
- User Burn Support: Support miners by contributing burns to their block commitments
- Pre-STX Authorization: Authorize addresses for STX operations
- Stack STX: Lock STX tokens for Proof-of-Transfer participation
- Transfer STX: Transfer STX via Bitcoin transactions
- Delegate STX: Delegate STX to stacking pool operators
All transaction types include:
- Proper OP_RETURN encoding with Stacks magic bytes
- Network selection (Mainnet/Testnet)
- Coin control for UTXO selection (required for two-transaction flows)
- Preview of encoded data before broadcasting
- Real-time STX address and balance display for the sender
The plugin extends Electrum's interface with STX address support:
- STX Address Column: Adds an "STX Address" column to the address list showing the corresponding STX address for each Bitcoin address
- Extended Address Dialog: Right-click any address to see its STX address and live STX balance
- Address Context Menu: Right-click options include:
- Copy STX Address to clipboard
- View on Stacks block explorer (Hiro)
- Compose Stacks transaction with preselected address
Converts Bitcoin addresses to their corresponding STX addresses:
- Legacy P2PKH (addresses starting with
1orm/n) - P2SH (addresses starting with
3or2) - Native SegWit P2WPKH (addresses starting with
bc1qortb1q)
Note: P2WSH and Taproot (P2TR) addresses are not supported as they use different hash constructions.
- Fetches live STX balances from the Stacks API
- Displays balance in address dialogs and transaction composer
- Supports both mainnet and testnet
Configure plugin settings via Tools > Stacks preferences:
- Network Selection: Choose between Stacks Mainnet and Testnet
- Custom Node URL: Configure a custom Stacks API endpoint (defaults to Hiro API)
Electrum requires plugins to be installed as ZIP files. Use the included build script:
./dev-refresh.shThis script:
- Packages the plugin into the correct ZIP format
- Installs it to
~/.electrum/plugins/stacks.zip - Excludes test files from the package
After running the script:
- Restart Electrum
- Enable the plugin: Tools > Plugins > Stacks Transaction Composer
If you prefer to install manually:
-
Create a ZIP file named
stacks.zipcontaining astacks/folder with:- All
.pyfiles (except test files) manifest.jsonstacks.svg
- All
-
Copy
stacks.zipto your Electrum plugins directory:- Linux/macOS:
~/.electrum/plugins/ - Windows:
%APPDATA%\Electrum\plugins\
- Linux/macOS:
-
Restart Electrum and enable the plugin
After enabling the plugin:
- Tools > Stacks preferences - Configure network and API settings
- Right-click any address in the Addresses tab to access STX features:
- Copy STX Address
- View on Stacks block explorer
- Compose Stacks transaction
- Click any address to view the extended address dialog with STX address and balance
- The STX Address column appears automatically in the Addresses tab
Several Stacks operations require two Bitcoin transactions with specific UTXO linkage:
-
Create VRF Key Registration:
- Select "Leader VRF Key Registration"
- Enter your consensus hash and VRF public key
- Use coin control to select the UTXO from your mining address
- Create and broadcast the transaction
-
Wait for confirmation (typically 1+ confirmations required)
-
Create Block Commit:
- Select "Leader Block Commit"
- Fill in block hash, VRF seed, and reference data
- Important: Use coin control to select a UTXO from the same address used in step 1
- Set your burn amount
- Create and broadcast
-
Create Pre-STX Authorization:
- Select "Pre-STX Authorization"
- Use coin control to select the UTXO from the address you want to authorize
- Create and broadcast
-
Wait for confirmation
-
Create STX Operation (Stack/Transfer/Delegate):
- Select your desired STX operation
- Important: Use coin control to select a UTXO from the Pre-STX transaction
- Fill in the required parameters
- Create and broadcast
Note on Transfer/Delegate STX recipients: The Stacks blockchain only accepts legacy Bitcoin addresses (P2PKH starting with 1 or P2SH starting with 3) for the recipient/delegate output. SegWit addresses (bc1...) are not supported per SIP-007. The plugin validates this and shows real-time feedback.
All transactions use the following structure:
| Bytes | Field | Description |
|---|---|---|
| 0-1 | Magic | Network identifier (X2 for mainnet, T2 for testnet) |
| 2 | Opcode | Operation type identifier |
| 3+ | Data | Operation-specific payload |
| Operation | Opcode | ASCII |
|---|---|---|
| Leader Block Commit | 0x5B |
[ |
| Leader Key Register | 0x5E |
^ |
| User Burn Support | 0x5F |
_ |
| Pre-STX | 0x70 |
p |
| Stack STX | 0x78 |
x |
| Transfer STX | 0x24 |
$ |
| Delegate STX | 0x23 |
# |
manifest.json- Plugin metadata__init__.py- Package initializationqt.py- Main plugin class with hooks and context menu integrationcomposer_dialog.py- Transaction composer dialog UIstacks_address_dialog.py- Extended address dialog with STX infostacks_address_list.py- Address list patches for STX columnstacks_preferences.py- Preferences dialog and config helpersstacks_wire.py- Wire format encoding and address conversion librarytest_stacks_wire.py- Unit tests for wire format encoding
- Electrum 4.0+
- PyQt6
MIT License