Post
Topic
Board Development & Technical Discussion
Re: generating public key from private key on the command line
by
piotr_n
on 26/05/2016, 09:11:30 UTC
Try this:

Code:
package main

import (
"fmt"
"encoding/hex"
"github.com/piotrnar/gocoin/lib/btc"
)

const PRV_KEY_HEX = "AB9EA551E262A87A13BB90591BE7B545CDF3FD0E1234567890ABCDEF12345678"
const COMPRESSED = false

func main() {
private_key, _ := hex.DecodeString(PRV_KEY_HEX)
fmt.Println(hex.EncodeToString(btc.PublicFromPrivate(private_key, COMPRESSED)))
}


You will just need to fetch gocoin package first (having go and git installed):
Code:
go get -d github.com/piotrnar/gocoin