diff --git a/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (1).gif b/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (1).gif deleted file mode 100644 index 851303d..0000000 Binary files a/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (1).gif and /dev/null differ diff --git a/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (2).gif b/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (2).gif deleted file mode 100644 index 851303d..0000000 Binary files a/.gitbook/assets/2021-11-03 16-59-42 (1) (1) (2).gif and /dev/null differ diff --git a/.gitbook/assets/2021-11-03 16-59-42 (1) (1).gif b/.gitbook/assets/2021-11-03 16-59-42 (1) (1).gif deleted file mode 100644 index 851303d..0000000 Binary files a/.gitbook/assets/2021-11-03 16-59-42 (1) (1).gif and /dev/null differ diff --git a/.gitbook/assets/image (13) (1) (1) (1) (1).png b/.gitbook/assets/image (13) (1) (1) (1) (1).png deleted file mode 100644 index 31ff57d..0000000 Binary files a/.gitbook/assets/image (13) (1) (1) (1) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (13) (1) (1) (1) (2).png b/.gitbook/assets/image (13) (1) (1) (1) (2).png deleted file mode 100644 index 31ff57d..0000000 Binary files a/.gitbook/assets/image (13) (1) (1) (1) (2).png and /dev/null differ diff --git a/.gitbook/assets/image (13) (1) (1) (1).png b/.gitbook/assets/image (13) (1) (1) (1).png deleted file mode 100644 index 31ff57d..0000000 Binary files a/.gitbook/assets/image (13) (1) (1) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (19) (1) (1) (1).png b/.gitbook/assets/image (19) (1) (1) (1).png deleted file mode 100644 index 6387e29..0000000 Binary files a/.gitbook/assets/image (19) (1) (1) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (19) (1) (1) (2).png b/.gitbook/assets/image (19) (1) (1) (2).png deleted file mode 100644 index 6387e29..0000000 Binary files a/.gitbook/assets/image (19) (1) (1) (2).png and /dev/null differ diff --git a/.gitbook/assets/image (19) (1) (1).png b/.gitbook/assets/image (19) (1) (1).png deleted file mode 100644 index 6387e29..0000000 Binary files a/.gitbook/assets/image (19) (1) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (19).png b/.gitbook/assets/image (19).png index da2655e..6387e29 100644 Binary files a/.gitbook/assets/image (19).png and b/.gitbook/assets/image (19).png differ diff --git a/.gitbook/assets/image (27) (1) (1).png b/.gitbook/assets/image (27) (1) (1).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (1) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (27) (1) (2) (1).png b/.gitbook/assets/image (27) (1) (2) (1).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (1) (2) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (27) (1) (2) (2).png b/.gitbook/assets/image (27) (1) (2) (2).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (1) (2) (2).png and /dev/null differ diff --git a/.gitbook/assets/image (27) (1) (2).png b/.gitbook/assets/image (27) (1) (2).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (1) (2).png and /dev/null differ diff --git a/.gitbook/assets/image (27) (1).png b/.gitbook/assets/image (27) (1).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (1).png and /dev/null differ diff --git a/.gitbook/assets/image (27) (2).png b/.gitbook/assets/image (27) (2).png deleted file mode 100644 index b923849..0000000 Binary files a/.gitbook/assets/image (27) (2).png and /dev/null differ diff --git a/.gitbook/assets/image (27).png b/.gitbook/assets/image (27).png index d733507..b923849 100644 Binary files a/.gitbook/assets/image (27).png and b/.gitbook/assets/image (27).png differ diff --git a/.gitbook/assets/image (42).png b/.gitbook/assets/image (42).png index e236886..da2655e 100644 Binary files a/.gitbook/assets/image (42).png and b/.gitbook/assets/image (42).png differ diff --git a/.gitbook/assets/image (43).png b/.gitbook/assets/image (43).png index a13fa43..e236886 100644 Binary files a/.gitbook/assets/image (43).png and b/.gitbook/assets/image (43).png differ diff --git a/.gitbook/assets/image (44).png b/.gitbook/assets/image (44).png index 682f8f7..a13fa43 100644 Binary files a/.gitbook/assets/image (44).png and b/.gitbook/assets/image (44).png differ diff --git a/.gitbook/assets/image (45).png b/.gitbook/assets/image (45).png index b6f9923..682f8f7 100644 Binary files a/.gitbook/assets/image (45).png and b/.gitbook/assets/image (45).png differ diff --git a/.gitbook/assets/image (46).png b/.gitbook/assets/image (46).png index 7c5bea4..b6f9923 100644 Binary files a/.gitbook/assets/image (46).png and b/.gitbook/assets/image (46).png differ diff --git a/.gitbook/assets/image (47).png b/.gitbook/assets/image (47).png index 4a9f021..7c5bea4 100644 Binary files a/.gitbook/assets/image (47).png and b/.gitbook/assets/image (47).png differ diff --git a/.gitbook/assets/image (48).png b/.gitbook/assets/image (48).png index 7f276cd..4a9f021 100644 Binary files a/.gitbook/assets/image (48).png and b/.gitbook/assets/image (48).png differ diff --git a/.gitbook/assets/image (49).png b/.gitbook/assets/image (49).png index 0922ac1..7f276cd 100644 Binary files a/.gitbook/assets/image (49).png and b/.gitbook/assets/image (49).png differ diff --git a/.gitbook/assets/image (50).png b/.gitbook/assets/image (50).png index 711e243..d733507 100644 Binary files a/.gitbook/assets/image (50).png and b/.gitbook/assets/image (50).png differ diff --git a/.gitbook/assets/image (51).png b/.gitbook/assets/image (51).png index 6afc456..0922ac1 100644 Binary files a/.gitbook/assets/image (51).png and b/.gitbook/assets/image (51).png differ diff --git a/.gitbook/assets/image (52).png b/.gitbook/assets/image (52).png index e710688..711e243 100644 Binary files a/.gitbook/assets/image (52).png and b/.gitbook/assets/image (52).png differ diff --git a/.gitbook/assets/image (53).png b/.gitbook/assets/image (53).png index 2a6de60..6afc456 100644 Binary files a/.gitbook/assets/image (53).png and b/.gitbook/assets/image (53).png differ diff --git a/.gitbook/assets/image (54).png b/.gitbook/assets/image (54).png index 0ef68d4..e710688 100644 Binary files a/.gitbook/assets/image (54).png and b/.gitbook/assets/image (54).png differ diff --git a/.gitbook/assets/image (55).png b/.gitbook/assets/image (55).png index a520271..2a6de60 100644 Binary files a/.gitbook/assets/image (55).png and b/.gitbook/assets/image (55).png differ diff --git a/.gitbook/assets/image (56).png b/.gitbook/assets/image (56).png index f277d60..0ef68d4 100644 Binary files a/.gitbook/assets/image (56).png and b/.gitbook/assets/image (56).png differ diff --git a/.gitbook/assets/image (57).png b/.gitbook/assets/image (57).png index 556e67b..a520271 100644 Binary files a/.gitbook/assets/image (57).png and b/.gitbook/assets/image (57).png differ diff --git a/.gitbook/assets/image (58).png b/.gitbook/assets/image (58).png index d3ecf45..f277d60 100644 Binary files a/.gitbook/assets/image (58).png and b/.gitbook/assets/image (58).png differ diff --git a/.gitbook/assets/image (59).png b/.gitbook/assets/image (59).png index 2cc5381..556e67b 100644 Binary files a/.gitbook/assets/image (59).png and b/.gitbook/assets/image (59).png differ diff --git a/.gitbook/assets/image (60).png b/.gitbook/assets/image (60).png index 54d6111..d3ecf45 100644 Binary files a/.gitbook/assets/image (60).png and b/.gitbook/assets/image (60).png differ diff --git a/.gitbook/assets/image (61).png b/.gitbook/assets/image (61).png new file mode 100644 index 0000000..2cc5381 Binary files /dev/null and b/.gitbook/assets/image (61).png differ diff --git a/.gitbook/assets/image (62).png b/.gitbook/assets/image (62).png new file mode 100644 index 0000000..54d6111 Binary files /dev/null and b/.gitbook/assets/image (62).png differ diff --git a/README.md b/README.md index 9462c99..3679d50 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,81 @@ --- -说明: 欢迎使用Dune +description: Welcome to Dune --- -# Dune介绍 +# Introduction to Dune -## 简介 +## Introduction -**Dune是一款强大的区块链研究工具。通过Dune你可以查询,导出和可视化区块链上浩如烟海的数据。Dune让公共的区块链数据对每个人都触手可及,从而使其有了无限的可能。该文档将会帮你解答类似如下的问题:** +**Dune is a powerful tool for blockchain research. Dune gives you all the tools to query, extract, and visualize vast amounts of data from the blockchain. Dune is unlocking the power of public blockchain data by making it accessible to everyone. This documentation will help you answer questions like:** -[Uniswap每天的交易资金有多少?](https://dune.xyz/queries/3) +[How much volume flows through Uniswap each day?](https://dune.xyz/queries/3) -[哪家去中心交易所的交易额最高?](https://dune.xyz/queries/1847) +[Which Dex has the highest volume?](https://dune.xyz/queries/1847) -[重要的稳定币有什么链上行为?](https://dune.xyz/hagaetc/stablecoins) +[How are important Stablecoins behaving today?](https://dune.xyz/hagaetc/stablecoins) -## Dune基础 +## Dune Basics -#### Dune应用 +#### Dune App -理解[查询](./#queries), [可视化](duneapp/visualizations/)和 [仪表盘](duneapp/dashboards.md)的概念将对你畅游Dune很有帮助。 他们是你通往区块链信息大门的基础区块。作为一名区块链分析师,你可以查询数据信息,可视化你的结果,然后进一步用仪表盘来讲述你的内容。 +While navigating Dune, it helps to have a good understanding of [queries](./#queries), [visualizations](duneapp/visualizations/), and [dashboards](duneapp/dashboards.md). These are the basic building blocks that act as your portal to the world's blockchain information. As a blockchain analyst, you can create custom queries to fetch data, visualize the results of these queries, and then tell stories with your data using dashboards. -#### Dune的数据可视化 +#### Data available on Dune -在屏幕背后,Dune将晦涩的数据转换成容易阅读的数据表。使用SQL查询,你能准确得筛选出你需要的信息。 +Behind the scenes, Dune transforms difficult-to-access data into human-readable tables. Using SQL queries, you can query for exactly the information you need. -Dune既提供原始区块链数据也提供已解码的数据。只有有用户向我们提出了合约解码的需求,我们才提供对应的解码数据。 你可以在这里提交解码需求[网页](https://dune.xyz/contracts/new).\ +Dune has raw blockchain data and decoded blockchain data available. Decoded data is only available if somebody signaled to us before that a contract needs to be decoded. You can signal a decoding request to us via our [website](https://dune.xyz/contracts/new).\ \ -目前你可以查询以下的链上数据 **Ethereum, Polygon, Binance Smart Chain, Optimism** 和 **Gnosis Chain**. +You can currently query data from **Ethereum, Polygon, Binance Smart Chain, Optimism** and **Gnosis Chain**. -Dune提取区块链上我们索引的时间和内部调用,我们不规定和存储数据。 +Dune picks up events and internal calls from the blockchains we index, we don't have state/storage data. -## 查询 +## Queries -Dune将区块链的数据聚合到易于检索的数据库中。通过查询,你可以限定输出哪些数据。 +Dune aggregates blockchain data into SQL databases that can be easily queried. Queries are used to specify what data from the blockchain should be returned. -你也许想了解 _今天所有去中心化交易所的交易额_, 或者 _今年稳定币的铸造数量_。 不管是哪个问题,你都可以通过查询来解答。 +Maybe you want to know _all the Dex trades that happened today_, or the _total value of stablecoins minted this year_. Whatever the question, the answer likely starts with a Dune query. -查询同时返回数据的行和列 (与传统的SQL查询类似),你可以用来可视化展示。 +Queries return rows and columns of data (same as traditional SQL queries) that can later be visualized and presented. ![Screen Shot 2021-04-22 at 9 56 34 AM](https://user-images.githubusercontent.com/76178256/115726979-357d1380-a351-11eb-83ee-16f0d57c6ecb.png) -一名区块链分析师(比如你)可以有很多途径开始一条查询: +There are a few ways that a blockchain analyst (ie. you!) can get started running queries: -1. 使用Dune的 _抽象表_ 来查询常用数据表。这是最简单的也是最常用的使用Dune的方式。一些常用的抽象表包括`dex.trades`,`lending.borrow`和`stablecoin.transfer` (你可以在这里找到完整的抽象表列表[这里](https://github.com/duneanalytics/abstractions)) -2. 查询区块、日志和交易在内的原始以太坊数据。 -3. 中心化交易所的数据也是可以查询的。通过使用`prices.usd`可以迅速的返回几乎任意一种加密货币的价格。 +1. Use Dune _abstractions_ to query commonly used data tables. This is the simplest and most common way to use Dune. Some popular abstractions include `dex.trades`, `lending.borrow`, and `stablecoin.transfer` (you can find a complete list of abstractions [here](https://github.com/duneanalytics/abstractions)) +2. Query the raw ethereum data including blocks, logs, and transactions. +3. It is also possible to query centralized exchange data. Use `prices.usd` to quickly return the price of almost any cryptoasset -## 可视化 +## Visualizations -表中的数据 (行和列)有时不易阅读。结果的可视化可以更清晰准确地展示信息。 +Data presented in table form (rows and columns) can be difficult to read. Visualizations take the results of a query and present the information in a clear & precise way. -你可以开始通过可视化来讲述你的内容。通过Dune你可以轻松地将: +You can use visualizations to begin to tell a story with your data. With Dune visualizations it is easy to transform this: ![Screen Shot 2021-04-22 at 10 59 48 AM](https://user-images.githubusercontent.com/76178256/115737269-fa331280-a359-11eb-9a31-c0dfe4b038e6.png) -转化为: +Into this: ![Screen Shot 2021-04-22 at 11 01 02 AM](https://user-images.githubusercontent.com/76178256/115737692-5b5ae600-a35a-11eb-8145-bdcf9396cd03.png) -这个柱状图清晰地展示了最高的交易量发生在4月19日,同时帮助观众了解了时间趋势。 +The bar chart visualization makes it clear that April 19th had the highest transfer volume, and helps the audience see the trend over time. -Dune提供了可是展示数据的一系列的可视化选择,包括柱状图,面积图,线图,饼图等等。 +Dune offers a variety of visualizations that you can use to visually present data including bar charts, area charts, line charts, pie charts, and more. -## 仪表盘 +## Dashboards -使用精心设计的视觉展示,聪明的区块链分析师可以讲述关于特定数据组的内容。例如,在下文中,[仪表盘](https://dune.xyz/hagaetc/dex-metrics) 顶部展示了'Dex'在增长。观众来可以通过下面的展示发现,哪些去中心化交易所的交易额是较高的,最终通过累积的柱状图来能发现随时间变化的趋势。只需要看这一个仪表盘,观众就能清楚地看到整个DEX市场的情况。 +Using carefully planned visuals, a clever blockchain analyst can tell a story about a particular group of data. For example, in the below[ dashboard](https://dune.xyz/hagaetc/dex-metrics) it is clear at the top that 'Dex' as a category is growing. Below, the audience sees which dex's are the most popular by volume, and finally can view a stacked bar chart that shows changes over time. By just looking at this single dashboard, the audience sees a clear picture of the entire DEX market. ![Screen Shot 2021-04-23 at 10 51 25 AM](https://user-images.githubusercontent.com/76178256/115889404-e7841080-a421-11eb-9e30-8d43e58e28f4.png) -## Dune需要协作 +## Dune is a collaborative effort -Dune默认所有查询和数据库都是公开的。 +On Dune, all queries and datasets are public by default. -这引入了一个有趣的动态,在这个动态中,用户可以轻松地分叉和混合其他创建者的查询,并在他们的知识基础上进行构建。另一方面,每次编写新查询时,你都会参与查询贡献,帮助人们查询Dune上的数据。Dune社区通过不断改进的查询范围获得共同成功,你可以轻松查询所需的统计信息。 +This introduces an interesting dynamic in which you, the user, can fork and remix the queries of other creators with ease and build on top of their knowledge. On the other side, every time you write a new query, you contribute to the collection of queries that help people query for data on dune. That way, the Dune Community succeeds together through an ever improving range of queries that allow you to easily query for just the stats you need. -如果你对查询的隐私性有需求, 你可以订阅[pro Plan](https://dune.xyz/pricing)。 +If you do need Privacy for your Queries, the [pro Plan](https://dune.xyz/pricing) has got you covered. -加入我们 [Discord社区](https://discord.gg/BJBHFR6sdy) 来获得我们团队和社区的帮助。 +Join our [Community Discord](https://discord.gg/BJBHFR6sdy) to get world class support from our team and the community. -如果有任何反馈意见,不管是功能需求还是报告错误,你都可以在这里提交[这里](https://feedback.dune.xyz/). +If you have any feedback, whether feature requests or bug reports, you can submit it [here](https://feedback.dune.xyz/). diff --git a/SUMMARY.md b/SUMMARY.md index 9a142c1..8c30513 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -1,100 +1,100 @@ # Table of contents -* [Dune介绍](README.md) - -## 关于Dune - -* [使用案例](about/usecases/README.md) - * [项目仪表盘](about/usecases/project-dashboards.md) - * [细分仪表盘](about/usecases/sector-dashboards.md) - * [生态仪表盘](about/usecases/ecosystem-dashboards.md) -* [教程](about/tutorials/README.md) - * [网络课程](about/tutorials/our-network-course.md) - * [Dune指南](about/tutorials/dune-guides/README.md) - * [查询技巧](about/tutorials/dune-guides/tips.md) - * [SQL指南](about/tutorials/sql-guides.md) - * [视频教程](about/tutorials/video-series.md) - * [查询模板](about/tutorials/queries/README.md) - * [钱包的ETH余额](about/tutorials/queries/eth-balance-of-a-wallet.md) - * [钱包交易的原始数据](about/tutorials/queries/tx-wallet.md) - * [钱包的矿工费指标](about/tutorials/queries/gas-metrics-per-wallet.md) - * [价格查询](about/tutorials/queries/price-queries.md) - * [代币随时间的总供应量](about/tutorials/queries/supply.md) - * [一段时间的用户和交易量](about/tutorials/queries/untitled-6.md) - * [交易事件中代币的美元价格](about/tutorials/queries/untitled-3.md) - * [Uniswap代币的美元价格](about/tutorials/queries/untitled-2.md) - * [一段时间内一个钱包的代币(和美元价值)](about/tutorials/queries/untitled-1.md) - -## 数据表 - -* [数据表](data-tables/data-tables/README.md) +* [Introduction to Dune](README.md) + +## About Dune + +* [Use Cases](about/usecases/README.md) + * [Project Dashboards](about/usecases/project-dashboards.md) + * [Sector Dashboards](about/usecases/sector-dashboards.md) + * [Ecosystem Dashboards](about/usecases/ecosystem-dashboards.md) +* [Tutorials](about/tutorials/README.md) + * [Our Network course](about/tutorials/our-network-course.md) + * [Dune Guides](about/tutorials/dune-guides/README.md) + * [Tips for querying](about/tutorials/dune-guides/tips.md) + * [SQL guides](about/tutorials/sql-guides.md) + * [Video Series](about/tutorials/video-series.md) + * [Query templates](about/tutorials/queries/README.md) + * [ETH Balance of a wallet](about/tutorials/queries/eth-balance-of-a-wallet.md) + * [raw transactions per wallet](about/tutorials/queries/tx-wallet.md) + * [gas metrics per wallet](about/tutorials/queries/gas-metrics-per-wallet.md) + * [price queries](about/tutorials/queries/price-queries.md) + * [total supply over time of a token](about/tutorials/queries/supply.md) + * [Users and amount over a trailing period](about/tutorials/queries/untitled-6.md) + * [USD value of token utilised for an event](about/tutorials/queries/untitled-3.md) + * [USD price for a token from Uniswap](about/tutorials/queries/untitled-2.md) + * [Token (and USD value) per token over time for an address](about/tutorials/queries/untitled-1.md) + +## Data Tables + +* [Data tables](data-tables/data-tables/README.md) * [nft.trades](data-tables/data-tables/nft.trading.md) - * [原始数据](data-tables/data-tables/raw-data/README.md) - * [以太坊数据](data-tables/data-tables/raw-data/ethereum-data.md) - * [xDai数据](data-tables/data-tables/raw-data/xdai-data.md) - * [已解码数据](data-tables/data-tables/decoded-data.md) - * [代币标准](data-tables/data-tables/special-tables.md) - * [ERC-20代币余额](data-tables/data-tables/erc-20-balances.md) - * [抽象表](data-tables/data-tables/abstractions.md) - * [用户生成表](data-tables/data-tables/user-generated.md) - * [价格表](data-tables/data-tables/prices.md) - * [标签](data-tables/data-tables/labels.md) - * [Solana数据](data-tables/data-tables/solana-data/README.md) - * [更新日志](data-tables/data-tables/solana-data/changelog.md) - * [第三方数据](data-tables/data-tables/community-data/README.md) + * [Raw Data](data-tables/data-tables/raw-data/README.md) + * [Ethereum data](data-tables/data-tables/raw-data/ethereum-data.md) + * [xDai Data](data-tables/data-tables/raw-data/xdai-data.md) + * [Decoded Data](data-tables/data-tables/decoded-data.md) + * [Token standards](data-tables/data-tables/special-tables.md) + * [ERC-20 balances](data-tables/data-tables/erc-20-balances.md) + * [Abstractions](data-tables/data-tables/abstractions.md) + * [User Generated](data-tables/data-tables/user-generated.md) + * [Prices](data-tables/data-tables/prices.md) + * [Labels](data-tables/data-tables/labels.md) + * [Solana Data](data-tables/data-tables/solana-data/README.md) + * [Changelog](data-tables/data-tables/solana-data/changelog.md) + * [Third Party Data](data-tables/data-tables/community-data/README.md) * [Flashbots](data-tables/data-tables/community-data/flashbots.md) -## Dune V2 (beta) +## Dune Engine V2 (beta) -* [Dune V2介绍](dune-engine-v2-beta/dunes-new-query-engine.md) -* [查询引擎](dune-engine-v2-beta/query-engine.md) -* [Dune V2抽象表](dune-engine-v2-beta/abstractions-in-dunev2.md) +* [Dune V2 Intro](dune-engine-v2-beta/dunes-new-query-engine.md) +* [Query Engine](dune-engine-v2-beta/query-engine.md) +* [Abstractions in Dune V2](dune-engine-v2-beta/abstractions-in-dunev2.md) ## Dune App -* [查询编辑器](duneapp/query-editor.md) -* [可视化](duneapp/visualizations/README.md) - * [图表](duneapp/visualizations/graphs.md) - * [计数器](duneapp/visualizations/counters.md) - * [饼图](duneapp/visualizations/pie-charts.md) -* [仪表盘](duneapp/dashboards.md) -* [参数](duneapp/parameters.md) -* [添加新合约](duneapp/adding-new-contracts.md) +* [Query Editor](duneapp/query-editor.md) +* [Visualizations](duneapp/visualizations/README.md) + * [Graphs](duneapp/visualizations/graphs.md) + * [Counters](duneapp/visualizations/counters.md) + * [Pie Charts](duneapp/visualizations/pie-charts.md) +* [Dashboards](duneapp/dashboards.md) +* [Parameters](duneapp/parameters.md) +* [Adding new contracts](duneapp/adding-new-contracts.md) ## Onboarding -* [入门Dune](onboarding/onboarding-to-dune.md) +* [Onboarding to Dune](onboarding/onboarding-to-dune.md) -## 赏金计划 +## Bounties -* [Wizard需求计划](bounties/wizard-request-program.md) +* [Wizard Request Program](bounties/wizard-request-program.md) -## 跨网站使用Dune图表 +## Dune Charts across the web -* [内容归属](sharing/attribution.md) -* [嵌入第三方平台](sharing/embeds/README.md) +* [Attribution](sharing/attribution.md) +* [Embeds](sharing/embeds/README.md) * [Discord](sharing/embeds/discord.md) * [Twitter](sharing/embeds/twitter.md) * [Webpages](sharing/embeds/webpages.md) * [Mirror.xyz](sharing/embeds/mirror.xyz.md) * [Known Issues](sharing/embeds/known-issues.md) -## 资源 +## Resources * [Press Kit](resources/press-kit.md) ## FAQ -* [Dune是如何获取数据的?](faq/how-does-dune-get-its-data.md) -* [Dune有API吗?](faq/does-dune-have-an-api.md) -* [Dune有代币吗?](faq/does-dune-have-a-token.md) -* [查询结果如何刷新?](faq/how-are-results-refreshing.md) +* [How does Dune get it's data ?](faq/how-does-dune-get-its-data.md) +* [Does Dune have an API?](faq/does-dune-have-an-api.md) +* [Does Dune have a Token?](faq/does-dune-have-a-token.md) +* [How are results refreshing?](faq/how-are-results-refreshing.md) -## 更新日志 +## Changelog -* [Dune的变化](changelog/dune-changes/README.md) - * [2021年3月](changelog/dune-changes/march-2021.md) - * [2020年8月](changelog/dune-changes/august-2020.md) - * [2020年3月](changelog/dune-changes/march-2020.md) - * [2020年1月](changelog/dune-changes/january-2020.md) - * [2019年10月](changelog/dune-changes/october-2019.md) +* [Changes to Dune](changelog/dune-changes/README.md) + * [March 2021](changelog/dune-changes/march-2021.md) + * [August 2020](changelog/dune-changes/august-2020.md) + * [March 2020](changelog/dune-changes/march-2020.md) + * [January 2020](changelog/dune-changes/january-2020.md) + * [October 2019](changelog/dune-changes/october-2019.md) diff --git a/about/tutorials/README.md b/about/tutorials/README.md index b538c03..eb7bc74 100644 --- a/about/tutorials/README.md +++ b/about/tutorials/README.md @@ -1,14 +1,14 @@ -# 教程 +# Tutorials -## 如何开始 +## How to get started -**Dune是为技术和非技术人员构建的** \ -不论你是一个经验丰富的SQL开发人员还是刚刚起步的使用者,你都可以使用我们的平台,很快的开始分析区块链数据。 +**Dune is made for technical and non-technical users alike.** \ +Whether you are a seasoned SQL developer or just starting out, you can use our platform to start analyzing Blockchain data in an instant. -Dune团队和我们的一些社区成员已经制作了很好的内容,这些内容可以帮助你成为Dune巫师(Wizard)。 +The Dune Team and several of our community members have produced great content to aid you in your journey of becoming a Dune Wizard. -你可以从观看我们的视频系列开始 [这里](video-series.md) 或者通过文字教程 [这里](dune-guides/).\ -如果你对SQL完全不熟悉,不妨先用所列的SQL指南学习一下SQL [这里](sql-guides.md). +You can either start out by watching our video series [here](video-series.md) or looking through written tutorials [here](dune-guides/).\ +If you are entirely unfamiliar with SQL, it might be good to start off by learning some SQL with the guides listed [here](sql-guides.md). {% content-ref url="video-series.md" %} [video-series.md](video-series.md) @@ -22,22 +22,23 @@ Dune团队和我们的一些社区成员已经制作了很好的内容,这些 [dune-guides](dune-guides/) {% endcontent-ref %} -## 你需要知道哪些? +## What do you need to know? -#### SQL知识 +#### SQL knowledge -要想在Dune上成功地查询到数据,需要对SQL有一个基本的了解。\ -PostgreSQL数据库几乎在各行各业都被广泛使用,你可以找到很多关于它的非Dune专用的文档。这往往有助于回答与查询有关的问题,因为大多数答案可以在互联网上很容易找到。[PostgreSQL 文档](https://www.postgresql.org/docs/12/index.html) 官方文档也很有帮助. Dune运行在 PostgreSQL 12.2上. +A fundamental understanding of SQL is needed to be able to successfully query for data on Dune.\ +PostgreSQL Database Systems are widely used across almost all walks of life and you can find a lot of non Dune specific documentation about it. This often times helps with answering query related questions since most answers can easily be found in the internet. The official [PostgreSQL documentation](https://www.postgresql.org/docs/12/index.html) is quite helpful as well. Dune runs on PostgreSQL 12.2. -#### 以太坊虚拟机(EVM)数据 +#### Ethereum Virtual Machine data -你能在链上找到的数据,在Dune的数据库中基本都能找到,这个过程在许多方面都与理解以太坊虚拟机的整体工作方式有关,还需要理解具体的智能合约是如何工作的。如果你能够阅读Etherscan中的大部分数据,你就已经在能够在dune上熟练的查询各种数据了。\ -然而目前我们真的没有一个很好的资源可以提供,因为每个智能合约都有自己的规则。我们已经在我们的网站上写了一些关于这个问题的教程。[Section "decoded data"](../../data-tables/data-tables/decoded-data.md). +The data you will find on chain and therefore in Dune's databases is in many ways connected to understanding how the Ethereum Virtual Machine works as a whole and then in more specific terms understanding how the specific smart contracts work. If you are able to read most of the data in Etherscan, you are already well on your way to being able to query for things on dune.\ +Unfortunately there really isn't one great resource we can point you to currently as each smart contract has it's own rules. We have written up a few words on this in our [Section "decoded data"](../../data-tables/data-tables/decoded-data.md). -#### 业务理解 +#### Business Understanding -以上这些对你们中的一些人来说可能是一个惊喜,但实际上了解什么样的数据对你的项目或主题是有用的,是成为一个厉害的数据分析师的基础。\ +This is something that might come as a surprise to some of you, but actually understanding what kinds of data is interesting for your project or topic is a fundamental part of becoming a great wizard. \ \ -问你自己: **哪些数据是我的项目所关心和需要的,可以帮助我的决策过程 ?** +Ask yourself: **What Data is interesting and needed for my project to make better decisions ?** + +There is a thousand ways to go about finding what metrics are interesting to your project, but talking to the community of the project or the founders usually yields good results. -有上千种方法去寻找你的项目对哪些指标感兴趣,多与项目的社区或创始人交流通常会产生好的结果。 diff --git a/about/tutorials/dune-guides/README.md b/about/tutorials/dune-guides/README.md index f9228bd..54a80a7 100644 --- a/about/tutorials/dune-guides/README.md +++ b/about/tutorials/dune-guides/README.md @@ -1,6 +1,6 @@ -# Dune 指南 +# Dune Guides -我们的一些社区成员已经为Dune制作了很棒的教程。 +Some of our Community Members have produced great written tutorials for Dune: [Andrew Hong](https://twitter.com/andrewhong5297) @@ -31,6 +31,6 @@ -这些指南都很好,我们建议阅读所有的指南。\ +These guides are all great and we recommend reading all of them.\ \ -非常**感谢**这些指南的作者,你们太了不起了! +Big **thank you** to the authors of these guides, you are amazing! diff --git a/about/tutorials/dune-guides/tips.md b/about/tutorials/dune-guides/tips.md index ae1722f..8f64ca4 100644 --- a/about/tutorials/dune-guides/tips.md +++ b/about/tutorials/dune-guides/tips.md @@ -1,34 +1,34 @@ -# 查询技巧 +# Tips for querying -你可以通过我们的界面与数据表进行互动,网址是 [dune.xyz](https://www.dune.xyz/). +You can interact with the data tables through our interface at [dune.xyz](https://www.dune.xyz/). -要创建一个新的查询,你只需点击右上角的`New Query`。 +To create a new query you simply click `New Query` in the top right corner ![](https://i.imgur.com/dMHavC8.png) -在你的左边,你可以在下拉列表中选择你要使用的数据库,然后在窗口中看到数据表。只要搜索你感兴趣的项目就可以了。 +On your left you can select which database you want to use in the dropdown list and then see the data tables in the window. Just search for the project you are interested in working with. -## 使用抽象表(abstractions) +## Use abstractions -使用Dune Analytics进行分析的最简单方法是使用准备好的[抽象表](.../.../data-tables/data-tables/abstractions.md)表,如`dex.trades`。所有的表都是经过清理的,包含了数据和元数据(如人类可读的标记符号),使它们查询会非常便捷。 +The easiest way to do great analysis with Dune Analytics is to use prepared [abstractions](../../../data-tables/data-tables/abstractions.md) tables like `dex.trades`. All tables are cleaned and contains data and metadata (like human readable token symbols) that make them very straight forward to query. -## 在查询中使用以太坊地址 +## Using Inline Ethereum addresses -在Dune中,以太坊地址被存储为postgres字节数,并以`x`前缀进行编码。这与习惯的`0x`前缀不同。如果你想使用一个地址,比如说过滤一个给定的代币,你可以这样做 +In Dune Ethereum addresses are stored as postgres bytearrays which are encoded with the `\x` prefix. This differs from the customary `0x` prefix. If you’d like to use an inline address, say to filter for a given token, you would do ```sql WHERE token = '\x6b175474e89094c44da98b954eedeac495271d0f' ``` -是下面的简洁版本 +which is simply short for ```sql WHERE token = '\x6b175474e89094c44da98b954eedeac495271d0f'::bytea ``` -## 引用驼峰字母的列名和表名 +## Quote camel case column and table names -列和表的名称大多直接取自智能合约的ABI,没有任何修改。由于大多数智能合约是用Solidity编写的,而且是用驼峰命名惯例编写的,所以Dune的许多表和列名也是如此。Postgres要求你用双引号去区分的列和表的大小写。 +Column and table names are mostly taken directly from smart contract ABIs, with no modification. Since most smart contracts are written in Solidity, and written with a camelCased naming convention, so is many of Dune’s table and column names. Postgres requires you to quote columns and tablenames that are case sensitive: ```sql SELECT “columnName” @@ -36,7 +36,7 @@ FROM projectname.”contractName_evt_EventName” LIMIT 10 ``` -在Postgres中,双引号是为表和列保留的,而单引号是为值保留的: +In Postgres, double quotes are reserved for tables and columns, whereas single quotes are reserved for values: ```sql SELECT “columnName” @@ -45,61 +45,60 @@ WHERE contract_address = '\x6B175474E89094C44Da98b954EedeAC495271d0F' LIMIT 10 ``` -模式(schemas)在Dune中总是小写的。 +Schemas are always lowercase in Dune. ## Remove decimals -以太币转账和大多数ERC-20代币都是18位数字。为了得到一个更适合人类阅读的数字,你需要去掉所有的代表小数的0。表`erc20.tokens`为你提供了流行代币的合约地址、符号和小数点的数量。然后将代币价值转移除以10的小数点幂。 +Ether transfers and most ERC-20 tokens have 18 decimal places. To get a more human readable number you need to remove all the decimals. The table `erc20.tokens` gives you contract address, symbol and number of decimals for popular tokens. Token value transfers are then divided by 10 to the power of decimals from this table: `transfer_value / 10^erc20.tokens.decimals` -## 使用`date_trunc`获得时间 +## Use `date_trunc` to get time -我们在解码的事件表中加入了`evt_block_time`,以方便你使用。使用它的一个很好的方法是与`date_trunc`函数一起使用,像这样 +We’ve added `evt_block_time` to decoded event tables for your convenience. A neat way to use it is with the `date_trunc` function like this ```sql SELECT date_trunc('week', evt_block_time) AS time ``` -你可以用minute, day, week, month. +Here you can use minute, day, week, month. -## 如何获得美元价格(USD) +## How to get USD price To get the USD volume of onchain activity you typically want to join the smart contract event you are looking at with the usd price and join on minute. Also make sure that asset matches asset. -为了获得链上活动的美元交易量,你通常要将你所看的智能合约事件与美元价格就行关联,以分钟为关联的键,还要确保资产与资产相匹配。 + ```sql LEFT JOIN prices.usd p ON p.minute = date_trunc('minute', evt_block_time) AND event."asset" = p.contract_address ``` -然后,你可以在你的`SELECT`语句中简单地将智能合约事件的价值或金额与美元价格相乘:`* p.price`。 - -## 代币符号 +Then you can simply multiply the value or amount from the smart contract event with the usd price in your `SELECT` statement: `* p.price`. -你经常想按代币地址来分组查询结果。例如,你想看到按代币查询在DEX上的交易量。然而,一大堆代币地址的列表是抽象的,难以理解的。 +## Token symbols -因此,你经常想用代币符号来代替,简单地将表`erc20.tokens`与你的事件表关联起来,使用asset=token地址。然后你就可以用代币的符号代替地址。 +You often want to group your results by token address. For instance you want to see volume on a DEX grouped by token. However, a big list of token addresses are abstract and hard to digest. -**NB** `erc20.tokens`表包含了一些流行的代币。如果你正在处理更多晦涩难懂的代币,你应该注意与该表的关联,因为不在coincap表中的代币可能被排除在你的结果之外。 +Therefore you often want to use the token symbol instead. Simply join the table `erc20.tokens` with your event table where asset = token address. You then select symbol in your select statement instead of token address. +**NB** The `erc20.tokens` table cointains a selection of popular tokens. If you are working with more obscure tokens you should be careful with joining with this table because tokens that are not in the coincap table might be excluded from your results. -## 用参数过滤查询和仪表盘 +## Filter queries and dashboards with parameters -参数可以把你的查询或仪表盘变成区块链数据的应用程序。 +Parameters can turn your query or dashboard into an app for blockchain data. -在查询编辑器页面上点击SQL编辑器右下方的`Add parameter`。 +Click `Add parameter` in the bottom right of the SQL editor on the query editor page ![](https://i.imgur.com/rYJVSqA.png) -双层大括号将出现在你的查询中`{{}}`。在这些大括号中,你可以放入你的参数名称,如 `token symbol`或`holder address`。 +Double curly bracets will appear in your query `{{}}`. Inside these you put the name of your paramter like `token symbol` or `holder address`. -注意,如果你想在你的查询中使用参数`WHERE token = '{{token symbol}}'`,你需要加上单引号。 +Note that you need to put single quotes if you want to use the parameter in your query `WHERE token = '{{token symbol}}'`. -为了使用户不必为地址输入`\x`,一个有用的地址格式化是这样的。 +To save the user from having to put in `\x` for the address a useful formatting of addresses is this one: ```sql WHERE contract_address = CONCAT('\x', substring('{{token address}}' from 3))::bytea ``` -这让你的查询用户在过滤时只需粘贴`0xc00e94cb662c3520282e6f5717214004a7f26888`而不是`\xc00e94cb662c3520282e6f5717214004a7f26888`。 +This let’s a user of your query simply paste in `0xc00e94cb662c3520282e6f5717214004a7f26888` instead of `\xc00e94cb662c3520282e6f5717214004a7f26888` when they filter. diff --git a/about/tutorials/our-network-course.md b/about/tutorials/our-network-course.md index 8400faa..2e530ce 100644 --- a/about/tutorials/our-network-course.md +++ b/about/tutorials/our-network-course.md @@ -1,14 +1,13 @@ # Our Network course -我们来自OurNetwork的朋友与Dune Analytics合作创建了一个课程,在30天内教给30人web3数据分析。 +Our friends from OurNetwork have created a course in cooperation with Dune Analytics that taught 30 people web3 data in 30 days. -该课程涵盖了成为一名的Dune创作者的所有主题,并向所有人免费提供。它由Dune上的一些最好的创作者主讲,是开始你的Dune之旅的好地方。 +The course consists of presentations around all important topics that you need to become a Dune Creator and is available for free to everyone. It was hosted by some of the best creators we have on Dune nowadays and is currently the place to start your Dune Journey. -更多的细节信息和课程资料可以从下面找到: +More details and course materials can be found here: [https://ournetwork.mirror.xyz/gP16wLY-9BA1E\_ZuOSv1EUAgYGfK9mELNza8cfgMWPQ](https://ournetwork.mirror.xyz/gP16wLY-9BA1E\_ZuOSv1EUAgYGfK9mELNza8cfgMWPQ) Please consider buying an edition of the mirror post to support the teachers of this course. -请考虑购买mirror,以支持本课程的教师。 diff --git a/about/tutorials/queries/README.md b/about/tutorials/queries/README.md index a91268e..68ab646 100644 --- a/about/tutorials/queries/README.md +++ b/about/tutorials/queries/README.md @@ -1,12 +1,13 @@ -# 查询模板 +# Query templates -**根据我们的经验,你最好在Dune周围寻找你可能感兴趣的查询,并查看这些查询的源代码来学习。** +**In our experience, you are best off looking around Dune and finding queries that you might find interesting and looking at the source code of those to learn.** -Dune是一个由用户共享的协作的平台。所有数据分析师的复合知识将使你以最快的方式获得结果。 -看到查询的结果和反馈,确实可以让你更直观地参与到内容中去,学习得更快。\ -**找到优秀的查询创建者,并将他们的查询分叉,以获得最大的效率。** +Dune is a collaborative endeavour that is shared by it's users. The compounded knowledge of all analysts will allow you to get to results the fastest way.\ +Seeing the queries live and in action does allow you to more intuitively engage with the content and learn faster. -**我们一些最好的创作者:** +**Find great query creators and fork their queries for maximum efficiency.** + +**Some of our best creators are these:** * [https://dune.xyz/hagaetc](https://dune.xyz/hagaetc) * [https://dune.xyz/rchen8](https://dune.xyz/rchen8) @@ -16,7 +17,7 @@ Dune是一个由用户共享的协作的平台。所有数据分析师的复合 * \*\*\*\*[https://dune.xyz/Siang513](https://dune.xyz/Siang513) * [https://dune.xyz/keeganead](https://dune.xyz/keeganead) -**我们在此收集了一些查询,以做简单介绍:** +**Nevertheless we have collected some queries here for a simple introduction:** {% content-ref url="untitled-6.md" %} [untitled-6.md](untitled-6.md) diff --git a/about/tutorials/queries/eth-balance-of-a-wallet.md b/about/tutorials/queries/eth-balance-of-a-wallet.md index a41e985..22bc42a 100644 --- a/about/tutorials/queries/eth-balance-of-a-wallet.md +++ b/about/tutorials/queries/eth-balance-of-a-wallet.md @@ -1,6 +1,6 @@ -# 钱包的ETH余额 +# ETH Balance of a wallet -这个查询可以得出一个钱包在一段时间内的ETH余额。 +This Query yields the ETH balance of a wallet over time. ```sql Select sum(transfer) over (order by day asc), day @@ -35,4 +35,4 @@ SELECT date_trunc('day', block_time) as day, sum(-value/1e18) as transfer ) as x ``` -原作者: [https://twitter.com/MSilb7](https://twitter.com/MSilb7) +Original author: [https://twitter.com/MSilb7](https://twitter.com/MSilb7) diff --git a/about/tutorials/queries/gas-metrics-per-wallet.md b/about/tutorials/queries/gas-metrics-per-wallet.md index 399537a..ecf3ad8 100644 --- a/about/tutorials/queries/gas-metrics-per-wallet.md +++ b/about/tutorials/queries/gas-metrics-per-wallet.md @@ -1,6 +1,6 @@ -# 每个钱包的gas花费 +# gas metrics per wallet -### 总的gas费用(USD) +### Running Total of Gas Paid in USD ```sql with alltransactions @@ -33,7 +33,7 @@ ON date_trunc('minute', block_time) = minute ORDER BY block_time DESC ``` -### 总的gas费用(ETH) +### Running Total of Gas Paid in ETH ```sql with alltransactions @@ -58,7 +58,7 @@ FROM alltransactions ORDER BY block_time DESC ``` -### 平均gas费用 +### Average Gas Price Paid ```sql with alltransactions @@ -81,7 +81,7 @@ SELECT FROM alltransactions ``` -### 平均gas费用(USD) +### Average Gas Fee in USD ```sql with alltransactions @@ -113,7 +113,7 @@ LEFT JOIN ON date_trunc('minute', block_time) = minute ``` -### 最高gas费用(USD) +### Highest Gas Fee Paid in USD ```sql with alltransactions @@ -145,7 +145,7 @@ LEFT JOIN ON date_trunc('minute', block_time) = minute ``` -### 每月gas费用(USD) +### Gas Fees Paid by Month in USD ```sql with alltransactions diff --git a/about/tutorials/queries/price-queries.md b/about/tutorials/queries/price-queries.md index d29ba7e..2577baf 100644 --- a/about/tutorials/queries/price-queries.md +++ b/about/tutorials/queries/price-queries.md @@ -1,6 +1,6 @@ -# 价格查询 +# price queries -### 中心化交易所价格数据 +### Centralized exchange price data ```sql Select @@ -14,7 +14,7 @@ WHERE symbol = '{{1. Symbol}}' and minute > now() - interval '1hour' ``` -### 去中心化交易所价格数据 +### Decentralized exchange price data ```sql Select @@ -28,9 +28,9 @@ WHERE symbol = '{{1. Symbol}}' and hour > now() - interval '1000hour' ``` -这个查询以来erc20.tokens表,当该小时内没有提交的交易时,可能会出现空隙。 +This Query depends on the erc20.tokens table and can have gaps when there are no trades that been committed in that hour. -对于一个更好但更复杂的版本,使用这个: +For a better but more complicated to navigate version use this: ```sql with dex_trades AS ( @@ -107,4 +107,4 @@ with dex_trades AS ( AND d.hour < b.next_hour -- Yields an observation for every hour after the first transfer until the next hour with transfer ``` -这将根据dex交易数据按小时返回价格,并填补没有进行过交易的空白行。你可以在第53行调整所需的交易样本量,以便获取价更好的格数据。这可以帮助修正arbritrage机器人在dexes上获得奇怪价格的异常情况。如果你有这方面的问题,请在Discord上与我们联系。 \ No newline at end of file +This will return the price by hour according to dex trading data and fill in gaps where there have been no trades commited. You can adjust the sample size of trades required to carry the price data forward in line 53. This can help ammend edge cases where arbritrage bots get weird prices on dexes. If you have issues with this, please reach out to us on Discord. diff --git a/about/tutorials/queries/supply.md b/about/tutorials/queries/supply.md index 577c288..c5ad313 100644 --- a/about/tutorials/queries/supply.md +++ b/about/tutorials/queries/supply.md @@ -1,8 +1,8 @@ -# 代币在一段时间内的总供应量 +# total supply over time of a token -你可以使用该token的合约表,只要他们被解码([decoded](../../../data-tables/data-tables/decoded-data.md)): +You can either use that token's specific tables as long as they are [decoded](../../../data-tables/data-tables/decoded-data.md): ```sql SELECT @@ -24,8 +24,9 @@ UNION ) as net; ``` -或者你可以使用一些更通用的方式查询,就像这个: -(请注意,虽然这对大多数ERC20代币都有效,但有些代币的结构有细微变化,这个查询就会不起作用。) +Or you can use a more general purpose query like this one: + +(Please note that while this works for most tokens, some tokens do have slight changes in their structure that break this query) ```sql Select diff --git a/about/tutorials/queries/tx-wallet.md b/about/tutorials/queries/tx-wallet.md index 1644b56..761d488 100644 --- a/about/tutorials/queries/tx-wallet.md +++ b/about/tutorials/queries/tx-wallet.md @@ -1,6 +1,6 @@ -# 每个钱包的原始交易 +# raw transactions per wallet -### 总交易笔数 +### Total # of Transactions ```sql with alltransactions @@ -24,7 +24,7 @@ FROM alltransactions ``` -### 交易成功率 +### Transaction Success Rate ```sql with alltransactions @@ -50,7 +50,7 @@ GROUP by success ORDER BY success DESC ``` -### 某时间的总交易笔数 +### Running Total of # of Transactions ```sql with alltransactions diff --git a/about/tutorials/queries/untitled-1.md b/about/tutorials/queries/untitled-1.md index 0e0c8ee..6ed74f4 100644 --- a/about/tutorials/queries/untitled-1.md +++ b/about/tutorials/queries/untitled-1.md @@ -1,6 +1,6 @@ -# 一个地址的每个代币(和美元价值)在一段时间内的情况 +# Token (and USD value) per token over time for an address -请注意,当在很长一段时间内有许多代币和转让时,这个查询会变得非常繁重。 +Note that this query can get very heavy when there are many tokens and transfers over a long period of time. ```sql WITH transfers AS ( diff --git a/about/tutorials/queries/untitled-2.md b/about/tutorials/queries/untitled-2.md index f1a102d..993836d 100644 --- a/about/tutorials/queries/untitled-2.md +++ b/about/tutorials/queries/untitled-2.md @@ -1,10 +1,10 @@ -# 某一代币在Uniswap上的美元价格 +# USD price for a token from Uniswap -在Dune Analytics上获取代币美元价格的最常见和最简单的方法是使用`prices.usd`表。然而,这个数据是从中心化交易所获取的,所以对于长尾(小众)的代币,最好的方法是从Uniswap获取价格。 +The most common and easiest way to get token USD prices on Dune Analytics is with the `prices.usd` table. However, this data is fetched from centralised exchanges so for a long tail of tokens the best approach is to get prices from Uniswap. -这个查询使用WETH对,用来映射到美元价格。该查询可以被修改,以适用于任何有`prices.usd`价格的代币。 +This query uses WETH pairs, which is used to map to USD price. The query can be modified to work with any token that has a price in `prices.usd` -你可以在这里找到相关内容[这里](https://explore.dune.xyz/queries/11050/source?p\_Token%20address=0xeb4c2781e4eba804ce9a9803c67d0893436bb27d). +You can find this query on Dune [here](https://explore.dune.xyz/queries/11050/source?p\_Token%20address=0xeb4c2781e4eba804ce9a9803c67d0893436bb27d). ```sql WITH weth_pairs AS ( -- Get exchange contract address and "other token" for WETH diff --git a/about/tutorials/queries/untitled-3.md b/about/tutorials/queries/untitled-3.md index 9f3d528..1a13f47 100644 --- a/about/tutorials/queries/untitled-3.md +++ b/about/tutorials/queries/untitled-3.md @@ -1,4 +1,4 @@ -# 获取一个事件(event)的代币美元价值 +# USD value of token utilised for an event ### diff --git a/about/tutorials/queries/untitled-6.md b/about/tutorials/queries/untitled-6.md index 3866102..ebe8bfb 100644 --- a/about/tutorials/queries/untitled-6.md +++ b/about/tutorials/queries/untitled-6.md @@ -1,4 +1,4 @@ -# 查询一段时间的用户和交易量 +# Users and amount over a trailing period ```sql SELECT date_trunc('day', evt_block_time), diff --git a/about/tutorials/sql-guides.md b/about/tutorials/sql-guides.md index 80ab060..f1697ff 100644 --- a/about/tutorials/sql-guides.md +++ b/about/tutorials/sql-guides.md @@ -1,16 +1,16 @@ -# SQL指南 +# SQL guides -**PostgreSQL教程** +**General PostgreSQL Tutorials** -为了成为一名成功的Dune Wizard,你需要对PostgreSQL有一个很好的了解,以便能够从我们的数据库中查询数据。 +To be a successful Dune Wizard you need to have a good understanding of PostgreSQL to be able to query data from our database. -我们已经整理了一些资源,我们认为这些资源对你成为一名Dune Wizard的旅程是有帮助的。 +We have compiled a few resources that we think are helpful in your journey to becoming a Dune Wizard. -[FreecodeCamp.org](https://www.youtube.com/watch?v=qw--VYLpxG4) 视频教程列表 (免费) +[FreecodeCamp.org](https://www.youtube.com/watch?v=qw--VYLpxG4) Video Playlist (FREE) -[Amigoscode](https://www.youtube.com/watch?v=5hzZtqCNQKk) Youtube视频 (免费) +[Amigoscode](https://www.youtube.com/watch?v=5hzZtqCNQKk) Youtube Video (FREE) [UDEMY Course SQL & PostgreSQL for Beginners](https://www.udemy.com/course/sql-and-postgresql-for-beginners/?ranMID=39197\&ranEAID=JVFxdTr9V80\&ranSiteID=JVFxdTr9V80-nnMsdWXzWeu9lqxtbEa72g\&utm\_source=aff-campaign\&LSNPUBID=JVFxdTr9V80\&utm\_medium=udemyads) ($10) -[Mode SQL Tutorial](https://mode.com/sql-tutorial/) (免费) +[Mode SQL Tutorial](https://mode.com/sql-tutorial/) (FREE) diff --git a/about/tutorials/video-series.md b/about/tutorials/video-series.md index 11f511d..d5114e2 100644 --- a/about/tutorials/video-series.md +++ b/about/tutorials/video-series.md @@ -1,32 +1,34 @@ -# 视频教程系列 +# Video Series -我们在Youtube上制作了一系列的视频教程 [Youtube频道](https://www.youtube.com/channel/UCPrm9d2hLd\_YxSExH7oRyAg). +We have produced a video tutorial series on our [Youtube Channel](https://www.youtube.com/channel/UCPrm9d2hLd\_YxSExH7oRyAg). -## Dune 5分钟入门 +## Dune Analytics 5 Minute Intro + +This Video is the quickest and best way to get an introduction to Dune, be sure to check it out. -这个视频是了解Dune的最快速和最好的方法,一定要看一看。 {% embed url="https://www.youtube.com/watch?v=S-cctFmR828" %} -## 课程介绍 +## Intro to the Course + +This Video serves as an overview and intro to the whole course. -本视频是对整个课程的概述和介绍。 {% embed url="https://youtu.be/USTIesVPk68" %} -## 第1集: 案例和应用 +## Episode 1: Usecases and Applications -本视频解释了Dune的基础知识和它可以用来做什么。 +This Video explains the basics of Dune and what it can be used for. {% embed url="https://www.youtube.com/watch?v=IHC8HAZvw_Q" %} -## 第2集: 数据库 +## Episode 2: The database -本视频介绍了Dune中的数据表以及数据库的工作方式。 +This Video goes over the Data tables in Dune and how the database works. {% embed url="https://youtu.be/UDu23Eyvo_Y" %} -## 第3集: 简单query实例以及重建Fees.wtf查询 +## Episode 3.1: Simple Queries and recreating Fees.wtf in Dune -这个视频是对Dune内部查询的一个很好的介绍。我们的社区经理Boxer在Dune中重新创建了Fees.wtf,所以视频主要集中在gas交易方面。 +This Video is a great introduction to querying inside of Dune. Our Community Manager Boxer recreates Fees.wtf inside of Dune, so the Video mostly focuses on gas transactions. {% embed url="https://youtu.be/ez3VfcfNwvc" %} diff --git a/about/usecases/README.md b/about/usecases/README.md index e01661f..e3afc81 100644 --- a/about/usecases/README.md +++ b/about/usecases/README.md @@ -1,19 +1,18 @@ --- -说明: >- - 利用Dune来为你个人,你的项目,你的机构提供洞见。 - +description: >- + Leverage Dune to generate Insights for yourself, your project or your + organisation. --- -# 使用案例 - -## Dune是一个开放平台 +# Use Cases -Dune是一个区块链数据的分析平台,它将链上数据变成用户可读的数据并免费提供给用户。用户可以使用PostgreSQL来查询链上的数据,同时可以创建多个查询组成的仪表盘来讲述故事。Dune上的查询(query)是公开的,任何人都可以查看和分叉(fork),但隐私查询(private query)是非公开的,该功能只对订阅专业计划(Pro Plan)的用户开放。 +## Dune is an open platform +Dune is a data analytics platform that surfaces blockchain data turns on chain data into human readable data available to users for free. Users can query on chain data using PostgreSQL and create dashboards that group queries together to tell a story. Queries on Dune are public goods and are available for anyone to view and fork with the exception of private queries, which are available to users who have the pro plan subscription. -## **Dune用途有哪些?** +## **What is Dune used for?** -在Dune上几乎所有的事情都是可能的,所以在链上数据的查询方面,它没有任何限制。但我们可以展示一些具体的使用案例: +Since pretty much everything is possible on Dune, there really aren't any limitations as to what you can query in regards to on-chain data. There still is some distinct Use Cases we can establish: {% content-ref url="sector-dashboards.md" %} [sector-dashboards.md](sector-dashboards.md) @@ -28,11 +27,14 @@ Dune是一个区块链数据的分析平台,它将链上数据变成用户可 {% endcontent-ref %} \ -Dune上的创作内容是哪些类型? +What type of content is generated on Dune? ------------------------------------------ -为了获得更多关于用户如何使用Dune的洞见,你可以关注我们的推特账户,我们会转发Dune上最有趣的创作内容。\ - \ -只要点击一下最近的几条推文,就可以看到用户在Dune上的最新作品了! +To get more insights into how people use Dune, you can follow our Twitter account where we retweet the most interesting things that happen on Dune.\ +\ +Just click through the last few tweets and see what people are up to on Dune currently! {% embed url="https://twitter.com/DuneAnalytics" %} + +\ +\\ diff --git a/about/usecases/ecosystem-dashboards.md b/about/usecases/ecosystem-dashboards.md index 2b18492..0ca7efc 100644 --- a/about/usecases/ecosystem-dashboards.md +++ b/about/usecases/ecosystem-dashboards.md @@ -1,22 +1,22 @@ -# 生态仪表盘 +# Ecosystem Dashboards -**Dune汇总了所有数据集,因此你也可以探索更多的一般性指标。** +**Since Dune has all the data in one place you can also check more general metrics.** -## 矿工费(Gas) +## Gas Prices [https://dune.xyz/kroeger0x/gas-prices](https://dune.xyz/kroeger0x/gas-prices) -你可以用Dune很容易地收集到每个tx的平均矿工费(gas)、矿工费上限、一个区块的总矿工费等数据。 +You can easily assemble the data on average gas spent per tx, gas limit, gas spent in total in a block etc. using Dune. ![](<../../.gitbook/assets/image (13) (2).png>) ![](<../../.gitbook/assets/image (21).png>) -花费的矿工费(gas)和类似指标的数据也可能与具体协议有关,请记住这一点。 +Data on gas spent and similar metrics can also be relevant to certain protocols, so do keep this in mind. -## **DeFi用户** +## **DeFi Adoption** -[Richard Chen](https://twitter.com/richardchen39) 整合了所有重要的DeFi协议的用户数量,并将它们纳入了一个仪表盘。 +[Richard Chen](https://twitter.com/richardchen39) has compiled the user numbers of all important DeFi Protocols and compiled them in one Dashboard. ![](<../../.gitbook/assets/image (22).png>) diff --git a/about/usecases/project-dashboards.md b/about/usecases/project-dashboards.md index 593998b..d328b04 100644 --- a/about/usecases/project-dashboards.md +++ b/about/usecases/project-dashboards.md @@ -2,25 +2,25 @@ description: Project Dashboards are a great way to track the metrics of your project. --- -# 项目仪表盘 +# Project Dashboards -**项目仪表盘使你能够轻松地将你最喜欢的项目的数据汇集到一起。**\ -**没有基础设施需要维护,你可以简单地查询你想要的数据并将其聚合在仪表盘上,为你的项目提供一个现实的数据中心。** +**Project Dashboard allow you to easily assemble data on your favorite project in one place.**\ +**Without having to maintain infrastructure or overhead, you can simply query for the data you desire and assemble it on a Dashboard to make a Datahub for your project Reality.** -**让我们通过一个例子来探索:** +**Let's explore this with an example:** \*\*\*\*[**https://dune.xyz/poma/tornado-cash\_1**](https://dune.xyz/poma/tornado-cash\_1)\*\*\*\* -这是Tornado Cash的仪表盘,有创作者将所有重要的指标集合在了一个地方。 +This is the dashboard from Tornado Cash on which someone assembled all the important metrics in one place. ![](<../../.gitbook/assets/image (18).png>) -我们可以看到,创作者向我们展示了一些一目了然的计数器,用简单的数字告诉我们最重要的信息。 +We can see that the creator is showing us a few "on a glance" counters which tell us the most important information in simple numbers. ![](<../../.gitbook/assets/image (18) (1).png>) -接着他用一些有趣的历史数据,显示了用户和体量的增长。这只是仪表盘的一部分,但从中你可以清楚地看到这些统计数字和图表可以为你的项目带来多大的价值。 +He follows this up with some interesting historical data points which show the growth in users and volume. The Dashboard continues, but you can clearly already see how much value these stats and charts can produce for your project. -拥有所有这些统计数据,将十分有助于你的项目管理并帮助它获得成功。 +Having all these stats in one place greatly helps to manage your project and help it succeed. -你可以在我们的网站上找到许多其他更强大的仪表盘:[Projects Page](https://dune.xyz/projects). +You can find many other great dashboard on our [Projects Page](https://dune.xyz/projects). diff --git a/about/usecases/sector-dashboards.md b/about/usecases/sector-dashboards.md index 8fafb2f..b2e2610 100644 --- a/about/usecases/sector-dashboards.md +++ b/about/usecases/sector-dashboards.md @@ -1,18 +1,18 @@ -# 细分仪表盘 +# Sector Dashboards -**细分仪表盘让你可以一览细分的新兴领域,并实时分析正在发生的事情。** +**Sector Dashboards allow you to glance at an entire sector of our new Economy and analyse what's happening in real time.** -让我们通过一些例子来探讨这个问题: +Let's explore this with some examples: -## Dex指标 +## Dex Metrics [**https://dune.xyz/hagaetc/dex-metrics**](https://dune.xyz/hagaetc/dex-metrics) -这个仪表盘让你可以一次看清整个去中心化交易所的情况。 +This Dashboard allows you to take a look at the entirety of decentralized exchanges at once. -你可以看到Dex交易量、市场份额、所有交易所的总交易量以及更多的统计数据,一目了然。这让你可以比较不同交易所之间的表现,同时评估整个细分领域的表现。 +You can see Dex Volume, Market share, Total Volume across all exchanges and many more stats all on one glance. This allows you to compare the performance of different dexes with each other and at the same time evaluate the performance of the entire sector. -所有这些都是实时更新的,并由社区维护,如果一个新的dex想出现在这个仪表盘上,他们所要做的就是提交他们的代码到我们的公开github。更多内容见[抽象表](../../data-tables/data-tables/abstractions.md). +All of this updates in real time and is maintained by the community, if a new dex wants to be on this dashboard, all they have to do is submit their code to our public github. More on this in [abstractions](../../data-tables/data-tables/abstractions.md). ![](<../../.gitbook/assets/image (7).png>) @@ -20,29 +20,30 @@ ![](<../../.gitbook/assets/image (9).png>) -## 指数 +## Indices [**https://dune.xyz/0xBoxer/indices-products**](https://dune.xyz/0xBoxer/indices-products) -另一个有趣的仪表盘是关于去中心化指数的仪表盘。 +Another interesting Dashboard we have is a dashboard on decentralized indices. + +Here again, you can evaluate the entire state of a sector in one glance, being able to compare different products and projects to each other with ease. -在这里,你也可以一目了然地评估一个细分领域的整体状况,能够轻松地将不同的产品和项目相互比较 ![](<../../.gitbook/assets/image (10).png>) ![](<../../.gitbook/assets/image (11).png>) ![](<../../.gitbook/assets/image (12).png>) -## 借贷 +## Lending -这同样适用于借贷协议,它让你你轻松地了解借贷协议的状况并相互比较。 +The same applies for lending protocols, it allows you to easily check the state of lending protocols and compare them to each other with ease. ![](<../../.gitbook/assets/image (13).png>) ![](<../../.gitbook/assets/image (14).png>) -## 总结 +## Summary -细分仪表盘允许你的关注者对某一新兴领域的整个情况做出假设。这对于比较不同的产品和试图发现趋势是非常有用的。 +Sector Dashboards allow your audience to make assumptions on a whole sector of this nascent Industry. This is very useful for comparing different products with each other and trying to spot trends. -大多数细分仪表盘都依赖于一个或许多[抽象表)](.../.../data-tables/data-tables/abstractions.md)表,这使得它很容易查询大量的数据并在不同的协议之间实现标准化。 +Most Sector Dashboards are relying on one or many [abstraction](../../data-tables/data-tables/abstractions.md) tables which make it easy to query for vast amounts of data and standardizing between the different protocols. diff --git a/bounties/wizard-request-program.md b/bounties/wizard-request-program.md index f89f5c1..dd09cc6 100644 --- a/bounties/wizard-request-program.md +++ b/bounties/wizard-request-program.md @@ -1,45 +1,36 @@ -# Wizard需求计划 +# Wizard Request Program -#### 对于想寻找Wizards的项目方 +#### For projects looking for Wizards -如果你是一个想要在Dune上拥有更多或者更好仪表盘的项目方,我们已经为你提供了一个途径。以下是它如何工作的说明: +If you're a project looking to have more/better dashboards on Dune, we've created this program for you. This is how it works: -1. 项目方填写这个[表格](https://bounties.dune.xyz)去详细阐明他们的全部内容以及他们想要在Dune上看到的insights类型以及他们愿意为此支付的金额。 +1. Project fills out [this form](https://bounties.dune.xyz) explaining what they're all about and the kind of insights they'd like to see surfaced on Dune and how much they're willing to pay for it.\\ +2. We share this with our community and interested wizards get in touch with you.\\ +3. Project screens wizards and chooses who to work with.\\ +4. The data flows. +As opposed to more traditional bounty programs, the Wizard Request program is meant to unlock long-lasting relationships/collaborations between the analysts and the projects at large. -2. 我们将与社区分享,感兴趣的wizards会与你联系。 +#### For Wizards looking for :moneybag::moneybag::moneybag: -3. 项目方筛选以及选择跟谁合作。 +If you are a wizard looking for bounties, make sure to join [our Discord](https://discord.gg/ErrzwBz), go to our “freelancer-listing” channel and click on the flying dollar bill emoji there. Also follow the [bounty bot](https://twitter.com/Dune\_Bounties) on Twitter. -4. 数据就流动了起来。 +**FAQs about the program** -与更传统的赏金计划相反,Wizard需求计划旨在搭建分析师与项目方之间的长期关系/合作。 - - - -#### 对于想寻找:moneybag::moneybag::moneybag:的Wizards - -如果你是寻找赏金的wizard,请务必加入[我们的 Discord](https://discord.gg/ErrzwBz),进入我们的“自由职业者列表”频道,然后单击那里美元钞票的表情符号。 你还可以在推特上关注。[赏金机器人](https://twitter.com/Dune\_Bounties) 。 - - - -**关于项目的FAQs** - -_-我需要大量的数据分析,那么应该发布多少需求??_ - -将每个需求都当作一个仪表盘。如果你想在一个仪表盘中查看所有信息,那么只需一个需求。另一方面,如果你希望看到三个不同的仪表盘,我们建议你创建三个需求。创建三个需求并不一定意味着与三个不同的分析师合作,这取决于你的想法。 +_- I need a lot of data, how many requests should I post?_ +Think of every request as a dashboard. If you’d like to see all of your information in just one dashboard, then just one request. If, on the other hand, you’d like to see three different dashboards we recommend you create three requests. Creating three requests doesn’t necessarily mean working with three different analysts, that will be up to you to decide. \ -_- 我是一名分析师。我该如何报名?_ +_- I’m an analyst. How do I enroll?_ -目前,你唯一需要做的就是加入[我们的Discord](https://discord.gg/dunecom),进入我们的“自由职业者列表”频道,然后单击那里美元钞票的表情符号,这样你就会在新请求到达时收到通知。你还应该关注 Twitter 上[的赏金机器人](https://twitter.com/Dune_Bounties) 。 -\ -_- 我想创建一个需求,但我不知道我应该为此支付/报价多少金额_ +For the moment the only thing you need to do is join [our Discord](https://discord.gg/dunecom), go to our “freelancer-listing” channel and click on the flying dollar bill emoji there, this way you’ll get notified when new requests arrive. Oh and you should definitely follow the [bounty bot](https://twitter.com/Dune\_Bounties) on Twitter. -嗯,这实际上取决于你的需求的工作量和复杂性程度,但在你可接受的范围内,我们鼓励你尽可能慷慨。如果不确定,你可以随时在我们的 Discord 上提问! +\ +_- I want to create a requests but I don’t know how much should I pay/offer for it_ -_- Dune会抽成吗??_ +Well, that really depends on how much work/complexity your request entails but to the extent that you can, we encourage you to be generous. If you ain’t sure you can always ask on our Discord! -我们不会。 事实上,Dune 不参与完成交易的过程或后续跟进,这完全是在wizard和项目之间的事情。 +_- Does Dune take a cut?_ +No we don’t. In fact, Dune does not take part in closing the deal or following up over time, this is strictly between the wizard and the project. diff --git a/changelog/dune-changes/august-2020.md b/changelog/dune-changes/august-2020.md index 6fd8079..b698c9f 100644 --- a/changelog/dune-changes/august-2020.md +++ b/changelog/dune-changes/august-2020.md @@ -2,13 +2,13 @@ -#### 价格数据源切换 -我们已将价格数据源从 Coincap 更改为 Coinpaprika,以及现在在 prices.usd 和 prices.layer1_usd 表中拥有 230 多种资产的价格! 有一点需要注意的是,以前我们有截至当前时间的所有分钟的价格,但我们现在有截至当前时间前 5 分钟的价格。 +#### Price Provider Switch -**新表prices.layer1_usd** +We’ve changed price providers from Coincap to Coinpaprika, and in turn now have prices for 230+ assets in the `prices.usd` and `prices.layer1_usd` tables! A slight caveat is that while previously we had prices for all minutes up to current time, we now have prices up to 5 minutes before current time. -我们已将所有非以太坊代币的资产移至它们的表 prices.layer1_usd。 该表按symbol分区并具有 `(symbol, minute)` +**New table prices.layer1\_usd** +We’ve moved all assets that are not tokens on Ethereum to their own table `prices.layer1_usd`. This table is partitioned on `symbol` and has `(symbol, minute)` as primary key as before. ``` Column │ Type @@ -18,20 +18,17 @@ symbol │ text ``` -#### prices schema的变化 +#### Changes to prices schema -**price.usd表新增新列decimals** +**New column decimals on prices.usd** -我们在`prices.usd`中添加了一个新的列`decimals`,这样你就可以避免与 erc20.tokens 进行额外关联来计算正确的交易量。 +We’ve added a new column `decimals` to `prices.usd` so that you can avoid the additional join with `erc20.tokens` for calculating correct volumes. +**New primary key for prices.usd** +Previously `prices.usd` was partitioned on the token `symbol`, and it’s primary key was `(symbol, minute)`. In this release we’ve made a change to this scheme to allow for multiple `contract_address`es to map to the same `symbol`. This could happen e.g. in times where a token migration is happening. `prices.usd` is now partitioned on `contract_address` and it’s primary key is `(contract_address, minute)`. -**New price.usd 的新主键** - -以前`prices.usd` 是根据代币`symbol`进行分区的 , 它的主键是 `(symbol, minute)`。在此版本中,我们对此方案进行了更改,以允许多个`contract_address`映射到同一个`symbol`。在某些场景下它会发挥作用例如在Token合约发生迁移的时候。`prices.usd`现在在`contract_address`上进行了分区,它的主键是`(contract_address, minute)`。 - -请注意,执行包含 `SELECT minute, price FROM prices.usd WHERE symbol='x'`的查询时可能会产生一些奇怪的结果。因为在某些情况下时间窗口中有两个contract映射到symbol `x`,然后你可能每分钟下会关联多多条数据。 这种情况下最好使用主键`contract_address` - +Note that this might yield some weird results for queries that rely on doing `SELECT minute, price FROM prices.usd WHERE symbol='x'` in certain cases where there are two contracts mapped to the symbol `x` in a time window. You may then receive several rows per minute. It is better to then use the primary key `contract_address` for filtering and joining. ``` Column │ Type diff --git a/changelog/dune-changes/january-2020.md b/changelog/dune-changes/january-2020.md index a749068..fd62f32 100644 --- a/changelog/dune-changes/january-2020.md +++ b/changelog/dune-changes/january-2020.md @@ -1,14 +1,12 @@ # January 2020 ## Postgres 12.1 -我们已将数据库从 postgres 11 升级到 postgres 12.1。这应该会使性能得到全面的改进。 +We’ve upgraded the database from postgres 11 to postgres 12.1. This should result in performance improvements across the board. +## ERC20 Transfer and Approval tables -##ERC20 转移和授权表 - -你现在可以查询`erc20."ERC20_evt_Transfer"`和`erc20."ERC20_evt_Approval"`表以获取解码的Token转移和授权表。这些表回包括可以使用 ERC20 标准的 ABI 解码的所有事件。这意味着所有代币的所有转账都可以通过这张表查询。该表很大(撰写本文时为240M行),因此请告诉我们你对查询性能的体验。 - +You can now query the `erc20."ERC20_evt_Transfer"` and `erc20."ERC20_evt_Approval"` tables to get decoded token transfers and approvals. These tables should include all events that could be decoded using the ABI of the ERC20 standard. This means that all transfers from all tokens can be queried through this table. The table is large (240M rows at time of writing), so please let us know your experience of the query performance. `erc20."ERC20_evt_Transfer"` schema: @@ -32,8 +30,7 @@ | `evt_tx_hash` | `bytea` | | `evt_index` | `bigint` | -这里的`contract_address`是指发出事件的合约,即代币地址,`evt_tx_hash`和`evt_index`可以方便地让你使用类似的查询关联`ethereum.logs`。 - +Here `contract_address` refers to the contract emmitting the event, i.e. the token address, while `evt_tx_hash` and `evt_index` conveniently lets you join with `ethereum.logs` using a query like ``` SELECT * @@ -43,7 +40,7 @@ ON apps.evt_tx_hash = logs.tx_hash AND apps.evt_index = logs.index LIMIT 100; ``` -另请注意,你可以将这些表与`erc20.tokens`连接起来,以获得人类可读的Token符号和小数位数,如 +Also note that you can join these tables with `erc20.tokens` to get human readable token symbols and the number of decimals like ``` SELECT value/10^decimals, tr.* @@ -54,9 +51,11 @@ WHERE symbol = 'MKR' LIMIT 10 ``` -**例子** +Note though that -**Token头部持有者** +**Examples** + +**Top token holders** ``` WITH transfers AS ( @@ -81,7 +80,7 @@ ORDER BY 2 desc LIMIT 10 ``` -**Token余额** +**Token Balances** ``` WITH transfers AS ( @@ -105,18 +104,13 @@ GROUP BY 1 ORDER BY 2 desc; ``` -## 反向解码 - -上面的表格是使用我们称为“反向解码”的新功能生成的。本质上,它能拆解为为能够被解码的日志,而无所谓事件的合约地址或合约字节码。如果你知道此解码可能有用的其他情况,请随时通过 [hello@dune.xyz](mailto:hello@dune.xyz)告诉我们 - -## 其他 - -* 现在可以分别在`gnosis_sight`、`gnosis_safe` 和`gnosis_dfusion`模式中找到 Gnosis vision、safe 和 dfusion 的数据。 -* Synthetix 代币合约现在有了正确的名称`Synthetix`并且可以在`synthetix`模式中找到 -* `prices.usd_dai`已重命名为`prices.usd_sai`,Symbol更改为 SAI - 不幸的是,我们仍然没有 DAI 价格,因为我们的价格提供者没有提供。 -* `prices.usd_rep`现在为迁移后的条目提供了正确的`REP`Token地址。以前所有条目都有旧地址。 - - +## Fallback decoding +The above tables are generated with a new feature we call “fallback decoding”. Essentially it breaks down to being able to decode logs regardless of the events contract address or contract bytecode. If you know other cases where this decoding can be useful feel free to let us know at [hello@dune.xyz](mailto:hello@dune.xyz) +## Misc +* Data for Gnosis sight, safe and dfusion can now be found in `gnosis_sight`, `gnosis_safe` and `gnosis_dfusion` schemas respectively. +* Synthetix token-contracts now have the correct name `Synthetix` and are found in the `synthetix` schema +* `prices.usd_dai` have been renamed to `prices.usd_sai`, and the symbol changed to `SAI` - we still don’t have `DAI` prices unfortunately, as our price provider has not listed it. +* `prices.usd_rep` now has the correct token address for `REP` for entries after the migration. Previsouly all entries had the old address. diff --git a/changelog/dune-changes/march-2020.md b/changelog/dune-changes/march-2020.md index 8384271..95ad1a8 100644 --- a/changelog/dune-changes/march-2020.md +++ b/changelog/dune-changes/march-2020.md @@ -2,13 +2,13 @@ -本月在数据方面有较大的更新。 +Big release on the data front this month. -#### `block_time`以及`block_number`的的非规范化 +#### Denormalization of `block_time` and `block_number` -我们为所有解码的事件和调用添加了 `block_time`和`block_number`,分别命名为 `evt_block_time`, `evt_block_number` 和`call_block_time`, `call_block_number` 这将消除平台上最痛苦的关联查询,关联`ethereum.transactions`以便在你的查询中获得时间维度。 +We’ve added `block_time` and `block_number` to all decoded events and calls, with names `evt_block_time`, `evt_block_number` and `call_block_time`, `call_block_number` respectively. This will eliminate the most painful joins on the platform, joining with `ethereum.transactions` in order to get a time dimension into your queries. -过去我们可能需要这样做 +Where previously would need to do ``` SELECT date_trunc('day', tx.block_time), count(*) @@ -17,7 +17,7 @@ INNER JOIN ethereum.transactions tx ON tp.evt_tx_hash = tx.hash GROUP BY 1; ``` -为了获得 Uniswap 上每日 `TokenPurchase`-events 的数量,你现在可以很简单地实现 +in order to get the number of daily `TokenPurchase`-events on Uniswap, you can now simply do ``` SELECT date_trunc('day', evt_block_time), count(*) @@ -25,11 +25,9 @@ FROM uniswap."Exchange_evt_TokenPurchase" GROUP BY 1; ``` -消除了令人痛苦以及消耗较大的join。通过使用`evt_block_number`或`call_block_number`,也可以在不涉及任何以太坊表的情况下完成两个解码表的连接。 +eliminating a painful and costly join. Joining across two decoded tables can also be done without involving any of the `ethereum`-tables by using `evt_block_number` or `call_block_number`. - - -####无参数解码事件 +#### Decoding events without parameters We’re also “decoding” events that are emitted without parameters. These events have their own tables, but only include Dune-added fields i.e.: @@ -41,10 +39,9 @@ We’re also “decoding” events that are emitted without parameters. These ev | `evt_block_time` | `timestamptz` | | `evt_block_number` | `bigint` | -#### 解码 Call Output +#### Decoding call outputs - -我们已将函数返回值添加到已解码的`call`table中。 每当一个有命名函数有一个返回值时,它将被解码为 `output_{{name}}`,当它没有命名时,它将被解码为`output_{{i}}`,其中 i 是一个从 0 开始的计数器。参考以下案例,计算调用 Compound CERC20 mint 函数的成功和错误代码: +We’ve added function return values to decoded `call` tables. Whenever a function has a named return value it will be decoded into `output_{{name}}`, and when it is not named it will be decoded into `output_{{i}}` where `i` is a counter that starts at 0. Consider the following case, counting success and error codes for calls to the Compound CERC20 `mint` function: ``` SELECT output_0, count(*) @@ -55,8 +52,7 @@ GROUP BY 1; #### traces.success -**TLDR**: 我们向 `ethereum.traces`添加了一个`success`字段,你可以使用它来确定确切的调用是否成功。 对例如有用 计算余额。 这是一个例子: - +**TLDR**: we’ve added a `success` field to `ethereum.traces` that you can use to figure out if an exact call was successful. Useful for e.g. calculating balances. Here’s an example: ``` SELECT sum(amount) @@ -82,13 +78,9 @@ FROM ( ; ``` -**更长的故事**: Dune 从 Parity OpenEthereum 提取交易traces。 OpenEthereum 返回一个的函数的call traces(树状数据结构),其中一些可能会有非空`error`字段。以前我们或多或少地提取过traces,今天我们在 ethereum.traces 中添加了一个`success`字段。如果在traces层次结构中有非空`error`字段但是它上面没有traces,则它的success字段为true。 - - - -我们注意到,如果父级tracese-entry有一个非空`error`字段,则子call用在 EVM 中也被视为失败。以前在 Dune 中为了正确评估给定函数调用的状态更改是否包含在区块链中,你需要编写一个稍微复杂的查询来检查跟踪树的同一分支中的任何traces 是否有错误.随着今天success字段的加入,这变得容易多了。 - +**Longer Story**: Dune ingests transaction traces from Parity OpenEthereum. OpenEthereum returns a tree-like datastructure of function call traces, where some can have a non-null `error` field. Where previously we ingested the traces more or less _as is_, today we’ve added a `success` field to `ethereum.traces`. This `success` field is `true` for a given trace if no trace above it in the trace hierarchy has a non-null `error` field. +It came to our attention that if a _parent_ trace-entry has a non-null `error` field, the _child_ call is considered failed in the EVM as well. Previously in Dune, in order to correctly assess whether or not a given function call’s state change was included in the blockchain you would’ve needed to write a slightly complex query to check if any traces in the same branch of the trace tree had an error. With the addition of the `success` field today, this has become much easier. Note that the field `tx_success` field denotes the success of the transaction as a whole, and that a `true` `tx_success`-field, does not necessarily mean that every function call in the transaction has a `true` `success` field. Here are the potential combinations @@ -98,18 +90,17 @@ Note that the field `tx_success` field denotes the success of the transaction as | `true` | `false` | | `false` | `false` | -正如你所看到的,一个成功的transaction中的一个call也可能是失败的,但在一个失败的的transaction中call都会是失败的..... - -另请注意,以前解码表上的字段 `call_success`计算为`traces.tx_success && !traces.error`,现在直接从`traces.success`复制 +As you can see a call can be _not successful_ in a _successful_ transaction, but can not be _successful_ in a _not successful_ transaction… +Also note that where previously the field `call_success` on decoded tables where calculated as `traces.tx_success && !traces.error`, it is now directly copied from `traces.success`. #### Postgresql 12.2 -将数据库升级到 postgresql 12.2。 更改日志在[这里](https://www.postgresql.org/docs/current/release-12-2.html)。 +Upgraded the databases to postgresql 12.2. Changelog [here](https://www.postgresql.org/docs/current/release-12-2.html). -#### 其他 +#### Misc -重命名了一些curvefi-contracts: +Renamed some curvefi-contracts: | schema | name | Address | | ------- | ------------ | ------------------------------------------ | @@ -120,7 +111,7 @@ Note that the field `tx_success` field denotes the success of the transaction as | curvefi | busd | 0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27 | | curvefi | compound\_v3 | 0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56 | -将onesplit的的contracts移动到它们自己的schema下. +Moved onesplit contracts to their own schema. | schema | name | address | | -------- | -------- | ------------------------------------------------------ | diff --git a/changelog/dune-changes/march-2021.md b/changelog/dune-changes/march-2021.md index 52dc1a4..12a7001 100644 --- a/changelog/dune-changes/march-2021.md +++ b/changelog/dune-changes/march-2021.md @@ -4,70 +4,68 @@ description: Dune Analytics version 2.0 # March 2021 -## 更新概览 +## Overview of changes -* 查询 - * 保存 - * 执行 -* 刷新 -* 其他各种更新 +* Queries + * Saving + * Running +* Refreshing +* Various other upgrades -新版本的Dune无论是前端上还是底层都对查询和刷新方式做了调整。 +While all the core functionality you expect from Dune is available in Dune v2 the new version of Dune brings changes to how queries and refreshing work, both on the surface and under the hood. +## Queries -## 查询 +**Saving** -**保存** +By default, **new queries are not saved** to your queries so you can play around and test various ideas quickly. If you want to keep your work, remember to hit the **Save button** and give your query a name. -默认情况下**新查询不会保存**因此你可以快速尝试以及测试各种想法。如果你想保留你的工作成果,请记住点击 **“保存”按钮**并为你的查询命名。 +This means that if you navigate away from a page without saving, your work is lost. If you allow notifications from [dune.xyz](http://dune.xyz/) in your browser, the app will notify you when you navigate away from unsaved content. -这意味着,如果你在没有保存的情况下离开页面,你的工作成果就会丢失。如果你在浏览器中允许来自[dune.xyz](http://dune.xyz/) 的通知,当你离开未保存的内容时,该应用程序会通知你。 +The same applies to forks. A fork is not saved to your queries before you click the **Save button** and give your fork a name. -这同样适用于forks。在你单击 **保存按钮**以及为你的 fork 命名之前,不会将 fork 保存到你的查询中。 +**Running** +We’ve merged the old save and execute buttons into a single button, **Run**. When you click **Run** on a saved query, any changes you’ve made to the query text is saved and the query is queued for execution. -**执行** -我们将旧的保存和执行按钮合并为一个按钮,**Run**。当你在已保存的查询上单击**Run**时,你对查询文本所做的任何更改都会被保存,并且查询会排队等待执行。 +> _**Useful tip:**_ Press `CMD / CTRL + Enter` to run your query. +**Running query snippets** -> _**有用的tip:**_ 按住 `CMD / CTRL + Enter`可以快速运行你的查询. +If you mark parts of your query, the button changes to **Run selection**, and executes the part of the query that you’ve marked. This will updates the results and visualizations in the process but _**not save**_ the query. -**运行查询部分片段** -如果你标记查询的一部分,按钮将变为**Run selection**,并执行你标记的查询部分。这将更新项目中中的结果和可视化,但**不保存**查询。 +> _**Useful tip:**_ if you want to execute the whole query without saving it, select all of the query (CMD / CTRL + A) and then hit **Run selection**. +## Refreshing +There’s also changes to how results are refreshed. Over the last months we’ve been redesigning our entire query execution backend to bring large improvements to how Dune works. -> _**有用的tip:**_ 如果你想执行整个查询而**不保存**它,选择所有查询(CMD / CTRL + A)然后点击**Run selection** +When a visualization is viewed, either on a query page or on a dashboard, the Dune backend will inspect the age of the most recent result. If the result is stale (currently defined as >3 hours old), Dune will automatically queue an execution for this query and run it in the background. -## 刷新 -结果的刷新方式也发生了变化。 在过去的几个月里,我们一直在重新设计整个查询执行后端,以极大地改进 Dune 。 +This means that your dashboards will always be kept up to date when they are being viewed. -当在查询页面或仪表盘上查看可视化时,Dune 后端将检查最新结果的年龄。 如果结果过时(当前定义为 >3 小时前),Dune 将自动排队执行此查询并在后台运行它。 +Query creators does not need to set a refresh scheduele and the scheduling feature has been deprecated as it is no longer needed to keep results fresh. -这意味着你的仪表盘在查看时将始终保持最新状态。 +## Queues -查询创建者不需要设置刷新计划,并且计划功能已被弃用,因为它不再需要一直去刷新结果。 +We’re also bringing changes to how queueing works in Dune. When you manually click **Run** on a query an execution is queued. Every user on Dune can queue 3 queries at the same time (pro users have more, see our [pricing](https://hackmd.io/YOP3YIgaRAejTPE190sOjw?view) page for more info). -## 队列 +Automatically refreshed results (as we talked about above) does not use the query creators queuing credits nor the viewing user’s. -我们还对Dune中的排队方式进行了调整。 当你在查询里手动单击**Run**按钮时,一个查询会进入队列。Dune 上的每个用户都可以同时排队3个查询(专业用户有更多,请参阅我们的[定价](https://hackmd.io/YOP3YIgaRAejTPE190sOjw?view) 页面了解更多信息) +## Other updates -## 其他更新 +**A faster and better looking Dune** - the whole Dune app including all the charts have gotten a big facelift. The app is now also many times faster. -**一个更快、更好看的Dune** -包括所有图表在内的整个Dune应用程序都进行了重大改造。这个应用比之前快了很多倍。 +**Query parameters** - what is probably Dune’s most underrated feature has gotten a major upgrade. It’s now super easy to filter any query or dashboard for a token, address or anything really. Meaning you can turn your queries and dashboards into interactive apps for onchain data. -**查询参数** -这个可能是 Dune 最被低估的功能已经得到了重大升级。现在通过Token、地址或任何东西筛选任何查询或仪表盘都非常容易。这意味着你可以将查询和仪表盘变成用于链上数据的交互式应用程序。 +**See all content without having to log in** - simply copy and share the link from the page you are on. The exception is for paid users that make their content private, more details on our [pricing page](https://hackmd.io/YOP3YIgaRAejTPE190sOjw?view). +**Errors show on the relevant line** - when running your queries you will see error messages directly on the relevant line in your code. -**无需登录即可查看所有内容** - 只需复制并分享你所在页面的链接即可。将内容设为私有的付费用户除外,详情请参阅我们的[定价](https://hackmd.io/YOP3YIgaRAejTPE190sOjw?view) 页面。 - -**错误显示在相关行** -运行查询时,你将直接在代码的相关行上看到错误消息。 - -**单击查询标题以从仪表盘进行查询** - -我们很乐意在[Discord](https://discord.com/invite/ErrzwBz)的#feedback 频道中获得你对 Dune v2 体验的反馈。如果你遇到任何问题,也可以联系 [support@dune.xyz](mailto:support@dune.xyz)。 +**Click query title to go to query from a dashboard** +We’d love to get your feedback on your experience with Dune v2 in the #feedback channel in our [Discord](https://discord.com/invite/ErrzwBz). You can also contact [support@dune.xyz](mailto:support@dune.xyz) if you face any issues. Happy querying! -**PS.** Dune v2 目前不支持一些可视化类型:数据透视、队列、漏斗、热图和气泡。我们已向受影响的用户发送电子邮件。如果你没有收到电子邮件,你的所有查询和可视化应该在 v2 中正常运行。 +**PS.** There are a few visualisation types that are currently not supported in Dune v2: pivot, cohort, funnel, heatmap and bubble. We’ve emailed the users that are affected. If you have not been emailed all your queries and visualisations should work seamlessly in v2. diff --git a/changelog/dune-changes/october-2019.md b/changelog/dune-changes/october-2019.md index 5e288b1..6387652 100644 --- a/changelog/dune-changes/october-2019.md +++ b/changelog/dune-changes/october-2019.md @@ -1,12 +1,12 @@ # October 2019 -#### 新的数据结构 +#### New data structure -如果你要分叉旧查询,则需要注意这些变化,你可以用新的替换旧的表和列名。 +If you are forking old queries you need to be aware of these changes to you can replace old table and column names with new ones. +#### USD price tables -#### USD价格表 -以前美元价格表被命名为`coincap."tokens/usd"`现在改为`prices.usd`。 +Previously the usd price table was named `coincap."tokens/usd"` this is now changed to `prices.usd` with the fields ``` symbol -- unchanged @@ -15,9 +15,6 @@ price -- previously "average" minute -- previously "time" ``` -#### Dune生成的列 +#### Dune generated columns We add some data fields to all decoded tables for `calls` and `events`. These are now named `evt_index, evt_tx_hash, contract_address`. Previously these were simplt named `index, tx_hash, address` but we wanted to make it clear that these are added by Dune and not extracted directly from the blockchain. - -我们为`calls`和`events`的所有解码表添加了一些数据字段。 这些现在被命名为 `evt_index, evt_tx_hash, contract_address`。以前这些是简单命名的index、tx_hash、address,但我们想明确指出,这些是由 Dune 添加的,而不是直接从区块链中提取的。 - diff --git a/data-tables/data-tables/README.md b/data-tables/data-tables/README.md index 4a47994..dba9768 100644 --- a/data-tables/data-tables/README.md +++ b/data-tables/data-tables/README.md @@ -1,51 +1,52 @@ --- -说明: 数据表是 Dune 工作的基础 +description: Data Tables are what makes Dune work. --- -# 数据表 +# Data tables {% embed url="https://www.youtube.com/watch?v=UDu23Eyvo_Y" %} -这个视频涵盖了有关数据表的所有重要主题。 +This video covers all important topics around data tables. -## Dune 的表结构 +## Dune's Table Structure -Dune 将区块链数据聚合到一个可访问的 PostgreSQL 数据库中。可以通过以下方式理解模式: +Dune aggregates blockchain data into an accessilbe PostgreSQL database. The schema can be understood in the following way: -1\) 底层数据(原始交易数据)提供区块链上所有活动的详细记录。 +1\) Low-level data (raw transaction data) provides detailed records of all activities on the blockchain -2\) 解码数据表使用相应智能合约的应用程序二进制接口将编码数据转换为解码数据。你可以通过我们的 [网站] (https://dune.com/contracts/new) 的这一部分向我们发出信号,表明你需要某个智能合约的解码数据。在”[添加新合约](../../duneapp/adding-new-contracts.md)”中阅读有关合约提交的更多信息。 +2\) Decoded Data tables use the Application binary interface of the respective smart contract to turn the encoded data into decoded data. \ +You can signal to us that you need decoded data for a smart contract via this part of our [website](https://dune.xyz/contracts/new). Read more about contract submission in "[Adding new contracts](../../duneapp/adding-new-contracts.md)" -3\) 抽象表(Abstractions)是返回有关分类/主题的聚合/标准化数据的更高级别的生成表。生成这些表的脚本可在这个 [github 存储库](https://github.com/duneanalytics/abstractions) 中找到。 +3\) Abstractions are higher-level created tables that return aggregated/standarized data on sectors/topics. The scripts to generate these tables are available in this [github repository](https://github.com/duneanalytics/abstractions). -你目前可以从**Ethereum、Polygon**、**Binance Smart Chain**、**Optimism** 和 **Gnosis Chain** 区块链数据集查询数据。 +\ +You can currently query data from **Ethereum, Polygon, Binance Smart Chain, Optimism** and **Gnosis Chain**. -## 如何找到我需要的数据? +## How do I find the data I need? -本部分旨在指导你找到适合你项目的数据表。 +This section aims to guide you in the process of finding the right data tables to work on your project.\ +Different Use Cases of Dune require different data tables to pull data from, study these carefully and you'll recognize what significance each of the data table types has for your Queries and Dashboards. -Dune 的不同用例需要不同的数据表来提取数据,仔细研究这些数据表,你将认识到每种数据表类型对查询和仪表盘的重要性。 - -Dune 上的大多数表都是由 Dune 填充的,只是将区块链数据转换为 SQL 表,但对于 [抽象表](abstractions.md) 和 dune\_user\_generated 表,你实际上可以自己创建,并根据你的需要来聚合或修改数据集。 +Most of the tables on Dune are populated by Dune and are just a translation of the blockchain data to SQL tables, but in the case of [abstractions ](abstractions.md)and dune\_user\_generated tables you can actually create your own tables that aggregate or modify the dataset to your need. {% content-ref url="raw-data/" %} -[原始数据](raw-data/) +[raw-data](raw-data/) {% endcontent-ref %} {% content-ref url="decoded-data.md" %} -[已解码数据](decoded-data.md) +[decoded-data.md](decoded-data.md) {% endcontent-ref %} {% content-ref url="abstractions.md" %} -[抽象表数据](abstractions.md) +[abstractions.md](abstractions.md) {% endcontent-ref %} {% content-ref url="prices.md" %} -[价格数据](prices.md) +[prices.md](prices.md) {% endcontent-ref %} {% content-ref url="labels.md" %} -[标签数据](labels.md) +[labels.md](labels.md) {% endcontent-ref %} diff --git a/data-tables/data-tables/abstractions.md b/data-tables/data-tables/abstractions.md index e953d0f..c650359 100644 --- a/data-tables/data-tables/abstractions.md +++ b/data-tables/data-tables/abstractions.md @@ -1,48 +1,53 @@ --- -说明: >- - 我们构建了涵盖区块链上所有类型活动的自定义表格,从而使你能够轻松聚合大量数据并尽可能地减少的不便。 +description: >- + We construct customs tables which cover the entirety of a type of activity on + the blockchain and thereby enable you to effortlessly aggregate lots of data + with as little friction as possible. --- -# 抽象表(Abstractions) +# Abstractions -## 什么是抽象表? +## What are abstractions? -抽象表是由 Dune 团队和我们的社区维护的自定义表。它们允许你访问更复杂的 SQL 运算符,例如创建自己的表、在值中循环或其他更适合数据库管理员的操作。这有时对于聚合链上数据或简化数据查询过程是必要的。 +Abstractions are custom tables that are maintained by Team Dune and our community. They allow you to gain access to more complex SQL operators like creating your own tables, looping through values or other operations that are more catered towards database administrators. This sometimes is necessary to aggregate the on-chain data or simplify the process of querying for data. -这个公共的 [github 存储库](https://github.com/duneanalytics/abstractions) 承载构建表和视图的逻辑。 +This public [github repository](https://github.com/duneanalytics/abstractions) hosts the logic to construct the tables and views. -有哪些抽象表? +\ +Which abstractions are there? ----------------------------- -你可以在我们的 [公共 github 存储库](https://github.com/duneanalytics/abstractions) 中检查现有的抽象表。你通常可以将它们分为 2 个不同的类别。 +You can check for existing abstractions in our [public github repository](https://github.com/duneanalytics/abstractions). You can generally divide them into 2 distinct categories. -### 细分领域抽象表(Sector Abstractions) +### Sector Abstractions -细分领域抽象表是指 dex.trades、erc20.stablecoins、lending.borrow 等表。 +Sector Abstractions are tables like dex.trades, erc20.stablecoins, lending.borrow etc. -这些抽象表从多个合约和项目中获取数据,标准化它们之间的数据,因此可以很容易地查询这些数据并比较不同项目的指标。 +These abstractions take in data from multiple contracts and projects, standardize the data across them and therefore make it very easy to query for this data and compare the metrics of different projects with each other. -大多数 [细分领域](../../about/usecases/sector-dashboards.md) 仪表盘都依赖于细分领域抽象表。这引入了一个有趣的动态,项目可以通过向我们的公共 [github 存储库](https://github.com/duneanalytics/abstractions) 发出拉取请求轻松地将其数据放入这些仪表盘。 +Most of the [sector](../../about/usecases/sector-dashboards.md) Dashboards depend on sector abstractions. This introduces an interesting dynamic in which projects can easily get their data into these dashboards by making a pull request to our public [github repo](https://github.com/duneanalytics/abstractions).\ +\ +Team Dune and the community are always improving on these sector abstractions, all new additions to existing ones are always welcome. -Dune 团队和社区一直在改进这些细分领域抽象,我们总是欢迎对现有数据的所有新添加。 -### 项目抽象表(Project Abstractions) +### Project Abstractions -有时,将数据组装到一张整齐的表格中以让需要的所有数据集中在一起对某些项目很有用。为此,你可以在我们的抽象表中构造视图或表。 +Sometimes it can be useful for projects to assemble their data into one neat table that has all the data they need in one place. To do this, you can construct views or tables in our abstractions. -与仅构建视图相比,这里的主要优势是你可以在我们的抽象表中处理大量数据,因为我们可以每隔几个小时在后台自动运行它们。 +The main advantage here over just constructing a view is that you are able to deal with bigger amounts of data in our abstractions since we can run them automatically in the background every few hours. -### 查找抽象表(Lookup abstractions) +### Lookup abstractions -这类抽象表中最引人注目的是 `erc20.tokens` 抽象表,我们将代币映射到它们的小数和符号。其他还有 `erc20.stablecoins` 或 `compound.view_c_tokens` 等。 +The most noticeable mentions for this abstraction is the `erc20.tokens` abstraction in which we map tokens to their decimals and symbols. There also is `erc20.stablecoins` or `compound.view_c_tokens.` -## 贡献抽象表 +## Contributing to abstractions -一般来说,我们的抽象表对所有团队和项目开放,但我们保留拒绝请求的权利。 +Our abstractions are open to all teams and projects in general, but we do reserve the right to reject pull requests. -如果你确实选择为抽象表做出贡献,请确保你的添加确实有效并产生了预期的结果。此外,请给我们一个简短的摘要,说明你要实现的目标以及你的项目是做什么的。 +If you do choose to contribute to abstractions please make sure your addition actually works and produces the intended results. Furthermore please give us a short summary about what you are trying to achieve and what your project does. + +If applicable please construct a view in which you show us that your addition produces the intended results. -如果适用,请构建一个视图,通过它向我们展示你的添加达到了预期的结果。 diff --git a/data-tables/data-tables/community-data/README.md b/data-tables/data-tables/community-data/README.md index ca4a364..1870c94 100644 --- a/data-tables/data-tables/community-data/README.md +++ b/data-tables/data-tables/community-data/README.md @@ -1,7 +1,8 @@ --- -说明: >- - 本部分包含由第三方数据提供商提交并托管在 Dune 上的数据 +description: >- + This section contains data that has been submitted and hosted on Dune by 3rd + party data providers --- -# 第三方数据 +# Third Party Data diff --git a/data-tables/data-tables/community-data/flashbots.md b/data-tables/data-tables/community-data/flashbots.md index 0f97ac9..7a3d42f 100644 --- a/data-tables/data-tables/community-data/flashbots.md +++ b/data-tables/data-tables/community-data/flashbots.md @@ -1,119 +1,126 @@ --- -说明: >- - Flashbots 是一个研发组织,旨在确保 MEV 激励措施不会变得不透明和不民主。 +description: >- + Flashbots is a research and development organization formed with the goal of + making sure MEV incentives do not become opaque and undemocratic. --- # Flashbots -**注意:** mev-inspect-py 是 Flashbots 用于生成 MEV 数据的开源引擎,用于为 mev-explore 和 Dune 的 Flashbots 集成等仪表盘提供动力。在我们的社区和贡献者的帮助下,我们一直在寻求改进、修复错误、覆盖边缘情况并尽我们所能增加协议覆盖率。我们鼓励研究人员和开发人员报告并帮助纠正任何发现的错误,或实现任何新功能! 请随时查阅文档并加入 Flashbots discord,以获取有关我们的数据和 mev-inspect 的更多信息和更新。 +**Note:** mev-inspect-py, Flashbots’ open source engine for generating MEV data, is used to power dashboards such as mev-explore and Dune’s Flashbots integration. We’re always looking to improve, fix bugs, cover edge cases, and add protocol coverage to the best of our ability with the help of our community and contributors. We encourage researchers and developers to report and help correct any found bugs, or implement any new features! Feel free to consult the documentation and join the Flashbots discord for more information and updates on our data and mev-inspect -**文档:** [https://docs.flashbots.net/](https://docs.flashbots.net) +**Docs:** [https://docs.flashbots.net/](https://docs.flashbots.net) -**Discord:** [https://discord.gg/7hvTycdNcK](https://discord.gg/7hvTycdNcK) +**Discord:** [https://discord.gg/7hvTycdNcK](https://discord.gg/7hvTycdNcK) ## **flashbots.mev\_summary** -此表包含所有分类交易的摘要。 +This table contains summary of all the classified transactions -查询示例可在此处找到:[来自清算和套利的矿工收入](https://dune.com/queries/625974/1167301) +Query examples can be found here: [Miner Revenue from Liquidations and Arbitrages](https://dune.com/queries/625974/1167301) -| **列名** | **数据类型** | **说明** | +| **Column name** | **Type** | **Description** | | ------------------------------------ | --------- | ------------------------------------------------------ | -| block\_timestamp | timestamp | 区块时间戳 | -| block\_number | bigint | 区块编号 | -| base\_fee\_per\_gas | bigint | 每单位 gas 的基本费用 | -| coinbase\_transfer | bigint | 直接转账到矿工地址的费用 | -| error | string | 错误信息(如果存在) | -| gas\_price | bigint | gas 价格 | -| gas\_price\_with\_coinbase\_transfer | bigint | gas 价格+直接转账到矿工地址的费用 | -| gas\_used | bigint | 消耗的 gas 量 | -| gross\_profit\_usd | double | 以美元为单位的交易总利润 | -| miner\_address | string | 矿工地址 | -| miner\_payment\_usd | double | 矿工收到的美元付款 | -| protocol | string | 主要交互协议 | -| protocols | string | 交易中涉及的协议列表 | -| transaction\_hash | string | 交易哈希 | -| type | string | MEV的类型(例如arbitrage) | -| timestamp | timestamp | 文件最新更新的时间戳 | +| block\_timestamp | timestamp | Block timestamp | +| block\_number | bigint | Block number | +| base\_fee\_per\_gas | bigint | Base fee per gas | +| coinbase\_transfer | bigint | Direct transfer to miner’s address | +| error | string | Error if exists | +| gas\_price | bigint | Price of the gas | +| gas\_price\_with\_coinbase\_transfer | bigint | Amount of gas spent + direct transfer to miner address | +| gas\_used | bigint | Amount of gas used | +| gross\_profit\_usd | double | Total profit from the transaction in usd | +| miner\_address | string | Address of the miner | +| miner\_payment\_usd | double | Payment received by the miner in usd | +| protocol | string | Main interacted protocol | +| protocols | string | List of protocols involved in the transaction | +| transaction\_hash | string | Hash of the transaction | +| type | string | Type of the MEV (e.g. arbitrage) | +| timestamp | timestamp | Timestamp of the latest update of the file | ## **flashbots.arbitrages** -此表包含有关每笔套利交易的附加信息的记录。 +This table contains records with additional information about each arbitrage trade. -查询示例可在此处找到:[总套利协议](https://dune.com/queries/626076/1167481) +Query examples can be found here: [Total Arb Protocols](https://dune.com/queries/626076/1167481) -| **列名** | **数据类型** | **说明** | +| **Column name** | **Type** | **Description** | | ---------------------- | --------- | --------------------------------------------- | -| block\_number | bigint | 区块编号 | -| account\_address | string | 搜索者的地址 | -| created\_at | string | 记录创建时间 | -| end\_amount | bigint | 套利后可用金额 | -| error | string | 错误信息(如果存在) | -| id | string | 套利的内部id | -| profit\_amount | bigint | 套利后的利润额 | -| profit\_token\_address | string | 利润资产地址 | -| protocols | string | 交易中涉及的协议列表 | -| start\_amount | bigint | 套利前可用金额 | -| transaction\_hash | string | 交易哈希 | -| timestamp | timestamp | 文件最新更新的时间戳 | +| block\_number | bigint | Block number | +| account\_address | string | Address of the searcher | +| created\_at | string | Time of the record creation | +| end\_amount | bigint | Available amount after the arbitrage | +| error | string | Available amount after the arbitrage | +| id | string | Internal id of the arbitrage | +| profit\_amount | bigint | Profit amount after the arbitrage | +| profit\_token\_address | string | Address of the profit asset | +| protocols | string | List of protocols involved in the transaction | +| start\_amount | bigint | Available amount before the arbitrage | +| transaction\_hash | string | Hash of the transaction | +| timestamp | timestamp | Timestamp of the latest update of the file | ## **flashbots.liquidations** -清算是另一种 MEV 策略。此表包含与已执行清算相关的详细信息。 +Liquidation is another MEV strategy. This table contains details related to executed liquidations. -查询示例可以在这里找到:[协议清算](https://dune.com/queries/625715/1166880) +Query examples can be found here: [Liquidations by Protocol](https://dune.com/queries/625715/1166880) -| **列名** | **数据类型** | **说明** | +| **Column name** | **Type** | **Description** | | ------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------- | -| created\_at | string | 记录创建时间 | -| transaction\_hash | string | 交易哈希 | -| trace\_address | string | 与 MEV 交易相关的所有交易链中交易位置相关的跟踪模式 | -| debt\_token\_address | string | 要支付的债务的基础代币地址 | -| received\_amount | bigint | 从清算中收到的金额 | -| protocol | string | 协议名称 | -| liquidated\_user | string | 被清算用户地址 | -| liquidator\_user | string | 清算人用户地址 | -| received\_token\_address | string | 收到资产的地址 | -| block\_number | bigint | 区块编号 | -| debt\_purchase\_amount | bigint | 购买的债务金额 | -| timestamp | timestamp | 文件最新更新的时间戳 | +| created\_at | string | Time of the records creation | +| transaction\_hash | string | Transaction hash | +| trace\_address | string | Trace pattern related to the position of the transaction in the chain of all transactions related to the MEV trade. | +| debt\_token\_address | string | Underlying token address of the debt to pay | +| received\_amount | bigint | Amount received from the liquidation | +| protocol | string | Protocol name | +| liquidated\_user | string | Address of the liquidated user | +| liquidator\_user | string | Address of the liquidator user | +| received\_token\_address | string | Address of the received asset | +| block\_number | bigint | Block number | +| debt\_purchase\_amount | bigint | Amount of purchased debt | +| timestamp | timestamp | Timestamp of the latest update of the file | ## **flashbots.sandwiched\_swaps** -Sandwiched\_swaps 表包含有关一个或多个交换的附加数据,这些交换与数据库中的相应三明治夹在中间。 +The sandwiched\_swaps table contains additional data about one or more swaps that were sandwiched with a corresponding sandwich in the database. -| **列名** | **数据类型** | **说明** | +Query examples can be found here: + +| **Column name** | **Type** | **Description** | | ----------------- | --------- | ----------------------------------------------------------------------------------------------------------- | -| created\_at | string | 记录创建时间 | -| block\_number | bigint | 区块编号 | -| sandwich\_id | string | 三明治交易的内部 id | -| trace\_address | string | 与套利交易相关的所有掉期链中掉期位置相关的跟踪模式 | -| transaction\_hash | string | 交易哈希 | -| timestamp | timestamp | 文件最新更新的时间戳 | +| created\_at | string | Time of the records creation | +| block\_number | bigint | Block number | +| sandwich\_id | string | Internal id of the sandwiched swap | +| trace\_address | string | Trace pattern related to the position of the swap in the chain of all swaps related to the arbitrage trade. | +| transaction\_hash | string | Transaction hash | +| timestamp | timestamp | Timestamp of the latest update of the file | ## **flashbots.sandwiches** -此表包含有关已执行三明治交换的详细信息。 +This table contains detailed information about executed sandwiches + +Query examples can be found here: -| **列名** | **数据类型** | **说明** | +| **Column name** | **Type** | **Description** | | --------------------------------- | --------- | --------------------------------------------------------------- | -| created\_at | datetime | 记录创建时间 | -| block\_number | bigint | 区块编号 | -| backrun\_swap\_trace\_address | string | 回溯交易中的交换地址 | -| backrun\_swap\_transaction\_hash | string | 指定三明治的backrun代交易的交易哈希 | -| frontrun\_swap\_trace\_address | string | 前端交易中的掉期地址 | -| frontrun\_swap\_transaction\_hash | string | 指定三明治前端交易的交易哈希 | -| id | string | 三明治交易的内部 id | -| profit\_amount | bigint | 套利后的利润额 | -| profit\_token\_address | string | 利润资产地址 | -| sandwicher\_address | string | 三明治交易者的地址 | -| timestamp | timestamp | 文件最新更新的时间戳 | +| created\_at | datetime | Time of the records creation | +| block\_number | bigint | Block number | +| backrun\_swap\_trace\_address | string | address of the swap in the backrun transaction | +| backrun\_swap\_transaction\_hash | string | transaction\_hash of backrun transaction of specified sandwich | +| frontrun\_swap\_trace\_address | string | address of the swap in the frontrun transaction | +| frontrun\_swap\_transaction\_hash | string | transaction\_hash of frontrun transaction of specified sandwich | +| id | string | Internal id of the sandwich | +| profit\_amount | bigint | Profit amount after the arbitrage | +| profit\_token\_address | string | Address of the profit asset | +| sandwicher\_address | string | Address of the sandwicher | +| timestamp | timestamp | Timestamp of the latest update of the file | ## **flashbots.blocks** -此表包含块号和对应的区块时间戳。 +This table contains block numbers and corresponding block\_timestamps + +Query examples can be found here: -| **列名** | **数据类型** | **说明** | +| **Column name** | **Type** | **Description** | | ---------------- | --------- | --------------- | -| block\_number | bigint | 区块编号 | -| block\_timestamp | timestamp | 区块时间戳 | +| block\_number | bigint | Block number | +| block\_timestamp | timestamp | Block timestamp | diff --git a/data-tables/data-tables/decoded-data.md b/data-tables/data-tables/decoded-data.md index fd042f0..8c64ca4 100644 --- a/data-tables/data-tables/decoded-data.md +++ b/data-tables/data-tables/decoded-data.md @@ -1,81 +1,82 @@ --- -说明: >- - 我们对智能合约发出的数据进行解码,并将它们存储在易于使用的表格中。 +description: >- + We decode the data emitted by smart contracts and store them in easy-to-use + tables. --- -# 已解码数据 +# Decoded Data -## 已解码智能合约数据 +## Decoded smart contract data -Dune 不使用跟踪和日志,而是将智能合约活动解码为易于阅读的表格。 +Instead of working with the traces, logs, and traces, Dune decodes smart contract activity into nice human-readable tables. -我们为智能合约 ABI 中定义的每个事件(event)和功能(function)创建表格。随后,对该合约的每个事件或函数调用都被解码并作为一行插入到这些表中。 +We create tables for each event and function defined in the smart contract ABI. Subsequently, every event or function call on that contract is decoded and inserted as a row into these tables. -这些表被相应地命名: +The tables are named accordingly -**事件(events):** `projectname."contractName_evt_eventName"` +**events:** `projectname."contractName_evt_eventName"` -**函数调用(function calls):** `projectname."contractName_call_eventName"` +**function calls:** `projectname."contractName_call_eventName"` -例如,在表 [uniswap\_v2."pair\_swap"](https://dune.xyz/queries/38968) 中可以找到 uniswap V2 交换合约的 `swap` 事件的解码数据。 +As an example, decoded data for the `swap`-event of the uniswap V2 exchange contract is found in the table [uniswap\_v2."pair\_swap"](https://dune.xyz/queries/38968). -使用事件表通常就足够了,但在某些情况下,你会想要使用 `call` 表。例如 Maker DAO,它不会给你太多事件,你可以使用像 [maker."SaiTub\_call\_draw](https://dune.xyz/queries/38974)" 这样的表格。 +Using the event tables is usually sufficient, but in some cases you will want to use the `call` tables. For instance Maker DAO which don’t give you too many events you can use tables like [maker."SaiTub\_call\_draw](https://dune.xyz/queries/38974)". -## 哪些合约有已解码数据? +## What contracts have decoded data? -你可以通过我们的数据库查询 “blockchain”.contracts 表或 [这个仪表盘](https://dune.xyz/0xBoxer/Is-my-Contract-decoded-yet) 来检查合约是否已解码。 +You can check if contracts are already decoded by querying "blockchain".contracts through our database or [this dashboard](https://dune.xyz/0xBoxer/Is-my-Contract-decoded-yet). -如果合约还没有在我们的数据库中,你可以在此处将其提交给 [解码](../../duneapp/adding-new-contracts.md):[dune.xyz/decode](http://dune.xyz/decode). +If the contract is not in our database yet, you can submit it for [Decoding](../../duneapp/adding-new-contracts.md) here: [dune.xyz/decode](http://dune.xyz/decode) -我们通常需要大约 24-48 小时来解码智能合约。 +We usually take about 24-48 hours to decode smart contracts. -查看 [本指南](../../duneapp/adding-new-contracts.md) 以了解有关解码过程的更多信息。 +Check out [this guide](../../duneapp/adding-new-contracts.md) to learn more about the Decoding process. -## 如何理解已解码数据? +## How to understand decoded data? -解码数据有时有点难以处理,因为它需要你了解事件/调用在智能合约上下文中的含义。此外,你需要了解智能合约发出什么样的数据,并了解项目的不同智能合约相互交互的复杂性。通常,你要查找的数据分散在 Dune 中的多个智能合约和表格中。 +Decoded data sometimes is a bit tricky to work with since it requires you to understand what the events/calls mean in the context of the smart contract. Additionally you need to understand what kind of data the smart contract emits and understand the intricacies of the different smart contracts of the project interacting with each other. Often times the data you are looking for is scattered across multiple smart contracts and tables in Dune. -如果你无法通过仅在表格中搜索来理解数据,则使用代交易哈希和 etherscan 查看单个交易(transaction)的详情通常会有所帮助。 +If you are not able to make sense of the data by just searching at the tables, it usually helps to look at single tx's using the transaction hash and etherscan. -如果这也不能带来令人满意的结果,那么搜索项目的相关文档和 github 可以引导你找到所需的答案。此外,与项目的开发人员和核心社区交流也可以让你更好地理解合约。 +If that also doesn't lead to satisfactory results, scouring the relevant docs and github of the project can lead you to the desired answers. Furthermore, talking to the developers and core community of a project can also get you to a good understanding of the contract. -在整个 Dune 中都可以找到有关如何处理解码数据的一些很好的展示,但尤其是我们的 [抽象表存储库](https://github.com/duneanalytics/abstractions) 充满了很好的例子。 +Some good showcasing of how to deal with decoded data can be found all throughout Dune, but especially our [abstraction repository](https://github.com/duneanalytics/abstractions) is full of great examples. -**总之**: +**In Summary**: -处理解码数据可以让你深入访问存储在区块链上的信息,并且信息量非常丰富,但了解数据有时需要你付出一些努力,因为你正在以直接的方式与合约数据进行交互。 +Dealing with decoded data allows you deep access to information stored on the blockchain and is very information rich, but understanding that data sometimes takes a bit of effort on your side since you are interacting with the data of the contract in a direct way. -## 跨合约的可扩展解码 +## Scalable decoding across contracts -许多 dApp 拥有大量使用相同字节码部署的智能合约。这可以是:收益聚合池、独特的期权、流动性池等。 +Many dApps have numerous smart contracts that are deployed with the same bytecode. This can be: yield aggregator pools,distinctive options, liquidity pools etc. -我们可以自动将这些相似的合约提取到同一个表中,从而让你更轻松地处理这些数据。无需查询所有独特的智能合约,你只需查询一张表,该表将以该特定智能合约的 `contract_address` 作为标识符。 +We can automatically pull these similar contracts into the same tables and thereby make it way easier for you to work with that data. Instead of having to query for all distinctive smart contracts you can then just query one table which will have the `contract_address` of that specific smart contract as an identifier. -为了能够使用此功能,你必须在将合约提交解码时将其作为两个底部选项之一提交。 +To be able to use this function you have to submit the contract as one of the two bottom options while submitting it to decoding. ![](<../../.gitbook/assets/image (23).png>) -因此,来自单个表的 `SELECT` 可能会产生来自多个合约的数据。在解码表中,`contract_address` 列告诉你事件或调用在哪个智能合约上。如果你只想查看单个合约,则可以按其地址进行过滤。 +As a result, `SELECT`-ing from a single table might yield data from multiple contracts. In decoded tables, the column `contract_address` tells you which smart contract the event or call is on. If you want to look at only a single contract you can filter by its address. -例如: +For example: ```sql SELECT DISTINCT contract_address FROM uniswap_v2."Pair_evt_swap"; ``` -将通过代币购买事件为你提供所有独特的 Uniswap 交易对。 +will give you all the unique Uniswap Pairs with a Token Purchase event. -[查询实战](https://dune.xyz/queries/39006) +[Query in action](https://dune.xyz/queries/39006) -## **探索已解码合约的查询** +## **Queries to explore decoded Contracts** -**查看我们已解码数据的所有项目** +**See all projects we have decoded data for** ```sql SELECT DISTINCT namespace FROM ethereum."contracts"; ``` -如果你直接使用事件或调用表,你可以通过此查询查看该合约是否有多个实例。 +If you are working with a an event or call table directly you can see if there are several instances of that contract with this query. ```sql SELECT DISTINCT contract_address FROM projectname."contractName_evt_eventName"; diff --git a/data-tables/data-tables/erc-20-balances.md b/data-tables/data-tables/erc-20-balances.md index 5a1d296..2247bcf 100644 --- a/data-tables/data-tables/erc-20-balances.md +++ b/data-tables/data-tables/erc-20-balances.md @@ -1,21 +1,22 @@ --- -说明: >- - ERC20 代币分析是任何 DeFi 产品分析的基础部分,这些表格和视图将为你提供所有必要的信息。 +description: >- + ERC20 token analysis is a fundamental part of any analysis of DeFi products, + these tables and views will provide you with all the necessary information. --- -# ERC-20 代币余额 +# ERC-20 balances -## 随着时间的推移轻松跟踪钱包和代币余额 +## Easily track wallets and token balances over time. -下列表格允许随时间变化或按快照格式轻松跟踪钱包余额、代币分配或代币供应量。 +The following tables allow for easy tracking or wallet-balances, token allocations or supply of a token over time or in a snapshot format. -在原始数据级别上,使用 erc20 代币非常困难,因为你需要对所有地址的所有代币转移进行汇总。这不必要地使查询膨胀并迅速导致人为错误。为了防止这种情况发生,我们构建了几个视图和表,可以帮助你轻松查询 erc20 代币数据。 +On a raw data level it's pretty hard to work with erc20 tokens since you need to sum all transfers for all addresses over time. This unnecessarily bloats queries and quickly leads to human errors. To prevent that from happening we have constructed several views and tables that will help you query for erc20 data with ease. -这些表可用于各种有趣的分析,但在使用它们时你仍需要注意一些事项: +These tables can be used for all kinds of interesting analysis, but you still need to watch out for a few things while working with them: -* **铸造/燃烧地址** 没有标准化,因此你需要找出这些地址并在查询中手动应用修复。在大多数情况下,用于铸造和燃烧的将是 `x0000000000000000000000000000000000000000` ,但请始终确保确实如此。在下面给出的示例中,情况并非如此。 +* the **mint/burn address** is not standardized, so you need to find out those addresses and manually apply a fix in your queries. In most cases it will be `x0000000000000000000000000000000000000000`for minting and burning, but always make sure that that is indeed the case. In the example given that's exactly not the case. -**示例:** +**example:** ```sql Select @@ -25,11 +26,11 @@ Select token_symbol from erc20."view_token_balances_daily" where token_address = '\x429881672B9AE42b8EbA0E26cD9C73711b891Ca5' -and wallet_address != '\x0000000000000000000000000000000000000000' -- 铸造地址 -and wallet_address != '\x000000000000000000000000000000000000dead' -- 燃烧地址 +and wallet_address != '\x0000000000000000000000000000000000000000' --mint address +and wallet_address != '\x000000000000000000000000000000000000dead' --burn address ``` -* 使用这些表格工作会很快产生很多单独的数据点,我们的可视化引擎并不总是能够完美处理这些数据点。与其尝试显示每个唯一的持有者,不如将它们按特定标准分组并以这种方式显示数据集。这对于每个代币都是唯一的,你可能需要进行一些试验以查看什么分类方式能在你的查询中有效工作。 +* working with these tables quickly leads to a lot of individual data points that our visualization engine is not always able to handle perfectly. Instead of trying to display every unique holder it makes sense to group them by certain criteria and display the dataset that way. This is unique for every token, you might need to experiment a bit to see what works in your queries. ```sql Select @@ -44,7 +45,7 @@ Select WHEN amount between 100 and 1000 then 'fish(100-1,000)' WHEN amount between 1000 and 10000 then 'dolphin(1,000-10,000)' WHEN amount > 10000 then 'whale (>10000)' - -- 请注意,case 表述的顺序在这里很重要 + --note that the order of case statements matters here end as classification, sum(amount) as amount, @@ -53,67 +54,67 @@ from erc20."view_token_balances_latest" where token_address = '\x429881672B9AE42b8EbA0E26cD9C73711b891Ca5' and wallet_address != '\x0000000000000000000000000000000000000000' and wallet_address != '\x000000000000000000000000000000000000dead' -and amount > 0.1 -- 过滤掉灰尘量,根据经济价值针对不同的代币进行调整 +and amount > 0.1 --filter out dust amounts, adjust this for different tokens based on economic value group by 1,3 ``` -## 仪表盘示例: +## Dashboard example: -此仪表盘包含与用作治理代币的单个 erc20 代币相关的最重要用例。 +This dashboard contains the most important use cases related to a single erc20 token that is used as gov token. [https://dune.xyz/0xBoxer/pickle-finance\_1](https://dune.xyz/0xBoxer/pickle-finance\_1) ## erc20.view\_token\_balances\_latest -此视图依赖于 erc20.token\_balances 表,并为你提供该代币的最新分布信息。 +This view depends on the erc20.token\_balances table and gives you the information of the latest distribution of that token. -| 列名 | 数据类型 | 描述 | +| column name | data type | description | | ----------------------------- | ----------- | ------------------------------------------------------------------------------------------ | -| amount | numeric | 该代币的正确显示格式的金额 | -| amount\_raw | numeric | 该代币的原始金额(需要除以小数位数!) | -| amount\_usd | float8 | 当前价格(如果我们有价格数据) | -| last\_transfer\_\_\_timestamp | timestamptz | 此特定钱包地址中此代币余额最后更改的日期 | -| token\_address | bytea | 代币地址 | -| token\_symbol | text | 代币符号 | -| wallet\_address | bytea | 持有该代币的钱包地址 | +| amount | numeric | the correct display format for that token | +| amount\_raw | numeric | the raw amount of that token (need to divide by decimals!) | +| amount\_usd | float8 | the current price (if we have data on the price) | +| last\_transfer\_\_\_timestamp | timestamptz | the date on which the balance of this token last changed in this particular wallet address | +| token\_address | bytea | the address of the token | +| token\_symbol | text | the symbol of the token | +| wallet\_address | bytea | the address of the wallet holding this token | ## erc20.view\_token\_balances\_hourly -此表将按小时提供有关所有代币余额的信息。在大多数情况下,它还已经包含小数和价格,因此它们已经准备好可开箱即用。 +This table will provide information about all token balances on an hourly basis. It also already includes decimals and prices in most cases, so they are pretty much ready to go out of the box. -| 列名 | 数据类型 | 描述 | +| column name | data type | description | | --------------- | ----------- | ---------------------------------------------------------- | -| amount | numeric | 该代币的正确显示格式的金额 | -| amount\_raw | numeric | 该代币的原始金额(需要除以小数位数!) | -| amount\_usd | float8 | 当前价格(如果我们有价格数据) | -| hour | timestamptz | 以小时为单位的时间 | -| token\_address | bytea | 代币地址 | -| token\_symbol | text | 代币符号 | -| wallet\_address | bytea | 持有该代币的钱包地址 | +| amount | numeric | the correct display format for that token | +| amount\_raw | numeric | the raw amount of that token (need to divide by decimals!) | +| amount\_usd | float8 | the current price (if we have data on the price) | +| hour | timestamptz | the time in the resolution of hours | +| token\_address | bytea | the address of the token | +| token\_symbol | text | the symbol of the token | +| wallet\_address | bytea | the address of the wallet holding this token | ## erc20.view\_token\_balances\_daily -**此表的性能将比 `erc20.view_token_balances_hourly` 好得多,因为它仅按天查询数据**。如果你想进行高阶分析,这是你应该选择的表。 +**This table will perform much better than `erc20.view_token_balances_hourly` since it's only querying for data on a daily basis**. If you want to make high level analysis, this is your way to go. -| 列名 | 数据类型 | 描述 | +| column name | data type | description | | --------------- | ----------- | ---------------------------------------------------------- | -| amount | numeric | 该代币的正确显示格式的金额 | -| amount\_raw | numeric | 该代币的原始金额(需要除以小数位数!) | -| amount\_usd | float8 | 当前价格(如果我们有价格数据) | -| day | timestamptz | 以天为单位的时间 | -| token\_address | bytea | 代币地址 | -| token\_symbol | text | 代币符号 | -| wallet\_address | bytea | 持有该代币的钱包地址 | +| amount | numeric | the correct display format for that token | +| amount\_raw | numeric | the raw amount of that token (need to divide by decimals!) | +| amount\_usd | float8 | the current price (if we have data on the price) | +| day | timestamptz | the time in the resolution of days | +| token\_address | bytea | the address of the token | +| token\_symbol | text | the symbol of the token | +| wallet\_address | bytea | the address of the wallet holding this token | ## erc20.token\_balances -该表包含所有 erc20 代币在这些代币存在期间的每小时余额。如果我们上面提供的视图不足以满足你尝试建立的用例,你可以使用此表作为备用选项。 +This table contains the hourly balance of all erc20 tokens over the entire existence of these tokens. You can use this table as a fallback option might the views we have provided above not be sufficient for the usecase you are trying to establish. -| 列名 | 数据类型 | 描述 | +| column name | data type | description | | --------------- | ----------- | ---------------------------------------------------------- | -| amount | numeric | 该代币的正确显示格式的金额 | -| amount\_raw | numeric | 该代币的原始金额(需要除以小数位数!) | -| timestamp | timestamptz | 以小时为单位的时间 | -| token\_address | bytea | 代币地址 | -| token\_symbol | text | 代币符号 | -| wallet\_address | bytea | 持有该代币的钱包地址 | +| amount | numeric | the correct display format for that token | +| amount\_raw | numeric | the raw amount of that token (need to divide by decimals!) | +| timestamp | timestamptz | the time in the resolution of hours | +| token\_address | bytea | the address of the token | +| token\_symbol | text | the symbol of the token | +| wallet\_address | bytea | the address of the wallet holding this token | diff --git a/data-tables/data-tables/labels.md b/data-tables/data-tables/labels.md index 3acc8e9..6539c7a 100644 --- a/data-tables/data-tables/labels.md +++ b/data-tables/data-tables/labels.md @@ -1,99 +1,99 @@ -# 标签(Labels) +# Labels -你是否曾经在 Dune 上查询过地址列表,却只是停下来想知道这些漂亮的随机十六进制编码字符串背后是什么? 我们也是。 +Have you ever made a query on Dune where you get a list of addresses, only to stop and wonder what’s behind these beautiful, random hexadecimal encoded strings? So have we. -**地址标签** 是 Dune 上的一项功能,你作为用户可以为任何地址_添加_、_更新_和_查询_标签数据。 +**Address labels** is a feature on Dune where you as a user can _add_, _update_ and _query_ labels for any address. -## 什么是标签? +## What is a label? -标签是**关于某个地址的元数据**、标记或元数据(如果你愿意)。它以键值对的形式出现。键是标签_类型_,值是标签_名称_。 +A label is **a piece of metadata about an address**, a tag or metadata if you will. It comes in the form of a key-value pair. The key is the label _type_, and the value the label _name_. -在 [**标签页面**](https://dune.xyz/labels) 浏览地址和标签。 +Browse addresses and and labels at the [**labels page**](https://dune.xyz/labels). -## 标签看起来像什么 +## What labels looks like -查看 [这个仪表盘](https://dune.xyz/hagaetc/labels) 了解可以使用标签创建的示例。 +Check out [this dashboard](https://dune.xyz/hagaetc/labels) for examples on what can be created with labels. -**地址标签示例** +**Address label examples** -地址 [0xD551234Ae421e3BCBA99A0Da6d736074f22192FF](https://dune.xyz/ethereum/address/0xD551234Ae421e3BCBA99A0Da6d736074f22192FF) 可以被这样标记: +The address [0xD551234Ae421e3BCBA99A0Da6d736074f22192FF](https://dune.xyz/ethereum/address/0xD551234Ae421e3BCBA99A0Da6d736074f22192FF) can be labeled like this: -| **类型** | **名称** | +| **type** | **name** | | ----------- | -------- | | owner | binance | | wallet type | exchange | -此地址由交易所 Binance 控制。 +The address is controlled by the exchange Binance. -地址 [0xe65040f61701940b62e18da7a53126a58525588b](https://dune.xyz/ethereum/address/0xe65040f61701940b62e18da7a53126a58525588b) 可以被这样标记: +The address [0xe65040f61701940b62e18da7a53126a58525588b](https://dune.xyz/ethereum/address/0xe65040f61701940b62e18da7a53126a58525588b) can be labeled like this: -| **类型** | **名称** | +| **type** | **name** | | ---------- | ------------ | | dapp usage | uniswap user | | activity | dex trader | -这个地址曾经与 Uniswap 进行过交互。 +The address in the past interacted with Uniswap. -你可以随意想出新的类型和标签名称,因为 Dune 上的标签是开放式的并且**众包**的。 +You are free to come up with both new types and label names, as labels on Dune are open ended and **crowd sourced.** -## 添加标签 +## Adding labels -添加标签的方法有两种: +There are two ways to add labels: -**1. 通过我们的标签页面直接添加地址** +**1. Directly to an address via our labels page** -适合特定标签,例如“这是一个币安(binance)钱包”。 +Good for specific labels like “this is a binance wallet”. -**2. 通过 Dune 查询** +**2. Via a Dune query** -使用 Dune 查询来标记地址。一种非常强大且可扩展的方式来添加标签,例如“所有这些地址都使用过 Uniswap”等等。 +Use Dune queries to label addresses. A very powerful and scalable way to add labels like “all these addresses used Uniswap”, and much much more. -请参阅我们的 [Github](https://github.com/duneanalytics/abstractions/tree/master/labels),了解使用你自己的查询和 PR 创建标签的示例! +Please see our [Github](https://github.com/duneanalytics/abstractions/tree/master/labels) for examples of labels created with queries and PR in your own! -你可以执行的操作示例: +Examples of what you can do: -* 标记所有使用某个 dapp 的地址 -* 标记所有持有一定数量某种代币的地址 -* 标记每月使用某个 dapp 超过 X 次的所有地址 -* 标记所有向 Binance 汇款的地址 +* Label all addresses that used a certain dapp +* Label all addresses that hold a certain amount of a token +* Label all addresses that use a dapp more than X times per month +* Label all addresses that sent money to Binance -你还可以围绕用户模式做更多新颖和复杂的事情,例如谁进行了套利交易或从闪电贷款中获利等等。 +You could also do more novel and involved things around user patterns like who did arbitrage trades or profited from flash loans and so much more. -请注意,在 [dune.xyz](http://dune.xyz/) 上添加标签后,在你可以在 SQL 中查询它之前可能会有几分钟延迟。 +Note that there might be a few minutes delay from adding the label on [dune.xyz](http://dune.xyz/) until you can query it in SQL. -## 标签表 +## The labels table -标签存储在新的 `labels.labels` 表中,该表具有以下模式: +Labels are stored in the new `labels.labels` table which has the following schema: -| 列名 | 数据类型 | 说明 | +| column name | data type | description | | ----------- | ----------- | -------------------------------------------------------- | -| id | int | 自增整数 | -| address | bytea | 此标签描述的合约或钱包的地址 | -| name | text | 标签名称 | -| type | text | 标签类型 | -| author | text | 创建此标签的用户的用户名 | -| source | text | 此标签的来源,由 Dune 自动填充 | -| updated\_at | timestamptz | 最近更改此标签的时间 | +| id | int | incrementing integer | +| address | bytea | the address of a contract or wallet this label describes | +| name | text | label name | +| type | text | label type | +| author | text | the username of the user who created this label | +| source | text | the source of this label, autopopulated by dune | +| updated\_at | timestamptz | the last time this label was changed | -## 使用标签 +## Using labels -请注意,该表为每个地址中包含多行记录,因此对它进行连接可能会很棘手。出于这个原因,我们制作了方便的功能: +Note that this table holds multiple rows per address, and therefore joins against it can be tricky to get right. For that reason we’ve made the convenient function: `labels.get(address bytea, type text default null) RETURNS text[]` -我们预计这将是使用标签的主要方式。请参阅下面的示例。 +which we anticipate will be the primary way to use labels. See examples below. -通常,如果你执行返回 `address` 的查询,你可以使用 `labels.get(address)` 来获取该地址的所有标签,而与标签类型无关。如果你想查看 `owner` 类型的标签,可以执行 `labels.get(address, 'owner')` 。你还可以将此函数传递给你想要包含的几种标签类型,例如:`labels.get(address, 'owner', 'project')` 。 +Typically if you do a query that returns `address` you can use `labels.get(address)` to get all labels for that address independent of label type. If you want to see labels of the type `owner` you can do `labels.get(address, 'owner')`. You can also pass this function several label types you want included like: `labels.get(address, 'owner', 'project')`. -我们还添加了函数 `labels.url(address bytea)` 。从你的查询中传递给该函数一个地址,你的结果表将包含一个可点击的链接,例如: +We’ve also added the function `labels.url(address bytea)`. Pass that function an address from your query and your results table will contain a clickable link to for instance: [https://dune.xyz/ethereum/address/0xD551234Ae421e3BCBA99A0Da6d736074f22192FF](https://dune.xyz/ethereum/address/0xD551234Ae421e3BCBA99A0Da6d736074f22192FF) -### 用例:我想显示地址列表的标签 +### Usecase: I want to display labels for a list of addresses -> 我们鼓励你在阅读本文时在 Dune 中运行这些查询 +> We encourage you to run these queries in Dune while you read this -假设你正在查看过去 24 小时内所有 dex 中 DAI 的前 10 名交易者: +Say you’re looking at the top 10 traders of DAI across all dexes last 24 hours: ```sql SELECT trader_a, SUM(token_a_amount) @@ -105,9 +105,9 @@ ORDER BY 3 DESC LIMIT 10; ``` -如果你想为这些地址添加标签,只需将 `trader_a` 列更改为 `labels.get(trader_a)` 。 +If you want to have labels for these addresses simply alter the `trader_a` column to `labels.get(trader_a)`. -> 注意:在下面的示例中,`---` 表示删除的行,而 `+++` 表示添加的行。 +> Note: In the examples below `---` represents lines removed, and `+++` lines added. ```sql SELECT trader_a, labels.get(trader_a) as label, SUM(token_a_amount) @@ -120,7 +120,7 @@ SELECT trader_a, labels.get(trader_a) as label, SUM(token_a_amount) LIMIT 100; ``` -现在你已将地址替换为交易者a(trader\_a)的所有标签列表。有时你只对标签的一个子集感兴趣:`labels.get` 接受一个可选的类型名称列表,用于过滤你获得的标签类型。假设你只对 `‘activity’` 标签感兴趣: +Now you’ve replaced the addresses with lists of all labels for trader\_a. Sometimes you’re only interested in a subset of labels: `labels.get` accepts an optional list of type names which filter the type of labels you get. Say you’re only interested in ‘activity’ labels: ```sql SELECT trader_a, labels.get(trader_a, 'activity') as label, SUM(token_a_amount) @@ -133,7 +133,7 @@ SELECT trader_a, labels.get(trader_a) as label, SUM(token_a_amount) LIMIT 100; ``` -当然你也可以显示地址,同时过滤多种标签类型 +Of course you can also show the address, and filter for multiple label types ```sql SELECT trader_a, labels.get(trader_a, 'activity', 'project', 'contract_name') as label, SUM(token_a_amount) @@ -146,7 +146,7 @@ SELECT trader_a, labels.get(trader_a) as label, SUM(token_a_amount) LIMIT 100; ``` -你还可以使用 `labels.url` 使地址可点击: +You can also use `labels.url` to make the addresses clickable: ```sql SELECT labels.url(trader_a), labels.get(trader_a, 'activity') as labels, SUM(token_a_amount) @@ -158,13 +158,13 @@ GROUP BY 1, 2 LIMIT 10; ``` -这样,查看你的仪表盘的人可以轻松地为其添加更好的标签! +This way people who look at your dashboard can easily contribute even better labels to it! -### 用例:我想按存在的标签过滤我的查询。 +### Usecase: I want to filter my query by labels that exist. -在这个用例中,你不想使用 `labels.get`,因为它操作起来可能很慢。相反,你将在 SQL 中使用奇妙的 `EXISTS` 函数。 +In this usecase you wouldn’t want to use `labels.get`, because it can be slow to operate with. Instead you’ll use the fantastic `EXISTS` function in SQL. -例如:你正在查询 _Uniswap_,但对之前在 _1inch_ 上交易过的用户的行为感兴趣。以下是你的处理方式: +As an example: you’re querying _Uniswap_, but are interested in the behavior of users who have traded previously on _1inch_. Here’s how you’d go about that: ```sql SELECT "to" @@ -179,9 +179,9 @@ WHERE EXISTS( LIMIT 10; ``` -上面的查询将为你提供 10 个在 Uniswap 上交换并在 1inch 上交易过的地址。 +The above query will give you 10 address that has swapped on Uniswap and traded on 1inch. -当然,你可以结合使用这两种模式! 如果你确实对这些地址上的标签感兴趣,请继续使用 `labels.get` 和 `WHERE EXISTS` 模式: +Of course, you can use the two patterns in conjunction! If you _are_ interested for labels on those addresses, go ahead and use `labels.get` in addition to the `WHERE EXISTS` pattern: ```sql --- SELECT "to" @@ -191,4 +191,4 @@ LIMIT 10; LIMIT 10; ``` -你得到:你看到在 Uniswap 和 1inch 上交易的地址 _以及_ 所有相关的地址标签。 +There you have it: you see addresses that traded on both Uniswap and 1inch _and_ all associated address labels. diff --git a/data-tables/data-tables/nft.trading.md b/data-tables/data-tables/nft.trading.md index 75ef6e2..21e0d06 100644 --- a/data-tables/data-tables/nft.trading.md +++ b/data-tables/data-tables/nft.trading.md @@ -1,49 +1,50 @@ --- -说明: >- - NFT交易表 在 Dune 上向所有人提供 NFT 交易数据。 - NFT交易表 将跨多个 NFT 平台的数据聚合到一张简单的表格中。 +description: >- + nft.trades makes NFT trading data available to everyone on Dune Analytics. + NFT.trades aggregates data across multiple NFT platforms into one simple + table. --- -# NFT交易表(nft.trades) +# nft.trades -## **一种查询 NFT 数据的简单方法** +## **An easy way of querying for NFT data** -NFT交易表(nft.trades)旨在让 Dune 上的每个人都能轻松获得 NFT 交易数据。该表将不同数据平台之间的数据聚合和标准化,并在同一张表中提供辅助信息和元数据。 +`nft.trades` is an effort to make NFT trading data easily available to everyone on Dune Analytics. This table aggregates and standardizes the data between different data platforms and provides auxiliary information and metadata all in one table. -最重要的是使用该数据集,让在所有索引平台上查询任何与 NFT 相关的交易数据变得非常容易。 +The culmination of this is a dataset which makes it extremely easy to query for any NFT related trading data across all indexed platforms. -到目前为止,我们已经对以下平台的数据进行了索引: +So far we have indexed the data of the following platforms: * OpenSea * Rarible * SuperRare -* CryptoPunks(他们在自己的合约中进行交易) +* CryptoPunks (They get traded in their own contracts) * Foundation * LooksRare -所有这些数据都可以通过非常简单的查询轻松访问,例如: +All of this data is easily accessible with very simple queries like these: -* [**给定 NFT 的所有交易**](https://dune.xyz/queries/146090) +* [**all trades for a given NFT**](https://dune.xyz/queries/146090) ![](<../../.gitbook/assets/image (31).png>) ```sql select * from nft.trades -where nft_contract_address = '\xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb' -- 这是 cryptopunks 的地址 +where nft_contract_address = '\xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb' --this is the cryptopunks address ``` -* [**过去 24 小时内在给定平台上的交易**](https://dune.xyz/queries/146152) +* [**trades in the last 24 hour on a given platform**](https://dune.xyz/queries/146152) ```sql -select date_trunc('day', block_time), usd_amount, nft_contract_address, token_id from +select date_trunc('day', block_time), usd_amount, nft_contract_address, token_id from nft.trades -where platform = 'OpenSea' -- 仅显示给定平台上的交易 +where platform = 'OpenSea' --only shows trades on given Platform and block_time > now() - interval '24hours' ``` -* [**去年的平台交易量**](https://dune.xyz/queries/146160) +* [**platform volumes in the last year**](https://dune.xyz/queries/146160) ```sql select sum(usd_amount), date_trunc('day', block_time), platform from nft.trades @@ -55,99 +56,97 @@ group by 2,3 ### -### 基本理解 +### Basic Understanding -#### 单品交易(Single Item Trade) +#### Single Item Trade -交易发生在“买方”(buyer)和“卖方”(seller)之间。 +A trade occurs between a `buyer`and a `seller`.\ +They exchange an item which is uniquely identified by the combination of `nft_contract_address` and `token_id`. The Buyer will pay the Seller a given `original_amount`of tokens in any given `original_currency`. To make it easier, we have calculated the `usd_amount` that this was worth at the time of the trade for you. Most trades will be done in ETH or WETH, but especially non OpenSea trades often contain other currencies.\ +The trade is committed on any of the indexed `platforms`and will be facilitated through a smart contract of those platform's `exchange_contract_address`. Each trade will have metadata like `block_time`, `tx_hash`_,_ `block_number`, `platform version`, `evt_index` etc.\ +\ +Additionally, we also provide metadata about the traded NFT. `nft_project_name` and `erc_standard` will help you in analysing your dataset more easily. `nft_project_name` data gets pulled from the `nft.tokens` [table](https://github.com/duneanalytics/abstractions/blob/master/ethereum/nft/tokens.sql), if your NFT is missing in that table, you are welcome to make a PR to add it. -他们交换一个由 `nft_contract_address` 和 `token_id` 的组合唯一标识的项目。买方将以任何给定的 `original_currency` 向卖方支付给定的 `original_amount` 代币。为方便起见,我们已经为你计算了在交易时对应价值的 `usd_amount` 。大多数交易将以 ETH 或 WETH 进行,但尤其是非 OpenSea 交易通常包含其他货币类型。 +**Bundle Trade** -交易在任何被索引的 `platforms` 上进行,并将通过这些平台的 `exchange_contract_address` 的智能合约来促进。每笔交易都会有诸如 `block_time` , `tx_hash` , `block_number` , `platform version` , `evt_index` 等元数据。 +There can also be trades in which a single trade transaction contains multiple Items. Each of these Items is uniquely identified through a combination of `nft_contract_address` and `token_id`. Unfortunately, in these trades there is not a clear way to determine a corresponding `usd_amount` for each of the items. A possible workaround is to divide the number of items by the payment made for the bundle, but this logic very quickly falls apart when Items that are not one in kind/value get sold in a bundle. We recommend removing bundle transfers from the dataset that you are working with since it can heavily influence the results in either direction. Note that `token_id` and '`erc_standard` will be null if tokens with different tokens IDs or erc type are transfered within the same transaction. -此外,我们还提供有关交易的 NFT 的元数据。`nft_project_name` 和 `erc_standard` 将帮助你更轻松地分析数据集。`nft_project_name` 数据将从 `nft.tokens` [数据表](https://github.com/duneanalytics/abstractions/blob/master/ethereum/nft/tokens.sql) 中提取,如果你的 NFT 在该表中不存在,欢迎你发PR来添加它。 +**Aggregator Trade** -**捆绑交易(Bundle Trade)** +There can also be trades in which a single trade transaction contains multiple items, especially when using NFT aggregator platforms. Our approach is to unravel aggregator trades so that each row correspond to a unique item that was traded, with its associated ID, price, collection, etc. Importantly, the `trade_type` will be indicated as `Aggregator Trade`, and platform names and address can be found in the `nft.aggregators` [table](https://github.com/duneanalytics/abstractions/blob/master/ethereum/nft/aggregators.sql). If your aggregator platform is missing in that table, you are welcome to make a PR to add it. -单次交易也可能包含多个物品。这些物品中的每一个都通过 `nft_contract_address` 和 `token_id` 的组合来唯一标识。然而在这些交易中,没有明确的方法来确定每个物品对应的 `usd_amount` 。一种可能的解决方法是将商品数量除以捆绑商品的付款金额,但是当非实物/价值的商品捆绑出售时,这种逻辑就不成立了。我们建议从你正在使用的数据集中删除捆绑转移,因为它会严重影响任一方向的结果。请注意,如果在同一交易中转移具有不同Token ID 或 erc 类型的代币,则 `token_id` 和 `erc_standard` 将为空(Null)。 +**Platform and Royalty Fees** -**聚合贸易(Aggregator Trade)** +In the most recent version of `nft.trades`, information about the amount and percent of royalty fees in the original amount and in USD is available when this information was able to be retrieved. Royalty fees are going to the creator, and Platform fees are collected by the NFT platform. Note that royalty fees cannot always be retrieved, and are set to null by default. -在使用 NFT 聚合器平台时,也会出现单次交易包含多个物品的情况。我们的方法是分解聚合器交易,以便每一行对应一个被交易的唯一商品,及其关联的 ID、价格、分类等。重要的是,`trade_type` 将指示为`聚合贸易` ,平台名称和地址可以在 `nft.aggregators` [数据表](https://github.com/duneanalytics/abstractions/blob/master/ethereum/nft/aggregators.sql) 中找到。如果该表中缺少你的聚合平台,欢迎你提交 PR 以添加它。 +### **Sample dashboards** -**平台和版税费用** +**Dashboard that utilize parameters** -在最新版本的 `nft.trades` 中,如果销售许可费(royalty fees)的原始金额,美元金额以及百分比的信息在数据库中存在,那么检索时是一并提供的。版税归创作者所有,平台费用由 NFT 平台收取。请注意,版税费用并非总是能检索,所以默认设置为 null。 - -### **示例仪表盘** - -**利用参数的仪表盘** - -[**https://dune.xyz/0xBoxer/NFT**](https://dune.xyz/0xBoxer/NFT) +[**https://dune.xyz/0xBoxer/NFT**](https://dune.xyz/0xBoxer/NFT)\*\*\*\* [**https://dune.xyz/rantum/NFT-Sales-Overview-by-Project**](https://dune.xyz/rantum/NFT-Sales-Overview-by-Project) -**涵盖整个生态系统的仪表盘** +**Dashboards that look across the entire Ecosystem** [**https://dune.xyz/rantum/NFT-Collection-Dashboard**](https://dune.xyz/rantum/NFT-Collection-Dashboard) [**https://dune.xyz/masquot/NFT-Sales-Trends**](https://dune.xyz/masquot/NFT-Sales-Trends) -## **先生,我的平台没有被索引** +## **Ser my platform is not indexed** -处理每个市场数据的 SQL 代码是开源的,可在我们的 [github 存储库](https://github.com/duneanalytics/abstractions/tree/master/ethereum/nft/trades) 中找到。每个人都可以查看代码、提交拉取请求并提交代码以添加更多交易市场。 +The SQL code that processes the data for every market place is open source and available in our [github repository](https://github.com/duneanalytics/abstractions/tree/master/ethereum/nft/trades). Everyone can review the code, make pull requests and submit code to add more marketplaces. -另请阅读有关此主题的“[抽象表](abstractions.md)”部分。 +Also read the section "[abstractions](abstractions.md)" about this topic. -**数据表内容** +**Table contents** -| 列名 | 数据类型 | 说明 | +| column\_name | data\_type | description | | ---------------------------- | ------------------------ | --------------------------------------------------------------------------------- | -| block\_time | timestamp with time zone | 该交易何时执行的 | -| nft\_project\_name | text | NFT 项目名称(例如“the dudes”) | -| nft\_token\_id | text | 交易的 token\_id(例如 235) | -| erc\_standard | text | 交易代币的代币标准 | -| platform | text | 该交易是在哪个平台上执行的? | -| platform\_version | text | 使用了该平台的哪个版本? | -| trade\_type | text | “单品销售”还是“捆绑销售”? | -| number\_of\_items | integer | 本次交易一共交易了多少个 NFT? | -| category | text | 这是拍卖(auction)还是直销(direct sale)? | -| evt\_type | text | 当前未使用,默认“Trade” | -| aggregator | text | 此交易是否使用聚合器进行(是:聚合器名称,否:NULL) | -| usd\_amount | numeric | 执行时交易的美元价值 | -| seller | bytea | NFT 卖家地址 | -| buyer | bytea | NFT 买家地址 | -| original\_amount | numeric | 正确格式的金额 | -| original\_amount\_raw | numeric | 货币的原始金额 | -| eth\_amount | numeric | 执行时交易的 ETH 价值 | -| royalty\_fees\_percent | numeric | 支付给创作者的版税(百分比) | -| original\_royalty\_fees | numeric | 交易所用货币的特许权使用费 | -| usd\_royalty\_fees | numeric | 执行时特许权使用费的美元价值 | -| platform\_fees\_percent | numeric | 平台费用(百分比) | -| original\_platform\_fees | numeric | 用于此交易的货币的平台费用 | -| usd\_platform\_fees | numeric | 执行时平台费用的美元价值 | -| original\_currency | text | 用于此交易的货币 | -| original\_currency\_contract | bytea | 本次交易所用币种的 erc20 地址(不适用于原始ETH) | -| currency\_contract | bytea | 修正后的货币合约 | -| nft\_contract\_address | bytea | 交易的 NFT 合约地址 | -| exchange\_contract\_address | bytea | 促成此交易的平台合约 | -| tx\_hash | bytea | 本次交易的哈希 | -| block\_number | integer | 该交易执行完成的区块编号 | -| tx\_from | bytea | 发起本次交易的地址 | -| tx\_to | bytea | 接收这笔交易的地址 | +| block\_time | timestamp with time zone | When was this trade exectuted | +| nft\_project\_name | text | NFT project name (e.g. "the dudes") | +| nft\_token\_id | text | The token\_id that got trades (e.g. 235) | +| erc\_standard | text | The Token Standard of the traded token | +| platform | text | Which Platform was this trade executed on? | +| platform\_version | text | Which version of this platform was utilized? | +| trade\_type | text | "Single Item Sale" or "Bundle Sale"? | +| number\_of\_items | integer | How many NFTs were traded in this trade? | +| category | text | Was this an auction or a direct sale? | +| evt\_type | text | currently not in use, default 'Trade' | +| aggregator | text | Was this trade made using an aggregator (Yes : Name of aggregator, No : Null) | +| usd\_amount | numeric | USD value of the trade at time of execution | +| seller | bytea | Seller of NFTs | +| buyer | bytea | Buyer of NFTs | +| original\_amount | numeric | The amount in the right format | +| original\_amount\_raw | numeric | raw amount of the currency | +| eth\_amount | numeric | ETH value of the trade at time of execution | +| royalty\_fees\_percent | numeric | Royalty fees going to the creator (in %) | +| original\_royalty\_fees | numeric | Royalty fees in the currency used for this trade | +| usd\_royalty\_fees | numeric | USD value of royalty fees at time of execution | +| platform\_fees\_percent | numeric | Platform fees (in %) | +| original\_platform\_fees | numeric | Platform fees in the currency used for this trade | +| usd\_platform\_fees | numeric | USD value of platform fees at time of execution | +| original\_currency | text | The Currency used for this trade | +| original\_currency\_contract | bytea | The erc20 address of the currency used in this trade (does not work with raw ETH) | +| currency\_contract | bytea | the corrected currency contract | +| nft\_contract\_address | bytea | The contract address of the NFT traded | +| exchange\_contract\_address | bytea | The platform contract that facilitated this trade | +| tx\_hash | bytea | the hash of this transaction | +| block\_number | integer | the block\_number that this trade was done in | +| tx\_from | bytea | Initiated this transaction | +| tx\_to | bytea | Received this transaction | | trace\_address | ARRAY | n/a | -| evt\_index | integer | 事件索引 | +| evt\_index | integer | event index | | trade\_id | integer | n/a | -## **鸣谢** +## **Credits** -以下 Dune 用户在 NFT 方面的惊叹的先驱性工作: +Amazing pioneer work on NFTs by the following Dune users: * [https://dune.xyz/rchen8](https://dune.xyz/rchen8) * [https://dune.xyz/keeganead](https://dune.xyz/keeganead) * [https://dune.xyz/eliasimos](https://dune.xyz/eliasimos) -以下高级用户提供了多方面的帮助: +The following power users helped along the way in various ways: * [https://dune.xyz/0xBoxer](https://dune.xyz/0xBoxer) * [https://dune.xyz/danner\_eth](https://dune.xyz/danner\_eth) diff --git a/data-tables/data-tables/prices.md b/data-tables/data-tables/prices.md index 9d5ead6..9bb0300 100644 --- a/data-tables/data-tables/prices.md +++ b/data-tables/data-tables/prices.md @@ -1,48 +1,51 @@ -# 价格表(Prices) +# Prices -#### 中心化交易所交易数据 +#### Centralized exchanges trading data -代币成交量很好,但你通常想知道智能合约活动的美元价值。你可以使用我们从 coinpaprika API 中提取的数据轻松获取该信息并将其与链上数据相结合。 +Token volume is great, but more often than not you want to know the USD value of smart contract activity.\ +You can easily get and combine that information with on-chain data using the data we pull from the coinpaprika API. -价格是基于实时市场数据的成交量加权价格,转换为美元。 +The Price is the volume-weighted price based on real-time market data, translated to USD. **prices.usd** -该表支持一系列 erc20.tokens 。 +This table support a range of erc20.tokens. \ +If the token you desire is not listed in here, please make a pull request to our [github repository](https://github.com/duneanalytics/abstractions/tree/master/prices) **** or use the decentralized price feed **dex.view\_token\_prices.** -如果你想要的代币未在此处列出,请向我们的 [github 存储库](https://github.com/duneanalytics/abstractions/tree/master/prices) 提交拉取请求 **** 或使用去中心化价格馈送(price feed) **dex.view\_token\_prices.** - -|

