What is Atomic Swap?

Our readers often ask us what exactly is Atomic Swap, and how does it guarantee a secured transaction.

Let us look into the technology in more detail.

In Crypto, the term “Atomic” was adopted from databases, where there is a number of database operations that either occur altogether or do not occur at all (or are brought back to their initial condition, if one of the operations is interrupted, or if something else goes wrong).

These operations are named Atomic Transactions.

Atomicity is one of the four characteristics of “ACID” transactions, with the remaining three being: Consistency; Isolation; Durability. All of these characteristics are necessary, in order to perform a transaction within the database.

The word Swap speaks for itself. It is the exchange of one cryptocurrency for another. By bringing these two meanings together, we get the following definition of an Atomic Swap – a series of operations with two blockchain systems, that lead to a successful exchange of two cryptocurrencies. If one of the conditions of the transaction is not met, the swap is not confirmed, excluding a situation where only one of the two participants receives their cryptocurrency.

The principals of the atomic swap are used in a variety of decentralized exchange technologies. For example, in all sorts for onchain DEXax ( idex, waves, etherdelta, bitshares) and Cross-Chain exchanges (komodo, hodlhodl, swap.online). In the near future we expect to see them be used in PCN (Payment Channel Networks), for instance – Lightning Network.

All of these technologies used differently and have various levels of decentralization. Nevertheless, they all solve the problem of creating a balance between decentralization and speed. The usage of atomic swaps is becoming more popular among Cross Chain exchanges based on HTLC technologies (Hash Time Lock Contract).

As you already know, Hash – is a one-way encryption, with a determined result. This means that for any given secret you will always get the same encrypted line that is difficult to reconstruct (if being precise – very-very hard to reconstruct).

HTLC is a smart contract for an agreed amount of cryptocurrency. The amount can only be sent to a predetermined wallet(address – account) after providing the secret to the hash junction within the given time frame. When creating a contract, you only know the hash function of the secret, keeping the secret itself unavailable to the public. By creating symmetric HTCL on two different block-chains, you get a simplified Atomic Swap mechanism.

Alice creates a smart contract on the Bitcoin blockchain, stating Bob’s address as the beneficiary. Bob creates the same exact contract, but only on the Ethereum blockchain, mentioning Alice’s address as the beneficiary. Both contracts use the same Hash function, but only one of the two parties knows the Hash functions secret.

atomic swap how it works

There is no difference who knows the secret, as long as the party that does know it creates a contract with a more extended time frame.

Here is how the HTLC works. Both of the contracts are symmetric, and the first party to receive their crypto-currency is the one that holds the secret. For example, Alice is the holder of the secret. She provides the Secret to Bob’s smart contract on the Ethereum BlockChain. Once the smart contract receives the secret, it calculates its hash function, and if it matches the hash function in the smart contract, Alice will receive here Ethereum, that will be sent to her wallet.

As we know, all the operations in the blockchain are seen by the public, so when Alice reveals the secret – Bob will immediately receive it. Given that Alice’s Bitcoin Blockchain contract holds the exact same hash function when Bob provides it with the secret he automatically received his Bitcoins to his wallet.

If for some reason Alice does not reveal the secret, Bob will get his Ethereum back after his smart contract’s time frame runs out. In addition, if Alice provides an incorrect secret, the calculation will not match the hash function of Bob’s smart contract, not allowing the transfer of the funds.

atomic swap cryptocurrency

It’s that simple.

You can find more details on HTLC on the internet with different examples of how there are used.

Every Atomic Swap goes through two stages.

The first stage – “Order Matching”. Reaching an agreement between two participants of the Swap. To be precise, this important stage has to be done before the atomic swap. How this stage is accomplished defines projects from one another. There are different “handshake” protocols that can be used, for example, some use centralized services or sidechains, others use decentralized order-books.

Swap.online in its initial protocol version uses ipfs pubsub – a fully decentralized protocol for sending messages. Each order that a Market Maker places is distributed through the message channels that the Market Takers are subscribed to. As if announcing through a loudspeaker they are willing to exchange, for example, 10 of their Bitcoins for 100 of your Ethereums.

The Market Takers will see all the new orders after subscribing to the message channels. In order to view the Market Makers order constantly – he or she should always send out messages about its relevance, meaning the Market Maker should always be online in order to confirm an exchange.

Nevertheless, this does not bring any operational inconvenience. Because in any case for an HTLC protocol exchange you must sign the transactions in real time, and a Market Taker can show an interest to your order at any time.

Once a Market Taker decides to accept one of the orders, he/she sends a message of confirmation, and both parties create an HTLC contract on their blockchains and finalize the exchange as shown in the above-mentioned protocol.

Please see other helpful links below:

Why do I need SWAP tokens?

Atomic Swap for the newbies: Swap.Online Guide

SWAP Token Review

Basic observations on the SWAP token economy

Disclaimer: This document is for information and illustrative purposes only. It is not, and should not be regarded as “investment advice” or as a “recommendation” regarding a token price, including and not limited on how those terms are used in any applicable law or regulation. SWAP token economics and its features might be subject to change.

atomic swap wallet token

Abstract

As we have already announced (see p. 10) in the project light paper, the SWAP token will be the core element of Swap.Online project monetization. SWAP is ERC-20 token listed on Swap.Online and can be added to plenty of hot crypto wallets. The total SWAP supply is 21M with neither ICO nor mining procedures planned. We avoided the traditional hype-based model of initial coin offering. The value of the SWAP token will depend on its features and functionality.

Functionality

