---
# System prepended metadata

title: <center><i class="fa fa-edit"></i> 4.4 Online Wallets and Exchanges </center>
tags: [Blockchain]

---

# <center><i class="fa fa-edit"></i> 4.4 Online Wallets and Exchanges </center>
###### tags: `Blockchain`
The following notes are taken from [Coursera](https://www.coursera.org/learn/cryptocurrency/home/week/2)

---
### Online Wallet
- Like a local wallet but "in the cloud"
- Runs in your browser
    - Site sends code
    - Site stores keys
    - Log in to access wallet

### Onliine Wallet Tradeoffs
- Convenient
    - Nothing to install, works on multiple devices
- Security worries
    - Vulnerable if site is malicious or compromised
- Ideally, site is run by security professionals 

### Bank-like Services
- You give the bank money (deposit)
- Bank promises to pay you back later, on demand 
- Bank doesn't actually keep your money in the back room
    - Typically, bank invests the money
    - Keeps some around to meet withdrawals (fractional reserve)

### Bitcoin Exchanges
- Accept deposits of Bitcoins and fiat currency ($, €, …)
    - Promise to pay back on demand
- Lets customers:
    - Make and receive Bitcoin payments
    - Buy/sell Bitcoins for fiat currency
        - Typically match up BTC buyer with BTC seller

**What happens when you buy BTC?**
- Suppose my account at Exchange holds $5000 + 3 BTC
- I use Exchange to buy 2 BTC for $580 each
- Result: my account holds $3840 + 5 BTC
- Note: no BTC transaction appears on the blockchain
- Only Effect: Exchange is making a different promise now 

**Pros:**
- Connects BTC economy to fiat currency economy
- Easy to transfer value back and forth

**Cons:**
- Risk
- Same kinds of risks as banks
    - Bank run: everyone shows up wanting money back
    - Ponzi scheme: owners of banks might be crooks
    - Cyber attack: penetrate security of exchange

### Bank Regulation
- For traditional banks, gov typically:
    - Imposes min reserve requirements (3-10% in US)
        - Must hold some fraction of deposits in reserve
    - Regulates behavior, investments
    - Insures depositors against losses
    - Acts as lender of last resort

### Proof of Reserve
- Bitcoin exchange can prove it has fractional reserve
    - Fraction can be 100%
- Prove how much reserve you're holding
    - Publish valid payment-to-self of that amount
    - Sign a challenge string with the same private key
- Prove how many demand deposits you hold
    - Merkle tree with subtree totals
        - ![](https://i.imgur.com/szk9Kox.jpg)
        - Check is still show O(log n) items
:::success
**Summary**
- Prove that you have at least `X` amount of reserve currency
- Prove that customers have at most `Y` amount deposited
- So reserve fraction `≥ X / Y`
:::