GithubHelp home page GithubHelp logo

nullcount / satbounty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yzernik/squeakroad

0.0 0.0 0.0 1.42 MB

Open source labor market to incentivize and monetize work

License: MIT License

Shell 0.14% Rust 98.23% Makefile 0.03% Dockerfile 0.17% SCSS 1.43%

satbounty's Introduction

SatBounty

An open source labor market to incentivize and monetize work.

Create and claim bounties paid in sats over the lightning network. Vote with sats to raise the reward of other bounties.

How it works

A registered user creates a brief for the project deposits the initial reward upfront. Other users may read the bounty and increase the reward by making deposits of their own. Another user can submit a claim that they completed the bounty. The bounty creator may award any claim they choose. The current bounty reward is given to the claimant (minus market fees).

Why it works

  1. Reputation and Trust

Users build reputation by hunting bounties and creating them. Users also have "bonding sats" held with the market. The bond can only be withdrawn by user deactivation. The amount held in bond can affect the user's percieved trust.

  1. Full Transparency

There is no single reputation score. Rather statistics are displayed for every user that summarize their activity on the platform. Each user makes a judgement whether they feel certain the bounty poster will fairly reward them for work.

  1. Admin Moderation & Market Fees

The admin must approve every bounty before it's published. The admin is responsible for hosting SatBounty and complying with local regulations. The admin is responsible for the custody of funds.

The admin may terminate a user without disbursement of their bond. Or subtract from their bond as punishment.

Market fees are earned each time a bounty is awarded. This fee rewards the admin for providing a safe and secure marketplace.

Ways to break it

  1. Sock Puppets

Users can create duplicate accounts and award themselves a bounty they created. The market fee discorages cheaters. However, it's possible that a bounty reward increases significantly beyond the inital deposit and even after paying market fees, the cheater gains sats.

  1. Unfair Awarding

A user could feel cheated if they did the work but didn't win the award. Maybe someone else got the award, or maybe the bounty poster is unresponsive. Their only recourse is report to the admin who will investigate case-by-case.

  1. Targeted Attacks

Anytime you expose something to the public, you are inviting attacks. When hosting SatBounty, do not use a lightning node connected with your identity or location. For extra protection, serve the website only as a tor or I2P hidden service.

Installation

Requirements

  • an LND node
  • Rust and Cargo
  • openssl apt install libssl-dev
  • gexiv2 apt install libgexiv2-dev
  • compiler dependencies apt install libprotobuf-dev protobuf-compiler cmake

Step 1. Create the configuration

Copy config.example file to config.toml and edit relevant sections to connect to your LND node:

db_url="db.sqlite"
admin_username="admin"
admin_password="pass"
lnd_host="localhost"
lnd_port=10009
lnd_tls_cert_path="~/.lnd/tls.cert"
lnd_macaroon_path="~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"

Step 2. Start satbounty:

cargo run

Go to http://localhost:8000/ and use the username/password in config.toml to log in.

Test

cargo test

Front-end

Satbounty uses SASS/SCSS only. No JavaScript.

Sass is compiled on cargo run using grass

For development, run sass --watch static/scss/style.scss static/css/style.css

Database Migrations

Use sqlx-cli.

cargo install sqlx-cli

cargo sqlx migrate --source db/migrations add <YOUR_MIGRATION_NAME>

Then put your SQL changes in the new file.

cargo sqlx migrate --source db/migrations run

After running migrations, generate the schema for compile-time type-checking:

cargo sqlx prepare --database-url sqlite3://db.sqlite

Optional: create a .env with DATABASE_URL=sqlite3://db.sqlite to avoid passing --database-url

License

Distributed under the MIT License. See LICENSE file.

satbounty's People

Contributors

yzernik avatar nullcount avatar robhodl avatar

satbounty's Issues

Remove images

Satbounty will not ship with the ability to upload images. Remove related crates as well.

Show user reputation metrics in profile

The reputation metrics include:

BOND_LEVEL,
USER_ACTIVATION_TIMESTAMP,
LAST_LOGIN,
BOUNTIES_CLAIMED,
BOUNTIES_AWARDED,
BOUNTIES_ACTIVE,
SATS_WON,
SATS_PAID,
SATS_ESCROW

Non-custodial escrow

Bounty poster generates preimage, sends hash of preimage to market, market creates hold invoice for initial bounty reward, bounty poster pays hold invoice, market sends hash to every case submission, case sumbission creates hold invoice for current reward amount, market pays hold invoice, some case is awarded by bounty creator and given the preimage, awarded case settles invoice with preimage, market settles bounty creation invoice with preimage. In this example there is a risk associated with reuse of the payment hash. Intermediate nodes on both paths may shortcut the preimage and disallow the market from receiving any money.

Max invoice timeout is 2016 blocks (two weeks).

TODO: what happens if invoices expire before a case is awarded?

To submit the bounty, user must deposit the reward to hold in escrow

Currently, the only way to add to one's account balance is by winning a bounty.

Should add a flow to deposit funds to account balance using LN.

  1. In user account settings, add a link to "Deposit Funds".
  2. Similar to prepare_case.rs, the user is presented with an invoice string requesting the arbitrary amount of sats entered by user in field form.
  3. Check for payment of invoice and credit user's account balance for sats deposited.

Similar to stacker news, we will use the user's account balance to pay for fees/rewards.

LNURL-Auth

Implement the lnurl-auth spec as a login/signup option

option to use LN Proxy for invoices

admin setting, add up to three proxy urls to use when generating invoices.
Try each proxy until a successful response received. Present the hodl invoice for payment request to mask market node identity.

cases for active bounties have 1:1 chats

The bounty poster and the case author may chat by posting messages attached to the case.

A case author may not initiate a chat. Only the bounty poster can start a chat.

If bounty is private, enforce PGP encrypted messages

allow paying fees with account balance

before showing an invoice, check if user's balance could pay the required amount. Give user choice to pay with account balance or deposit by paying invoice.

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.