Contest: Atomic Swaps on Free TON [31 August 2020 - 20 September 2020]

Guys, @SergeyD, @pavlovdog, @roman.nguyen, @nailkhaf great works! :+1: :+1: :+1:

The only drawback, as it seems to me, is that there is little originality in this competition, everyone went the same way and uses HTLC. Perhaps the next competition will be for the implementation of Bitcoin SPV, as mentioned in the link above :grinning:. I have just worked out in this direction, the code turns out to be really more complex.

Tell me, is any of the works production-ready?
Personally, I make my own just so that I can use it myself later. If there are ready-made ones, I would use them for exchanges. And if not, what are the plans to bring the contest works to working condition?

4 Likes

@creator Thank you!

Is it possible to verify Ethereum’s Merkle tree with keccak256 and check ethash PoW in TON VM?
Or verify TON Ed25519 signature in Ethereum VM?
HTLC require only the presence of a sha256, which is found in many blockchains. In this sense it is much more versatile.

I can only say for our project. It is not production-ready, it will take several months to complete.
Improvement is required not only in the part of the UI, but also a number of problems need to be solved, for example, the possibility of loss of funds, which I wrote about in an article on Medium (only in Russian)
https://medium.com/@sergey.dobkin8/атомарные-свопы-в-free-ton-9701dbdf1bdc

2 Likes

idk, to my shame. That’s why I didn’t plan to integrate with Ethereum at first. In any case, this would be too expensive for SPV due to more frequent transactions. So for a combined BTC-ETH contest, the HTLC seems the only right solution, agree.

2 Likes

@SergeyD @pavlovdog @roman.nguyen
Hello colleagues. One of the tough conditions for implementation was this:

Tell me, which of you added this functionality to your solution?
Please do not be angry if I was inconsiderate and did not see this in your submission. Just answer. Thank.

My second question is how long will it take for you to get a stable solution into production?

2 Likes

