WyreBitcoin Swap Wallet is a protocol allowing cross-chain swap of cryptocurrencies without the need for an intermediary party. Implementation is done with JS & the use of IPFS.
Features
- DECENTRALIZED WALLET: Completely Decentralized Cryptocurrency Wallet. No intermediary parties involved. Your coins, Your keys.
- BROWSER-BASED: No more software downloads or installs. Use the browser or the chrome extension to power your wallet.
- ATOMIC SWAPS: Connecting multiple blockchains & enabling users to exchange coins directly with other connected peers.
- IPFS POWERED: Orders are recorded and activated directly on the IPFS. Orders are activated & deactivated as you turn your browser on/off.
- IMPORT/EXPORT: Import or Export your wallets as you wish. Enjoy complete control over your funds. No restrictions, no fees.
- OPEN SOURCE: 100% open sourced project for improved transparency & further developments by Blockchain & Crypto geeks.
Terms You Need to Know
- Hash function: a function conforming to the following conditions:
If x is known, then f(x) is relatively easy to calculate.
If y=f(x) is known, there is no simple (efficient) way to calculate x.
Example of the function , where mod is the remainder after division by N. - Order: a message which indicates that the user wishes to trade ‘X’ for ‘Y’. In this case, the swap (exchange) only begins when other users ‘subscribe’ to the orders and their conditions are met. More info: https://medium.com/@EthAdvisor/atomic-swaps-etomic-swaps-explained-in-plain-english-4c3936c7adb8
- Swap: an exchange procedure whereby X is traded for Y and vice versa in a simultaneous and irreversible way.
- Smart contract: specifically conditioned address on the blockchain with funds locked only until the specific condition has been met.
- Bitcoin script: smart contracts for bitcoin and likewise networks.
- IPFS pub sub: a decentralized network for message and data transmission.
Forkflow
The swap (exchange) process resembles a dialogue between people. Below, M refers to the Market Maker, T refers to the Market Taker, and M refers to Messages which are marked as **.
- ** Maker to All: I want to exchange 1 BITCOIN for 10 ETH (place order) (signed with a private key with a condition that a penalty of $100 is to be paid upon refusal)
- ** Taker to Maker: Let’s exchange
- The Maker fills the bitcoin script with the condition that only T may unlock it upon sending the x value conforming to the condition y=f(x) to the script; the script contains the y value.
- ** Maker to Taker: I have frozen bitcoins at the address {ContractBTCaddress}, sending the Y value now
- The Taker creates and fills a similar contract in the Ethereum network stating the same Y value
- ** Taker to Maker: Here is the contract in the Ethereum network {ContractETHaddress}
- The Maker takes ETH out of {ContractETHaddress} by transferring the X value there
- The Taker takes bitcoins from {ContractBTCaddress} by transferring the X value there
The Maker is unable to take money out of {ContractBTCaddress} until the timeout expires, and vice versa.
The parties check whether the smart contract is created and filled properly by the other party before taking any actions.
Components
Wallet
Upon first logging in to the wallet, cryptocurrency addresses and its corresponding private keys are generated for the user. The user can then proceed to import/export private keys, deposit, withdraw, view transaction history, and place swap orders.
Orderbook
The orderbook (for swaps) mimics a mini-blockchain whereby all parties will actively keep a copy of the orderbook.
- order messages and data operates via events through IPFS whereby each user will be able to send his/her actions directly to other users
Transport: IPFS
Data are stored in a distributed network based on IPFS pub sub, and in this case the only point of failure is the signal server; furthermore, several such servers may be added.
- Possible Alternatives: webRTC, metsh, Whisper, libp2p
- Current: IPFS pub sub room
- Disclaimer: It is probable that a redundant transport system will be required as IPFS remains unfinished
Liquidity: bots
The protocol allows exchanging cryptocurrency directly from other addresses; users do not have to keep a reserve on the stock exchange. The user may keep reserves wherever he/she requires these reserves, for example, on other stock exchanges, and run them through the system only during the swap. Thus, we will not take liquidity from competitors and become an additional invisible layer.
Rating and pledge
*to be expanded*
It is not possible to implement all parts of the protocol technically, many aspects still depends on the user; therefore, a rating or other additional data to filter users are required.
Rating example: Each exchange increases statistics for the volume and quantity of transactions, with the drawback that it keeps Ethereum-related transactions, but this means 95% of all tokens.
Pledge example: The market maker puts a pledge into the smart contract which is reduced if he/she agrees for transactions and later cancels them.
Rating data may be stored off-chain; each user keeps the exchange history with signatures from the other party, which allows uploading it into the blockchain at any time to obtain rating points.
Token (example)
- A token is a pledge for the green status;
- The user transfers the token into the smart contract, and his/her address becomes green in the system which can be seen by all protocol participants;
- If one party aborts the transaction, part of his/her tokens will be transferred to another user;
- Therefore, the system encourages correct behaviour, when the expected value is positive; it is not an investment income;
- If desired, the participant may withdraw excess tokens;
- The token holders may, upon a general vote, establish a fee for all transactions with tokens and a purpose of use (stating the address);
- We cannot affect the protocol operation in any way but may choose what information should be displayed on the website.
QA
Q: What is the difference from x?
A: It is most likely that x is working with only one blockchain (such as 0x, EtherDelda, BitShares …) or is not launched yet.
Q: What is your main difference from your competitors?
A: Most stock exchanges are written using Go and C languages; we create our stock exchange completely on JS, which means that users do not have to download and install binary files. Furthermore, no data pass through our server.
Q: It is used only for exchanges. Can information be transferred?
A: Information can easily be written into contracts.
Q: OK, if I want to connect bitcoins to my blockchain token project, what should I do?
A: Open the app, add your token using the custom token form. Then offer an order for sale. Press the share button and copy the link to the payment form. Upload it to the website. Do not turn the app off.
Q: What is the difference from Lightning and Raiden?
A: We use Lightning as well, add an orderbook and a reputation system. Thus, the product becomes more complex and cryptocurrency-oriented. Furthermore, it is necessary to open a channel for Lightning, while we are making the on-chain system, that is, money can be used at once unlike Lightning where the channel must be closed beforehand.
Q: How can your project help my project if we already accept bitcoin and listing on your platform gives us nothing (no volumes)?
A: It will be a simple news opportunity.
Q: What is your difference from BitShares, WavesDEX, etc.?
A: Most use gateways accepting currency and issue unsecured tokens (such as BTC > dexBTC) that can be used for trade in another blockchain. There is no guarantee that the gateways will accept the tokens back.
Q: I am a market maker. Most exchanges are ready to remove fees, what bonuses can you offer?
A: You don’t have to keep the volume on our system.
Full list of features
- Wyre Bitcoin Wallet: a second level protocol and a platform implementing cross-blockchain swaps of cryptocurrencies
- using hashed timelock contracts (the base of atomic swap, Lightning network)
- the basis of bitcoin is the integrity of private property, we support the principle
- purpose: the period between sending from a wallet and deposit in another blockchain is 1 minute.
- 95% of cryptocurrencies are supported (because of ERC20)
- Automatic market maker
- Convenient UX
- A direct exchange is possible via a link
- it does not require its own blockchain, it works using existing ones
- exchange is possible in 20 seconds if there is mutual trust
- works directly from the browser
- BitcoinJS, web3, ipfs.js are used
- the use of Lightning is planned
- solution for fiat
- planned: Lightning network wallet
- planned: Monero swaps
- 0% fee (not for everybody)
- works in browsers (excellent for mobile users)
- planned: lending, margin trading