For now, we define five main functions of SWAP token.

  1. Premium Trading Options. Swap.Online will provide zero-fee for cross-chain exchanges of BTC, ERC-20, USDT, EOS coins. By the way, the default trades will be available with a ‘starter-pack’ interface and a reduced toolkit. SWAP holder will be able to see the reputation and rating of the counterparties, number of trades, market analytics, and other useful information and insights. SWAP tokens are a must-have for daily-traders and market makers.
  2. Building up Reputation. Atomic swap is all about exchanges built on trust and protecting your funds no matter what the intentions of your counterparty are. But we also understand the importance of the time for a swap and the momentum of opportunity. The time could be lost by a cancelled or intentionally slowed down swap by the counterparty. That’s why we’ve introduced a reputation management system which will be done in a centralized way. If you want your reputation to be scored (e.g: as a market maker), we will require a stake in SWAP tokens.
  3. Safety. Working as a part of a proof-of-stake consensus, SWAP tokens will be used as an additional safety guarantee for its holders. For example, in case of an attack on the Node or an unexpected IPFS-connection failure, a new connection will first be provided to the users with SWAP tokens. By the way, it this particular case, the users can connect to any other server.
  4. Advertising. Swap.Online website, being an attractive platform for crypto-traders, will generate high and quality traffic, thus bringing value to the advertising space on our resource. SWAP tokens will be used as a mean of payment for this advertising space.
  5. Token Integration. Swap.Online is a licensed multi-chain hot wallet that can promptly integrate your Сoin into the balance showing it on our homepage. SWAP tokens will be needed to list new ERC-20 and other types of tokens. Maybe, in the near future, we will also provide the possibility of *TOKEN*<->SWAP trades on Swap.Online platform from the first day of their listing.

Trading

Our SWAP tokens will be freely traded via the centralized and decentralized exchanges which support ERC-20 tokens. Note: Swap Online OÜ itself DOES NOT sell SWAP tokens at the moment. By the way, in accordance with our roadmap, a significant stake of SWAP tokens will be spent on the project’s development.

We officially avoid giving any predictions about the price of SWAP. But as a reference, our contributors estimate the price of the SWAP token in approximately 1 USD. Thus, Swap.Online capitalisation based on token supply&price is approximately 21M USD and can be compared to CryptoBridge, Lykke Exchange, SingularX, and Legolas Exchange.

You can also compare Swap.Online with its main competitors (see the table below) considering their capitalization, features, and weaknesses.

Fuel Going to Rocket: August Dev Update, Very Last One Prior to the Mainnet

atomic swap wallet update

IPFS-messaging improvement, no way for the null secret and multiple tabs…Atomic Swaps on EOS?

We would like to share with you our latest updates on the development progress that occured during this hot August. Like our previous development report, this one is dedicated mostly to the issues of stability and usability.

Stability

Since instant and reliable cross-chain transactions are one of the market problems we address, the stability of swaps is one of our ‘things’. Thus, we’re working hard to avoid all the malfunctions which can occur within the swap process. For example, we improved the process of IPFS-messaging. In our previous articles, we briefly described the usage of this technology in the Atomic Swaps process. “Now in case of IPFS-connection failure, the users are able to get reconnected very shortly. The system checks the correct IPFS-room and reconnects you automatically; as a result, now the lost progress of swap is not an option’, comments the improvement our lead developer Nikita Dementiev.

Also, the mechanism of swaps now considers whether the messages between a market maker and a market taker are finalized correctly or not. Remember our pesky Alice and Bob. Alice is sending a message to Bob. Now in Swap.Online, Mr. Bob should confirm the receipt of the Alicе’s message for the procedure continuation. If he doesn’t, for the bilateral security of traders, the message is requested one more time.

Moreover, now the Swap.Online IPFS-mechanism avoids the proceeding of null secrets. Finding the fact that some transaction secret is null, the mechanism also removes such transaction.

Finally, we prohibited the Swap.Online launch from the multiple tabs. As the processing machine sees the tab when the swap is launched, the six Swap.Online tabs can mislead the user (but not the Swap.Online). So, this limitation (used e.g. in Telegram Web) is introduced with the purpose to secure the stability of swaps.

Usability

As we work with the cryptocurrency remittance, we fully accept our user’s desire to know all the details about their swaps’ proceeding. To grant this request, we presented two visualization options. Firstly, now all the errors (e.g. gas insufficiency) are displayed in the swap monitor screen. You are not only unable to lose your money but even to miss a single thing about its status. Secondly, now the progress of the IPFS-connection loading is shown in the left bottom of the start page. You can trace when the connection will be reached and how many users (‘peers’) are online.

Also, now the user is able to copy the link on a given order to the clipboard and send it to a friend. As Nikita says, ‘In addition, you can see, which orders you have opened via the received links. Now, you can discuss it with your friends or post to social network boasting about your success in crypto trading’

atomic swap wallet

The orders you have received via the copied links are highlighted green

Finally, we implemented constant checking of users’ ETH balance. In case of its insufficiency, the user will be informed before the trade.

Moreover, we fixed some minor bugs, checked the SEO-optimization of our site and made Swap.Online operations much easier for low-performance computers with poor RAM. So our service will really be mass adopted.

And now we are getting closer to the good part.

Our team made a tremendous progress on the EOS implementation in our decentralized multi-chain wallet. Why it matters and how it was done – that deserves another single article. Stay tuned and exchange EOS on BTC and ERC-20 tokens in a decentralized way!

The Bridges That Should Be Built: Cross-chain Overview

cross chain swap

Swap.Online addresses the area of cross-chain technologies and continue the series of articles about the most acute issues of nowadays blockchain sphere. We would like to discuss the future of cross-chain, the thorny path to this level of blockchain interaction, and where we are now on this path.

How They Got There: Two Approaches to The Origin of Cross-Chain

Cross-chain as multi-purpose, decentralized, peer-to-peer, direct informational interaction between different blockchains is a complex phenomenon for both cryptocurrencies and the rest of blockchain implementation spheres. Thus, we can explain the origin of cross-chain in terms of at least two approaches.

In a broad sense, to say, ideologically, it is the expression of Web 3.0. inheriting from Web 1.0 with its author-generated content and from Web 2.0 with CMS, usability, etc. Web 3.0 is widely understood as the decentralized, peer-to-peer web. Real decentralization (both political and architectural, in terms of Vitalik Buterin) can be reached only in case of free interaction between different blockchains. Even single centralized element — proxy-token, main server, website administration, etc., should not be considered suitable for Web 3.0.