It is a pity that you did such a great job, but did not submit an official submission for the contest. Sorry, your forum post is not a submission. (

@bitjudge, Hello!

One of the tough conditions for implementation was this:

Tell me, which of you added this functionality to your solution?
Please do not be angry if I was inconsiderate and did not see this in your submission. Just answer. Thank.

Here I see some lack of specifics in the assignment. Who is a broker? The presence of the owner person, in the sense that he is the only one organizing the exchange, makes the solution partially centralized, and the owner - the main point of failure. This means that the service cannot be highly reliable. The arrest and shutdown of some centralized mixers and exchanges is a clear confirmation of this.

Therefore, we designed our solution with decentralization in mind. There is no “owner” here, only the “creator”. Which deploys a TON Orderbook smart contract and that’s it. He does not incur any operating costs and does not receive any fees. In our solution, the broker is a smart contract. It collects a constant fee when depositing (see the receive () function in tonorderbook.sol) to cover the smc storage fee (it is also constant).

This is the same approach as in uniswap and other contract-based exchanges. And it is very reliable.

Of course, we could make it possible to collect fees for the creator. However, it doesn’t make any sense. Since all sources are distributed under a free license, anyone can deploy the same smart contract except that it does not charge a fee. And users will prefer it.
If Satoshi charged his own fee in every Bitcoin transaction, how quickly would the fork appear without it?

My second question is how long will it take for you to get a stable solution into production?

approx. 3-5 months.
The most difficult tasks that need to be implemented for a production-ready solution are the ability to complete the last part of the transaction by a third party and the ability to buy crystals by a person who does not have them.

4 Likes

@pavlovdog @roman.nguyen
Will you answer the questions I asked above?

1 Like

Hello!

Yes, this feature is implemented. On the TON / Ethereum contracts you can see the contract parameters

  • Platform address
  • Fee amount

The platform address is the address of the “organizer of the trade”. In the case of a successful withdraw call, the (amount - fee amount) will be sent to the target address and the rest of the funds will be sent to the platform address.

To add the broker reward in case of Bitcoin, all you need is to implement the additional output on the withdraw transaction, which sends the reward to the broker Bitcoin address.

2 Likes

Good afternoon, thank you for being involved in the process. We are so sorry for late response.

Answering the first question about the broker’s commission, I would like to say about a number of points.

To begin with, I note that the main idea of ​​creating a service was open distribution and maximum decentralization. We deliberately did not add exchange features to contracts such as order books or ratings, simply because the technology itself requires the absence of any third parties, minimizing the cost of interacting with contracts and transparency in execution. The technology does not imply additional functions such as finding a deal partner and so on, and in our case, all the staff to help users find deal partners is carried out on the side of the final service. In general, the implementation of contracts directly is aimed at ensuring that everyone can create their own services with their own functions, features, etc. Isn’t that what decentralization is all about? From our point of view, ideologically, any extra features in addition to the main technology are implemented and lie on the shoulders of those who will implement it into their ready-made products.

If we deviate a little from our ideology and hit slightly into the technique, there are the following points:

  1. Atomic swap, as I already said, is a technology that does not imply third parties. The very architecture of the technology contradicts the charging of any additional payment in addition to transaction fees and a certain number of tokens to support the execution of the contract.

  2. From a technological point of view, the implementation of such a commission in the “when you take - pay the commission” format is extremely difficult to implement, if at all realizable, within the BTC framework. If we cannot make a polymorphic model for all currencies, it turns out that someone must always pay. Or you need to look for some other ways, the specification of which is a separate task. In fact, in any case, a person buying BTC will have additional profit relative to his opponent, since the exchange of TON in BTC can only pay to the broker with TON, and the exchange of TON - ETH can be paid by both parties.

  3. Commissions of networks are already high enough. If you look a little into the future, paying additional commissions will force people to either make a fork or simply not use the service at all, since an atomic swap without a broker’s commission is often more expensive than a regular centralized exchange exchange, where there are practically no commissions for transfers other than brokerage. Plus, the translation of the broker fee itself is also an expense that someone should incur.

On the other hand, the implementation of this requirement is literally 4-5 lines of code for each of the networks which support fee stuff, provided that a clear criterion of functionality is defined, for example

  1. at what moment the money is sent to the broker’s account

  2. who pays the commission for this transfer

  3. whether a commission is charged if the transaction did not take place

etc.

In any case, the architecture and implementation of our solution more than allows us to realize the broker’s commission. The question is solely about necessity, ideology and usability.

Answering the question about the production-ready solution. We are still working on the service, at the moment the design mentioned in the presentation is being implemented, automated tests are being added, and so on. The bottleneck, in our understanding, of any financial technology is security, therefore it is important to conduct a correct audit of contracts and their mandatory formal verification, which will take the most time. We estimate the work before the stable release as 2-3 months of work. We plan to carry out the first tests in combat networks not earlier than in 2-3 weeks.

3 Likes

Nail, could you please explain what happened? Why you weren’t able to push your proposal? Could you please elaborate.

1 Like

Hello, @Mitja @bitjudge

I discussed it in telegram chats.
https://t.me/freetondevru/45474.
https://t.me/tondefi/403

There was mistake with time period. At the forum submission period is 31 August 2020 - 20 September 2020. For me it means time period 3 weeks, 21 days. It was clearly for me that finish at the end of Sunday… But at Sunday I saw that contest’s contract already moved to the next stage and I couldn’t submit my proposal, because the end was 1 day before, at Saturday. So I publish work only at the forum, because I did it for FreeTon.

4 Likes

От имени своей команды хочу высказаться по поводу ситуации с @nailkhaf.

Я сам лично чуть не наступил на эти грабли – планировал подавать заявку 20-го числа. И спасла только паранойя «так конкурс до 20-го включительно или нет?». Если как минимум 2 человека ошиблись, это, вероятно, не случайность. Но я здесь не для поиска виновных.

Ознакомившись с работой @nailkhaf, могу сказать, что он в одиночку сделал довольно много. Вклад в общее дело внесён существенный, и этот вклад не может остаться без благодарности сообщества.

В связи с этим, наша команда единогласно поддержала идею направить 5% от выигрыша на компенсацию трудозатрат @nailkhaf. Если так поступят и остальные участники конкурса, наберётся на награду 4-го места. Надеюсь, они поддержат эту идею.

Я категорически не согласен с позицией – «это блокчейн, здесь строгие правила, терпите и привыкайте». Блокчейн запишет то, что мы туда запишем, и только от нас зависит, будет это безразличие или человечность.

9 Likes

From the Broxus team, I would like to officially support this initiative. Thank you @SergeyD for proposing.

7 Likes

@SergeyD @cryonyx

Thank you for your support! It’s valuable for me :slightly_smiling_face:

5 Likes

Hello Sergey,
I’m sorry for bothering you but I noticed that probably you missed the next part of the contest description:

It would be nice if you can fix this before others notice.
Thank you!

1 Like

Since this contest only had 3 submissions, the way to distribute rewards is to simply eliminate prizes 4 - 10 and distribute just the 1st 3 prizes to winners. That would normally be the case; however, in this instance, winners 1 and 2 are tied for 1st place, both with a score of 8.25. As a result. 1st and second prize should be added and divided by 2 to create an average amount of 150k tokens per winner. 3rd place is still 50k.

1 Like

Hey!

In my opinion we should do something with this (Jury's Codex Proposal). Current situation looks unfair and unclear! We should investigate it!

Hi, Nail!
I can’t find your wallet address in your submission.
Please post it here.

Hi, @SergeyD @cryonyx

I added wallet address to my profile. Thank You again for your supporting. I think this is a contribution to humanity and I will act accordingly in the future :handshake:

0:5aa1043ace33d38038ff3f288aa03e541acb7acd1f776320db9d5d02e708d7e7

2 Likes

happy weekend :smiley:

2 Likes