1. LBRNEWS | 天秤币资讯首页
  2. 文章分类
  3. Libra天秤币新闻

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

详情页1

近日,在bZx连遭攻击之后,关于“预言机”、“闪电贷”、“管理密钥”的讨论已变得越来越多,DeFi生态正在经历一个短暂的痛苦期。

对此,以太坊联合创始人Vitalik Buterin也不得不站出来维稳局面了,他在今日转发了Uniswap创始人Hayden Adams的一条推文,并评论称:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

“计划中的Uniswap v2 价格预言机设计,能够抵御最近的闪电贷攻击。”

真的如此吗?

我们来看这条推文中推荐的文章《Uniswap何时会成为一个好的预言机?》

文章作者是安全分析平台Gauntlet成员,斯坦福博士生Guillermo Angeris。

以下是译文内容:

Uniswap已成为了一种非常流行的传统订单簿式交易所替代方案,并且已成为了一种测量两种币之间相对价格的常用方法(通常被称为‘价格预言机’)。有点令人惊讶的是,尽管Uniswap的基本思想非常简单,但它的实际效果却是相当好的:在“现实世界”中,与规模大得多的交易所相比,Uniswap似乎准确地估计了两种资产的相对价格。

Uniswap的稳定性也是令人惊讶的,因为它似乎不受那些试操纵价格以谋取私利的不良行为者的影响。这些结果可能是Uniswap用户的直觉,因为他们已目睹了它在野外的表现。而对于怀疑者来说,我们的分析为“Uniswap是一个好预言机”的条件创建了一个数学框架。在最近发表的论文(已被Cryptoeconomic Systems 2020接受)中,我们对Uniswap进行了一番分析,并希望在会议之前与更广泛的受众分享一些结果。

 

恒定乘积市场(Constant-product markets)

 

Uniswap是恒定乘积自动做市商(通常简称为恒定乘积AMM)的特殊例子。其思想如下:我们有一个合约(或交易所),它有一些代币“A”(包含R这样的代币)的储备以及一些代币”B”(包含R’ 这样的代币)的储备。

一个想购买代币”B” Δ’ 币的代理人必须投入足够的代币“A”,以使储备乘积保持不变。换言之,如果代理人想从储备中购买代币”B” Δ’币,那么代理人必须将“A”代币的Δ币投入储备,以便新储备乘积与旧储备乘积相同:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

方程(1)可以很容易地用来推导我们将要用到的量。例如,币“A”的Uniswap价格 mᵤ,相对于币“B”的定义,是用一定数量的币“B”购买币“A”的边际价格。

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

这相当于是用币“B”购买无限小数量币“A”的平均价格,我们可以将其绘制为价格在Δ = 0时的斜率:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

在下一节中,我们将把Uniswap的边际价格与真实市场价格联系起来(剧透:在不收费的情况下,且在一般假设下,它们是相等的)。

注:截至目前,恒定乘积公式(方程式(1))不包括任何交易费用。为了简单起见,我们将在文章的剩余部分假设这个案例是免费的,但我们在这里所做的大多数陈述与收费案例中的预期是基本一致的。

 

套利以及它告诉了我们什么

 

为了说明Uniswap的价格应相对于参考市场的价格,我们需要假设这些市场是如何相互作用的。

在金融数学中,一个非常常见和简单的方法,就是说不存在套利。换言之,我们会假设,不承担任何风险,只在这两个市场之间进行交易,是不可能免费赚到钱的。

因此,我们可以证明,如果mᵤ≠m(其中m是参考市场价格),那么必然存在一笔足够小的交易,使得代理人可以获得正利润,这就意味着,在这个假设下mᵤ = m。

为了证明这一点,我们假设mᵤ > m, 然后,通过定义mᵤ,存在一个足够小的币“A”输入,例如Δ,这样:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

在给定币“A”的Δ的情况下,Δ’是币“B”的输出。

