https://github.com/hirosystems/multisig-cli
CLI for updated Ledger app
https://github.com/hirosystems/multisig-cli
Last synced: 11 months ago
JSON representation
CLI for updated Ledger app
- Host: GitHub
- URL: https://github.com/hirosystems/multisig-cli
- Owner: hirosystems
- License: apache-2.0
- Created: 2023-10-10T14:04:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-28T15:18:08.000Z (11 months ago)
- Last Synced: 2025-08-10T10:58:12.274Z (11 months ago)
- Language: TypeScript
- Size: 503 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multisig CLI tool
Command line utility written in NodeJS for creating and signing Stacks multisig transactions with a Ledger device
## Dependencies
You will need to have `nodejs` and `npm` installed.
After cloning the repository, go to the project root and run:
```sh
npm install
```
## How to Run
### CLI
```sh
npm start -- [args]
```
| Subcommand | Description |
| ---------------- | -------------------------------------------------------------- |
| `get_pub ` | Get public key from Ledger |
| `make_multi` | Make multisig address from pubkeys |
| `check_multi` | Check multisig addresses derived from pubkeys |
| `create_tx` | Create unsigned multisig transaction |
| `sign` | Sign multisig transaction with Ledger |
| `decode` | Decode and print Stacks base64-encoded transaction |
| `broadcast` | Broadcast a transaction to the network |
| Flags | Subcommands | Description |
| --------------------- | ----------------------------------|-------------------------------------------------------|
| `--json-inputs `| `create_tx` | Read transaction inputs from JSON file |
| `--csv-inputs ` | `create_tx` | Read transaction inputs from a CSV file |
| `--json-txs ` | `sign`, `broadcast` | Allow bulk operations by reading JSON array from file |
| `--csv-keys ` | `sign` | Sign using pubkeys/paths from a CSV file |
| `--out-file ` | `create_tx`, `sign`, `broadcast` | Output JSON directly to file |
| `--api-key ` | `broadcast` | Use Hiro API key to avoid rate limits |
## Examples
### Using Hiro API Key
To avoid rate limits when creating transactions or broadcasting them, you can use a Hiro API key:
1. Get an API key from [Hiro](https://docs.hiro.so/api)
2. Save your API key to a file
3. Use the `--api-key` flag with the relevant commands:
```sh
# When broadcasting transactions
npm start -- broadcast --api-key path/to/api-key-file
```
This is especially useful when working with multiple transactions to avoid hitting rate limits.
### Recieving Funds
1. Get any Ledger public keys needed
```sh
npm start -- get_pub
```
If you are unsure of what `path` to use to generate the pubkey for your account, try `m/5757'/0'/0/0/0` or `m/44'/5757'/0/0/0`
2. Create a multisig address from pubkeys
```sh
npm start -- make_multi
```
3. Use any wallet to send funds to the address
### Single Transaction Using User Input
While using this tool, inputs/outputs will be in base64-encoded JSON.
You will need to copy/paste this between steps to manage application state.
1. Create a transaction
```sh
npm start -- create_tx
```
2. For each required signature, sign with Ledger
```sh
npm start -- sign
```
3. **[Optional]** Print transaction as JSON to check
```sh
npm start -- decode
```
3. Broadcast transaction
```sh
npm start -- broadcast
```
### Bulk Transactions
1. Create the transactions from a CSV file and save outputs to file
```sh
npm start -- create_tx --csv-inputs $CSV_INPUTS_FILE --out-file transactions.json
```
2. Sign the transactions and save outputs to file
```sh
npm start -- sign --json-txs transactions.json --csv-keys $CSV_KEYS_FILE --out-file signed_transactions.json
```
3. Broadcast transactions
```sh
npm start -- broadcast --json-txs signed_transactions.json --out-file broadcast_results.json
```
### CSV File Structure
The Transactions CSV file should have the following columns:
| Column Name | Description |
| --- | --- |
| `recipient` | Destination STX Address |
| `fee` | Transaction Fee (in microSTX) |
| `amount` | Amount to Send (in microSTX) |
| `publicKeys/0` | Public Key 1 (add for each signer)|
| `publicKeys/1` | Public Key 2 |
| `publicKeys/2` | Public Key 3 |
| `numSignatures` | Number of Signatures Needed |
| `sender` | Source STX Address|
The Key Path Map CSV file should have the following columns with the public key for each signer for each path
| Column Name | Description |
| --- | --- |
| `key` | Derivation Path |
| `path` | Public Key for that Path a Given Signer |
## Using Docker
You will need Docker and `just` (can be installed by `cargo install just`)
### Building the Image
```sh
just build
```
### Running the Image
Run the same way you would run normally, but replace the `npm start --` prefix with:
```sh
just run [args...]