Skip to content

Commit 1bd7df9

Browse files
author
shadowy-pycoder
committed
updated doctests
1 parent d21a6d8 commit 1bd7df9

File tree

1 file changed

+104
-104
lines changed

1 file changed

+104
-104
lines changed

README.md

Lines changed: 104 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -17,159 +17,159 @@ To install with pip, run:
1717
Quickstart Guide
1818
----------------
1919

20-
Usage:
20+
Usage:
2121

22-
python bmt.py -h
23-
usage: python3 bmt.py [-h] {sign,verify} ...
22+
python bmt.py -h
23+
usage: python3 bmt.py [-h] {sign,verify} ...
2424

25-
Bitcoin message signing/verification tool
25+
Bitcoin message signing/verification tool
2626

27-
positional arguments:
28-
{sign,verify}
27+
positional arguments:
28+
{sign,verify}
2929

30-
options:
31-
-h, --help show this help message and exit
30+
options:
31+
-h, --help show this help message and exit
3232

33-
Message signing
33+
Message signing
3434

35-
python bmt.py sign -h
36-
usage: python3 bmt.py sign [-h] -p -a {p2pkh,p2wpkh-p2sh,p2wpkh} -m [MESSAGE ...] [-d] [-v]
35+
python bmt.py sign -h
36+
usage: python3 bmt.py sign [-h] -p -a {p2pkh,p2wpkh-p2sh,p2wpkh} -m [MESSAGE ...] [-d] [-v]
3737

38-
options:
39-
-h, --help show this help message and exit
38+
options:
39+
-h, --help show this help message and exit
4040

41-
Sign messsage:
42-
-p, --privkey private key in wallet import format (WIF)
43-
-a {p2pkh,p2wpkh-p2sh,p2wpkh}, --addr_type {p2pkh,p2wpkh-p2sh,p2wpkh}
44-
type of bitcoin address
45-
-m [MESSAGE ...], --message [MESSAGE ...]
46-
Message to sign
47-
-d, --deterministic sign deterministtically (RFC6979)
48-
-v, --verbose print prettified message
41+
Sign messsage:
42+
-p, --privkey private key in wallet import format (WIF)
43+
-a {p2pkh,p2wpkh-p2sh,p2wpkh}, --addr_type {p2pkh,p2wpkh-p2sh,p2wpkh}
44+
type of bitcoin address
45+
-m [MESSAGE ...], --message [MESSAGE ...]
46+
Message to sign
47+
-d, --deterministic sign deterministtically (RFC6979)
48+
-v, --verbose print prettified message
4949

50-
Example 1:
51-
Non-deterministic signature for compressed private key and p2pkh address
50+
Example 1:
51+
Non-deterministic signature for compressed private key and p2pkh address
5252

53-
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced
53+
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced
5454

55-
PrivateKey(WIF): <insert private key here>
55+
PrivateKey(WIF): <insert private key here>
5656

57-
Output:
57+
Output:
5858

59-
Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
60-
Message: ECDSA is the most fun I have ever experienced
61-
Signature: IBuc5GXSJCr6m7KevsBAoCiX8ToOjW2CDZMr6PCEbiHwQJ237LZTj/REbDHI1/yelY6uBWEWXiOWoGnajlgvO/A=
59+
Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
60+
Message: ECDSA is the most fun I have ever experienced
61+
Signature: IBuc5GXSJCr6m7KevsBAoCiX8ToOjW2CDZMr6PCEbiHwQJ237LZTj/REbDHI1/yelY6uBWEWXiOWoGnajlgvO/A=
6262

63-
Example 2:
64-
Deterministic signature for compressed private key and p2pkh address
63+
Example 2:
64+
Deterministic signature for compressed private key and p2pkh address
6565

66-
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d
66+
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d
6767

68-
PrivateKey(WIF): <insert private key here>
68+
PrivateKey(WIF): <insert private key here>
6969

70-
Output:
70+
Output:
7171

72-
Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
73-
Message: ECDSA is the most fun I have ever experienced
74-
Signature: HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
72+
Bitcoin address: 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
73+
Message: ECDSA is the most fun I have ever experienced
74+
Signature: HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
7575

76-
Example 3:
77-
Deterministic signature for compressed private key and p2pkh address (verbose mode)
76+
Example 3:
77+
Deterministic signature for compressed private key and p2pkh address (verbose mode)
7878

79-
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d -v
79+
$python bmt.py sign -p -a p2pkh -m ECDSA is the most fun I have ever experienced -d -v
8080

81-
PrivateKey(WIF): <insert private key here>
81+
PrivateKey(WIF): <insert private key here>
8282

83-
Output:
83+
Output:
8484

85-
-----BEGIN BITCOIN SIGNED MESSAGE-----
86-
ECDSA is the most fun I have ever experienced
87-
-----BEGIN BITCOIN SIGNATURE-----
88-
175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
85+
-----BEGIN BITCOIN SIGNED MESSAGE-----
86+
ECDSA is the most fun I have ever experienced
87+
-----BEGIN BITCOIN SIGNATURE-----
88+
175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
8989

