Skip to content

Commit

Permalink
Added example for address from private key
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Sep 30, 2020
1 parent e08b15a commit 868b8f2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/address_from_private_key/address_from_private_key.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"log"

"github.com/bitcoinschema/go-bitcoin"
)

func main() {

// Start with a private key
privateKey, err := bitcoin.CreatePrivateKeyString()
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}

// Get an address
var address string
if address, err = bitcoin.AddressFromPrivateKey(privateKey); err != nil {
log.Fatalf("error occurred: %s", err.Error())
}

// Success!
log.Printf("found addres: %s from private key: %s", address, privateKey)
}

0 comments on commit 868b8f2

Please sign in to comment.