Skip to content

A Web3-powered decentralized code snippet hub on Starknet, enabling secure storage, sharing, and real-time collaboration with Web3 authentication and voice chat.

License

Notifications You must be signed in to change notification settings

Haroldwonder/Snipu

Β 
Β 

Repository files navigation

Snipu - Bitcoin Script VM in Cairo

Revolutionizing Code Sharing in Web3 with Blockchain-Powered Collaboration Snipu Logo

BUILD CAIRO REACT

EXPLORATION TEAM TELEGRAM

Overview

Snipu is an innovative Bitcoin Script Virtual Machine implemented in Cairo, designed to bring Bitcoin's scripting capabilities to Layer 2 solutions. This project enables developers to execute and verify Bitcoin scripts within the Cairo environment, facilitating advanced interoperability between Bitcoin and other blockchain platforms.

Website Workflow

The Snipu platform offers a streamlined experience for developers looking to work with Bitcoin scripts in Cairo:

  1. Home Page: Users are greeted with an overview of Snipu's capabilities and key features.

  2. Script Editor:

    • Write custom Bitcoin scripts directly in the browser
    • Access a library of template scripts for common use cases
    • Syntax highlighting and error checking in real-time
  3. Compiler Interface:

    • Compile Bitcoin scripts into Cairo-compatible format
    • View detailed compilation logs and debugging information
    • Export compiled scripts for integration with other projects
  4. Testing Environment:

    • Execute compiled scripts in a sandboxed environment
    • Provide custom inputs and witness data for script execution
    • View execution results and stack states
  5. Documentation Center:

    • Access comprehensive guides on using Snipu
    • Reference materials for Bitcoin Script opcodes and their Cairo implementations
    • Step-by-step tutorials for common development scenarios
  6. Community Hub:

    • Connect with other developers using Snipu
    • Share custom scripts and implementations
    • Discuss best practices and technical challenges

Features

Core VM Implementation

  • Full implementation of Bitcoin Script opcodes in Cairo
  • Stack-based execution environment matching Bitcoin's processing model
  • Accurate handling of Bitcoin's execution constraints and edge cases

Script Compilation

  • Bitcoin Script to Cairo transpilation with optimization
  • Support for both legacy and SegWit script formats
  • Preservation of script semantics across languages

Verification Tools

  • Zero-knowledge proof generation for script execution
  • On-chain verification of Bitcoin script execution on Layer 2
  • Cryptographic linking between Bitcoin and Cairo execution environments

Developer Tools

  • Comprehensive API for integrating Snipu into existing applications
  • CLI tools for batch processing and automation
  • Detailed execution logs for debugging complex scripts

Interoperability Features

  • Cross-chain messaging capabilities using Bitcoin scripts
  • Bitcoin transaction verification on Layer 2 platforms
  • Bridge mechanisms for Bitcoin-based assets

Security Components

  • Formal verification of core VM components
  • Comprehensive test suite covering edge cases
  • Security audit-ready architecture

Technologies Used

Core Technologies

  • Cairo Language (v1.0.0): Zero-knowledge friendly programming language for VM implementation
  • Bitcoin Script: Native Bitcoin scripting language supported by the VM
  • React (v18.2.0): Frontend framework for the web interface
  • TypeScript (v4.9.5): Type-safe language for frontend development
  • Node.js (v16.20.0): Runtime environment for development tools

Backend Stack

  • Rust (v1.70.0): Performance-critical components and optimization
  • Scarb (v0.7.0): Cairo package manager
  • StarkNet (v0.13.0): Layer 2 integration for on-chain verification

Frontend Libraries

  • Redux (v8.1.0): State management for the application
  • Material UI (v5.13.0): Component library for consistent UI
  • Monaco Editor (v0.40.0): Code editor for script writing
  • Web3.js (v1.10.0): Blockchain interaction library
  • D3.js (v7.8.5): Data visualization for script execution

Development Tools

  • Docker (v24.0.5): Containerization for consistent development and deployment
  • GitHub Actions: CI/CD pipeline for automated testing and deployment
  • Jest (v29.5.0): Testing framework for frontend components
  • Starknet.js (v5.14.1): Client library for StarkNet integration
  • ESLint (v8.40.0): Code quality and style enforcement

Security Tools

  • Slither: Smart contract static analyzer
  • Cairo-Test: Cairo-specific testing framework
  • OpenZeppelin Contracts: Secure, reusable smart contract components

Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • Rust (v1.70 or higher)
  • Starknet wallet (ArgentX or Braavos)
  • Yarn/NPM/PNPM/Bun

Installation

  1. Clone the repository:
git clone https://github.com/SudiptaPaul-31/Snipu.git
cd Snipu

## πŸš€ Getting Started

1. Clone the repository:
```bash
git clone https://github.com/yourusername/snipu.git
  1. Install dependencies :
npm install
# or
yarn
# or
pnpm install
# or
bun install
  1. Running locally:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Setup Guidelines

Setting up the Project

This guide provides instructions for setting up and running the project on your local machine

Make sure you have the following prerequisites installed on your system:

  • npm

Setting Up the Project

  1. Clone the repository:

    git clone https://github.com/SudiptaPaul-31/Snipu.git
    cd snipu
  2. Install dependencies:

    npm install
  3. Create and switch into you own branch:

    git branch <your-branch>
    git checkout <your-branch>

Running the Entire Project

To run the entire project, including both smart contracts and the frontend:

  1. Build commands:
    npm run dev

The frontend should now be running at http://localhost:3000

Notes for Contributors

  • Follow our contributor's guide given here.
  • Make sure to follow the respective commands for working on either the smart contracts or the frontend.
  • Ensure the code is properly building, passing tests and formatted using npm run check at the root directory before making a pull request.

Contribution Guidelines

Thank you for your interest in contributing to this project! Please read the following rules carefully before applying to work on an issue.

Application Process

When applying to work on an issue:

  1. Provide a brief background about yourself.
  2. Explain how you plan to approach the issue.
  3. Share your estimated time of arrival (ETA) for completing the task.

Deadlines and Communication

  • If you cannot complete the task within your ETA + 1 day, you must inform me on Telegram (@SoarinSkySagar). Failure to do so will result in you being unassigned from the issue.
  • Contributors can reach out for help regarding the project anytime via:
    • My Telegram: @Sudipta_31
    • Project Telegram: Snipu
    • Our project's Telegram group.

Workflow Requirements

  1. Work on a Separate Branch

    • Always create a new branch for your work and submit your pull requests (PRs) from there.
  2. Run Checks Before Submitting a PR

    • Make sure to run the following command in the root directory:
      npm run check
    • Ensure there are no errors before submitting your PR.
  3. PR Validation

    • If any checks fail on your PR, you must fix them before it can be merged.
    • The only exception is Vercel deployments, which require my authorization.

Project Setup

Refer to the SETUP.md file in the same directory for detailed instructions on setting up the project.

By following these guidelines, you help ensure a smooth contribution process for everyone involved. Thank you for contributing!

Contributors

SudiptaPaul-31
SudiptaPaul-31

32 commits
anneyomeje
anneyomeje

2 commits
Davidemulo
Davidemulo

2 commits
emarc99
emarc99

1 commits
Pheenah
Pheenah

1 commits
sergejparity
sergejparity

1 commits
Shashwat-Nautiyal
Shashwat-Nautiyal

1 commits
viktrified
viktrified

1 commits
Patrick-Ehimen
Patrick-Ehimen

1 commits
yashtech00
yashtech00

1 commits

About

A Web3-powered decentralized code snippet hub on Starknet, enabling secure storage, sharing, and real-time collaboration with Web3 authentication and voice chat.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.3%
  • JavaScript 2.6%
  • CSS 1.1%