Hello I have a desire to write in the result of the code file:
package main
import (
"fmt"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/base58"
)
func main() {
// Print header
fmt.Printf("%64s %34s %49s", "Private", "Public", "decoded")
// Initialise big numbers with small numbers
count, one := big.NewInt(0), big.NewInt(10000)
// Create a slice to pad our count to 32 bytes
padded := make([]byte, 32)
// Loop forever because we're never going to hit the end anyway
for {
// Increment our counter
count.Add(count, one)
// Copy count value's bytes to padded slice
copy(padded[32-len(count.Bytes()):], count.Bytes())
// Get public key
_, public := btcec.PrivKeyFromBytes(btcec.S256(), padded)
// Get compressed and uncompressed addresses
caddr, _ := btcutil.NewAddressPubKey(public.SerializeCompressed(),
&chaincfg.MainNetParams)
decoded, version, err := base58.CheckDecode(caddr.EncodeAddress())
if err != nil {
fmt.Println(err)
return
}
// Print keys
fmt.Printf("%x %34s %49s", padded, caddr.EncodeAddress(),
big.NewInt(0).SetBytes(decoded))
fmt.Println("", version)
}
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.