OSDN Git Service

d3649438df90be392cd27e7d631c7152d723018e
[bytom/pybtm.git] / README.md
1 pybtm
2 ======
3
4 - [1 Installation](#1-installation)
5 - [2 Usage](#2-usage)
6   - [2.1 Create entropy](#21-create-entropy)
7   - [2.2 Create mnemonics](#22-create-mnemonics)
8   - [2.3 Create seed](#23-create-seed)
9   - [2.4 Create root expanded private key](#24-create-root-expanded-private-key)
10   - [2.5 Create expanded public key](#25-create-expanded-public-key)
11
12 Python3 implementation of the Bytom protocol.
13
14 ## 1 Installation
15
16 ```
17 $ pip install pybtm
18 ```
19
20 ## 2 Usage
21
22 ### 2.1 Create entropy
23
24 get_entropy() create 128 bits entropy.
25
26 ```python
27 >>> from pybtm import key
28 >>> key.get_entropy()
29 '100e2704b431f914e3262926bdba6fce'
30 ```
31
32 ### 2.2 Create mnemonics
33
34 get_mnemonic create 12 new mnemonics.
35
36 ```python
37 >>> key.get_mnemonic('089fe9bf0cac76760bc4b131d938669e')
38 'ancient young hurt bone shuffle deposit congress normal crack six boost despair'
39 ```
40
41 If no paramater is specified, it will return 12 new random mnemonics.
42
43 ```python
44 >>> from pybtm import key
45 >>> key.get_mnemonic()
46 'nothing gate perfect glide wink lizard journey negative load quote wrong reason'
47 ```
48
49 ### 2.3 Create seed
50
51 get_seed create 512 bits seed from 12 mnemonics.
52
53 ```python
54 >>> from pybtm import key
55 >>> key.get_seed('ancient young hurt bone shuffle deposit congress normal crack six boost despair')
56 'afa3a86bbec2f40bb32833fc6324593824c4fc7821ed32eac1f762b5893e56745f66a6c6f2588b3d627680aa4e0e50efd25065097b3daa8c6a19d606838fe7d4'
57 ```
58
59 ### 2.4 Create root expanded private key
60
61 get_root_xprv create root expanded private key.
62
63 ```python
64 >>> from pybtm import key
65 >>> key.get_root_xprv('afa3a86bbec2f40bb32833fc6324593824c4fc7821ed32eac1f762b5893e56745f66a6c6f2588b3d627680aa4e0e50efd25065097b3daa8c6a19d606838fe7d4')
66 '302a25c7c0a68a83fa043f594a2db8b44bc871fced553a8a33144b31bc7fb84887c9e75915bb6ba3fd0b9f94a60b7a5897ab9db6a48f888c2559132dba9152b0'
67 ```
68
69 ### 2.5 Create expanded public key
70
71 get_xpub create expanded public key.
72
73 ```python
74 >>> from pybtm import key
75 >>> key.get_xpub('c003f4bcccf9ad6f05ad2c84fa5ff98430eb8e73de5de232bc29334c7d074759d513bc370335cac51d77f0be5dfe84de024cfee562530b4d873b5f5e2ff4f57c')
76 '1b0541a7664cee929edb54d9ef21996b90546918a920a77e1cd6015d97c56563d513bc370335cac51d77f0be5dfe84de024cfee562530b4d873b5f5e2ff4f57c'
77 ```