Skip to content

Commit 657a4a9

Browse files
committed
# update readme
1 parent 2c15098 commit 657a4a9

File tree

2 files changed

+106
-3
lines changed

2 files changed

+106
-3
lines changed

README.md

+105-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,105 @@
1-
# hardwallet
2-
Hyperpay hardwallet
1+
# Hyperpay Wallet HardWallet
2+
3+
HardWallet is committed to build a straightforward and easy-to-use library.
4+
The open source framework displays all functions and methods related to the hardware wallet. Contains related mnemonics, private keys, addresses and related signed transactions.
5+
And use a ble middleware to simulate the relevant data compression and transmission under Bluetooth communication.
6+
7+
## Environment Setup
8+
9+
- [Go Installation](https://golang.org/doc/install)
10+
- About the missing librarys, use `go get xxx ..` to install them
11+
- `git clone https://github.com/hyperpayorg/hardwallet`
12+
- `cd hardwallet`
13+
14+
## How to use
15+
16+
For ease of use and understanding, some tests that can be tested directly are written.
17+
This can help to quickly understand the relationship between the various components.
18+
19+
20+
## Generate wallet
21+
Private key, public key and address can be generated by `GenerateMnWallet` func.
22+
Language supports: `english``korean``chinese_simplified` ,etc.
23+
Mnemonics supports: `12 words``24 words`,etc.
24+
Password supported.
25+
```go
26+
ceateAccount := &clientwallet.CreateAccount{
27+
Language: "english",
28+
Length: 12,
29+
Password: "123456",
30+
}
31+
fmt.Println(ceateAccount)
32+
isCreated := clientwallet.GenerateMnWallet(ceateAccount)
33+
fmt.Println(isCreated)
34+
```
35+
## Wallet SignRawTransation
36+
SignRawTransation can be generated by `func SignRawTransaction(signIn *SignInput)` func.
37+
38+
```go
39+
signIn := &clientwallet.SignInput{
40+
Coin: "btc",
41+
Symbol: "btc",
42+
Amount: 10000,
43+
Change: 25000000 - 10000 - 10000,
44+
Fee: 10000,
45+
SrcAddr: "",
46+
DestAddr: "",
47+
Net: "testnet",
48+
Password: "123456",
49+
Inputs: jsonInputs,
50+
}
51+
52+
signResult := clientwallet.SignRawTransaction(signIn)
53+
fmt.Println(signResult)
54+
```
55+
Data structure returned as follow:
56+
```go
57+
type WalletAccount struct {
58+
ResCode int // 0 fail 1 Success
59+
Address string
60+
PublicKey string
61+
PrivateKey string
62+
Seed string // root seed
63+
Coin string
64+
ErrMsg string // fail messages
65+
ErrCode int // err code
66+
Params []byte // reserved fields
67+
}
68+
```
69+
70+
71+
### Wallet EnKeystore
72+
73+
Key information storage supports pwd & udid.
74+
```go
75+
Key := "L1oh9KNH4XpJgqDodxhjPgaEVS1qwXToWvPf2Zyn6bcm7xxxxxxx"
76+
pwd := "11111"
77+
udid := "AOIJF-QWEQR-VDFBET-YTAWWE"
78+
79+
// Encode
80+
enResult := EnKeystore(Key, pwd, udid)
81+
fmt.Println("Keystore : \n", enResult.Result)
82+
```
83+
## Wallet KeyStore File Decrypt
84+
The keystore file is decrypted using the KeyStore json, udid and the password.
85+
86+
To decrypt keystore file, use the following methods:
87+
88+
89+
```go
90+
func DeKeystore(json, password, udid string)
91+
```
92+
93+
> Description: JSON is the KeyStore JSON file
94+
95+
Data structure returned as `KeystoreResult`。
96+
97+
### Wallet DeKeystore
98+
```go
99+
enResult := "xxxxxxx"
100+
pwd := "11111"
101+
udid := "AOIJF-QWEQR-VDFBET-YTAWWE"
102+
// Decode
103+
deResult := DeKeystore(enResult, pwd, udid)
104+
fmt.Println("PrivateKey : ", deResult.Result)
105+
```

hardwallet/keystore.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"crypto":{"cipher":"aes-128-ctr","ciphertext":"8f8476cbb56804cc1206914bd57ffa672294af41d0f733b92da23f9421ccdd4664373c499aba08288cba196576ed56f4fa244ab856f2625ca0c0cc87b31c9a230a15ca66bb2ccd832eb98b26c66c0b654fd54f23","cipherparams":{"iv":"efd62f81823404dee688f83a754af23d"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":2048,"p":1,"r":8,"salt":"a7ad843aa20dafecfdafc0e053d13deef77b65c6641123fbab30278ed9ba4b51"},"mac":"55069d20f67c0825c91810695b950bd210f75a163112f840b7fd665e1418e3d1"},"version":3}
1+
{"crypto":{"cipher":"aes-128-ctr","ciphertext":"2478f8b32c6c54ffe4ee8f03d66c7e5994ff5da93a950d168bcb2a606beeac05a5b926d0eafff8e7746a26bb198b2784e315b884deba33f7e9dfd25aa738a5fd3c5dad4ac23e2852aeb575bcb8b337","cipherparams":{"iv":"16a18732a4e3686dac90794c2bf26387"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":2048,"p":1,"r":8,"salt":"9af9a31c12cbedc6b80c0c5abe66afa80a6c7f4ff7c51a71d6f0d4d75a2cd02b"},"mac":"a5acd7c3c061d6f2fe001c316744ece490b1d45a5a4117e3658f57e587359754"},"version":3}

0 commit comments

Comments
 (0)