github.com/Blockdaemon/celo-blockchain@v0.0.0-20200129231733-e667f6b08419/crypto/bls/bls_test.go (about)

     1  package blscrypto
     2  
     3  import (
     4  	"encoding/hex"
     5  	"testing"
     6  
     7  	"github.com/celo-org/bls-zexe/go"
     8  	"github.com/ethereum/go-ethereum/crypto"
     9  )
    10  
    11  func TestECDSAToBLS(t *testing.T) {
    12  	privateKeyECDSA, _ := crypto.HexToECDSA("4f837096cd8578c1f14c9644692c444bbb61426297ff9e8a78a1e7242f541fb3")
    13  	privateKeyBLSBytes, _ := ECDSAToBLS(privateKeyECDSA)
    14  	t.Logf("private key: %x", privateKeyBLSBytes)
    15  	privateKeyBLS, _ := bls.DeserializePrivateKey(privateKeyBLSBytes)
    16  	publicKeyBLS, _ := privateKeyBLS.ToPublic()
    17  	publicKeyBLSBytes, _ := publicKeyBLS.Serialize()
    18  	t.Logf("public key: %x", publicKeyBLSBytes)
    19  
    20  	address, _ := hex.DecodeString("4f837096cd8578c1f14c9644692c444bbb614262")
    21  	pop, _ := privateKeyBLS.SignPoP(address)
    22  	popBytes, _ := pop.Serialize()
    23  	t.Logf("pop: %x", popBytes)
    24  }