In a narrow or, if you will, applied sense, cross-chain is the marker of a new level of anonymous encrypted messages transfer. Let’s take the cryptocurrency exchanges (find more on that in our review). Being descendants of the non-blockchain digital currency exchanges, centralized exchanges allowed the interaction between two different chains, but only serving as the centralized point of exchange which resulted in the bulk of vulnerabilities. First decentralized exchanges either use proxy-token (e.g. Waves and NXT) or are pegged to one type of blockchain (EtherDelta and Stellar DEX). So, the launch of cross-chain exchanges using the Atomic Swap technology, e.g. Altcoin.io or Komodo’s BarterDEX (both of them are now in Beta testnet) is among the most anticipated milestones of the sphere evolution in the year of 2018.

Challenges and Responses

In terms of practice, cross-chain solves at least four problems of the blockchain. Firstly, it’s the scalability of network. We have already reviewed proprietary solutions for Bitcoin and Ethereum networks, but the fact is — every isolated blockchain has its bottlenecks making the transactions slow and high-cost. Secondly, it’s isolability: even with CEXs and proxy-token DEXs, different blockchains are still isolated from each other, so, the system based on ERC-20 token has very poor prospects in interaction with Bitcoin-based system. Thirdly, it’s developability: dApps really anticipate cross-chain technologies to adopt useful and interesting solutions. Finally, it is so called ‘shared security’ problem: two interacting blockchains can be much more secure than each of them individually.

Cross-chain can be applied in the spheres of interaction between digital and traditional economy. IoT, Big Data, ID verification, digital banking, money remittances, civil legal proceedings, insurance, copyright protection, crowdfunding, etc., remain a klondike for cross-chain solutions. For example, through the cross-chain solutions can be built a ‘triangle’ between investors, ICO team, and oracle body with no even slightest possibility for anyone to cheat on the whole system. The triangle of such kind can be formed between the shareholders, real estate developers, and supervisory governmental entity within the framework of mortgaged housing construction. And there are plenty of other examples like that.

Polkadot Project: The Infancy of The Pioneer

Polkadot is one of the most promising cross-chain project. It is being developed since 2017 by Parity Technologies (Great Britain), commissioned by Web3 Foundation (Switzerland). The idea of the project is to develop a protocol integrating different blockchains between each other. Structurally it will consist of ‘Parachains’ — the ordinary blockchains even if with different characteristics, ‘Relay chain’ that coordinates consensus and transaction delivery between chains, and ‘Bridges’ — links to blockchains with their own consensus such as Ethereum.

One doesn’t need to be an expert in blockchain to note that ‘Relay chain’ is a kind of very delicate balance. It is maintained by four types of actors in cooperation: validators, collators, nominators and fishermen.

  • Validators secure the Relay chain by their stakes of product tokens (DOTs, native Polkadot blockchain), validating proofs from collators and participating in consensus with other validators;
  • Nominators secure the Relay chain by selecting good validators and staking DOTs;
  • Collators maintain parachains by collecting parachain transactions from users and producing state transition proofs for validators. They also monitor the network and prove bad behaviour to validators;
  • Fishermen act as a kind of the final security frontier, they monitor the network and prove bad behaviour to validators.

In a word, this is a complicated system sharing PoS- and PoW-principles. This system is governed by sophisticated hierarchy of three types of ‘plebiscite’: council, referenda and public referenda. As a result, bad actors lose their stakes (DOTs) and eventually expelled from the network. Nobody has an option to get control over the full network. More on that here.

But the majority of this is still under development: a project is in its early days. Milestones of the project are called PoC (proof-of-concept), in July, 2018, the PoC-2 was released. What’s ready for today? You can download desktop testnet version of the Polkadot (‘Krumme Lanke’) and launch your own node as ‘parachain’: the list of nodes can be tracked online. Relay chain is close to its final image. It is backed by Parity’s Substrate technology written on Rust, however, the core functionality that comprises the state machine was written in WebAssembly (Wasm). Finally, first transaction of some DOTs between two chains was executed in Polkadot network.

By the way, there are a lot of uncertainties about Polkadot. The mainnet release called Polkadot Genesis is scheduled for the Q3, 2019. Developers say they have no idea how many PoCs will be released on the way to that day. Also, they warn that ‘Polkadot may not be successfully developed or may not function as intended and that the Polkadot genesis block may not be deployed as intended or at all. Finally, the project team is still not sure about the role of DOT holders and this token features. All this may seem like a pure overreaction. Nevertheless, the most professional part of crypto community highly appreciates all Polkadot updates.

Cross-chain for Swap.Online

atomic swap eos

Swap.Online includes plenty of cross-chain implementations. Firstly, basic solution for our wallet is cross-blockchain exchange of crypto. Now, the Atomic Swaps with the BTC, ERC-20, ETH, and EOS are already being executed, operations with USDT are successfully tested, NEM coins are to be added very soon. Cross-chain is also used in Cross Swap technology allowing to send crypto during the operation to different addresses. Finally, In the near term, Swap.Online plans to launch Swap.Button — a many-to-one transactional instrument for the acceptance of crypto investments to the blockchain projects with the cross-chain as the inevitable element.

Don’t forget, there are only five days left to mainnet release of Swap.Online cross-chain wallet.

Stay tuned!

Swap.Online Essential Links

Website: https://testnet.swap.online
GitHub: https://github.com/swaponline
Email: [email protected]
Telegram: https://t.me/swaponline
Facebook: https://www.facebook.com/Swaponline
Twitter: https://twitter.com/SwapOnlineTeam
Wiki: https://wiki.swap.online/
Bitcointalk: https://bitcointalk.org/index.php?topic=4636633

Atomic Swap with Tether (USDT)

On the eve of the release on the mainnet, the team of the cross-chain wallet Swap Online is publishing a research study and the code of the atomic swap using USDT.

atomic swap wallet

USD Tether — the equivalent of the dollar on Omni Layer

