-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.go
executable file
·58 lines (49 loc) · 1.23 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package bip44
import (
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil/hdkeychain"
)
type Addresses []Address
type Address struct {
Address string
Pubkey string
Privkey string
Index int
}
type Account struct {
Coin string
CoinType int
Key *hdkeychain.ExtendedKey // bip44 extended key (m/44'/cointype'/0')
External *hdkeychain.ExtendedKey // external extended key (m/44'/cointype'/0'/0)
Masterkey *btcec.PrivateKey
Addresses Addresses
PrivateKey string
}
type Wallet struct {
Seed []byte // bip39 64byte (512bits) bip39
Seedwords string // bip39 mnemonic
Accounts []Account // different coin accounts
}
type Altcoin struct {
Name string
PubKeyHashAddrID byte
PrivateKeyID byte
CoinType int
}
type Coin string
const (
Ethereum Coin = "Ethereum"
Energi Coin = "Energi"
Bitcoin Coin = "Bitcoin"
Litecoin Coin = "Litecoin"
Dash Coin = "Dash"
Dogecoin Coin = "Dogecoin"
)
var CoinList = map[Coin]*Altcoin{
Ethereum: {"Ethereum", 0xff, 0xff, 60},
Energi: {"Energi", 0xff, 0xff, 39797},
Bitcoin: {"Bitcoin", 0x00, 0x80, 0},
Litecoin: {"Litecoin", 0x30, 0xb0, 2},
Dash: {"Dash", 0x4c, 0xcc, 5},
Dogecoin: {"Dogecoin", 0x1e, 0x9e, 3},
}