Giter VIP home page Giter VIP logo

scrypt-interactive's Introduction

Truebit Verification for Scrypt.

Overview

This repo provides a proof-of-concept implementation of the Truebit smart contract system.

It enables a step-by-step running and verification of the Scrypt hashing function on the EVM.

This can form the basis of a Dogecoin/Ethereum relay. Dogecoin uses Scrypt for its Proof-of-Work algorithm, specifically to calculate the block hash. Therefore, an ability to compute Scrypt hashes is required in order to verify the validity of Dogecoin transactions, as it allows one to check Merkle proofs from a known block header. This computation is too large given Ethereum's gas constraints, making it an ideal use case for Truebit.

For more context on how relays work, look at the BTCRelay project.

Protocol Schematic

The client relies on a local Parity instance to execute the ScryptRunner contract and compute state roots. These calls do not write to the blockchain, and conveniently, the Parity client does not trigger a timeout for long-running EVM operations.

The rest of the contracts can be deployed on any chain (currently ganache for local development, Rinkeby for staging, and mainnet for production).

There are 2 actors in the system:

  1. The Claimant:
    • submits doge block headers to the DogeRelay contract.
    • must also defend their block headers in the event of a challenge.
  2. The Verifier:
    • monitors the Truebit contract and challenges incorrect claims.

The address for the contracts as deployed on Rinkeby are in the .env file.

Running the client

The client software is open-source and available in this repo.

Follow these directions to setup the client.

Use the CLI tool to interact with the client:

# check the status
npm start status

# manage your deposits
npm start deposit <amount_in_ether>
npm start withdraw <amount_in_ether>

# monitor the system as a Verifier.
# note: you must have the required amount of eth deposited to stake per claim you want to challenge;
# otherwise, it won't be able to do anything but watch.
npm start monitor --auto-challenge

# submit a claim as a Claimant.
# note: you must defend your claim (scrypt hash and plaintext payload) against challenges. 
# note: you must have the required amount of eth deposited to stake.
npm start claim <input> <hash> <proposalId>

You can see all commands available with npm start -- --help.

Running the tests

First, install the needed dependencies as described in the setup docs.

Running the tests involves:

  1. Running ganache npm run ganache
  2. Running parity npm run parity
  3. Running the tests npm run test

We also have a convenient test.sh script that does all that for you.

./bin/test.sh

Deploying the contracts

To deploy the contracts to your favorite chain:

# first:
# update the .env file.

# then
npm run migrate:rinkeby  # or target another chain.

# then
# update the resulting contract addresses in .env

scrypt-interactive's People

Contributors

hswick avatar sinahab avatar scnale avatar shrugs avatar chriseth avatar terminaldweller avatar mrsmkl avatar cat-j avatar

Stargazers

 avatar null data avatar  avatar  avatar

Watchers

Ismael Bejarano avatar James Cloos avatar Oscar Guindzberg avatar  avatar  avatar  avatar  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.