The solution described above with the protocol “over” the Bitcoin network gave life to one of the most controversial cryptocurrency projects of the last two years — Tether. Tether (symbol Tether — ₮, ticker — USDT) is a hybrid cryptocurrency with a rate binding to one US dollar. Moreover, according to the assurances of Tether Limited, the issuer of the given tokens, the “binding” is to be understood literally, as each purchased token of USDT corresponds to one US dollar available at the disposal of the company.

If we take the three largest exchanges based on their daily turnover of transactions at the time of writing (Binance, OKEx and HuObi), and then track the five most popular trading pairs for each, we will encounter USDT in 13 out of 15 cases.

USDT — the token with the largest capitalization in the world.

All this generates great community interest in faster, safer and cheaper solutions for exchanging Tether into other currencies. Obviously, such a solution could be atomic swaps, which are instant, decentralized cross-chain exchanges. The Komodo laboratory, the main headliners of this technology, who presented it in the autumn of 2017, reported on the successful exchange of KMD to USDT carried out on the BarterDEX platform, Komodo’s own exchanger.At the same time, according to our data, the developers of Komodo made a swap on the ERC20-a version of Tether, which is only available in 3% of cases. Approximately 60 million USDT from global turnover can thus be exchanged using this method, which, obviously, cannot be considered as a solution to the problem. Striking examples of imperfections of existing solutions can be found even on Etherscan.

This fall, the team of https://swap.online is ready to present an atomic swap with Tether. And here’s how we did it.

How Omni conducts transactions

To carry out the Omni transaction, a user needs to create a regular Bitcoin transaction-transfer of 546 satoshi (minimum) with an additional output storing payload using the OP_RETURN op-code. An example of such a transaction. The payload is a mandatory part of any Omni transaction, as it is a sequence of bytes containing all the necessary information about the transaction.

(example on bitcoinjs.js https://gist.github.com/caffeinum/f64a51ce55d5ac9075bb2f5f2f439c0d )

Let us consider what information is stored in the payload itself

transaction marker — 4 bytes, the mandatory part of any Omni payload is always equal to 0x6f6d6e69 — ASCII code omni. If the first 4 bytes of the sequence are not equal to 0x6f6d6e69, then this sequence is not a payload of Omni.

version — 2 bytes, an analog version of the transaction in Bitcoin. For the described algorithm to work, version 0 is used, or that is the same as 0x0000.

transaction type — 2 bytes, transaction type, for an atomic swap it is sufficient to use only “Simple send” transactions, as simple send is the usual sending of omni currency from its address to the address of the recipient. Simple send corresponds to the transaction type code 0, that is, the next 2 bytes 0x0000. Other possible types of transactions exist in Omni.

token identifier — 4 bytes, identifier of the currency used. For example TetherUS has the identifier 31 or 0x0000001f. All tokens created by the Omni protocol at this time can be seen via the following link.

amount — 8 bytes, for a transaction of type Simple send, this is the amount of the sent currency.

As you can see, payload does not store the addresses of senders and recipients of the transactions, these addresses are determined by the Bitcoin transaction in which the payload output was detected. By scanning inputs, the Omni protocol determines who makes the transfer by finding the output of the corresponding address from among the inputs of the transaction p2pkh.

Thus, for a transfer from Alice to Bob of, for example, 50,000,000 TetherUS, we need to create a Bitcoin transaction where one of the inputs will refer to the p2pkh output corresponding to the Alice address. It is also important that this entry be the first in this transaction (the index of this entry in the received transaction would be is minimal or none at all). One of the outputs of this transaction should be the output of p2pkh to Bob’s address, and another output must have been one of the outputs with the following payload:

https://www.blockchain.com/ru/btc/tx/1f359902f666249b73f7bf8a1ea778259fa4b4eb904538e9713c487e091d4756

https://www.omniexplorer.info/search/1f359902f666249b73f7bf8a1ea778259fa4b4eb904538e9713c487e091d4756

Atomic Swap on Omni Layer

Suppose that Alice and Bob are willing to make an inter-blockchain exchange of cryptocurrencies. Alice wants to exchange the units of any Omni currency, for example TetherUS (the given currency has the currency identifier # 31 in the Mainnet, then in the text we will only talk about this currency of the Omni protocol, since it is the most popular at the moment, but the algorithm below will work for any currency of the Omni protocol as well) for b units of a cryptocurrency working on another blockchain. (Omni works on top of the Bitcoin blockchain, of course, according to the algorithm below it is possible to exchange TetherUS for Bitcoins, but due to their work on one and the same blockchain, this exchange can be done in a different, more efficient way).

Glossary

A — blockchain of Bitcoin.

B — the blockchain of the cryptocurrency for which TetherUS is being exchanged.

a — the sum of TetherUS, which Alice wants to exchange.

b — the sum of the cryptocurrency of the adjoining blockchain B, to which Alice wants to exchange her a TetherUS.

Creating a Transaction

1) Bob generates a random value secret.

2) Bob calculates the secretHash by performing the following operation: secretHash = RIPEMD160 (secret)

3) Bob creates and sends an htlc transaction sealed by secretHash

4) Bob sends Alice a secretHash value, and a hash of the hrlc transaction he created in the previous paragraph in order for Alice to make sure that the correct htlc transaction is actually present in the B blockchain.

5) Alice received from Bob the secretHash and hash of the htlc-transaction Bob created, and is convinced that such a transaction is really present in the B blockchain, and that this is indeed a htlc-transaction sealed by the secretHash value.

6) using the received secretHash, Alice creates the following transaction and translates it into the Bitcoin blockchain:

Let us call such a transaction financing_tx. In fact, it is almost an ordinary Bitcoin htlc transaction that is used in atomic swap with the only difference that in the amount field, 546 satoshi is the minimum number of Bitcoins that can be at the output of the transaction, below this value, Bitcoin counts the transaction as dust and does not conduct it.

7) Alice creates a transaction according to the following scheme:

atomic swap tether usdt

