Escrow Bot TFT/BTC

It would be nice to have a bot which can operate as temporary escrow service for BTC/TFT

The idea is that anyone can send TFT to the bot, then someone else sends BTC to the same bot the bot will then release the amount.

  • It should be a safe solution but still easy to use.
  • Its just a piece of code running somewhere on TFGrid in a VM, deployed with smart contract for IT
  • anyone who uses this piece of software, agrees with the limitations & risk, there is no counterpart whatsoever

Ideas

  • a bot which is deployed on TFGrid using smart contract for IT (means people can see how deployed)
  • the bot has 2 wallets TFT Stellar & BTC
  • the person who wants to sell TFT sends TFT to the bot and announces the deal on the forum.threefold.io OTC section, the details of the deal as mentioned in the top part of the post in the format as specified below. The memofield has id of the post (is the nr in the url, this post has id 1717) and the deal ID in format $DEALID:$MATTERMOSTID
  • the person who wants to buy TFT, sends BTC to the bot and specifies the id of the post (is the nr in the url, this post has id 1717) and the deal ID in format $DEALID:$MATTERMOSTID
  • if BTC send to bot are larger than deal size, remainder send back to BTC sender
  • if BTC send to bot is smaller than deal size, it will partially fill, rest stays for someone else
  • if the deal expires, bot will just return the TFT to source
  • if no deal found or mistake in message, TFT or BTC just gets returned to sender
  • once the deal registered the bot can do the transaction
  • the bot has a web page which can be consulted over planetary network will show list of all deals registered, so its easy for people to see what deals are there
  • there can be more than 1 bot deployed, so people can choose which one to use

Requirements

  • Terraform script which deploys such a solution
  • Deployment done by means of Smart Contract of IT
  • the bot will only accept deals which have unique id and, expiration max 2 days, min 10 min
  • the bot will only accept deals which are specified in message on forum.threefold.io in OTC section and which are in main part of the post, also the bot will use the planetary network addr of the forum, which means its end2end encrypted and verified communication between bot & forum, it will be guaranteed the TF forum.
  • the bot will max accept 2m TFT
  • the bot will download the URL and get the data out of the content, if any issue parsing the money will not be accepted (send back)
  • created in vlang & compiled as part of deployment, this way everyone can verify working

format of the message

  • format of the message
  • needs to be embedded in a text or html which can be accessed from internet e.g. can be the post on our forum, can be a github file, can be a website page, …
==============
TFTUSD: 0.1
BTCUSD: 41800
DEADLINE: 10m
DEALID: 8djw6
SELLER_BTC: 1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX
==============

or

==============
BTCTFT: 418000
DEADLINE: 10m
DEALID: 8djw6
SELLER_BTC: 1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX
==============
  • Info
    • price of TFT in USD
    • expiration time in minutes or hours: 10m, 2h
    • dealid which is combination of 5 chars (a…z,0…9)
    • the BTC address of the seller
    • the TFT address of the seller
  • ============== is at least 4, max 30 =
  • there can be whitespace before and in between arguments
  • PARAMS need to be in capital e.g. TFTUSD ok, tftusd not

What would the benefits be of this approach

  • easy & transparent for everyone to exchange TFT for BTC
  • no middleman, its just a piece of code running centrally

Process & Reward

  • suggest 50.000 TFT, to be delivered when code is there & can be verified
  • reply on this post to express interest
  • funds are coming from Threefold Grants, multisig by ThreeFold Foundation Guardians, will be DAO in future.
2 Likes

Stellar has memos, but the closest thing on BTC is an OP_RETURN. Most wallets don’t allow users to add this to a BTC transaction. If this bot has a web interface, a purpose built wallet to attach info to BTC transactions could be included.

Placing the entire offer into the memo would remove the proposed dependency on the forum and probably help with security. There should be a way to format needed info such that it fits in Stellar memo. For BTC, multiple OP_RETURNS can be used.

A bot holding such large funds will be an attractive target for attack. I think any proposal should address security concerns.

3 Likes

a solution could be to create a peer2peer bot which everyone can use, but then it gets more complicated again. People would have to install a local piece of software. Let me sleep over an idea how we can resolve the attack vector, I might have an idea using multi signature wallet from stellar.

By means of the smart contract for IT, we could have e.g. 3 people deploying the bot, independent of each other, use a multi signature wallet for TFT. Which means a hacker would not be able to do anything, would have to hack 3 people.

The BTC wallet is not there, so there is no risk on that level, we only need to secure the TFT side, I think this multisignature can resolve that.

PS about using the forum is actually more safe, because we can use the planetary network and as such we know for sure where the info comes from, and thanks to the network tech its not possible for people to do man in the middle. The memo field in Stellar is too small thats the issue, and otherwise it gets complicated.

3 Likes

modification needed:

  • when buyer sends BTC< they need to also mention their own Stellar Addr otherwise we cannot send it back.
  • memo field: $DEALID:$MATTERMOSTID:$stellaraddr
1 Like

I was wondering… Maybe a combination of offline transactions to keep the coins in user´s wallet until the transaction´s conditions are satisfied and, once it does, the multisig takes care of confirmation between the participants. So the transaction is recorded in Blockchain only when the agreement is fullfiled :thinking:

the best actually would be to make some personal trading bot running on TFGrid, where people send their instructions & the money they want to work with. If we would do a first one XLM to TFT and reverse, that would be ideal. Shouldn’t be too hard to do. Would be cool, will look into it how it could look like. My specs above dont seem to work, BTC has no message field, I didn’t realise that, stupid me, the memo field is only stored in your own wallet, there are ways to do something but it makes it complicated.

With multisignature some things could be done, but issue is at point of money movement an escrow kind of service is still needed.

1 Like

thanks scott, didn’t know about this, indeed found info here

then we would have to create a different kind of wallet, or maybe the bot as described below

1 Like