Zhuang's Diary

言之有物,持之以恒

Problem 1. [18 points]: Questions from all over.

A) Briefly explain why a Rollup system stores all transaction data on chain? What would go wrong if transaction data were discarded and not stored anywhere?

answer - The main goal of Rollup is to increase transaction speed (faster finality), and transaction throughput (high transactions per second), without sacrificing decentralization or security.

Some Rollup solutions are optimistic rollups, zero-knowledge rollups or state channels. Transactions are rolled up into a single transaction to Mainnet Ethereum, reducing gas fees for users making Ethereum more inclusive and accessible for people everywhere. Rollups perform transaction execution outside layer 1 and then the data is posted to layer 1 where consensus is reached. As transaction data is included in layer 1 blocks, this allows rollups to be secured by native Ethereum security. That is why Rollup system stores all transaction data.

So If Rollup system has only one single data storage and its transaction data were discarded, the transaction data before rollup will lose and can not get back. Usually, Rollup system is a blockchain and data saved in decentralized nodes, so original transaction data will not lose when one of blockchain nodes is down or broken.

B) Consider the following Solidity code:

1
2
3
4
5
6
7
8
pragma solidity ^0.8.0; 
contract ERC20 is IERC20 {
mapping(address => uint256) private _balances;
event Transfer(address indexed from, address indexed to, uint256 value);
function _transfer(address sender, address recipient, uint256 amount) {
emit Transfer(sender, recipient, amount);
}
}

Suppose this code is deployed in two contracts: a contract at address X and a contract at address Y . Which of the following can read the state of _balances in contract X? Circle the correct answer(s).

  • A Code in the _transfer() function in contract ERC20 at address X
  • B Code in the _transfer() function in contract ERC20 at address Y
  • C An enduser using etherscan.io

answer C is correct.

C) Continuing with part (B),

which of the following can read the log entry Transfer emitted when the function _transfer() is called? Circle the correct answer(s).

  • A Code in the function getBalance() defined in contract ERC20 at address X
  • B Code in the function getBalance() defined in contract ERC20 at address Y
  • C An enduser using etherscan.io

answer C is correct.

D) Two Ethereum transactions, tx1 and tx2, are submitted to the network at the same time. Transaction tx1 has maxPriorityFee set to y and transaction tx2 has maxPriorityFee set to 2y. Will tx2 necessarily be executed on chain before tx1? Justify your answer. You can assume that maxFee for both tx1 and tx2 is greater than baseFee + maxPriorityFee.

answer - Assume that maxFee (tx1 and tx2) is greater than baseFee + maxPriorityFee, tx1 and tx2 will mine by miner both, they will execute in the same block, that is the most possibility, because usually miner nodes are working for tx order base on gasFee from high to low. But still has other possibilities - 1) send tx1 in node 1, send tx2 in node2, the network of node 1 is bad, and all txs in txpool of node 1 maybe blocked , so the speed and status of network of node is very important for transaction success; 2) the other transactions’ maxPriorityFee, if they all very high than 2y, the block is full and cannot take tx2 in, then tx1 and tx2 will not execute, and their executed order will depends on the next block. Or they all very high than y, the block is full and cannot take tx1 in, but the block take tx2 in, so tx1 will not execute, tx2 will execute.

Catch up high Miner extractable value (MEV) may cause a miner to take priority of a lower fee transaction because it benefits them in some way, it is good for DeFi and application boom, but bad for UX, blockchain network congestion, even make blockchain block order re-organization and consensus instability.

E) Alice wants to buy a car from dealer Bob. She sends 1 BTC to Bob’s Bitcoin address. Bob waits for a transaction where (i) the input is from Alice’s address, and (ii) one of the outputs is a UTXO bound to Bob’s address with a value of 1 BTC. As soon as Bob sees this transaction on the Bitcoin blockchain, he gives Alice the keys, and she drives away. Is this safe? Could Alice get the car for free? If so, explain why. If not, explain what Bob should do to ensure that he gets paid.

answer - In bitcoin with PoW consensus protocol, the tx finality need to wait 6 blocks. so Bob should to wait 6 blocks after the block of tx.

F) Alice owns a brand new Tesla Model Y. Can she currently use her car as collateral for a loan in the Compound system? (without selling the car) If yes, explain how. If no, explain why not.

answer - no, physical car cannot come into digital Compound system yet, because the car maybe bad, maybe broken, maybe stole from somewhere illegally, the car loan needs many kinds of service to confirm its value and price. Compound now only provide cryptocurrencies as collateral for a loan.

KYC & AML

KYC

考虑到数据覆盖率,金融机构会选择2-3家合规机构同时使用。

more traditional DeFi (mandatory KYC)

high yield DeFi (less or no KYC)

Proof-of-Authority is a replacement for Proof-of-Work, already working in production of Ethereum, like OpenEthereum, geth.

This article show path of dev, and move to production steps as my github project: WillZhuang/geth-poa-tutorial: Clique Proof-of-Authority Tutorial (github.com). it is working under Geth v1.10.15.

