Skip to content

🍵 schnorr signatures over ristretto255 in pure go

License

Notifications You must be signed in to change notification settings

longcpp/go-schnorrkel

This branch is 3 commits ahead of, 31 commits behind ChainSafe/go-schnorrkel:master.

Folders and files

NameName
Last commit message
Last commit date
Oct 28, 2019
Dec 24, 2019
Apr 14, 2020
Apr 14, 2020
Apr 14, 2020
Jan 12, 2020
Apr 14, 2020
Dec 17, 2019
Dec 17, 2019
Jan 2, 2020
Jan 2, 2020
Apr 14, 2020
Dec 30, 2019
Nov 19, 2019
Apr 5, 2020
Apr 5, 2020
Jan 15, 2020
Jan 15, 2020

Repository files navigation

go-schnorrkel

Go implementation of the sr25519 signature algorithm (schnorr over ristretto25519). The existing rust implementation is here.

This library is currently able to create sr25519 keys, import sr25519 keys, and sign and verify messages. It is interoperable with the rust implementation.

The BIP39 implementation in this library is compatible with the rust substrate-bip39 implementation. Note that this is not a standard bip39 implementation.

dependencies

go 1.13

usage

Example: key generation, signing, and verification

package main 

import (
	"fmt"
	
	schnorrkel "github.com/ChainSafe/go-schnorrkel"
)

func main() {
	msg := []byte("hello friends")
	signingCtx := []byte("example")

	signingTranscript := schnorrkel.NewSigningContext(signingCtx, msg)
	verifyTranscript := schnorrkel.NewSigningContext(signingCtx, msg)

	priv, pub, err := schnorrkel.GenerateKeypair()
	if err != nil {
		fmt.Println(err)
		return
	}

	sig, err := priv.Sign(signingTranscript)
	if err != nil {
		fmt.Println(err)
		return
	}

	ok := pub.Verify(sig, verifyTranscript)
	if !ok {
		fmt.Println("did not verify :(")
		return
	}
}

About

🍵 schnorr signatures over ristretto255 in pure go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%