lnp2pbot / bot Goto Github PK
View Code? Open in Web Editor NEWPeer-to-peer lightning network telegram bot
License: MIT License
Peer-to-peer lightning network telegram bot
License: MIT License
ESP/ENG to messages
A command to select lang
If the seller does not confirm the operation that received the fiat in certain amount of time (ORDER_EXPIRATION_WINDOW
), the bot cancels the hold-invoice and closes the order, before the time expires the buyer will be notified by the bot that the seller is not responding and the buyer can start a dispute.
Add a new env var ORDER_EXPIRATION_WINDOW
, and a script that will be run by a cronjob.
/release command always must show a response to seller even if the payment to the buyer failed
cuando el bot hace un pago de una invoice, guardar el routing fee en bd
revisar cuando el usuario crea/toma ordenes si su username es el mismo al guardado en bd
User enter: /help
Response:
/start
/sell <monto_en_sats> <monto_en_fiat> <codigo_fiat> <método_de_pago>
/buy <monto_en_sats> <monto_en_fiat> <codigo_fiat> <método_de_pago> <lightning_invoice>
/cancel <order_id> -- cancel an order
/dispute <order_id> -- start a dispute
/release <order_id> -- release satoshis
For more information on each command type /help <command>.
setinvoice command should check if there is a pending payment record for that order on pending_payments collection with paid=false and then update that buyer payment request field
Create a button linked to the operation, that when a user clicks it it will begin the takesell/takebuy operation upon that order
cuando cancelas una orden con cooperative, que en el mensaje de confirmacion te diga "has recibido un reembolso lightning, no es necesario hacer nada mas", no es evidente que rechaza el pago en esos casos
whe user commands buy/sell they will enter a scene to fill the parameters necesary for the order
In order to have clear messages to the users the bot should say the exact fiat amount and fiat currency on the message to the buyer when the buyer must send the fiat money to the seller
We need a way of show a better user reputation, this reputation is displayed when a user A creates a new order, and helps user B to know how A is using the bot.
The current reputation
only shows how many successful trades did user A.
The new reputation should be a new index from 1 to 5, calculated using the successful trades and volume in sats.
If users A and B traded successfully they will have a positive impact on the index but if the next trades between themselves will add less positive points to the index.
Things to have in consideration, currently a user can create an order and the same user can take that order, we need to eliminate this option
Vendedor crea una order, cambiar este mensaje que recibe cuando alguien la toma
"Por favor paga esta factura para comenzar la venta, esta factura expira en 10 minutos"
por
"Alguien quiere comprarte sats por fiat amount Fiat code, Por favor paga esta factura para comenzar la venta, esta factura expira en 10 minutos"
We are receiving request from users to create channels by country, we can do that easily but probably in the future we will receive request for channels by cities, or comunities and so on, instead of create new channels in a centralize way, I think a better idea is to allow users to create their own channels without asking permission.
The idea is, if a user is admin of the group A, that user can link that group to channel B, when the bot receive new orders sent from the group A the bot will publish them to the channel B.
for each FIAT code, create a dedicated channel and publish the operation in its respective channel
Trade 611eeea65a192872bb657f07 was not completed after seller released the sats. The bot sent me this message:
El vendedor ha liberado los satoshis pero no he podido pagar tu invoice, en unos minutos intentaré pagarla nuevamente, asegúrate que tu nodo/wallet esté online
This should not be the default behavior
Some commands receive a order id as parameter, for example /release <order_id>
, in order have a better UX we need to change those commands to work without the param if the user have only one active order.
If the user have more than one order that can be released, the response from the bot should be show the orders (type, id, sats amount, fiat amount, fiat code) and ask which is the one the user needs to release.
Do the same with commands /fiatsent
, /cancel
, /dispute
, /cancel
,
Buyers add invoices to receive sats, the should use amountless invoices
It's needs to show only orders related to the user executing the command
We need to add a new env var MAX_DISPUTES
to .env file with the max number of disputes to ban users and also code the logic for banning users with many diputes.
After x hours an order has been processed, remove the order from the public channel in order to maintain a clean channel of active orders
This jobs should send a message to the channel admin when try to pay an invoice, failed or success
We use this status to know when a buyer is about to add an invoice, if the user don't do it in a period of Time the order will expire.
Also a user with this status can't take any other order.
The bot supports all fiat currencies but we only have a limited number of fiat currencies with we know the current price using an external API, we should let know to users which are those currencies.
The fiat data is on /util/fiat.json and the ones that have price: true
are the ones we can work with the price, por example, when the user create an order with 0 amount on sats.
After a user creates a new order and before another user take it, the user can cancel the order, but in some cases users can agree on cancel the order, it shouldn't be unilateral.
Add a command /cooperativecancel
to cancel cooperatively, only if both execute this command the order is canceled and the seller sats are returned.
If users have a disagreement on canceling or going forward the can open a dispute.
Currently a user can create an order and the same user can take that order, we need to eliminate this option
Some wallets generate invoices with an expiration time of 60 minutes, to avoid working with expired invoices when buying we should stop asking for an invoice when the user create the buy order and only ask for an invoice when the order is taken by a seller
Also we need to set the order expiration time (after buyer took it, status=WAITING_PAYMENT) to be the same to the buyer invoice expiration minus 10 minutes, to do this in an easy way we can set an expiration time when create the hold invoice and cancel the order on jobs/cancel_orders.js
a /ban command for admins only to manually ban a user
A seller that didn't release funds to the buyer can't open or take another order from the bot.
nombrar el username del comprador en el mensaje cuando El comprador hacer fiatsent
We need to calculate the average time between for buyer/seller
We need to show this number when the bot publishes the order and when other user take it
Buyer response time:
Time from when the order becomes ACTIVE (when the bot puts them in touch) until the buyer does the /fiatsent (status FIAT_SENT)
Seller response time:
Time from buyer executes /fiatsent
to seller executes /release
(status PAID_HOLD_INVOICE)
The workflow should be dynamic, for this we can use have the same time that we use for invoice expirations, for this we use the env var HOLD_INVOICE_EXPIRATION_WINDOW
.
Currently when a user creates an order he needs to indicate the sats amount and the fiat amount, this order is published on a channel, the problem come when an order is not taken instantly and the bitcoin price goes up or down, the order creator needs to manually cancel it and create a new one with the corrected price.
We can allow users to create an order just with the fiat amount and let the bot calculate the BTC price using an API
I propose to use the api from this site which have the free market fiat currencies rate.
Example:
VES: https://api.yadio.io/rate/VES
ARS: https://api.yadio.io/rate/ARS
MXN: https://api.yadio.io/rate/MXN
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.