代写代考 COMP90088: Cryptocurrencies and decentralised ledgers Semester 1 2022

COMP90088: Cryptocurrencies and decentralised ledgers Semester 1 2022
Tutorial Sheet, Week 12 Week of May 23, 2022
1. Off-chain payment networks. In class we discussed the use of payment channel networks to improve Bitcoin scaling. Consider two possible network scenarios for a group of N users. In a distributed model, all users have a channel with all other users. In a hub-and-spoke model, all users have one channel with a central hub.
Assume all payment channels are bidirectional. Each has an initial capacity, the maximum the balance can deviate from zero in either direction. If a payment is executed which increases the channel balance to capacity, the channel is reset. We¡¯ll consider a simple model where every second, a random user sends 1 unit to a different random user. Assume there are N users total and each user is willing to put M total coins on deposit.

Copyright By PowCoder代写 加微信 powcoder

a. For each scenario, how many channels will be required for N users?
b. For each scenario, what will be the bidirectional capacity of each channel be assuming the M coins per user are divided equally between each channel? Note: remember that
to open a channel with bidirectional capacity X, 2X coins must be put on deposit.
c. For each scenario, for what fraction of random payments will a given channel be used?
a. For each scenario, compute the long-run scalability improvement over processing all
payments on-chain. That is, compute the ratio of the number of on-chain transactions required to the number required if all payments appeared on-chain. Remember that resetting a channel requires two transactions.
Hint: A useful fact from the theory of random walks is that the ¡°time to complete¡± (starting from 0) with upper and lower boundaries (n, -m) is nm. For example, in a single channel of capacity n with random payments back and forth, an average of n2 payments can be made before one will push the balance to ¡Àn, requiring a channel reset.
d. What are some disadvantages of the hub-and-spoke model?
e. Why is the random payment model in this question unrealistic? Briefly describe how you
might improve efficiency by taking advantage of a more realistic distribution of payments.

2. Ethereum micropayments. In class we saw a protocol for serial micropayments in Bitcoin: Alice wants to send a series of payments to Bob, so she puts n units of currency into an escrow account which is a multisig account shared by Alice and Bob. She then repeatedly signs transactions, the first paying 1 unit to Bob and returning n-1 to Alice, the second paying 2 units to Bob and returning n-2 units to Alice, and so on. Alice stops sending transactions whenever she wishes, and Bob can sign and publish the last transaction received. A time-locked refund transaction is used to ensure Alice can recover her money if Bob goes offline.
Let¡¯s consider solving this problem in Ethereum. It is very easy to implement the above logic. We can actually add a cool feature: each micropayment need only require hashing, rather than signatures. This is perfect for lightweight clients (although initialization will require a signed message). The scheme works as follows: Alice picks a random X and computes Y = Hn(X) [that is, iterate the function H n times starting at X, e,g., for n=2 we have Y = H(H(X))]. She then creates a contract with n units of currency and embeds the value Y in the contract (and sends Y to Bob). To pay Bob k units (for kCS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com