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

COMP90088: Cryptocurrencies and decentralised ledgers Semester 1 2022
Tutorial Sheet, Week 6/7
For tutorials on April 8, 2022 and April 12-14, 2022
1. Pre-mines: Many altcoins launch with a lockup period for pre-mined tokens, where they cannot be traded for a certain period of time (and often gradually become tradable after a vesting schedule). Remember that pre-mined coins are often allocated to founders and a foundation to support development:

Copyright By PowCoder代写 加微信 powcoder

a. What is the advantage of having a lockup period?
b. What might go wrong if the lockup period is too long or too short?
2. Atomic swaps: Imagine that there are two chains, PancakeChain and WaffleChain, and Alice and Bob want to perform an atomic swap between the chains. Consider pseudocode for a simpler variant of the symmetric atomic swap function described in class. Unlike the version in class, this requires only one transaction on each chain:
Transaction 1 (on PancakeCoin chain)
Transaction 2 (on WaffleCoin chain)
Before time T_1:
¡ñ SignaturebyK_A
¡ñ xsuchthatH(x)=y After time T_1:
¡ñ SignaturebyK_B
Before time T_2:
¡ñ SignaturebyK_B
¡ñ xsuchthatH(x)=y After time T_2:
¡ñ SignaturebyK_A
a. This version was not possible with the original Bitcoin script mechanics. What feature was added which made this simpler version possible?
b. Given the scripts above, does Alice originally hold PancakeCoins or WaffleCoins?
c. Which transaction should be posted first? What happens if the order is swapped?
d. How should T_1 and T_2 be selected?
e. In practice, how should Alice and Bob select the magnitude of the difference |T_1 – T_2|? What can go wrong if this value is too small? What can go wrong if this value is too large?
f. What can go wrong if the same value x is used for multiple runs of the protocol?

3. Solidity modifiers: Consider the following Solidity function:
address owner;
function withdraw() public owner_only {
payable(msg.sender).transfer(this.value);
a. Does the withdraw function need to be marked payable?
b. Can the withdraw function be marked as view and/or pure?
c. What visibility level (public/private/internal/external) should be applied to
the member variable owner?
d. Finally, consider the following implementations of the owner_only modifier. Which will
actually be secure? Which is best practice?
i. modifier owner_only {
require(msg.sender == owner_address);
ii. modifier owner_only {
if (msg.sender != owner_address)
iii. modifier owner_only {
vi. modifier owner_only {
if (msg.sender != owner_address)
iv. modifier owner_only { _;
require(msg.sender == owner_address)
v. modifier owner_only {
if (msg.sender != owner_address)
return; _;
if(msg.sender == owner_address)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com