Let us call this transaction redeem_tx. Alice creates such a transaction with two inputs: the first is the input referencing the output of funding_tx, which contains the htlc script. Alice does not sign this script, that is, the SigScript field remains completely empty. The second input is the input referring to any unspent exits of Alice, the main condition is that at this output stage there are enough Bitcoins to pay the transaction fee, and this entry is signed by Alice with her private key with the signature type SIGHASH_ALL (that is, she signs the entire transaction except for SigScript fields on the inputs transaction, which makes this transaction immutable. The outputs of the same transaction are the elementary Simple Send and a TetherUS from Alice to Bob (details of what Simple Send, payload is and how it works can be found in another section).

8) Alice sends Bob the redeem_tx created in the previous paragraph and the one she signed herself.

9) Bob got the redeem_tx sent by Alice, checks it, just looks through the inputs and outputs, making sure that this is really a transaction that Alice should have created using the real algorithm. After that, Bob signs the transaction with his private key and provides the secret value in the SigScript of the corresponding redeem_tx entry.

10) Bob sends the signed redeem_tx transaction to the blockchain, thereby transferring the TetherUS currency from Alice to himself. Note — before carrying out this step, we still need to check that Alice’s address has the necessary amount of TetherUS.

11) Alice looks through blockchain A and gets the value secret and uses it in the B blockchain to transfer the funds using the htlc transaction Bob created in point 3. The exchange ends here.

Stating the obvious: naturally the timelock value used by Bob when creating the htlc-transaction must be significantly longer than the timelock that Alice uses, since her htlc transaction should be spent earlier than the htlc created by Bob. This is necessary so that Bob cannot manage to spend both htlc.

Conclusion

Thus, connecting Omni Layer to Swap Online allows users to cover transactions.

Full research you may find in our Github

C++ source code for creating TX

C++ source code for redeem TX

Mainet

In next examples:
Alice’s Address – 1QCEnxXU9QAsnqfufArkiuangGNGqdE4in.
Bob’s – 1341545XP8GdCiL96osVr3NefXpHbjzoCs

Alice’s TetherUS balance:

Alice's_Balance

Bob’s Tether balance:

Alice's_Balance

Alice changing 1 TetherUS to 0.001 BTC. For make exhcnage they make this steps:

  1. Bob create SECRET –0x832f296f8f2cff3fe553dee413d8fc84def9102be547bd147c02c36b704ebafb
  2. secretHash=0xbd52a5a7d6d5b8367ddfa8417c271c5639f85322.
  3. Bob create transaction and sent to the blockchain  (funding_tx):

funding_tx_Example

  1. Bob sent secretHash to Alice (via offchain messaging)
  2. Alice created and sent to the blochcain (funding_tx):

funding_tx_Example

  1. Alice created redeem_tx, and signed by SIGHASH_ALL algorhytm:

redeem_tx_without_Bob's_sign
and send it to the Bob for sign (for example via IPFS). note: one of the outputs no have SigScript.

7. Bob sign this transaction and add secret, then send to the blockchain this transaction (redeem transaction):

redeem_tx

This transaction have output with “payload” – this transaction is “Omni” transaction:

omni_tx_Example

  1. Alice can parsesecret from bob’s transaction, then she create and broadcast this transaction:

redeem_txB

And take bitcoins:)

Alices TetherUS balance after swap:

Alice's_Balance

Bob’s TetherUS balance after swap:

Alice's_Balance

Swap.Online: cross-chain wallet provides zero-fee exchange between USDT, EOS, BTC, ETH, ERC20. https://swap.online/

 

About autor: Sergei Moiseev https://github.com/TyHDyK

Lightning Strike

swap tokens online walet

Scalability Is Sending a Message

In November 2015, Bitcoin was worth some $450. The vast majority of nowadays problems related to the world of cryptocurrencies remained either totally unknown and unpredictable or had been a province of few cryptographic geeks. By the way, it was blockchain developer Joseph Poon and Thadeus Dryja, Ph.D. in cryptographic primitives and network security at the University of Virginia who (i) prominently spelled out the main alarming limitations of the Bitcoin network in commercial and technical regards and (ii) suggested the solution for these issues is to be found off-chain and only off-chain.

In fact, they contributed to the discussion that would later be called an ‘ideological battle over Bitcoin’s future’ – the Bitcoin scalability problem debate. While the understanding of both realized and proposed ways of this problem’s solution requires a high-degree knowledge in applied maths and coding, the problem itself can be described in a nutshell.

Initially, one block size in the Bitcoin network is limited to 1 MB. As the quantity and amount of transactions grow, it is not enough anymore. Confirmations time-outs are getting longer, while the transaction fees are getting higher. It results in the loss of commercial attractiveness of Bitcoin solutions since no one prefers to pay more and wait more. The situation has to be resolved as it is about the future of both the applied and theoretical dimensions of blockchain.

Obvious Problems, Controversial Solutions

On the face of it, there are two mainstream ways to solve the Bitcoin scalability problem. Adepts of first way proceed from the understanding that the block size is the only limitation to the transaction throughput. So, they say, this limit is to be increased if not removed once and for all. During the years 2015, 2016 and 2017, a series of solutions of this kind was proposed by the Bitcoin developers community. Among the successful are Bitcoin hard-forks, namely Bitcoin XT, Bitcoin Classic, Bitcoin Unlimited and the most popular and viable, Bitcoin Cash. In accordance with their rules, the block size was expended, at first, to 2 MB. Now, the last Bitcoin Cash core update released on May 15, 2018, allows to enlarge the block size up to 32 MB. This process itself generating controversy and anxiety in the world crypto society was followed by the cascade of partially successful ‘agreements’ (Hong Kong, New York etc.) through which the fractions in Bitcoin community tried to implement a new consensus on mining, thus allowing to enlarge the block size to 2 MB.

The very popular Segregated Witness or SegWit solution is a Bitcoin soft-fork, allowing to increase the block size in another way. It splits the transaction into two segments, removing the unlocking signature (“witness” data) from the original portion and appending it as a separate structure at the end. After that, the block (‘on-chain’) size is increased as  signatures are ‘expelled’ from the blockchain. Since the volume of signatures is some half of the full transaction volume, the limit for the block size with the SegWit is around 1.8 MB. SegWit also addresses the issues with malleability. Signatures are impossible to change after being moved out of the transaction data. Marked as a ‘clever hack’ by the Bitcoin Magazine, the SegWit is now among the most popular Bitcoin scalability solutions. Activated on August 24, 2017, with the Bitcoin block number 481 824, SegWit reached the 10 per cent market penetration in two months. Now every 2 of 5 Bitcoin transactions are handled via SegWit. And that is really a lot.

