<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>gm365.eth</title>
        <link>https://paragraph.com/@gm365-2</link>
        <description>🐳  Web3 科普

✨ 尽量言之有物，尽量浅显易懂

🔆 知音如不赏，归卧故山秋。
</description>
        <lastBuildDate>Sat, 18 Apr 2026 00:55:32 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>gm365.eth</title>
            <url>https://storage.googleapis.com/papyrus_images/85e14f96fa5a6badfdfc02ee7e74cf7ec53b8b3bfd459eedb0fe4a77e30c7f14.png</url>
            <link>https://paragraph.com/@gm365-2</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[🔒 Snapshot 投票治理迷你研报]]></title>
            <link>https://paragraph.com/@gm365-2/snapshot</link>
            <guid>vWOKlAkl4dHfSgJBLWF4</guid>
            <pubDate>Sun, 30 Oct 2022 12:10:43 GMT</pubDate>
            <description><![CDATA[简介本迷你研报，试对 Snapshot 链上投票治理做简要分析，同时列举部分优质项目方，并规划投票权获取方法及参与方式等。 鉴于本人知识面所限，所说内容可能有遗漏、错误等，敬请指正。另本内容仅供内部参考。 简要目录：投票治理简介Snapshot 简介投票项目推荐投票权代币获取推荐配套工具Web3 投票治理简介在民主社会中，投票权被公平赋予每位公民。投票权甚至被认为是现代民主的根本特征。公民行使投票权来进行总统选举这样的国家大事。 在 Web3领域，大量 Web3、DeFi、NFT项目都喜欢追求去中心化的治理模式（不管是实质上还是表面上）。具体的参与方式便是，所有持币(ERC20、ERC721、ERC1155)用户通过签名的方式，为社区提案进行投票，最终根据投票结果来决议。 目前很多 ERC20 代币仅作为治理代币存在，比如 UNI, OP 等。理论上来说，这些代币存在的唯一意义仅包括发起提案、参与投票。然而，持币用户同样有权发起新提案，为代币赋予分红权，进而改变代币经济模型。 持币用户参与投票的行为，一般被视为关心项目发展且积极参与项目治理，为许多项目方所倡导。两种投票治理方式当...]]></description>
            <content:encoded><![CDATA[<h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"></h1><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">简介</h2><p>本迷你研报，试对 Snapshot 链上投票治理做简要分析，同时列举部分优质项目方，并规划投票权获取方法及参与方式等。</p><p>鉴于本人知识面所限，所说内容可能有遗漏、错误等，敬请指正。另本内容仅供内部参考。</p><p>简要目录：</p><ul><li><p>投票治理简介</p></li><li><p>Snapshot 简介</p></li><li><p>投票项目推荐</p></li><li><p>投票权代币获取推荐</p></li><li><p>配套工具</p></li></ul><h2 id="h-web3" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Web3 投票治理简介</h2><p>在民主社会中，投票权被公平赋予每位公民。投票权甚至被认为是现代民主的根本特征。公民行使投票权来进行总统选举这样的国家大事。</p><p>在 Web3领域，大量 Web3、DeFi、NFT项目都喜欢追求去中心化的治理模式（不管是实质上还是表面上）。具体的参与方式便是，所有持币(ERC20、ERC721、ERC1155)用户通过签名的方式，为社区提案进行投票，最终根据投票结果来决议。</p><p>目前很多 ERC20 代币仅作为治理代币存在，比如 UNI, OP 等。理论上来说，这些代币存在的唯一意义仅包括发起提案、参与投票。然而，持币用户同样有权发起新提案，为代币赋予分红权，进而改变代币经济模型。</p><p>持币用户参与投票的行为，一般被视为关心项目发展且积极参与项目治理，为许多项目方所倡导。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">两种投票治理方式</h2><p>当前有两种参与投票治理的方式：</p><ul><li><p>链上投票（需要消耗 gas 费，比如 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://uni.vote/%EF%BC%89">https://uni.vote/）</a></p></li><li><p>链上快照、链下投票（比如 Snapshot）</p></li></ul><p>目前看，免 gas 费的Snapshot 模式为绝大多数项目方采用。UniSwap 则同时拥有链上和链下两套模式（尚不清楚二者投票结果相悖时如何定夺）</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">投票治理用途</h2><p>作为拥有投票权的普通用户，参与投票行为本身并无法左右最终投票结果。但投票治理的行为，依然具有重大意义。</p><ul><li><p>增加链上行为权重，完善钱包地址用户行为画像（投票约为高质量用户特点）</p></li><li><p>博取项目对自身项目投票用户的空投或POAP（Voltz对投Yes票用户开放创世NFT Mint权限，此NFT当前地板价超0.3 ETH）</p></li><li><p>博取项目对参与其他DAO投票用户的空投（OP对至少参与&quot;活跃DAO&quot;一次链上投票或两次链下投票的用户发放254枚$OP）</p></li></ul><p>综上，积极参与高质量、活跃DAO的投票，以及针对某些项目有利益相关的投票（如Voltz），对完善账户质量，获取额外非预期收益，大有好处。</p><h2 id="h-snapshot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Snapshot 简介</h2><p>Snapshot 是由 Balancer 推出的开源链下无 gas 治理投票平台，于2021年11月获400万美元融资。目前几乎所有知名项目均在Snapshot平台开放 Space，当前总计有 7.7K Space。</p><h2 id="h-snapshot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Snapshot投票项目推荐</h2><div data-type="embedly" src="https://docs.google.com/spreadsheets/d/1T1Mc-K6XAQdXJGPR86lLUwvNg5-1Ja8bHqsxSesvJ04/edit?usp=sharing" data="{&quot;provider_url&quot;:&quot;http://docs.google.com&quot;,&quot;description&quot;:&quot;This browser version is no longer supported. Please upgrade to a supported browser.&quot;,&quot;title&quot;:&quot;Snapshot 投票治理项目列表&quot;,&quot;thumbnail_width&quot;:1200,&quot;height&quot;:530,&quot;width&quot;:700,&quot;html&quot;:&quot;&lt;iframe loading=\&quot;lazy\&quot; class=\&quot;embedly-embed\&quot; src=\&quot;//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1T1Mc-K6XAQdXJGPR86lLUwvNg5-1Ja8bHqsxSesvJ04%2Fpreview%3Fembedded%3Dtrue&amp;display_name=Google+Docs&amp;url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1T1Mc-K6XAQdXJGPR86lLUwvNg5-1Ja8bHqsxSesvJ04%2Fedit%3Fusp%3Dsharing&amp;image=https%3A%2F%2Flh7-us.googleusercontent.com%2Fdocs%2FAHkbwyLeIHEv9nW9s4aI4UsZ-Kd95h77qVVj8imGRhJ0vycMppO5AvB6b3RTQr_U_Zl2eRQtiFU4AM3KMURXrBjd_aJ9e8IpGLmviMEp1hSWimiL6Iieo3su%3Dw1200-h630-p&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=google\&quot; width=\&quot;700\&quot; height=\&quot;530\&quot; scrolling=\&quot;auto\&quot; title=\&quot;Google Docs embed\&quot; frameborder=\&quot;0\&quot; allow=\&quot;autoplay; fullscreen; encrypted-media; picture-in-picture;\&quot; allowfullscreen=\&quot;true\&quot;&gt;&lt;/iframe&gt;&quot;,&quot;version&quot;:&quot;1.0&quot;,&quot;provider_name&quot;:&quot;Google Docs&quot;,&quot;thumbnail_url&quot;:&quot;https://storage.googleapis.com/papyrus_images/3aa81936735c1f0916ae8f36e1770426541ca6f4edd99d9cd1a9bbb8d16710f7.png&quot;,&quot;type&quot;:&quot;rich&quot;,&quot;thumbnail_height&quot;:630,&quot;image&quot;:{&quot;img&quot;:{&quot;width&quot;:1200,&quot;height&quot;:630,&quot;src&quot;:&quot;https://storage.googleapis.com/papyrus_images/3aa81936735c1f0916ae8f36e1770426541ca6f4edd99d9cd1a9bbb8d16710f7.png&quot;}}}" format="iframe"><link rel="preload" as="image" href="https://storage.googleapis.com/papyrus_images/3aa81936735c1f0916ae8f36e1770426541ca6f4edd99d9cd1a9bbb8d16710f7.png"/><div class="react-component embed my-5" data-drag-handle="true" data-node-view-wrapper="" style="white-space:normal"><a class="link-embed-link" href="https://docs.google.com/spreadsheets/d/1T1Mc-K6XAQdXJGPR86lLUwvNg5-1Ja8bHqsxSesvJ04/edit?usp=sharing" target="_blank" rel="noreferrer"><div class="link-embed"><div class="flex-1"><div><h2>Snapshot 投票治理项目列表</h2><p>This browser version is no longer supported. Please upgrade to a supported browser.</p></div><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-link h-3 w-3 my-auto inline mr-1"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>http://docs.google.com</span></div><img src="https://storage.googleapis.com/papyrus_images/3aa81936735c1f0916ae8f36e1770426541ca6f4edd99d9cd1a9bbb8d16710f7.png"/></div></a></div></div><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">投票权代币获取路径</h2><p>鉴于前面推荐的绝大多数项目的投票代币均为以太坊主网 ERC20 代币，相对低成本获取投票权代币可参考以下方式：</p><ul><li><p>FTX Pro 买入对应代币，并提现到以太坊主网（质押对应数量的FTT用户可享受每日免费提现特定次数ERC20代币的权益；</p><p>在未质押FTT时，亦可选择低gas时段进行ERC20代币提现， 手续费最低为0.0005 E的等值代币 -- by @坚城）</p></li><li><p>买入 DPI 代币并在 TokenSets 官网 Redeem 为底层代币，当前包含14种DeFi 代币，含 UNI、SUSHI、AAVE、MKR、COMP、YFI等。此操作 gas 费较高，gas price 20 时需要约 $50 费用</p></li><li><p>买入 Bankless DeFi Innovation Index 代币，并在TokenSets 上Redeem，包含 dYdX, OHM, Convex, PERP等</p></li></ul><p>附 FTX 提现减免规则：</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>另，多账户操作时注意买入指数代币的数量、买入和赎回时间不要趋于一致，免于被追查女巫。</p><p>此外，可以考虑将精品号和普通号做区分处理：</p><ul><li><p>精品号买入高权重的代币且持有一定数量并人工参与投票</p></li><li><p>普通号可购入少量DPI指数类代币并批量参与投票</p></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">配套工具</h2><p>鉴于各项目开启投票的时间不定，且每个投票一般仅有3天有效期，所以持续监控项目是否有新提案并第一时间参与投票颇为重要。</p><p>可以考虑根据 Snapshot 官方 API 文档信息，开发一枚专门跟踪新提案的机器人，部署在 Telegram，Discord ，甚至配置一枚 Twitter Bot 账号。由此可第一时间获取新提案信息。</p><p>另，也可以开发 Snapshot 批量投票工具（难度不大，但目前官方仅有JS的SDK）。但此类工具使用时，务必注意不可同时间、重复性参与投票，以免被查女巫（HOP社区举报时发生过此类事件）</p><h2 id="h-snapshot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Snapshot 同类产品</h2><ol><li><p>Tally</p></li></ol><div data-type="embedly" src="https://www.tally.xyz/" data="{&quot;provider_url&quot;:&quot;https://www.tally.xyz&quot;,&quot;description&quot;:&quot;Best-in-class infrastructure for the world&apos;s most valuable networks.&quot;,&quot;title&quot;:&quot;Tally - Institutional-grade tokens&quot;,&quot;mean_alpha&quot;:245.37093254,&quot;thumbnail_width&quot;:4800,&quot;url&quot;:&quot;https://www.tally.xyz/&quot;,&quot;thumbnail_url&quot;:&quot;https://storage.googleapis.com/papyrus_images/cb3225bff353bb1467968769c9b39cc91a35bec798a480feb227944106e4067b.png&quot;,&quot;version&quot;:&quot;1.0&quot;,&quot;provider_name&quot;:&quot;Tally&quot;,&quot;type&quot;:&quot;link&quot;,&quot;thumbnail_height&quot;:2520,&quot;image&quot;:{&quot;img&quot;:{&quot;width&quot;:4800,&quot;height&quot;:2520,&quot;src&quot;:&quot;https://storage.googleapis.com/papyrus_images/cb3225bff353bb1467968769c9b39cc91a35bec798a480feb227944106e4067b.png&quot;}}}" format="small"><link rel="preload" as="image" href="https://storage.googleapis.com/papyrus_images/cb3225bff353bb1467968769c9b39cc91a35bec798a480feb227944106e4067b.png"/><div class="react-component embed my-5" data-drag-handle="true" data-node-view-wrapper="" style="white-space:normal"><a class="link-embed-link" href="https://www.tally.xyz/" target="_blank" rel="noreferrer"><div class="link-embed"><div class="flex-1"><div><h2>Tally - Institutional-grade tokens</h2><p>Best-in-class infrastructure for the world&#x27;s most valuable networks.</p></div><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-link h-3 w-3 my-auto inline mr-1"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>https://www.tally.xyz</span></div><img src="https://storage.googleapis.com/papyrus_images/cb3225bff353bb1467968769c9b39cc91a35bec798a480feb227944106e4067b.png"/></div></a></div></div><p>2. Messari</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://messari.io/governor/proposal-tracker/active">https://messari.io/governor/proposal-tracker/active</a></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">其他未尽事项</h2><p>鉴于个人知识所限，有相当多内容未能覆盖，如：</p><ul><li><p>还有哪些优质项目值得参与投票</p></li><li><p>是否前面所有项目都只能使用主网代币参与（如果持有L2或 Alt L1代币亦可投票，可大幅降低 gas 成本）</p></li><li><p>其他</p></li></ul><p>此文档可根据需要随时保持更新。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考资料</h2><p>[1] <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://help.ftx.com/hc/zh-cn/articles/360034881271-%E5%85%85%E5%B8%81%E5%8F%8A%E6%8F%90%E5%B8%81">FTX 提币手续费及减免规则</a></p><p>[2] <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://mirror.xyz/foresightnews.eth/OUVYwStc_u_CGU0zlKsOtX_MZfvhKDcxD32MtyQpj3M">$OP 空投细则中对投票治理用户奖励</a></p><p>[3] <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://opensea.io/collection/voltz-genesis-nft">Voltz奖励UniSwap投YES票用户NFT</a></p>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
        </item>
        <item>
            <title><![CDATA[✨ Web3 科学家极简入门指南]]></title>
            <link>https://paragraph.com/@gm365-2/web3</link>
            <guid>TSOmm4RyLU3qyOahftzz</guid>
            <pubDate>Wed, 25 May 2022 05:44:48 GMT</pubDate>
            <description><![CDATA[除了 Web3 领域，👨‍🔬 “科学家”的头衔从没有离普通人这么近过 。 一点点 Python (JavaScrip更好) 基本功、一点点智能合约基础知识、一点点项目投研分析（非必需） = Web3 科学家 。 本文作为一篇零基础教程，献给所有心怀科学家梦想的同学们。谁是 Web3 科学家？简单来说，通过程序的方式（Python、JavaScript等）进行合约交互、NFT Mint等的用户被统称为“科学家”。 普通用户使用 MetaMask 这样的钱包插件在项目官网进行合约交互或者 Mint NFT，“科学家”使用程序代替人工进行同样的操作 程序代替人工，机器代替人力，效率指数级增加。科学家的优势蒸汽机的发明将人力从繁重的劳动中解放出来，成功开启了第一次工业革命。 Web3科学家用程序代替人力，解放人力的同时，也获取了诸多优势： ✅ 效率大幅提升（常用于项目交互） ✅ 速度抢先（常用于 NFT Mint） ✅ 自动化程度高 🦾 速度快、效率高、批量化、自动化 = 收益指数级增加科学家的工具科学界们用程序进行合约交互的两大核心： ▪️ 交互用的程序语言 ▪️ 项目合约的交互...]]></description>
            <content:encoded><![CDATA[<p>除了 Web3 领域，👨‍🔬 “科学家”的头衔从没有离普通人这么近过 。</p><p>一点点 Python (JavaScrip更好) 基本功、一点点智能合约基础知识、一点点项目投研分析（非必需） = Web3 科学家 。</p><p>本文作为一篇零基础教程，献给所有心怀科学家梦想的同学们。</p><h2 id="h-web3" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">谁是 Web3 科学家？</h2><p>简单来说，通过程序的方式（Python、JavaScript等）进行合约交互、NFT Mint等的用户被统称为“科学家”。</p><p>普通用户使用 MetaMask 这样的钱包插件在项目官网进行合约交互或者 Mint NFT，“科学家”使用程序代替人工进行同样的操作 程序代替人工，机器代替人力，效率指数级增加。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">科学家的优势</h2><p>蒸汽机的发明将人力从繁重的劳动中解放出来，成功开启了第一次工业革命。</p><p>Web3科学家用程序代替人力，解放人力的同时，也获取了诸多优势：</p><p>✅ 效率大幅提升（常用于项目交互）</p><p>✅ 速度抢先（常用于 NFT Mint）</p><p>✅ 自动化程度高</p><p>🦾 速度快、效率高、批量化、自动化 = 收益指数级增加</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">科学家的工具</h2><p>科学界们用程序进行合约交互的两大核心：</p><p>▪️ 交互用的程序语言</p><p>▪️ 项目合约的交互路径</p><p>本文将选用 Python 做交互程序，并选取一两个跨链桥项目做代码演示。本末会有完整的 GitHub 开源代码仓库，供大家借鉴。</p><h2 id="h-python-web3" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用 Python 接入 Web3</h2><p>Web3 Python 简单易用，第三方库丰富，对新手极其友好。</p><p>用 Python 来进行 Web3 项目交互，其桥梁便是 <code>Web3. py</code>，看其名字就透露着野心。</p><p>如果你的电脑已经安装好了 Python3，直接用 <code>pip/pip3</code> 即可来安装： 👉 <code>pip install web3</code></p><p>Web3.py 的官方文档：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/5iJVfLdcCZ">https://web3py.readthedocs.io/en/stable/#</a></p><h2 id="h-web3" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">获取接入 Web3 世界的门票</h2><p>区块链本质上是一个P2P网络共同维护的巨大账本，所有的链上交互信息都是通过某个节点广播到整个 P2P 网络。</p><p>然而自建节点成本高昂，对我们大多数人而言，实无必要。我们通过&quot;Infura&quot;这个Web3领域的基础设施门户来接入区块链网络，更加简单便捷。</p><p>Infura的使用只需要如下三个步骤：</p><p>▪️ 注册账号</p><p>▪️ 新建项目</p><p>▪️ 获取 PROJECT ID</p><p>Infura官网链接： 👉 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/pZMvH1sTfL">https://infura.io</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/cd8fc30a51d6033754e0e0c58703bba53948e02c35b46a84534a99eafafc772b.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h2 id="h-python" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用 Python 查询区块链数据</h2><p>Infura目前提供对多条EVM 兼容链的主网、测试网接入节点，只需要切换 network 名称即可。</p><pre data-type="codeBlock" text="# get w3 endpoint by network name
def get_w3_by_network(network=&apos;mainnet&apos;):
    infura_url = f&apos;https://{network}.infura.io/v3/{INFURA_SECRET_KEY}&apos; # 接入 Infura
    w3 = Web3(Web3.HTTPProvider(infura_url))
    return w3
"><code><span class="hljs-comment"># get w3 endpoint by network name</span>
def get_w3_by_network(<span class="hljs-attr">network</span>=<span class="hljs-string">'mainnet'</span>):
    <span class="hljs-attr">infura_url</span> = f<span class="hljs-string">'https://{network}.infura.io/v3/{INFURA_SECRET_KEY}'</span> <span class="hljs-comment"># 接入 Infura</span>
    <span class="hljs-attr">w3</span> = Web3(Web3.HTTPProvider(infura_url))
    return w3
</code></pre><p>接入后的 <code>w3</code> 即为我们通向区块链世界的钥匙，不论是查询链上数据，还是进行转账、合约交互，都是通过它来实现。</p><p>比如用以下代码来查询 V神 3号钱包的ETH余额，可以得到结果: 29万ETH 🤯</p><pre data-type="codeBlock" text="# V神 3号钱包地址
vb = &apos;0x220866b1a2219f40e72f5c628b65d54268ca3a9d&apos;

# 地址格式转换
address = Web3.toChecksumAddress(vb)

# 查询地址 ETH余额
balance = w3.eth.get_balance(address) / 1e18
print(f&apos;V神地址余额: {balance = } ETH&apos;) 
"><code># V神 <span class="hljs-number">3</span>号钱包地址
vb <span class="hljs-operator">=</span> <span class="hljs-string">'0x220866b1a2219f40e72f5c628b65d54268ca3a9d'</span>

# 地址格式转换
<span class="hljs-keyword">address</span> <span class="hljs-operator">=</span> Web3.toChecksumAddress(vb)

# 查询地址 ETH余额
balance <span class="hljs-operator">=</span> w3.eth.get_balance(<span class="hljs-keyword">address</span>) <span class="hljs-operator">/</span> <span class="hljs-number">1e18</span>
print(f<span class="hljs-string">'V神地址余额: {balance = } ETH'</span>) 
</code></pre><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/8e838886e7f0dfaf26fd76330abcb8f4b38abc1c80645b4e0b1e1e732b63d7ca.jpg" alt="查询 Balance" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">查询 Balance</figcaption></figure><h2 id="h-python-eth" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用 Python 转账 ETH</h2><p>转账是所有链上交互的灵魂，是一种改变区块链状态的行为。相比较前面的“查询地址余额”，属于“写入”的操作类型。</p><p>转账、合约交互等操作，都需要用地址对应的私钥签名交易并广播。</p><p>让我们尝试在 Rinkeby 测试网上转账一点ETH测试币</p><pre data-type="codeBlock" text="# 转账 ETH
def transfer_eth(w3,from_address,private_key,target_address,amount,gas_price=5,gas_limit=21000,chainId=4):
    from_address = Web3.toChecksumAddress(from_address)
    target_address = Web3.toChecksumAddress(target_address)
    nonce = w3.eth.getTransactionCount(from_address) # 获取 nonce 值
    params = {
        &apos;from&apos;: from_address,
        &apos;nonce&apos;: nonce,
        &apos;to&apos;: target_address,
        &apos;value&apos;: w3.toWei(amount, &apos;ether&apos;),
        &apos;gas&apos;: gas_limit,
        # &apos;gasPrice&apos;: w3.toWei(gas_price, &apos;gwei&apos;),
        &apos;maxFeePerGas&apos;: w3.toWei(gas_price, &apos;gwei&apos;),
        &apos;maxPriorityFeePerGas&apos;: w3.toWei(gas_price, &apos;gwei&apos;),
        &apos;chainId&apos;: chainId,
        
    }
    try:
        signed_tx = w3.eth.account.signTransaction(params, private_key=private_key)
        txn = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
        return {&apos;status&apos;: &apos;succeed&apos;, &apos;txn_hash&apos;: w3.toHex(txn), &apos;task&apos;: &apos;Transfer ETH&apos;}
    except Exception as e:
        return {&apos;status&apos;: &apos;failed&apos;, &apos;error&apos;: e, &apos;task&apos;: &apos;Transfer ETH&apos;}
"><code># 转账 ETH
def transfer_eth(w3,from_address,private_key,target_address,amount,gas_price<span class="hljs-operator">=</span><span class="hljs-number">5</span>,gas_limit<span class="hljs-operator">=</span><span class="hljs-number">21000</span>,chainId<span class="hljs-operator">=</span><span class="hljs-number">4</span>):
    from_address <span class="hljs-operator">=</span> Web3.toChecksumAddress(from_address)
    target_address <span class="hljs-operator">=</span> Web3.toChecksumAddress(target_address)
    nonce <span class="hljs-operator">=</span> w3.eth.getTransactionCount(from_address) # 获取 nonce 值
    params <span class="hljs-operator">=</span> {
        <span class="hljs-string">'from'</span>: from_address,
        <span class="hljs-string">'nonce'</span>: nonce,
        <span class="hljs-string">'to'</span>: target_address,
        <span class="hljs-string">'value'</span>: w3.toWei(amount, <span class="hljs-string">'ether'</span>),
        <span class="hljs-string">'gas'</span>: gas_limit,
        # <span class="hljs-string">'gasPrice'</span>: w3.toWei(gas_price, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'maxFeePerGas'</span>: w3.toWei(gas_price, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'maxPriorityFeePerGas'</span>: w3.toWei(gas_price, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'chainId'</span>: chainId,
        
    }
    <span class="hljs-keyword">try</span>:
        signed_tx <span class="hljs-operator">=</span> w3.eth.account.signTransaction(params, private_key<span class="hljs-operator">=</span>private_key)
        txn <span class="hljs-operator">=</span> w3.eth.sendRawTransaction(signed_tx.rawTransaction)
        <span class="hljs-keyword">return</span> {<span class="hljs-string">'status'</span>: <span class="hljs-string">'succeed'</span>, <span class="hljs-string">'txn_hash'</span>: w3.toHex(txn), <span class="hljs-string">'task'</span>: <span class="hljs-string">'Transfer ETH'</span>}
    except Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> {<span class="hljs-string">'status'</span>: <span class="hljs-string">'failed'</span>, <span class="hljs-string">'error'</span>: e, <span class="hljs-string">'task'</span>: <span class="hljs-string">'Transfer ETH'</span>}
</code></pre><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/35d5ae34781fe7dcfd39ae4f54305b5a459ac470e6ea5099c90035201a417c67.jpg" alt="Web3.py 转账结果" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Web3.py 转账结果</figcaption></figure><p>❕注意：示例代码中的私钥仅作演示用，注意风险。</p><p>👉 代码： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/5v6gFKLr7r">https://github.com/gm365/Web3_Tutorial/blob/main/transferETH.py</a></p><h2 id="h-python-arbitrum" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用 Python 交互 Arbitrum 测试网跨链桥</h2><p>合约交互比起普通转账，又要复杂了一些。</p><p>从合约交互开始，会需要额外几个参数：</p><p>▪️ 合约地址</p><p>▪️ 合约ABI</p><p>▪️ 交互的函数名称及具体参数</p><p>一般情况下，我们可以拆解为以下三个步骤来完成：</p><ol><li><p>先在Arbitrum官方跨链桥测试网页面手工交互</p></li><li><p>接着从交互记录，找到 Etherscan上合约地址</p></li><li><p>定位到合约 &quot;Write Contract&quot; 中的 &quot;depositEth&quot; 函数，获取函数名称及对应参数</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/12e46dbc8bde9ac8d486549683ff60b283da5a7e24d64460cdd091717be57e26.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>注：本例中其实是定位到 “Write As Proxy”的页面，说明当前合约是一个可升级合约</p><p>最终编写的 Python 代码如下：</p><pre data-type="codeBlock" text="# bridge eth from rinkeby to arbitrum testnet
def bridge_arbitrum_eth(w3, from_address, private_key, contract_address, amount_in_ether, chainId):
    from_address = Web3.toChecksumAddress(from_address)
    contract_address = Web3.toChecksumAddress(contract_address)

    ABI = &apos;[{&quot;inputs&quot;:[{&quot;internalType&quot;:&quot;uint256&quot;,&quot;name&quot;:&quot;maxSubmissionCost&quot;,&quot;type&quot;:&quot;uint256&quot;}],&quot;name&quot;:&quot;depositEth&quot;,&quot;outputs&quot;:[{&quot;internalType&quot;:&quot;uint256&quot;,&quot;name&quot;:&quot;&quot;,&quot;type&quot;:&quot;uint256&quot;}],&quot;stateMutability&quot;:&quot;payable&quot;,&quot;type&quot;:&quot;function&quot;}]&apos;
    
    amount_in_wei = w3.toWei(amount_in_ether, &apos;ether&apos;)
    maxSubmissionCost = int(amount_in_wei * 0.01) # 定义参数值
    nonce = w3.eth.getTransactionCount(from_address)

    params = {
        &apos;chainId&apos;: chainId,
        &apos;gas&apos;: 250000,
        &apos;nonce&apos;: nonce,
        &apos;from&apos;: from_address,
        &apos;value&apos;: amount_in_wei,
        # &apos;gasPrice&apos;: w3.toWei(&apos;5&apos;, &apos;gwei&apos;),
        &apos;maxFeePerGas&apos;: w3.toWei(5, &apos;gwei&apos;),
        &apos;maxPriorityFeePerGas&apos;: w3.toWei(5, &apos;gwei&apos;),
        &apos;chainId&apos;: chainId,
    }
    contract = w3.eth.contract(address=contract_address, abi=ABI)

    # 调用合约的 depositEth 函数，参数为 maxSubmissionCost
    func = contract.functions.depositEth(maxSubmissionCost)
    try:
        tx = func.buildTransaction(params)
        signed_tx = w3.eth.account.sign_transaction(tx, private_key=private_key)
        txn = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
        return {&apos;status&apos;: &apos;succeed&apos;, &apos;txn_hash&apos;: w3.toHex(txn), &apos;task&apos;: &apos;Bridge ETH&apos;}
    except Exception as e:
        return {&apos;status&apos;: &apos;failed&apos;, &apos;error&apos;: e, &apos;task&apos;: &apos;Bridge ETH&apos;}
"><code># bridge eth <span class="hljs-keyword">from</span> rinkeby to arbitrum testnet
def bridge_arbitrum_eth(w3, from_address, private_key, contract_address, amount_in_ether, chainId):
    from_address <span class="hljs-operator">=</span> Web3.toChecksumAddress(from_address)
    contract_address <span class="hljs-operator">=</span> Web3.toChecksumAddress(contract_address)

    ABI <span class="hljs-operator">=</span> <span class="hljs-string">'[{"inputs":[{"internalType":"uint256","name":"maxSubmissionCost","type":"uint256"}],"name":"depositEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"}]'</span>
    
    amount_in_wei <span class="hljs-operator">=</span> w3.toWei(amount_in_ether, <span class="hljs-string">'ether'</span>)
    maxSubmissionCost <span class="hljs-operator">=</span> <span class="hljs-keyword">int</span>(amount_in_wei <span class="hljs-operator">*</span> <span class="hljs-number">0</span><span class="hljs-number">.01</span>) # 定义参数值
    nonce <span class="hljs-operator">=</span> w3.eth.getTransactionCount(from_address)

    params <span class="hljs-operator">=</span> {
        <span class="hljs-string">'chainId'</span>: chainId,
        <span class="hljs-string">'gas'</span>: <span class="hljs-number">250000</span>,
        <span class="hljs-string">'nonce'</span>: nonce,
        <span class="hljs-string">'from'</span>: from_address,
        <span class="hljs-string">'value'</span>: amount_in_wei,
        # <span class="hljs-string">'gasPrice'</span>: w3.toWei(<span class="hljs-string">'5'</span>, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'maxFeePerGas'</span>: w3.toWei(<span class="hljs-number">5</span>, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'maxPriorityFeePerGas'</span>: w3.toWei(<span class="hljs-number">5</span>, <span class="hljs-string">'gwei'</span>),
        <span class="hljs-string">'chainId'</span>: chainId,
    }
    <span class="hljs-class"><span class="hljs-keyword">contract</span> = <span class="hljs-title">w3</span>.<span class="hljs-title">eth</span>.<span class="hljs-title"><span class="hljs-keyword">contract</span></span>(<span class="hljs-params"><span class="hljs-keyword">address</span>=contract_address, <span class="hljs-built_in">abi</span>=ABI</span>)

    # 调用合约的 <span class="hljs-title">depositEth</span> 函数，参数为 <span class="hljs-title">maxSubmissionCost</span>
    <span class="hljs-title">func</span> = <span class="hljs-title"><span class="hljs-keyword">contract</span></span>.<span class="hljs-title">functions</span>.<span class="hljs-title">depositEth</span>(<span class="hljs-params">maxSubmissionCost</span>)
    <span class="hljs-title"><span class="hljs-keyword">try</span></span>:
        <span class="hljs-title"><span class="hljs-built_in">tx</span></span> = <span class="hljs-title">func</span>.<span class="hljs-title">buildTransaction</span>(<span class="hljs-params">params</span>)
        <span class="hljs-title">signed_tx</span> = <span class="hljs-title">w3</span>.<span class="hljs-title">eth</span>.<span class="hljs-title">account</span>.<span class="hljs-title">sign_transaction</span>(<span class="hljs-params"><span class="hljs-built_in">tx</span>, private_key=private_key</span>)
        <span class="hljs-title">txn</span> = <span class="hljs-title">w3</span>.<span class="hljs-title">eth</span>.<span class="hljs-title">sendRawTransaction</span>(<span class="hljs-params">signed_tx.rawTransaction</span>)
        <span class="hljs-title"><span class="hljs-keyword">return</span></span> </span>{<span class="hljs-string">'status'</span>: <span class="hljs-string">'succeed'</span>, <span class="hljs-string">'txn_hash'</span>: w3.toHex(txn), <span class="hljs-string">'task'</span>: <span class="hljs-string">'Bridge ETH'</span>}
    except Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> {<span class="hljs-string">'status'</span>: <span class="hljs-string">'failed'</span>, <span class="hljs-string">'error'</span>: e, <span class="hljs-string">'task'</span>: <span class="hljs-string">'Bridge ETH'</span>}
</code></pre><p>👉 完整参考代码： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/gm365/Web3_Tutorial/blob/main/ArbitrumBridge.py">Arbitrum Bridge</a></p><h2 id="h-abi" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">合约ABI</h2><p>合约的 <code>ABI</code> 即应用程序二进制接口，定义了智能合约各函数调用的参数与方法。</p><p>对于开源已验证源码的合约，直接在 <code>etherscan</code> 的合约页面即可查到完整的 ABI 信息</p><p>比如 Arbitrum 测试网跨链桥: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/aipYKHL8w1">https://rinkeby.etherscan.io/address/0x578bade599406a8fe3d24fd7f7211c0911f5b29e#code</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/4204619722f9e6e291a78c9437217ae341b6ce3c99e901e707854c29b40f668a.jpg" alt="ABI 信息" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">ABI 信息</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">合约的调用函数及参数</h2><p>在你手工交互的 <code>Hash</code> 信息页面的最底部，可以看到 <code>&quot;Input Data&quot;</code> 区域。如果是开源合约则直接显示调用的函数名称及参数信息。</p><p>对于未开源合约的调用，可以参考之前的一个 Twitter 🧵</p><div data-type="twitter" tweetId="1521058983838380032" tweetData="{&quot;__typename&quot;:&quot;Tweet&quot;,&quot;lang&quot;:&quot;zh&quot;,&quot;favorite_count&quot;:208,&quot;created_at&quot;:&quot;2022-05-02T09:28:16.000Z&quot;,&quot;display_text_range&quot;:[0,161],&quot;entities&quot;:{&quot;hashtags&quot;:[],&quot;urls&quot;:[],&quot;user_mentions&quot;:[{&quot;id_str&quot;:&quot;1375161541704642564&quot;,&quot;indices&quot;:[141,149],&quot;name&quot;:&quot;Black Magic An&quot;,&quot;screen_name&quot;:&quot;MrsZaaa&quot;}],&quot;symbols&quot;:[]},&quot;id_str&quot;:&quot;1521058983838380032&quot;,&quot;text&quot;:&quot;✨ 未开源智能合约的调用原理、方法及实现代码 🧵\n\n对于未开源的智能合约，是否就束手无策，无法调用了呢？\n\n并不完全是。\n\n如果你在项目官网可以用 Metamask 正常调用这个智能合约，那么通过一定的策略，你也可以用 Web3 .py 的方式来调用\n\n本🧵的一些思路、工具来自于 @MrsZaaa  的教学视频，感谢&quot;,&quot;user&quot;:{&quot;id_str&quot;:&quot;148629284&quot;,&quot;name&quot;:&quot;gm365&quot;,&quot;screen_name&quot;:&quot;gm365&quot;,&quot;is_blue_verified&quot;:true,&quot;profile_image_shape&quot;:&quot;Circle&quot;,&quot;verified&quot;:false,&quot;profile_image_url_https&quot;:&quot;https://storage.googleapis.com/papyrus_images/9fed6223e3ad1f12e00fa919b2cba3280b2ea8e477a6894f4629e6d691ae4431.jpg&quot;},&quot;edit_control&quot;:{&quot;edit_tweet_ids&quot;:[&quot;1521058983838380032&quot;],&quot;editable_until_msecs&quot;:&quot;1651485496313&quot;,&quot;is_edit_eligible&quot;:true,&quot;edits_remaining&quot;:&quot;5&quot;},&quot;conversation_count&quot;:17,&quot;news_action_type&quot;:&quot;conversation&quot;,&quot;isEdited&quot;:false,&quot;isStaleEdit&quot;:false}"> 
  <div class="twitter-embed embed">
    <div class="twitter-header">
        <div style="display:flex">
          <a target="_blank" href="https://twitter.com/gm365">
              <img alt="User Avatar" class="twitter-avatar" src="https://storage.googleapis.com/papyrus_images/9fed6223e3ad1f12e00fa919b2cba3280b2ea8e477a6894f4629e6d691ae4431.jpg" />
            </a>
            <div style="margin-left:4px;margin-right:auto;line-height:1.2;">
              <a target="_blank" href="https://twitter.com/gm365" class="twitter-displayname">gm365</a>
              <p><a target="_blank" href="https://twitter.com/gm365" class="twitter-username">@gm365</a></p>
    
            </div>
            <a href="https://twitter.com/gm365/status/1521058983838380032" target="_blank">
              <img alt="Twitter Logo" class="twitter-logo" src="https://paragraph.com/editor/twitter/logo.png" />
            </a>
          </div>
        </div>
      
    <div class="twitter-body">
      <img class="twitter-emoji" draggable="false" alt="✨" src="https://abs-0.twimg.com/emoji/v2/72x72/2728.png"/> 未开源智能合约的调用原理、方法及实现代码 <img class="twitter-emoji" draggable="false" alt="🧵" src="https://abs-0.twimg.com/emoji/v2/72x72/1f9f5.png"/><br /><br />对于未开源的智能合约，是否就束手无策，无法调用了呢？<br /><br />并不完全是。<br /><br />如果你在项目官网可以用 Metamask 正常调用这个智能合约，那么通过一定的策略，你也可以用 Web3 .py 的方式来调用<br /><br />本<img class="twitter-emoji" draggable="false" alt="🧵" src="https://abs-0.twimg.com/emoji/v2/72x72/1f9f5.png"/>的一些思路、工具来自于 <a class="twitter-content-link"  href="https://twitter.com/MrsZaaa" target="_blank">@MrsZaaa</a>  的教学视频，感谢
      
      
       
    </div>
    
     <div class="twitter-footer">
          <a target="_blank" href="https://twitter.com/gm365/status/1521058983838380032" style="margin-right:16px; display:flex;">
            <img alt="Like Icon" class="twitter-heart" src="https://paragraph.com/editor/twitter/heart.png">
            208
          </a>
          <a target="_blank" href="https://twitter.com/gm365/status/1521058983838380032"><p>4:28 AM • May 2, 2022</p></a>
        </div>
    
  </div> 
  </div><p>理论上，能通过网站交互的，就一定能通过程序来完成。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/c1f385c1a8d4a15d4bb563fad25b0ce2897987e6f0806254e4c09356158098c1.jpg" alt="调用函数及参数" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">调用函数及参数</figcaption></figure><h2 id="h-python-zksync" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用 Python 交互 zkSync 测试网跨链桥</h2><p>相比较于 <code>Arbitrum</code>，<code>zkSync</code> 的难度稍微高了一点。因为后者使用了一个可升级合约，导致无法在 <code>Etherscan</code> 网站找到确切的 <code>ABI</code> 信息 。</p><p>不过，通过前一条 🧵 中的方法，最终在网站 <code>chunk-vendor-xxx.js</code> 文件中定位到了完整的 <code>ABI</code> 信息。</p><p>✅ 难关攻克</p><p>示例代码：</p><pre data-type="codeBlock" text="# bridge eth from goerli to zkSync 2.0 testnet
def bridge_zkSync_eth(w3, from_address, private_key, contract_address, amount_in_ether, chainId):
    from_address = Web3.toChecksumAddress(from_address)
    contract_address = Web3.toChecksumAddress(contract_address)

    # Deposit ETH ABI
    ABI = &apos;[{&quot;inputs&quot;:[{&quot;internalType&quot;:&quot;uint256&quot;,&quot;name&quot;:&quot;_amount&quot;,&quot;type&quot;:&quot;uint256&quot;},{&quot;internalType&quot;:&quot;address&quot;,&quot;name&quot;:&quot;_zkSyncAddress&quot;,&quot;type&quot;:&quot;address&quot;},{&quot;internalType&quot;:&quot;enum Operations.QueueType&quot;,&quot;name&quot;:&quot;_queueType&quot;,&quot;type&quot;:&quot;uint8&quot;},{&quot;internalType&quot;:&quot;enum Operations.OpTree&quot;,&quot;name&quot;:&quot;_opTree&quot;,&quot;type&quot;:&quot;uint8&quot;}],&quot;name&quot;:&quot;depositETH&quot;,&quot;outputs&quot;:[],&quot;stateMutability&quot;:&quot;payable&quot;,&quot;type&quot;:&quot;function&quot;},{&quot;inputs&quot;:[],&quot;name&quot;:&quot;emergencyFreezeDiamond&quot;,&quot;outputs&quot;:[],&quot;stateMutability&quot;:&quot;nonpayable&quot;,&quot;type&quot;:&quot;function&quot;}]&apos;

    amount_in_wei = w3.toWei(amount_in_ether, &apos;ether&apos;)
    nonce = w3.eth.getTransactionCount(from_address)

    # goerli链：无须设置 gas, gas price , chainId, 会自动计算并配置为 EIP 1559 类型
    tx_params = {
        &apos;value&apos;: amount_in_wei,
        &quot;nonce&quot;: nonce,
        # &apos;gas&apos;: 150000,
        # &apos;gasPrice&apos;: w3.toWei(2, &apos;gwei&apos;),
        # &apos;maxFeePerGas&apos;: w3.toWei(8, &apos;gwei&apos;),
        # &apos;maxPriorityFeePerGas&apos;: w3.toWei(2, &apos;gwei&apos;),
        # &apos;chainId&apos;: chainId,
    }

    contract = w3.eth.contract(address=contract_address, abi=ABI)

    try:
        raw_txn = contract.functions.depositETH(amount_in_wei, from_address, 0, 0).buildTransaction(tx_params)
        signed_txn = w3.eth.account.sign_transaction(raw_txn, private_key=private_key)
        txn = w3.eth.send_raw_transaction(signed_txn.rawTransaction)
        return {&apos;status&apos;: &apos;succeed&apos;, &apos;txn_hash&apos;: w3.toHex(txn), &apos;task&apos;: &apos;zkSync Bridge ETH&apos;}
    except Exception as e:
        return {&apos;status&apos;: &apos;failed&apos;, &apos;error&apos;: e, &apos;task&apos;: &apos;zkSync Bridge ETH&apos;}
"><code># bridge eth from goerli to zkSync <span class="hljs-number">2.0</span> testnet
def <span class="hljs-title function_ invoke__">bridge_zkSync_eth</span>(w3, from_address, private_key, contract_address, amount_in_ether, chainId):
    from_address = Web3.<span class="hljs-title function_ invoke__">toChecksumAddress</span>(from_address)
    contract_address = Web3.<span class="hljs-title function_ invoke__">toChecksumAddress</span>(contract_address)

    # Deposit ETH ABI
    ABI = '[{<span class="hljs-string">"inputs"</span>:[{<span class="hljs-string">"internalType"</span>:<span class="hljs-string">"uint256"</span>,<span class="hljs-string">"name"</span>:<span class="hljs-string">"_amount"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"uint256"</span>},{<span class="hljs-string">"internalType"</span>:<span class="hljs-string">"address"</span>,<span class="hljs-string">"name"</span>:<span class="hljs-string">"_zkSyncAddress"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"address"</span>},{<span class="hljs-string">"internalType"</span>:<span class="hljs-string">"enum Operations.QueueType"</span>,<span class="hljs-string">"name"</span>:<span class="hljs-string">"_queueType"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"uint8"</span>},{<span class="hljs-string">"internalType"</span>:<span class="hljs-string">"enum Operations.OpTree"</span>,<span class="hljs-string">"name"</span>:<span class="hljs-string">"_opTree"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"uint8"</span>}],<span class="hljs-string">"name"</span>:<span class="hljs-string">"depositETH"</span>,<span class="hljs-string">"outputs"</span>:[],<span class="hljs-string">"stateMutability"</span>:<span class="hljs-string">"payable"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"function"</span>},{<span class="hljs-string">"inputs"</span>:[],<span class="hljs-string">"name"</span>:<span class="hljs-string">"emergencyFreezeDiamond"</span>,<span class="hljs-string">"outputs"</span>:[],<span class="hljs-string">"stateMutability"</span>:<span class="hljs-string">"nonpayable"</span>,<span class="hljs-string">"type"</span>:<span class="hljs-string">"function"</span>}]'

    amount_in_wei = w3.<span class="hljs-title function_ invoke__">toWei</span>(amount_in_ether, <span class="hljs-symbol">'ether</span>')
    nonce = w3.eth.<span class="hljs-title function_ invoke__">getTransactionCount</span>(from_address)

    # goerli链：无须设置 gas, gas price , chainId, 会自动计算并配置为 EIP <span class="hljs-number">1559</span> 类型
    tx_params = {
        <span class="hljs-symbol">'value</span>': amount_in_wei,
        <span class="hljs-string">"nonce"</span>: nonce,
        # <span class="hljs-symbol">'gas</span>': <span class="hljs-number">150000</span>,
        # <span class="hljs-symbol">'gasPrice</span>': w3.<span class="hljs-title function_ invoke__">toWei</span>(<span class="hljs-number">2</span>, <span class="hljs-symbol">'gwei</span>'),
        # <span class="hljs-symbol">'maxFeePerGas</span>': w3.<span class="hljs-title function_ invoke__">toWei</span>(<span class="hljs-number">8</span>, <span class="hljs-symbol">'gwei</span>'),
        # <span class="hljs-symbol">'maxPriorityFeePerGas</span>': w3.<span class="hljs-title function_ invoke__">toWei</span>(<span class="hljs-number">2</span>, <span class="hljs-symbol">'gwei</span>'),
        # <span class="hljs-symbol">'chainId</span>': chainId,
    }

    contract = w3.eth.<span class="hljs-title function_ invoke__">contract</span>(address=contract_address, abi=ABI)

    <span class="hljs-keyword">try</span>:
        raw_txn = contract.functions.<span class="hljs-title function_ invoke__">depositETH</span>(amount_in_wei, from_address, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>).<span class="hljs-title function_ invoke__">buildTransaction</span>(tx_params)
        signed_txn = w3.eth.account.<span class="hljs-title function_ invoke__">sign_transaction</span>(raw_txn, private_key=private_key)
        txn = w3.eth.<span class="hljs-title function_ invoke__">send_raw_transaction</span>(signed_txn.rawTransaction)
        <span class="hljs-keyword">return</span> {<span class="hljs-symbol">'status</span>': <span class="hljs-symbol">'succeed</span>', <span class="hljs-symbol">'txn_hash</span>': w3.<span class="hljs-title function_ invoke__">toHex</span>(txn), <span class="hljs-symbol">'task</span>': <span class="hljs-symbol">'zkSync</span> Bridge ETH'}
    except Exception <span class="hljs-keyword">as</span> e:
        <span class="hljs-keyword">return</span> {<span class="hljs-symbol">'status</span>': <span class="hljs-symbol">'failed</span>', <span class="hljs-symbol">'error</span>': e, <span class="hljs-symbol">'task</span>': <span class="hljs-symbol">'zkSync</span> Bridge ETH'}
</code></pre><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/a4ec33715bcba5ea6040b00a0815ef5a7ee433d5d79358ba44f54a397072ec9f.jpg" alt="zkSync Bridge" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">zkSync Bridge</figcaption></figure><h2 id="h-bungee-refuel" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">交互 Bungee 的 Refuel 模块</h2><p>Bungee 跨链桥最近添加了一个<code> Refuel</code> 模块，可以帮你把一条链的原生代币，跨链并兑换为另一条链的原生代币（用于），功能相当实用。</p><p>相比较于之前的任务，这个交互的难度在两颗 🌟</p><p>▪️ 合约开源</p><p>▪️ 参数只有两枚</p><p>唯一需要研究清楚的就只是<code>&quot;destinationChainId&quot;</code>所对应的具体数值（跨链到不同目的地，其定义的 <code>destinationChainId</code> 是不一样的）</p><p>具体的实现代码没有给出，留作大家的课堂作业吧。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/3471f4394ac1e31f80d855e465d0562cafdcc438eb980b7a841a305259f28674.jpg" alt="MetaMask 提示调用函数信息" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">MetaMask 提示调用函数信息</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/8af35871f82eeb0ce5cd0f456a2006109874ef1d5884eb6c4fac08a7237d5bc0.jpg" alt="ABI 信息" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">ABI 信息</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">科学家合约交互四部曲</h2><p>用程序来交互合约，核心就四个步骤：</p><p>▪️ 确定合约地址</p><p>▪️ 找到合约ABI</p><p>▪️ 研究函数名及参数具体含义</p><p>▪️ 写交互代码，广播交易信息</p><p>像跨链桥这类合约开源、参数简单、 Gas磨损偏低的， 自然会成为科学家堆积成山的重灾区。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">教程开源代码</h2><p>本篇教程内涉及到的 4个任务及对应的完整代码已开源在 GitHub，供大家参考：</p><div data-type="embedly" src="https://t.co/vGipHV5yFl" data="{&quot;provider_url&quot;:&quot;https://github.com&quot;,&quot;description&quot;:&quot;🐳 Web3科学家极简入门指南. Contribute to gm365/Web3_Tutorial development by creating an account on GitHub.&quot;,&quot;title&quot;:&quot;GitHub - gm365/Web3_Tutorial: 🐳 Web3科学家极简入门指南&quot;,&quot;url&quot;:&quot;https://github.com/gm365/Web3_Tutorial&quot;,&quot;author_name&quot;:&quot;gm365&quot;,&quot;thumbnail_width&quot;:1200,&quot;thumbnail_url&quot;:&quot;https://storage.googleapis.com/papyrus_images/db2b2ceeb4db0025217caf5b9ba64dd4d4b88df3221a4db1b746dad3eda8eb93.png&quot;,&quot;author_url&quot;:&quot;https://github.com/gm365&quot;,&quot;version&quot;:&quot;1.0&quot;,&quot;provider_name&quot;:&quot;GitHub&quot;,&quot;type&quot;:&quot;link&quot;,&quot;thumbnail_height&quot;:600,&quot;image&quot;:{&quot;img&quot;:{&quot;width&quot;:1200,&quot;height&quot;:600,&quot;src&quot;:&quot;https://storage.googleapis.com/papyrus_images/db2b2ceeb4db0025217caf5b9ba64dd4d4b88df3221a4db1b746dad3eda8eb93.png&quot;}}}" format="small"><link rel="preload" as="image" href="https://storage.googleapis.com/papyrus_images/db2b2ceeb4db0025217caf5b9ba64dd4d4b88df3221a4db1b746dad3eda8eb93.png"/><div class="react-component embed my-5" data-drag-handle="true" data-node-view-wrapper="" style="white-space:normal"><a class="link-embed-link" href="https://t.co/vGipHV5yFl" target="_blank" rel="noreferrer"><div class="link-embed"><div class="flex-1"><div><h2>GitHub - gm365/Web3_Tutorial: 🐳 Web3科学家极简入门指南</h2><p>🐳 Web3科学家极简入门指南. Contribute to gm365/Web3_Tutorial development by creating an account on GitHub.</p></div><span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-link h-3 w-3 my-auto inline mr-1"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>https://github.com</span></div><img src="https://storage.googleapis.com/papyrus_images/db2b2ceeb4db0025217caf5b9ba64dd4d4b88df3221a4db1b746dad3eda8eb93.png"/></div></a></div></div><p>建议大家申请好 <code>Infura</code> 的 <code>API Key</code> 之后，先从测试网的几个跨链桥开始尝试。</p><p>任何涉及到主网交互的，请务必做好对密钥信息的保密工作，谨防泄漏，以免丢失资产。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">👨‍🔬 科学家进阶之旅</h2><p>👨‍🔬 交互科学家</p><p>测试网简单合约 ➜ 测试网复杂合约 ➜ 主网合约 ➜ 多账号单合约 ➜ 多账号多合约 ➜ 多账号切断关联 ➜ 多账号多合约模拟真实用户行为轨迹 ➜ ( Ξ ) ➜ 躺平</p><p>👩‍🔬 大神科学家</p><p>MEV套利 ➜ ( Ξ Ξ Ξ ) ➜ 躺平</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/560cd7332991691417b37d117c74eddb7bba52d5f9b7a88ab9a330623bb22da4.jpg" alt="Ξ 躺平" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Ξ 躺平</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">总结</h2><p>所谓 <code>Web3</code> “科学家”，在大部分语境下，也只不过是用程序代替人工进行合约交互的那群人。</p><p>在传统领域，顶多也就称得上是“脚本小子”；但在 <code>Web3</code> 这个蛮荒领域，却被冠以如此高大上的名号，可见行业尚处早期。</p><p>然而，随着我们徐徐揭开其神秘面纱，却发现并无太大玄机。学好 <code>Python</code> ，你我皆可登堂入室。</p><p>👨‍🔬 人均科学家的时代即将来临？</p><p>任何行业领域内的机会窗口都是稍纵即逝的，越是处于行业早期，越是有较大的先发优势。同时这样的时期也是普通人“逆天改命”最好的时机，是草根阶层实现阶层跨越的绝佳时机。</p><p>让我们一起迎接 <code>Web3</code> 的大航海时代 ！</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><figcaption HTMLAttributes="[object Object]" class="">Web3 大航海时代</figcaption></figure><p>附录：</p><ul><li><p>本文原推 🧵:</p><div data-type="twitter" tweetId="1527487356198330368" tweetData="{&quot;__typename&quot;:&quot;Tweet&quot;,&quot;lang&quot;:&quot;zh&quot;,&quot;favorite_count&quot;:1391,&quot;possibly_sensitive&quot;:false,&quot;created_at&quot;:&quot;2022-05-20T03:12:19.000Z&quot;,&quot;display_text_range&quot;:[0,158],&quot;entities&quot;:{&quot;hashtags&quot;:[],&quot;urls&quot;:[],&quot;user_mentions&quot;:[],&quot;symbols&quot;:[],&quot;media&quot;:[{&quot;display_url&quot;:&quot;pic.x.com/NzW8IU1D82&quot;,&quot;expanded_url&quot;:&quot;https://x.com/gm365/status/1527487356198330368/photo/1&quot;,&quot;indices&quot;:[154,177],&quot;url&quot;:&quot;https://t.co/NzW8IU1D82&quot;}]},&quot;id_str&quot;:&quot;1527487356198330368&quot;,&quot;text&quot;:&quot;✨ Web3 科学家极简入门指南\n\n👨‍🔬 除了 Web3 领域外，“科学家”的头衔从没有离普通人这么近过\n\n一点点 Python (JavaScrip更好) 基本功、一点点智能合约基础知识、一点点项目投研分析（非必需） = Web3 科学家\n\n🌀 一篇零基础教程，献给所有心怀科学家梦想的同学们\n\n🧵 👇 https://t.co/NzW8IU1D82&quot;,&quot;user&quot;:{&quot;id_str&quot;:&quot;148629284&quot;,&quot;name&quot;:&quot;gm365&quot;,&quot;screen_name&quot;:&quot;gm365&quot;,&quot;is_blue_verified&quot;:true,&quot;profile_image_shape&quot;:&quot;Circle&quot;,&quot;verified&quot;:false,&quot;profile_image_url_https&quot;:&quot;https://storage.googleapis.com/papyrus_images/9fed6223e3ad1f12e00fa919b2cba3280b2ea8e477a6894f4629e6d691ae4431.jpg&quot;},&quot;edit_control&quot;:{&quot;edit_tweet_ids&quot;:[&quot;1527487356198330368&quot;],&quot;editable_until_msecs&quot;:&quot;1653018139000&quot;,&quot;is_edit_eligible&quot;:true,&quot;edits_remaining&quot;:&quot;5&quot;},&quot;mediaDetails&quot;:[{&quot;display_url&quot;:&quot;pic.x.com/NzW8IU1D82&quot;,&quot;expanded_url&quot;:&quot;https://x.com/gm365/status/1527487356198330368/photo/1&quot;,&quot;ext_media_availability&quot;:{&quot;status&quot;:&quot;Available&quot;},&quot;indices&quot;:[154,177],&quot;media_url_https&quot;:&quot;https://pbs.twimg.com/media/FTK4KutagAExKQP.png&quot;,&quot;original_info&quot;:{&quot;height&quot;:383,&quot;width&quot;:900,&quot;focus_rects&quot;:[{&quot;x&quot;:130,&quot;y&quot;:0,&quot;w&quot;:684,&quot;h&quot;:383},{&quot;x&quot;:281,&quot;y&quot;:0,&quot;w&quot;:383,&quot;h&quot;:383},{&quot;x&quot;:304,&quot;y&quot;:0,&quot;w&quot;:336,&quot;h&quot;:383},{&quot;x&quot;:376,&quot;y&quot;:0,&quot;w&quot;:192,&quot;h&quot;:383},{&quot;x&quot;:0,&quot;y&quot;:0,&quot;w&quot;:900,&quot;h&quot;:383}]},&quot;sizes&quot;:{&quot;large&quot;:{&quot;h&quot;:383,&quot;resize&quot;:&quot;fit&quot;,&quot;w&quot;:900},&quot;medium&quot;:{&quot;h&quot;:383,&quot;resize&quot;:&quot;fit&quot;,&quot;w&quot;:900},&quot;small&quot;:{&quot;h&quot;:289,&quot;resize&quot;:&quot;fit&quot;,&quot;w&quot;:680},&quot;thumb&quot;:{&quot;h&quot;:150,&quot;resize&quot;:&quot;crop&quot;,&quot;w&quot;:150}},&quot;type&quot;:&quot;photo&quot;,&quot;url&quot;:&quot;https://t.co/NzW8IU1D82&quot;}],&quot;photos&quot;:[{&quot;backgroundColor&quot;:{&quot;red&quot;:204,&quot;green&quot;:214,&quot;blue&quot;:221},&quot;cropCandidates&quot;:[{&quot;x&quot;:130,&quot;y&quot;:0,&quot;w&quot;:684,&quot;h&quot;:383},{&quot;x&quot;:281,&quot;y&quot;:0,&quot;w&quot;:383,&quot;h&quot;:383},{&quot;x&quot;:304,&quot;y&quot;:0,&quot;w&quot;:336,&quot;h&quot;:383},{&quot;x&quot;:376,&quot;y&quot;:0,&quot;w&quot;:192,&quot;h&quot;:383},{&quot;x&quot;:0,&quot;y&quot;:0,&quot;w&quot;:900,&quot;h&quot;:383}],&quot;expandedUrl&quot;:&quot;https://x.com/gm365/status/1527487356198330368/photo/1&quot;,&quot;url&quot;:&quot;https://storage.googleapis.com/papyrus_images/a35b93a48e269c8d704320ad77b0f68da276e77ea0472be808c0948c884cd970.png&quot;,&quot;width&quot;:900,&quot;height&quot;:383}],&quot;conversation_count&quot;:88,&quot;news_action_type&quot;:&quot;conversation&quot;,&quot;isEdited&quot;:false,&quot;isStaleEdit&quot;:false}"> 
  <div class="twitter-embed embed">
    <div class="twitter-header">
        <div style="display:flex">
          <a target="_blank" href="https://twitter.com/gm365">
              <img alt="User Avatar" class="twitter-avatar" src="https://storage.googleapis.com/papyrus_images/9fed6223e3ad1f12e00fa919b2cba3280b2ea8e477a6894f4629e6d691ae4431.jpg" />
            </a>
            <div style="margin-left:4px;margin-right:auto;line-height:1.2;">
              <a target="_blank" href="https://twitter.com/gm365" class="twitter-displayname">gm365</a>
              <p><a target="_blank" href="https://twitter.com/gm365" class="twitter-username">@gm365</a></p>
    
            </div>
            <a href="https://twitter.com/gm365/status/1527487356198330368" target="_blank">
              <img alt="Twitter Logo" class="twitter-logo" src="https://paragraph.com/editor/twitter/logo.png" />
            </a>
          </div>
        </div>
      
    <div class="twitter-body">
      <img class="twitter-emoji" draggable="false" alt="✨" src="https://abs-0.twimg.com/emoji/v2/72x72/2728.png"/> Web3 科学家极简入门指南<br /><br /><img class="twitter-emoji" draggable="false" alt="👨‍🔬" src="https://abs-0.twimg.com/emoji/v2/72x72/1f468-200d-1f52c.png"/> 除了 Web3 领域外，“科学家”的头衔从没有离普通人这么近过<br /><br />一点点 Python (JavaScrip更好) 基本功、一点点智能合约基础知识、一点点项目投研分析（非必需） = Web3 科学家<br /><br /><img class="twitter-emoji" draggable="false" alt="🌀" src="https://abs-0.twimg.com/emoji/v2/72x72/1f300.png"/> 一篇零基础教程，献给所有心怀科学家梦想的同学们<br /><br /><img class="twitter-emoji" draggable="false" alt="🧵" src="https://abs-0.twimg.com/emoji/v2/72x72/1f9f5.png"/> <img class="twitter-emoji" draggable="false" alt="👇" src="https://abs-0.twimg.com/emoji/v2/72x72/1f447.png"/> 
      <div class="twitter-media"><img class="twitter-image" src="https://storage.googleapis.com/papyrus_images/a35b93a48e269c8d704320ad77b0f68da276e77ea0472be808c0948c884cd970.png" /></div>
      
       
    </div>
    
     <div class="twitter-footer">
          <a target="_blank" href="https://twitter.com/gm365/status/1527487356198330368" style="margin-right:16px; display:flex;">
            <img alt="Like Icon" class="twitter-heart" src="https://paragraph.com/editor/twitter/heart.png">
            1,391
          </a>
          <a target="_blank" href="https://twitter.com/gm365/status/1527487356198330368"><p>10:12 PM • May 19, 2022</p></a>
        </div>
    
  </div> 
  </div></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/b5250e9a406fc0bbc1c0f8ef74d75d9b5ba600f780c9de8f5c55a3aa62bfcea5.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[✨ Dune Analytics零基础极简入门指南]]></title>
            <link>https://paragraph.com/@gm365-2/dune-analytics</link>
            <guid>oRCvpeis60jWaEs0xEHs</guid>
            <pubDate>Sun, 15 May 2022 09:08:28 GMT</pubDate>
            <description><![CDATA[Dune Analytics¹ 号称“平民版 Nansen”、“链上数据分析师神器”，为各路大神所追捧。 然神器在手，奈何找不到适合新手小白的说明书，我等只得望洋兴叹否？ 非也！ 本文作为一篇入门级的极简教程，适合 Dune 的零基础小白用户，与大家一起掀开 Dune 女神的面纱。何谓 Dune？Dune 作为一款链上数据研究分析的强大工具，经过4轮融资，目前估值已达10亿美元²。 用户通过类SQL的数据库查询语言，从 Dune 缓存的区块链数据仓库中检索、筛选、提取、聚合，形成一个个 Query，再对查询到的数据进行可视化，最终汇总而成一个个 Dashboard 面板。何谓数据仓库？区块链本质上是一个去中心化的账本，所有过往的交易转账、合约调用形成了一条条的交易记录明细，包含交易时间、转入、转出地址、交易金额、调用信息、合约事件、tx_hash 等数据。 Dune 将以上所有数据分门别类进行存储形成数据仓库，供有需要的人通过类SQL语言来调用、查询、分析（可谓功德无量）。何谓 SQL？SQL 即“结构化查询语言”，专用于数据库相关的查询、管理。 在 Dune 中，我们用 SQL...]]></description>
            <content:encoded><![CDATA[<p>Dune Analytics¹ 号称“平民版 Nansen”、“链上数据分析师神器”，为各路大神所追捧。</p><p>然神器在手，奈何找不到适合新手小白的说明书，我等只得望洋兴叹否？</p><p>非也！</p><p>本文作为一篇入门级的极简教程，适合 Dune 的零基础小白用户，与大家一起掀开 Dune 女神的面纱。</p><h2 id="h-dune" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">何谓 Dune？</h2><p>Dune 作为一款链上数据研究分析的强大工具，经过4轮融资，目前估值已达10亿美元²。</p><p>用户通过类SQL的数据库查询语言，从 Dune 缓存的区块链数据仓库中检索、筛选、提取、聚合，形成一个个 Query，再对查询到的数据进行可视化，最终汇总而成一个个 Dashboard 面板。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">何谓数据仓库？</h2><p>区块链本质上是一个去中心化的账本，所有过往的交易转账、合约调用形成了一条条的交易记录明细，包含交易时间、转入、转出地址、交易金额、调用信息、合约事件、tx_hash 等数据。</p><p>Dune 将以上所有数据分门别类进行存储形成数据仓库，供有需要的人通过类SQL语言来调用、查询、分析（可谓功德无量）。</p><h2 id="h-sql" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">何谓 SQL？</h2><p>SQL 即“结构化查询语言”，专用于数据库相关的查询、管理。</p><p>在 Dune 中，我们用 SQL³ 查询语句来获取所有想要的数据，构建成对应的 “Query”。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/7cb6557c2cf80289cd046a0a27109054d47c26fb5b9222c5bf5098a435b38fbc.png" alt="SQL 语言" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">SQL 语言</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">何谓数据表？</h2><p>每一个数据表（table）⁴ 可以视作一个超大的 Excel 表格，按顺序记录了所有与之相关的数据。</p><p>Dune 提供了很多内置的知名协议专属的 &quot;数据表dataset&quot;。 注册登陆你的 Dune 账户，点击顶部的 &quot;New Query&quot; 即可打开如下页面： 左侧即为内置数据表，右侧是“查询语句”和“查询结果”</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/21f4268d50981238b418fb4064df4406a72de86db2b764293d33116da1eb3017.jpg" alt="Dune New Query 页面" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Dune New Query 页面</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">常用数据表</h2><p>除了内置的数据表外，还有些常用的数据表，比如： 最常用的 ethereum.transactions，可以查询所有的以太坊链上交易信息，包括了普通转账和合约调用等信息。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f5c786260c8a58db1c6d5484cc071573dbbb76287a514edf1ba3818b7ee176b3.jpg" alt="Dune 常用数据表" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Dune 常用数据表</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">数据表里有什么？</h2><p>不同数据表，提供的内容各有迥异。</p><p>以 <code>&quot;ethereum.transactions&quot;</code> 为例，表内提供了:</p><ul><li><p><code>block_time</code> 区块时间</p></li><li><p><code>from</code> 发起地址</p></li><li><p><code>to</code> 转入地址（或调用的合约地址）</p></li><li><p><code>value</code> 转账金额，</p></li><li><p><code>data</code> 附加数据（合约调用的input data）</p></li></ul><p>等诸多数据</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/f1f790427713a81d96e6db2ad8d696e287afb513875eda3939cdcaa3f94fe231.jpg" alt="transactions 数据表" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">transactions 数据表</figcaption></figure><h2 id="h-sql" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">SQL 查询语句怎么写？</h2><p>基本的 SQL 查询语句： <code>SELECT * FROM X</code></p><ul><li><p><code>select</code>: 取什么数据</p></li><li><p><code>from</code>: 从哪里取数据</p></li><li><p><code>where</code>: 限制条件是什么</p></li><li><p><code>order by</code>: 根据什么排序</p></li><li><p><code>limit</code>: 限制取回的数据条数</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/091ee404520b341fe9d1e5cf2661eb4620a54420c0d135ae16595cf2b3e2715c.jpg" alt="SQL 查询语句" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">SQL 查询语句</figcaption></figure><h2 id="h-dune" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">你的第一条 Dune 查询语句</h2><p>打开 Dune 的 &quot;New Query&quot;，粘贴以下语句</p><p>👉 <code>select * from ethereum.transactions limit 5</code></p><p>点击 &quot;Run&quot; 稍等即可在&quot;Query Results&quot;看到查询结果</p><p>语句中的 <code>*</code> 代表查询所有字段，<code>limit 5</code> 是为了限制数据取回的数量，如果不加这条限制，你就是在告诉 Dune 要取回以太坊链上的所有交易数据（耗时超长且无必要）</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/5c0af3c2b8a0e85f32787061b72f342deb2ddab92167bc9b6ba09586c08424e0.jpg" alt="首条 Dune 查询语句" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">首条 Dune 查询语句</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">更复杂的查询语句</h2><p>现在让我们来试试更复杂（也更有趣）的 Dune 查询语句：查询 V神钱包 的链上交易信息</p><p>这次我们新增了 <code>where &quot;from&quot;</code> 限制条件，只筛选“V神”的钱包地址，<code>order by</code> 语句限定排序条件，<code>desc</code> 表降序</p><pre data-type="codeBlock" text="select *
from ethereum.transactions
where &quot;from&quot; = &apos;\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6&apos;
order by &quot;block_time&quot; desc
limit 10
"><code><span class="hljs-keyword">select</span> <span class="hljs-operator">*</span>
<span class="hljs-keyword">from</span> ethereum.transactions
<span class="hljs-keyword">where</span> "from" <span class="hljs-operator">=</span> <span class="hljs-string">'\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6'</span>
<span class="hljs-keyword">order</span> <span class="hljs-keyword">by</span> "block_time" <span class="hljs-keyword">desc</span>
limit <span class="hljs-number">10</span>
</code></pre><p>点击链接即可复制语句，或 fork 后自己该参数运行 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/I59NaGsig2">dune.com/queries/724390</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/0ce30b7bd689c5009e86e782708311055b428eca98af946a6d1b9db321d1f58f.jpg" alt="更复杂的查询语句" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">更复杂的查询语句</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">更有用的查询语句</h2><p>现在，让我们筛选一些“更有用”的信息，比如：转账金额</p><pre data-type="codeBlock" text="select block_time as &quot;date&quot;,
value/1e18 as &quot;value&quot; -- value 字段的值换算为 ETH 单位
from ethereum.transactions
where &quot;from&quot; = &apos;\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6&apos; -- 交易的发出地址为 V神钱包
and value/1e18 &gt; 0.1 -- 转账金额 &gt; 0.1 ETH
order by &quot;block_time&quot; desc  -- 按照区块时间倒序排序
"><code>select block_time <span class="hljs-keyword">as</span> <span class="hljs-string">"date"</span>,
value<span class="hljs-operator">/</span><span class="hljs-number">1e18</span> <span class="hljs-keyword">as</span> <span class="hljs-string">"value"</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> value 字段的值换算为 ETH 单位
<span class="hljs-keyword">from</span> ethereum.transactions
where <span class="hljs-string">"from"</span> <span class="hljs-operator">=</span> <span class="hljs-string">'\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6'</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> 交易的发出地址为 V神钱包
and value<span class="hljs-operator">/</span><span class="hljs-number">1e18</span> <span class="hljs-operator">></span> <span class="hljs-number">0</span><span class="hljs-number">.1</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> 转账金额 <span class="hljs-operator">></span> <span class="hljs-number">0</span><span class="hljs-number">.1</span> ETH
order by <span class="hljs-string">"block_time"</span> desc  <span class="hljs-operator">-</span><span class="hljs-operator">-</span> 按照区块时间倒序排序
</code></pre><p>这次我们 <code>select</code> 选取两个字段: <code>block_time</code> 和 <code>value</code></p><p><code>value</code> 的值，我们通过 <code>value/1e18</code> 这个计算公式，换算为 ETH 单位⁵。</p><p><code>as</code> 关键词为其取一个好听的别名</p><p>第5行 <code>and</code> 关键词指 <code>where</code> 下多个限定条件取交集</p><p>Query链接：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/684ryLWPCo">https://dune.com/queries/728779</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b0a0f493774901d5d4bed96b2236f79cb1422f6c3e8d7d7c1a826cfbbd624ffa.jpg" alt="更有用的查询语句" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">更有用的查询语句</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">你的第一个可视化图表 📈</h2><p>数据已有，可视化图表呼之欲出</p><p>对于随时间变动的数值，最普遍使用的图表就是bar chart （条形图📊、柱状图）了</p><p>在前一步生成的查询结果顶部点击&quot;New visualization&quot;，选择“Bar Chart”，看到系统已经自动帮我们把 <code>X</code>,<code>Y</code> 轴都选好了。</p><p>如果在数据较多的情况下，则需要手动选择<code>Y</code>轴数据</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/abdc2bf8c9bbb07dcef06e444ded712a90a1f56f504d1f7efdb50cadd207f436.jpg" alt="首个可视化图表📈" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">首个可视化图表📈</figcaption></figure><h2 id="h-sum" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Sum函数求和</h2><p>一个最普遍的数据统计需求就是：加总求和</p><p>我们对筛选到的数据，直接使用 <code>sum</code> 函数即可</p><p>👉 <code>sum(value/1e18) as &quot;total&quot;</code></p><pre data-type="codeBlock" text="select sum(value/1e18) as &quot;total&quot; -- 使用 sum 函数对 value 求和
from ethereum.transactions
where &quot;from&quot; = &apos;\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6&apos;
"><code>select sum(value<span class="hljs-operator">/</span><span class="hljs-number">1e18</span>) <span class="hljs-keyword">as</span> <span class="hljs-string">"total"</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> 使用 sum 函数对 value 求和
<span class="hljs-keyword">from</span> ethereum.transactions
where <span class="hljs-string">"from"</span> <span class="hljs-operator">=</span> <span class="hljs-string">'\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6'</span>
</code></pre><p>然后在可视化图表区域选择 <code>Counter</code>，修改 <code>Title</code> ，就有了如图的汇总数据：83.25万 ETH</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/3a7009f9d68a9c2692e1598cefdb169576e573773f45b7531a4b87286e9a8bc0.jpg" alt="sum 求和函数" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">sum 求和函数</figcaption></figure><h2 id="h-count" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">计数 count</h2><p><code>SUM</code>、<code>AVG</code>、<code>MAX</code>、<code>MIN</code>、<code>COUNT</code> 统称为聚合函数，用于将组中的行汇总为单个值。</p><p>前面提到的 <code>sum</code> 用于对数值求和，<code>count</code> 则用于统计查询记录的总数目。</p><p>比如我们统计下 V神 钱包总计对外发出交易的次数</p><p>👉 <code>select count(*)</code></p><pre data-type="codeBlock" text="select count(*)   -- count 函数用于计数
from ethereum.transactions
where &quot;from&quot; = &apos;\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6&apos; -- V神 对外发出交易的次数
"><code>select count(<span class="hljs-operator">*</span>)   <span class="hljs-operator">-</span><span class="hljs-operator">-</span> count 函数用于计数
<span class="hljs-keyword">from</span> ethereum.transactions
where <span class="hljs-string">"from"</span> <span class="hljs-operator">=</span> <span class="hljs-string">'\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6'</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> V神 对外发出交易的次数
</code></pre><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/a3f43730620ab85bd3da016fa71db051f90325388b302741e6d9bdb4cbeefbdf.jpg" alt="count 计数" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">count 计数</figcaption></figure><h2 id="h-dune" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">你的第一个 Dune 数据看板</h2><p>保存前面每一个 Query 并取名，现在我们就来搭建你的首个 Dune Dashboard</p><p>在首页点击&quot;New Dashboard&quot;，或直接在 Query 结果页面点击&quot;Add to dashboard&quot;，输入 Dashboard 名字即可</p><p>👉 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://dune.com/gm365/:-V-YYDS">dune.com/gm365/:-V-YYDS</a></p><p>建议：首次取名选简短的英文，这部分内容会被用在url上（只支持英文、数字且后期无法修改）。你可以首次取名并保存之后，再对其改名以显示完成内容（现在可以中英文、emoji表情混用了）</p><h2 id="h-group-by" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">分类汇总 group by</h2><p>另一个常见的数据统计需求：分类汇总</p><p>比如我们想知道 V神 每月的转入、转出ETH总额</p><p>Query 代码的第1行中 <code>date_trunc(&apos;month&apos;, block_time)</code> 称为截断日期函数，用于将时间间隔截断为指定的精度级别（这里我们选取 <code>month</code> 统计每月数值，你还可以选 <code>hour</code>、<code>minute</code> 、<code>second</code> 、 <code>day</code>、<code>week</code>、<code>year</code> 等时间间隔单位 ）</p><pre data-type="codeBlock" text="select date_trunc(&apos;month&apos;, block_time) as &quot;Date&quot;,
sum(value/1e18) as &quot;Value&quot; -- 当月接收 ETH 求和
"><code>select date_trunc(<span class="hljs-string">'month'</span>, block_time) <span class="hljs-keyword">as</span> <span class="hljs-string">"Date"</span>,
sum(value<span class="hljs-operator">/</span><span class="hljs-number">1e18</span>) <span class="hljs-keyword">as</span> <span class="hljs-string">"Value"</span> <span class="hljs-operator">-</span><span class="hljs-operator">-</span> 当月接收 ETH 求和
</code></pre><p>第2行中，我们要使用 <code>sum</code> 表示对当月的 ETH 转账金额进行求和</p><p>最后一行的 <code>group by 1 </code>即按第一个字段 <code>&quot;date&quot;</code> 进行分类汇总，如果是第二个字段，则为 <code>group by 2</code>，以此类推</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b801e24a32a8f882a9db77ce38d51eb5b9a481c0ef838a8989bb5202f7a39200.jpg" alt="分类汇总" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">分类汇总</figcaption></figure><h2 id="h-cumulative-sum" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">累计求和 Cumulative Sum</h2><p>累计求和，在前一项数据基础上，累加当前数据，不断重复。</p><p>一般我们会先按日求和，再不断累加汇总。比如统计某个协议有史以来所有充值到合约地址的ETH总额。</p><p>要实现“累计求和”，其 Query 代码稍微有些复杂。</p><pre data-type="codeBlock" text="with net as (
select day,
sum(&quot;total&quot;) as daily_sum 
from (
    select value/1e18 as &quot;total&quot;, 
    date_trunc(&apos;day&apos;, &quot;block_time&quot;) as day
    from ethereum.&quot;traces&quot; 
    where &quot;from&quot; = &apos;\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6&apos; -- 从 V神钱包地址 发出的交易
) as &quot;total_amount&quot;
group by day
)

select day, sum(sum(&quot;daily_sum&quot;)) over (order by day)
from net
group by day
order by day desc
"><code><span class="hljs-keyword">with</span> net <span class="hljs-keyword">as</span> (
<span class="hljs-keyword">select</span> <span class="hljs-keyword">day</span>,
<span class="hljs-built_in">sum</span>("total") <span class="hljs-keyword">as</span> daily_sum 
<span class="hljs-keyword">from</span> (
    <span class="hljs-keyword">select</span> <span class="hljs-keyword">value</span><span class="hljs-operator">/</span><span class="hljs-number">1e18</span> <span class="hljs-keyword">as</span> "total", 
    date_trunc(<span class="hljs-string">'day'</span>, "block_time") <span class="hljs-keyword">as</span> <span class="hljs-keyword">day</span>
    <span class="hljs-keyword">from</span> ethereum."traces" 
    <span class="hljs-keyword">where</span> "from" <span class="hljs-operator">=</span> <span class="hljs-string">'\x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6'</span> <span class="hljs-comment">-- 从 V神钱包地址 发出的交易</span>
) <span class="hljs-keyword">as</span> "total_amount"
<span class="hljs-keyword">group</span> <span class="hljs-keyword">by</span> <span class="hljs-keyword">day</span>
)

<span class="hljs-keyword">select</span> <span class="hljs-keyword">day</span>, <span class="hljs-built_in">sum</span>(<span class="hljs-built_in">sum</span>("daily_sum")) <span class="hljs-keyword">over</span> (<span class="hljs-keyword">order</span> <span class="hljs-keyword">by</span> <span class="hljs-keyword">day</span>)
<span class="hljs-keyword">from</span> net
<span class="hljs-keyword">group</span> <span class="hljs-keyword">by</span> <span class="hljs-keyword">day</span>
<span class="hljs-keyword">order</span> <span class="hljs-keyword">by</span> <span class="hljs-keyword">day</span> <span class="hljs-keyword">desc</span>
</code></pre><p>面对这种情况，千万不要气馁。因为我们新人小白也有必杀技: <code>Fork并修改关键参数</code></p><p>比如，我们直接 fork 下面这个 Query ，在其基础之上，只需要修改第8行参数即可</p><p>👉 dune.com/queries/732520</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/1a11d57f21661bf3c98e8985542a082c6dd106b153c256dd9f3844119d13b1aa.jpg" alt="累计求和" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">累计求和</figcaption></figure><h2 id="h-fork" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Fork 神技能</h2><p>作为新人小白，我们一定要掌握的最重要的一门技能：fork 神技</p><p>站在前辈大神的肩膀之上，能让我们光速入门。越过陡峭的学习曲线，Fork 大神的代码与劳动成果，然后只需要简单修改核心参数，即可实现同类功能，获取心仪的数据（感恩大神与前辈的付出）</p><p>具体到 Dune上，我们在任一 Dune看板的图表区域点击左上角 <code>Query</code> 名字即可查看完整 <code>SQL</code>查询语句。Fork之，修改关键参数，然后点 <code>Run</code> 即可见证奇迹</p><p>比如 oxBi 大神做好的一个叫 ”Total Holder by Day - ENS ” 的 Query，统计了 ENS 代币每日的总持币人数。代码有67行之长，语法复杂，艰深无比，我等小白唯有汪洋兴叹的份儿。</p><p>但，如果你只是想借用下大神这个 Query 的功能，统计其他代币的每日持币人数，我们 Fork 后修改第14行代码中 Token 地址即可搞定。</p><p>站在巨人肩膀之上，轻松无比。</p><p>👉 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://dune.com/queries/326596/621471">dune.com/queries/326596/621471</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/b1c2d9aa43578e692d0c2a2ef24a141167f1ee9c4e354540c5fe573d32cd817f.jpg" alt="ENS 每日持币人数 Query" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">ENS 每日持币人数 Query</figcaption></figure><h2 id="h-dune" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Dune 零基础实战</h2><p>零基础入门的小白能否直接实战？</p><p>当然！</p><p>👉 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.co/U4OdkykAIL">https://dune.com/gm365/Syndicate</a></p><p>这个 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/SyndicateDAO">@SyndicateDAO</a> 看板，所用到的基础知识在前面全部有所涉及。事实上，这也是我近期学习并用 Dune 做的第一个数据 Dashboard。</p><p>在前面基础知识铺垫之上，另一个关键就在于找准协议所对应的合约地址，大家可以点开每一个 <code>Query</code> 查看具体的 <code>SQL</code> 代码，你会发现实现这些链上数据统计功能并没有太难。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/d35dced65cac59468981f2abd52b2a8ecd8ff2ac9bc02f88b0e46dc661f2b44c.jpg" alt="Syndicate Dune Dashboard" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Syndicate Dune Dashboard</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">总结</h2><p>Dune 帮我们保存了珍贵的链上数据，我们要做的便是“各取所需，为我所用”。</p><p>大神们构建的Query语句精妙绝伦，却也繁复无比。我们作为小白，只要掌握了最基本的 <code>SQL</code>查询语句，其实已经可以开启神奇的链上数据分析师🧙‍♂️之旅了。</p><p>本文只能算作一个相当初级的 Dune 入门指南，无论是对 <code>SQL</code> 还是 Dune 的介绍，都有诸多遗漏。对于有心深入链上数据分析的同学而言，建议可以先从基础的 <code>SQL</code> 入门教程开始，掌握基础语法后，就可以选一个你喜欢的协议来尝试制作你个人版本的 Dune 数据看板了。</p><p>比如前面提到的 Syndicate Dashboard，也是我个人尝试的第一个看板。没成想，竟然还被收录到了第29期的官方 Dune Digest 中，属实意外。</p><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">致谢</h3><p>本文写作过程中，参考了其他前辈与大神的诸多教程和文章。这里尤其感谢大神 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/Pro_0xBi">@Pro_0xBi</a> 的三篇 Mirror 教学文章，敬请移步大神置顶推文获取更多 Dune 秘籍。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">备注</h2><p>[1] Dune 已经将域名从 dune.xyz 跳转到 dune.com</p><p>[2] Dune 于 2022.2.2 完成最新一轮 6942万美元融资 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://www.qianba.com/news/p-429265.html">www.qianba.com/news/p-429265.html</a></p><p>[3] Dune 实际上使用的是一种叫 PostgreSQL 的查询语言，其兼容大部分 SQL 语句，普通用户无须做更进一步的区分</p><p>[4] 实际上， Dune 已经将其改名为 dataset，称为数据集更为准确，但其本质含义并未发生变化</p><p>[5] 以太坊的单位默认为 wei， 1个 ETH 相当于10的18次方wei，所以需要把原始单位除以 10的18次方，计算后的结果即为常用的 ETH 单位</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考文献</h2><ul><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://0xbi.mirror.xyz/">0xBi Mirror</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://0xbi.mirror.xyz/603BIaKXn7s2_7A84oayY_Fn5XUPh6zDsv2OlQTdzCg">从0到1构建你的Dune Analytics看板（实战篇）</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/zengo/dune-analytics-introduction-tutorial-with-examples-d2c764600d6">Dune Analytics introduction tutorial</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.runoob.com/sql/sql-intro.html">SQL语言基础</a></p></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/fed7c314a67d2cf29a25822e151d2585222afe018d7c124bfd78f0966972865a.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[🌍 Charm愿景图：连接加密价值与真实价值]]></title>
            <link>https://paragraph.com/@gm365-2/charm</link>
            <guid>INzgEQ65p5C1j28b13J5</guid>
            <pubDate>Tue, 22 Mar 2022 09:11:21 GMT</pubDate>
            <description><![CDATA[原文：Connecting Crypto Value to Real Value 作者： Tom 译者：gm365Charm 通往可持续未来的路线图过去的16个月里， Charm 为去中心化做市策略（DMMS）开创了一个全新的行业通过为新产品和服务创造流动性市场， DMMS 连接了加密价值与真实价值Alpha Vaults 是第一个使用 DMMS 的产品。它帮 Uniswap V3 在 ETH 和 BTC 上创造了更多的市场流动性Alpha Pro 将是首个使用 DMMS 来帮项目方在 Uniswap V3 上发行代币的产品，它也会是第一个使用 DMMS 来创造新市场的产品本文解释了为什么打造 “Real Value” 非常重要，为什么加密货币最适合于这个目的，以及 Charm 打算帮任何人打造 "Real Value" 的愿景前言创新和创造力是人类进步最强大的决定性因素。数千年以来，它们决定了个人、公司、国家和王朝的兴衰起伏。最伟大的创新，比如电话、蒸汽机、计算机、互联网等，已经在实体经济中（Real Value）创造了大量的价值，并提高了世界各地数十亿人民的生活质量。 金融经...]]></description>
            <content:encoded><![CDATA[<h1 id="h-" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"></h1><p>原文：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/connecting-crypto-value-to-real-value-10890d2ebb47">Connecting Crypto Value to Real Value</a></p><p>作者： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/CryptoMa20">Tom</a></p><p>译者：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/gm365">gm365</a></p><blockquote><p>Charm 通往可持续未来的路线图</p></blockquote><ul><li><p>过去的16个月里， Charm <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">为去中心化做市策略（DMMS）开创了一个全新的行业</a></p></li><li><p>通过为新产品和服务创造流动性市场， DMMS 连接了加密价值与真实价值</p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://alpha.charm.fi/">Alpha Vaults</a> 是第一个使用 DMMS 的产品。它帮 Uniswap V3 在 ETH 和 BTC 上创造了更多的市场流动性</p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-pro-5a11012c48c1">Alpha Pro</a> 将是首个使用 DMMS 来帮项目方在 Uniswap V3 上发行代币的产品，它也会是第一个使用 DMMS 来创造新市场的产品</p></li><li><p>本文解释了为什么打造 “Real Value” 非常重要，为什么加密货币最适合于这个目的，以及 Charm 打算帮任何人打造 &quot;Real Value&quot; 的愿景</p></li></ul><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">前言</h2><p>创新和创造力是人类进步最强大的决定性因素。数千年以来，它们决定了个人、公司、国家和王朝的兴衰起伏。最伟大的创新，比如电话、蒸汽机、计算机、互联网等，已经在实体经济中（Real Value）创造了大量的价值，并提高了世界各地数十亿人民的生活质量。</p><p>金融经济（包括数字货币）的目的是将资源分配到实体经济中最具生产力的部分，以便创新能够获取其发展所需的资金。如果无法有效率的做到这一点，那么实体经济的增长会停滞，既而引发金融经济的崩溃，最终带来毁灭性的后果。</p><p>加密经济和金融经济的其他部分相差无几，只是由于缺乏中心化的中间机构，Crypto Value（加密价值）可以很容易的进行转移。因此，一种能连接Crypto Value（加密价值）和 Real Value（真实价值）的机制将给社会带来巨大的好处，因为它可以更快更有效地将资本转移到经济中最具生产力的部分。</p><p>本文将从介绍 Real Value 的重要性开始，并以 Charm 帮助任何人创造 Real Value 结束。</p><hr><h2 id="h-real-value" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Real Value 是什么</h2><blockquote><p>Real Value 是实体经济中所有商品和服务的市场价值总和（即 GDP）</p></blockquote><p>创新是创造 Real Value 的新方法。因为它们在人们可购买的商品和服务的种类和数量上的影响力，创新是人类进步最强大的决定性因素。创新的重要性体现在下图中：</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/aefb96804b3e00a3feec85a4b42a07e4f1b2dcd88e2e3ada1959c7b275ad963c.jpg" alt="工业革命以来，在创新的推动下，世界经济经历了前所未有的增长。资料来源：Manyika等人，麦肯锡全球研究院，2013年5月，第24页" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">工业革命以来，在创新的推动下，世界经济经历了前所未有的增长。资料来源：Manyika等人，麦肯锡全球研究院，2013年5月，第24页</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">货币是什么</h2><blockquote><p>货币通常被认定为财富的储藏手段，但实际上它是由中心化或去中心化实体创造的信用。</p></blockquote><p>信用（比如美元、比特币、以太坊）可以用来创造更多货币（通过投资、借贷）。但因为货币本身没有任何价值，所以最终所有货币其实都在实体经济中用于交换其他商品和服务。</p><p>货币被创造出来之后，被进一步杠杆化来生成债务。债务人可以用收到的货币买入金融资产（比如股票、代币、债券、期权等），或者用它生成更多债务。金融资产的交易创建了金融经济，加密货币经济属于其中的一小部分。</p><h2 id="h-crypto-value" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Crypto Value 是什么</h2><blockquote><p>Crypto Value 是加密经济中所创造的数字资产的市场价值总和</p></blockquote><p>加密经济是金融经济的延伸，纸质或数字资产是用今天的 Real Value 创造的。因此，当它们被交易时，资金被分配给实体经济的一部分，用来在未来增加 Real Value。</p><p>通过移除金融经济中的中间机构，加密经济提供了一种更便宜、更有效和更公平的资本分配方式，因此这也是一种更好的发展实体经济的方式。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">当事情出错之时</h2><p>金融经济堆积债务的倾向容易使事情变得一团糟。如果债务无法使用 Real Value 来偿还，金融经济就会萎缩到和实体经济相匹配的规模。</p><p>当前述状况发生时，债务持有人（即金融资产的购买者）将面临严重损失，从而导致经济衰退、破产、失业和最弱势群体失去生计。</p><p>为了避免这种灾难的发生，实体经济必须持续增长，以支持建立其上的金融经济。这是为所有人创造积极成果的唯一途径。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">如何发展实体经济</h2><p>将 Crypto Value（加密价值）和 Real Value（真实价值）联系起来是发展实体经济的好方法，因为加密经济本质上是一种草根运动，货币、信贷、债务和资产等都是由实体经济中的个人创造，而不是由中心化的中间机构创造。</p><p>自16个月前成立以来，Charm 社区一直致力于研究如何将 Crypto Value 和 Real Value 联系起来，并最终促成了<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">去中心化做市策略（DMMS）这一崭新行业</a>。</p><p>通过为新产品和新服务打造流动性市场，DMMS能够发展实体经济。以下即是 Charm 发展DMMS产业的路线图。</p><hr><h2 id="h-charm" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Charm 的路线图</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/3afe565772fc174cb98b862e4f1bc708f973a733712422bf56cc5885d329a7bc.jpg" alt="Charm 的路线图分为三个阶段。第一阶段是实验阶段（当前已完成），第二阶段是增长阶段，第三阶段是打造影响力" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Charm 的路线图分为三个阶段。第一阶段是实验阶段（当前已完成），第二阶段是增长阶段，第三阶段是打造影响力</figcaption></figure><p>Charm 路线路的第一阶段是实验各种方式，来连接 Crypto Value 和 Real Value。经过长达一年的努力，Alpha Vaults 产品上线，并 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">催生了 DMMS 这一新行业</a>。</p><p>阶段 2.1 始于 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-pro-5a11012c48c1">Alpha Pro 产品</a>的上线，目标在于发展 DMMS 行业。</p><p>阶段 2.2 通过 Alpha Pro，或打造新的 DMMS 平台，来为所有能够被代币化的资产建立交易市场。</p><p>第三阶段将帮助任何人实现新想法、打造新产品和服务，然后通过 DMMS 将他们的贡献推向市场。</p><p>这三个阶段的进展并不确定，因为这期间可能发生任何事。这也是为什么会有一个从任一阶段到其更早期阶段的反馈回路，以便 Charm 可以根据需要转向不同策略。然而，Charm 打算帮任何人实现新想法、打造新产品和服务，以及连接 Crypto Value 和 Real Value 的目标不会改变。</p><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">结论</h2><p>创新是人类进步最强大的决定性因素，它的兴衰决定了个人、公司、国家和王朝的兴衰起伏。</p><p>利用金融经济提供的资本，创新促进了实体经济的增长。当创新未能实现时，事情通常变得很糟糕，随之而来的便是金融经济萎缩到其与实体经济相匹配的规模。</p><p>这就是为什么将金融价值和真实价值联系起来很重要，这样实体经济才有足够的资金来保持增长。去中心化做市策略（DMMS）可以助力实现这个目标。</p><p>Charm 是第一个使用 DMMS 来为新创建的市场增加流动性的协议，很快也将会成为首家使用 DMMS 来创建新市场的协议。未来，Charm 将致力于开发新的解决方案，以帮助任何人为新想法、新产品和服务创建市场，从而带动创新，使其免于无人问津。</p><p>因此，如果你也笃信创新、去中心化和打造 Real Value，请不要犹豫，来联系 Charm 吧 —— 我们很乐意与你一起合作，为所有人打造可持续的未来。</p><p>后会有期 : )</p><p>任何问题，敬请联系 Charm 社区：</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/charmfinance">Twitter</a> | <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://discord.com/invite/6BY3Fq2">Discord</a> | <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://t.me/charmfinance">Telegram</a> | Email</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考资料</h2><ul><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.mckinsey.com/~/media/mckinsey/business%20functions/mckinsey%20digital/our%20insights/disruptive%20technologies/mgi_disruptive_technologies_full_report_may2013.ashx">Manyika，麦肯锡全球研究院，2013年5月，第24页</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://finance.sina.cn/zl/2019-06-04/zl-ihvhiews6790929.d.html?vt=4&amp;cid=79615">王永利:何谓货币的本相？</a></p></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/5fe76edbdb61d06144e6682dfee23c66cbb152c48d1bc997c4259d165256e2c1.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[🌍 Alpha Pro 详谈：鱼和熊掌何以兼得]]></title>
            <link>https://paragraph.com/@gm365-2/alpha-pro</link>
            <guid>MyZtppZVOkKyV7aG2i4y</guid>
            <pubDate>Sun, 20 Mar 2022 05:33:56 GMT</pubDate>
            <description><![CDATA[原文： Introducing Alpha Pro 原作者： Tom （译注：Charm 创始人） 译者： gm365Alpha Pro 是一个用于在 Uniswap V3 上启动流动性机枪池的免许可平台。 发行代币、流动性挖矿、像V2一样在V3上注资，同时还能获得两种版本的全部好处！有了 Alpha Pro，任何人都可以建立专属的流动性机枪池*，用于如下目的：在 Uniswap V3 上增加代币的流动性，最小化资本损失，并促进价格发现确保代币永远可交易像在 Uniswap V2 上一样，通过单一的 ERC-20 代币和标准化质押合约，在 V3 上启动流动性挖矿激励计划对代币发行拥有完全的控制权，并实现更好的去中心化给提供流动性的LP用户提供一个像在V2上一样简单的增加流动性的方法通过使用 Alpha Vaults 在去中心化做市策略的创新基础上，Alpha Pro 得以实现此目标。与此同时，其策略的链上参数还可以进行相应调节，以实现在资本效率和最坏情况下可交易性这二者之间的最佳融合。 *此机枪池的代码基于 Alpha Vaults，后者已通过了安全审计，并在持续8个月的连续运行...]]></description>
            <content:encoded><![CDATA[<p>原文： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-pro-5a11012c48c1">Introducing Alpha Pro</a></p><p>原作者： Tom （译注：Charm 创始人）</p><p>译者： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/gm365">gm365</a></p><blockquote><p>Alpha Pro 是一个用于在 Uniswap V3 上启动流动性机枪池的免许可平台。 发行代币、流动性挖矿、像V2一样在V3上注资，同时还能获得两种版本的全部好处！</p></blockquote><p>有了 Alpha Pro，任何人都可以建立专属的流动性机枪池*，用于如下目的：</p><ul><li><p>在 Uniswap V3 上增加代币的流动性，最小化资本损失，并促进价格发现</p></li><li><p>确保代币永远可交易</p></li><li><p>像在 Uniswap V2 上一样，通过单一的 ERC-20 代币和标准化质押合约，在 V3 上启动流动性挖矿激励计划</p></li><li><p>对代币发行拥有完全的控制权，并实现更好的去中心化</p></li><li><p>给提供流动性的LP用户提供一个像在V2上一样简单的增加流动性的方法</p></li></ul><p>通过使用 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-vaults-an-lp-strategy-for-uniswap-v3-ebf500b67796">Alpha Vaults</a> 在<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">去中心化做市策略</a>的创新基础上，Alpha Pro 得以实现此目标。与此同时，其策略的<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://learn.charm.fi/charm-finance/alpha-pro/user-guides/strategy-parameters">链上参数</a>还可以进行相应调节，以实现在资本效率和最坏情况下可交易性这二者之间的最佳融合。</p><p>*此机枪池的代码基于 Alpha Vaults，后者已通过了<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.certik.com/projects/charmfinance">安全审计</a>，并在持续8个月的连续运行过程中没有出任何状况或安全事故。此外，Alpha Pro 还会在上线前进行另一次安全审计。</p><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">介绍</h2><p>Uniswap V3（后续用V3指代）于2021年5月5日推出后，迅速成为DeFi 领域资本效率最高的DEX，仅用25%的资金流动性就超过了Uniswap V2（后续用V2指代）的交易量。缘由在于这是业内首次 V3 允许流动性做市商通过集中流动性在 AMM 上做市，而无须再将流动性分布于整个价格区间（即 V2 的做法）。</p><p>Alpha Vaults 在 2021年<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/alpha-vault-is-live-on-mainnet-25594aee3b82">5月7日</a>在主网推出，仅比 V3 上线晚了2天。这是在 V3 上提供流动性最简单的方法，而且在主网持续运行了8个月。它仍然是同类产品中表现最好、波动最低、运行时间最长、最稳定的LP机枪池。</p><p>Alpha Vaults的下一步便是Alpha Pro。它利用Charm在<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">去中心化做市策略</a>方面的专长，帮助其他项目增加其代币在V3上的流动性。</p><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">挑战</h2><p>V3 提供了更好的流动性及价格发现机制的同时，也在代币发行、提供流动性、流动性挖矿等方面提出了诸多挑战：</p><ul><li><p>在 V3 上提供流动性颇具挑战，因为流动性提供商（LP）必须选定一个价格范围，并随时进行再平衡的步骤以使当前价格处于其流动性价格区间之内。</p></li><li><p>与 V2 相比，LP 在V3上的无常损失（IL）<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/auditless/impermanent-loss-in-uniswap-v3-6c7161d3b445">风险要高得多</a>。</p></li><li><p>如果交易发生在价格区间范围之外，代币将失去流动性。</p></li><li><p>对 V3 资金池的直接激励（比如使用 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/Uniswap/v3-staker">V3 质押工具</a>）意味着少数钱包将获取大部分的激励（例如这些钱包提供相对较窄的价格区间）</p></li><li><p>V3上的头寸不是ERC-20 标准 Token，因此标准化的质押合约无法用于流动性挖矿。</p></li></ul><hr><p>项目方的应对之计</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/e58c35b3013d07b902adb98f657787e8cb8c2b1051448f9b049a539bf9b99b09.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>图1: 总结下现有项目方推出代币的做法。大多数项目仍在使用 Uniswap V2，因为其有利于去中心化及流动性挖矿，同时还能保证代币永远可被交易；但这样就错失了 V3 最大的好处：资本效率。为了提高资本效率，项目方还可以直接通过 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/Uniswap/v3-staker">V3 质押工具</a> 或 主动管理流动性头寸的方式来激励 V3 流动性资金池。 但这样就又牺牲了可交易性、流动性挖矿及去中心化。有了 Alpha Pro，项目方能以去中心化的方式捕获 V3 的资本效率，同时也无须牺牲 V2 的核心优势，比如连续可交易性及流动性挖矿。</p><p>由于困难重重，很多项目方：</p><p><strong>直接在 V2 上发行代币，或者在 V3 上使用</strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://help.uniswap.org/en/articles/5391541-provide-liquidity-on-uniswap-v3"><strong>全价格区间</strong></a><strong>。</strong></p><ul><li><p>这意味着项目方错失在 V3 上提供更好的价格深度和价格发现机制的好处</p></li></ul><p><strong>选择一个第三方的流动性管理者帮他们管理流动性。这意味着：</strong></p><ul><li><p>去中心化程度受限，因为他们通过链下的方式管理流动性</p></li><li><p>如果 V3 的价格区间范围选取不当，或更新不及时，又或者价格波动巨大时，项目方将面临代币无法交易的风险</p></li></ul><p><strong>在 V3 上发行代币，但降低代币奖励</strong></p><ul><li><p>这意味着代币的市场更小，市场效率更低，同时也无法减少由少数钱包攫取大部分奖励的风险</p></li><li><p>V3 资本效率的架构也为流动性挖矿奖励带来了<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://app.betafinance.org/liquidity">诸多不便</a></p></li></ul><hr><h2 id="h-alpha-pro" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Alpha Pro解决方案</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/d09dba4012dd00ae204ad93ffa15e20d4b7290e821b615923c8406e68ade5ed7.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>图2: Alpha Pro 解决方案。项目方使用 Alpha Pro 来创建一个免许可机枪池，同时结合了 V3 的资本效率和 V2 的简洁与熟悉感。</p><p>有了 Alpha Pro，项目方就能建立属于他们自己的免许可机枪池，用于在 V3 上管理流动性。</p><p>这个机枪池优势多多：不但允许项目方像使用 V2 一样开启流动性挖矿奖励计划（比如使用 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/Synthetixio/synthetix/blob/develop/contracts/StakingRewards.sol">StakingRewards</a> ），同时保有对机枪池<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://learn.charm.fi/charm-finance/alpha-pro/user-guides/strategy-parameters">策略</a>的完全控制权，通过<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://uniswap.org/blog/uniswap-v3">集中流动性</a>来提高代币流动性，并且使用<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://help.uniswap.org/en/articles/5391541-provide-liquidity-on-uniswap-v3">全价格区间</a>来保证代币永远可交易。除此之外，机枪池的份额是 ERC20 代币，也就意味着 LP 可以像 V2 一样存款、取款和质押。</p><p><strong>以此来看，这种机枪池实质上是一种结合了 V3 的资本效率和 V2 的简洁与熟悉感的接口。</strong></p><p>下面我们来看下 Alpha Pro 的一些实际用例。</p><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">用例</h2><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">提供流动性</h3><p>不像<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://app.uniswap.org/#/add/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/0xdac17f958d2ee523a2206206994597c13d831ec7/3000">在 V3 上注资</a>，流动性提供商(LPs)可以在一个<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://alpha.charm.fi/vault/0xe72f3e105e475d7db3a003ffa377afae9c2c6c11">类似 V2 的前端界面</a>存入资金。 <strong>LP 不再需要选择价格区间、再平衡及对冲无常损失</strong>，因为 Alpha Pro 可以自行解决所有这些问题。</p><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">流动性挖矿</h3><p>项目方现在可以部署一个<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/Synthetixio/synthetix/blob/develop/contracts/StakingRewards.sol">标准化的质押合约</a>，来激励 LP 质押他们的 Alpha Pro 份额（现在是一种ERC20格式）到这个合约中，而无须直接使用合约激励 V3 的资金池。</p><p>上述步骤对项目方和 LP 而言相对容易许多，因为它跟使用 V2 质押一样。与此同时，由于所有的 LP 使用的都是由项目方或治理方决定的同一种策略，因此避免了奖励分配的不公平现象。</p><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">实现去中心化</h3><p>对很多 DeFi 协议而言，去中心化是其重中之重。借由 Alpha Pro，项目可以拓展更大的去中心化程度：</p><ul><li><p>Alpha Pro 将会是 DeFi 领域最去中心化的产品之一，因为它所有的活动、源码和策略都是链上可见的</p></li><li><p>Alpha Pro 的<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://learn.charm.fi/charm-finance/alpha-pro/user-guides/strategy-parameters">策略参数</a>可以在链上进行调整，这意味着<strong>项目方或其治理方对策略有完全的控制权</strong>。</p></li></ul><p>借助 Alpha Pro，项目方终于可以使用熟悉的工具来管理他们 V3 流动性的方方面面。</p><hr><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">运作机制</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/265e2f111be5f1e1075e0464d09707b57ec7c5c4b071cb303b283412c0570c27.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>图3: Alpha Pro 将流动性注入到 V3 的三种价格区间订单中：一个<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://help.uniswap.org/en/articles/5391541-provide-liquidity-on-uniswap-v3">全价格区间单</a>用来保证流动性、一个<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-vaults-an-lp-strategy-for-uniswap-v3-ebf500b67796">基准区间订单</a>来集中流动性、一个<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-vaults-an-lp-strategy-for-uniswap-v3-ebf500b67796">限价单</a>来最小化无常损失。通过调整策略参数（比如 B，L，全价格区间的流动性比例，再平衡频率等），项目方可以在代币价格波动时的可交易性、集中流动性的深度和为LP提供的无常损失保护力度之间进行抉择。选定各项参数后，当价格波动时，机枪池可以保证现货价格处于价格区间的中间范围之内，这和 Alpha Vaults 在过去8个月持续运行的表现如出一辙。</p><p><strong>Alpha Pro的工作原理是将</strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-vaults-an-lp-strategy-for-uniswap-v3-ebf500b67796"><strong>被动再平衡</strong></a><strong>（V3风格的LP）和</strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://help.uniswap.org/en/articles/5391541-provide-liquidity-on-uniswap-v3"><strong>全价格区间</strong></a><strong>（V2风格的LP）融合进一个机枪池中。</strong> 被动再平衡用于集中流动性，提高资本效率，并将无常损失降至最低；全价格区间则确保代币始终可交易。</p><p>因此，Alpha Pro可以实现比V2更高的资本效率，并保证项目代币在任何市场条件下都可以进行交易。</p><p>在使用Alpha Pro部署他们自己的机枪池时，项目方需要选择策略参数*，从而在资本效率和极端最差场景下的流动性之间保持平衡。</p><p>在设定参数之后，机枪池即可自动运行。除非项目方打算更新参数，否则完全无需干预。Alpha Vault 的跟踪记录显示，机枪池可以自动进行再平衡，使市场价格保持在一定范围内。 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://dune.xyz/queries/78325/155734?Number%20of%20days=200">Alpha Vault</a> 的业绩跟踪记录显示了机枪池如何自动进行再平衡从而使得市场价格处于所选价格区间之内。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/581dbd7a47eff37e772985dc142fb2195d6cbe2b541563eafd70e94d49aeca37.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>图4: Alpha Vault是一个用 Alpha Pro 建立机枪池的例子。链上数据显示，在8个月内，机枪池通过自动重新平衡，来使市场价格（红线）保持在V3价格区间的中间（蓝色区域）。</p><p>*关于如何使用 Alpha Pro 的详细文档将在其临近上线主网时公布。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">结论</h2><p>Alpha Pro 作为 Charm 的一个新产品，同时结合了 Uniswap V2 和 V3的优点。它帮助各种规模的项目方在 V3 上增加代币流动性，并提供一个简洁、公平、熟悉和去中心化的方式来发行代币及推出流动性挖矿奖励。</p><p>Alpha Pro 保证代币始终可交易，并提供<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/9e77d82d02a14eea8ec1df81f050814e">灵活的参数</a>来让项目方自行选择流动性集中程度，以及对 LP 无常损失大小的保护力度。</p><p>这些参数统统可以在链上进行调整，这意味着项目方（或治理方）对策略参数拥有完全控制权。每个参数都可以被包括进治理框架之内，并为更加<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/quietly-innovating-a-trillion-dollar-industry-e03ab29cb5d9">去中心化的做市策略</a>提供了一个基础层。</p><p>Alpha Pro 在手，<strong>鱼（Uniswap V2）和熊掌（Uniswap V3）终于可以兼得了！</strong></p><p>后会有期 : )</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考资料</h2><ul><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.apy.vision/defi-vaults/">Everything You Need to Know About DeFi Vaults</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://zhuanlan.zhihu.com/p/385444018">一文科普DeFi中的机枪池</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.jinse.com/news/blockchain/1173466.html">深入分析 Uniswap V3 流动性供应的数学原理</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://mirror.xyz/0x5Eba828AB4999825D8416D7EAd9563b64FD90276/YbVAkQdPf7UcTrr4big-cjFMRHGL6Je73VtqwkKCUJk">Uniswap v3 ：走向资本高效还是放大LP损失？</a></p></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/f0e0d1378ff13257f4d9ee96bf28780cf6c9109f1e89556ad32c0bdcf00434ef.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[🌍 L2代币蓄势待发]]></title>
            <link>https://paragraph.com/@gm365-2/l2</link>
            <guid>3K94cZzZ8Ak5BZVlSY5N</guid>
            <pubDate>Wed, 16 Mar 2022 06:13:45 GMT</pubDate>
            <description><![CDATA[原文：Layer 2 Tokens Are Coming - Bankless 原作者：John Wang、RyanSAdams 译者：@gm365前言亲爱的 Bankless Nation， 二层代币要来了。 Arbitrum, Optimism, zkSync, Starkware —— 所有这些当前大热的二层网络都还没有代币！ 但这些二层网络都增速飞快，目前已锁定了数十亿美元的TVL，并且每天还在吸引更多的链上活动。以太坊的未来就在二层网络的手中。 问题来了，“什么时候发币¹ ” ？ /zkSync/ 已经确认过它会将会是“社区所有”。 /Arbitrum/ 和 /Starkware/ 尚未回应。 /Optimism/ 在 Bankless的播客中说他们近期没有发币的计划。 他们是否公开确认发币计划其实根本不重要。他们都有股权结构表²，上面写满了投资人和团队成员。他们也都需要刺激增长和提高流动性。 用查理芒格的话来说就是：“谁给我面包吃，我给谁唱歌。” 现在面包就在那儿，结果看上去也一目了然。 为了抢占L2的淘金热，还需要回答以下几个问题：L2代币经济学长什么样？发币时会有...]]></description>
            <content:encoded><![CDATA[<p>原文：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://newsletter.banklesshq.com/p/rollup-tokens-are-coming">Layer 2 Tokens Are Coming - Bankless</a></p><p>原作者：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang">John Wang</a>、<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/ryansadams">RyanSAdams</a></p><p>译者：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/gm365">@gm365</a></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">前言</h2><p>亲爱的 Bankless Nation， 二层代币要来了。</p><p>Arbitrum, Optimism, zkSync, Starkware —— 所有这些当前大热的二层网络都还没有代币！ 但这些二层网络都增速飞快，目前已锁定了数十亿美元的TVL，并且每天还在吸引更多的链上活动。以太坊的未来就在二层网络的手中。</p><p>问题来了，“什么时候发币¹ ” ？</p><p>/zkSync/ 已经确认过它会将会是“社区所有”。 /Arbitrum/ 和 /Starkware/ 尚未回应。 /Optimism/ 在 Bankless的播客中说他们近期没有发币的计划。</p><p>他们是否公开确认发币计划其实根本不重要。他们都有股权结构表²，上面写满了投资人和团队成员。他们也都需要刺激增长和提高流动性。</p><p>用查理芒格的话来说就是：“谁给我面包吃，我给谁唱歌。” 现在面包就在那儿，结果看上去也一目了然。</p><p>为了抢占L2的淘金热，还需要回答以下几个问题：</p><ul><li><p>L2代币经济学长什么样？</p></li><li><p>发币时会有怎样的激励措施？</p></li><li><p>他们用来治理什么东西呢？</p></li><li><p>代币会怎样进行分发？</p></li><li><p>他们还在等什么呢？</p></li><li><p>rollup 的二层代币会寄生在ETH上吗？</p></li></ul><p>我们请来了帮助推出Immutable的IMX代币的人，来跟大家分享他对这一切问题的看法。</p><p>让我们准备好迎接L2的淘金热吧。</p><p>—— RSA</p><h1 id="h-rollup" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Rollup 代币要来了</h1><p>作者：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang">John Wang</a>，独立分析师兼 Buider</p><p>🧵 本文基于 John Wang 的一篇<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang/status/1480600447081758721">Twitter长文</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/873b05631ebef211436c02224e252009b86829aab4db5395040bed05b8fd77a1.png" alt="图片归属 Logan Craig" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">图片归属 Logan Craig</figcaption></figure><p>二层网络（L2）的代币马上就要来了，并将很快迎来大爆发，但关于L2代币经济学的信息却着墨甚少，以及更重要的，“什么时候发币”？</p><p>本文打算深入讨论。</p><p>这里介绍一点背景信息，我促成了 IMX、GODS在 Immutable链，以及GOG 在 StarkEx链上的发币。鉴于此，我打算分享下我在加密货币这个新兴领域的经验。</p><p>虽然我跟Starkware团队在一起工作，但我对这些L2代币并没有任何内幕消息。以下内容主要基于我心目中好的rollup代币经济学是什么样子的，以及它们会如何分发。所有这些都只是一些有理有据的猜测而已。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">议题</h2><ol><li><p>通过激进的空投或激励策略，对其他L1网络进行吸血鬼攻击</p></li><li><p>代币质押经济体系和治理体系</p></li><li><p>Rollup成本补贴</p></li><li><p>代币分发</p></li><li><p>跨链桥、法币入金入口以及 /Tokemak/ 合作</p></li><li><p>EVM兼容</p></li><li><p>MEV的获取或预防</p></li><li><p>rollup代币是否寄生于 ETH</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/dbdde135b9c206a96057c7fcb33732b069b7de8b0153bfe070b72d8c618ea049.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h2 id="h-rollup" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Rollup 概览</h2><p>如果你对 Rollup所知甚少，请参阅这篇 <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://tinyurl.com/rollupintro">DCBuilder’s great article</a> ，干货极多。</p><p>Rollup四巨头：Arbitrum, Optimism, zkSync, 以及 StarkNet 目前已经开放白名单 dApp 应用，同时/或拥有中心化的定序器及验证者，但会在2022年计划打造去中心化的定序器，同时推动无需许可的接入方式。值得一提的是，最近Arbitrum正是因为中心化的定序器问题才宕机十小时³。</p><p>随时锁定在这些二层网络中的TVL不断增长，他们尤其需要去中心化。顺理成章的一个方案便是发行代币。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/5951a89459652b573de3a854c6bf1e0d9b575ac65a56de6a5faa9ab8a4e89de2.png" alt="图片版权归属：L2Beat" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">图片版权归属：L2Beat</figcaption></figure><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">那什么时候发币？</h2><p>我认为 rollup 代币会在2022年底到2023年初以以下顺序推出：zkSync (/已确认/) → StarkNet (/暂无消息/) → Arbitrum (/暂无消息/) → Optimism (/公开否认/)。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/462f81edd833506937fc1e74546a5355415c5af0945ceecd419b3c387c49ddfd.png" alt="来源： Bankless Interview with Optimism" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">来源： Bankless Interview with Optimism</figcaption></figure><p>也就是说，任何项目——包括二层网络在内——都只应该达到“产品市场契合点⁴ ”时再发币。我认为 rollups 只有在解决以下问题后才能达到产品市场契合点：</p><ul><li><p>去中心化定序器</p></li><li><p>跨链桥/入金</p></li><li><p>EVM兼容性/等效</p></li></ul><blockquote><p>激励计划属于市场营销费用支出，并且还非常昂贵。你总是需要先证明用户喜欢你的产品，否则你就是在浪费你的营销预算。 —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/QwQiao/status/1478024084990668804?s=20">QiaoWang</a></p></blockquote><p>我们稍后会再次谈及这些问题。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">激进的激励措施</h2><p>你准备好见证历史上最大的吸血鬼⁵ 攻击事件了吗？ 与之相比，SushiSwap 对 Uniswap 的吸血鬼攻击只能算是小巫见大巫。为了和其他L1公链⁶竞争，rollups 代币应该通过激进的空投、质押、流动性挖矿和生态系统基金等方式，来大力推进用户向 L2 的迁移。L2网络之间的跨链桥会让 rollups 体系赶超其他中心化的 L1公链。</p><p>Rollups 应该战略性地空投给那些早期的 rollups 尝鲜者或ETH用户，以及其他的L1公链活跃用户，同时还要能过滤掉那些跨链撸毛大军。针对开发者的激励也可以根据他们部署合约的活跃使用程度进行等比例的量化。Rollups 也可以跟像 Olympus Pro 这样的 DeFi 2.0 协议合作，来常见流动性激励池或 L2 债券池。</p><p>然而，为了能吸引更多TVL，业内需要更好用的 L1、L2之间的跨链桥基础设施。 Rollups 团队⁷成员们也明白这点，很可能到那个时候才会发币。</p><p>但代币经济学⁸会是什么样子的？</p><h2 id="h-l2" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">L2代币的质押机制</h2><p>激励措施可以和以下可罚没的质押机制需求相权衡：</p><ul><li><p>zkRollups的定序器和证明器（有过提示）</p></li><li><p>Optimistic Rollups 的欺诈证明的发起人和验证人 （有过提示）</p></li><li><p>Validiums/zkPorter 的数据可用性委员会成员</p></li><li><p>zkPorter的数据可用性守护者（已官宣）</p></li><li><p>$METIS模式：提供给 Rangers（验证者）欺诈-挑战 定序器的激励（获胜方保留被罚没的$METIS）</p></li></ul><p>作为参考，Immutable的IMX 将一定百分比的交易手续费存入质押奖励池，这种模式可以被其他 rollup 代币所借鉴。 代币一旦参与质押就失去了流动性（译注：无法从市场上买入这些代币），所以质押机制本身能极大的提高 rollups 的安全性。Matter Labs说过，“要使zkPorter中的数据不可用，攻击者需要筹集到全部质押代币总市值的2/3”。</p><p>METIS 是Optimism机制的一个分叉代币，拥有一种动态 Bond 阈值的质押机制。对定序者而言，如果他们质押的代币价值低于将要排序的区块价值，那么他们将无法参与此区块的排序。直到找到一个合格的定序者之前，交易无法被打包，这样就限制了交易价值的大小。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">成本补贴</h2><p>ZK Rollup 系应该通过补贴早期用户使用成本的方式，来追求一种亏本销售的用户增长策略。</p><p>根据Polynya的模型预测，随着TPS的增加，交易费用能在3.33 TPS 的时候打平，并一路下降。Matter Labs 与其意见一致，“当前的服务运作无限接近于收支平衡，并且在实现去中心化之前一直保持如此。”</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/8594637029c53c2aa41a1ee8a5ded0f6ae5e4648f1e256c996d1c31e119e22e1.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>这点能通过营销预算的支出，或者代币通胀来实现。跟每天花费上千万美元来保护SOL、DOT、AVAX、NEAR的Aurora等网络的安全来比，每天几千美元的补贴成本根本不值一提。作为参考的是，Solana每天花费 1800万美元的安全成本，但仅售出 22.5万美元的交易打包区块。在Immutable上，我们直接全额补贴交易gas费（译注：发送交易不收gas费），希望交易手续费能补贴一二。</p><p>与之相比， Optimism Rollups …</p><blockquote><p>ORs (译注：Optimism Rollups) 遵循另一条降低交易费用的方式： 压缩 calldata 。他们的打包处理的承恩已经够低了，虽然我知道某些 ORs 还有一些优化空间。 —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/epolynya/status/1474991618834919425">polynya</a></p></blockquote><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">治理设计</h2><p>目前所有 rollups 都有在 L1 上部署的多签智能合约。</p><p>Rollups 属于新生事物，所以早期都需要在 L1 一侧进行升级和bug修复。当前比较重要的是，我们有详细的透明度报告，以及像逃生舱一类的紧急逃生出口机制。</p><blockquote><p>当前的 Rollup 逃生机制并不怎么有用。你需要有产生新区块的能力才能把你的资金从一个二层的智能合约上取出，但对大部分用户而言，他们都没这种本事。 —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang/status/1480280201930379265?s=20">JohnWang</a></p></blockquote><p>随着DAO的成熟，Rollup 在 L1 上的智能合约应该由治理代币来投票决定，并最终变成不可变更的。 目前而言，L1 上的多签智能合约绝对意味着可信任的初始设置，不过由于时间锁的存在，你随时能提取你的资金，所以也算不上什么实质性的安全风险。</p><p>其他的治理议题包括有为定序器设计的降低 MEV 机制、收费模型、在 Optimism 上实施欺诈证明、生态系统基金和 DAO 合作伙伴关系等国库财政支出、数据可用层及通过 MEV 拍卖来资助公共物品。</p><p>如你所见，有大把的议题可供 L2 的 DAO 来投票。</p><blockquote><p>虽然有很多创新性的解决方案，但实现去中心化定序机制可行性的第一步应该是由 rollup 的团队在世界各地指定少数几个高信誉的团队，并在他们之间轮替。更好的方案则是有一个治理代币并通过治理投票来决定（ Lido？） —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/epolynya/status/1480412824333524998">polynya</a></p></blockquote><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">代币分发</h2><p>对于 zkSync 公开宣称他们要把 67%的代币分配给社区的说法，我赞叹不已。这为其他人的效仿设定了一个竞争底线。这给其他人的效仿设定了一个基准值。</p><p>现有的一些 L2 dApps 协议代币的 FDV ⁹已经高达惊人的上百亿美元，而 L2 智能合约的 rollup 的代币最起码十倍于此，按市值算的话，很容易跻身 TOP 30。</p><blockquote><p>更进一步来说，IMX和DYDX有90亿美元的FDV，StarkNet和zkSync的代币只会更高。在8%的通胀率水平下，足以在 500 TPS的水平将 gas 费补贴至 0.01 美元。如果像 SOL 那么高的通胀率，大于 5000 的TPS也是有可能的 （译注：保持 0.01 美元的gas费价格） —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/epolynya/status/1474996795801362432">polynya</a></p></blockquote><p>Starkware最近以20亿美元的估值进行了融资，zkSync 则是 12.5亿美元。</p><p>如果我们以<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/Cooopahtroopa/status/1478465171282554880">Cooper的数据</a>来对代币的分配方案进行行业平均水平的推演，其中35%预留给团队或内部人士，并反推出早期VC的超低折扣，那么这些代币的初始市值最低也有70亿美元。</p><blockquote><p>私人投资者 分配给那些早期购买股权并在后来转换为代币或是直接购买代币的投资人。 同样会有锁定期，一般和团队成员保持一致。 投资人的分配占比一直呈下降趋势——从2013年的大约25%，一直到2021年的15%。 [image:9EBB32A3-9E1E-4659-9437-998B038AB397-60073-00000E5152EA628D/FISKPmAVcAQovOK.png] —— @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/Cooopahtroopa">Coopahtroopa.eth</a></p></blockquote><p>与 L1 相比，L2代币的一大劣势就是缺少代币分发环节。即使空投和激励计划运作良好，其他L1公链的代币由于近几年来的表现不佳，也占到了一定时间优势。 L2代币在早期阶段表现强势的话，可能会进一步地被巨鲸增持。</p><p>我们可以通过持续通胀的 L2 代币奖励（就像比特币一样）来补贴交易费用的方式来解决这个问题，吸引用户，并确保更广泛的分配来维持长期的安全性。</p><h2 id="h-l2" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">发行 L2 代币的障碍</h2><h3 id="h-" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">跨链桥</h3><p>针对 L2 的跨链桥和发币入金通道对于吸引 TVL 和解决流动性碎片化问题而言至关重要。</p><p>目前已经有一些跨链桥缩短了Optimistic rollup 的7天提款期，比如如Hop Protocol， Connext Network， Argent， Celer Network， Maker，PolyNetwork， Layerswap， MultiChain等。</p><p>目前L2原生跨链桥的TVL在以太坊所有跨链桥TVL中只占17.7%。跟其他L1链相比，ZKRs跨链桥有着无与伦比的优越性，因为你可以通过最小化信任的跨链桥来验证L1目标链上的状态转换。长期来看，即使跨多个分片或外部DA源来执行，rollups 仍将拥有最佳的可组合性执行层。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/e4ba940329d3a865e66403e2776a23491c8cb3fb5e656c263091c2cfa627d4e9.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Celestia创始人Mustafa Al-Bassam 一针见血的说到，&quot;针对信任型的跨链桥，跨链桥的运营商可以盗走你的资金。这是因为这些链并不验证彼此的状态转换，而仅依靠验证者委员会来签署交易。比如 Eth-Polygon的跨链桥或者Eth-Solana的 Wormhole跨链桥&quot;。</p><p>Starkware和Loopring合作开发了dAMM，这是一个跨ZKL2的AMM，允许和其他L2及L1上的流动性资金池（例如Uniswap）异步共享流动性。</p><p>二层网络技术需要从现有的基础设施上进行大量的人工整合。中心化交易所，CoinList，Chainlink等预言机，以及像Graph Protocol这样的数据索引都必须做自定义的整合。据我所知，BitGo/机构托管人甚至没有这方面的具体计划，从而限制了机构触及L2。</p><blockquote><p>在跨链桥内通过通胀或中心化做市商的方式来激励流动性，由于热钱高度波动的特性或对中心化的依赖，将使L2的生态系统变得脆弱。为了激励资金池内的流动性，Hop 项目和 Polygon 联合发起了一项流动性挖矿计划，向那些流动性提供者发放 MATIC 奖励。正如预期的那样，一旦流动性挖矿计划结束，那些池子里的流动性就急剧下降。</p></blockquote><p>可见，跨链桥方面还有很多工作要完成。</p><h2 id="h-evm" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">EVM兼容性/等效性</h2><p>软件的可组合性及其重要。 未来数月内， EVM兼容性/等效性将会出现在所有的四大二层网络¹⁰中。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/628e0752b54d2db650fee8b43c23b95c188dd08590b4b153a3fc3894acf764a0.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>对真正的可组合性而言，重要的是 EVM 等效性，而不仅仅是 EVM 兼容。</p><p>Metis DAO和Optimism具有EVM等效性。Optimism 2.0在其Geth客户端中集成了EVM解释器，而不必重新实现链上 EVM。这给系统提供了未来的安全保证，以应对未来的EVM升级。像DappTools 这样的开发者工具（智能合约库、命令行工具、格式化验证、符号执行、项目管理等）、Hardhat、Solidity、Vyper及其他所有工具都能将在原生OVM 2.0上无缝运作，而这些工具的开发者也不必担心支持碎片化的代码库。</p><p>相比之下，Arbitrum One（原Nitro）、zkSync 2.0和StarkNet都仅是与EVM兼容。Cairo和Solidity之间简单的语法差异损害了代码的互操作性。鉴于此，zkSync 承认他们还没完全兼容 EVM。</p><p>只需要对代码做极细微的改动，准备的Solidity合约ABI就可以部署到链上。但目前还无法实现跨L2的消息通信或智能合约的无缝调用。</p><p>zkEVMs极其复杂，开发人员仍在不遗余力地解决一些问题，比如因验证人无法处理回退交易从而引起的拒绝服务攻击。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/05550e8028f20807eec6936c5eb15eab67d2a1ea6fcc9db396db0b3bad4e762d.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h2 id="h-rollup-eth" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Rollup 代币是否寄生于 ETH？</h2><p>二层的 rollups 如何验证以及执行合约，而 L1 则专门存储不可变更的交易数据。在目前的情况下，L1 链的代币几乎没有捕获到什么价值。可以看下 Solana 和 Avalanche 的情况。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/cd6fc58366e2d8b17530e63453c870229e80b5450173b0a66af6a13316702574.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>价值捕获主要发生在协议层。这也意味着结算层、执行层、共识层正在竞争 MEV ¹¹ 及货币的价值存储。</p><p>事实上，根据<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://hackmd.io/@flashbots/mev-in-eth2">这篇Flashbots的论文</a>，在Eth 2.0中，&quot;MEV可以将验证者的奖励提高75.3%&quot;!</p><p>随着更多流动性涌入二层网络，L2代币本质上寄生于L1代币的MEV价值捕获。L2转移了为L1提供安全性的矿工收入，减少了安全预算，从而降低了发动51%攻击的成本。</p><p><em>这是 ETH 社区还未认真对待的一个严肃问题。</em></p><h2 id="h-l2-mev" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">为什么 L2 捕获 MEV？</h2><p>二层网络可能会在定序器和矿工之间看到更复杂的MEV和协调机制。跟目前的 PoW 矿工相比，运行 PoS 验证器的人的背景更接近于那些真正理解 MEV 的人的背景。</p><p>在不同排序机制之间的相互作用下，跨 rollups 将促成 MEV 组合爆炸效应。Flashbots 有一篇很赞的论文，文中他们建议排序者“在拥有MEV最大价值的的链上积累投票……从而降低他们的跨域MEV成本”，“像Flashbots或基于SGX的DAO这样的机制可以降低跨链串通的成本&quot;。</p><p>不过，正如Flashbots创始人Stephane Gosselin所言，&quot;在主网上结算 rollups，真的没多少MEV —— 矿工唯一能做的就是延迟几个区块的结算，但这并不真正影响 rollups 的体验，而且成本相当高。&quot;</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">以太坊的净收益</h2><p>虽然短期来看二层网络可能会寄生于ETH，但二者的长期关系却是正和博弈¹²的。确实，随着更多活动逐步迁移到二层网络，将比 L1 捕获更多 MEV。同时，和没有 rollup 存在的世界比，这可能会在短期内造成收益下降的压力。</p><p>因为 rollups 一次性将成千上万比交易批量提交到 L1 链上，rollups 的交易费用呈对数比例扩展。这几乎就像销售领域“薄利多销”和“厚利少销”这样的两难境地。从提供的数据可用性的规模来看，来自 rollups 的L1交易将比普通交易支付更高的交易费用。</p><p>另一个棘手的问题是矿工们可能会离开网络，从而降低L1的安全性。更糟糕的是，更多的L2交易将导致更多的状态膨胀，和对全节点更高的存储要求，从而降低去中心化。</p><p>归根结底，我们应该问的是：有还没有 rollups，会让 ETH 的价格涨得更高？</p><p>由于区块容量限制，以及高昂的gas费让大多数用户流失，直接发生在以太坊L1上的交互会有一个需求上限。在一个有 rollups、递归、分层L3的世界里，潜在的用户规模¹³将是十亿级别的。</p><p>在同样固定的L1区块空间中，rollup 打包进了更大的网络效应。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://storage.googleapis.com/papyrus_images/954b9cec7537718dc4e80a2dfb62eaed35f2d873862a1895a3b2afbfa8d24109.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>以太坊扩展到全球通用意味着L1上的区块空间永远都被占满。L2上的排序者赚取L2的交易手续费，同时支付他们在L1上的手续费，赚取这二者之间的价差，大家都开心。</p><p>此外，我不认为MEV和交易费用是ETH价值的驱动因素。Solana的交易费用收入极低，但它仍有800亿美元市值。</p><p>ETH的价值应该用商品定价和货币数量理论二者的融合来计算（以太坊是一个国家，ETH是它的货币）。安全层的价值捕获来源于发生在其上的经济活动，以及ETH的“货币性”。虽然有着较高的TPS和较低的交易费用，但L2仍然显著增加了货币流转速度。</p><p>很多怀疑论者说，L2 降低了 ETH 的&quot;moneyness&quot;。 @<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/TaschaLabs">TaschaLabs</a> 声称：</p><blockquote><p>你可以直接在中心化交易所购买，比如说 /ZKTOKEN/，转进你的 ZK 钱包，然后在 ZK 的L2上花费你的 /ZKTOKEN/，全程不需要 ETH。</p></blockquote><p>实际情况是，ETH的&quot;moneyness&quot;远没有被削弱。相比较于在某个特定L2上，因特定的dApps或用例的需求不稳定导致的tx需求波动，所有 rollups 对tx需求的总和将更加稳定。在一个 rollup 的世界里，ETH 将会成为通用货币。</p><p>大家买 ETH 不仅仅为了支付 gas 费用，同时也是因为很多东西都是以 ETH 本位计价的。 ETH 将会成为支付 gas 费用的主要实用型代币（即使是在 rollups 上）。NFT以ETH计价。Uniswap上最大的流动性池都是和ETH配对的。</p><p>ETH 属于可靠的抵押物，也是付款的首选。</p><p>ETH 在广泛分布的 &quot;moneyness&quot;网络效应方面具有先发优势。</p><p>🔊 🦇 ¹⁴的 林迪效应¹⁵已然成真。</p><p>通缩的代币经济学有助于货币性的叙事。正如@epolynya所说，&quot;rollups 有一个很大的优势，就是它们在通胀的预算几乎没有支出，或者只占其他竞争性L1的很小一部分。&quot;</p><h2 id="h-l2" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">L2 代币将至</h2><p>Rollups 的代币激动人心。不过，在它们推出之前，仍有很多准备工作要做。 我预计大多数 rollups 代币要在今年年底，甚至2023年才会推出。</p><p>但我相信势不可挡。二层网络需要代币来跟其他竞争性的L1竞争。通过推出原生代币，及实施一整套的激励计划和空投措施，将会推动这项技术实现其当初的预言：为以太坊扩容。</p><p>一旦他们发币，将举众哗然。</p><p>拭目以待吧。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">作者简介</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang">John Wang</a> 是一名独立研究员兼 builder，曾任/Saber (Solana)/的增长主管，及/Immutable (Starkware)/的产品经理。可以关注他的<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/j0hnwang">推特</a>或<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.johnwang.xyz/">博客</a>。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">译者注</h2><ul><li><p>[1] Wen Token ： 业内知名梗，所有或热门或冷门的DeFi协议、公链，只要还没发币的，基本每天都会被人在Discord、Twitter上追问： wen token？鉴于业内的传统，发币一般就意味着空投。</p></li><li><p>[2] Cap Table：股权结构表，公司股本的形成经历，记录了团队成员、投资人的持续占比等数据信息。</p></li><li><p>[3] Arbitrum 宕机十小时事件：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://thedefiant.io/arbitrum-outage-2/">Arbitrum Goes Down Citing Sequencer Problems - The Defiant</a></p></li><li><p>[4] Product Market Fit: 产品和市场达到最佳的契合点</p></li><li><p>[5] vampire attack：吸血鬼攻击，通过空投等形式，把用户和资金从另一个同类型协议中吸引过来，最早见于 SushiSwap 通过空投和超高的ARP收益率吸引了14亿美元的锁仓</p></li><li><p>[6] alt-L1s： 其他的 L1 链，比如 BNB Chain、Solana、Avalanche等高性能公链。</p></li><li><p>[7] rollup team：这里指的并不是 rollup 背后的团队，而是文中提到的这四条L2链背后的团队。因为这四个二层网络使用的都是叫做 rollup 的压缩技术</p></li><li><p>[8] tokenomics：代币经济学，主要指代币的发行、分发、质押、治理、销毁等</p></li><li><p>[9] FDV：完全稀释估值，等于当前代币价格 * 最大可能供应量</p></li><li><p>[10] Big Four: 使用 rollup 压缩技术的四个L2，zkSync、Optimism、Arbitrum、Starkware</p></li><li><p>[11] MEV：最大可提取价值，指区块提议者可以通过重新排序、审查或插入交易而无需许可地提取的价值</p></li><li><p>[12] positive-sum：正和博弈，是指博弈双方的利益都有所增加，或者至少是一方的利益增加，而另一方的利益不受损害，因而整个社会的利益有所增加</p></li><li><p>[13] TAM：total addressable market，特定产品或服务在市场中的潜在用户总数</p></li><li><p>[14] 🔊 🦇 : ETH 被社区称为 ultra sound money，用🦇 和 🔊 两个图标指代 ultra sound</p></li><li><p>[15] Lindy Effect：林迪效应，对于一些不会自然消亡的东西，比如一种技术、一个想法，它们的预期寿命和它们目前已经存在的时间成正比。即它每多生存一段时间，它的剩余预期寿命就会增加一点</p></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考资料</h2><ul><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://cornerstonevc.tw/vc-101-what-is-cap-table/">VC 101 什麼是 Cap Table - Cornerstone Ventures</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.zhihu.com/question/19658333">Product/Market Fit (PMF) 是什么？ - 知乎</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://new.qq.com/omn/20200908/20200908A0M0BA00.html?pc">Sushiswap的阳谋，吸血鬼攻击如何“窃取”流动性？_腾讯新闻</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://duncaninvest.blogspot.com/2021/05/tokenomics.html">Token + Economics = Tokenomics 代幣經濟學</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.defidaonews.com/article/6716186">DeFi之道财富密码：聊聊全稀释估值（FDV）和市值（MC）</a></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.panewslab.com/zh/articledetails/D60160060.html">MEV的定义究竟是什么？Flashbots进行了详细解释-PANews</a></p></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/23c345da169f356462ac19f00f573e7b9adc8e1c1bdcf658acc486f1f6ccb473.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[🌍 Alpha Passive 详谈：指数化的LP策略金库]]></title>
            <link>https://paragraph.com/@gm365-2/alpha-passive-lp</link>
            <guid>Ta0o44yX5ERrSyroc3kQ</guid>
            <pubDate>Sat, 12 Mar 2022 12:14:11 GMT</pubDate>
            <description><![CDATA[原文： Introducing Alpha Passive 原作者：Tom (Charm创始人) 编译： gm365Alpha Passive 提供的是一种被动式投资工具，以帮助长期投资者获取 DeFi 交易费，多样化他们的投资组合，并简化了 LP ¹ 体验。Alpha Passive 是一种针对长期投资者的 LP 金库（Vaults ²）套件，也是第一个使用指数作为其流动性策略的金库。这意味着投资者第一次可以使用被动投资工具获取 DeFi 的交易手续费。所有金库都是同类产品中运行时间最长、最安全、表现最优异的产品。这些金库也可以用来作为其他LP策略的业绩基准。所有现有的 Alpha Vault 都将被包含进 Alpha Passive 中。介绍Alpha Vault 是第一个部署在以太坊主网的 LP 金库，也是第一个使用 LP 策略来获取 DeFi 交易手续费的金库。它成功催生了一个策略型LP管理的新行业，业内很多同行如雨后春笋般涌现，而他们所用的正是与Alpha Vaults相同的技术。 时至今日，Alpha Vault 仍然是唯一持续表现优异的金库，同时也是唯一100%链上...]]></description>
            <content:encoded><![CDATA[<p>原文： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/charmfinance/introducing-alpha-passive-95d0f76436a4">Introducing Alpha Passive</a></p><p>原作者：Tom (Charm创始人)</p><p>编译： <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/gm365">gm365</a></p><blockquote><p>Alpha Passive 提供的是一种被动式投资工具，以帮助长期投资者获取 DeFi 交易费，多样化他们的投资组合，并简化了 LP ¹ 体验。</p></blockquote><ul><li><p>Alpha Passive 是一种针对长期投资者的 LP 金库（Vaults ²）套件，也是第一个使用指数作为其流动性策略的金库。</p></li><li><p>这意味着投资者第一次可以使用被动投资工具获取 DeFi 的交易手续费。</p></li><li><p>所有金库都是同类产品中运行时间最长、最安全、表现最优异的产品。</p></li><li><p>这些金库也可以用来作为其他LP策略的业绩基准。</p></li><li><p>所有现有的 Alpha Vault 都将被包含进 Alpha Passive 中。</p></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">介绍</h2><p>Alpha Vault 是第一个部署在以太坊主网的 LP 金库，也是第一个使用 LP 策略来获取 DeFi 交易手续费的金库。它成功催生了一个策略型LP管理的新行业，业内很多同行如雨后春笋般涌现，而他们所用的正是与Alpha Vaults相同的技术。</p><p>时至今日，<em>Alpha Vault</em> 仍然是唯一持续表现优异的金库，同时也是唯一100%链上型的策略。</p><p>鉴于<em>Alpha Vault</em> 的底层策略其实是一种能帮长期投资者获取 DeFi 交易手续费并最小化本金损失的指数型产品，现有 Alpha Vault 下的金库都将成为 <em>Alpha Passive</em> 。</p><h2 id="h-index" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">什么是指数（Index）？</h2><p>满足以下三个特性的策略应该被视为一种指数：</p><ol><li><p>完全透明</p></li><li><p>标的可投资</p></li><li><p>系统性（即完全基于特定规则）</p></li></ol><p>Alpha Passive 所使用的策略完全符合以上三条标准。</p><ul><li><p><em>完全透明</em></p></li></ul><p>金库的架构、策略和性能指标全部在链上且开源，能被任何人审阅并验证。</p><ul><li><p><em>标的可投资</em></p></li></ul><p>任何人都可以投资任意一个 Alpha Passive 金库，只需要有一个以太坊钱包即可。</p><ul><li><p><em>系统性</em></p></li></ul><p>Alpha Passive 已经在以太坊主网运行了近10个月（跟 Uniswap V3 上线时间一样长），且所有的价格区间均是在链上基于特定规则而选择，没有任何人工干预。</p><blockquote><p>由此可知，Alpha Passive 是第一个使用指数作为其LP策略的金库，且所有的金库都有着长期的业绩记录，透明，方便，表现优异。这也就是说，由 Alpha Passive 所提供的 Index Vaults ³ 与其他类型的指数投资标的（如标普500）具有相同的特性，这也意味着为LP策略建立被动投资工具第一次成为了可能。</p></blockquote><p>下一章将为大家介绍其核心优势及其他特性。</p><h2 id="h-alpha-passive" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Alpha Passive 的优势</h2><blockquote><p>更高的长期收益</p></blockquote><p>所有的指数产品（比如标普500）都有一个长期投资理论（如股票价格持续走高），并通过遵循一个基于特定规则的投资系统（如股票市值加权的投资回报组合），而不是通过人为决定买卖投标标的的方式来获取更高的投资收益。</p><p>对 Alpha Passive 而言，长期投资理论指的则是基于 DeFi 的交易量会持续攀升，并且在一套基于均值回归理念的基础上制定的开源策略来调整LP的价格区间，而无须任何人工干预。</p><p>通过投资于某个由 Alpha Passive 提供的 Index Vault 金库产品，投资者可以获得更高的投资收益，而不需要主动管理他们的头寸。在过去10个月的收益记录中，Alpha Passive 的表现一直优于主动调整价格区间型用户，以及设置全价格区间 ⁴ 的LP用户。</p><blockquote><p>最简单的方式提供流动性</p></blockquote><p><em>Alpha Passive</em> 是最简单的在 Uniswap V3 上提供流动性的方式，因此也是赚取交易手续费最简单的方式。</p><blockquote><p>下跌保护</p></blockquote><p>通过投资于 Alpha Passive，当标的价格下跌时，投资者（即LP持有人）收益将比 HODL（持有者）更高；而当标的价格上涨时，如果交易量放大，其收益同样更高。</p><blockquote><p>波动性更低</p></blockquote><p>LP份额的波动性比存入LP的任何单一资产都小得多，这也就意味着如果LP份额被用作借贷抵押物时，将能够获得更高的杠杆或更多贷款额度，而被清算的风险也更低。</p><blockquote><p>用作其他LP管理策略的业绩表现基准</p></blockquote><p>Alpha Passive为LP 策略提供了第一个 Index Vaults，很好地覆盖了主流交易对（比如 ETH/USDT, ETH/USDC, WBTC/USDC等）。因此，这些金库可以用作其他同类LP策略的业绩基准，就像投资指数（比如标普500）被用于主动管理型基金的业绩评判标准一样。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">风险</h2><blockquote><p>长时间的价格波动</p></blockquote><p>一般而言，LP策略都是做空波动性的（投资者都在押注波动性下降）。因此，如果标的价格长期持续上涨或下跌而不回调，LP策略则表现较差。即便所有的 Alpha Passive 策略都有对波动性的内在保护，但仍然有可能会有本金损失（即无常损失），即使是交易手续费也无法覆盖这些损失。</p><blockquote><p>短期表现可能不如主动管理型LP策略</p></blockquote><p>和所有的被动型投资类似，Alpha Passive 服务于那些长期投资者，在短期内的表现可能不如主动管理型的LP策略。</p><blockquote><p>流动性分布区间的变化</p></blockquote><p>Uniswap V3的流动性分布可能会起一定的变化，从而降低策略收益，这就意味着需要对策略进行相应调整。这种情况暂时还未发生过（过去10个月内），但未来有可能会发生。</p><p>在对策略进行任何调整之前，都会有相应的公告。</p><p>** 这就类似于标普500指数改变其指数编制方法，以反映股票拆分、特殊股息、公司分拆及其他可能影响其指数价值的变动。</p><blockquote><p>安全风险</p></blockquote><p>所有Alpha Passive提供的金库都经过了安全审计，且在过去10个月内未发生任何安全事故，但这并不确保未来一定不会发生。这也是为什么目前所有金库都在接受另一次审计，并同时设计了bug赏金计划，以此来接受社区的持续监督。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">总结</h2><p>Alpha Passive是第一个使用指数作为其LP策略的金库，且所有的Index Vaults 都有着长期的业绩记录，透明，方便，表现优异。这些金库可以被其他开发者用来建立被动投资工具，也可以被投资者用来获取DeFi交易手续费，从而使他们的投资组合多样化，并简化他们的LP体验。</p><p>Alpha Vaults提供的所有现有Index Vaults都符合纳入Alpha Passive的标准，Charm也会在未来研究和推出更多的Index Vaults。</p><p>如果你有兴趣与 Charm 合作编纂新的指数，或有任何其他问题，别犹豫，请通过下面的链接联系我们。我们很乐意与您一起帮助长期投资者们最大化他们的投资组合收益。</p><p>后会有期。</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/charmfinance">Twitter</a> | <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://discord.com/invite/6BY3Fq2">Discord</a> | <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://t.me/charmfinance">Telegram</a> | Email</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">译者注</h2><ul><li><p>[1] LP：Liquidity Provider，流动性提供者，给各类 DEX 比如 Uniswap、SushiSwap的交易对添加流动性的用户</p></li><li><p>[2] Vault：直译为保险库、金库，国内习惯性翻译为“机枪池”，起源于 Yearn 的 Vault 产品，其本质为一种通过运行既定策略来使收益最大化的聚合器。鉴于本文中的产品和机枪池的概念略有不同，其运行的是某一特定策略，而不会随意切换投资标的或策略，故本文选择“金库”的译法，以免大家误解。</p></li><li><p>[3] Index Vaults：根据和原作者 Tom 及 小伙伴 SP 等沟通的结果来看，此处的 Index Vaults 指的是 Charm 原有 Alpha Vaults 中的每一个单一 Vault，比如 WBTC/USDC、 WETH/USDC等。Charm后续将推出更多的 Index Vaults。</p></li><li><p>[4] Full Range ：全价格区间，指的是在 Uniswap V3 中添加流动性时，价格区间选择和 V2 一样的 0 - ∞ 全区间。</p></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考信息</h2><ul><li><p>Passive Vaults 产品的历史收益数据可查阅此 Dune Dashboard: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://dune.xyz/mxwtnb/Alpha-Vaults-Performance?Number%20of%20days=200">Alpha Vaults Performance</a></p></li><li><p>不同 Uniswap V3 Vaults 的历史收益对比数据：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://dune.xyz/vividot/Uniswap-V3-Vault-Range-Data-(for-me)?Number%20of%20days=200">Uniswap V3 Range Data</a></p></li><li><p>Passive Strategy 所使用的链上策略：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/charmfinance/alpha-vaults-contracts/blob/main/contracts/PassiveStrategy.sol">PassiveStrategy.sol · GitHub</a></p></li><li><p>什么是指数：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://jpm.pm-research.com/content/42/2/21">What Is an Index? | The Journal of Portfolio Management</a></p></li><li><p>标普500指数计算公式：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.investopedia.com/ask/answers/05/sp500calculation.asp">How Is the Value of the S&amp;P 500 Calculated?</a></p></li></ul>]]></content:encoded>
            <author>gm365-2@newsletter.paragraph.com (gm365.eth)</author>
            <enclosure url="https://storage.googleapis.com/papyrus_images/39c7ac33a9075d3103ddd988139db28a29708a6d874234ad6c03406b5778891f.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>