GithubHelp home page GithubHelp logo

robertohuertasm / prime-product-pallet Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.22 MB

⛓️🧰 Substrate pallet to find a * b = N, given N and knowing that a and b are prime integers

License: The Unlicense

Rust 96.41% Shell 1.13% Nix 2.46%

prime-product-pallet's Introduction

Prime Product Pallet

Custom Substrate pallet which would help users to solve a particular problem.

The problem

With the equation

N = a * b

for a given uint N, find a and b, knowing both a and b are prime integers

Example:

Problem: N = 6

Solution: a = 2, b = 3

  • Any user can submit new problem and set a non-zero reward for a solution.

  • Any user can submit solution candidate for yet unsolved problem, and if correct, receive 80% of the problem's reward.

  • The rest 20% of the reward stays in pallet's "treasury pool".

The following data should be stored on-chain:

  • unsolved and solved problems,
  • correct solutions.

Node Template

The source code of the pallet can be found here.

If you want to run the whole Substrate node, you can use the following command:

# to build the node
cargo build --release
# to run it
./target/release/node-template --dev

If you want to learn more about it, you can read the the node's README or the node's documentation.

How to use it

You can use the Substrate front-end template to get started with the node and the pallet.

First, in this case, Alice submits a new problem for N = 9 and offers a reward of 1_000_000_000.

alice-submit-problem

Then Bob submits a solution candidate for N = 9 and, as it is correct, it gets the 80% of the reward of 800_000_000. You can check it in the events table.

bob-submit-solution

The 20% of each reward stays in the treasury pool, 200_000_000.

bob-pot-info

prime-product-pallet's People

Contributors

robertohuertasm avatar

Watchers

 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.