|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | """ |
3 | | -Bitcoin Utils CLI - Command line interface for python-bitcoin-utils |
| 3 | +Bitcoin Utils CLI (bu) - Command line interface for python-bitcoin-utils |
4 | 4 |
|
5 | 5 | This CLI tool provides educational utilities to interact with Bitcoin through |
6 | 6 | the python-bitcoin-utils library. It's designed to help understand the |
7 | 7 | inner workings of Bitcoin through practical examples and utilities. |
| 8 | +
|
| 9 | +Installation Instructions: |
| 10 | +------------------------ |
| 11 | +
|
| 12 | +1. Make the file executable: |
| 13 | + $ chmod +x bitcoin_utils_cli.py |
| 14 | +
|
| 15 | +2. Create a symlink named 'bu' in your PATH: |
| 16 | + $ sudo ln -s /path/to/bitcoin_utils_cli.py /usr/local/bin/bu |
| 17 | +
|
| 18 | + Or using pip (if included in a package): |
| 19 | + $ pip install python-bitcoin-utils[cli] |
| 20 | +
|
| 21 | +Usage: |
| 22 | +------ |
| 23 | + $ bu --help |
| 24 | + $ bu generate |
| 25 | + $ bu validate 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH --pubkey 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 |
| 26 | + $ bu decode <transaction_hex> |
| 27 | + $ bu script <script_hex> |
| 28 | + $ bu block <block_file_path> |
8 | 29 | """ |
9 | 30 |
|
10 | 31 | import argparse |
11 | 32 | import sys |
12 | 33 | import json |
13 | 34 | import binascii |
| 35 | +import os |
14 | 36 | from bitcoinutils.setup import setup |
15 | 37 | from bitcoinutils.keys import PrivateKey, PublicKey |
16 | 38 | from bitcoinutils.transactions import Transaction |
@@ -262,7 +284,7 @@ def parse_block(args): |
262 | 284 |
|
263 | 285 | def main(): |
264 | 286 | """Main entry point for the CLI""" |
265 | | - parser = argparse.ArgumentParser(description='Bitcoin Utils CLI - Educational tools for understanding Bitcoin') |
| 287 | + parser = argparse.ArgumentParser(description='Bitcoin Utils CLI (bu) - Educational tools for understanding Bitcoin') |
266 | 288 |
|
267 | 289 | # Network options |
268 | 290 | parser.add_argument('--network', choices=['mainnet', 'testnet', 'regtest'], |
|
0 commit comments