|
1 | | -# Reimplemnenting the Bitcoin Message Tool |
| 1 | +# The [Bitcoin Message Tool](https://github.com/shadowy-pycoder/bitcoin_message_tool) in Go |
| 2 | + |
| 3 | +## Installation |
| 4 | + |
| 5 | +```shell |
| 6 | +go install github.com/shadowy-pycoder/go-bitcoin-message-tool/cmd/bmt@latest |
| 7 | +``` |
| 8 | +This will install the `bmt` binary to your `$GOPATH/bin` directory. |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +### General |
| 13 | +```shell |
| 14 | +bmt -h |
| 15 | + |
| 16 | +██████╗ ███╗ ███╗████████╗ |
| 17 | +██╔══██╗████╗ ████║╚══██╔══╝ |
| 18 | +██████╔╝██╔████╔██║ ██║ |
| 19 | +██╔══██╗██║╚██╔╝██║ ██║ |
| 20 | +██████╔╝██║ ╚═╝ ██║ ██║ |
| 21 | +╚═════╝ ╚═╝ ╚═╝ ╚═╝ |
| 22 | + |
| 23 | +Bitcoin Message Tool by shadowy-pycoder |
| 24 | + |
| 25 | +GitHub: https://github.com/shadowy-pycoder |
| 26 | + |
| 27 | +Usage: bmt [OPTIONS] COMMAND |
| 28 | +Options: |
| 29 | + |
| 30 | + -h show this help message and exit |
| 31 | + |
| 32 | +Commands: |
| 33 | + |
| 34 | + sign Create bitcoin message |
| 35 | + verify Verify bitcoin message |
| 36 | +``` |
| 37 | + |
| 38 | +### Message signing |
| 39 | +```shell |
| 40 | +Usage bmt sign [-h] -p -a {legacy, nested, segwit} -m [MESSAGE ...] [-d] [-e] |
| 41 | +Options: |
| 42 | + |
| 43 | + -a value |
| 44 | + type of bitcoin address (legacy, nested, segwit) |
| 45 | + -d sign deterministically (RFC6979) |
| 46 | + -e create electrum-like signature |
| 47 | + -h show this help message and exit |
| 48 | + -m string |
| 49 | + [MESSAGE ...] message to sign |
| 50 | + -p private key in wallet import format (WIF) |
| 51 | + |
| 52 | +Examples: |
| 53 | + |
| 54 | +Deterministic signature for compressed private key and legacy address |
| 55 | + |
| 56 | +bmt sign -p -a legacy -d -m "ECDSA is the most fun I have ever experienced" |
| 57 | +PrivateKey (WIF): L3V9AFB763LKWWsMh8CyosSG8QV8KDTjYeXqkt4WX5Xyz2aNqLAY |
| 58 | +-----BEGIN BITCOIN SIGNED MESSAGE----- |
| 59 | +ECDSA is the most fun I have ever experienced |
| 60 | +-----BEGIN BITCOIN SIGNATURE----- |
| 61 | +16wrm6zJek6REbxbJSLsBHehn3Lj1vo57t |
| 62 | + |
| 63 | +H3x5bM2MpXK9MyLLbIGWQjZQNTP6lfuIjmPqMrU7YZ5CCm5bS9L+zCtrfIOJaloDb0mf9QBSEDIs4UCd/jou1VI= |
| 64 | +-----END BITCOIN SIGNATURE----- |
| 65 | +``` |
| 66 | + |
| 67 | +### Message verification |
| 68 | +```shell |
| 69 | +Usage bmt verify [-h] [-f | -a ADDRESS -m [MESSAGE ...] -s SIGNATURE] [-e] [-v] [-r] |
| 70 | +Options: |
| 71 | + |
| 72 | + -a string |
| 73 | + ADDRESS bitcoin address |
| 74 | + -e verify electrum-like signature |
| 75 | + -f verify message in RFC2440-like format |
| 76 | + -h show this help message and exit |
| 77 | + -m string |
| 78 | + [MESSAGE ...] message to verify |
| 79 | + -r recover public key |
| 80 | + -s value |
| 81 | + SIGNATURE bitcoin signature in base64 format |
| 82 | + -v show full message |
| 83 | + |
| 84 | +Examples: |
| 85 | + |
| 86 | +Message verification in verbose mode |
| 87 | + |
| 88 | +bmt verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \ |
| 89 | +-m "ECDSA is the most fun I have ever experienced" \ |
| 90 | +-s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \ |
| 91 | +-v |
| 92 | +true |
| 93 | +message verified to be from 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL |
| 94 | + |
| 95 | +Display a recovered public key |
| 96 | + |
| 97 | +bmt verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \ |
| 98 | +-m "ECDSA is the most fun I have ever experienced" \ |
| 99 | +-s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \ |
| 100 | +-r |
| 101 | +true |
| 102 | +024aeaf55040fa16de37303d13ca1dde85f4ca9baa36e2963a27a1c0c1165fe2b1 |
| 103 | + |
| 104 | +Verify message in RFC2440-like format |
| 105 | + |
| 106 | +bmt verify -f -v -r |
| 107 | +Insert message in RFC2440-like format (or Ctrl+C to quit): |
| 108 | +-----BEGIN BITCOIN SIGNED MESSAGE----- |
| 109 | +ECDSA is the most fun I have ever experienced |
| 110 | +-----BEGIN BITCOIN SIGNATURE----- |
| 111 | +16wrm6zJek6REbxbJSLsBHehn3Lj1vo57t |
| 112 | + |
| 113 | +H3x5bM2MpXK9MyLLbIGWQjZQNTP6lfuIjmPqMrU7YZ5CCm5bS9L+zCtrfIOJaloDb0mf9QBSEDIs4UCd/jou1VI= |
| 114 | +-----END BITCOIN SIGNATURE----- |
| 115 | +true |
| 116 | +message verified to be from 16wrm6zJek6REbxbJSLsBHehn3Lj1vo57t |
| 117 | +02700317e20cefbcd8a9e2f294ff2585bc0b8dc981bfe68f72c42497d1b5239988 |
| 118 | +``` |
| 119 | + |
| 120 | +### Wallet creation |
| 121 | +```shell |
| 122 | +Usage bmt create [-h] [-n {1...1000000}] [-path] |
| 123 | +Options: |
| 124 | + |
| 125 | + -h show this help message and exit |
| 126 | + -n value |
| 127 | + number of wallets to create [1...1000000] (default 1) |
| 128 | + -path string |
| 129 | + path to a file to write created wallets (if ommited prints to stdout) |
| 130 | + |
| 131 | +Examples: |
| 132 | + |
| 133 | +Create 100 key pairs with addresses and write to wallets.txt |
| 134 | + |
| 135 | +bmt create -n 100 -path=./wallets.txt |
| 136 | + |
| 137 | +Create a wallet and print to console (you can redirect output to a file) |
| 138 | + |
| 139 | +bmt create -n 1 |
| 140 | +Private Key (Raw): 60180445912902181241548287604652662614241904941006823251259342289760572987478 |
| 141 | +Private Key (WIF): L1gLtHEKG4FbbxQDzth3ksCZ4jTSjRvcU7K2KDeDE368pG8MjkFg |
| 142 | +Public Key (Raw): (x=47540055824935908510461373219072689454917771939693273636263256867956974171064, y=80481361684980169856026167260820025559478707302150175078848962789012628471346) |
| 143 | +Public Key (HEX Copmpressed): 02691ab7d2b2e1b41a8df334a5471a3abd7a93c8822b2abf3de64c552147dc33b8 |
| 144 | +Legacy Address: 1N3kZRUrEioGxXQbSyCWuBwmoFp4T62i93 |
| 145 | +Nested SegWit Address: 3KWsrxLMHPU1v8riptj33zCsWD8bf6jfLF |
| 146 | +Native SegWit Address: bc1qum0at29ayuq2ndk39z4zwf4zdpxv5ker570ape |
| 147 | +``` |
0 commit comments