The database doesn't need to contain account balances or funds so long as it contains credentials necessary to access them.
The database doesn't need to contain account balances or funds so long as it contains credentials necessary to access them.
For example, Curve.fi meets the common definition of "decentralized exchange", and as such does not store credentials, etc in a centralized database. Their code is deployed to Ethereum and runs on Ethereum, so users are able to make trades against it, deposit funds into trading pools, etc, all without having a central actor hold credentials.
That said, Curve.fi can still cause users to lose funds if they have bugs in their code, but they do not have the risk of someone stealing passwords from their server and walking away with the money.
So if they get hacked and the credentials to upload code get stolen, what happens? Wouldn’t the hackers be able to deploy code that steals users crypto?
This is easily accessible information. Google it or ask an LLM. Don't just spew speculation into the void. You don't need to be a "smart contract expert" to use Google.
Just because smart contracts can be made immutable, doesn't mean contracts are commonly deployed that way, and even when they are, developers need a way to get people to use newer versions of immutable code (like uniswap v1 to v2).
Generally immutability is better for security reasons, but proxy contracts are useful if someone is testing in production. There have been cases of immutable contracts with bugs that locked millions of dollars of cryptocurrency with no recovery possible.
Here's USDC on Ethereum, for example: https://etherscan.io/address/0xa0b86991c6218b36c1d19d4a2e9eb... – you can clearly see the upgrade mechanism that will allow anyone that knows the admin key to swap out the contract for anything they like.
The cryptocurrency ecosystem's idea of decentralization in a nutshell.
The standard decentralized setup is this:
1. Developers write a smart contract that does something. For example, a token exchange to trade tokens, or a derivatives exchange to trade exposure to tokens/real world assets/etc.
2. Developers publish the source code for this smart contract, deploy it to the chain, and, with the leverage of basic cryptography, make it impossible to change the code --- make it immutable.
3. Anyone who now comes along to use their smart contract does not have to trust the developers because they can 1) read through the open source code and 2) verify that the open source code they are reading is the same as the code deployed on chain. Of course this does not eliminate the risk of unforeseen bugs in the smart contract, which is known as "protocol risk."
If you say you are building a decentralized exchange, that is what you're doing. Otherwise, you're arguably committing fraud.
Many companies want to build financial primitives like decentralized exchanges, hopefully because they think that's where the future will lead and ultimately because there is a lot of money to be made. However, companies must comply with the rules and regulations of the jurisdictions in which they operate. These regulators nearly always insist on the ability to intervene. This creates a slightly different setup:
1. Same as above
2. Same as above, but strikeout the "make immutable" part and leave in an "upgrade authority" backdoor, which allows the code of the smart contract to be replaced (avoiding semantics). This upgrade authority can be gated by a multi-sig, requiring m of n keypairs to sign for new code to be deployed.
3. Often the code is still published, but there are many cases where the code remains closed-source.
The original commenter said this, in paraphrase:
> If you get access to the deploy keys to a decentralized exchange, can't you just deploy new code and take all the funds?
The answer is "no" because a decentralized exchange is immutable. If it were not immutable, then it would not be a decentralized exchange.
If, however, the exchange was not actually decentralized, but fraudulently claimed to be, then yes, you can do exactly as the original commenter speculates.