3

Do they write wrappers around bitcoind or is there a better solution out there? Some exchanges handle dozens of digital currencies, does this mean they are running bitcoind, litecoind, dogecoind, etc concurrently?

2 Answers 2

1

From an exchange's perspective, the best option would be to write mostly your own software. From a technical perspective, an exchange only has to fulfill the following in order to be accepting a crypto-currency:

  • Must allow deposits of Bitcoin or coin the exchange claims to accept.
  • Must allow withdraws of Bitcoin or coin the exchange claims to accept.

Normally bitcoind or the altcoin variant of it, litecoind, dogecoind, etc., take care of both for a user of a crypto-currency. But an exchange has special demands. Here are some issues I can think of that may happen to an exchange if they used the core client.

  • Core clients are not designed to work in a multiple server environments, something vital for large exchanges.
  • Private keys and corresponding addresses need to be stored under special conditions. An exchange may want add a username along with an address or even reuse addresses for efficiency.
  • Core clients aren't exactly lightweight. An exchange doesn't need a lot of features commonly packaged together with a core client. As an example, accounts; it's purely for organizing money cosmetically, something exchanges don't need.
  • Core clients don't allow for more intricate control of transactions or other components, SatoshiDice is impossible to create using bitcoind because it require manipulation of transaction inputs to create sends, something you can't currently do with bitcoind.

So what should an exchange be doing?

Using a combination of the two, or even ditching the core client. There are many programming libraries that simplify all aspects of Bitcoin technology, libbitcoin is a C++ library that allows you to make a partial or full node in no time. SatoshiDice is constructed on BitcoinJ, a popular Java library for Bitcoin. There are also many libraries available for other languages, but the point is that building a node isn't too hard.

I recommend a hybrid use because bitcoind is a lot more safe and bug-free than your own code. You can accidentally create code that creates invalid transactions or even accidentally send coins to the wrong address. I'd use a library and my favorite language to detect deposits and accredit them to accounts, and then push raw transactions to a bitcoind instance running on my own or possibly the same server where it will validate it and take care of sending it other nodes in the network. Less space to mess up in code.

For altcoins, you'd need an instance running or just doing small modifications to the code to differentiate. There isn't a huge difference between the protocols all the crypto-currencies use. You should know anyways if you're planning to accept a coin as an exchange.

TL;DR

Exchanges should be using software they wrote themselves. This isn't hard to do as there are many libraries available that give you nitty-gritty access to Bitcoin. Core clients can be a bottleneck at times but can be used in conjunction to avoid said bottlenecks while maintaining a safety net for an exchange and can even simplify certain parts.

3
  • Thanks for the answer, but this all sounds like speculation. Mar 25, 2014 at 3:33
  • 1
    That's true it is an educated guess on what they should be doing. No exchange has detailed how their wallets works precisely but the approach I've explained is really efficient and likely. For all we know they can be using bad implementations like Mt. Gox supposedly did. Hard to prove.
    – John T
    Mar 25, 2014 at 3:40
  • Fair enough, although not an exact answer it's still good information. I read on reddit that a common approach is to interact with the daemons with the json (rpc?) interface. I'm wondering if that is a good solution up until a certain volume of transactions. Mar 25, 2014 at 17:53
0

I don't think exchanges are actually managing wallets for you, for two reasons:

  1. For many cryptocoins, it takes time to transfer funds into a wallet. But when you purchase a certain cryptocoin on an exchange, it immediately ends up in your 'wallet'.

  2. AntShares do not support fractions. You can only own whole units of them in a wallet. When you purchase AntShares on an exchange, you can purchase them in fractions and they will sit in your 'wallet' in fractions. It's not until you transfer them to your own wallet (no quotes) that the decimals will be truncated and you are left with whole units.

My conclusion is that exchanges merely keep records of what you own. These records may be viewed as IOUs. When you withdraw, they will tap into their own wallets.

I don't see how else it could work.

4
  • 1
    You're right concerning balance changes within the exchange, but when the exchanges perform withdrawals these obviously must happen on the blockchains. What do you think do they use to create transactions on various blockchains?
    – Murch
    Jun 25, 2017 at 6:46
  • Also when withdrawing, how they send money from "your exchange address" -> "your withdrawal address" instantly? Because they don't keep it in "your exchange address", and if you withdraw money, you can see that transaction starts from "your exchange address". If exchange first transfers money from "their hot wallet" -> "your exchange address", that would add delay+fee, i don't see such delays? cc @Murch Mar 14, 2022 at 12:34
  • I think they don't send back your money (when withdrawin) from "your exchange address", but from "their hot wallet": support.kraken.com/hc/en-us/articles/… Mar 14, 2022 at 12:44
  • Right, if they first staged the withdrawal in a specific address and then sent it to you, they'd just do two payments when one would suffice.
    – Murch
    Mar 14, 2022 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.