90-
HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
91-
-----END BITCOIN SIGNATURE-----
90+
HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
91+
-----END BITCOIN SIGNATURE-----
9292

93-
Example 4:
94-
Uncompressed private keys can't produce addresses other than 'p2pkh'
93+
Example 4:
94+
Uncompressed private keys can't produce addresses other than 'p2pkh'
9595

96-
python bmt.py sign -p -m ECDSA is the most fun I have ever experienced -a 'p2wpkh' -d -v
96+
python bmt.py sign -p -m ECDSA is the most fun I have ever experienced -a 'p2wpkh' -d -v
9797

98-
PrivateKey(WIF): <insert private key here>
98+
PrivateKey(WIF): <insert private key here>
9999

100-
Output:
100+
Output:
101101

102-
Traceback (most recent call last):
103-
...
104-
PrivateKeyError: ('Need WIF-compressed private key for this address type:', 'p2wpkh')
102+
Traceback (most recent call last):
103+
...
104+
PrivateKeyError: ('Need WIF-compressed private key for this address type:', 'p2wpkh')
105105

106-
Message verification
106+
Message verification
107107

108-
python bmt.py verify -h
109-
usage: python3 bmt.py verify [-h] -a ADDRESS -m [MESSAGE ...] -s SIGNATURE [-v] [-r]
108+
python bmt.py verify -h
109+
usage: python3 bmt.py verify [-h] -a ADDRESS -m [MESSAGE ...] -s SIGNATURE [-v] [-r]
110110

111-
options:
112-
-h, --help show this help message and exit
111+
options:
112+
-h, --help show this help message and exit
113113

114-
Verify messsage:
115-
-a ADDRESS, --address ADDRESS
116-
specify bitcoin address
117-
-m [MESSAGE ...], --message [MESSAGE ...]
118-
Message to verify
119-
-s SIGNATURE, --signature SIGNATURE
120-
bitcoin signature in base64 format
121-
-v, --verbose print full message
122-
-r, --recpub recover public key
114+
Verify messsage:
115+
-a ADDRESS, --address ADDRESS
116+
specify bitcoin address
117+
-m [MESSAGE ...], --message [MESSAGE ...]
118+
Message to verify
119+
-s SIGNATURE, --signature SIGNATURE
120+
bitcoin signature in base64 format
121+
-v, --verbose print full message
122+
-r, --recpub recover public key
123123

124-
Example 1:
125-
Standard message verification
124+
Example 1:
125+
Standard message verification
126126

127-
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
128-
> -m ECDSA is the most fun I have ever experienced \
129-
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
127+
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
128+
> -m ECDSA is the most fun I have ever experienced \
129+
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs=
130130

131-
Output:
131+
Output:
132132

133-
True
133+
True
134134

135-
Example 2:
136-
Message verification in verbose mode
135+
Example 2:
136+
Message verification in verbose mode
137137

138-
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
139-
> -m ECDSA is the most fun I have ever experienced \
140-
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
141-
> -v
138+
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
139+
> -m ECDSA is the most fun I have ever experienced \
140+
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
141+
> -v
142142

143-
Output:
143+
Output:
144144

145-
True
146-
Message verified to be from 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
145+
True
146+
Message verified to be from 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL
147147

148-
Example 3:
149-
Display a recovered public key
148+
Example 3:
149+
Display a recovered public key
150150

151-
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
152-
> -m ECDSA is the most fun I have ever experienced \
153-
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
154-
> --recpub
151+
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
152+
> -m ECDSA is the most fun I have ever experienced \
153+
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLapfa43JjyrRqdSA0pxs= \
154+
> --recpub
155155

156-
Output:
156+
Output:
157157

158-
True
159-
024aeaf55040fa16de37303d13ca1dde85f4ca9baa36e2963a27a1c0c1165fe2b1
158+
True
159+
024aeaf55040fa16de37303d13ca1dde85f4ca9baa36e2963a27a1c0c1165fe2b1
160160

161-
Example 4:
162-
Error message
161+
Example 4:
162+
Error message
163163

164-
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
165-
> -m ECDSA is the most fun I have ever experienced \
166-
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLaffa43Jj= -v -r \
164+
python bmt.py verify -a 175A5YsPUdM71mnNCC3i8faxxYJgBonjWL \
165+
> -m ECDSA is the most fun I have ever experienced \
166+
> -s HyiLDcQQ1p2bKmyqM0e5oIBQtKSZds4kJQ+VbZWpr0kYA6Qkam2MlUeTr+lm1teUGHuLaffa43Jj= -v -r \
167167

168-
Output:
168+
Output:
169169

170-
Traceback (most recent call last):
171-
...
172-
SignatureError: ('Signature must be 65 bytes long:', 57)
170+
Traceback (most recent call last):
171+
...
172+
SignatureError: ('Signature must be 65 bytes long:', 57)
173173

174174
Contribute
175175
----------

0 commit comments

Comments
 (0)