Skip to content

Commit 5d59a6b

Browse files
committed
Merge branch 'add-cli-tool' of https://github.com/JAGADISHSUNILPEDNEKAR/python-bitcoin-utils into JAGADISHSUNILPEDNEKAR-add-cli-tool
2 parents 7fba829 + ba2dbfe commit 5d59a6b

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

bitcoin_utils_cli.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
11
#!/usr/bin/env python3
22
"""
3-
Bitcoin Utils CLI - Command line interface for python-bitcoin-utils
3+
Bitcoin Utils CLI (bu) - Command line interface for python-bitcoin-utils
44
55
This CLI tool provides educational utilities to interact with Bitcoin through
66
the python-bitcoin-utils library. It's designed to help understand the
77
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>
829
"""
930

1031
import argparse
1132
import sys
1233
import json
1334
import binascii
35+
import os
1436
from bitcoinutils.setup import setup
1537
from bitcoinutils.keys import PrivateKey, PublicKey
1638
from bitcoinutils.transactions import Transaction
@@ -262,7 +284,7 @@ def parse_block(args):
262284

263285
def main():
264286
"""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')
266288

267289
# Network options
268290
parser.add_argument('--network', choices=['mainnet', 'testnet', 'regtest'],

tests/test_bitcoin_utils_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
Tests for the Bitcoin Utils CLI tool
3+
Tests for the Bitcoin Utils CLI (bu) tool
44
"""
55

66
import unittest

0 commit comments

Comments
 (0)