appendix:

  1. guide about node append / delete : https://geth.ethereum.org/docs/rpc/ns-clique.

clique.propose(address, auth) / clique.discard(address)

  1. Original EIP-225: Clique proof-of-authority consensus protocol (ethereum.org)

  2. benchmark: drandreaskrueger/chainhammer: fire many transactions at Ethereum node, then produce diagrams of TPS, blocktime, gasUsed and gasLimit, and blocksize. (github.com)

CBDC pay attention on PoA:

Digital Currency Implementation Checklist for Central Banks

快问快答

  1. Is the DFC(Digital Fiat Currency) to be a token-based or account-based system, or some combination? Discussion: Account-based systems are actor-centric, while token-based systems are object centric. Each has specific benefits and disadvantages relating to interoperability, (de)centralization, efficiency, and security. The relative merits of the two approaches have been discussed in depth elsewhere in the CBDC and DFC literature, and ultimately depends on the specific needs and goals of the jurisdiction in question. 基于帐户的系统以参与者为中心,而基于令牌的系统以对象为中心。每个都有与互操作性、(去)中心化、效率和安全性相关的特定优点和缺点。这两种方法的相对优点已在 CBDC 和 DFC 文献的其他地方进行了深入讨论,最终取决于相关司法管辖区的具体需求和目标。
  2. Will interest be paid on DFC balances? If so, how much, and under what conditions? Discussion: In contexts where the goal of implementation of DFC is merely to replace physical coins and paper currency, the capacity to pay interest directly on DFC balances is of less importance. Conversely, if the aim of introducing DFC is to precipitate a broader reorganization of the payments system, the ability to pay interest directly on DFC balances may be important to the implementation of monetary and fiscal policy, as well as for preserving technical features of the existing payments system (i.e. the capacity to pay interest on-reserves). 如果引入 DFC 的目的是促成更广泛的支付系统重组,那么直接为 DFC 余额支付利息的能力对于货币和财政政策的实施以及保留现有技术特征可能很重要。
  3. Will DFC funds have durational features? If so, how much, and under what conditions? Discussion: DFC instruments are commonly thought of as a digital equivalent to cash instruments, or a retail-accessible form of digital reserve balances, both of which have zero duration. However, in the modern central banking era, government securities accounts also operate on similar payments and accounts infrastructure. Hence, DFC has the potential to perform other functions that involve duration, such as providing consumer savings and/or investor securities accounts, and also serving as the settlement layer for smart contracts and financial trading platforms. DFC 工具通常被认为是现金工具的数字等价物,或零售可访问的数字准备金余额形式,两者的久期均为零。然而,在现代中央银行时代,政府证券账户也在类似的支付和账户基础设施上运作。因此,DFC 有潜力执行其他涉及持续时间的功能,例如提供消费者储蓄和/或投资者证券账户,以及充当智能合约和金融交易平台的结算层。
  4. Will certain kinds of transactions be prohibited at the technical layer? What?
    Discussion: It is possible to design a DFC system to allow for discrimination and censorship on a transaction-by-transaction basis. Doing so would further a range of law enforcement and security interests. However, such interests must also be weighed against privacy and security considerations. Once the capacity for transactional censorship is hardwired into the DFC infrastructure, it cannot be easily removed and may be used for purposes beyond the initial scope that justified its adoption. 可以设计一个 DFC 系统以允许在逐笔交易的基础上进行歧视和审查。这样做将促进一系列执法和安全利益。然而,这些利益也必须与隐私和安全考虑进行权衡。一旦交易审查能力被硬连接到 DFC 基础设施中,它就不能轻易删除,并且可能用于超出其采用的初始范围的目的。
  5. Will DFC transactions and wallets be usable offline? How? Discussion: While digital payments systems offer many benefits over physical cash, they suffer from vulnerabilities regarding network-connection and power consumption. In order to provide a true substitute for physical cash, some form of offline transaction capacity is crucial. Such capacity is also important in the event of network failure, and/or for actors who exist on the margins of the electric/internet grid. 离线交易是必要的。
  6. Will the DFC intermediary network be an open system, or restricted to a limited number of pre-approved institutions? Discussion: Most DFC systems, at least in the first iteration, will likely incorporate and/or rely on intermediaries to fulfill some core infrastructural functions, from wallet-management through to data-storage. Consequently, it is important for regulators to develop a framework for evaluating and approving potential intermediaries, to maintain quality and security standards while simultaneously avoiding excessive regulations that stifle innovation and widespread adoption. One way of authorizing intermediaries is to subjectively identify and approval specific applicants on an institution-by-institution basis. Another approach is to develop objective standards and criteria and approve any and all actors that meet those criteria. Determining which approach to use (or some combination) will depend on the needs and interests of the specific jurisdiction. 大多数 DFC 系统,至少在第一次迭代中,从钱包管理到数据存储,可能会合并和/或依赖中介来实现一些核心基础设施功能。