同样,对于市场来说,存在足够小的交易,使得mΔ ≈ Δ’’,但是,由于Δ’’ < Δ’ (因为mᵤ> m),我们可以很容易地通过在公开市场上以Δ”交易Δ来轻松获利,然后在Uniswap中以Δ交易Δ’,也就是说,我们的利润是正的(因为 Δ’’– Δ’ > 0)。注意,这个推导虽然不是完全严格的,但基本上遵循了数学证明。

由于我们可以在mᵤ<m时提出类似的声明,因此我们得出结论,在无套利条件下,mᵤ = m。 这就意味着,如果我们假设没有套利和交易费用,那么Uniswap的市场价格一定是等于真实的市场价格当然,无套利假设仅在实践中大致成立,因此Uniswap可能会偏离真实市场价格,特别是在一个区块或少量区块内。 更为详细的分析表明,在许多市场模型下,真实的市场价格将非常接近Uniswap价格,基于代理的模拟验证了这一点。有关详细信息,请参见论文第2节。 注:类似(但较弱)的声明适用于有交易费用的情况: γm ≤ mᵤ ≤ γ⁻¹m, 其中(1-γ)是交易费的百分比。如前所述,有关详细信息,请参见论文第2节。

 

Uniswap的优良特性

 

Uniswap还有一些很好的特性,这增强了我们的信念,即它在实践当中很可能是一个好的预言机。

更具体地说: (a) 不可能仅仅通过在市场内交易币来耗尽Uniswap的储备(b)向市场增加流动性是正确的做法,因为它降低了特定币的交易成本,同时增加了操纵预言机的成本。

 

储备金的边界

 

要证明没有交易能耗尽Uniswap的币,这是不难的。 由于k = R’R,那么,通过AM-GM不等式(均值不等式)我们得到:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

这立即意味着,可能储备金的总和,是以积k的平方根为界的。根据定义,每次交易后k总是常数,那么储量的总和总是离0较远的。

 

增加流动性降低交易成本

 

有几种方法可以证明这一事实,但最简单的一点是,给定币“A”的输入Δ,我们得到:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

利用无套利情况下R =mᵤR’的事实,则币B的输出等于:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

对于固定边际价格mᵤ,它在R’中增加(注意分母随着R’的增加而减少)。因此,可用储量越高,给定输入量的输出量就越大。这对于很多使用Uniswap协议的用户来说是很直观的,在更多流动性池的情况下,他们看到的滑动是较小的。

 

价格操纵是昂贵的(当进行大的变动时)

 

事实上,将Uniswap价格操纵到任何固定金额的成本,都与储备量与区块数量成线性关系,这在很多实际情况下可能是昂贵的,尽管我们注意到,对价格非常小或短期的扰动,会是相对便宜的。 现在,假设攻击者希望将Uniswap mᵤ的价格操纵到一定的量p > m(其中m是市场价格),那么这个单一操作(例如,对于单个区块)的成本至少是:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

(关于推导,见论文附录E部分),如果我们假设 p ≥ (1+ε)m且ε>0,那么由于 C(p)在p中(p>m)是增加的,我们得到的成本至少是:

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

据我们所知

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

以及

Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者

其中K至少为1/(32√2)。找到C(ε)的这一下界有点棘手,相关论据在论文附录E中可见。如前所述,这一下界与一个常数因子相关,但这里给出的常数K是一个非常弱的下界(因此,这个特殊的选择应该只是作为经验法则,而不是作为一个确切数)。

事实上,成本与储备量R是成线性关系的,这一事实正说明了大型流动性池对稳健的重要性另一方面,由于当ε很小时,成本是平方标度的,攻击者有可能在很长一段时间内对Uniswap中报告的价格进行轻微操纵,而无需花费太多费用

例如,如果储备池的R=1000 ETH,攻击者可通过ε=1%操纵价格,大约为每个区块C(.01) ≈ 0.025 ETH(这里的下界相当弱,给出C(.01)≥ 0.002 ETH)。

请注意,这种操纵在实践中是可能存在的,因此,我们将警告说,任何协议都不应依赖这些预言机(oracle)所报告价格非常细微的变化,也不应该依赖在非常短的时间内报告的价格

