How my exchange project battles market manipulation...

in Project HOPE3 years ago

I don't write a lot... When I write, it's almost always about something I have been working recently.

Some people might have already read about my project that will bridge all cryptocurrencies and smart contract platforms together.

The basic principle is that for each cryptocurrency pair, there is software that monitors both block chains for special transactions that have embedded metadata that contains address that belong to the other block chain. When that transaction has enough confirmations (for example 10), the software will make transfer on the other chain using specific rules (minimum amount, conversion rate). Every transaction is logged to if the scanning has to be restarted from earlier block height, no conversion transaction is sent twice. If sending fails, it is re-queued.

To reduce the size of the address, sometimes the address is decoded using Base58 algorithm or using modified hexadecimal to binary algorithm that preserves difference of a-f and A-F, so for example checksum on Ethereum addresses are preserved.

Conversion rate can be hard coded either in the software monitoring the block chains, or utility contract that holds balance for two different tokens.

Utility contract can also utilize own balances of the two token contracts to calculate conversion rate. Basically the transferred amount is added to the balance of source token and that amount is first compared to balance on the second token and then multiplied by transferred amount to get amount of tokens to get in the destination token contract.

For example, if source token has balance of 100, the transferred amount is also 100 tokens and the destination token has balance of 200, the ratio is 200/200, which means user gets same amount in destination token, so the user gets 100 tokens.

For example, if source token has balance of 100, the transferred amount is 1000 token and the destination token has balance of 200, the ratio is 1100/200, which means for every 11 tokens sent, the user gets 2 tokens, so in total the user gets 181 tokens (decimals are truncated).

To battle against draining the balances, the initial token amounts held by the contract must be high enough. The fee taken by the contract for each swap can be altered but it will take effect after any pending swaps are processed by blockchain. To "kill" the utility contract, fee can be set to 100%.

Coin Marketplace

STEEM 0.27
TRX 0.11
JST 0.030
BTC 71023.23
ETH 3852.08
USDT 1.00
SBD 3.49