Skip to content

Commit

Permalink
general improvements and uk english check (#65)
Browse files Browse the repository at this point in the history
* aib.md grmmar check

* aib.md grammar check

* ccs.md grammar check

* pos.md grammar check

* mev.upd grammar check

* grammar check

* grammar check

* check
  • Loading branch information
aik31 committed Jan 9, 2024
1 parent 7c7efb1 commit 9517558
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
40 changes: 20 additions & 20 deletions blogs/AIB/aib.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions blogs/CCS/ccs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
`````{margin} **Atomic Swaps**
Direct and automatic peer-to-peer (P2P) exchanges of crypto assets on fundamentally different blockchain networks without the use of centralised intermediaries {cite}`miraz2019atomic`.
`````
In the Decentralised Finance (DeFi) landscape, interoperability between disparate blockchain networks is paramount for data and value transmission across chains {cite}`mao2022crosschaintech`. Cross-chain technology has applications in Decentralised Exchanges (DEXs), cross-platform Decentralised Applications (DApps), tokenised real assets, distributed transaction platforms, etc. The technologies need to enable secure and trustless transactions to prevent reliance on centralised intermediaries. To this end, Hash Time Lock Contracts (HTLCs), a form of atomic swaps, are commonly used to achieve cross-chain asset exchange. HTLCs and all other atomic swaps have inherent risks associated with them: (1) value fluctuation during the exchange, and (2) high incentives for malicious agents {cite}`reijsbergen2023crocodai`. An alternative approach is Packetised Payments (PPs) {cite}`robinson2019stanford`, which implement a series of alternating transactions to achieve cross-ledger exchange. This article summarises the recent studies regarding these protocols - unraveling their execution success rate bottlenecks and exploring the proposed solutions {cite}`jiahua2021htlcs` {cite}`jiahua2021pps`.
In the Decentralised Finance (DeFi) landscape, interoperability between disparate blockchain networks is paramount for data and value transmission across chains {cite}`mao2022crosschaintech`. Cross-chain technology has applications in Decentralised Exchanges (DEXs), cross-platform Decentralised Applications (DApps), tokenised real assets, distributed transaction platforms, etc. The technologies need to enable secure and trustless transactions to prevent reliance on centralised intermediaries. To this end, Hash Time Lock Contracts (HTLCs), a form of atomic swaps, are commonly used to achieve cross-chain asset exchange. HTLCs and all other atomic swaps have inherent risks associated with them: (1) value fluctuation during the exchange, and (2) high incentives for malicious agents {cite}`reijsbergen2023crocodai`. An alternative approach is Packetised Payments (PPs) {cite}`robinson2019stanford`, which implement a series of alternating transactions to achieve cross-ledger exchange. This article summarises the recent studies regarding these protocols - unravelling their execution success rate bottlenecks and exploring the proposed solutions {cite}`jiahua2021htlcs` {cite}`jiahua2021pps`.


### HTLCs
Expand All @@ -30,7 +30,7 @@ Packetised Payments start by breaking down transactions into packets. Further, o

## Game Theoretic Analysis

A game theoretic framework is developed to sequentially analyze events in the two protocols and derive probabilities for the success rate of cross-chain exchanges. The detailed version of the below discussion can be found in {cite}`jiahua2021htlcs` {cite}`jiahua2021pps`.
A game theoretic framework is developed to sequentially analyse events in the two protocols and derive probabilities for the success rate of cross-chain exchanges. The detailed version of the below discussion can be found in {cite}`jiahua2021htlcs` {cite}`jiahua2021pps`.

### Game Theoretic Framework for HTLCs

Expand Down Expand Up @@ -58,17 +58,17 @@ It is found that in steps 1 to 3, the greater the range between minimum and maxi
### Key Findings

`````{margin} **Transaction Confirmation Time**
The time between a network receiving a transaction and the transaction getting processed on chain by a miner node.
The time between a network receiving a transaction and the transaction getting processed on the chain by a miner node.
`````
1. **Exchange Rate:** The success of the swap depends on a defined range of exchange rates $P^*$. Deviations from this range significantly impact the success probability. The overall success rate is highly sensitive to the range of values allowed for $P^*$; therefore, the stability and security of HTLCs can be optimised by maximising this range.
2. **Success premium:** This is the measure of how determined each party is to see the swap succeed. Actors with low success premiums would cause a low success rate for the swap and come off as malicious. A high success premium leads to a high success rate and a greater range of feasible $P^*$.
3. **Time preference (r):** Time preference describes an agent’s impatience level - the desire to access assets now rather than later. larger r results in a narrower viable range of values for $P^*$. If r is greater than a calculated critical value, the swap is rendered impossible as no $P^*$ remains feasible.
4. **Transaction confirmation time:** Higher confirmation time on either chain shrinks the viable range of $P^*$ as the increased time taken reduces the transaction utility functions for either or both parties. When $P^*$ is chosen to maximise the success rate, a lower confirmation time increases the success rate.
5. **Price trend and volatility:** A High upward trend of the exchange rate increases the success rate as Alice is highly likely to decide in favor of the final optionality she receives. In contrast, higher volatility reduces the success rate.
5. **Price trend and volatility:** A High upward trend of the exchange rate increases the success rate as Alice is highly likely to decide in favour of the final optionality she receives. In contrast, higher volatility reduces the success rate.

HTLCs experience reoccurring and numerous transaction failures. Hence, it can be stated that existing parameters and success premiums of agents are stacked such that success rates cannot be optimal.

Extending the above game theoretic framework to PPs proves that not only do malicious agents have no incentive to complete transactions, but also that they can enter into multiple transactions in parallel to generate large profits.
Extending the above game theoretic framework to PPs proves that not only do malicious agents have no incentive to complete transactions, but also that they can enter multiple transactions in parallel to generate large profits.

## Optimising Cross-Chain Swaps

Expand Down
12 changes: 6 additions & 6 deletions blogs/FLASHLOANS/flashloans.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Lenders benefit from fee revenue, and borrowing demand boosts overall pool liqui

## Attack Incentives and Methods

Flash lending made its debut in 2018 by the Marble Protocol and quickly found popularity with traders looking to profit off arbitrage opportunities between decentralised exchanges {cite}`aonFlashLoan`. The central incentive for flash loan attacks is to gain substantial profits with minimal risk. Attackers extract value from DeFi protocols before changes are reverted due to failed repayment. Importantly, there is essentially no cost to attempting attacks repeatedly as long as the initial loan is repayed {cite}`coinledgerFlashLoans`.
Flash lending made its debut in 2018 by the Marble Protocol and quickly found popularity with traders looking to profit off arbitrage opportunities between decentralised exchanges {cite}`aonFlashLoan`. The central incentive for flash loan attacks is to gain substantial profits with minimal risk. Attackers extract value from DeFi protocols before changes are reverted due to failed repayment. Importantly, there is essentially no cost to attempting attacks repeatedly as long as the initial loan is repaid {cite}`coinledgerFlashLoans`.

```{figure} images/floan.png
---
Expand All @@ -45,7 +45,7 @@ Typical attack methods include:

- **Price manipulation:** Attackers can use flash loans to manipulate the price of a cryptocurrency by artificially inflating or deflating its value. This can cause significant losses for traders who have placed orders based on manipulated prices.

- **Removal of liquidity/Smart contract exploits:** Draining pooled reserves through flash borrowing to disable markets or deposit contracts {cite}`acmdigitalloan`. Attackers can exploit DeFi smart contract vulnerabilities including reentrancy issues and integer overflow errors by using flash loans. They might be able to carry out more assaults or steal money from the protocol as a result {cite}`hackenFlashLoan`.
- **Removal of liquidity/Smart contract exploits:** Draining pooled reserves through flash borrowing to disable markets or deposit contracts {cite}`acmdigitalloan`. Attackers can exploit DeFi smart contract vulnerabilities including re-entrancy issues and integer overflow errors by using flash loans. They might be able to carry out more assaults or steal money from the protocol as a result {cite}`hackenFlashLoan`.

These techniques combine borrowed capital with issues in incentive design, oracle integrity, and contract logic. Successful attacks across multiple protocols demonstrate how interconnectivity amplifies vulnerabilities {cite}`aaveFlashLoans`.

Expand All @@ -57,17 +57,17 @@ In total, 12 of the top 20 DeFi exploits by profit involved flash loans {cite}`D

## Emerging Defensive Techniques

In response to rampant flash loan attacks, several defensive techniques have emerged. One approach involves transaction monitoring and the detection of common attack patterns, such as rapid pumping and dumping of oracles. This allows for preemptive action against the attack and transaction reversals.
In response to rampant flash loan attacks, several defensive techniques have emerged. One approach involves transaction monitoring and the detection of common attack patterns, such as rapid pumping and dumping of oracles. This allows for pre-emptive action against the attack and transaction reversals.

Another mitigation strategy is to require credit based approval for flash loan usage in a protocol’s smart contracts. While this restricts manipulation using flash loans, it may also compromise the intended flexibility of flash loans. Usage of models like the Recency, Frequency and Monetary model(RFM) which is a marketing technique used to quantify user value based on recency, frequency, and monetary value of purchases. Recency measures how recently a user has made a purchase, Frequency measures how often they purchase, and Monetary measures how much money they spend. Users are segmented into groups based on their RFM scores to identify reliable users.
Another mitigation strategy is to require credit-based approval for flash loan usage in a protocol’s smart contracts. While this restricts manipulation using flash loans, it may also compromise the intended flexibility of flash loans. Usage of models like the Recency, Frequency and Monetary model (RFM) which is a marketing technique used to quantify user value based on recency, frequency, and monetary value of purchases. Recency measures how recently a user has made a purchase, Frequency measures how often they purchase, and Monetary measures how much money they spend. Users are segmented into groups based on their RFM scores to identify reliable users.

At the protocol level, leveraging time-weighted average pricing via oracles helps reduce manipulation, as does using the maximum across multiple oracles. However, oracle designs remain a challenge. Additionally, proposals to share liquidity across central and decentralised exchanges can mitigate the impact of liquidity attacks {cite}`springerTowardsSecure`.

Despite these defenses, the effectiveness remains elusive as attacks continue to grow more sophisticated. Inherent challenges persist in securing economic protocols atop public blockchains that permit open access {cite}`acmdigitalloan`.
Despite these defences, the effectiveness remains elusive as attacks continue to grow more sophisticated. Inherent challenges persist in securing economic protocols atop public blockchains that permit open access {cite}`acmdigitalloan`.

## Conclusion

In summary, flash loans offer both capital efficiency and the potential for manipulation. Numerous DeFi protocols and users have fallen victim to sophisticated attacks, resulting in damages exceeding $750 million to date. Technical and economic solutions are still evolving, but following best practices like third party auditing, re-entrancy guards and credit based checks can mitigate risks of such attacks immensely.
In summary, flash loans offer both capital efficiency and the potential for manipulation. Numerous DeFi protocols and users have fallen victim to sophisticated attacks, resulting in damages exceeding $750 million to date. Technical and economic solutions are still evolving, but following best practices like third-party auditing, re-entrancy guards and credit-based checks can mitigate the risks of such attacks immensely.

It is important to stay updated with the latest best practices and reports as the DeFi landscape is continuously evolving, by following best practices and being vigilant, we can help to build a safe DeFi landscape for everyone.

Expand Down
12 changes: 6 additions & 6 deletions blogs/MEVupd/mevupd.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

```{admonition} Key Insights
:class: tip
- MEV's impact extends beyond transaction ordering profits, influencing network congestion and fee inflation, with miners potentially altering their behavior to chase these extractable values.
- MEV's impact extends beyond transaction ordering profits, influencing network congestion and fee inflation, with miners potentially altering their behaviour to chase these extractable values.
- To reduce the manipulative impact of MEV on transaction order, proposals for including transactions based on objective metrics like gas prices or timestamps are being examined.
- The emergence of specialised roles, including arbitrage traders and bot operators, signifies the development of a sophisticated MEV ecosystem, focusing on the optimisation of transaction placement for maximum returns.
- To enhance the fairness of blockchain networks, new protocols are being developed that aim to level the playing field by minimising the advantages of MEV for miners with greater computational resources.
Expand Down Expand Up @@ -35,15 +35,15 @@ The impact of MEV is significant, particularly on end users who pay transaction

**Frontrunning:** This involves placing the attacker’s transactions ahead of the victim's. For instance, an attacker may offer higher transaction fees to ensure their transaction gets executed first to exploit a rare market opportunity. Block space is sold to non-miner MEV extractors in return for transaction fees through Priority Gas Auctions.

**Backrunning:** In this scenario, the attacker places their transaction right after the victim's transaction to take advantage of the market change initiated by the victim. For instance, if a transaction on Exchange X significantly increases an asset's price, it opens an arbitrage opportunity. Here, the backrunner could purchase the same asset from another exchange, X', at a lower cost and then sell it on X, keeping the price difference {cite}`yang2022sok`. In this scenario, the backrunner's transaction does not harm the user and aids in maintaining price consistency between the two exchanges. In a similar context, backrunning can also be used to capitalise on oracle updates for liquidation opportunities {cite}`qin2021empirical`.
**Backrunning:** In this scenario, the attacker places their transaction right after the victim's transaction to take advantage of the market change initiated by the victim. For instance, if a transaction on Exchange X significantly increases an asset's price, it opens an arbitrage opportunity. Here, the backrunner could purchase the same asset from another exchange, X', at a lower cost and then sell it on X, keeping the price difference {cite}`yang2022sok`. In this scenario, the backrunner's transaction does not harm the user and aids in maintaining price consistency between the two exchanges. In a similar context, backrunning can also be used to capitalise on Oracle updates for liquidation opportunities {cite}`qin2021empirical`.

**Sandwich Attacks:** Sandwich attacks present a more complex MEV extraction method where the attacker places two transactions, one before and one after the victim's regular trade. The goal is to manipulate asset prices in such a way that the attacker benefits from the victim's loss {cite}`zhou2021high`. However, executing sandwich attacks can be risky for the attacker as any deviation from the desired transaction order can lead to financial loss. In most cases, these attacks are executed via MEV auction platforms.

**Bribery Attacks:** Attackers may generate MEV to encourage miners to act in their favor, this is known as a bribery attack. These attacks can range from incentivizing miners to temporarily delaying a transaction by offering higher fees for a conflicting transaction to more complex schemes facilitated by smart contracts {cite}`tsabary2021mad` {cite}`winzer2019temporary`. The impact of bribery attacks varies depending on the specific application.
**Bribery Attacks:** Attackers may generate MEV to encourage miners to act in their favour, this is known as a bribery attack. These attacks can range from incentivizing miners to temporarily delaying a transaction by offering higher fees for a conflicting transaction to more complex schemes facilitated by smart contracts {cite}`tsabary2021mad` {cite}`winzer2019temporary`. The impact of bribery attacks varies depending on the specific application.

## Impact on Blockchain Fairness and Security Risks

Eskandari et al. {cite}`eskandari2020sok` highlighted a disconcerting aspect of economic inequality that MEV introduces into a system fundamentally designed for decentralisation and equality. Their research showed that miners with more significant computational resources are advantaged, leading to an unequal distribution of wealth and power within the network. This core issue necessitates more rigorous examination and underscores the urgency for remedies that reestablish equilibrium and honor the essential principles of blockchain technology.
Eskandari et al. {cite}`eskandari2020sok` highlighted a disconcerting aspect of economic inequality that MEV introduces into a system fundamentally designed for decentralisation and equality. Their research showed that miners with more significant computational resources are advantaged, leading to an unequal distribution of wealth and power within the network. This core issue necessitates more rigorous examination and underscores the urgency for remedies that re-establish equilibrium and honour the essential principles of blockchain technology.

### Financial Losses

Expand All @@ -54,9 +54,9 @@ The competitive pursuit of MEV by bots can lead to on-chain bidding battles. The

### Threat to Consensus Stability

Carlsten et al. {cite}`carlsten2016instability` demonstrated that when transaction fees surpass block rewards, miners may stray from honest mining practices. They could create forks with high-fee blocks to entice other miners to contribute to their fork. MEV can be seen as an expanded form of transaction fees directed to the miner, and a significant MEV can amplify this issue. Today, lucrative MEV extraction often outweighs block rewards {cite}`flashbot2022transparency`.
Carlsten et al. {cite}`carlsten2016instability` demonstrated that when transaction fees surpass block rewards, miners may stray from honest mining practices. They could create forks with high-fee blocks to entice other miners to contribute to their forks. MEV can be seen as an expanded form of transaction fees directed to the miner, and a significant MEV can amplify this issue. Today, lucrative MEV extraction often outweighs block rewards {cite}`flashbot2022transparency`.

Daian et al. {cite}`daian2020flash` detailed an additional attack method that leverages MEV, referred to as Time-bandit attacks. Essentially, this approach enhances reorganisation of 51% attacks by supplementing them with financial support derived from MEV.
Daian et al. {cite}`daian2020flash` detailed an additional attack method that leverages MEV, referred to as Time-bandit attacks. Essentially, this approach enhances the reorganisation of 51% attacks by supplementing them with financial support derived from MEV.

### A Catalyst for Centralisation

Expand Down
Loading

0 comments on commit 9517558

Please sign in to comment.