Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Breadman authored Nov 13, 2017
1 parent e612830 commit d3d5235
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ package main
import (
"fmt"
"github.com/golangdaddy/multichain-client/address"
"github.com/golangdaddy/multichain-client/params"
)
const (
Expand All @@ -67,6 +68,19 @@ const (
func main() {
// you need to refer to your params.dat file to get the needed config parameters
cfg, err := params.Open("./multichain-cold/params.dat")
if err != nil {
panic(err)
}
// The address package handles the encoding of keys, so it needs to be configued.
address.Configure(&address.Config{
PrivateKeyVersion: cfg.String("private-key-version"),
AddressPubkeyhashVersion: cfg.String("address-pubkeyhash-version"),
AddressChecksumValue: cfg.String("address-checksum-value"),
})
seed := []byte("seed")
keyChildIndex := 0
Expand All @@ -75,15 +89,23 @@ func main() {
if err != nil {
panic(err)
}
fmt.Println(keyPair)
fmt.Println(keyPair)
}
```

If you have an existing private key, you can export it's MultiChain address from the public key with the MultiChainAddress function.
If you have an existing private key, you can export it as WIF (Wallet Import Format) which can be used with importprivkey API command with MultiChain.

```
wif, err := address.MultiChainWIF(privKeyBytes)
```

...or it's MultiChain address from the public key with the MultiChainAddress function.

```
addr, err := address.MultiChainAddress(pubKeyBytes)
addr, err := address.MultiChainAddress(pubKeyBytes)
```

0 comments on commit d3d5235

Please sign in to comment.