列名

| 描述 | +|

column name

| description | | ------------------------- | --------------------------------------------- | -| contract\_address | erc20 合约地址 | -| symbol | 资产的标识符(股票代码、现金标签) | -| price | 任何给定分钟内的资产价格 | -| minute | 此表是按分钟为单位计算的 | +| contract\_address | the contract address of the erc20 token | +| symbol | the identifier of the asset (ticker, cashtag) | +| price | the price of the asset in any given minute | +| minute | the resolution for this table is by minute | Note that `WETH` can be used for ETH price. **prices.layer\_1usd** -该表还支持其他区块链上的第 1 层(Layer 1)资产。 +This table also supports layer 1 assets on other blockchains. -| 列名 | 描述 | +| column name | description | | ----------------- | --------------------------------------------- | -| contract\_address | erc20 合约地址 | -| symbol | 资产的标识符(股票代码、现金标签) | -| price | 任何给定分钟内的资产价格 | -| minute | 此表是按分钟为单位计算的 | +| contract\_address | the contract address of the erc20 token | +| symbol | the identifier of the asset (ticker, cashtag) | +| price | the price of the asset in any given minute | +| minute | the resolution for this table is by minute | **** **dex.view\_token\_prices** -我们创建了一个去中心化的价格馈送(price feed),它根据去中心化的交易所交易数据计算价格。**此表涵盖的资产比 price.usd 多得多**。此表非常占用资源,因此只能每隔几个小时更新一次,使用时请记住这一点。 +We created a decentralized price feed that calculates prices based on decentralized exchange trading data. **This table covers much more assets than prices.usd.** This table is very resource intensive and can therefore only be updated every few hours, please keep that in mind when utilizing it. -该表目前仅在以太坊数据集中存在。 +This table currently only exists for Ethereum data. -| 列名 | 描述 | +| column name | description | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| contract\_address | erc20 合约地址 | -| sample\_size | 该资产在所有去中心化交易所发生的交易数量(如果数量非常少,你可能希望排除数据,这可能会导致不准确)。| -| median\_price | 任何给定小时内资产的中位数价格 | -| hour | 此表按每小时为单位计算 | +| contract\_address | the contract address of the erc20 token | +| sample\_size | the number of trades that occurred for this asset on all decentralized exchanges (If the number is very small you might want to exclude the data, it can lead to inaccuracies). | +| median\_price | the median price of the asset in any given hour | +| hour | the resolution for this table is hourly | + + + diff --git a/data-tables/data-tables/raw-data/README.md b/data-tables/data-tables/raw-data/README.md index 8b66a49..87dc82b 100644 --- a/data-tables/data-tables/raw-data/README.md +++ b/data-tables/data-tables/raw-data/README.md @@ -1,15 +1,15 @@ -# 原始数据表 +# Raw Data {% content-ref url="ethereum-data.md" %} -[以太坊数据(ethereum)](ethereum-data.md) +[ethereum-data.md](ethereum-data.md) {% endcontent-ref %} {% content-ref url="xdai-data.md" %} -[XDai 数据(xdai).md](xdai-data.md) +[xdai-data.md](xdai-data.md) {% endcontent-ref %} {% content-ref url="../solana-data/" %} -[Solana 数据(solana)](../solana-data/) +[solana-data](../solana-data/) {% endcontent-ref %} diff --git a/data-tables/data-tables/raw-data/ethereum-data.md b/data-tables/data-tables/raw-data/ethereum-data.md index 71ddd18..4d9d06e 100644 --- a/data-tables/data-tables/raw-data/ethereum-data.md +++ b/data-tables/data-tables/raw-data/ethereum-data.md @@ -1,109 +1,110 @@ --- -说明: >- - 我们的数据库自动获取以太坊区块链上每笔交易的不同方面, - 并根据表格关注的方面将它们解析为不同的表格。 +description: >- + Our Database automatically picks up different aspects of every transaction on + the Ethereum Blockchain and parses them into different tables depending on + which aspect that table is focused on. --- -# 以太坊数据(Ethereum) +# Ethereum data ## Ethereum.Blocks -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | ------------------- | ------------ | ---------------------------------------------------------------------------------------- | -| time | timestamptz | 区块被开采的时间。 | -| number | numeric | 区块链的长度(以块为单位) | -| hash | bytea | 该区块的唯一标识符 | -| parent hash | bytea | 前一个区块的唯一标识符 | -| gas\_limit | numeric | 当前区块的gas限制 | -| gas\_used | numeric | 当前区块中使用的gas | -| miner | bytea | 矿工的地址 | -| difficulty | numeric | 开采区块所需的难度值 | -| total\_difficulty | numeric | 直到这个区块的总难度值 | -| nonce | bytea | 区块随机数,用于展示挖矿过程中的工作量证明 | -| size | numeric | 此块的大小(以字节为单位)(受限于 gas limit) | -| base\_fee\_per\_gas | numeric | 此区块的基本费用(由[EIP1559](https://eips.ethereum.org/EIPS/eip-1559))引入 | +| time | timestamptz | the time when the block was mined. | +| number | numeric | the length of the blockchain in blocks | +| hash | bytea | a unique identifier for that block | +| parent hash | bytea | the unique identifier for the prior block | +| gas\_limit | numeric | the gas limit of the current block | +| gas\_used | numeric | the gas used in this block | +| miner | bytea | the address of the miner | +| difficulty | numeric | the effort required to mine the block | +| total\_difficulty | numeric | total difficulty of the chain until this block | +| nonce | bytea | the block nonce is used to demonstrate the proof of work during mining | +| size | numeric | this block's size in bytes (limited by gas limit) | +| base\_fee\_per\_gas | numeric | this block's base fee (introduced by [EIP1559](https://eips.ethereum.org/EIPS/eip-1559)) | ## Ethereum.Logs -该表存储了智能合约生成的所有日志。它有时对于查询尚未解码或抗解码的合约很有用(我们需要一个 abi 密钥才能解码)。 +This Table stores all logs that get generated by smart contracts. It is sometimes useful for querying contracts that are not yet decoded or are resistant to being decoded(we need an abi key for that). -日志是一种以低廉的价格在以太坊区块链上存储少量数据的优雅方式。具体来说,事件日志有助于让其他人知道发生了什么事情,而不必单独查询合约。 +Logs are an elegant way to store tiny amounts of data on the Ethereum blockchain for a small price. Specifically, event logs are useful to let other people know something has happened without them having to query contracts individually. -关于此主题的更多信息请阅读 [这篇文章](https://medium.com/mycrypto/understanding-event-logs-on-the-ethereum-blockchain-f4ae7ba50378)。 +For more on this topic read [this article](https://medium.com/mycrypto/understanding-event-logs-on-the-ethereum-blockchain-f4ae7ba50378). -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | ----------------- | ------------ | ------------------------------------------------ | -| block\_hash | bytea | 该区块的唯一标识符 | -| block\_number | int8 | 区块链的长度(以块为单位) | -| block\_time | timestamptz | 区块被开采的时间 | -| contract\_address | bytea | 发出日志的合约地址 | -| data | bytea | 事件数据 | -| topic1 | bytea | 事件的索引主题1 | -| topic2 | bytea | 事件的索引主题2 | -| topic3 | bytea | 事件的索引主题3 | -| topic4 | bytea | 事件的索引主题4 | -| index | numeric | 区块中的交易索引位置 | -| tx\_hash | bytea | 事件的交易哈希 | -| tx\_index | numeric | 交易索引 | - -[**请自行看看**](https://dune.xyz/queries/38957) +| block\_hash | bytea | a unique identifier for that block | +| block\_number | int8 | the length of the blockchain in blocks | +| block\_time | timestamptz | the time when the block was mined | +| contract\_address | bytea | The address of the contract that emitted the log | +| data | bytea | event data | +| topic1 | bytea | indexed _keys_ of the event | +| topic2 | bytea | indexed _keys_ of the event | +| topic3 | bytea | indexed _keys_ of the event | +| topic4 | bytea | indexed _keys_ of the event | +| index | numeric | the transactions index position in the block | +| tx\_hash | bytea | the transaction hash of the event | +| tx\_index | numeric | the index of the transaction | + +[**Take a look for yourself**](https://dune.xyz/queries/38957) ## Ethereum.Transactions -| **列名** | **数据类型** | **说明** | -|------------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| block\_time | timestamptz | 区块被开采的时间 | -| nonce | numeric | 该钱包独有的交易随机数 | -| index | numeric | 区块中的交易索引位置 | -| success | boolean | 显示代交易是否成功的真/假值 | -| from | bytea | 发送者的地址 | -| to | bytea | 接收者的地址。当是合约创建交易时为NULL | -| value | numeric | 在此交易中发送的以 wei 为单位的以太币数量。请注意,erc20 代币不会出现在这里。 | -| block\_number | int8 | 区块链的长度(以块为单位) | -| block\_hash | bytea | 该区块的唯一标识符 | -| gas\_limit | numeric | 以 wei 为单位的 gas 限制 | -| gas\_price | numeric | 以 wei 为单位的 gas 价格 | -| gas\_used | numeric | 以 wei 为单位的交易消耗的 gas | -| data | bytea | 事件数据 | -| hash | bytea | 交易哈希 | -| type | text | 交易类型:`Legacy, AccessList,` 或者 `DynamicFee` | -| access\_list | jsonb | 交易打算访问的地址和存储密钥的列表。参见 [EIP 2930](https://eips.ethereum.org/EIPS/eip-2930)。适用于交易类型为 `AccessList` 或 `DynamicFee` 的情况 | -| max\_fee\_per\_gas | numeric | 交易发送者愿意支付的每单位 gas 的最高费用总额(由 [EIP1559](https://eips.ethereum.org/EIPS/eip-1559) 引入) | -| max\_priority\_fee\_per\_gas | numeric | 交易发送者愿意向矿工支付的每单位 gas 的最高费用,以激励他们包含他们的交易(由 [EIP1559](https://eips.ethereum.org/EIPS/eip-1559) 引入) | -| priority\_fee\_per\_gas | numeric | 本次交易支付给矿工的优先权费用(由 [EIP1559](https://eips.ethereum.org/EIPS/eip-1559) 引入) | - -\*\*\*\*[**请自行看看**](https://dune.xyz/queries/38964)\*\*\*\* +| **Column Name** | **datatype** | **Description** | +| ---------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| block\_time | timestamptz | the time when the block was mined | +| nonce | numeric | the transaction nonce, unique to that wallet | +| index | numeric | the transactions index position in the block | +| success | boolean | a true/false value that shows if the transaction suceeded | +| from | bytea | address of the sender | +| to | bytea | address of the receiver. Null when its a contract creation transaction | +| value | numeric | the amount of ether sent in this transaction in wei. note that erc20 tokens do not show up here. | +| block\_number | int8 | the length of the blockchain in blocks | +| block\_hash | bytea | a unique identifier for that block | +| gas\_limit | numeric | the gas limit in wei | +| gas\_price | numeric | the gas price in wei | +| gas\_used | numeric | the gas consumed by the transaction in wei | +| data | bytea | event data | +| hash | bytea | the hash of the transaction | +| type | text | the type of the transaction: `Legacy, AccessList,` or`DynamicFee` | +| access\_list | jsonb | a list of addresses and storage keys the transactions intends to access. See [EIP2930](https://eips.ethereum.org/EIPS/eip-2930). Applicable if the transaction is of type `AccessList` or `DynamicFee` | +| max\_fee\_per\_gas | numeric | the maximum fee per gas the transaction sender is willing to pay total (introduced by [EIP1559](https://eips.ethereum.org/EIPS/eip-1559)) | +| max\_priority\_fee\_per\_gas | numeric | maximum fee per gas the transaction sender is willing to give to miners to incentivize them to include their transaction (introduced by [EIP1559](https://eips.ethereum.org/EIPS/eip-1559)) | +| priority\_fee\_per\_gas | numeric | the priority fee paid out to the miner for this transaction (introduced by [EIP1559](https://eips.ethereum.org/EIPS/eip-1559)) | + +\*\*\*\*[**Take a look for yourself**](https://dune.xyz/queries/38964)\*\*\*\* ## Ethereum.Traces -代交易可以触发修改以太坊虚拟机内部状态的更小的原子动作。有关这些操作执行的信息会被记录下来,并且可以存储为 EVM 执行跟踪,或者简称_跟踪(trace)_。 - -在[这里](https://medium.com/chainalysis/ethereum-traces-not-transactions-3f0533d26aa)阅读更多信息。 - -| **列名** | **数据类型** | **说明** | -| --------------- | ------------ | ------------------------------------------------------------------------------------------------ | -| block\_time | timestamptz | 区块被开采的时间 | -| tx\_success | boolean | 显示代交易是否成功的真/假值 | -| success | boolean | 显示跟踪操作是否成功的真/假值 | -| block\_hash | bytea | 该区块的唯一标识符 | -| block\_number | int8 | 区块链的长度(以块为单位) | -| tx\_hash | bytea | 事件的交易哈希 | -| from | bytea | 发送者的地址 | -| to | bytea | 接收者的地址。当是合约创建交易时为NULL | -| value | numeric | 在此交易中发送的以 wei 为单位的以太币数量。请注意,erc20 代币不会出现在这里。| -| gas | numeric | gas 限制 | -| gas\_used | numeric | 以 wei 为单位的交易消耗的 gas | -| tx\_index | numeric | 交易索引 | -| trace\_address | array | 调用图森林中的跟踪地址。例如,[0, 2, 1] 是 [0, 2, 1, 0] 的父级。| -| sub\_traces | numeric | 子跟踪的数量 | -| type | text | 操作类型 | -| address | bytea | 当类型为自毁或创建时调用的合约 | -| code | bytea | 代码 | -| call\_type | bytea | 调用类型 | -| input | bytea | 输入数据 | -| output | bytea | 输出数据 | -| refund\_address | bytea | 退款地址 | - -\*\*\*\*[**请自行看看**](https://dune.xyz/queries/38730)\*\*\*\* - -**在使用 Dune 进行分析时,你可能不会过多地使用这些(请参阅** [**已解码数据**](../decoded-data.md)**),但拥有它们以防万一总是好的。** +Transactions can trigger smaller atomic actions that modify the internal state of the Ethereum Virtual Machine. Information about the execution of these actions is logged and can be found stored as an EVM execution trace, or just a _trace_. + +Read more [here](https://medium.com/chainalysis/ethereum-traces-not-transactions-3f0533d26aa). + +| **Column Name** | **datatype** | **Description** | +| --------------- | ------------ | ------------------------------------------------------------------------------------------------- | +| block\_time | timestamptz | the time when the block was mined | +| tx\_success | boolean | a true/false value that shows if the transaction succeeded | +| success | boolean | a true/false value that shows if the trace action succeeded | +| block\_hash | bytea | a unique identifier for that block | +| block\_number | int8 | the length of the blockchain in blocks | +| tx\_hash | bytea | the transaction hash of the event | +| from | bytea | address of the sender | +| to | bytea | address of the receiver. Null when its a contract creation transaction | +| value | numeric | the amount of ether sent in this transaction in wei. note that erc20 tokens do not show up here. | +| gas | numeric | | +| gas\_used | numeric | the gas consumed by the transaction in wei | +| tx\_index | numeric | the index of the transaction | +| trace\_address | array | address of the trace within the call graph forest. E.g., \[0, 2, 1] is a parent of \[0, 2, 1, 0]. | +| sub\_traces | numeric | number of children of a trace | +| type | text | type of action | +| address | bytea | the contract that is called when the type is suicide or create | +| code | bytea | | +| call\_type | bytea | the type of the call | +| input | bytea | | +| output | bytea | | +| refund\_address | bytea | | + +\*\*\*\*[**Take a look for yourself**](https://dune.xyz/queries/38730)\*\*\*\* + +**You probably won’t use these too much when doing analysis with Dune (see** [**decoded data**](../decoded-data.md)**), but it’s always nice to have just in case.** diff --git a/data-tables/data-tables/raw-data/xdai-data.md b/data-tables/data-tables/raw-data/xdai-data.md index 803759f..e5ccf36 100644 --- a/data-tables/data-tables/raw-data/xdai-data.md +++ b/data-tables/data-tables/raw-data/xdai-data.md @@ -1,93 +1,93 @@ -# xDai 数据 +# xDai Data ### xDai.Blocks -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | ----------------- | ------------ | ---------------------------------------------------------------------- | -| time | timestamptz | 区块被开采的时间 | -| number | numeric | 区块链的长度(以块为单位) | -| hash | bytea | 该区块的唯一标识符 | -| parent hash | bytea | 前一个区块的唯一标识符 | -| gas\_limit | numeric | 当前区块的gas限制 | -| gas\_used | numeric | 此块中使用的gas数量 | -| miner | bytea | 矿工的地址 | -| difficulty | numeric | 开采区块所需的难度值 | -| total\_difficulty | numeric | 直到这个区块链的总难度值 | -| nonce | bytea | 区块随机数,用于展示挖矿过程中的工作量证明 | -| size | numeric | 此块的大小(以字节为单位)(受限于gas limit) | +| time | timestamptz | the time when the block was mined. | +| number | numeric | the length of the blockchain in blocks | +| hash | bytea | a unique identifier for that block | +| parent hash | bytea | the unique identifier for the prior block | +| gas\_limit | numeric | the gas limit of the current block | +| gas\_used | numeric | the gas used in this block | +| miner | bytea | the address of the miner | +| difficulty | numeric | the effort required to mine the block | +| total\_difficulty | numeric | total difficulty of the chain until this block | +| nonce | bytea | the block nonce is used to demonstrate the proof of work during mining | +| size | numeric | this block's size in bytes (limited by gas limit) | ### ### xDai.Logs -该表存储了智能合约生成的所有日志。它有时对于查询尚未解码或抗解码的合约很有用(我们需要一个 abi 密钥才能解码)。 +This Table stores all logs that get generated by smart contracts. It is sometimes useful for querying contracts that are not yet decoded or are resistant to being decoded(we need an abi key for that). -日志是一种以低廉的价格在以太坊区块链上存储少量数据的优雅方式。具体来说,事件日志有助于让其他人知道发生了什么事情,而不必单独查询合约。 +Logs are an elegant way to store tiny amounts of data on the Ethereum blockchain for a small price. Specifically, event logs are useful to let other people know something has happened without them having to query contracts individually. -有关此主题的更多信息,请阅读 [这篇文章](https://medium.com/mycrypto/understanding-event-logs-on-the-ethereum-blockchain-f4ae7ba50378)。 +For more on this topic read [this article](https://medium.com/mycrypto/understanding-event-logs-on-the-ethereum-blockchain-f4ae7ba50378). -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | ----------------- | ------------ | ------------------------------------------------ | -| block\_hash | bytea | 该区块的唯一标识符 | -| block\_number | int8 | 区块链的长度(以块为单位) | -| block\_time | timestamptz | 区块被开采的时间 | -| contract\_address | bytea | 发出日志的合约地址 | -| data | bytea | 事件数据 | -| topic1 | bytea | 事件的索引主题1 | -| topic2 | bytea | 事件的索引主题2 | -| topic3 | bytea | 事件的索引主题3 | -| topic4 | bytea | 事件的索引主题4 | -| index | numeric | 区块中的交易索引位置 | -| tx\_hash | bytea | 事件的交易哈希 | -| tx\_index | numeric | 交易索引 | +| block\_hash | bytea | a unique identifier for that block | +| block\_number | int8 | the length of the blockchain in blocks | +| block\_time | timestamptz | the time when the block was mined | +| contract\_address | bytea | The address of the contract that emitted the log | +| data | bytea | event data | +| topic1 | bytea | indexed _keys_ of the event | +| topic2 | bytea | indexed _keys_ of the event | +| topic3 | bytea | indexed _keys_ of the event | +| topic4 | bytea | indexed _keys_ of the event | +| index | numeric | the transactions index position in the block | +| tx\_hash | bytea | the transaction hash of the event | +| tx\_index | numeric | the index of the transaction | ### xDai.Transactions -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | --------------- | ------------ | ------------------------------------------------------------------------------------------------ | -| block\_time | timestamptz | 区块被开采的时间 | -| nonce | numeric | 该钱包独有的交易随机数 | -| index | numeric | 区块中的交易索引位置 | -| success | boolean | 显示代交易是否成功的真/假值 | -| from | bytea | 发送者的地址 | -| to | bytea | 接收者的地址。当是合约创建交易时为空(NULL) | -| value | numeric | 在此交易中发送的以 wei 为单位的以太币数量。请注意,erc20 代币不会出现在这里。| -| block\_number | int8 | 区块链的长度(以块为单位) | -| block\_hash | bytea | 该区块的唯一标识符 | -| gas\_limit | numeric | 以 wei 为单位的 gas 限制 | -| gas\_price | numeric | 以 wei 为单位的 gas 价格 | -| gas\_used | numeric | 以 wei 为单位的交易中消耗的 gas 数量 | -| data | bytea | 事件数据 | -| hash | bytea | 交易哈希 | +| block\_time | timestamptz | the time when the block was mined | +| nonce | numeric | the transaction nonce, unique to that wallet | +| index | numeric | the transactions index position in the block | +| success | boolean | a true/false value that shows if the transaction suceeded | +| from | bytea | address of the sender | +| to | bytea | address of the receiver. Null when its a contract creation transaction | +| value | numeric | the amount of ether sent in this transaction in wei. note that erc20 tokens do not show up here. | +| block\_number | int8 | the length of the blockchain in blocks | +| block\_hash | bytea | a unique identifier for that block | +| gas\_limit | numeric | the gas limit in wei | +| gas\_price | numeric | the gas price in wei | +| gas\_used | numeric | the gas consumed by the transaction in wei | +| data | bytea | event data | +| hash | bytea | the hash of the transaction | ### xDai.Traces -交易可以触发修改以太坊虚拟机内部状态的更小的原子操作。有关这些操作执行的信息会被记录下来,并且可以存储为 EVM 执行跟踪,或者简称_跟踪(trace)_。 + Transactions can trigger smaller atomic actions that modify the internal state of the Ethereum Virtual Machine. Information about the execution of these actions is logged and can be found stored as an EVM execution trace, or just a _trace_.\ +\ +Read more [here](https://medium.com/chainalysis/ethereum-traces-not-transactions-3f0533d26aa). -在[这里](https://medium.com/chainalysis/ethereum-traces-not-transactions-3f0533d26aa) 阅读更多信息. - -| **列名** | **数据类型** | **说明** | +| **Column Name** | **datatype** | **Description** | | --------------- | ------------ | ------------------------------------------------------------------------------------------------ | -| block\_time | timestamptz | 区块被开采的时间 | -| tx\_success | boolean | 显示代交易是否成功的真/假值 | -| success | boolean | 显示跟踪(trace)是否成功的真/假值 | -| block\_hash | bytea | 该区块的唯一标识符 | -| block\_number | int8 | 区块链的长度(以块为单位) | -| tx\_hash | bytea | 事件的交易哈希 | -| from | bytea | 发送者的地址 | -| to | bytea | 接收者的地址。当是合约创建交易时为空(NULL) | -| value | numeric | 在此交易中发送的以 wei 为单位的以太币数量。请注意,erc20 代币不会出现在这里。| -| gas | numeric | gas 限制 | -| gas\_used | numeric | 以 wei 为单位的交易中消耗的 gas 数量 | -| tx\_index | numeric | 交易索引 | -| trace\_address | | 跟踪地址 | -| sub\_traces | | 子跟踪的数量 | -| type | text | 操作类型 | -| address | bytea | 当类型为自毁或创建时调用的合约地址 | -| code | bytea | 代码 | -| call\_type | bytea | 调用类型 | -| input | bytea | 输入数据 | -| output | bytea | 输出数据 | -| refund\_address | bytea | 退款地址 | +| block\_time | timestamptz | the time when the block was mined | +| tx\_success | boolean | a true/false value that shows if the transaction succeeded | +| success | boolean | a true/false value that shows if the trace action succeeded | +| block\_hash | bytea | a unique identifier for that block | +| block\_number | int8 | the length of the blockchain in blocks | +| tx\_hash | bytea | the transaction hash of the event | +| from | bytea | address of the sender | +| to | bytea | address of the receiver. Null when its a contract creation transaction | +| value | numeric | the amount of ether sent in this transaction in wei. note that erc20 tokens do not show up here. | +| gas | numeric | | +| gas\_used | numeric | the gas consumed by the transaction in wei | +| tx\_index | numeric | the index of the transaction | +| trace\_address | | | +| sub\_traces | | | +| type | text | type of action | +| address | bytea | the contract that is called when the type is suicide or create | +| code | bytea | | +| call\_type | bytea | the type of the call | +| input | bytea | | +| output | bytea | | +| refund\_address | bytea | | -**在使用 Dune 进行分析时,你可能不会过多地使用这些(请参阅** [**已解码数据**](../decoded-data.md)**),但拥有它们以防万一总是好的。** +**You probably won’t use these too much when doing analysis with Dune (see** [**decoded data**](../decoded-data.md)**), but it’s always nice to have just in case.** diff --git a/data-tables/data-tables/solana-data/README.md b/data-tables/data-tables/solana-data/README.md index f8e1890..2578bd4 100644 --- a/data-tables/data-tables/solana-data/README.md +++ b/data-tables/data-tables/solana-data/README.md @@ -1,155 +1,158 @@ --- -说明: >- - 我们的数据库自动从 Solana 区块链中提取原始数据, - 并根据表格关注的方面将它们解析为不同的表格。 +description: >- + Our database automatically pulls in raw data from the Solana Blockchain and + parses them into different tables depending on which aspect that table is + focused on. --- -# Solana 数据 +# Solana Data -下面的所有表格都是在 Dune 平台的更新版本中构建的,需要对 wizards 在平台中编写查询的方式进行轻微更改。新的数据平台利用 Spark 来提高查询速度、数据规模并支持多链查询。 +All of the tables below are built in an updated version of the Dune platform that will require a slight change to how wizards write queries in the platform. The new data platform leverages spark to increase query speed, data scale, and to support multi-chain queries. -在你开始查询 Solana 表时使用的参考文档可在此处获得: +A reference document to use as you start to query the Solana tables is available here: {% embed url="https://spark.apache.org/docs/latest/sql-ref-ansi-compliance.html" %} ## Solana.blocks -该表包含 Solana 区块链中的区块数据。它可用于识别区块活动和随时间的交易变化。 +This table contains the block data within Solana’s blockchain. It can be used to identify block activity and transaction changes over time. -查询示例可在此处找到:[随着时间推移的 Solana 区块](https://dune.xyz/queries/389979) 和 [每日交易](https://dune.xyz/queries/390045) +Query examples can be found here: [Solana blocks over time](https://dune.xyz/queries/389979) and [Transactions per day](https://dune.xyz/queries/390045) -| 列名 | 数据类型 | 说明 | -| ------------------------ | ----------- | --------------------------------------------------- | -| hash | string | 此区块的哈希,base-58 编码 | -| height | bigint | 该区块之下的块数 | -| slot | bigint | 该区块在账本中的槽索引 | -| time | timestamp | 这个区块的(估计)生成时间 | -| date | date | 用于分区 | -| parent\_slot | bigint | 该区块的父区块的槽索引 | -| previous\_block_\__hash | string | 此区块的父区块的哈希,base-58 编码 | -| total\_transactions | bigint | 该区块的交易总数 | -| successful\_transactions | bigint | 该区块成功交易的数量 | -| failed\_transactions | bigint | 该区块中失败的交易数量 | +| Column Name | Column Type | Description | +| ------------------------- | ----------- | --------------------------------------------------- | +| hash | string | string The hash of this block, base-58 encoded | +| height | bigint | The number of blocks beneath this block | +| slot | bigint | This block’s slot index in the ledger | +| time | timestamp | The (estimated) time this block was produced | +| date | date | Used to partition by | +| parent\_slot | bigint | The slot index of this block's parent | +| previous\_block\_\_\_hash | string | The hash of this block's parent, base-58 encoded | +| total\_transactions | bigint | The total number of transactions in this block | +| successful\_transactions | bigint | The number of successful transactions in this block | +| failed\_transactions | bigint | The number of failed transactions in this block | ## Solana.transactions -该表包含 Solana 区块链中的交易数据。此表中提供了与帐户、协议和程序活动相关的大多数相关数据。 - -查询示例可以在这里找到:[过去 7 天热门项目的 NFT 交易](https://dune.xyz/queries/390720/745376) 和 [drift-protocol 概述](https://dune.xyz/bigz/drift-\(solana\)) - -| 列名 | 数据类型 | 说明 | -| ------------------------------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| block\_slot | bigint | 该区块在账本中的槽索引 | -| block\_time | timestamp | 这个区块的(估计)生成时间 | -| block\_date | date | 事件日期 | -| index | bigint | 索引区块的交易 | -| fee | bigint | 此交易收取的费用,由第一个帐户支付 | -| block\_hash | string | 此区块的哈希,base-58 编码 | -| error | STRUCT error | 如果 success = true 则为 NULL true. | -| required\_signatures | bigint | 使交易有效所需的签名总数。 | -| readonly\_signed_\__accounts | bigint | 签名密钥的最后一个 readonly\_signed\_accounts 是只读帐户。 | -| readonly\_unsigned_\__accounts | bigint | 未签名密钥的最后一个 readonly\_unsigned\_accounts 是只读帐户。 | -| id | string | 交易哈希 | -| success | boolean | 交易是否成功 | -| recent\_block_\__hash | string | 账本中最近区块的哈希值,用于防止交易重复并赋予交易生命周期 | -| instructions | array\ | 执行的指令数组(按顺序) | -| accountKeys | array\ | 交易中使用的帐户地址 | -| log\_messages | array\ | 代交易发出的日志消息 | -| pre\_balances | array\ | 处理交易之前的账户余额数组。第 i 个余额是 account\_keys 中第 i 个账户的余额 | -| post\_balances | array\ | 处理交易后的账户余额数组。第 i 个余额是 account\_keys 中第 i 个账户的余额 | -| pre\_token\_balance | array\ | 交易处理前的 [代币余额](https://docs.solana.com/developing/clients/jsonrpc-api#token-balances-structure) 列表,如果在此交易期间尚未启用代币余额记录,则省略 | -| post\_token\_balance | array\ | 交易处理后的 [代币余额](https://docs.solana.com/developing/clients/jsonrpc-api#token-balances-structure) 列表,如果在此交易期间尚未启用代币余额记录,则省略 | -| signatures | array\ | 应用于交易的 base-58 编码签名列表。总是长度为 numRequiredSignatures | -| signer | string | 发起交易并支付交易费用的 account\_keys 数组的初始值 | - -### 结构定义 - -在其中的几个列中是一种数据类型 STRUCT,它允许表示嵌套的分层数据并具有键值对。它类似于 python 中的字典,可用于将字段组合在一起以使它们更易于访问。 - -一个如何用这些结构字段提取数据的示例:[按天统计 DEXes 的 Solana 指令数](https://dune.xyz/queries/416358/794290) +This table contains the transaction data within Solana’s blockchain. Most of the relevant data related to account, protocol, and program activity is available in this table. + +Query examples can be found here: [NFT transactions of popular programs past 7 days](https://dune.xyz/queries/390720/745376) and [drift-protocol overview](https://dune.xyz/bigz/drift-\(solana\)) + +| Column Name | Column Type | Description | +| -------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| block\_slot | bigint | This block’s slot index in the ledger | +| block\_time | timestamp | The (estimated) time this block was produced | +| block\_date | date | Event date | +| index | bigint | Index into the block’s transactions | +| fee | bigint | Fee this transaction was charged, as paid by first account | +| block\_hash | string | The hash of this block, base-58 encoded | +| error | STRUCT error | NULL if success is true. | +| required\_signatures | bigint | The total number of signatures required to make the transaction valid. | +| readonly\_signed\_\_\_accounts | bigint | The last readonly\_signed\_accounts of the signed keys are read-only accounts. | +| readonly\_unsigned\_\_\_accounts | bigint | The last readonly\_unsigned\_accounts of the unsigned keys are read-only accounts. | +| id | string | The first signature in the transaction | +| success | boolean | The transaction was valid and thus committed. | +| recent\_block\_\_\_hash | string | The hash of a recent block in the ledger, used to prevent transaction duplication and to give transactions lifetimes | +| instructions | array\ | Instructions to execute (in order) | +| accountKeys | array\ | The account keys used in the transaction | +| log\_messages | array\ | The log messages emitted by the transaction | +| pre\_balances | array\ | Array of account balances before the transaction was processed. The i-th balance is the balance of the i-th account key in account\_keys | +| post\_balances | array\ | Array of account balances after the transaction was processed. The i-th balance is the balance of the i-th account key in account\_keys | +| pre\_token\_balance | array\ | List of [token balances](https://docs.solana.com/developing/clients/jsonrpc-api#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction | +| post\_token\_balance | array\ | List of [token balances](https://docs.solana.com/developing/clients/jsonrpc-api#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction | +| signatures | array\ | A list of base-58 encoded signatures applied to the transaction. Always of length numRequiredSignatures | +| signer | string | The initial value from the account\_keys array that initiates the transaction and pays the transaction fee | + +### Struct definitions + +Within several of these columns is a data type of STRUCT which allows for representing nested hierarchical data and has key-value pairs. It's similar to a dictionary in python and can be used to group fields together to make them more accessible. + +An example of how these can be used to extract data: [# of Solana instructions by day for DEXes](https://dune.xyz/queries/416358/794290) **token\_balance** -| 列名 | 数据类型 | 说明 | +| Field | Data type | Description | | ------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| account | string | 提供代币余额的帐户的帐户地址。 | -| mint | string | 代币铸造合约的公钥。这是一个存储有关代币元数据的帐户:供应量、小数位数以及控制铸造的各种权限。| -| amount | Decimal | 源自代币余额的原始金额 (ui\_token\_amount.amount) 和小数位数 (ui\_token\_amount.decimals) | +| account | string | The account key of the account that the token balance is provided for. | +| mint | string | Public key of the token’s mint. This is an account that stores metadata about the token: The supply, number of decimals, and various authorities with control over the mint. | +| amount | Decimal | Derived from the token balance's raw amount (ui\_token\_amount.amount) and the number of decimals (ui\_token\_amount.decimals) | -**** +*** **instructions** -| 列名 | 数据类型 | 说明 | +| Field | Data type | Description | | ------------------- | ---------------------------------- | -------------------------------------------------------------- | -| account\_arguments | array\ | 要传递给程序的帐户的有序列表 | -| data | string | 以 base-58 编码的程序输入数据 | -| executing\_account | string | 执行此指令的程序的帐户地址 | -| inner\_instructions | array\ | 该指令调用的指令 | +| account\_arguments | array\ | Ordered list of accounts to pass to the program | +| data | string | Program input data in a base-58 string | +| executing\_account | string | The account key of the program that executed this instruction. | +| inner\_instructions | array\ | The instructions invoked by this instruction. | -**** +*** **inner\_instructions** -| 列名 | 数据类型 | 说明 | +| Field | Data type | Description | | ------------------ | -------------- | -------------------------------------------------------------- | -| account\_arguments | array\ | 要传递给程序的帐户的有序列表 | -| data | string | 以 base-58 编码的程序输入数据 | -| executing\_account | string | 执行此指令的程序的帐户地址 | +| account\_arguments | array\ | Ordered list of accounts to pass to the program | +| data | string | Program input data in a base-58 string | +| executing\_account | string | The account key of the program that executed this instruction. | -**** +*** **error** -| 列名 | 数据类型 | 说明 | +| Field | Data type | Description | | ---------------------- | --------- | ---------------------------------- | -| **instruction\_index** | int | 失败的指令号 | -| message | string | 错误信息 | +| **instruction\_index** | int | The instruction number that failed | +| message | string | The error message | ## Solana.vote\_transactions -该表包含验证者提交的用于对区块进行投票的全部投票交易。它可以与上面的非投票交易表结合起来,以获得所有交易的完整细分。它与主代交易表(transactions)具有相同的架构。 +This table contains the full set of vote transactions that are submitted by validators to vote on a block. It can be joined with the non-vote transactions table above to get a full breakdown of all transactions. It has the same schema as the main transactions table. -此处提供了一个演示示例查询:[Solana 过去 30 天的交易](https://dune.xyz/queries/389976/743760) +An example query that demonstrates that is available here: [Solana transactions past 30 days](https://dune.xyz/queries/389976/743760) ## Solana.rewards -此表包含有关在 Solana 上支付的奖励的数据。一个区块可能包含零个或多个奖励,每一行对应一个奖励。 +This table contains data about rewards paid out on Solana. One block may contain zero or more rewards, and each row corresponds to one reward. -可以在此处找到示例查询:[Solana 每天奖励费用](https://dune.xyz/queries/391421/747012) +An example query can be found here: [Solana rewards fee per day](https://dune.xyz/queries/391421/747012) -| 列名 | 数据类型 | 说明 | +| Column Name | Column Type | Description | | ------------- | ----------- | ------------------------------------------------------------------------------------------------- | -| block\_slot | bigint | 该区块在账本中的槽索引 | -| block\_hash | string | 此区块的哈希,base-58 编码 | -| block\_time | timestamp | 这个区块的(估计)生成时间 | -| block\_date | date | 事件日期 | -| commission | string | 奖励入账时的投票账户佣金,仅用于投票和质押奖励 | -| lamports | bigint | 账户贷记或借记的奖励 lamports 数量 | -| pre\_balance | bigint | 应用奖励前的账户余额(lamports) | -| post\_balance | bigint | 应用奖励后的账户余额(lamports) | -| recipient | string | 收到奖励的账户的公钥,以 base-58 编码的字符串 | -| reward\_type | string | 奖励类型:"fee", "rent", "voting", "staking" | +| block\_slot | bigint | This block’s slot index in the ledger | +| block\_hash | string | The hash of this block, base-58 encoded | +| block\_time | timestamp | The (estimated) time this block was produced | +| block\_date | date | Event date | +| commission | string | Vote account commission when the reward was credited, only present for voting and staking rewards | +| lamports | bigint | Number of reward lamports credited or debited by the account | +| pre\_balance | bigint | Account balance in lamports before the reward was applied | +| post\_balance | bigint | Account balance in lamports after the reward was applied | +| recipient | string | The public key, as base-58 encoded string, of the account that received the reward | +| reward\_type | string | Type of reward: "fee", "rent", "voting", "staking" | ## Solana.account\_activity -此表包含来自交易表中的信息,主要关注帐户使用情况。每行包含有关交易中帐户使用情况的所有信息。 - -| 列名 | 数据类型 | 说明 | -| ------------------------ | ----------- | ---------------------------------------------------------------- | -| block\_slot | bigint | 该交易所在区块的槽位。 | -| block\_hash | string | 该交易所在区块的哈希值 | -| block\_time | timestamp | 此帐户使用发生的时间戳 | -| block\_date | date | 此帐户使用发生的日期 | -| address | string | 账户地址,也称为公钥 | -| tx\_index | int | 该交易在区块中的索引 | -| tx\_id | string | 发生此帐户使用的交易的 ID | -| tx\_success | boolean | 代交易是否成功并已提交 | -| signed | boolean | 此帐户是否签署了此交易 | -| writeable | boolean | 此帐户是否在此交易中被授予读写权限 | -| pre\_balance | bigint | 该账户在交易处理前的余额 | -| pre\_token_\__balance | decimal | 交易处理前的代币余额 | -| post\_balance | bigint | 交易处理后该账户的余额 | -| post\_token_\__balance | decimal | 交易处理后的代币余额 | -| balance\_change | bigint | 作为交易的一部分发生的余额变化 | -| token\_balance_\__change | decimal | 作为交易的一部分发生的代币余额变化 | +This table contains information from the transactions table focused on account usage. Each row contains all information about an account's usage in a transaction. + +An example query can be found here: + +| Column Name | Column Type | Description | +| -------------------------- | ----------- | ---------------------------------------------------------------- | +| block\_slot | bigint | The slot of the block this transaction was in. | +| block\_hash | string | The hash of the block this transaction was in | +| block\_time | timestamp | The timestamp that this account usage occurred | +| block\_date | date | The date this account usage occurred | +| address | string | The address of the account, also referred to as public key | +| tx\_index | int | The index of this transaction in the block | +| tx\_id | string | The ID of the transaction in which this account usage occurred | +| tx\_success | boolean | The transaction succeeded and was committed | +| signed | boolean | This account signed this transaction | +| writeable | boolean | This account was granted read-write access in this transaction | +| pre\_balance | bigint | The balance of this account before the transaction was processed | +| pre\_token\_\_\_balance | decimal | The token balance before the transaction was processed | +| post\_balance | bigint | The balance of this account after the transaction was processed | +| post\_token\_\_\_balance | decimal | The token balance after the transaction was processed | +| balance\_change | bigint | The balance change that occurred as part of the transaction | +| token\_balance\_\_\_change | decimal | The balance change that occurred as part of the transaction | diff --git a/data-tables/data-tables/solana-data/changelog.md b/data-tables/data-tables/solana-data/changelog.md index a9f1131..494cc7f 100644 --- a/data-tables/data-tables/solana-data/changelog.md +++ b/data-tables/data-tables/solana-data/changelog.md @@ -1,46 +1,47 @@ --- -说明: >- - 更改日志包含在测试版中对 Solana 表进行的更新。 +description: >- + The changelog contains the updates being made to the Solana tables while in + beta. --- -# 更改日志 +# Changelog ### 2022-03-25 -`solana.account_activity` 表已更新为新版本。该表的新版本包含有关代币活动的附加信息。新增了以下列到表中: +the `solana.account_activity` table has been updated to a new version. The new version of the table contains additional information around token activity. The following columns were added to the table: * `pre_token_balances` - * 交易处理前的代币余额 + * The token balance before the transaction was processed * `post_token_balances` - * 交易处理后的代币余额 + * The token balance after the transaction was processed * `token_balance_changes` - * 作为交易的一部分发生的余额变化 + * The balance change that occurred as part of the transaction ### 2022-03-18 -发布了 `solana.account_activity` 表,其中包含有关交易中帐户使用情况的所有信息。 +Released the `solana.account_activity` table that contains all of the information about an account’s usage in a transaction. -该表经过优化,可以使用“WHERE address = ...”查询运行。 +The table is optimized to run with ‘WHERE address = …’ queries ### 2022-03-01 -`solana.transactions` 表现已升级到新版本。新版本的表使用更简洁的数组结构,以便更容易地提取有用信息。 +The `solana.transactions` table has now been upgraded to a new version. The new version of the table uses cleaner array structs to make it easier to extract useful information. -投票代交易也被拆分到自己的表 `solana.vote_transactions` 中,因此使用 `solana.transactions` 的查询将具有更好的性能。不幸的是,此表的修改也意味着一些现有查询现在将会中断并需要更改。 +The vote transactions have also been split into their own table `solana.vote_transactions`, so queries using `solana.transactions` will have better performance. Unfortunately, the table change also means that some existing queries will now break and need to be changed. -这对使用 `solana.transactions` 的现有查询意味着什么: +What this means for your existing queries using `solana.transactions`: -* 你无需检查交易是否为投票交易,这通常使用 `WHERE ARRAY_CONTAINS(account_keys, "Vote111111111111111111111111111111111111111") = false` 来完成。 -* `error_index` 和 `error_message` 列已被删除,并已合并到 `error` 列(这是一个结构)。所以现在查询应该用 `WHERE error is not null` 而不是用 `WHERE error_index is not null`。 -* 包含 `account_keys` 索引的结构现在直接包含帐户地址,因此无需再使用 `account_keys` 列来查找帐户地址: +* You won't need to check if a transaction is a vote transaction, which has typically been done with `WHERE ARRAY_CONTAINS(account_keys, "Vote111111111111111111111111111111111111111") = false` +* The `error_index` and `error_message` columns have been removed, and have been merged into the `error` column (which is a struct). So now instead of `WHERE error_index is not null`, a query should do `WHERE error is not null`. +* Structs containing indexes to `account_keys` now include the account address directly, so there is no need to use the `account_keys` column to look up the account addresses: ``` -以前 -> 现在 +before -> now account_keys[instructions[i]['program_id_index']] -> instructions[i].executing_account account_keys[pre_token_balances[i]['account_index']] -> pre_token_balances[i].account account_keys[post_token_balances[i]['account_index']] -> post_token_balances[i].account ``` -* `pre_token_balances` 和 `post_token_balances` 列已更改。代币余额现在包含在 `amount` 字段中。并且如上所述,数组中的结构现在有一个字段 `account`,这是代币余额的帐户。 -* `instructions` 列已更改。如上所述,数组中的结构现在有一个字段 `executing_account`,它是执行指令的帐户。 -* `inner_instructions` 列被删除,内部指令已移至 `instructions` 列。 +* The `pre_token_balances` and `post_token_balances` columns have changed. The token balance is now included in the field `amount`. And as mentioned above, the struct in the array now has a field `account`, which is the account of the token balance. +* The `instructions` column has changed. As mentioned above, the struct in the array now has a field `executing_account`, which is the account executing the instruction. +* The `inner_instructions` column is removed, and inner instructions have been moved into the `instructions` column. diff --git a/data-tables/data-tables/special-tables.md b/data-tables/data-tables/special-tables.md index 9abe053..4a2b52b 100644 --- a/data-tables/data-tables/special-tables.md +++ b/data-tables/data-tables/special-tables.md @@ -1,42 +1,42 @@ -# 代币标准 +# Token standards -## 接口 +## Interfaces -当我们对触发的事件子集感兴趣时,无论原始合约如何,Dune 都会使用接口解码。值得注意的例子包括 erc20、erc721 和 erc1155 转移事件。此方法保留用于特殊情况。这些表格让跟踪 ERC20 代币和 NFT 流入和流出合约和钱包变得轻松,在 Dune 上得到广泛使用。 +When we’re interested in a subset of events fired regardless of the origin contract, Dune uses interface-decoding. Notable examples include erc20, erc721 and erc1155 transfer events. This method is reserved for special cases. These tables make it easy to keep track of ERC20 tokens and NFT's flowing in and out of contracts and wallets and are widely used across dune. **erc20."ERC20\_evt\_Transfer"** -| **列名** | **数据类型** | **说明** | +| column name | **data type** | **description** | | ------------------ | ------------- | -------------------------------------------------------------------------------------------------------------- | -| from | bytea | 交易发送者 | -| to | bytea | 交易接收者 | -| value | numeric | 发送的 erc20 代币数量。请注意,你已将其除以 erc20 代币的相关小数位。| -| contract\_address | bytea | erc20 代币的合约地址 | -| evt\_tx\_hash | bytea | 交易哈希 | -| evt\_index | numeric | 交易索引 | -| evt\_block\_time | timestamptz | 交易发生时间 | -| evt\_block\_number | int8 | 区块链的长度(区块编号) | +| from | bytea | the transactions sender | +| to | bytea | the transaction receiver | +| value | numeric | the amount of erc20 tokens sent. Notice that you have divide this by the relevant decimals of the erc20 token. | +| contract\_address | bytea | the contract\_address of the erc20 token | +| evt\_tx\_hash | bytea | the transaction hash | +| evt\_index | numeric | the transaction index | +| evt\_block\_time | timestamptz | the time at which the transaction occurred | +| evt\_block\_number | int8 | the length of the blockchain | -[查看此表的实际操作](https://dune.xyz/queries/39012) +[See this table in action](https://dune.xyz/queries/39012) **erc721."ERC721\_evt\_Transfer"** -| **列名** | **数据类型** | **说明** | +| **c**olumn name | **data type** | **description** | | ------------------ | ------------- | ----------------------------------------------- | -| from | bytea | 交易发送者 | -| to | bytea | 交易接收者 | -| tokenID | numeric | 唯一标识此 NFT 的 Token ID | -| contract\_address | bytea | erc721 代币的合约地址 | -| evt\_tx\_hash | bytea | 交易哈希 | -| evt\_index | numeric | 交易索引 | -| evt\_block\_time | timestamptz | 交易发生时间 | -| evt\_block\_number | int8 | 区块链的长度(区块编号) | +| from | bytea | the transactions sender | +| to | bytea | the transaction receiver | +| tokenID | numeric | The Token ID which uniquely identifies this NFT | +| contract\_address | bytea | the contract\_address of the erc20 token | +| evt\_tx\_hash | bytea | the transaction hash | +| evt\_index | numeric | the transaction index | +| evt\_block\_time | timestamptz | the time at which the transaction occurred | +| evt\_block\_number | int8 | the length of the blockchain | -[查看此表的实际操作](https://dune.xyz/queries/38974) +[See this table in action](https://dune.xyz/queries/38974) -你可以使用此查询查询特殊表: +You can query for special tables using this query: -**已根据“接口”解码的合约列表** +**Contracts that are “interface”-decoded** ```sql SELECT * FROM ethereum."contracts" WHERE address IS NULL; diff --git a/data-tables/data-tables/user-generated.md b/data-tables/data-tables/user-generated.md index e454daa..43e58b3 100644 --- a/data-tables/data-tables/user-generated.md +++ b/data-tables/data-tables/user-generated.md @@ -1,27 +1,27 @@ --- -说明: >- - dune_user_generated 模式是一种在我们的数据库中构建你自己的视图、函数或表的简单方法。 +description: >- + The Schema dune_user_generated is an easy way to construct your own view, + function or table inside of our database. --- -# 用户生成表 +# User Generated -#### 请注意,这些表不保证包含数据的准确性,如果不是你自己创建的,请谨慎使用。 +#### Note that these tables are not guaranteed to contain correct data, please use these with caution if you haven't created them yourself. -**请始终为你的视图保存构造函数参数。有时我们必须删除视图以便能够更改一些解码问题或代理依赖关系,你可能必须重新部署你的视图。** +**Always save the constructor arguments for your views. Sometimes we have to drop views in order to be able to change some decoding troubles or proxy dependencies and you might have to redeploy your view.** -## 用例 +## Usecases -你可以通过多种方式在 Dune 中使用自己的视图和表格,从而更轻松地在 Dune 上处理数据。 +There is several ways in which you can utilize your own views and tables inside of Dune to make working with your data on Dune even easier.\ +Your own tables, views and function all have an important part to play in creating content on Dune and make maintenance of your dashboards and queries easier if used correctly. -你自己的表、视图和函数都可以在 Dune 上创建内容方面发挥重要作用,如果使用得当,可以更轻松地维护仪表盘和查询。 +If you are unfamiliar with tables, views, materialized views and functions please consult the [pgSQL documentation](https://www.postgresqltutorial.com/postgresql-views/) or check out our [Tutorials](../../about/tutorials/). -如果你不熟悉表、视图、物化视图和函数,请查阅 [pgSQL 文档](https://www.postgresqltutorial.com/postgresql-views/) 或查看我们的 [教程](../../about/tutorials/)。 +### Storing Information -### 存储信息 +Sometimes certain references or information that you do need for your data extraction are not properly stored in available tables or stored in many different tables, which would makes the query quite hard to work with. In these cases, you are best off storing the necessary information in a view and referencing that view. -有时,数据提取所需的某些参考或信息未正确存储在可用表中或存储在许多不同的表中,这会使查询非常难以处理。在这些情况下,你最好将必要的信息存储在视图中并引用该视图。 - -这方面的一个例子是将某些金库或借贷代币映射到它们各自的基础代币。 +An example of this would be the mapping of certain vault or lending tokens to their respective underlying tokens. ```sql CREATE OR REPLACE VIEW dune_user_generated.view_test (symbol, contract_address, decimals, underlying_token_address) AS VALUES @@ -34,25 +34,24 @@ CREATE OR REPLACE VIEW dune_user_generated.view_test (symbol, contract_address, ('yBTC'::text, '\x04EF8121aD039ff41d10029c91EA1694432514e9'::bytea, 8::numeric, '\x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'::bytea) ``` -此表生成一个视图,你可以在你的查询中将它用于关联(join)。 - -[看看这个表](https://dune.xyz/queries/41577). +This table generates a view that you can use to join on your query. -### 聚合数据 +[Look at the table](https://dune.xyz/queries/41577). -视图还可用于将多个智能合约的操作聚合到一个包含所有必要数据的视图中。 +### Aggregating Data -如果你一遍又一遍地使用相同的数据集并且只更改显示或聚合数据的方式,这将特别有用。这样,你不必一次又一次地查询数据集,只需将其放入视图一次,然后就可以开始引用该视图。 +Views can also be used to aggregate the actions of multiple smart contracts into one view that contains all the necessary data. -这将允许你更改构建数据集的基本查询,而无需逐个检查一个查询的多个不同实例。想一想,就像将你的数据收集和你使用该数据所做的实际工作/显示分成两个彼此独立运行的不同部分。 +This is especially useful if you are working with the same dataset over and over and only change the way you display or aggregate the data. That way, instead of having to query for your dataset again and again, you just put it into a view once and then can start referencing that view.\ +This will allow you to change the base query that constructs your dataset without having to go through multiple different instances of your query. Think about it like splitting your data collection and the actual work/display you do with that data into two different parts that function independently of each other. -使用它将使仪表盘的维护变得更加容易,因为你只需更改 **dune\_user\_generated** 视图,而不必单独处理所有查询。 +Utilizing this will make the maintenance of your dashboards much easier since you can just change the **dune\_user\_generated** view instead of having to go through all queries individually. -一个很好的例子就是 [这个仪表盘](https://dune.xyz/keeganead/cryptoart\_1) 上的几乎所有查询。创建者在 **dune\_user\_generated** 模式中创建了一个基础数据集,并使用它来作为他所有查询的基础。 +A great example of this in action is almost all queries on [this dashboard](https://dune.xyz/keeganead/cryptoart\_1). The Creator made one base dataset in the **dune\_user\_generated** schema and uses that to base all of his queries on. -请注意,虽然这种方法适用于大多数情况,但视图的算力成本可能会很高,你最好在我们的 [抽象表](abstractions.md) 中构建物化视图或表。 +Please do note that while this approach works for most cases, views can get very computationally expensive and you might be better off constructing a materialized view or table in our [abstractions](abstractions.md). -此示例从 uniswap\_v3 中获取数据,并对 dex.trades 表的数据进行标准化。 +This example takes the data from uniswap\_v3 and standardises the data for the dex.trades table. ```sql CREATE OR REPLACE view dune_user_generated.uniswap_v3 as @@ -66,7 +65,7 @@ CREATE OR REPLACE view dune_user_generated.uniswap_v3 as project, version, category, - coalesce(trader_a, tx."from") as trader_a, -- 子查询依赖此 COALESCE 来避免与 transactions 表的冗余连接 + coalesce(trader_a, tx."from") as trader_a, -- subqueries rely on this COALESCE to avoid redundant joins with the transactions table trader_b, token_a_amount_raw, token_b_amount_raw, @@ -120,36 +119,36 @@ CREATE OR REPLACE view dune_user_generated.uniswap_v3 as [https://dune.xyz/queries/42779](https://dune.xyz/queries/42779) -### 测试抽象表(Testing Abstractions) +### Testing Abstractions -另一个使用“create”函数的好用例是测试你对我们的 abstractions github 存储库发出的拉取请求是否真的产生了预期的结果。只需尝试使用模式 **dune\_user\_generated** 而不是你在 Github 中想要的实际模式运行查询。 +Another great use case of utilizing the "create" function is to test out if the Pull Request you are making to our abstractions github actually produce the intended results. Simply try running the query with the schema **dune\_user\_generated** instead of the actual schema that you want in Github. -如果测试成功,你可以继续进行拉取请求。如果可以,请将“测试表/视图”附加到拉取请求中。 +If the test succeeds, you can proceed in making the Pull Request. If you can please attach the "Test Table/View" into the Pull Request. -### 视图定义 +### View Definition -要了解特定视图是如何创建的,你可以对 pgsql 基础表运行查询。 +To find out how a particular view got created you can run queries against pgsql base tables. -**某个特定视图** +**A particular view** ```sql select definition from pg_views where viewname = 'view_name_here' ``` -**所有视图** +**All views** ```sql select * from pg_views where schemaname = 'dune_user_generated' ``` -### 视图依赖 +### View dependencies -如果你构建多个相互依赖的视图,有时可能会发生你无法更改 `view1` 的情况,因为 `view2` 依赖于 `view1`。这可以通过运行下面的查询来修复任何依赖问题来解决。 +If you build multiple views that are dependent on each other it might sometimes happen that you can't change `view1` because `view2` depends on `view1` . This can be remedied by running the query below to fix any dependency issues. ```sql --- 来源: https://stackoverflow.com/a/48770535/1838257 +-- source: https://stackoverflow.com/a/48770535/1838257 --CREATE OR REPLACE VIEW dune_user_generated.gosuto_view_dependencies AS SELECT DISTINCT srcobj.oid AS src_oid, @@ -166,11 +165,11 @@ FROM pg_class srcobj LEFT JOIN pg_namespace tgtnsp ON tgtobj.relnamespace = tgtnsp.oid WHERE tgtdep.deptype = 'i'::"char" AND tgtobj.relkind = 'v'::"char" --- 像这样过滤: +-- filter like so: -- SELECT * FROM dune_user_generated.gosuto_view_dependencies -- WHERE src_objectname LIKE '%filter_word%' ``` -你需要暂时中断依赖关系才能更改 `view1`。 +You need to temporarily break the dependencies in order to be able to change `view1`. -在 [此处](https://dune.xyz/queries/70916) 找到该查询。非常感谢 gosuto 发现了这一点。 +Find the query [here](https://dune.xyz/queries/70916). Big thanks to gosuto for uncovering this. diff --git a/dune-engine-v2-beta/abstractions-in-dunev2.md b/dune-engine-v2-beta/abstractions-in-dunev2.md index 6519e8e..cc9470a 100644 --- a/dune-engine-v2-beta/abstractions-in-dunev2.md +++ b/dune-engine-v2-beta/abstractions-in-dunev2.md @@ -1,5 +1,5 @@ -# Dune V2 中的抽象表(Abstractions) +# Abstractions in Dune V2 -此文档页面仍在建设中。你可以在我们的 github 存储库的自述文件中找到关于如何参与abstractions贡献的早期版本: +This docs page is still under construction, you can find an early version for contributing to abstractions in the readme in our github repo: {% embed url="https://github.com/duneanalytics/abstractions#readme" %} diff --git a/dune-engine-v2-beta/dunes-new-query-engine.md b/dune-engine-v2-beta/dunes-new-query-engine.md index b062b27..7bbce60 100644 --- a/dune-engine-v2-beta/dunes-new-query-engine.md +++ b/dune-engine-v2-beta/dunes-new-query-engine.md @@ -1,49 +1,49 @@ -# Dune 新版数据库 +# Dune V2 Intro -### **引言** +### **Introduction** -**Dune Engine V2** 是 Dune 的新版查询引擎,它将 Dune 的核心工具集的性能、可扩展性和功能带到了一个新的水平,使 wizards 能够查询、提取和可视化区块链上的大量数据。 +**Dune Engine V2** is Dune's new query engine that brings a new level of performance, scalability and functionality to Dune's core set of tools that enables wizards to query, extract, and visualize the vast amounts of data on the blockchain. -它利用 **Apache Spark** 来提高复杂查询的性能、处理数据规模扩张,并能够在同一个 UI 中实现跨链查询。 +It leverages **Apache Spark** to enable increased performance of complex queries, handle data scale, and enable cross-chain queries all within the same UI. -本节中包含的所有数据源现在都可用于使用新版查询引擎进行查询。目前我们有以下数据可供查询: +All of the data sources contained in this section are available for querying with the new query engine today. Currently we have the following data available to query: -* ****[**原始数据表**](../../data-tables/data-tables/raw-data/)**** +* ****[**Raw tables**](../data-tables/data-tables/raw-data/)**** * Ethereum * Gnosis Chain * BNB Chain * Optimism * Solana -* ****[**已解码数据表**](../../data-tables/data-tables/decoded-data.md)**** - * 我们仍在优化这个部分,目前只有少数已被解码。 -* ****[**Flashbots**](../../data-tables/data-tables/community-data/flashbots.md)**** - * 示例: [https://dune.com/niftytable/MEV](https://dune.com/niftytable/MEV) -* ****[**价格表**](../../data-tables/data-tables/prices.md)****(包括 Solana) +* [**Decoded tables**](../data-tables/data-tables/decoded-data.md)**** + * we are still optimizing this, only a few are decoded for now +* ****[**Flashbots**](../data-tables/data-tables/community-data/flashbots.md)**** + * Example: [https://dune.com/niftytable/MEV](https://dune.com/niftytable/MEV) +* ****[**Prices**](../data-tables/data-tables/prices.md) (including Solana) -### 新版查询引擎 +### New query engine -DuneV2 改变了我们的整个数据库架构。我们正在从 PostgresQL 数据库过渡到托管在 Databricks 上的 Apache Spark 实例。两种系统的区别可以总结如下: +DuneV2 changes our entire database architecture. We are transitioning away from a PostgresQL database to an Instance of Apache Spark hosted on Databricks. The difference between the two systems can be summarized as follows: -* 我们现在使用 Databricks SQL,而不是 PostgresQL。SQL 关键字的变化很小,但可能与你的某些查询书写习惯有关。 -* 与 PostgresQL 的面向行的方法相反,Spark 是一个面向列的数据库。 -* 传统的索引被列块级别的`最小/最大`值替换。 +* Instead of PostgresQL, we will now use DatabricksSQL. The change in SQL keywords is minimal but might be relevant for some of your querying habits. +* Spark is a column oriented database in contrast to PostgresQL’s row oriented approach. +* traditional indexes are replaced by column chunk level `min/max` values -**你可以在此处阅读有关SQL变化的更多信息:** +**You can read more about the changes here:** {% content-ref url="query-engine.md" %} [query-engine.md](query-engine.md) {% endcontent-ref %} -### 抽象表(Abstractions) +### Abstractions -DuneV2 中的抽象表将在 [dbt](https://docs.getdbt.com/docs/introduction)(数据构建工具)上运行。dbt 使分析工程师能够通过简单地编写选择语句来转换其数据仓库中的数据。dbt 将这些选择语句处理转换为 [数据表](https://docs.getdbt.com/terms/table) 和 [视图](https://docs.getdbt.com/terms/view)。 +Abstraction in DuneV2 will run on [dbt](https://docs.getdbt.com/docs/introduction) (data build tool). dbt enables analytics engineers to transform data in their warehouses by simply writing select statements. dbt handles turning these select statements into [tables](https://docs.getdbt.com/terms/table) and [views](https://docs.getdbt.com/terms/view). -这将使抽象表更加健全、可扩展且更易于使用。 +This will make abstractions more robust, scaleable and easier to work with. {% content-ref url="abstractions-in-dunev2.md" %} [abstractions-in-dunev2.md](abstractions-in-dunev2.md) {% endcontent-ref %} -### 反馈 +### Feedback -最后一点,由于查询引擎仍处于测试 **(beta)** 状态,你可能会遇到错误或对如何改进它有反馈,请随时在 [Discord](https://discord.com/invite/ErrzwBz) 和 [Canny](https://dune.canny.io/) 上与我们分享。 +One final note, as the query engine is still in in **beta** you may run into bugs or have feedback on how it can be improved, feel free to share it with us on [Discord](https://discord.com/invite/ErrzwBz) and [Canny](https://dune.canny.io/). diff --git a/dune-engine-v2-beta/query-engine.md b/dune-engine-v2-beta/query-engine.md index bc807aa..41d9ccb 100644 --- a/dune-engine-v2-beta/query-engine.md +++ b/dune-engine-v2-beta/query-engine.md @@ -1,114 +1,111 @@ -# 查询引擎 +# Query Engine -### 欢迎来到 DuneV2 +### Welcome to DuneV2 -DuneV2 改变了我们的整个数据库架构。我们正在从 PostgreSQL 数据库过渡到托管在 Databricks 上的 Apache Spark 实例。两种系统的区别可以总结如下: +DuneV2 changes our whole database architecture. We are transitioning away from a PostgreSQL database to an Instance of Apache Spark hosted on Databricks. The difference between the two systems can be summarized as follows: -* 我们现在使用 Databricks SQL,而不是 PostgresQL。SQL 关键字的变化很小,但可能与你的某些查询书写习惯有关。 -* 与 PostgresQL 的面向行的方法相反,Spark 是一个面向列的数据库。 -* 传统的索引被列块级别的 `最小/最大` 值替换。 +* Instead of PostgreSQL, we will now use Databricks SQL. The change in SQL keywords is minimal but might be relevant for some of your querying habits. +* Spark is a column oriented database in contrast to PostgreSQL’s row oriented approach. +* traditional indexes are replaced by column chunk level `min/max` values -### Databricks SQL <> PostgresQL 操作符的变化 +### Databricks SQL <> PostgresSQL operator changes -两种编码语言语法和关键字运算符之间的变化非常小,但是你应该注意下面这些差异: +The changes between the 2 coding languages syntax and the keyword operators are quite minimal, however there is some differences you should be mindful of: -| 描述 | DuneV1 | DuneV2 | +| Description | DuneV1 | DuneV2 | | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| **Spark 中不存在 bytea2numeric。** | bytea2numeric(bytea) | cast(CONV(string, 16, 10) as decimal) | -| **基于 0 与基于 1 的索引** | 基于 1 | 基于 0 | -| **bytea 与 string 字符串(地址、tx哈希等…)** |