SegWit Transactions Percentage in the Bitcoin Network. Impressive, isn’t it?

Adherents of the second way suppose that the increase of the volume of the block is only a poor remedy for the Bitcoin network scalability problem. According to them, the pivotal problem is blockchain overload, so, the transactions should be conducted without the use of blockchain as it was generally accepted up to nowadays. They observed that some transactions can be handled ‘above’ the blockchain, or, if you will, on the second layer. So, the proponents of this approach stuck to the ‘Second Layer’ solutions.

Unloading The Blockchain

The Lightning Network ideologists Ј. Poon and T. Dryja asked in their whitepaper: “If a tree falls in the forest and no one is around to hear it, does it make a sound?” They compared the transaction between our familiar Alice and Bob to a tree in the forest. “…if only two participants care about an everyday recurring transaction, it’s not necessary for all other nodes in the Bitcoin network to know about that transaction. It is instead preferable to only have the bare minimum of information on the blockchain”, they declared.

There’s a plenty of Lightning Network schemes in the Internet, I had a hard time finding a clear one for you. Have a look: only two peers know the full information about the transaction with only critical data saved in the blockchain.

To put it at its plainest, in the Lightning Network, if Alice and Bob come to the agreement that the tree fell down at 2:45 PM, it is true without regard to public opinion. Their agreement that before the transaction Alice had 0.5 BTC and Bob had 0.4 ВТС, then after the transaction, Alice owned 0.6 BTC and Bob should content himself with 0.3 BTC, is secured by the hash-time lock contract. This transaction is atomic: it is to be finished only in case of bilateral recognition. Thus, there is no way for fraudulent payments: if the transaction is not broadcast within the timeframe defined in the contract, then it is considered null and void. The channel the transaction is sent through is live only for the time of the swap.

From The Idea to Mainnet: Lightning Solutions Development

Unlike the Rayden second-scale solution for the Ethereum ecosystem, which is solely developed by Brainbot Labs, there is a couple of teams working on Lightning Network in parallel. Moreover, the commercial and non-commercial implementations of Lightning are being developed separately. Non-commercial implementation of Lightning is researched by Digital Currency Initiative of MIT Media Lab (project LIT). Commercial implementations are being developed by Blockstream (project Lightning Charge, see the wide range of specifications proposed by Rusty Russel, one of the most well-known Lightning contributors), Lightning Labs (project lnd) and ACINQ (project Éclair). Now, every abovementioned team presented the beta version for the developers and those who would like to test its features with a dummy amount of coins. The up-to-date condition of the Lightning Network connections worldwide can be found here. At the time of publication, it consists of 2699 nodes and 7403 channels with a total capacity of $0.6M.

Lightning Network Channels Live.

It’s no great deal at the time, but it is increasing day by day.

Why does it matter? There are four main spheres of use the Lightning solutions can be implemented in. Firstly, it is the huge sphere of instant payments. With its prompt speed of operation, Lightning Network can bring the Bitcoin close to the b2c-payments, replacing Visa and MasterCard. Then, it is the trading (or exchange) arbitrage. There is presently an incentive to hold funds on exchanges to be ready for large market moves due to 3-6 block confirmation times. It is possible for the exchange to participate in this network and for clients to move their funds on and off the exchange for orders nearly instantly. Micropayments, e.g. machine-to-machine payments in amount of some Satoshis are also waiting for a solution of that kind. Finally, it can open new levels for applied financial smart contracts and escrow as the third parties are totally expelled from the chain.

Swap.Online x Lightning Network: Long Drive Ahead

Swap.Online, as an OTC crypto marketplace, has a lot of common grounds with Lightning Network solutions. First and foremost, it is due to our special interest in the swaps with Bitcoin. It seems to be really appreciated by the market, since the most popular and advanced modern decentralized exchanges support only ERC-20 tokens. We decided to emphasize the possibility of Bitcoin atomic swaps, since it remains the most popular and attainable cryptocurrency. Then, the Lightning Network focus on the machine-to-machine payments and micropayments in common is coincidental with our b2b-product – Swap Button, the tool for receiving the investments in crypto. Finally, big and experienced traders are obviously interested in high-technology, as instant swaps will eventually switch to the Lightning Network. As a result, we have a strong interest in the research of Lightning algorithms.

Swap.Online Essential Links

Website: https://testnet.swap.online
GitHub: https://github.com/swaponline
Email: [email protected]
Telegram: https://t.me/swaponline
Facebook: https://www.facebook.com/Swaponline
Twitter: https://twitter.com/SwapOnlineTeam
Wiki: https://wiki.swap.online/
Bitcointalk: https://bitcointalk.org/index.php?topic=4636633

 

Atomic Swap for the Newbies: Swap.Online Guidе

Atomic Swaps: What’s That Like

atomic swap bitcoin

To start with, Atomic Swap is a technology of direct trade between two different cryptocurrencies with no third parties, middlemen, intermediary tokens etc. Alice sends Bitcoins to Bob, Bob sends Litecoins to Alice. That’s it. The story is about Alice and Bob’s wallets containing cryptos, their decision to exchange, and their computers connected to their respective blockchains.

If Alice owned 5 Bitcoins, but instead wanted 100 Litecoins, and Bob owned 100 Litecoins, but instead wanted 5 Bitcoins, then Bob and Alice could make a trade. To avoid Alice’s possible cheating in accepting Bob’s 100 Litecoins, but then failing to send her 5 Bitcoins, atomic swaps utilizes what is known as hash time-locked contracts (HTLCs).