换而言之,在试图对价格进行重大调整时,操纵很快就会变得昂贵,这也是我们目前没有观察到对Uniswap市场进行大规模操纵的原因之一。

 

结论

 

Uniswap虽然相对简单,但它似乎具有很好的理论性质,这表明,在实践中,它作为一个去中心化市场和价格预言机可以拥有稳定性。此外,上面的声明确实强调了在Uniswap中拥有大型储备池的重要性,因为所有结果都以某种方式依赖于此。

如前所述,以上只是完整论文中陈述的一小部分,对细节和证明感兴趣的读者都应该看看论文!

 

附录

 

2020年2月15日发生bZx攻击时,攻击者利用bZx智能合约逻辑中的一个漏洞来消耗合约资金,我们要重申上述结论条件的重要性。

据我们所知,这次攻击并不依赖于预言机(oracle)操作,而是涉及到在单个区块中执行的多个事务。

特别是,如果攻击可以在一个区块中执行,那么操纵的代价就是非常小的(代价基本上只是交易费用),因此在大多数情况下是相当可行的,因为上面给出的界限并不适用。

这就强调了我们在“操纵成本高昂”部分内容所作警告的重要性:

(a) 合约依赖于Uniswap价格的微小变化可能是不明智的(这次攻击证明了,成本是相当便宜的); (b)合约不应在很短的一段时间内基于Uniswap报告的价格;

从文章内容来看,似乎V神的“能够抵御闪电贷攻击”的结论似乎有些夸大了,他可能只是想表达自己看好这个方案。

你怎么看?

免责声明:本文转载自互联网,经授权后发布,版权归原作者所有,转载请联系原作者并获许可。文章观点仅代表作者本人,不代表Libra资讯立场。若内容涉及投资建议,仅供参考勿作为投资依据。投资有风险,入市需谨慎。

发表评论

电子邮件地址不会被公开。

