Labyrinth
WhitepaperResearchGet Private Access
  • 🔭Labyrinth Overview
    • Introduction
    • Why Labyrinth?
    • Who can use Labyrinth?
    • Reward and Fee in Labyrinth
    • Compliance
  • ⭐Use Labyrinth web App
    • How to use the Labyrinth app?
  • 📦Labyrinth SDK
    • ❓What is Labyrinth SDK?
    • ⚒️Quickstart
      • Setup Environment
      • Initialization
      • Private Transactions
      • Balance And Transaction History
      • Protocol Integration
    • 1️⃣Getting Started
    • 🔐Shielded Account
    • 📈Transaction
    • ▶️Initializing SDK
    • 💰Balances And History
    • 📤Sending Transaction
    • 🔌Integrating with DeFi Protocols
    • Labyrinth fee structure
  • Compliance Solution
    • Overview of Compliance
    • How Compliance Works
  • 💻CLI
    • ▶️Running SeDe CLI
  • Technical Implementation
    • Cryptographic Primitives
    • Shielded Account
    • Shielded Address
    • Account Abstraction
    • 🔵Core Architecture
      • 💵Note
      • 🌲Merkle Tree
      • 🔀JoinSplits
      • 🛡️Shielded Transaction
    • 🔄Protocol Interoperability
  • Resource and support
    • Roadmap
    • FAQs
    • Whitepaper
    • Selective De-Anonymization Compliance Paper
  • Contact and socials
    • Labyrinth Website
    • Twitter
    • Discord
    • Contact Us
Powered by GitBook
On this page
  • Installation
  • Installing SnarkJs
  1. Labyrinth SDK
  2. Quickstart

Setup Environment

The SDK is written in TypeScript and is available in the form of a set of npm packages. It is available to use within both Node and browser environments.

Installation

Make sure you have Node (>v18) and npm installed on your machine. Then install the SDK packages by adding the following node modules to your package.json file:

dependencies": {
    "@zkfi-tech/account": "^1.0.3",
    "@zkfi-tech/babyjubjub": "^1.0.2",
    "@zkfi-tech/core": "^1.3.5",
    "@zkfi-tech/shared-types": "^1.0.0",
    "@zkfi-tech/transaction": "^1.3.5",
    "@zkfi-tech/utils": "^1.0.2",
    "@zkfi-tech/zk-prover": "^1.1.3",
    "fixed-merkle-tree": "^0.7.3"
}
# pnpm
pnpm install

# yarn
yarn install

# npm
npm install

Installing SnarkJs

Node

For node, you can install snarkjs simply as an npm package and make it a globally available variable:

# pnpm
pnpm add snarkjs

# yarn
yarn add snarkjs

# npm 
npm i snarkjs

Set as global variable:

import * as snarkjs from 'snarkjs';

globalThis.snarkjs = snarkjs;

Browser

<script src="/<path-to-snarkjs>/snarkjs.min.js"></script>

Including this script automatically makes snarkjs a globally available variable. Make sure this variable is available before you invoke transaction proof generation.

Alright, setup done!

PreviousQuickstartNextInitialization

Last updated 10 months ago

The SDK depends on the package for ZK proof generation. You need to install it separately from the SDK, depending on the environment you are working in:

For the browser, you need to include it as a JS script. You can get the minified script from the official snarkjs repo . After downloading and including the script in your project, put a script tag in your HTML:

📦
⚒️
snarkjs
here