mina-signer-experimental
mina-signer-experimental
npm i mina-signer-experimental
Deprecated!
Package no longer supported. Please use the official mina-signer package
mina-signer-experimental

mina-signer-experimental

Mina is a new cryptocurrency with a constant size blockchain, improving scaling while maintaining decentralization and security.

by MinaProtocol

1.3.0 (see all)License:Apache-2.0TypeScript:Built-In
npm i mina-signer-experimental
Readme

Mina Signer Experimental

This is purly an experimental build, please use this with care. Please see the offical mina-signer package first.

This is a Browser/NodeJS SDK that allows you to sign strings, payments, and delegations using Mina's key pairs for various specified networks.

Install

yarn add mina-signer-experimental
# or with npm:
npm install --save mina-signer-experimental

Usage

import Client from "mina-signer-experimental";
const client = new Client({ network: "mainnet" });

// Generate keys
let keypair = client.genKeys();

// Sign and verify message
let signed = client.signMessage("hello", keypair);
if (client.verifyMessage(signed)) {
  console.log("Message was verified successfully");
}

// Sign and verify a payment
let signedPayment = client.signPayment(
  {
    to: keypair.publicKey,
    from: keypair.publicKey,
    amount: 1,
    fee: 1,
    nonce: 0,
  },
  keypair.privateKey
);
if (client.verifyPayment(signedPayment)) {
  console.log("Payment was verified successfully");
}

// Sign and verify a stake delegation
const signedDelegation = client.signStakeDelegation(
  {
    to: keypair.publicKey,
    from: keypair.publicKey,
    fee: "1",
    nonce: "0",
  },
  keypair.privateKey
);
if (client.verifyStakeDelegation(signedDelegation)) {
  console.log("Delegation was verified successfully");
}
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate