Note: This is not an official Bancor Yellow Paper. Richurd Smarth wrote this post to summarize the Bancor Protocol and the contents of this post are not officially endorsed by the Bancor team. Richard is an employee of BlockchainIL (https://www.blockchainil.com/) which provides consulting services to the Bancor Foundation.
Abstract
Bancor is a decentralized network that provides automated and continuous liquidity for over 100 ERC-20 Tokens. Bancor enables anyone to create a Smart Token - a cryptocurrency which can hold balances of one or more tokens within its smart contract as connected “reserves” — essentially creating relationships between tokens in the network using smart contracts. Any token in the network can be converted to any other token in the network by depositing to and withdrawing from these reserves, at rates that are calculated by the smart contracts using the transparent Bancor Protocol formula. Instead of using a traditional buyer/seller matching system to facilitate price discovery and exchange, Bancor utilizes its own unique algorithm to allow smart contracts to buy from and sell to users at predictable rates which are continuously recalculated based on demand. The transactions are made possible by utilizing the stored token reserves within the smart contracts and the Bancor Formula which uses their real-time supply and the requested transaction volume to accurately price any token conversion. When tokens are being purchased, their price gradually increases according to the formula. When tokens are being sold, their price gradually decreases according to the formula. The greater a smart token’s supply and reserve balance(s), the lower the impact of any given transaction on its price. Because of this algorithm, tokens using the Bancor Protocol will always have access to liquidity at a predictable price, based on actual demand (as represented by real transactions.) Bancor currently pre-sets its gas-price so that transactions happen within 1–2 minutes. This allows transactions to be processed with minimal slippage because it works outside of the buyer/seller method, which can produce unpredictable price fluctuations according to the traditionally used bid/ask order book. The Bancor Network uses a decentralized architecture, meaning that no user or Smart Token reserve funds are stored within the network, and users and Smart Token creators are always able to access their tokens through third -party wallets such as MEW, using their own keys and passphrases, which Bancor also does not store.
Market Terms
What is BNT?
BNT is the symbol for the Bancor Network Token. BNT is the world’s first Smart Token™. BNT is the hub token that connects all tokens in the Bancor Network, allowing every token to be easily convertible to every other token via one efficient conversion transaction. BNT’s smart contract holds a reserve balance in ETH, and tokens joining the Bancor Network hold a reserve balance of BNT in their smart contracts..
BNT can always be purchased simply by sending ETH to an address — which instantly issues BNT tokens back to the sender, according to its current price, using the formulas in the Bancor Protocol white paper. Selling BNT for ETH is always possible as well by using the same method - sending BNT to an address and automatically receiving ETH back to the sender’s wallet, at the rate calculated by the Bancor Formula. The total circulating supply of BNT is dynamic, as new BNT tokens are created when they are purchased by sending ETH to the smart contract, and existing BNT is destroyed when it is sold by sending BNT to the contract in exchange for ETH.
What is a Liquid Token?
A Liquid Token™ is a new type of cryptocurrency invented by Bancor. Liquid Tokens are built on smart contracts with “connectors” to other tokens. These connectors are essentially reserve balances of other tokens, held by the Liquid Token’s smart contract. These balances allow Liquid Tokens to be bought and sold for any tokens to which they are connected by simply depositing to and withdrawing from their reserves. The prices at which Liquid Tokens can be bought and sold for other tokens they are connected to are calculated by the Bancor Formula, and continuously adjust to reflect real-time supply and demand for each token, based on its particular supply, reserve balance and size of requested transaction at any given time.
What is Gas?
Gas is the unit used to measure the fees required to execute a particular computation on the Ethereum Network. In Bancor, token conversions require computations on the Ethereum Network which incur fees paid in gas to Ethereum Network “miners” (explained below).
Before we delve into how gas works, it’s important to understand why it is necessary. Ethereum is a Turing complete computing language that can simulate any computer algorithm, including loops. If there were no gas fees, a malicious actor could easily try to disrupt the Ethereum Network by executing an infinite loop within a transaction, without any repercussions. Thus, fees protect the network from deliberate attacks. This could be similar to charging a small fee per email sent in order to prevent spam.
Gas is charged based on the relative complexity of the computing operation requested. For example, adding two integers is less computationally intensive than multiplying them together, so addition requires less gas than multiplication to execute on the Ethereum Network.
Gas price is the amount of Ether a user is willing to spend on every unit of gas, and is measured in “gwei.” “Wei” is the smallest unit of Ether, where ¹⁰¹⁸ Wei represents 1 Ether. One gwei is 1,000,000,000 Wei.
Gas limit represents the maximum gas that a user is willing to spend on a transaction. If the user has enough Ether in their account balance to cover this maximum, the user is refunded for any unused gas at the end of the transaction, exchanged at the original rate. In the case that the user does not provide the necessary gas to execute the transaction, the transaction “runs out of gas” and is considered invalid. Additionally, a record of the transaction failing is recorded, showing what transaction was attempted and where it failed. Since the machine already expended effort to run the calculations before running out of gas, none of the gas is refunded to the user.
Bancor currently uses a fixed gas recommendation in order to simplify the user experience of executing token conversions in the Bancor Network, and to prevent as many as possible from failing, resulting in lost gas to the user. By having the gas settings fixed, we eliminate the problems of frontrunning and market manipulation.
What is Price Slippage?
Price slippage refers to the difference between the expected price before a transaction is executed and the actual price at which it is executed.
Slippage occurs on the Bancor Network due to the dynamic variables of the Bancor Formula. Every transaction changes the price slightly, either up or down. The larger a given transaction’s size relative to the liquidity depth of the requested token, the higher the price slippage. Read more on liquidity depth below.
Because transaction prices are determined based on the real-time variables at the moment of execution, the actual price at the time of execution may vary from the expected price at the time the conversion was requested, depending on which other transactions were executed in this time.
Bancor allows users to set a Minimum Price they will accept for each transaction in order to improve the user experience and minimize any difference in expected prices, which still benefiting from on-chain real-time settlement. Read more on the minimum return feature below.
What is Liquidity Depth?
Liquidity depth represents the amount of BNT tokens that exist in a Liquid Token’s connector balance. This value can be used to calculate price slippage when buying and selling tokens through the Bancor Network. A token with a high liquidity depth relative to the size of a requested transaction will experience a lower price slippage during the transaction. In other words, buys and sells will affect its price less.
The effective price slippage for a given transaction can be easily estimated by dividing the size of the transaction by the liquidity depth of the requested token. For example, say token XYZ has a liquidity depth of $100,000 and a user wishes to buy $5,000 worth of XYZ. The estimated price slippage would be:
In other words, if XYZ token's price before this transaction is $1, the effective price for this purchase will be $1.05.
As a comparison, If token XYZ had a liquidity depth of $500,000, the same $5,000 transaction would result in 1% price slippage.
What is Minimum Return?
Minimum return is a value that a user can optionally include with every conversion transaction. This value is the minimum number of tokens you will accept in return for the tokens you are converting. If the real-time conversion price when your requested transaction is executed results in less than this value, your transaction will not be executed, and your gas will be returned. This feature serves as a protection mechanism for cases when the price of a token changes rapidly, allowing users to “abort” transactions that would be outside of their acceptable range of uncertainty.
Imagine a case in which a user wishes to convert 1 ETH and expects to receive 100 BNT in return. In such a case, they can set the minimum return to 90 BNT indicating that if the rate changes during the execution process to the point where they will receive less than 90 BNT as a result of the conversion, they no longer wish to execute the conversion and the transaction will not be executed.
What is a Relay Token?
A Relay Token is an ERC20 compliant Smart Token that is configured with two reserves, one that holds a balance of BNT and one that holds a balance of another ERC20 token. A Relay Token enables conversions between BNT and the ERC20 token using an on-chain transaction in the Bancor Network. Because BNT can be converted into any other token in the Bancor Network, the ERC20 token can now also be converted to any other token, in another (immediately subsequent) on-chain transaction.
How to create a Relay Token
Anyone can create a Relay Token including but not limited to the original issuer of the connecting ERC20 token. A Relay Token creator sets up a Relay Token by depositing an amount of BNT in one address and another amount of an ERC20 token in another address, and then creating a smart contract that points to the two addresses. The Relay Token creator maintains custody of the connected token addresses and the Relay Token smart contract to ensure the distributed design of the Bancor Network.
A Relay Token may be optionally configured by its creator to take a fee from each token conversion it executes in the Bancor Network. Each conversion fee that accrues in a Relay Token is deposited to (and increases) one of its connected token balances. If the market value of either of a Relay Token’s connected tokens drops, the value of the Relay Token itself will drop, assuming the decline in price of the connected token in question is larger than the accumulated conversion fees, or the increase in price of the other connected token.
How to Buy a Relay Token
Anyone can buy a Relay Token by sending any amount of either of the connected tokens to the Relay Token’s address, and receiving the corresponding amount of Relay Tokens in return, based on the Bancor Formula. Each purchase of a Relay Token generates new units of the Relay Token, while each sale of a Relay Token destroys the existing units being sold. When buying or selling a large amount of a Relay Token relative to its liquidity depth, it is recommended to do so in increments, alternating between each connected token. This is because the Relay Token will constantly adjust prices based on the transaction, changing the ratio of prices between each connected token and the Relay Token. This price slippage in large conversions can be partially offset by executing the transaction incrementally, allowing prices to adjust gradually.
Currently, Relay Tokens use a standard 50/50 ratio configuration between their two connected tokens. For example, if a Relay Token holds 100 BNT and 100 XYZ tokens, and both BNT and XYZ token prices are $1 on the market, this means that the Relay Token’s total value is $200. See “Example 2” in the Relay Token Examples Spreadsheet . If the ratio between BNT and XYZ was not pre-set to 50/50, the higher weighted token’s price would have a greater effect on the Relay Token’s total value. It is currently not possible to configure Relay Tokens with a non standard ratio in the Bancor Network.
(As a comparison, if BNT is $2 and XYZ is $1, the Relay Token’s value is $300)
How Relay Tokens Process Token Conversions
A Relay Token is an ERC20 token that is configured with two connected tokens in its smart contract. You can think of a Relay Token as a smart contract that manages two different buckets of tokens. Each bucket contains an amount of an ERC20 token. These buckets are set to an initial price when the Relay Token is created. The Relay Token always considers the value of both buckets to be equal (according to its preset 50/50 ratio setting), no matter what. For simplicity’s sake, let’s say one bucket contains 1 BNT and the other bucket contains 1 XYZ, and 1 XYZ = $1.00, so 1 BNT = 1 XYZ = $1.00.
Now say you want to convert 5 BNT for some XYZ. You send 5 BNT to the Relay Token address, which adds the 5 BNT to the Relay Token’s BNT bucket(making the balance 105 BNT). The Relay Token will then return to the user 5 XYZ which it withdrew from the Relay Token’s XYZ bucket (making its balance now 95 XYZ).
Remember that even though the amounts in the buckets have adjusted, the Relay Token still considers the two buckets equal in value and will calculate the value of each token according to that formula, so now the prices of each token are as follows:
105 BNT = 95 XYZ
1 BNT = $1.05
1 XYZ — $0.95
As you can see from the example above, every transaction changes the conversion rate between the connected tokens in a Relay Token. This ensures that the balances held in the connectors cannot mathematically ever be depleted. As the supply of tokens on one side of the balance is reduced, the exchange rate between the two sides increases so that it will never reach zero.
Another benefit of this model is that the demand of any one side of the balance dictates its price relative to the other side. When the supply of one connected balance is reduced, its price increases. As with all Smart Tokens, when a Relay Token’s calculated conversion rates differ from prices on other exchanges, traders are incentivized to act as “liquidity movers” between the Relay Token and other exchanges, ensuring conversion rates represent “real” market prices over time.
Product Section (w/ links)
Bancor Wallet — Enables users to buy, store and manage any ERC20 token and offers built-in access to token conversions with instant on-chain settlement between any token on the Bancor Network.
Tokens with the highest 24-hour volume in the Bancor Network (8/7):
BNT https://www.bancor.network/communities/5967699a4a93370018b7b891/currency
KIN https://www.bancor.network/communities/5a1d8d69171b01000182777c/currency
BAT https://www.bancor.network/communities/5a1fd4ee31b0890001c2b93e/currency
BABB https://www.bancor.network/communities/5a9f8403ad1988000122eae0/currency
RVT https://www.bancor.network/communities/5ac0b6a6fdb5b6b9ec5010cc/currency
Vision / Brand Values
Bancor’s goal is to provide continuous and accessible liquidity to all tokens that wish for it. In an expanding world of decentralized applications, where currencies can be created by anyone with access to the Internet, Bancor works to resolve the crisis of illiquidity - or transactional friction - between an increasing number of potential tokens. Currently, Bancor is working on cross-chain functionality to extend its automated liquidity network to emerging blockchain ecosystems. Entrance barriers, such as expensive listing fees, tedious voting processes or high volatility costs for users, restrict liquidity to a subset of the potentially viable tokens. Bancor does not charge listing fees and utilizes the Bancor Protocol method of exchange, which levels the playing field for buyers and sellers of tokens by replacing the order book, and thus volatile bid/ask matching, with a transparent and predictable smart contract. Anyone can add any ERC-20 compatible token to the decentralized network quickly and easily. As the Bancor Network expands to include more tokens within and outside of the Ethereum Network, more and more token communities will benefit from automated liquidity and the benefits to users it provides.
You can read more about how to add your token to the Bancor Network here — How to Get Your Token Listed on Bancor
Interesting, I started reading up more about smart tokens and had no clue that BNT is the first one of its kind.
A good overview of Liquid Tokens, hopefully atomic swaps will become the industry standard for dexs and wallets in the future.