---
# System prepended metadata

title: 'HW 4: Cross-Chain, Wallets, Byzantine, & Privacy'
tags: [Homeworks]

---

---
tags: Homeworks
---

# HW 4: Cross-Chain, Wallets, Byzantine, & Privacy

:::info
**Released:** May 1st, 11:59pm EST
**Due:** May 8th, 11:59pm EST
:::

## Problem 1
Alice, Bob, and Carol want to exchange assets. Which of the following protocols are atomic swaps? Don't worry about who's getting which asset. You only need to make sure that the swap is correct. We strongly recommend you draw out these graphs.
:::info
**Hashed Time Locks:** 

**HTLC:** (hashlock, escrower, redeemer, delta)

**Ex:** $(H_0, Alice, Bob, 6\Delta)$ 

The hashlock is $H_0$, and Bob must provide the secret $S$ such that $H(S) = H_0$ before $6\Delta$ have passed to redeem Alice's asset.
:::

- [ ] Protocol 1, where Alice is the leader:
    - $(H_0, Alice, Carol, 10\Delta)$
    - $(H_0, Bob, Alice, 4\Delta)$
    - $(H_0, Carol, Bob, 8\Delta)$
- [ ] Protocol 2, where Carol is the leader:
    - $(H_1, Carol, Bob, 8\Delta)$
    - $(H_1, Bob, Alice, 5\Delta)$
    - $(H_1, Alice, Carol, 2\Delta)$
- [ ] Protocol 3, where Bob is the leader:
    - $(H_2, Alice, Bob, 4\Delta)$
    - $(H_2, Bob, Carol, 7\Delta)$
    - $(H_2, Carol, Alice, 6\Delta)$
    
    

## Problem 2
Practical Byzantine Fault Tolerance ensures both the liveness and safety assumptions. One such implementation is the "Hot Stuff Protocol," as described in lecture.

:::    warning
**NOTE (05/03/23) :** In previous versions of the slides, Maurice talked more extensively about the HSP in particular, but in the later slides opted for more general discussions about BFT and consensus.

While most of these questions have the same answer for most/all protocols that hope to be Byzantine Fault Tolerant, we have decided to throw these questions out of grading (or rather, you will get them automatically right regardless of answer) for the sake of fairness.
:::


#### Which of the following statements are in accord with the "Hot Stuff Protocol"?

- [ ] Validator V votes to commit block B, then block C at height $k+11$, then block D at height $k+10$. 
- [ ] Suppose there are 3 dishonest validators in a quorum of 9. Given they are voting on block $B$, $B$ will receive a quorum certificate.
- [ ] There is a quorum of 9 validators. They are deciding on conflicting blocks $A$ and $B$, which both have height $k$. Both receive valid Quorum Certificates, having received at least $2f+1$ votes.

## Problem 3
Suppose  the MTAs decide that all HTAs and UTAs should now be paid in Bitcoin, rather than USD. After all, Bitcoin is far superior to USD. Currently, there are only two courses at Brown: cs1951-L and cs1760. 

:::info
**`OBJECTIVE`:**
cs1951-L and cs1760 should be completely separated, but the MTAs should be able to see information from both courses.
:::

1. The MTAs can see how much the HTAs of cs1951-L and cs1760 make.
2. The HTAs of cs1951-L can't see how much the HTAs of cs1760 make.
3. The MTAs can see how much the UTAs of cs1760 make.
4. The HTAs of cs1951-L can see how nuch the UTAs of cs1951-L make.
5. The HTA of cs1760 can see how much the UTAs of cs1951-L make.
6. The UTAs of cs1760 can't see how much the UTAs of cs1951-L make (and vice-versa)

#### Do these rules conform to those of a hierarchical deterministic wallet?

- [ ] Yes
- [ ] No

Suppose a third course, cs4000, is added to this schema. The MTAs are good friends with the HTAs of cs4000, so they allow the HTAs of cs4000 to see how much the HTAs of cs1951-L and cs1760 make.

#### Does this break the `OBJECTIVE` of the MTAs described above?

- [ ] Yes
- [ ] No

#### Given that they have access to the salaries of cs1951-L and cs1760 HTAs, the MTAs are unsure whether they are custodians of the BTC in their new wallet system. Should they be regulated by the SEC?

- [ ] Yes
- [ ] No

