Core library for Lightning Network peer-to-peer nostr platform

Overview

Mostro server

This document explains how Mostro works.

Overview

Due to the growing need to be able to operate with Bitcoin without giving up personal data, in 2021 I started a project to allows people to buy and sell Bitcoin through Lightning Network without funds custody and without KYC, this project is a telegram bot called @lnp2pbot.

@lnp2pBot is growing steadily and organically, it's being use in the whole world and is having a bigger impact in Latin-America, a place where there is no need to explain to people that money is broken, it's being used more and more in dictatorial regimes like Cuba and Venezuela, where people keep resisting tyranny and protesting using less the local currency and more Bitcoin.

Although the bot works excellent, it's running on top of Telegram, a great platform but we do not know if one day it will be reached by the tentacles of a powerful government asking for political dissidents or simply awkward public person.

At this point Nostr appears as a platform where a system like this can live without the possibility of being censored by a powerful entity. This document explains how we can create a censorship-resistant and non custodial lightning network peer-to-peer exchange without a single point of failure like a telegram bot.

Server

Mostro works with a simple server/client architecture on top of Nostr, the server will be the escrow that will allow buyer and seller operate reducing the risk for both parties.

Mostro server will handle Bitcoin using a Lightning Network node, the node will create the hold invoices for sellers and pay the buyers lightning regular invoices.

Mostro server will need a private key to be able to create, sign and send events to Nostr network.

In the next graphic we can see a very summarized version of how Mostro, the seller and the lightning node interact, a more detailed explanation can be found here:

sequenceDiagram
    autonumber
    Seller->>Mostro: I want to sell Bitcoin
    Mostro-->>LN-Node: Give me a hold invoice
    LN-Node->>Mostro: Hold invoice
    Mostro->>Seller: Please pay this hold invoice
    Seller->>LN-Node: Paying throught lightning
    LN-Node-->>Mostro: Payment received
    Mostro-->>Seller: Thanks! talk to buyer now

In this repository we are building a Mostro server on Rust.

Client

Buyers and sellers will need Mostro's clients in order to buy/sell Bitcoin and a Lightning Wallet, for this we need to build at least a web client to start, we plan to build mobile and desktop clients in the future.

Removing the single point of failure

For this idea to work we need to make it as easy as possible for anyone to be a server, we don't need dozens of servers but we do need the ones that are running to be reliable, that's why with this implementation we encourage to create your own Mostro server and give more options to users.

To handle a Mostro server is not going to be that easy, a Mostro server admin needs to have a lightning node up and running, it will need to have enough liquidity for users to operate lightning fast, the node MUST have uptime closer to 99.9%, all this requires resources that can be obtained by the fee that sellers pay on each successful order, this is a percentage that can vary between servers.

Server reputation

Users will be able to rate servers and servers will compete to obtain more users in order to survive. Bad servers should be rejected by users and will lose incentives to keep existing.

You might also like...
The gRPC library for Rust built on C Core library and futures

gRPC-rs gRPC-rs is a Rust wrapper of gRPC Core. gRPC is a high performance, open source universal RPC framework that puts mobile and HTTP/2 first. Sta

Lightning Optimizing Opening Server

Lightning Optimizing Opening Server (loptoš ~ naughty boy/brat/hooligan/..., not to be confused with lopta == ball) WARNING: ULTRA-EXPERIMENTAL SOFTWA

A Lightning-Fast DNS Resolver written in Rust 🦀
A Lightning-Fast DNS Resolver written in Rust 🦀

dnsresolver A Lightning-Fast DNS Resolver Table of Contents Installation Usage Basic Usage Resolving Hosts with Ports Virtual Host Enumeration Using U

Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

A cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

BitTorrent peer ID registry/parser/(soon) encoder for Rust

BitTorrent peer ID registry/parser/(soon) encoder By convention, BitTorrent clients identify themselves and their versions in peer IDs they send to tr

A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

Lightweight p2p library. Support build robust stable connection on p2p/distributed network.

Chamomile Build a robust stable connection on p2p network features Support build a robust stable connection between two peers on the p2p network. Supp

Fast and easy-to-use event-driven network library.
Fast and easy-to-use event-driven network library.

