-
Notifications
You must be signed in to change notification settings - Fork 5
/
doc.go
50 lines (39 loc) · 1.05 KB
/
doc.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
// Copyright rockx.com
// All rights reserved
/*
This package aims to enhance online staking service procedure
with safe usage of master key to derive child keys
package main
import (
"crypto/rand"
"fmt"
"io"
"github.com/RockX-SG/eth2deposit"
"github.com/awnumar/memguard"
)
func main() {
// Safely terminate in case of an interrupt signal
memguard.CatchInterrupt()
// Purge the session when we return
defer memguard.Purge()
var seed [32]byte
io.ReadFull(rand.Reader, seed[:])
// create master key and dervie 100th child key
masterKey := eth2deposit.NewMasterKey(seed)
lockedBuffer, err := masterKey.DeriveChild(100)
if err != nil {
panic(err)
}
// create a deposit credential
cred, err := eth2deposit.NewCredential(lockedBuffer, 0, nil, eth2deposit.MainnetSetting)
if err != nil {
panic(err)
}
bts, err := cred.MarshalText()
if err != nil {
panic(err)
}
fmt.Println(string(bts))
}
*/
package eth2deposit