Skip to content

Commit

Permalink
feat(core/btc): support export wif priKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkirito committed Apr 15, 2024
1 parent 2835c18 commit 59c707e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/btc/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,11 @@ func PublicKeyTransform(pubkey string, compress bool) (string, error) {
return types.HexEncodeToString(btcPubkey.PubKey().SerializeUncompressed()), nil
}
}

func PrivateKeyToWIF(pri *btcec.PrivateKey, network *chaincfg.Params) (string, error) {
wif, err := btcutil.NewWIF(pri, network, true)
if err != nil {
return "", err
}
return wif.String(), nil
}

0 comments on commit 59c707e

Please sign in to comment.