Hash time-locked contracts ensure that the atomic swap process is completely trustless by ensuring both parties fulfill the requirements of the trade. If this proof is not received within 24 hours (the timeframe depends on various factors), the money is returned to their respective owners.

That’s why this technology matters, as the trade is cancelled if only one of the two parties is unsatisfied.

Therefore, for a trade between Alice and Bob to take place, both must submit their transactions to their respective blockchains, Alice on the Bitcoin blockchain, and Bob on the Litecoin blockchain. In order for Alice to claim the 100 Litecoins sent from Bob, she must produce a number that only she knows, which is used to generate a cryptographic hash (a very long row of letters and numbers), thus providing proof of payment.

Brief History of Atomic Swaps

The idea of fully decentralized transactions comes from the very first papers written by Satoshi Nakamoto about Bitcoin (2008), and even by Nick Szabo about smart-contracts. HLTCs are a particular case (middle 1990s). The Komodo Platform, a fork of the Bitcoin team, was the pioneer of Atomic Swaps. The original idea for atomic swaps was described on the BitcoinTalk forum by forum member Tier Nolan in 2013. Komodo’s lead developer, JL777, recognized the value of the idea, built the necessary framework, and completed his first atomic swap just a year later in 2014. Since then, his team has continued to make tremendous advances in the technology.

On September 19, 2017, they executed the first Atomic Swap between two blockchains, Litecoin and Decred.

Three days later, the first Atomic Swap between the two oldest currencies, Bitcoin and Litecoin, was successfully carried out.

Cross-chain Atomic Swaps technology is now widespread on different blockchains.

Atomic Swaps: Present and Future Application

Currently, this technology is being used for sending money from one blockchain to another. For example, in Swap.Online, we use it for BTC ⇔ ETH and ERC-20 ⇔ BTC swaps. Everyone can change their cryptos in a safe and decentralized manner. You can try it yourself: just follow the instruction manual!

Research on the future of this technology is being carried out in two directions. Firstly, there are a couple of emerging solutions for executing swaps above the blockchain (second-layer scalability) e.g. Lightning Network for Bitcoin, Raiden Network, and Liquidity Network for Ethereum. They are trying to somehow solve the problem of blockchain overloads. Secondly, many researchers are trying to find commercial applications for Atomic Swaps. It is highly likely that they will be used in statistics, banking, logistics, state registers and other areas.

What can we derive from this article? The technology of Atomic Swaps is a way to transfer cryptos from one blockchain to another with the use of special smart contracts set for a limited amount of time. The technology is used for decentralized peer-to-peer cryptocurrency trading.

Your Guide in the World of Cryptos,

Swap.Online team

Swap.Online Essential Links

Medium: https://medium.com/swaponline
GitHub: https://github.com/swaponline
Email: [email protected]
Telegram: https://t.me/swaponline
Facebook: https://www.facebook.com/Swaponline
Twitter: https://twitter.com/SwapOnlineTeam
Wiki: https://wiki.swap.online/
Bitcointalk: https://bitcointalk.org/index.php?topic=4636633

Raiden Network Ethereum Testnet Deployment: On The Verge of a New Era?

‘The Raiden Network
is not your average DApp’

Raiden Network Team,
“The Raiden Network Token Model”, October 2017.

On July 19, 2018, the Raiden Network team announced that the product is ready for deployment in the Ropsten Ethereum testnet. Swap.Online would like to make an overview of the history and present state of the Raiden Network technology, which is considered to be the second-layer scalability solution for Ethereum network tokens and off-chain transactions, and discusses the prospects of its commercial application.

Driving transactions off-chain

As the quantity of transactions on the blockchains like Ethereum or Bitcoin started growing exponentially, it became obvious to the industry that one day, in the future, high transaction fees and long confirmation timeouts will eventually become the downfall of cryptocurrency’s evolution. The extensive solutions based on the banal increase of mining technical capacities seemed to be a feeble remedy. Thus, the only possible resolution was to transfer some part of transaction process from the blockchain in a safe and decentralized manner. After working on the problem since early 2015, the developers from Brainbot Labs Establishment presented the Roadmap of the Raiden project. It was initially planned that the series of decentralized solutions will be implemented in three stages, namely µRaiden or Micro Raiden as a service of many-to-one transfers above the Ethereum network, the Raiden Network as an advanced many-to-many payments service for ERC-20 tokens, and Raiden 2.0 (or ‘Raidos’ referring to ‘dos’ for ‘two’ in Spanish) designed to scale Ethereum’s generalized computation capabilities through a network of satellite chains, which can host any smart contract.

Raiden Roadmap: October 2017. Not so easy to figure something out.

The path

The Raiden Network team raised great awareness the first time with the Micro Raiden, which was launched in testnet in September 2017. As the project developers said, mainly it targeted the dApps interested in ‘using the Raiden Network as a robust, many-to-one payment channel system; one service provider offering services to many recurring customers’. A more advanced and scalable solution was presumed since the very start of Micro Raiden’s implementation. It was said that Micro Raiden requires users to lock up tokens upfront for every potential payee, so, it is not suitable for many-to-many payments. The reason was the reduced technological complexity, which made a quick mainnet release of the product possible.

Apart from the technical aspects of this release, we have to admit that it was a really splendid commercial move, as the ICO of the Raiden Network was announced two days later.

At first glance, the ordinary offering of yet another utility-token set off a firestorm of debates, despite the fact that the team said they will do little to market their ICO. The team was accused of planning a ‘grab-the-cash’ ICO. When somebody asked why ETH itself cannot be used as the currency of the Raiden Network, the Reddit thread collected more than 400 comments by the time it was archived. Even Vitalik Buterin, who usually appreciates all second-layer scalability of Ethereum decisions, was defensive, albeit understanding the motivation of the Raiden Network team.

Vitalik understood the Raiden Network team’s efforts to raise some cash.

As it has already been said, the ICO of RDN was not accompanied by a remarkable media campaign. Nevertheless, after being launched on October 18 and organized on the principle of a Dutch auction, it ended on November 1 with a rather moderate amount of 109,532 ETH (about $32.75 million). The final price at which all the participants received the RDN tokens was 0.0021906 ETH per RDN. The tokens themselves immediately became available for secondary trading. Looking ahead, we need to say that on January 9, 2018, the RDN/USD exchange rate reached its top value (see figure below).