评论列表(45条)

  • free coin master spins
    free coin master spins 九月 11, 2020 5:03 上午

    Wonderful blog! I found it while surfing around on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?

    I’ve been trying for a while but I never seem to get there!
    Thank you

  • free spins coin master
    free spins coin master 九月 11, 2020 5:07 上午

    Hmm is anyone else experiencing problems with the images on this blog loading?
    I’m trying to determine if its a problem on my end or if it’s the blog.
    Any feedback would be greatly appreciated.

  • free coin master spins
    free coin master spins 九月 11, 2020 6:10 上午

    Do you have any video of that? I’d like to find out more details.

  • free spins coin master
    free spins coin master 九月 11, 2020 6:17 上午

    Appreciate the recommendation. Let me try it out.

  • free coin master spins
    free coin master spins 九月 11, 2020 6:19 上午

    Hi to every one, the contents existing at this site are genuinely awesome
    for people experience, well, keep up the nice work
    fellows.

  • free coinmaster spins
    free coinmaster spins 九月 11, 2020 7:06 上午

    Hurrah! At last I got a weblog from where I can actually take valuable data regarding my study and knowledge.

  • free spins coin master
    free spins coin master 九月 11, 2020 8:00 上午

    Good post. I will be dealing with some of these issues as well..

  • free coinmaster spins
    free coinmaster spins 九月 11, 2020 8:02 上午

    I love what you guys tend to be up too. This kind
    of clever work and reporting! Keep up the awesome works
    guys I’ve incorporated you guys to blogroll.

  • free coinmaster spins
    free coinmaster spins 九月 11, 2020 6:36 下午

    Hello, i read your blog occasionally and i own a similar one and i
    was just wondering if you get a lot of spam feedback?
    If so how do you stop it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any assistance is very much appreciated.

  • coin master free spins
    coin master free spins 九月 11, 2020 10:37 下午

    There is certainly a lot to learn about this topic.
    I really like all of the points you’ve made.

  • free spins coin master
    free spins coin master 九月 11, 2020 11:35 下午

    I think the admin of this web page is in fact working hard
    in favor of his website, as here every information is quality based material.

  • free psn codes generator
    free psn codes generator 九月 24, 2020 6:24 下午

    I want to to thank you for this great read!! I definitely
    enjoyed every bit of it. I have got you saved as a favorite to check out new stuff you post…

  • free robux
    free robux 九月 24, 2020 6:27 下午

    I think the admin of this website is truly working hard in support of his site, as here
    every material is quality based data.

  • vbucks genetator
    vbucks genetator 九月 24, 2020 6:42 下午

    Everyone loves it whenever people get together and share thoughts.
    Great site, stick with it!

  • free itunes gift card generator
    free itunes gift card generator 九月 24, 2020 6:50 下午

    Please let me know if you’re looking for a author for your blog.
    You have some really great articles and I believe I would be a good asset.
    If you ever want to take some of the load off, I’d absolutely love to write some content
    for your blog in exchange for a link back to mine.

    Please blast me an e-mail if interested. Many thanks!

  • free amazon gift card generator
    free amazon gift card generator 九月 24, 2020 7:15 下午

    I relish, cause I found just what I was taking a look for.

    You’ve ended my four day long hunt! God Bless you man. Have a great day.

    Bye

  • free coin master spins
    free coin master spins 九月 25, 2020 1:07 下午

    Remarkable! Its in fact amazing post, I have got much clear idea about
    from this article.

  • psn codes free
    psn codes free 九月 25, 2020 3:06 下午

    Have you ever considered writing an ebook or guest authoring on other websites?
    I have a blog based on the same topics you discuss and would really like to have you share some stories/information. I know my readers would enjoy your work.
    If you’re even remotely interested, feel free to shoot me an e-mail.

  • netflix account generator
    netflix account generator 九月 25, 2020 9:05 下午

    These are genuinely wonderful ideas in on the topic of blogging.
    You have touched some pleasant things here. Any way keep
    up wrinting.

  • free steam codes generator
    free steam codes generator 九月 26, 2020 4:26 下午

    I like the valuable information you provide in your articles.
    I’ll bookmark your blog and check again here frequently.
    I am quite sure I will learn a lot of new stuff right here!
    Good luck for the next!

  • free amazon gift card
    free amazon gift card 九月 26, 2020 7:28 下午

    We’re a group of volunteers and starting a new scheme in our
    community. Your web site offered us with valuable info to work on. You have done an impressive
    job and our whole community will be thankful to you.

  • free robux codes generator
    free robux codes generator 十月 14, 2020 9:14 下午

    Great blog right here! Additionally your website a lot up
    fast! What host are you the usage of? Can I get your affiliate link in your host?
    I want my site loaded up as fast as yours lol

  • get free robux
    get free robux 十月 14, 2020 10:06 下午

    you’re in point of fact a good webmaster. The web site loading pace is incredible.
    It kind of feels that you’re doing any unique trick. Moreover, The contents are masterpiece.
    you’ve done a excellent activity on this subject!

  • free robux codes generator
    free robux codes generator 十月 14, 2020 10:11 下午

    Touche. Outstanding arguments. Keep up the great effort.

  • how to get free robux
    how to get free robux 十月 14, 2020 10:11 下午

    Appreciation to my father who told me on the topic of
    this blog, this web site is actually amazing.

  • how to get free robux for roblox
    how to get free robux for roblox 十月 14, 2020 10:20 下午

    My relatives always say that I am killing my time here
    at web, but I know I am getting knowledge daily by reading such pleasant content.

  • free robux codes
    free robux codes 十月 14, 2020 10:28 下午

    This is a really good tip especially to those new to the blogosphere.
    Brief but very precise information… Appreciate your sharing this one.

    A must read post!

  • free robux generator
    free robux generator 十月 14, 2020 10:34 下午

    Hello to all, how is the whole thing, I think every one is getting more from this site, and your views are pleasant for new users.

  • how to get free robux
    how to get free robux 十月 14, 2020 10:48 下午

    My developer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses. But he’s tryiong none the less.
    I’ve been using Movable-type on a number of websites for about a year and am
    nervous about switching to another platform.
    I have heard excellent things about blogengine.net. Is there a way I can transfer all my wordpress posts into it?
    Any help would be really appreciated!

  • get free robux
    get free robux 十月 14, 2020 10:57 下午

    If you would like to grow your know-how simply keep visiting this website and be updated with the hottest news
    update posted here.

  • how to get free robux
    how to get free robux 十月 15, 2020 5:13 上午

    I couldn’t refrain from commenting. Well written!

  • robux generator
    robux generator 十月 15, 2020 12:06 下午

    I’m not sure exactly why but this web site is loading extremely slow for me.
    Is anyone else having this issue or is it a problem on my end?

    I’ll check back later and see if the problem still exists.

  • get free robux
    get free robux 十月 15, 2020 1:36 下午

    Every weekend i used to pay a quick visit this
    site, for the reason that i wish for enjoyment, for the reason that this this site conations really fastidious funny material too.

  • free robux codes generator
    free robux codes generator 十月 15, 2020 3:37 下午

    It’s awesome in favor of me to have a web page, which
    is valuable in favor of my knowledge. thanks admin

  • free robux generator
    free robux generator 十月 15, 2020 6:20 下午

    Thanks for finally talking about > Vitalik:Uniswap v2 价格预言机能够抵御闪电贷攻击_LibraNews_服务于区块链创新者,LBRNEWS | 天秤币资讯 < Liked it!

  • free robux codes
    free robux codes 十月 15, 2020 6:45 下午

    I am really impressed with your writing skills and also with the layout on your weblog.

    Is this a paid theme or did you customize it yourself?
    Either way keep up the excellent quality writing, it is
    rare to see a nice blog like this one nowadays.

  • free robux
    free robux 十月 15, 2020 8:25 下午

    This is very interesting, You’re a very skilled blogger.
    I’ve joined your feed and look forward to seeking more of your fantastic post.

    Also, I’ve shared your site in my social networks!

  • how to get free robux
    how to get free robux 十月 15, 2020 8:31 下午

    It is perfect time to make some plans for the future and it’s time to
    be happy. I’ve read this post and if I could I wish to
    suggest you few interesting things or tips. Maybe you can write next articles referring to this article.
    I desire to read even more things about it!

  • robux generator
    robux generator 十月 15, 2020 8:34 下午

    Hi, just wanted to say, I enjoyed this blog post. It was practical.

    Keep on posting!

  • how to get free robux for roblox
    how to get free robux for roblox 十月 15, 2020 8:37 下午

    Hi there, yup this post is in fact good and I have learned lot of things from it on the topic
    of blogging. thanks.

  • free robux
    free robux 十月 15, 2020 8:45 下午

    Greetings! Very useful advice in this particular post!
    It is the little changes that make the greatest changes.
    Thanks a lot for sharing!

  • robux generator
    robux generator 十月 15, 2020 9:54 下午

    Thanks to my father who shared with me regarding this web site, this webpage is truly awesome.

  • free robux codes
    free robux codes 十月 17, 2020 3:47 上午

    When someone writes an piece of writing he/she keeps the thought
    of a user in his/her brain that how a user can be aware of
    it. Thus that’s why this article is outstdanding. Thanks!

  • robux generator
    robux generator 十月 19, 2020 12:23 下午

    Howdy! Do you use Twitter? I’d like to follow you if that would be okay.
    I’m definitely enjoying your blog and look forward to new
    posts.

  • free v bucks generator
    free v bucks generator 十月 19, 2020 9:02 下午

    I do believe all of the concepts you have presented in your post.

    They are very convincing and will definitely work. Nonetheless, the posts are too quick
    for novices. May you please lengthen them a little from subsequent time?
    Thanks for the post.

bitcoin
Bitcoin (BTC) 90,685.70 0.17%
ethereum
Ethereum (ETH) 2,570.90 0.98%
usd-coin
USD Coin (USDC) 6.70 0.02%