## Problem 4
Ethereum blocks are often full of "whale" contracts---calls that occupy most of the transaction space on a block and computation power of the consensus committee. This is to the detriment of simpler transactions, severely limiting Ethereum's throughput. Algorand solves this problem by diverting "whale" contracts to a contract committee prior to them reaching the consensus committee.

#### Which of the following statements are true?

- [ ] Validation of transaction signatures can occur statically before they reach the validators, saving some time on the validation end.
- [ ] Only the leader of the consensus committee can fill a block with transactions. 
- [ ] The contract committee needs to be larger than the consensus committee, since it requires more computation to validate smart contracts than simple transactions.
- [ ] The certificates provided by the contract committee to the consensus committee are speculative, which is why Algorand has to live with a window of vulnerability in which a layer 1 transaction can falsify a certified batch of effect transactions.
- [ ] Suppose that Alice uses an AMM to convert between APR and BAN tokens. The transfer is certified by the contact committee given an AMM conversion rate of 2.1 (APR to BAN). When the effect transaction makes its way to the consensus committee, that rate has dropped to 1.5. There is no way the transfer can proceed.


## Problem 5

Alice loves two things: movies and Christmas. She recently purchased movie-based advent calendars for the next 20 years. The advent calendar stores an entire HD movie on each December day for Alice to enjoy. 

Her friend Bob is a software entrepreneur who recently bought many servers. Since the business hasn't taken off yet, Bob's servers are currently idling.

Alice decides she'll pay Bob a fee to store her digital advent calendars, since it's currently April and she won't be needing any of them for a while (and some not for quite a while). However, she needs to make sure that Bob is actually storing the collection and not just taking her money. 

Bob and Alice develop a scheme where Alice can challenge Bob's storage, and he can prove he is storing any movie for any of the advent calendars, without ruining the surprise for Alice!

#### Which of the following schemes would allow Bob to prove he's properly storing all of the movies without Alice ever knowing the contents of the movie?
- [ ] While she doesn't know anything else about the movie, Alice knows how large each movie is (in GB) for each (day, year) pairing of her many advent calendars. At any point she can ask Bob about the size of a specific (day, year) pairing, and he must tell her the size of that specific movie.
- [ ] Alice employs her friend Carol to be in charge of all of her movies. So, Carol knows which movie is behind each (day, year) pairing. Up to 10 times over the duration of the storage contract, Carol sends a request to Bob, containing a `(day, year, start_time, end_time)` tuple, where `start_time` and `end_time` define a 5-second clip of the movie. Bob returns the contents of the clip to Alice.
- [ ] Alice uses some open-source software that can make requests on her behalf to Bob, which uses a pseudorandom number generator to create the `(day, year, start_time, end_time)` tuple. The seed of the pseudorandom number generator is publicly known. Alice does not interfere with the software, which sends a request to Bob up to 10 time over the duration of the storage contract. When he receives such a request, he returns the 5-second clip to the software, which validates the clip and tells Alice whether Bob has completed his challenge.

## Problem 6

With the increasing popularity and adoption of cryptocurrencies, the use of crypto wallets has become more prevalent, raising important questions about the ethical implications of using these wallets for financial transactions. **Crypto Wallets are often touted as providing greater privacy and anonymity** than traditional financial systems, but this raises concerns about the potential for illegal activities such as money laundering or tax evasion. At the same time, ensuring transparency and accountability in f**inancial transactions is crucial for maintaining trust in the financial system.**

To further explore the implications of these issues, here are a few use cases and resources that may be of interest. 

[Article 1](https://www.thestreet.com/csuiteadvisors/stories/csq-thought-leader-lars-seir-christensen-can-privacy-in-the-blockchain-be-accountable)

[Article 2](https://fortune.com/2022/10/28/finally-reconcile-privacy-compliance-crypto-new-technology-celsius-user-data-leak-illicit-transactions-crypto-tromer-ramaswamy/)

[Article 3](https://www.financemagnates.com/cryptocurrency/regulation/the-role-of-self-regulation-in-the-cryptocurrency-industry-where-do-we-go-from-here/)


[Article 4](https://www.spglobal.com/en/research-insights/featured/special-editorial/smart-contracts-could-improve-efficiency-and-transparency-in-financial-transactions)

Your task after reading these is to give a **writing response in less than 200 words** about what you think are the **ethical and social considerations should be taken into account when designing and implementing crypto wallets** to ensure user privacy, and how can these considerations be **balanced with the need for security/transparency, regulatory compliance and accountability** in financial transactions?