On January 9 2018, one RDN was worth some 8,65 USD.

In the last days of November 2017, the project team released the full version of Micro Raiden in the Ethereum main blockchain. The users met one restriction: the amount of tokens used in some project features was limited to 100 RDN. Lefteris Carapetsas, the developer of the project, wrote in his Github that the main aim of the release was to identify bugs in the code within the framework of the Raiden Network’s development process: “This is a bug bounty mainnet release. We recommend using only small amounts of RDN as channel deposits. As such, we have limited the maximum deposit to 100 RDN”.

The Raiden Network’s release on the Ropsten Testnet has been highly appreciated in the crypto world. What profits does the industry expect from this update?

Raiden Network: Features and Capabilities

It is generally believed that all second-layer Ethereum blockchain solutions (e.g. Raiden Network and its competitors, like the Liquidity Network) solve four main problems: scalability, latency, transaction fees, and privacy.

Traditional public blockchains are able to execute very low quantities of operations per second: e.g. for Ethereum this figure is some 9.6. This problem is solved in the Raiden Network by decentralized peer-to-peer mechanisms. The bigger the Raiden Network becomes, the higher its maximum throughput with the ability of growing ad infinitum.

These blockchains also work very slowly. With 15-30 seconds spent on one Ethereum block, the confirmation of some operations can take up to a couple of minutes. Raiden’s developers say that their transfers “are as fast as text messages”. The amount of coins received is transferred straight to the receiver’s wallet with no need to wait for confirmation.

The elimination of transaction fees seems to be the clearest feature of the Raiden Network. It is an odd thing to say that the transaction cost of a transfer via the blockchain is several times higher than of the one sent by a channel directly peer-to-peer. Raiden’s developers say it will be much more useful with the IoT extension surrounded by machine-to-machine payments.

Privacy issues are among the most sensitive for Ethereum users. The Raiden network foresees that only the amount of tokens sent will be shown to the entire world via the blockchain explorer without disclosing the maker and taker addresses.

Thus, the Raiden Network is designed for both for b2b and b2c commercial implementation with the latter being the focus.

What can we find there for Swap.Online?

Firstly, we can use Raiden solutions for collecting fees. As we suppose, we will avoid the classic model of 0,3 percent from the taker transaction fee. By the way, some of our users will be paying something for their swaps, and this issue is related strictly to the machine-executed micro payments field, which is clearly targeted by Raiden. Particular attention should be paid to the orders placed by the bot, as it is the best example of machine-to-machine payments.

Then, we can use the Raiden network’s solutions for researching the mechanism of Atomic Swaps, which is crucial for Swap.Online. Instant low-fee swaps are our basic ideology, so, we need to know something about this process.

We highly appreciate the Raiden Network testnet release. We will try it and write about our experience. We will also review the most interesting updates of crypto transfer technologies and keep you informed.

Stay with us!

Regards,
Swap.Online

4th round of Bounty campaign is successfully completed!

Friends, thank you all for your participation and support, this is very important for us! Here is link that shows the number of tokens you earned for the last round! https://docs.google.com/spreadsheets/d/1IBz8a4DUWDAvfuNneANvu0ONAD6ilyOT6ukxWu07goA

See What You Can: How To Use Swap.Online

atomic swap exchange

Swap.Online is a revolutionary crypto over-the-counter marketplace delivering the services of the instant BTC ⇔ ERC-20 and ERC-20 ⇔ ERC-20 exchange. It is based on the principles of real decentralization as no component (e.g. plug-ins, orderbooks etc.) serves as the center or middleman. This story is about buyer and seller only: we don’t store your keys, coins or data. Our exchange uses the Atomic Swaps technology, so you don’t need to use special software or even somehow tune your browser.

 

Decentralization: mantra or solution?

 

Since the quantity of crypto frauds and thefts grew rapidly (see figure) as well as the damage caused by them, the decentralized exchanges or DEXs now seem to be the most significant trend in crypto world: the DEXs doesn’t store the users’ crypto. Inspired by that fact, some services use the terms of decentralization without being decentralized indeed. They position themselves as the ‘hybrid’, ‘semi-decentralized’, ‘demi-decentralized’, ‘with critical infrastructure centralized only’ etc. being still decentralized in general.

We dealt with the issue our way.

 

Swap.Online is fully decentralized without any single component stored on or operated by centralized means. Our swaps are conducted directly in browsers of traders with no keys or money send to us or stored via our technical capacities.

Also we are higher than bulk majority of DEXs in several respects: we support BTC, we stand for the KYC/AML neutrality, our deals are safer and faster because of IPFS and Atomic Swaps technologies implementation. Written on JavaScript, our core is able to be implemented even in projects without JS via the REST API.

So, it’s the time to see it for yourself.

We are proudly presenting the test swap between BTC and ETH with the conditional coins as the most interesting and useful feature of our testnet – https://testnet.swap.online/ . Don’t miss the chance to see rapid speed and splendid functionality of our service!

 

  1. Launch https://testnet.swap.online/ .
  2. In the “Wallet” pad, download the keys and make us sure you saved it in the safe place (see Figure below)

  1. Now you see some test coins on your BTC and ETH wallets.
  2. Then come to the “Orders” pad. Here we see some test orders. Press the button ‘>’’ in the ‘Actions’ column.for the order suitable for you.  Now you are ready to start the swap.

  1. Press “Confirm” to start the exchange.

  1. Then you need to wait for 90-120 seconds and press “Continue”.

  1. The most impatient of you are already able to check the pending of transaction via Etherscan by one click on the test transaction hash.

  1. Few seconds later you will have your last option to refund the money send (use ‘’Try refund” button).

  1. The swap is conducted, PROFIT!

Congratulations, you finished your first deal via Swap.Online and received your money.

More swaps – more profit. Come back to us!

Best regards,

Swap.Online Team.