Skip to content
/ bitcoin Public
forked from njones/bitcoin

Golang (go) library for manipulating bitcoin (BTC) addresses

Notifications You must be signed in to change notification settings

hacash/bitcoin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin

Library for manipulating bitcoin addresses

Usage

Generate a btc private/public key pair

import btcpk "github.com/steakknife/bitcoin/addr/private"

pk := btcpk.MustGenerate()

fmt.Printf("BTC Private key address (wallet format): %s", pk)
fmt.Printf("BTC                  Public key address: %s", pk.PublicKey())

Parse a btc public key address

import btcpub "github.com/steakknife/bitcoin/addr/public"

pubKey := btcpub.MustDecode("19Bq1gipWrLxFGqVH41Un2suWnGzWxNjbZ")

fmt.Printf("BTC public key: %s\n", pubKey)
fmt.Printf("  network: %s (%d, 0x%02X)\n", pubKey.Network, int(pubKey.Network), int(pubKey.Network))
fmt.Printf("  address: %v\n", pubKey.Address)

Parse a btc private key address in wallet format

import btcpk "github.com/steakknife/bitcoin/addr/private"

privKey := btcpk.MustDecode("5Ju6hf57BPdusMDUg4C6gPKiauXSahHVnTGmTNHoJeGUwJHeqSY")

fmt.Printf("BTC private key: %s\n", privKey)
fmt.Printf("    network: %s (%d, 0x%02X)\n", privKey.Network, int(privKey.Network), int(privKey.Network))
fmt.Printf("   exponent: %v\n", privKey.Exponent())
fmt.Printf(" public key: %s\n", privKey.PublicKey())
fmt.Printf("              X: %v\n", privKey.XBytes())
fmt.Printf("              Y: %v\n", privKey.YBytes())

Testing

Run test cases

make

Run test cases and benchmarks

make GOTESTOPT='-bench=.'

License

MIT

Copyright

Copyright (C) 2013-2015 Barry Allard

About

Golang (go) library for manipulating bitcoin (BTC) addresses

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%