Skip to content

KarpelesLab/zanolib

Repository files navigation

GoDoc Go Report Card Tests

zanolib

Go library for Zano cryptocurrency operations, including address parsing, offline transaction signing, and zero-knowledge proof generation.

Features

  • Address handling — parse, create, and manipulate Zano addresses (standard, integrated, auditable)
  • Offline transaction signing — sign transactions generated by a view-only simplewallet without exposing the spend key to the network
  • Cryptographic primitives — CLSAG-GGX ring signatures, Bulletproof+ range proofs, BGE asset surjection proofs, balance proofs
  • Serialization — full EPEE binary serialization compatible with Zano's C++ implementation

Install

go get github.com/KarpelesLab/zanolib

Offline Signatures

Compatible Zano version: 2.1.0.382

This library allows loading unsigned transactions produced by a view-only simplewallet and signing them offline. There are a few caveats:

  • The unsigned transaction is a binary format not meant to be portable — it only works between specific versions of Zano. This library is tested against the version above and may not work with newer versions. Blob files aren't versioned so structure changes cannot be detected automatically.
  • For now this library only supports ZC→ZC transactions.

Usage

import (
	"crypto/rand"
	"os"

	"github.com/KarpelesLab/zanolib"
)

// Initialize a wallet from a securely stored spend secret.
// Set flags to 1 for auditable wallets.
wallet, err := zanolib.LoadSpendSecret(secret, 0)
if err != nil {
	// handle error
}

// Parse the unsigned transaction produced by simplewallet.
ftp, err := wallet.ParseFTP(unsignedTxBlob)
if err != nil {
	// handle error
}

// Inspect ftp to verify this is the transaction you want to sign.
// ...

// Sign the transaction.
finalized, err := wallet.Sign(rand.Reader, ftp, nil)
if err != nil {
	// handle error
}

// Encrypt and write to disk for broadcast via the view-only wallet.
signed, err := wallet.Encrypt(finalized)
if err != nil {
	// handle error
}
os.WriteFile("zano_tx_signed", signed, 0600)

License

See LICENSE file.

About

Zano offline transaction signature in Go

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors