Coder Social home page Coder Social logo

hack-a-chain-software / tickets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opact-protocol/tickets

0.0 0.0 0.0 139.13 MB

Home Page: monorepo-puce-two.vercel.app

License: MIT License

Shell 0.02% JavaScript 5.84% C++ 4.52% Assembly 27.33% Rust 29.67% TypeScript 26.44% CSS 0.14% Makefile 0.07% HTML 0.08% Solidity 3.71% Circom 2.19%

tickets's Introduction

Opact Tickets

Opact Tickets is a compliant anonymous transactions tool, that utilizes ZK (Zero-knowledge proof) technology.

The main feature is allowing the mixing of transactions using NEAR or any NEP-141 token only for well inteded users. The system integrates with data providors to block wallets suspicious of money laundering and smart contract hacking.

This works by leveaging hapi.one protocol as a data partner which is responsible for allowlisting and denylisting accounts.

How mixing works

TBD

Compliance scheme

The compliance scheme works with wallet risk scores.

When a user first deposits to HYC they have to call the allowlist method, which queries hapi.one to check for risk score. If it is above the threshold the user is automatically blocked from depositing. This means that the protocol has already identified the user as being in connection with criminal activities.

However, it is always possible that a user performs a hack / scam / is laudering money and has not yet been flagged by hapi.one. In this cases the user will be able to deposit funds without issue.

Here it is necessary to leverage the most innovative technology of the protocol. For mixed transactions to become untraceable, it is necessary that the user waits a determined amount of time (actually wait for a high number of other users to deposit and withdraw) before withdrawing the funds to a new wallet. The bigger the volume being moved, the more time the user has to wait.

We implemented a method called denylist, which can be called by anyone to perform a new security score check on any existing account. If the score of the account is found to be above the threshold, any funds that have been deposited by that account cannot be withdrawn anymore.

This means that, even if a malicious user is fast enough to deposit the tokens to HYC before being flagged, while the tokens are being mixed in the protocol, the malicious user runs the risk of being denylisted and losing access to all funds. Essentially a malicious user would have 3 choices:

  1. Deposit the funds before being flagged and withdraw really quickly, to avoid getting denylisted -> in this case the anonymity provided by HYC is not enough to stop fund tracking agencies from tracing the token flow;
  2. Deposit the funds before being flagged and wait the appropriate time to withdraw -> in this case, the user can be flagged at any moment by automated or human agents and lose all the funds;
  3. Not using HYC -> since case (1) does not provide benefits to the malicious user and case (2) is high risk, game theoretical equilibrium is for malicious user to avoid HYC

Tech

Installation

Opact Tickets requires Node.js, yarn, rust, circom and the rust wasm toolchain. It is recommended that you follow near sdk tutorial to install rust and wasm.

After installing all the tools, you can run the command:

yarn

And install all the dependencies

Circuits

To be able to reproduce tests, deployment and frontend, it is necessary to first compile all zero-knowledge circuits using:

yarn circuits circuit:setup:plonk

Smart Contracts

Build

To build the contracts run:

yarn contracts build:contract

To run tests on smart contracts run:

yarn contracts test:rust
yarn contracts test:lib

To deploy sample testnet app run:

yarn seed:testnet

This will print all relevant addresses generated so that you can set them as environment variables for other apps.

Subgraph

Subgraph is an indexer using The Graph technology to allow queries on HYC's historical data.

To setup, you must edit packages/subgraph/subgraph.yaml to include the addresses to all HYC core contracts and set the network version (mainnet or testnet).

After that you can deploy the subgraph to The Graph's hosted service using this tutorial.

The graphql link generated for the subgraph must them be set as an environment variable for both frotend and relayer.

Relayer

TBD

Front

To run frontend locally, simply set environment variables described in packages/front and run:

yarn front dev

CI

CI is set to perform all tests and deploy frontend to vercel. Sample deployments are done on PRs and production deployments are done on merges to main.

To change environment variables used in CI deployments alter the following files: PRs: .github/workflows/CI.yml production: .github/workflows/vercel_deploy.yml

tickets's People

Contributors

1mateus avatar alexandrearaujoo avatar veigajoao avatar p-destri avatar eduardogbg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.