\x2a7d..
(bytea)

|

0x2a7d...
(string)

| -| **地址(string)在Dune v2 中是小写的** |

\x2A7D...(bytea)
在 Postgres 中工作

|

0x2a7d... (string)
在 Spark 中必须小写。
可以通过 lower('0x2A7D...') 完成。

| -| **选择关键字列的方法不同** | `"from"` | `` `from` `` | -| **别名的命名方式不同** | `as "daily active users`" | ``as `daily active user``\` | -| **指数符号** | `x/10^y` | `x/power(10,y)` 或者 `x/1e*y` | -| **时间间隔参数在数字和时间单位之间需要一个空格** | `Interval '1day'` | `Interval '1 day'` | -| **Generate\_series() 现在变成了 sequence()** | `generate_series('2022-05-15', CURRENT_DATE, '1 day')` | `explode(sequence(to_date('2022-01-01'), to_date('2022-02-01'), interval 1 day))` | -| **prices.usd 表不再包含 Decimals 字段** |

不要使用
prices.usd 的 decimals 字段

| 用 `blockchain.erc20_tokens.decimals` 替换 | -| **定义 NULL 数组** | `NULL::integer[]` | `CAST(NULL AS ARRAY))` | -|

获取json对象的差异

|

("takerOutputUpdate"->
'deltaWei'->'value')


