mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
20 lines
577 B
Go
20 lines
577 B
Go
package main
|
|
|
|
import (
|
|
"github.com/daglabs/btcd/btcec"
|
|
"github.com/daglabs/btcd/util"
|
|
"github.com/daglabs/btcd/util/base58"
|
|
)
|
|
|
|
func decodeKeys(cfg *config) (*btcec.PrivateKey, *util.AddressPubKeyHash, error) {
|
|
privateKeyBytes := base58.Decode(cfg.PrivateKey)
|
|
privateKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), privateKeyBytes)
|
|
serializedPrivateKey := privateKey.PubKey().SerializeCompressed()
|
|
|
|
addr, err := util.NewAddressPubKeyHashFromPublicKey(serializedPrivateKey, activeNetParams.Prefix)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return privateKey, addr, nil
|
|
}
|