message-io is a fast and easy-to-use event-driven network library. The library handles the OS socket internally and offers a simple event message API

Comments
  • My two cents on mostro - list order command.

    My two cents on mostro - list order command.

    My two cents ( to start I hope ):

    Added the list offers action, you can request from nostril ( or cli when i work on that ) a command to request a pretty formatted table of a mostro like this: mostro_table

    Mostro will scan from db all orders with requested status from cli and send back a direct message for the user with the table.

    Will work on cli side to create a specific command to make the trick.

    opened by arkanoider 1
  • Basic tasks to have a usable version

    Basic tasks to have a usable version

    • [x] Seller creates a new order
    • [x] Buyer creates a new order
    • [x] Buyer send invoice to take seller's order
    • [ ] Seller takes an order from a buyer
    • [x] Seller receives by DM a hold invoice that he must pay to take an order
    • [x] Subscribe invoices to be aware when a hold invoice is paid
    • [x] After both parties do what they need, mostro send a DM to each party letting them know the pubkey of the counterpart
    • [x] Handle FiatSent message from buyer and send a message to seller to release funds
    • [x] Handle Release message from seller, settle hold invoice and ask them to rate to counterparty
    • [ ] Add CooperativeCancel option, this needs to be for both parties to cancel an order
    • [ ] Delete orders with time greather than now+N seconds
    • [ ] Add fiat price API to orders where users don't add sats amount
    • [ ] Add dispute message and logic
    • [ ] Add lightning address support
    • [ ] Add i18n support
    • [ ] Validations
    • [ ] Add admin options to settle/cancel hold invoices
    opened by grunch 0
Owner
Mostro
Lightning Network peer-to-peer nostr platform
Mostro
The Safe Network Core. API message definitions, routing and nodes, client core api.

safe_network The Safe Network Core. API message definitions, routing and nodes, client core api. License This Safe Network repository is licensed unde

MaidSafe 101 Dec 19, 2022
Peer-to-peer communications library for Rust based on QUIC protocol

qp2p Crate Documentation MaidSafe website SAFE Dev Forum SAFE Network Forum Overview This library provides an API to simplify common tasks when creati

MaidSafe 337 Dec 14, 2022
Painless peer-to-peer WebRTC networking for rust wasm

Matchbox Painless peer-to-peer WebRTC networking for rust wasm applications. The goal of the Matchbox project is to enable udp-like, unordered, unreli

Johan Klokkhammer Helsing 363 Jan 5, 2023
Simple Peer-to-Peer Exchange

Near Cetificate Devoloper - Demo Simple Peer-to-Peer Exchange On NEAR How it works? See how p2p exchange work here. Exploring The Code The contract co

null 3 Dec 20, 2021
IDP2P is a peer-to-peer identity protocol which enables a controller to create, manage and share its own proofs as well as did documents

IDP2P Experimental, inspired by ipfs, did:peer and keri Background See also (related topics): Decentralized Identifiers (DIDs) Verifiable Credentials

null 5 Oct 31, 2022
Easy-to-use wrapper for WebRTC DataChannels peer-to-peer connections written in Rust and compiling to WASM.

Easy-to-use wrapper for WebRTC DataChannels peer-to-peer connections written in Rust and compiling to WASM.

null 58 Dec 11, 2022
Peer-to-peer overlay routing

Rust_Pinecone This is a port of the peer-to-peer overlay routing mechanism Pinecone and aims to be interoperable with it, although it isn't yet becaus

null 3 Aug 2, 2022
Mateversum is a peer-to-peer WebXR metaverse project.

Mateversum ?? Mateversum (pronounced: MAH-tay-ver-sum) is a peer-to-peer WebXR metaverse project. The idea is that you'd be able to connect to a netwo

Ashley 23 Dec 21, 2022
Quick Peer-To-Peer UDP file transfer

qft QFT is a small application for Quick (and really reliable) Peer-To-Peer UDP file transfer. If a friend sent you here... ...look at the "Releases"

Daniel H. 99 Jan 7, 2023
Common Rust Lightning Network types

Common Rust Lightning Network types Warning: while in a good state, this is still considered a preview version! There are some planned changes. This l

Martin Habovštiak 5 Nov 8, 2022