decode(substring(("addressSet"->'baseAsset')::TEXT, 4,40), 'hex')

|

get_json_object(get_json_object(takerOutputUpdate,'$.deltaWei'),'$.value')

'0x'

| - -如果你发现任何其他需要注意的重要更改,请随时向我们的文档提交 PR 或在 [Discord](https://discord.com/dunecom) 中给我们反馈! - -在搜索 SQL 问题时,你现在应该搜索 `Databricks SQL median`,而不是搜索 `PGSQL median`。Databricks 在其网站上有一个有据可查的内置函数索引。 +| **bytea2numeric does not exist in Spark.** | bytea2numeric(bytea) | cast(CONV(string, 16, 10) as decimal) | +| **0 vs 1 based indexing** | 1 indexed | 0 indexed | +| **bytea vs string for address, tx hash, etc…** |

\x2a7d..
(bytea)

|

0x2a7d...
(string)

| +| **Addresses (strings) are lower case in dune v2** |

\x2A7D...(bytea)
Works in Postgres

|

0x2a7d... (string)
Has to be lowercase in Spark.
Can be done via lower('0x2A7D...').

| +| **Selecting keyword columns is is different** | `"from"` | `` `from` `` | +| **Alias naming is different** | `as "daily active users`" | ``as `daily active user``\` | +| **Exponentiation notation** | `x/10^y` | `x*power(10,y)` or `x*1e*y` | +| **Interval arguments need a space in between the number and time units** | `Interval '1day'` | `Interval '1 day'` | +| **Generate\_series () is now sequence ()** | `generate_series('2022-05-15', CURRENT_DATE, '1 day')` | `explode(sequence(to_date('2022-01-01'), to_date('2022-02-01'), interval 1 day))` | +| **Decimals are no longer in prices.usd** |

Don’t use
prices.usd decimals

| Replace by `blockchain.erc20_tokens.decimals` | +| **Define NULL array** | `NULL::integer[]` | `CAST(NULL AS ARRAY))` | +|

Get json object
differences

|

("takerOutputUpdate"->
'deltaWei'->'value')


decode(substring(("addressSet"->'baseAsset')::TEXT, 4,40), 'hex')

|

get_json_object(get_json_object(takerOutputUpdate,'$.deltaWei'),'$.value')

'0x'

| -{% embed url="https://docs.databricks.com/sql/language-manual/sql-ref-functions-builtin.html" %} +If you have found any other changes that are important to note, please feel free to sumbit a PR to our docs or leave us feedback in Discord! -### 数据库工作方式的变化 +If you have found any other changes that are important to note, please feel free to sumbit a PR to our docs or leave us feedback in [Discord](https://discord.com/dunecom)! -**数据库是如何工作的?** +When googling for SQL questions, instead of googling `PGSQL median`, you should now google for `Databricks SQL median`. Databricks has a well documented index of built in functions on their website. -在非常高的层次上,数据库将数据从存储读取到内存中,以返回你的查询结果。数据库通常会受到其将数据读入内存的速度的限制。这是一个经典的计算机科学问题,通常被称为 [I/O 边界](https://en.wikipedia.org/wiki/I/O\_bound)。 +{% embed url="https://docs.databricks.com/sql/language-manual/sql-ref-functions-builtin.html" %} -#### **面向行的数据库** +### Changes in how the database works -数据库将其数据存储在页(pages)中。页通常包含多行信息。多页将组成一个数据文件。数据库中的一个表有时会包含多个数据文件。 +**How does a database work?** -![面向行的数据库 (Postgres)](<../../.gitbook/assets/row based database (1).png>) +On a very high level, databases read data from storage into memory in order to return your query results. A database is often times limited by the speed of the database being able to read data into it's memory. This is a classic computer science problem that's commonly referred to as being[ I/O bound](https://en.wikipedia.org/wiki/I/O\_bound). -当从数据库中检索数据时,数据库会按页(page)的大小将数据读入内存/缓存中。这是数据库一次读取的最小数据量,也是从任何数据库读取数据时的常见瓶颈所在。将数据读入内存后,数据库要么创建临时文件,要么能够再次从内存中读取数据,最终到达所需的查询输出。 +#### **Row oriented database** -在任何数据库系统中,我们都希望在从数据库中检索任意数量的数据时减少读取的页的数量。由于传统数据库将多行数据存储在一页中,因此它们最适合在一个查询中检索一行的所有列的情况。数据库将始终必须读取存储特定行的整个页,因此数据库返回也存储在同一页中的其他数据非常简单。查询在数据库中紧密存储在一起的其他行也是如此。因此查询第 500-600 行是非常高效的,查询第 5、87、789 和 1050 行并不是那么高效,但仍然没问题。 +Databases store their data in pages. Pages traditionally contain rows of information. Multiple pages will make up one datafile. A table in a database will sometimes consist of multiple datafiles. -与此相反,查询存储在许多不同逻辑行和不同页中的数据是一项非常昂贵的操作。我们今天在 Dune 上运行的大多数查询都是来自跨越数千行甚至数百万行记录中的某一列的数据点的聚合。在这些情况下,数据库将读取存储此列数据的整个页,即使它只需要其中一列的数据。这意味着平均而言,我们正在读取大量返回查询结果并不需要用到的数据,只是因为它也包含在同一个页上,并且数据库不能“仅”读取一列,而是必须读取包含该列的整行。 +![row oriented database (Postgres)](<../.gitbook/assets/row based database (1).png>) -在 Postgres 中,我们可以使用索引来避免强制数据库读取整个表(因此读取很多页),而只查看其中一个结构化的子集。这将导致非常快速和高效的查询,但仅限于被索引的列。由于为特定表创建的每个新索引都将是数据库中的一个新文件,并且使更新和维护该表变得更加困难,因此这并不是扩展数据库的可持续方法。 +When retrieving data from the database, the database will read data into memory/cache in the size of pages. This is the smallest amount of data the database will read at once and is a common bottleneck while reading data from any database. After reading the data into memory, the database will either create temporary files or is able to read the data from memory again to finally arrive at the desired query output. -我们不可能在数据库中的每一列或列组合上创建索引而不会遇到麻烦。因此,Dune V2 不会在面向行的数据库上运行,而是在面向列的数据库上运行。 +In any database system, we want to reduce the amount of pages we read when retrieving any amount of data from the database. Since traditional databases store rows in one page, they are best suited for retrieving all columns of one row in a query. The database will always have to read the entire page in which a specific row is stored, therefore it is quite simple for the database to return the data also stored in this same page. The same is true for querying for rows which are stored closely together in the database. So querying for rows 500-600 is very efficient, querying for rows 5, 87, 789 and 1050 is not really all that efficient, but still alright.\ +In contrast, querying for data which is stored in many different logical rows and therefore different pages is a hugely expensive operation. Most of the queries we run on Dune today are aggregation of datapoints in a column over thousands if not millions of rows. In these cases, the database will read the entire pages in which this column data is stored, even though it only needs the data of one column. This means that on average, we are reading large amounts of data that is not needed to return the query results, just because it is also contained on a page and the database is not able to read "just" the one column, but has to read the entire row in which the column is contained. -#### **面向列的数据库** +In Postgres, we can use indexes to not force the database to read through the entire table (and therefore a lot of pages), but rather only look at a structured subset. This will lead to very fast and efficient queries, but is limited to the columns which are indexed. Since every new index that is created for a specific table will be a new file in the database and make it harder to update and maintain that table, this is not a sustainable approach to scale a database.\ +We can't possibly create an index on every column or combination of columns in our database without running into trouble down the line. Therefore, Dune V2 will not run on row-oriented database, but rather on a column-oriented database. -我们不是在页中存储行,而是在页中存储列。通过这种方式,我们减少了数据库在聚合或读取特定列时需要读取的页数量。 +#### **Column oriented database** -![面向列的数据库 (Spark)](<../../.gitbook/assets/column oriented database.png>) +Instead of storing rows in pages, we store columns in pages. In this way, we reduce the amount of pages the database needs to read while aggregating or reading through a specific column. -具体来说,在 Dune V2 中,我们将 [parquet 文件格式](https://github.com/apache/parquet-format) 用于我们的新数据库。Parquet 有时被描述为面向行的数据库和面向列的数据库之间的混合方法,因为数据库中的表仍然由多个 Parquet 文件组成,这些文件由数据集的行分区。在 parquet 文件中,实际包含数据的页将包含列而不是行,但仍存储在行组中,这些行组进一步按行划分数据。数据库仍然粗略地以面向行的格式存储,但各个值以列方向存储在页上。 +![column oriented database (Spark)](<../.gitbook/assets/column oriented database.png>) -![parquet 文件示意图](<../../.gitbook/assets/parquet file schema.png>) +Specifically, in Dune V2 we are using the [parquet file format](https://github.com/apache/parquet-format) for our new database. Parquet is sometimes described as a hybrid approach between row-oriented databases and column-oriented databases since a table in the database will still consist of multiple parquet files which are partitioned by rows of the dataset. Inside of the parquet file the pages which actually contain the data will contain columns instead of rows, but are still stored within row groups which further partition the data by rows. The database is still roughly stored in a row oriented format, but the individual values are stored on pages in column orientation. -这意味着,即使整个数据库在某种程度上是以面向行的方式定向的,但如果我们真的想要读取数据,我们总是会从面向列的页中读取。通过这种方式,我们可以轻松地将大量逻辑行中的数据聚合到一列中,因为在这种布局中,我们必须加载到内存中以实际读取数据的页的数量被最小化了。 +![schematic view of parquet files](<../.gitbook/assets/parquet file schema.png>) -相反,如果我们尝试查询特定逻辑行的所有列,我们必须访问许多不同的页,因为一个逻辑行的数据不再存储在一个页中,而是分布在许多不同的页中。 +\ +This means, that even though the database at large is somewhat oriented in a row oriented manner, should we actually want to read data, we will always read from a page which is column oriented. In this way, we can easily aggregate data in one column over a large amounts of logical rows, as in this layout the amount of pages we have to load into memory to actually read the data is minimized.\ +In contrast, should we try to query for all columns of specific logical rows, we have to access lots of different pages as the data of one logical row is no longer stored in one page, but rather distributed across lots of different pages. -这个视频很好地解释了面向行和面向列的数据库系统的差异。 +This video does a pretty good job of explaining the differences in row vs column oriented database systems. {% embed url="https://youtu.be/Vw1fCeD06YI" %} -**本质上**,将列而不是行存储在页中可以最大限度地减少数据库在从大量逻辑行中检索一列的数据时读取的不需要的数据量。我们有时能够在 Postgres 中通过以索引的形式创建大量结构化的子集数据来模仿这一点,但这并不能扩展。 - -### 索引或者干脆没有索引 +**In essence**, storing columns in pages instead of rows minimizes the amount of not needed data that is read by the database when retrieving data for one column over a large amount of logical rows. We were sometimes able to mimic this in Postgres by creating large amounts of structured subset data in the form of indexes, but this doesn't scale. -在基于 parquet 的系统中,传统意义上的索引并不存在。但是,它们基本上是动态创建的,每个 parquet 文件都有一个页脚,其中包含存储在该 parquet 文件中的每一列的`最小/最大`值。然后在列块级别上重复此模式,它为 parquet 文件中特定行组内的不同列存储此元数据。 +### Indexes or rather no Indexes -![最小/最大值示意图](<../../.gitbook/assets/minmax schema.JPG>) +Indexes don't exist in a traditional sense in a parquet based system. However, they are basically created on the fly with each parquet file having a footer that contains `min/max` values for every column stored in that parquet file. This pattern is then repeated on a column chunk level, which stores this metadata for the columns within a specific row group within the parquet file. -在文件级别和列块级别同时使用这些 `最小/最大` 值,允许数据库在扫描表时高效地跳过整个 parquet 文件或 parquet 文件中的列块。 +![schematic view of mix/max values](<../.gitbook/assets/minmax schema.JPG>) -不幸的是,字符串的 `最小/最大` 值通常不是很有用。特别是区块链系统中的 `tx_hash` 字符串和 `address` 字符串不适合这种 `最小/最大` 数据收集,因为它们是随机生成的。这意味着数据库将无法基于这些字符串跳过文件或列块,因此查询将非常低效,因为它需要数据库实际将所有页加载到内存中。 +Using these `min/max` values, both on a file level and on a column chunk level, allows the database to efficiently skip over entire parquet files or column chunks within parquet files while scanning through the table. -也就是说,由于整个查询引擎仍然能够非常有效地读取存储这些字符串的各个列,因此大多数情况下这不会对你的查询执行速度产生很大影响。 +Unfortunately, the `min/max` values of strings are often times not very useful. Especially `tx_hash` strings and `address` strings in blockchain systems are not suited well for this kind of `min/max` data gathering since they are randomly generated. That means the database won't be able to skip files or column chunks based on these strings and queries will therefore be quite inefficient since it requires the database to actually load all the pages into memory.\ +That said, since the query engine at large is still able to read through individual columns in which these strings are stored very efficiently, most of the time this won't make a big difference in your query execution speed.\ +This is mostly relevant for base tables like `ethereum.transactions`, `bnb.logs`, `erc20_ethereum.erc20_evt_transfer`, etc. which contain very large datasets which are not prefiltered. -这主要与 `ethereum.transactions`、`bnb.logs`、`erc20_ethereum.erc20_evt_transfer` 等基表相关,这些基表包含未经预过滤的非常大的数据集。 +A noteable exception from this is the solana dataset `account_activity`_,_ which instead of being ordered by `block_time` like the rest of our datasets, is ordered by `account_keys`. This allows us to actually reasonably utilize the `min/max` values for the account keys which were used and therefore run efficient queries based on the `account_keys` values. -一个值得注意的例外是 solana 数据集 `account_activity` ,它不像我们的其他数据集那样按 `block_time` 排序,而是按 `account_keys` 排序。这使我们能够实际合理地利用所使用的帐户密钥的 `最小/最大` 值,从而基于 `account_keys` 值运行有效的查询。 +### Query examples -### 查询示例 +Equipped with this knowledge, let's look at some queries on the new Dune V2 engine. -有了这些知识,我们再来看看新版 Dune V2 引擎的一些查询。 - -**查询交易哈希** +**Querying for transaction hashes** ```sql Select * from ethereum.transactions where hash = '0xce1f1a2dd0c10fcf9385d14bc92c686c210e4accf00a3fe7ec2b5db7a5499cff' ``` -如果使用我们之前学到的所有知识再次考虑这一点,希望你能明白此查询非常低效。我们这里唯一的过滤条件是 `hash` 字符串,因此我们基本上强制查询引擎读取所有存储 `tx_hash` 列数据的页。我们可能可以跳过那些存储在每个 parquet 文件的页脚中的最小/最大值是 `0xa0 - 0xcd` 的部分列块,但这些只是一个罕见的例外。 - -鉴于我们在搜索一个 `哈希` 时基本上对以太坊主网的整个历史进行了全面扫描(在撰写本文时为 1.6b 个条目),这个查询在大约 6 分钟内运行完成是相当令人印象深刻的。 +If you think about this for second with all the knowledge we have learned earlier, you will hopefully understand that this query is very inefficient. Our only filter condition here is a `hash` string, therefore we basically force the query engine to read all pages which store the data of the `tx_hash` column in full. We probably can skip a few column chunks where the min/max value stored in the footer of each parquet file is `0xa0 - 0xcd`, but those will be a rare exception. \ +Given that we are basically doing a full scan over the entire history of Ethereum mainnet (1.6b entries at time of writing) while searching for one `hash`, it's pretty impressive that this query runs in about 6 minutes. -鉴于查询 `哈希` 是 Dune 分析师工作流程中非常常见的情况,让我们考虑一下如何才能更快地完成这项工作。 +Given that querying for `hash` is a very common occurence in the workflow of an analyst on Dune, let's think about how we can make this faster. -我们只需要使用一个实际上包含有用的 `最小/最大` 值的列,以便能够不必完整读取所有页,而是能够跳过大量文件和列块。`block_time` 和 `block_number` 都可用于此目的。 +We simply have to use a column that actually has useful `min/max` values in order to be able to not read all pages in full, but rather be able to skip over a lot of files and column chunks. Both `block_time` and `block_number` are useful for this purpose. ```sql Select * from ethereum.transactions @@ -116,28 +113,27 @@ where block_number = 14854616 and hash = '0xce1f1a2dd0c10fcf9385d14bc92c686c210e4accf00a3fe7ec2b5db7a5499cff' ``` -这个查询仍然不如在 Postgres 中那么快(在Postgres中我们可以使用 btree 索引),但运行时间为 13 秒,我们已经非常接近了。 - -在这种情况下,查询执行期间发生的情况是,数据库引擎能够读取 parquet 文件的页脚,能够确定许多 parquet 文件的 `最小/最大` 值不符合定义的标准,并且有效地跳过它们。一旦我们找到了一个真正满足我们条件的 parquet 文件,我们可以简单地深入到列块的 `最小/最大` 值,找到正确的列块,将剩下的几页列数据加载到内存中,然后找到也匹配“ `哈希` 条件的部分。由于我们从这个查询中的逻辑行中选择所有条目,我们实际上还需要访问一些其他页,但如果我们只对几行执行此操作,这是一个相当有效的操作。 +This query is still not as fast as in Postgres, where we can make use of btree indexes, but with a runtime of 13 seconds, we are getting pretty close.\ +What happens during the query execution in this case is that the database engine is able to read the footer of the parquet files, is able to determine that the `min/max` values of a lot of parquet files is not meeting the defined criteria and skip over them efficiently. Once we have found a parquet file that actually meets our conditions, we can simply drill down into the column chunk `min/max` values, find the right column chunks, load the few pages of column data that are left into memory and find the match for the `hash` condition as well. Since we are selecting all entries from the logical row in this query, we actually need to access a few other pages as well, but this is a reasonably efficient operation if we only do this for a few rows. -**经验:** 以数据库能够合理使用文件和列块的 `最小/最大` 值的方式定义你的条件,以便它可以高效地找到你需要的逻辑行。 +**Lesson:** Define your conditions in a way in which the database is able to reasonably work with `min/max` values of files and columns chunks so it can efficiently find the logical row you need. -**在大量逻辑行上聚合数据** +**Aggregating data over a large amount of logical rows** -这主要是一个案例研究,以说明 Dune V2 在通过大量逻辑行聚合数据方面的效率。 +This is mainly a case study to illustrate how efficient DuneV2 is in aggregating data over a large set of logical rows. ```sql Select avg(gas_used) from ethereum.transactions ``` -此查询在 **惊人的** 7 秒内运行完成。这主要是因为我们现在不必从字面上读取整个表。我们现在能够大大减少必须读取的页数量,因为所有这些数据都存储在多个 parquet 文件中的页中。在 Postgres 中,我们必须读取的每个页都包含大量不需要的数据,在 Dune V2 中,我们只读取我们实际需要的数据。 +This query runs in an **amazing** 7 seconds. This is mainly due to the fact that instead of having to read literally the entire table, we are now able to able to majorly reduce the amount of pages we have to read, since all this data is stored together in pages across parquet files. In Postgres, each page that we would have to read would have contained a lot of not needed data, in Dune V2, we just read the data that we actually need. -**经验:** 跨大量逻辑行查询数据现在更加高效,并且许多以前由于超时而完全不可能的查询现在已经可以正常执行。 +**Lesson:** Querying for data across a large amount of logical rows is now much more efficient and a lot of queries that were formerly sheer impossible due to timing out are now able to be executed. -[hildobby 的](https://twitter.com/hildobby\_) [Ethereum 概述](https://dune.com/hildobby/Ethereum-Overview) 仪表盘就是一个很好的例子来说明这一点。这是以前根本无法实现的数据处理级别。 +A good example to illustrate this is [hildobby's](https://twitter.com/hildobby\_) [Ethereum Overview](https://dune.com/hildobby/Ethereum-Overview) dashboard. This is simply a level of data processing that was not possible before. -### 结束语 +### Closing remarks -一些在我们的 v1 数据库中被大量索引的查询在 DuneV2 中可能会感觉有点尴尬。对于 erc20 事件转移表(event transfer)、`ethereum.transactions` 和 `ethereum.logs` 以及它们在其他区块链上的对应物来说尤其如此。这是我们愿意为大规模启用区块链分析而做出的权衡。我们将继续对这些数据集和我们的数据库架构进行创新,以使每个查询在 DuneV2 上尽可能快地运行,但是像 `tx_hash` 的查询速度很慢只是这个新数据库系统的本质。也就是说,我们认为我们在启用大量新用例和加速大量现有查询方面做得非常好。 +Some queries that were heavily indexed on our v1 database might feel a bit awkward in DuneV2. This is especially the case for erc20 event transfer tables, `ethereum.transactions` and `ethereum.logs` and their counterparts on other blockchains. This is a tradeoff we were willing to take to enable blockchain analytics on a large scale basis. We will continue to keep innovating on these datasets and our database architecture to make every query run as fast as possible on DuneV2, but things like queries for `tx_hash` being slow is just in the nature of this new database system. That said, we think we have done a pretty damn good job of enabling a lot of new usecases and speeding up a large amount of already existing queries. -如果你对新系统有任何反馈或遇到问题,我们都会倾听并等待你在 [Canny](https://feedback.dune.xyz) 和 [Discord](https://discord.com/dunecom) 上的反馈。 +If you have any feedback or run into trouble with the new system, we are all ears and await your feedback on [Canny](https://feedback.dune.xyz) and [Discord](https://discord.com/dunecom). diff --git a/faq/how-does-dune-get-its-data.md "b/faq/Dune\346\200\216\344\271\210\350\216\267\345\217\226\346\225\260\346\215\256\346\272\220" similarity index 100% rename from faq/how-does-dune-get-its-data.md rename to "faq/Dune\346\200\216\344\271\210\350\216\267\345\217\226\346\225\260\346\215\256\346\272\220" diff --git a/faq/does-dune-have-an-api.md "b/faq/Dune\346\234\211API\345\220\227" similarity index 100% rename from faq/does-dune-have-an-api.md rename to "faq/Dune\346\234\211API\345\220\227" diff --git a/faq/does-dune-have-a-token.md "b/faq/Dune\346\234\211\344\273\243\345\270\201\345\220\227" similarity index 100% rename from faq/does-dune-have-a-token.md rename to "faq/Dune\346\234\211\344\273\243\345\270\201\345\220\227" diff --git a/faq/how-are-results-refreshing.md "b/faq/\347\273\223\346\236\234\345\246\202\344\275\225\345\210\267\346\226\260" similarity index 100% rename from faq/how-are-results-refreshing.md rename to "faq/\347\273\223\346\236\234\345\246\202\344\275\225\345\210\267\346\226\260" diff --git a/onboarding/onboarding-to-dune.md b/onboarding/onboarding-to-dune.md index 658fd21..95b6146 100644 --- a/onboarding/onboarding-to-dune.md +++ b/onboarding/onboarding-to-dune.md @@ -1,26 +1,28 @@ -# 入门Dune +# Onboarding to Dune +### Dune is an open platform that anyone can build on -### Dune是任何人都可以在上边Build的开放平台 - -Dune团队经常被问到关于”可能的合作”以及“合作方式”.我们感谢所有这些善意的请求,但是如果你想要在Dune上展示自己的数据,你确实不需要任何来自Dune核心团队的许可或者同意。 \ +Team Dune often gets asked about "possible cooperation" and "ways to work together" and while we appreciate all these kind requests, there really isn't anything you need from the core team to be able to surface your data on dune. \ \ -我们的平台是免费的、开放的以及无需许可的,任何人都按照他们认为适合的方式去使用这个平台。\ -你所需要的只是一名熟练的自由职业者或你的一个团队成员来处理实际要展示的数据。 +Our platform is free, open and permissionless and anyone can use the platform as they see fit. \ +All you need is either a skilled freelancer or one of your team members to take care of the actually surfacing the data. -**过程如下:** +**The Process looks like this:** -1. **整理一份所有相关合约的清单并把他们提交**[**解码**](../duneapp/adding-new-contracts.md)**。** -2. **使用SQL Queries查询数据** -3. **把查询结果给可视化** -4. **在Dashboard上把可视化的结果组装起来.** -5. **把看板做得更美观** -6. **享受你的数据** +1. **Compile a List of all relevant contracts and submit them for** [**decoding**](../duneapp/adding-new-contracts.md)**.** +2. **Surface the data using SQL queries** +3. **Visualize the results** +4. **Assemble visualizations on a dashboard.** +5. **Make the dashboard pretty** +6. **Enjoy your data** **** -### 如何找到一个自由职业者 +### How to find a freelancer + +There is quite a few people in the web3 scene which either specialized in building on dune or have the skillset in their repertoire. To reach out to this pool of freelancers, you can **fill in this** [**form**](http://bounties.dune.xyz/) **** and freelancers will get back to you in little to no time. Alternatively, you could also use platforms like gitcoin or layer3.xyz to find suitable freelancers. + +If hiring a freelancer for the first time, please make sure to check their past works and dashboards to verify that they are indeed capable of solving the task at hand. + -Web3场景中有很多这样的人,他们要么专职在Dune上building,要么在他们本身有这个技能点。如果你想要联系这群自由职业者,**你可以填写这个**[**表格**](http://bounties.dune.xyz/) 自由职业者会很快回复你。或者你也可以使用 gitcoin 或 layer3.xyz 等平台来寻找合适的自由职业者。 -如果你是第一次聘请自由职业者,请务必查看他们过去的作品和仪表盘,以确认他们确实有能力解决手头的任务。 diff --git a/sharing/attribution.md b/sharing/attribution.md index 1a3cc55..30b1852 100644 --- a/sharing/attribution.md +++ b/sharing/attribution.md @@ -1,19 +1,19 @@ --- -说明: Dune上的内容是社区创作的,所以也归属于社区。 +description: Content on Dune is community created and should be attributed accordingly! --- -# 内容归属 +# Attribution -### 内容归属 +### Attribution -Dune上的创作内容毫无疑问地是平台创作者的成果。\ -在任何其他平台引用Dune上的分析内容,不仅要归功于Dune,还要归功于引用内容的创作者。\ +Content on Dune is first and foremost the product of the creators on the platform. \ +Any mention of analysis published on our platform outside of the platform should credit the creators of this specific piece of analysis and not just "Dune". \ \ -引用图标和仪表盘可以这样归功于创作者: +Crediting charts and dashboards should be done in the following way: _"@eliasmos via_ [_https://dune.com/queries/610591_](https://dune.com/queries/610591)_"._ -你可以在创作者的个人页面中找到他们的推特和更多信息[个人页面](https://dune.xyz/rchen8)。 +You can find the twitter tags and more information of most creators in their [profile page](https://dune.xyz/rchen8). diff --git a/sharing/embeds/README.md b/sharing/embeds/README.md index 63dc8fa..a6e75a0 100644 --- a/sharing/embeds/README.md +++ b/sharing/embeds/README.md @@ -1,41 +1,41 @@ --- -说明: 嵌入功能使你能跨网站地使用实时更新的Dune图表! +description: Embeds allow you to enjoy beautiful, updating dune charts across the web! --- -# 嵌入功能 +# Embeds -## 使用嵌入功能 +## Using Embeds -**截图是无趣和过时的。** +**Screenshots are boring and tech of the past.** -Dune自带可以跨平台使用的嵌入功能,而不是使用形式不一的截图功能。 +Instead of using static screenshots in varying forms of quality, Dune has a native embed function that works across most platforms. -你可以在查询标题生成嵌入链接或者选择右上角的嵌入功能。 +You can generate embed links by clicking on any query title and selecting the embed function in the top right corner. ![generating an embedd link](<../../.gitbook/assets/2021-11-01 14-30-33.gif>) -### 参数化嵌入 +### Parameterized embeds -参数化的查询也是可以实现的,但这需要一点技巧: +Embed links also work with parameterized queries, but it is a bit tricky to get them to work: -生成的嵌入链接并不包含必要的参数,尽管查询已经被执行过。我们正在致力于实现自动化的生成链接,但是目前仅有这一条途径能够做到。 +The embed link that gets generated does not include the necessary parameters yet, even if you have ran the query with it. We are already working on automating the link generation, but for now the is the only way for us to handle this. -现在你需要在链接前手动输入参数。 +For now you need to manually prefix the parameter link with the parameters. -输入参数的写法是这样的: +The syntax for this is: `link?name_of_parameter1=xxxx&?name_of_parameter2=yyyy&...` __ -一个示例: +An example of this would be: `>https://dune.xyz/embeds/118220/238460/aa002dd3-f9e2-4d63-86c8-b765569306c6NFT?address=0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7&rolling_n_trades=500`\ `` -### 在不同平台上嵌入 +### Embeds across different platforms -这里有几个使用Dune嵌入的示例: +Here is a couple of exemplary use cases for Dune embeds: {% content-ref url="discord.md" %} [discord.md](discord.md) @@ -55,9 +55,9 @@ Dune自带可以跨平台使用的嵌入功能,而不是使用形式不一的 -### 已知问题 +### Known Issues -然而嵌入功能在一些比较流行的网站上还不能实现,这包括: +Unfortunately, embeds do not work in a couple of fairly popular sites, this includes: * substack * medium diff --git a/sharing/embeds/discord.md b/sharing/embeds/discord.md index cc54744..6c4c434 100644 --- a/sharing/embeds/discord.md +++ b/sharing/embeds/discord.md @@ -1,14 +1,14 @@ --- -说明: Dune可以完美地嵌入Discord展示! +description: Dune's embeds display beautifully in Discord! --- # Discord -Dune嵌入功能在discord上的效果非常好: +Dune embeds work very well in Discord: -你可以简单地在聊天框里发送链接,相应的可视化内容就会被展示。 +You can simply drop the link in the chat and the corresponding visualization will get displayed. -这也非常适合编程一个机器人,以便在命令中返回相应的图表。 +This also lends itself very well to programming a bot to return the corresponding charts on command. ![](<../../.gitbook/assets/2021-11-02 18-39-01.gif>) diff --git a/sharing/embeds/known-issues.md b/sharing/embeds/known-issues.md index d5e9b5f..c9b8ade 100644 --- a/sharing/embeds/known-issues.md +++ b/sharing/embeds/known-issues.md @@ -1,10 +1,10 @@ --- -说明: 并不是所有网站有想要嵌入功能。 +description: Sadly not every website wants to make it. --- -# 已知问题 +# Known Issues -这些网站目前还不支持Dune的嵌入功能: +These websites currently sadly do not support dune embeds: * substack * medium diff --git a/sharing/embeds/mirror.xyz.md b/sharing/embeds/mirror.xyz.md index 8ee786e..feb56a9 100644 --- a/sharing/embeds/mirror.xyz.md +++ b/sharing/embeds/mirror.xyz.md @@ -1,11 +1,11 @@ --- -说明: Dune嵌入功能可以在Mirror.xyz上使用! +description: Dune embedds work in Mirror.xyz! --- # Mirror.xyz -Dune的图表可以很轻松地嵌入mirror.xyz的文章。生成一个嵌入链接然后加上`?display=iframe`的后缀就会实现。 +Dune charts can easily be embedded into articles on mirror.xyz. Simply generate an embed link and postfix it with `?display=iframe` -一个示例: +An example of this would be: `https://dune.xyz/embeds/208941/391702/34ee3319-1cac-40e1-a08d-160bd93693cc?display=iframe` diff --git a/sharing/embeds/twitter.md b/sharing/embeds/twitter.md index d293102..83e670a 100644 --- a/sharing/embeds/twitter.md +++ b/sharing/embeds/twitter.md @@ -1,15 +1,16 @@ --- -说明: >- - 在推特上分享是Dune的可视化内容最常见的使用场景了。 +description: >- + Sharing data on Twitter is probably the most common use case of Dune's + Visualizations. --- -# 推特 +# Twitter -你可以使用嵌入功能在推特上分享可视化内容。 +You can use embeds to share Dune's visualizations on Twitter. -推特将自动呈现可视化效果,并随着时间的推移自动更新。 +Twitter will render the visualizations automatically and they will update automatically as time progresses. -与静态的截图相比这绝对是更好的体验! +Definitely a better experience compared to static screenshots! ![Twitter automatically renders the embed link correctly](<../../.gitbook/assets/2021-11-01 14-45-28.gif>) diff --git a/sharing/embeds/webpages.md b/sharing/embeds/webpages.md index 292e996..a56031e 100644 --- a/sharing/embeds/webpages.md +++ b/sharing/embeds/webpages.md @@ -1,20 +1,20 @@ --- -说明: 你可以在把Dune的可视化内容嵌入大多数网站上。 +description: You can embedd Dune's Visualizations on most Websites with ease. --- -# 网页 +# Webpages -### Dune的图表可以在你的网站上实时更新! +### Dune Charts can live in your website! -你可以使用Dune的嵌入功能来在你的网站上展示Dune上的内容。 +You can use Dune's embed function to embed the charts usually displayed on Dune Analytics Dashboards into your website. -这是一段代码示例: +Here is a code snippet example: `` -我们已经看到这个功能在很多网站上被使用了,比如项目网站,研究者的网站等等,现在唯一的限制就是你的想象力了! +We have seen this feature used on project websites, websites of researchers and basically everywhere by now, the limit really is just your imagination. -这里有一个很好的展示 [cryptoart.io](https://cryptoart.io/data) 网页。 +A great showcase for this is the [cryptoart.io](https://cryptoart.io/data) website.