diff --git a/.gitbook/assets/0 b/.gitbook/assets/0 new file mode 100644 index 0000000..f1c844f Binary files /dev/null and b/.gitbook/assets/0 differ diff --git a/.gitbook/assets/1 b/.gitbook/assets/1 new file mode 100644 index 0000000..3a6d573 Binary files /dev/null and b/.gitbook/assets/1 differ diff --git a/.gitbook/assets/2 b/.gitbook/assets/2 new file mode 100644 index 0000000..04f92af Binary files /dev/null and b/.gitbook/assets/2 differ diff --git a/.gitbook/assets/2021-11-01 14-30-33.gif b/.gitbook/assets/2021-11-01 14-30-33.gif new file mode 100644 index 0000000..a2ffa4e Binary files /dev/null and b/.gitbook/assets/2021-11-01 14-30-33.gif differ diff --git a/.gitbook/assets/2021-11-01 14-45-28.gif b/.gitbook/assets/2021-11-01 14-45-28.gif new file mode 100644 index 0000000..6fff2f2 Binary files /dev/null and b/.gitbook/assets/2021-11-01 14-45-28.gif differ diff --git a/.gitbook/assets/2021-11-02 18-39-01.gif b/.gitbook/assets/2021-11-02 18-39-01.gif new file mode 100644 index 0000000..e761404 Binary files /dev/null and b/.gitbook/assets/2021-11-02 18-39-01.gif differ diff --git a/.gitbook/assets/2021-11-03 16-59-42 (1).gif b/.gitbook/assets/2021-11-03 16-59-42 (1).gif new file mode 100644 index 0000000..851303d Binary files /dev/null and b/.gitbook/assets/2021-11-03 16-59-42 (1).gif differ diff --git a/.gitbook/assets/2021-11-03 16-59-42 (2).gif b/.gitbook/assets/2021-11-03 16-59-42 (2).gif new file mode 100644 index 0000000..851303d Binary files /dev/null and b/.gitbook/assets/2021-11-03 16-59-42 (2).gif differ diff --git a/.gitbook/assets/2021-11-03 16-59-42.gif b/.gitbook/assets/2021-11-03 16-59-42.gif new file mode 100644 index 0000000..851303d Binary files /dev/null and b/.gitbook/assets/2021-11-03 16-59-42.gif differ diff --git a/.gitbook/assets/2021-11-03 17-55-41 (1).gif b/.gitbook/assets/2021-11-03 17-55-41 (1).gif new file mode 100644 index 0000000..9803ad9 Binary files /dev/null and b/.gitbook/assets/2021-11-03 17-55-41 (1).gif differ diff --git a/.gitbook/assets/2021-11-03 17-55-41.gif b/.gitbook/assets/2021-11-03 17-55-41.gif new file mode 100644 index 0000000..9803ad9 Binary files /dev/null and b/.gitbook/assets/2021-11-03 17-55-41.gif differ diff --git a/.gitbook/assets/2021-11-04 12-34-39.gif b/.gitbook/assets/2021-11-04 12-34-39.gif new file mode 100644 index 0000000..39fc168 Binary files /dev/null and b/.gitbook/assets/2021-11-04 12-34-39.gif differ diff --git a/.gitbook/assets/2021-11-09 13-17-41.gif b/.gitbook/assets/2021-11-09 13-17-41.gif new file mode 100644 index 0000000..69a708d Binary files /dev/null and b/.gitbook/assets/2021-11-09 13-17-41.gif differ diff --git a/.gitbook/assets/2021-11-09 13-20-39.gif b/.gitbook/assets/2021-11-09 13-20-39.gif new file mode 100644 index 0000000..5bc2496 Binary files /dev/null and b/.gitbook/assets/2021-11-09 13-20-39.gif differ diff --git a/.gitbook/assets/2021-11-18 16-23-05.gif b/.gitbook/assets/2021-11-18 16-23-05.gif new file mode 100644 index 0000000..15661a8 Binary files /dev/null and b/.gitbook/assets/2021-11-18 16-23-05.gif differ diff --git a/.gitbook/assets/2021-11-19 01-22-49.gif b/.gitbook/assets/2021-11-19 01-22-49.gif new file mode 100644 index 0000000..8561816 Binary files /dev/null and b/.gitbook/assets/2021-11-19 01-22-49.gif differ diff --git a/.gitbook/assets/2021-11-26 13-08-16.gif b/.gitbook/assets/2021-11-26 13-08-16.gif new file mode 100644 index 0000000..bd0f3ec Binary files /dev/null and b/.gitbook/assets/2021-11-26 13-08-16.gif differ diff --git a/.gitbook/assets/2021-11-26 17-25-04.gif b/.gitbook/assets/2021-11-26 17-25-04.gif new file mode 100644 index 0000000..f41a9a4 Binary files /dev/null and b/.gitbook/assets/2021-11-26 17-25-04.gif differ diff --git a/.gitbook/assets/2021-12-06 14-55-04.gif b/.gitbook/assets/2021-12-06 14-55-04.gif new file mode 100644 index 0000000..7660564 Binary files /dev/null and b/.gitbook/assets/2021-12-06 14-55-04.gif differ diff --git a/.gitbook/assets/2021-12-08 22-33-19.gif b/.gitbook/assets/2021-12-08 22-33-19.gif new file mode 100644 index 0000000..6426d3e Binary files /dev/null and b/.gitbook/assets/2021-12-08 22-33-19.gif differ diff --git a/.gitbook/assets/2021-12-08 22-44-18.gif b/.gitbook/assets/2021-12-08 22-44-18.gif new file mode 100644 index 0000000..9a2f910 Binary files /dev/null and b/.gitbook/assets/2021-12-08 22-44-18.gif differ diff --git a/.gitbook/assets/2021-12-10 15-39-28.mp4 b/.gitbook/assets/2021-12-10 15-39-28.mp4 new file mode 100644 index 0000000..beb121b Binary files /dev/null and b/.gitbook/assets/2021-12-10 15-39-28.mp4 differ diff --git a/.gitbook/assets/2021-12-10 15-41-07.gif b/.gitbook/assets/2021-12-10 15-41-07.gif new file mode 100644 index 0000000..a2dd3bc Binary files /dev/null and b/.gitbook/assets/2021-12-10 15-41-07.gif differ diff --git a/.gitbook/assets/Dune-logo-Full.zip b/.gitbook/assets/Dune-logo-Full.zip new file mode 100644 index 0000000..310a803 Binary files /dev/null and b/.gitbook/assets/Dune-logo-Full.zip differ diff --git a/.gitbook/assets/Screen Shot 2022-01-03 at 14.43.07.png b/.gitbook/assets/Screen Shot 2022-01-03 at 14.43.07.png new file mode 100644 index 0000000..f6e82c9 Binary files /dev/null and b/.gitbook/assets/Screen Shot 2022-01-03 at 14.43.07.png differ diff --git a/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22 (1).png b/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22 (1).png new file mode 100644 index 0000000..cfa941f Binary files /dev/null and b/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22 (1).png differ diff --git a/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22.png b/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22.png new file mode 100644 index 0000000..cfa941f Binary files /dev/null and b/.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22.png differ diff --git a/.gitbook/assets/Screen Shot 2022-01-03 at 16.02.19.png b/.gitbook/assets/Screen Shot 2022-01-03 at 16.02.19.png new file mode 100644 index 0000000..493fd99 Binary files /dev/null and b/.gitbook/assets/Screen Shot 2022-01-03 at 16.02.19.png differ diff --git a/.gitbook/assets/Screen Shot 2022-01-03 at 16.05.07.png b/.gitbook/assets/Screen Shot 2022-01-03 at 16.05.07.png new file mode 100644 index 0000000..edb294a Binary files /dev/null and b/.gitbook/assets/Screen Shot 2022-01-03 at 16.05.07.png differ diff --git a/.gitbook/assets/column chunk minmax.png b/.gitbook/assets/column chunk minmax.png new file mode 100644 index 0000000..3e4d1a3 Binary files /dev/null and b/.gitbook/assets/column chunk minmax.png differ diff --git a/.gitbook/assets/column oriented database.png b/.gitbook/assets/column oriented database.png new file mode 100644 index 0000000..7bdf1b3 Binary files /dev/null and b/.gitbook/assets/column oriented database.png differ diff --git a/.gitbook/assets/dune-horizontal-logo-cover (1).png b/.gitbook/assets/dune-horizontal-logo-cover (1).png new file mode 100644 index 0000000..536e9d2 Binary files /dev/null and b/.gitbook/assets/dune-horizontal-logo-cover (1).png differ diff --git a/.gitbook/assets/dune-horizontal-logo-cover.png b/.gitbook/assets/dune-horizontal-logo-cover.png new file mode 100644 index 0000000..ee2582d Binary files /dev/null and b/.gitbook/assets/dune-horizontal-logo-cover.png differ diff --git a/.gitbook/assets/dune-horizontal-logo-dark.svg b/.gitbook/assets/dune-horizontal-logo-dark.svg new file mode 100644 index 0000000..d803f4b --- /dev/null +++ b/.gitbook/assets/dune-horizontal-logo-dark.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-horizontal-logo-dark@2x.png b/.gitbook/assets/dune-horizontal-logo-dark@2x.png new file mode 100644 index 0000000..67fad1a Binary files /dev/null and b/.gitbook/assets/dune-horizontal-logo-dark@2x.png differ diff --git a/.gitbook/assets/dune-horizontal-logo.svg b/.gitbook/assets/dune-horizontal-logo.svg new file mode 100644 index 0000000..c091e6f --- /dev/null +++ b/.gitbook/assets/dune-horizontal-logo.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-horizontal-logo@2x.png b/.gitbook/assets/dune-horizontal-logo@2x.png new file mode 100644 index 0000000..e006e65 Binary files /dev/null and b/.gitbook/assets/dune-horizontal-logo@2x.png differ diff --git a/.gitbook/assets/dune-icon-only (1).png b/.gitbook/assets/dune-icon-only (1).png new file mode 100644 index 0000000..b7daa24 Binary files /dev/null and b/.gitbook/assets/dune-icon-only (1).png differ diff --git a/.gitbook/assets/dune-icon-only.png b/.gitbook/assets/dune-icon-only.png new file mode 100644 index 0000000..b7daa24 Binary files /dev/null and b/.gitbook/assets/dune-icon-only.png differ diff --git a/.gitbook/assets/dune-icon-only.svg b/.gitbook/assets/dune-icon-only.svg new file mode 100644 index 0000000..cfd7337 --- /dev/null +++ b/.gitbook/assets/dune-icon-only.svg @@ -0,0 +1,4 @@ + + + + diff --git a/.gitbook/assets/dune-icon-only@2x (1).png b/.gitbook/assets/dune-icon-only@2x (1).png new file mode 100644 index 0000000..de96172 Binary files /dev/null and b/.gitbook/assets/dune-icon-only@2x (1).png differ diff --git a/.gitbook/assets/dune-icon-only@2x.png b/.gitbook/assets/dune-icon-only@2x.png new file mode 100644 index 0000000..de96172 Binary files /dev/null and b/.gitbook/assets/dune-icon-only@2x.png differ diff --git a/.gitbook/assets/dune-standard-logo (1).svg b/.gitbook/assets/dune-standard-logo (1).svg new file mode 100644 index 0000000..4e53158 --- /dev/null +++ b/.gitbook/assets/dune-standard-logo (1).svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-standard-logo-cover.png b/.gitbook/assets/dune-standard-logo-cover.png new file mode 100644 index 0000000..6bc0b41 Binary files /dev/null and b/.gitbook/assets/dune-standard-logo-cover.png differ diff --git a/.gitbook/assets/dune-standard-logo-dark (1).svg b/.gitbook/assets/dune-standard-logo-dark (1).svg new file mode 100644 index 0000000..650b901 --- /dev/null +++ b/.gitbook/assets/dune-standard-logo-dark (1).svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-standard-logo-dark.svg b/.gitbook/assets/dune-standard-logo-dark.svg new file mode 100644 index 0000000..df1fcaf --- /dev/null +++ b/.gitbook/assets/dune-standard-logo-dark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitbook/assets/dune-standard-logo-dark@2x (1).png b/.gitbook/assets/dune-standard-logo-dark@2x (1).png new file mode 100644 index 0000000..388a63d Binary files /dev/null and b/.gitbook/assets/dune-standard-logo-dark@2x (1).png differ diff --git a/.gitbook/assets/dune-standard-logo-dark@2x.png b/.gitbook/assets/dune-standard-logo-dark@2x.png new file mode 100644 index 0000000..5477197 Binary files /dev/null and b/.gitbook/assets/dune-standard-logo-dark@2x.png differ diff --git a/.gitbook/assets/dune-standard-logo.svg b/.gitbook/assets/dune-standard-logo.svg new file mode 100644 index 0000000..5ead416 --- /dev/null +++ b/.gitbook/assets/dune-standard-logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitbook/assets/dune-standard-logo@2x (1).png b/.gitbook/assets/dune-standard-logo@2x (1).png new file mode 100644 index 0000000..c40f7e2 Binary files /dev/null and b/.gitbook/assets/dune-standard-logo@2x (1).png differ diff --git a/.gitbook/assets/dune-standard-logo@2x.png b/.gitbook/assets/dune-standard-logo@2x.png new file mode 100644 index 0000000..f2980e9 Binary files /dev/null and b/.gitbook/assets/dune-standard-logo@2x.png differ diff --git a/.gitbook/assets/dune-vertical-logo (1).svg b/.gitbook/assets/dune-vertical-logo (1).svg new file mode 100644 index 0000000..a339a8b --- /dev/null +++ b/.gitbook/assets/dune-vertical-logo (1).svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitbook/assets/dune-vertical-logo-cover (1).png b/.gitbook/assets/dune-vertical-logo-cover (1).png new file mode 100644 index 0000000..15ef379 Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo-cover (1).png differ diff --git a/.gitbook/assets/dune-vertical-logo-cover.png b/.gitbook/assets/dune-vertical-logo-cover.png new file mode 100644 index 0000000..dd721b6 Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo-cover.png differ diff --git a/.gitbook/assets/dune-vertical-logo-dark (1).svg b/.gitbook/assets/dune-vertical-logo-dark (1).svg new file mode 100644 index 0000000..6df6d01 --- /dev/null +++ b/.gitbook/assets/dune-vertical-logo-dark (1).svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-vertical-logo-dark.svg b/.gitbook/assets/dune-vertical-logo-dark.svg new file mode 100644 index 0000000..4e7a2d5 --- /dev/null +++ b/.gitbook/assets/dune-vertical-logo-dark.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitbook/assets/dune-vertical-logo-dark@2x (1).png b/.gitbook/assets/dune-vertical-logo-dark@2x (1).png new file mode 100644 index 0000000..1cf2837 Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo-dark@2x (1).png differ diff --git a/.gitbook/assets/dune-vertical-logo-dark@2x.png b/.gitbook/assets/dune-vertical-logo-dark@2x.png new file mode 100644 index 0000000..66d984a Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo-dark@2x.png differ diff --git a/.gitbook/assets/dune-vertical-logo.svg b/.gitbook/assets/dune-vertical-logo.svg new file mode 100644 index 0000000..0a55262 --- /dev/null +++ b/.gitbook/assets/dune-vertical-logo.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitbook/assets/dune-vertical-logo@2x (1).png b/.gitbook/assets/dune-vertical-logo@2x (1).png new file mode 100644 index 0000000..960c44d Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo@2x (1).png differ diff --git a/.gitbook/assets/dune-vertical-logo@2x.png b/.gitbook/assets/dune-vertical-logo@2x.png new file mode 100644 index 0000000..fbe2fb2 Binary files /dev/null and b/.gitbook/assets/dune-vertical-logo@2x.png differ diff --git a/.gitbook/assets/image (1).png b/.gitbook/assets/image (1).png new file mode 100644 index 0000000..ababac9 Binary files /dev/null and b/.gitbook/assets/image (1).png differ diff --git a/.gitbook/assets/image (10).png b/.gitbook/assets/image (10).png new file mode 100644 index 0000000..e1a714d Binary files /dev/null and b/.gitbook/assets/image (10).png differ diff --git a/.gitbook/assets/image (11).png b/.gitbook/assets/image (11).png new file mode 100644 index 0000000..637f520 Binary files /dev/null and b/.gitbook/assets/image (11).png differ diff --git a/.gitbook/assets/image (12).png b/.gitbook/assets/image (12).png new file mode 100644 index 0000000..d264edd Binary files /dev/null and b/.gitbook/assets/image (12).png differ diff --git a/.gitbook/assets/image (13) (1) (1).png b/.gitbook/assets/image (13) (1) (1).png new file mode 100644 index 0000000..31ff57d Binary files /dev/null and b/.gitbook/assets/image (13) (1) (1).png differ diff --git a/.gitbook/assets/image (13) (1) (2).png b/.gitbook/assets/image (13) (1) (2).png new file mode 100644 index 0000000..31ff57d Binary files /dev/null and b/.gitbook/assets/image (13) (1) (2).png differ diff --git a/.gitbook/assets/image (13) (1).png b/.gitbook/assets/image (13) (1).png new file mode 100644 index 0000000..31ff57d Binary files /dev/null and b/.gitbook/assets/image (13) (1).png differ diff --git a/.gitbook/assets/image (13) (2).png b/.gitbook/assets/image (13) (2).png new file mode 100644 index 0000000..ea310e6 Binary files /dev/null and b/.gitbook/assets/image (13) (2).png differ diff --git a/.gitbook/assets/image (13).png b/.gitbook/assets/image (13).png new file mode 100644 index 0000000..d787a2f Binary files /dev/null and b/.gitbook/assets/image (13).png differ diff --git a/.gitbook/assets/image (14).png b/.gitbook/assets/image (14).png new file mode 100644 index 0000000..881fbdd Binary files /dev/null and b/.gitbook/assets/image (14).png differ diff --git a/.gitbook/assets/image (15).png b/.gitbook/assets/image (15).png new file mode 100644 index 0000000..17d8f37 Binary files /dev/null and b/.gitbook/assets/image (15).png differ diff --git a/.gitbook/assets/image (16).png b/.gitbook/assets/image (16).png new file mode 100644 index 0000000..33ab982 Binary files /dev/null and b/.gitbook/assets/image (16).png differ diff --git a/.gitbook/assets/image (17).png b/.gitbook/assets/image (17).png new file mode 100644 index 0000000..d77a392 Binary files /dev/null and b/.gitbook/assets/image (17).png differ diff --git a/.gitbook/assets/image (18) (1).png b/.gitbook/assets/image (18) (1).png new file mode 100644 index 0000000..93b4023 Binary files /dev/null and b/.gitbook/assets/image (18) (1).png differ diff --git a/.gitbook/assets/image (18).png b/.gitbook/assets/image (18).png new file mode 100644 index 0000000..982bfb8 Binary files /dev/null and b/.gitbook/assets/image (18).png differ diff --git a/.gitbook/assets/image (19) (1).png b/.gitbook/assets/image (19) (1).png new file mode 100644 index 0000000..6387e29 Binary files /dev/null and b/.gitbook/assets/image (19) (1).png differ diff --git a/.gitbook/assets/image (19) (2).png b/.gitbook/assets/image (19) (2).png new file mode 100644 index 0000000..6387e29 Binary files /dev/null and b/.gitbook/assets/image (19) (2).png differ diff --git a/.gitbook/assets/image (19).png b/.gitbook/assets/image (19).png new file mode 100644 index 0000000..6387e29 Binary files /dev/null and b/.gitbook/assets/image (19).png differ diff --git a/.gitbook/assets/image (2).png b/.gitbook/assets/image (2).png new file mode 100644 index 0000000..dc768ef Binary files /dev/null and b/.gitbook/assets/image (2).png differ diff --git a/.gitbook/assets/image (20).png b/.gitbook/assets/image (20).png new file mode 100644 index 0000000..2b31a1d Binary files /dev/null and b/.gitbook/assets/image (20).png differ diff --git a/.gitbook/assets/image (21).png b/.gitbook/assets/image (21).png new file mode 100644 index 0000000..0847a0c Binary files /dev/null and b/.gitbook/assets/image (21).png differ diff --git a/.gitbook/assets/image (22).png b/.gitbook/assets/image (22).png new file mode 100644 index 0000000..4b57374 Binary files /dev/null and b/.gitbook/assets/image (22).png differ diff --git a/.gitbook/assets/image (23).png b/.gitbook/assets/image (23).png new file mode 100644 index 0000000..8d09af5 Binary files /dev/null and b/.gitbook/assets/image (23).png differ diff --git a/.gitbook/assets/image (24).png b/.gitbook/assets/image (24).png new file mode 100644 index 0000000..d287bb7 Binary files /dev/null and b/.gitbook/assets/image (24).png differ diff --git a/.gitbook/assets/image (25).png b/.gitbook/assets/image (25).png new file mode 100644 index 0000000..0e47ef0 Binary files /dev/null and b/.gitbook/assets/image (25).png differ diff --git a/.gitbook/assets/image (26).png b/.gitbook/assets/image (26).png new file mode 100644 index 0000000..6be33db Binary files /dev/null and b/.gitbook/assets/image (26).png differ diff --git a/.gitbook/assets/image (27).png b/.gitbook/assets/image (27).png new file mode 100644 index 0000000..b923849 Binary files /dev/null and b/.gitbook/assets/image (27).png differ diff --git a/.gitbook/assets/image (28) (1).png b/.gitbook/assets/image (28) (1).png new file mode 100644 index 0000000..b923849 Binary files /dev/null and b/.gitbook/assets/image (28) (1).png differ diff --git a/.gitbook/assets/image (28).png b/.gitbook/assets/image (28).png new file mode 100644 index 0000000..b923849 Binary files /dev/null and b/.gitbook/assets/image (28).png differ diff --git a/.gitbook/assets/image (29).png b/.gitbook/assets/image (29).png new file mode 100644 index 0000000..3c848f7 Binary files /dev/null and b/.gitbook/assets/image (29).png differ diff --git a/.gitbook/assets/image (3).png b/.gitbook/assets/image (3).png new file mode 100644 index 0000000..e8f03fc Binary files /dev/null and b/.gitbook/assets/image (3).png differ diff --git a/.gitbook/assets/image (30) (1).png b/.gitbook/assets/image (30) (1).png new file mode 100644 index 0000000..b923849 Binary files /dev/null and b/.gitbook/assets/image (30) (1).png differ diff --git a/.gitbook/assets/image (30).png b/.gitbook/assets/image (30).png new file mode 100644 index 0000000..fd2a27e Binary files /dev/null and b/.gitbook/assets/image (30).png differ diff --git a/.gitbook/assets/image (31).png b/.gitbook/assets/image (31).png new file mode 100644 index 0000000..8dcbd54 Binary files /dev/null and b/.gitbook/assets/image (31).png differ diff --git a/.gitbook/assets/image (32).png b/.gitbook/assets/image (32).png new file mode 100644 index 0000000..8dcbd54 Binary files /dev/null and b/.gitbook/assets/image (32).png differ diff --git a/.gitbook/assets/image (33).png b/.gitbook/assets/image (33).png new file mode 100644 index 0000000..6d1ec07 Binary files /dev/null and b/.gitbook/assets/image (33).png differ diff --git a/.gitbook/assets/image (34).png b/.gitbook/assets/image (34).png new file mode 100644 index 0000000..ae1038c Binary files /dev/null and b/.gitbook/assets/image (34).png differ diff --git a/.gitbook/assets/image (35).png b/.gitbook/assets/image (35).png new file mode 100644 index 0000000..076c4c2 Binary files /dev/null and b/.gitbook/assets/image (35).png differ diff --git a/.gitbook/assets/image (36).png b/.gitbook/assets/image (36).png new file mode 100644 index 0000000..400ed65 Binary files /dev/null and b/.gitbook/assets/image (36).png differ diff --git a/.gitbook/assets/image (37).png b/.gitbook/assets/image (37).png new file mode 100644 index 0000000..853a757 Binary files /dev/null and b/.gitbook/assets/image (37).png differ diff --git a/.gitbook/assets/image (38).png b/.gitbook/assets/image (38).png new file mode 100644 index 0000000..e304524 Binary files /dev/null and b/.gitbook/assets/image (38).png differ diff --git a/.gitbook/assets/image (39).png b/.gitbook/assets/image (39).png new file mode 100644 index 0000000..8c42f7e Binary files /dev/null and b/.gitbook/assets/image (39).png differ diff --git a/.gitbook/assets/image (4).png b/.gitbook/assets/image (4).png new file mode 100644 index 0000000..995b018 Binary files /dev/null and b/.gitbook/assets/image (4).png differ diff --git a/.gitbook/assets/image (40).png b/.gitbook/assets/image (40).png new file mode 100644 index 0000000..06a5fd7 Binary files /dev/null and b/.gitbook/assets/image (40).png differ diff --git a/.gitbook/assets/image (41).png b/.gitbook/assets/image (41).png new file mode 100644 index 0000000..9626494 Binary files /dev/null and b/.gitbook/assets/image (41).png differ diff --git a/.gitbook/assets/image (42).png b/.gitbook/assets/image (42).png new file mode 100644 index 0000000..da2655e Binary files /dev/null and b/.gitbook/assets/image (42).png differ diff --git a/.gitbook/assets/image (43).png b/.gitbook/assets/image (43).png new file mode 100644 index 0000000..e236886 Binary files /dev/null and b/.gitbook/assets/image (43).png differ diff --git a/.gitbook/assets/image (44).png b/.gitbook/assets/image (44).png new file mode 100644 index 0000000..a13fa43 Binary files /dev/null and b/.gitbook/assets/image (44).png differ diff --git a/.gitbook/assets/image (45).png b/.gitbook/assets/image (45).png new file mode 100644 index 0000000..682f8f7 Binary files /dev/null and b/.gitbook/assets/image (45).png differ diff --git a/.gitbook/assets/image (46).png b/.gitbook/assets/image (46).png new file mode 100644 index 0000000..b6f9923 Binary files /dev/null and b/.gitbook/assets/image (46).png differ diff --git a/.gitbook/assets/image (47).png b/.gitbook/assets/image (47).png new file mode 100644 index 0000000..7c5bea4 Binary files /dev/null and b/.gitbook/assets/image (47).png differ diff --git a/.gitbook/assets/image (48).png b/.gitbook/assets/image (48).png new file mode 100644 index 0000000..4a9f021 Binary files /dev/null and b/.gitbook/assets/image (48).png differ diff --git a/.gitbook/assets/image (49).png b/.gitbook/assets/image (49).png new file mode 100644 index 0000000..7f276cd Binary files /dev/null and b/.gitbook/assets/image (49).png differ diff --git a/.gitbook/assets/image (5).png b/.gitbook/assets/image (5).png new file mode 100644 index 0000000..cde4cd8 Binary files /dev/null and b/.gitbook/assets/image (5).png differ diff --git a/.gitbook/assets/image (50).png b/.gitbook/assets/image (50).png new file mode 100644 index 0000000..d733507 Binary files /dev/null and b/.gitbook/assets/image (50).png differ diff --git a/.gitbook/assets/image (51).png b/.gitbook/assets/image (51).png new file mode 100644 index 0000000..0922ac1 Binary files /dev/null and b/.gitbook/assets/image (51).png differ diff --git a/.gitbook/assets/image (52).png b/.gitbook/assets/image (52).png new file mode 100644 index 0000000..711e243 Binary files /dev/null and b/.gitbook/assets/image (52).png differ diff --git a/.gitbook/assets/image (53).png b/.gitbook/assets/image (53).png new file mode 100644 index 0000000..6afc456 Binary files /dev/null and b/.gitbook/assets/image (53).png differ diff --git a/.gitbook/assets/image (54).png b/.gitbook/assets/image (54).png new file mode 100644 index 0000000..e710688 Binary files /dev/null and b/.gitbook/assets/image (54).png differ diff --git a/.gitbook/assets/image (55).png b/.gitbook/assets/image (55).png new file mode 100644 index 0000000..2a6de60 Binary files /dev/null and b/.gitbook/assets/image (55).png differ diff --git a/.gitbook/assets/image (56).png b/.gitbook/assets/image (56).png new file mode 100644 index 0000000..0ef68d4 Binary files /dev/null and b/.gitbook/assets/image (56).png differ diff --git a/.gitbook/assets/image (57).png b/.gitbook/assets/image (57).png new file mode 100644 index 0000000..a520271 Binary files /dev/null and b/.gitbook/assets/image (57).png differ diff --git a/.gitbook/assets/image (58).png b/.gitbook/assets/image (58).png new file mode 100644 index 0000000..f277d60 Binary files /dev/null and b/.gitbook/assets/image (58).png differ diff --git a/.gitbook/assets/image (59).png b/.gitbook/assets/image (59).png new file mode 100644 index 0000000..556e67b Binary files /dev/null and b/.gitbook/assets/image (59).png differ diff --git a/.gitbook/assets/image (6).png b/.gitbook/assets/image (6).png new file mode 100644 index 0000000..dcd5088 Binary files /dev/null and b/.gitbook/assets/image (6).png differ diff --git a/.gitbook/assets/image (60).png b/.gitbook/assets/image (60).png new file mode 100644 index 0000000..d3ecf45 Binary files /dev/null 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/.gitbook/assets/image (7).png b/.gitbook/assets/image (7).png new file mode 100644 index 0000000..35e8efa Binary files /dev/null and b/.gitbook/assets/image (7).png differ diff --git a/.gitbook/assets/image (8).png b/.gitbook/assets/image (8).png new file mode 100644 index 0000000..9856e18 Binary files /dev/null and b/.gitbook/assets/image (8).png differ diff --git a/.gitbook/assets/image (9).png b/.gitbook/assets/image (9).png new file mode 100644 index 0000000..759c710 Binary files /dev/null and b/.gitbook/assets/image (9).png differ diff --git a/.gitbook/assets/image.png b/.gitbook/assets/image.png new file mode 100644 index 0000000..12bdbd9 Binary files /dev/null and b/.gitbook/assets/image.png differ diff --git a/.gitbook/assets/minmax schema.JPG b/.gitbook/assets/minmax schema.JPG new file mode 100644 index 0000000..bda0889 Binary files /dev/null and b/.gitbook/assets/minmax schema.JPG differ diff --git a/.gitbook/assets/opening up profile.gif b/.gitbook/assets/opening up profile.gif new file mode 100644 index 0000000..c93c7e4 Binary files /dev/null and b/.gitbook/assets/opening up profile.gif differ diff --git a/.gitbook/assets/parquet file schema.png b/.gitbook/assets/parquet file schema.png new file mode 100644 index 0000000..5657c58 Binary files /dev/null and b/.gitbook/assets/parquet file schema.png differ diff --git a/.gitbook/assets/row based database (1).png b/.gitbook/assets/row based database (1).png new file mode 100644 index 0000000..f7ca8b3 Binary files /dev/null and b/.gitbook/assets/row based database (1).png differ diff --git a/.gitbook/assets/row based database.png b/.gitbook/assets/row based database.png new file mode 100644 index 0000000..f7ca8b3 Binary files /dev/null and b/.gitbook/assets/row based database.png differ diff --git a/README.md b/README.md index f4ba226..3679d50 100644 --- a/README.md +++ b/README.md @@ -1 +1,81 @@ -# docs-zh-cn +--- +description: Welcome to Dune +--- + +# Introduction to Dune + +## Introduction + +**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:** + +[How much volume flows through Uniswap each day?](https://dune.xyz/queries/3) + +[Which Dex has the highest volume?](https://dune.xyz/queries/1847) + +[How are important Stablecoins behaving today?](https://dune.xyz/hagaetc/stablecoins) + +## Dune Basics + +#### Dune App + +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. + +#### Data available on Dune + +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 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).\ +\ +You can currently query data from **Ethereum, Polygon, Binance Smart Chain, Optimism** and **Gnosis Chain**. + +Dune picks up events and internal calls from the blockchains we index, we don't have state/storage data. + +## Queries + +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. + +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. 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. + +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) + +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 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 + +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 is a collaborative effort + +On Dune, all queries and datasets are public by default. + +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. + +If you do need Privacy for your Queries, the [pro Plan](https://dune.xyz/pricing) has got you covered. + +Join our [Community Discord](https://discord.gg/BJBHFR6sdy) to get world class support from our team and the community. + +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 new file mode 100644 index 0000000..8c30513 --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,100 @@ +# Table of contents + +* [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) + * [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 Engine V2 (beta) + +* [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 + +* [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 + +* [Onboarding to Dune](onboarding/onboarding-to-dune.md) + +## Bounties + +* [Wizard Request Program](bounties/wizard-request-program.md) + +## Dune Charts across the web + +* [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 + +* [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 + +* [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 new file mode 100644 index 0000000..eb7bc74 --- /dev/null +++ b/about/tutorials/README.md @@ -0,0 +1,44 @@ +# Tutorials + +## How to get started + +**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. + +The Dune Team and several of our community members have produced great content to aid you in your journey of becoming a Dune Wizard. + +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) +{% endcontent-ref %} + +{% content-ref url="sql-guides.md" %} +[sql-guides.md](sql-guides.md) +{% endcontent-ref %} + +{% content-ref url="dune-guides/" %} +[dune-guides](dune-guides/) +{% endcontent-ref %} + +## What do you need to know? + +#### SQL knowledge + +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. + +#### Ethereum Virtual Machine data + +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 new file mode 100644 index 0000000..54a80a7 --- /dev/null +++ b/about/tutorials/dune-guides/README.md @@ -0,0 +1,36 @@ +# Dune Guides + +Some of our Community Members have produced great written tutorials for Dune: + +[Andrew Hong](https://twitter.com/andrewhong5297) + +* [Your guide to basic SQL while learning Ethereum at the same time](https://towardsdatascience.com/your-guide-to-basic-sql-while-learning-ethereum-at-the-same-time-9eac17a05929) (Part 1) +* [Your guide to intermediate SQL while learning Ethereum at the same time](https://towardsdatascience.com/your-guide-to-intermediate-sql-while-learning-ethereum-at-the-same-time-7b25119ef1e2?source=user\_profile---------6----------------------------) (Part 2) +* [Learning SQL and Ethereum](https://towardsdatascience.com/learning-sql-and-ethereum-part-3-5422f080ad36) (Part 3) +* [SQL on Ethereum: How to Work With All the Data from a Transaction](https://ath.mirror.xyz/mbR1n\_CvflL1KIKCTG42bnM4HpfGBqDPNndH8mu2eJw) + +[Alex Manuskin](https://twitter.com/amanusk\_) + +* [How to get started with querying on Dune Analytics](https://dune.xyz/blog/get-started-guide) + +[Paul Pivat](https://twitter.com/paulapivat) + +* [Lean foundational Ethereum topics with SQL](https://ethereum.org/en/developers/tutorials/learn-foundational-ethereum-topics-with-sql/) + +[Alex Kroeger](https://twitter.com/alex\_kroeger) + +* [How to use Dune Analytics like a degen](https://mirror.xyz/0x7B542178633f16940a131F8F6d670ffdbBe6b2Ab/0C3EQBtFqAK4k2TAGPZhg0JMY-upfTAxuTD-o91vBPc) + +[Chuxin](https://twitter.com/chuxin\_h) + +* [Select \* from web3](https://www.chuxinhuang.com/blog/select-from-web3/) + +[Gracelily](https://twitter.com/\_grace\_lily) + +* [PostgreSQL Query Optimization Tricks - How to Make Queries Faster in Dune Analytics](https://gracelily.medium.com/postgresql-query-optimization-tricks-6d5b7358d7fa) + + + +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 new file mode 100644 index 0000000..8f64ca4 --- /dev/null +++ b/about/tutorials/dune-guides/tips.md @@ -0,0 +1,104 @@ +# Tips for querying + +You can interact with the data tables through our interface at [dune.xyz](https://www.dune.xyz/). + +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. + +## Use abstractions + +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 + +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 + +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” +FROM projectname.”contractName_evt_EventName” +LIMIT 10 +``` + +In Postgres, double quotes are reserved for tables and columns, whereas single quotes are reserved for values: + +```sql +SELECT “columnName” +FROM projectname.”contratName_evt_eventName” +WHERE contract_address = '\x6B175474E89094C44Da98b954EedeAC495271d0F' +LIMIT 10 +``` + +Schemas are always lowercase in Dune. + +## Remove decimals + +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` + +## Use `date_trunc` to get time + +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 +``` + +Here you can use minute, day, week, month. + +## 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 +``` + +Then you can simply multiply the value or amount from the smart contract event with the usd price in your `SELECT` statement: `* p.price`. + +## Token symbols + +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. + +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. + +Click `Add parameter` in the bottom right of the SQL editor on the query editor page + +![](https://i.imgur.com/rYJVSqA.png) + +Double curly bracets will appear in your query `{{}}`. Inside these you put the name of your paramter like `token symbol` or `holder address`. + +Note that you need to put single quotes if you want to use the parameter in your query `WHERE token = '{{token symbol}}'`. + +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 +``` + +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 new file mode 100644 index 0000000..2e530ce --- /dev/null +++ b/about/tutorials/our-network-course.md @@ -0,0 +1,13 @@ +# Our Network course + +Our friends from OurNetwork have created a course in cooperation with Dune Analytics that taught 30 people web3 data in 30 days. + +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. diff --git a/about/tutorials/queries/README.md b/about/tutorials/queries/README.md new file mode 100644 index 0000000..68ab646 --- /dev/null +++ b/about/tutorials/queries/README.md @@ -0,0 +1,40 @@ +# Query templates + +**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 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) +* [https://dune.xyz/kroeger0x](https://dune.xyz/kroeger0x) +* \*\*\*\*[https://dune.xyz/eliasimos](https://dune.xyz/eliasimos) +* [https://dune.xyz/0xBoxer](https://dune.xyz/0xBoxer) +* \*\*\*\*[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) +{% endcontent-ref %} + +{% content-ref url="supply.md" %} +[supply.md](supply.md) +{% endcontent-ref %} + +{% content-ref url="untitled-3.md" %} +[untitled-3.md](untitled-3.md) +{% endcontent-ref %} + +{% content-ref url="untitled-2.md" %} +[untitled-2.md](untitled-2.md) +{% endcontent-ref %} + +{% content-ref url="untitled-1.md" %} +[untitled-1.md](untitled-1.md) +{% endcontent-ref %} diff --git a/about/tutorials/queries/eth-balance-of-a-wallet.md b/about/tutorials/queries/eth-balance-of-a-wallet.md new file mode 100644 index 0000000..22bc42a --- /dev/null +++ b/about/tutorials/queries/eth-balance-of-a-wallet.md @@ -0,0 +1,38 @@ +# ETH Balance of a wallet + +This Query yields the ETH balance of a wallet over time. + +```sql +Select sum(transfer) over (order by day asc), day +from ( + +SELECT date_trunc('day', block_time) as day, sum(-value/1e18) as transfer + FROM ethereum."traces" + WHERE "from" = '\xb66284947F9A35bD9FA893D444F19033FeBdA4A1' --optimism bridge + AND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null) + AND "tx_success" = true + AND success = true + GROUP BY 1 + + UNION all + + SELECT + date_trunc('day', block_time) as day, sum(value/1e18) as transfer + FROM ethereum."traces" + WHERE "to" = '\xb66284947F9A35bD9FA893D444F19033FeBdA4A1' --optimism bridge + AND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null) + AND "tx_success" = true + AND success = true + GROUP BY 1 + + UNION ALL --gas costs + + SELECT + date_trunc('day', block_time) as day, -SUM(gas_price*"gas_used")/1e18 as transfer + FROM ethereum."transactions" + WHERE "from" = '\xb66284947F9A35bD9FA893D444F19033FeBdA4A1' --optimism bridge + GROUP BY 1 + ) as x +``` + +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 new file mode 100644 index 0000000..ecf3ad8 --- /dev/null +++ b/about/tutorials/queries/gas-metrics-per-wallet.md @@ -0,0 +1,180 @@ +# gas metrics per wallet + +### Running Total of Gas Paid in USD + +```sql +with alltransactions +AS ( +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + date_trunc('minute', block_time), + SUM(eth_paid_for_tx*price) over (ORDER BY date_trunc('minute', block_time)) AS "Total Gas Fees Paid in USD" +FROM alltransactions +LEFT JOIN + (SELECT + minute, + price + FROM prices.usd + WHERE + symbol = 'WETH' AND + minute > '{{2. Start Date}}') AS prices +ON date_trunc('minute', block_time) = minute +ORDER BY block_time DESC +``` + +### Running Total of Gas Paid in ETH + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + block_time, + SUM(eth_paid_for_tx) over (ORDER BY block_time ASC) as "ETH Paid" +FROM alltransactions +ORDER BY block_time DESC +``` + +### Average Gas Price Paid + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + AVG(gas_prices) as "Average Gas Prices" +FROM alltransactions +``` + +### Average Gas Fee in USD + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + AVG(eth_paid_for_tx*price) AS "AVG Gas Fee per TX Paid in USD" +FROM alltransactions +LEFT JOIN + (SELECT + minute, + price + FROM prices.usd + WHERE + symbol = 'WETH' AND + minute > '{{2. Start Date}}') AS prices +ON date_trunc('minute', block_time) = minute +``` + +### Highest Gas Fee Paid in USD + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + MAX(eth_paid_for_tx*price) AS "Higest Gas Fee Paid (USD)" +FROM alltransactions +LEFT JOIN + (SELECT + minute, + price + FROM prices.usd + WHERE + symbol = 'WETH' AND + minute > '{{2. Start Date}}') AS prices +ON date_trunc('minute', block_time) = minute +``` + +### Gas Fees Paid by Month in USD + +```sql +with alltransactions +AS ( +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + date_trunc('month', block_time), + SUM(eth_paid_for_tx*price) AS "Total Gas Fees Paid in USD" +FROM alltransactions +LEFT JOIN + (SELECT + minute, + price + FROM prices.usd + WHERE + symbol = 'WETH' AND + minute > '{{2. Start Date}}') AS prices +ON date_trunc('month', block_time) = minute +GROUP BY 1 + +``` diff --git a/about/tutorials/queries/price-queries.md b/about/tutorials/queries/price-queries.md new file mode 100644 index 0000000..2577baf --- /dev/null +++ b/about/tutorials/queries/price-queries.md @@ -0,0 +1,110 @@ +# price queries + +### Centralized exchange price data + +```sql +Select + minute, + price, + symbol +from prices.usd + +WHERE symbol = '{{1. Symbol}}' + +and minute > now() - interval '1hour' +``` + +### Decentralized exchange price data + +```sql +Select + hour, + median_price, + d."contract_address" +from dex."view_token_prices" d +left join erc20.tokens e on d.contract_address = e.contract_address +WHERE symbol = '{{1. Symbol}}' + +and hour > now() - interval '1000hour' +``` + +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 ( + SELECT + token_a_address as contract_address, + usd_amount/token_a_amount as price, + block_time + FROM dex.trades + WHERE 1=1 + AND usd_amount > 0 + AND category = 'DEX' + AND token_a_amount > 0 + AND token_a_address = CONCAT('\x', substring('{{1. token_address}}' from 3))::bytea + + UNION ALL + + SELECT + token_b_address as contract_address, + usd_amount/token_b_amount as price, + block_time + FROM dex.trades + WHERE 1=1 + AND usd_amount > 0 + AND category = 'DEX' + AND token_b_amount > 0 + AND token_b_address = CONCAT('\x', substring('{{1. token_address}}' from 3))::bytea + + ), + + + rawdata as ( + + SELECT + date_trunc('hour', block_time) as hour, + d.contract_address, + e.symbol as asset, + (PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY price)) AS price, + count(1) AS sample_size + FROM dex_trades d + left join erc20.tokens e on e.contract_address = d.contract_address + GROUP BY 1, 2, 3 + + ) + + ,leaddata as + ( + SELECT + hour, + contract_address, + asset, + price, + sample_size, + lead(hour, 1, now() ) OVER (PARTITION BY contract_address ORDER BY hour asc) AS next_hour + from rawdata + where sample_size > 3 + ) + + ,hours AS + ( + SELECT + generate_series('2020-01-01'::TIMESTAMP, date_trunc('hour', NOW()), '1 hour') AS hour + ) + + + + SELECT + d.hour as hour, + contract_address, + asset, + price, + sample_size + from leaddata b + INNER JOIN hours d ON b.hour <= d.hour + AND d.hour < b.next_hour -- Yields an observation for every hour after the first transfer until the next hour with transfer +``` + +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 new file mode 100644 index 0000000..c5ad313 --- /dev/null +++ b/about/tutorials/queries/supply.md @@ -0,0 +1,44 @@ +# total supply over time of a token + + + +You can either use that token's specific tables as long as they are [decoded](../../../data-tables/data-tables/decoded-data.md): + +```sql +SELECT +week, +SUM(transfer) over (order by week) +FROM + ( + SELECT + date_trunc('week', evt_block_time) as week, + sum(amount/1e18) as transfer + FROM ptokens."pBTC_evt_Minted" tr + GROUP BY 1 +UNION + SELECT + date_trunc('week', evt_block_time) as week, + sum(-amount/1e18) as transfer + FROM ptokens."pBTC_evt_Burned" tr + GROUP BY 1 +) as net; +``` + +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 + sum(amount), + day + +from erc20."view_token_balances_daily" +where token_address = '\x429881672B9AE42b8EbA0E26cD9C73711b891Ca5' +and wallet_address != '\x0000000000000000000000000000000000000000' --mint address +and wallet_address != '\x000000000000000000000000000000000000dead' --burn address +group by 2 + +--mint and burn address are not standardized, make sure to query for the right ones +``` + diff --git a/about/tutorials/queries/tx-wallet.md b/about/tutorials/queries/tx-wallet.md new file mode 100644 index 0000000..761d488 --- /dev/null +++ b/about/tutorials/queries/tx-wallet.md @@ -0,0 +1,76 @@ +# raw transactions per wallet + +### Total # of Transactions + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + count(*) +FROM alltransactions + +``` + +### Transaction Success Rate + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + success, + count(success)*100/sum(count(*)) over () +FROM alltransactions +GROUP by success +ORDER BY success DESC +``` + +### Running Total of # of Transactions + +```sql +with alltransactions +AS ( + +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + block_time, + COUNT(block_time) over (ORDER BY block_time ASC) AS "Total # of Transactions" +FROM alltransactions +``` + diff --git a/about/tutorials/queries/untitled-1.md b/about/tutorials/queries/untitled-1.md new file mode 100644 index 0000000..6ed74f4 --- /dev/null +++ b/about/tutorials/queries/untitled-1.md @@ -0,0 +1,81 @@ +# 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 ( + + SELECT day, + address, + token_address, + sum(amount) AS amount -- Net inflow or outflow per day + FROM + + ( + SELECT date_trunc('day', evt_block_time) AS day, + "to" AS address, + tr.contract_address AS token_address, + value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE "to" = '\x70c730465dff5447a12bae37090446745c9edccc' --Filter for holding address + -- AND contract_address = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- Filter for token address if you only want to see a specific token + + UNION ALL + + SELECT date_trunc('day', evt_block_time) AS day, + "from" AS address, + tr.contract_address AS token_address, + -value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE "from" = '\x70c730465dff5447a12bae37090446745c9edccc' --Filter for holding address + -- AND contract_address = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- Filter for token address if you only want to see a specific token + ) t + GROUP BY 1, 2, 3 + ) + +, balances_with_gap_days AS ( + SELECT t.day, + address, + t.token_address, + SUM(amount) OVER (PARTITION BY token_address, address ORDER BY t.day) AS balance, -- balance per day with a transfer + lead(day, 1, now()) OVER (PARTITION BY token_address, address ORDER BY t.day) AS next_day -- the day after a day with a transfer + FROM transfers t + ) + + , days AS ( + SELECT generate_series('2020-07-01'::timestamp, date_trunc('day', NOW()), '1 day') AS day -- Generate all days since the first contract + ) + +, balance_all_days AS ( + SELECT d.day, + address, + erc.symbol, + b.token_address, + SUM(balance/10^decimals) AS balance + FROM balances_with_gap_days b + INNER JOIN days d ON b.day <= d.day AND d.day < b.next_day -- Yields an observation for every day after the first transfer until the next day with transfer + INNER JOIN erc20.tokens erc ON b.token_address = erc.contract_address + GROUP BY 1, 2, 3, 4 + ORDER BY 1, 2, 3, 4 + ) + +SELECT b.day, + b.symbol, + b.token_address, + SUM(balance) AS token_balance, + SUM(balance*p.price) AS balance_usd_value +FROM balance_all_days b +LEFT JOIN ( + SELECT date_trunc('day', p.minute) as day, + contract_address, + symbol, + decimals, + AVG(p.price) as price + FROM prices."usd" p + GROUP BY 1, 2, 3, 4 + ) p ON b.day = p.day AND b.token_address = p.contract_address +GROUP BY 1,2,3 +ORDER BY 1,2,3 +; + +``` diff --git a/about/tutorials/queries/untitled-2.md b/about/tutorials/queries/untitled-2.md new file mode 100644 index 0000000..993836d --- /dev/null +++ b/about/tutorials/queries/untitled-2.md @@ -0,0 +1,51 @@ +# USD price for a token from 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. + +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` + +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 + SELECT cr."pair" AS contract, + CASE WHEN cr."token0" = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then '0' ELSE '1' END AS eth_token, + CASE WHEN cr."token1" = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then cr."token0" ELSE cr."token1" END AS other_token + FROM uniswap_v2."Factory_evt_PairCreated" cr + WHERE token0 = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' OR token1 = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' + ) + +, swap AS ( -- Get all trades on the pair last 14 days + SELECT + CASE WHEN eth_token = '0' then sw."amount0In" + sw."amount0Out" ELSE sw."amount1In" + sw."amount1Out" + END/1e18 AS eth_amt, + CASE WHEN eth_token = '1' then sw."amount0In" + sw."amount0Out" ELSE sw."amount1In" + sw."amount1Out" + END/power(10, tok."decimals") AS other_amt, -- If the token is not in the erc20.tokens list you can manually divide by 10^decimals + tok."symbol", + tok."contract_address", + date_trunc('hour', sw."evt_block_time") AS hour + FROM uniswap_v2."Pair_evt_Swap" sw + JOIN weth_pairs ON sw."contract_address" = weth_pairs."contract" + JOIN erc20."tokens" tok ON weth_pairs."other_token" = tok."contract_address" + WHERE other_token = '\xeb4c2781e4eba804ce9a9803c67d0893436bb27d' --renBTC example + -- To allow users to submit token address in the Dune UI you can use the below line: + -- WHERE other_token = CONCAT('\x', substring('{{Token address}}' from 3))::bytea -- Allow user to input 0x... format and convert to \x... format + AND sw.evt_block_time >= now() - interval '14 days' + ) + +, eth_prcs AS ( + SELECT avg(price) eth_prc, date_trunc('hour', minute) AS hour + FROM prices.layer1_usd_eth + WHERE minute >= now() - interval '14 days' + group by 2 + ) + +SELECT + AVG((eth_amt/other_amt)*eth_prc) AS usd_price, + swap."symbol" AS symbol, + swap."contract_address" AS contract_address, + eth_prcs."hour" AS hour +FROM swap JOIN eth_prcs ON swap."hour" = eth_prcs."hour" +GROUP BY 2,3,4 +; +``` diff --git a/about/tutorials/queries/untitled-3.md b/about/tutorials/queries/untitled-3.md new file mode 100644 index 0000000..1a13f47 --- /dev/null +++ b/about/tutorials/queries/untitled-3.md @@ -0,0 +1,15 @@ +# USD value of token utilised for an event + +### + +```sql +SELECT +date_trunc('week', evt_block_time), +SUM(amount/1e18 * p.price) AS staked +FROM numerai."SimpleGriefing_evt_StakeAdded" s --Replace with relevant event +LEFT JOIN prices.usd p ON p.minute = date_trunc('minute', evt_block_time) +WHERE p.symbol = 'NMR' --Replace with relevant token +-- WHERE p.contract_address = s.token_address --In case different tokens +GROUP BY 1; +``` + diff --git a/about/tutorials/queries/untitled-6.md b/about/tutorials/queries/untitled-6.md new file mode 100644 index 0000000..ebe8bfb --- /dev/null +++ b/about/tutorials/queries/untitled-6.md @@ -0,0 +1,12 @@ +# Users and amount over a trailing period + +```sql +SELECT date_trunc('day', evt_block_time), + COUNT (DISTINCT buyer), + SUM(eth_bought / 1e18) +FROM uniswap."Exchange_evt_EthPurchase" p +WHERE evt_block_time > now() - interval '7 days' +GROUP BY 1 +ORDER BY 1; +``` + diff --git a/about/tutorials/sql-guides.md b/about/tutorials/sql-guides.md new file mode 100644 index 0000000..f1697ff --- /dev/null +++ b/about/tutorials/sql-guides.md @@ -0,0 +1,16 @@ +# SQL guides + +**General PostgreSQL Tutorials** + +To be a successful Dune Wizard you need to have a good understanding of PostgreSQL to be able to query data from our database. + +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) Video Playlist (FREE) + +[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/) (FREE) + diff --git a/about/tutorials/video-series.md b/about/tutorials/video-series.md new file mode 100644 index 0000000..d5114e2 --- /dev/null +++ b/about/tutorials/video-series.md @@ -0,0 +1,34 @@ +# Video Series + +We have produced a video tutorial series on our [Youtube Channel](https://www.youtube.com/channel/UCPrm9d2hLd\_YxSExH7oRyAg). + +## 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. + +{% 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" %} + +## Episode 1: Usecases and Applications + +This Video explains the basics of Dune and what it can be used for. + +{% embed url="https://www.youtube.com/watch?v=IHC8HAZvw_Q" %} + +## Episode 2: The database + +This Video goes over the Data tables in Dune and how the database works. + +{% embed url="https://youtu.be/UDu23Eyvo_Y" %} + +## Episode 3.1: Simple Queries and recreating Fees.wtf in Dune + +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 new file mode 100644 index 0000000..e3afc81 --- /dev/null +++ b/about/usecases/README.md @@ -0,0 +1,40 @@ +--- +description: >- + Leverage Dune to generate Insights for yourself, your project or your + organisation. +--- + +# Use Cases + +## 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. + +## **What is Dune used for?** + +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) +{% endcontent-ref %} + +{% content-ref url="project-dashboards.md" %} +[project-dashboards.md](project-dashboards.md) +{% endcontent-ref %} + +{% content-ref url="ecosystem-dashboards.md" %} +[ecosystem-dashboards.md](ecosystem-dashboards.md) +{% endcontent-ref %} + +\ +What type of content is generated on 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 new file mode 100644 index 0000000..0ca7efc --- /dev/null +++ b/about/usecases/ecosystem-dashboards.md @@ -0,0 +1,23 @@ +# Ecosystem Dashboards + +**Since Dune has all the data in one place you can also check more general metrics.** + +## Gas Prices + +[https://dune.xyz/kroeger0x/gas-prices](https://dune.xyz/kroeger0x/gas-prices) + +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>) + +Data on gas spent and similar metrics can also be relevant to certain protocols, so do keep this in mind. + +## **DeFi Adoption** + +[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>) + +[https://dune.xyz/rchen8/defi-users-over-time](https://dune.xyz/rchen8/defi-users-over-time) diff --git a/about/usecases/project-dashboards.md b/about/usecases/project-dashboards.md new file mode 100644 index 0000000..d328b04 --- /dev/null +++ b/about/usecases/project-dashboards.md @@ -0,0 +1,26 @@ +--- +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)\*\*\*\* + +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. + +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 new file mode 100644 index 0000000..b2e2610 --- /dev/null +++ b/about/usecases/sector-dashboards.md @@ -0,0 +1,49 @@ +# 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 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. + +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. + +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>) + +![](<../../.gitbook/assets/image (8).png>) + +![](<../../.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. + +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 new file mode 100644 index 0000000..dd09cc6 --- /dev/null +++ b/bounties/wizard-request-program.md @@ -0,0 +1,36 @@ +# Wizard Request Program + +#### For projects looking for Wizards + +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. 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. + +#### For Wizards looking for :moneybag::moneybag::moneybag: + +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. + +**FAQs about the program** + +_- 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?_ + +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. + +\ +_- I want to create a requests but I don’t know how much should I pay/offer for it_ + +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! + +_- 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/README.md b/changelog/dune-changes/README.md new file mode 100644 index 0000000..0cfb8ba --- /dev/null +++ b/changelog/dune-changes/README.md @@ -0,0 +1,2 @@ +# Changes to Dune + diff --git a/changelog/dune-changes/august-2020.md b/changelog/dune-changes/august-2020.md new file mode 100644 index 0000000..b698c9f --- /dev/null +++ b/changelog/dune-changes/august-2020.md @@ -0,0 +1,41 @@ +# August 2020 + + + +#### Price Provider Switch + +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. + +**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 +────────┼────────────────────────── + minute │ timestamp with time zone + price │ double precision + symbol │ text +``` + +#### Changes to prices schema + +**New column decimals on prices.usd** + +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)`. + +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 +──────────────────┼───────────────────────── + minute │ timestamp with time zone + price │ double precision + decimals │ smallint + contract_address │ bytea + symbol │ text +``` diff --git a/changelog/dune-changes/january-2020.md b/changelog/dune-changes/january-2020.md new file mode 100644 index 0000000..fd62f32 --- /dev/null +++ b/changelog/dune-changes/january-2020.md @@ -0,0 +1,116 @@ +# January 2020 + +## 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 + +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: + +| Column | Type | +| ------------------ | --------- | +| `"from"` | `bytea` | +| `"to"` | `bytea` | +| `value` | `numeric` | +| `contract_address` | `bytea` | +| `evt_tx_hash` | `bytea` | +| `evt_index` | `bigint` | + +`erc20."ERC20_evt_Approval"` schema: + +| Column | Type | +| ------------------ | --------- | +| `owner` | `bytea` | +| `spender` | `bytea` | +| `value` | `numeric` | +| `contract_address` | `bytea` | +| `evt_tx_hash` | `bytea` | +| `evt_index` | `bigint` | + +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 * +FROM erc20."ERC20_evt_Approval" apps +INNER JOIN ethereum.logs +ON apps.evt_tx_hash = logs.tx_hash AND apps.evt_index = logs.index +LIMIT 100; +``` + +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.* +FROM erc20."ERC20_evt_Transfer" tr +LEFT JOIN erc20.tokens t +ON t.contract_address = tr.contract_address +WHERE symbol = 'MKR' +LIMIT 10 +``` + +Note though that + +**Examples** + +**Top token holders** + +``` +WITH transfers AS ( + SELECT + evt_tx_hash AS tx_hash, + tr."from" AS address, + -tr.value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE contract_address = '\x6810e776880c02933d47db1b9fc05908e5386b96' --GNO +UNION ALL + SELECT + evt_tx_hash AS tx_hash, + tr."to" AS address, + tr.value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE contract_address = '\x6810e776880c02933d47db1b9fc05908e5386b96' --GNO +) +SELECT address, sum(amount/1e18) as balance +FROM transfers +GROUP BY 1 +ORDER BY 2 desc +LIMIT 10 +``` + +**Token Balances** + +``` +WITH transfers AS ( + SELECT + evt_tx_hash AS tx_hash, + contract_address AS token_address, + -tr.value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE tr."from" = '\xdeadbeef' -- insert real address here +UNION ALL + SELECT + evt_tx_hash AS tx_hash, + contract_address AS token_address, + tr.value AS amount + FROM erc20."ERC20_evt_Transfer" tr + WHERE tr."to" = '\xdeadbeef' -- insert real address here +) +SELECT token_address, sum(amount/1e18) as balance +FROM transfers +GROUP BY 1 +ORDER BY 2 desc; +``` + +## 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 new file mode 100644 index 0000000..95ad1a8 --- /dev/null +++ b/changelog/dune-changes/march-2020.md @@ -0,0 +1,120 @@ +# March 2020 + + + +Big release on the data front this month. + +#### Denormalization of `block_time` and `block_number` + +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(*) +FROM uniswap."Exchange_ev t_TokenPurchase" tp +INNER JOIN ethereum.transactions tx ON tp.evt_tx_hash = tx.hash +GROUP BY 1; +``` + +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(*) +FROM uniswap."Exchange_evt_TokenPurchase" +GROUP BY 1; +``` + +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.: + +| Column | Type | +| ------------------ | ------------- | +| `contract_address` | `bytea` | +| `evt_tx_hash` | `bytea` | +| `evt_index` | `bigint` | +| `evt_block_time` | `timestamptz` | +| `evt_block_number` | `bigint` | + +#### Decoding call outputs + +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(*) +FROM compound_v2."cErc20_call_mint" +WHERE call_success +GROUP BY 1; +``` + +#### 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) +FROM ( + SELECT address, sum(amount) / 1e18 as amount + FROM ( + SELECT "from" AS address, -value AS amount + FROM ethereum.traces + WHERE "from" = '\x390435245F2f95f7443eBb045357DA743E9A65a4' + and success = true + UNION ALL + SELECT "to" AS address, value AS amount + FROM ethereum.traces + WHERE "to" = '\x390435245F2f95f7443eBb045357DA743E9A65a4' + AND success = true + UNION ALL + SELECT "from" AS address, -gas_used * gas_price as amount + FROM ethereum.transactions + WHERE "from" = '\x390435245F2f95f7443eBb045357DA743E9A65a4' + ) t + group by 1 +) a +; +``` + +**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 + +| tx\_success | sucess | +| ----------- | ------- | +| `true` | `true` | +| `true` | `false` | +| `false` | `false` | + +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 + +Upgraded the databases to postgresql 12.2. Changelog [here](https://www.postgresql.org/docs/current/release-12-2.html). + +#### Misc + +Renamed some curvefi-contracts: + +| schema | name | Address | +| ------- | ------------ | ------------------------------------------ | +| curvefi | compound | 0xe5fdbab9ad428bbb469dee4cb6608c0a8895cba5 | +| curvefi | usdt | 0x52ea46506b9cc5ef470c5bf89f17dc28bb35d85c | +| curvefi | y | 0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51 | +| curvefi | compound\_v2 | 0x2e60cf74d81ac34eb21eeff58db4d385920ef419 | +| curvefi | busd | 0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27 | +| curvefi | compound\_v3 | 0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56 | + +Moved onesplit contracts to their own schema. + +| schema | name | address | +| -------- | -------- | ------------------------------------------------------ | +| onesplit | OneSplit | 0x2ad672fda8a042c4c78c411bf9d4f1b320aa915a | +| onesplit | OneSplit | 0xdff2aa5689fcbc7f479d8c84ac857563798436dd | +| onesplit | OneSplit | 0x0a236b41add0073df05eac5fc8505ad745c\*\*\*\*\*\*7859d | diff --git a/changelog/dune-changes/march-2021.md b/changelog/dune-changes/march-2021.md new file mode 100644 index 0000000..12a7001 --- /dev/null +++ b/changelog/dune-changes/march-2021.md @@ -0,0 +1,71 @@ +--- +description: Dune Analytics version 2.0 +--- + +# March 2021 + +## Overview of changes + +* Queries + * Saving + * Running +* Refreshing +* Various other upgrades + +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. + +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. + +**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. + +> _**Useful tip:**_ Press `CMD / CTRL + Enter` to run your query. + +**Running query snippets** + +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. + +> _**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. + +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. + +This means that your dashboards will always be kept up to date when they are being viewed. + +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. + +## 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. + +**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. + +**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. + +**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.** 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 new file mode 100644 index 0000000..6387652 --- /dev/null +++ b/changelog/dune-changes/october-2019.md @@ -0,0 +1,20 @@ +# 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 + +Previously the usd price table was named `coincap."tokens/usd"` this is now changed to `prices.usd` with the fields + +``` +symbol -- unchanged +contract_address -- previously "asset" +price -- previously "average" +minute -- previously "time" +``` + +#### 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. diff --git a/data-tables/data-tables/README.md b/data-tables/data-tables/README.md new file mode 100644 index 0000000..dba9768 --- /dev/null +++ b/data-tables/data-tables/README.md @@ -0,0 +1,52 @@ +--- +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's Table Structure + +Dune aggregates blockchain data into an accessilbe PostgreSQL database. The schema can be understood in the following way: + +1\) Low-level data (raw transaction data) provides detailed records of all activities on the blockchain + +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 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). + +\ +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. + +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/) +{% endcontent-ref %} + +{% content-ref url="decoded-data.md" %} +[decoded-data.md](decoded-data.md) +{% endcontent-ref %} + +{% content-ref url="abstractions.md" %} +[abstractions.md](abstractions.md) +{% endcontent-ref %} + +{% content-ref url="prices.md" %} +[prices.md](prices.md) +{% endcontent-ref %} + +{% content-ref url="labels.md" %} +[labels.md](labels.md) +{% endcontent-ref %} diff --git a/data-tables/data-tables/abstractions.md b/data-tables/data-tables/abstractions.md new file mode 100644 index 0000000..c650359 --- /dev/null +++ b/data-tables/data-tables/abstractions.md @@ -0,0 +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 + +## What are abstractions? + +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. + +This public [github repository](https://github.com/duneanalytics/abstractions) hosts the logic to construct the tables and views. + +\ +Which abstractions are there? +----------------------------- + +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 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. + +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. + + + +### 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 + +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 new file mode 100644 index 0000000..1870c94 --- /dev/null +++ b/data-tables/data-tables/community-data/README.md @@ -0,0 +1,8 @@ +--- +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 new file mode 100644 index 0000000..7a3d42f --- /dev/null +++ b/data-tables/data-tables/community-data/flashbots.md @@ -0,0 +1,126 @@ +--- +description: >- + Flashbots is a research and development organization formed with the goal of + making sure MEV incentives do not become opaque and undemocratic. +--- + +# Flashbots + +**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 + +**Docs:** [https://docs.flashbots.net/](https://docs.flashbots.net) + +**Discord:** [https://discord.gg/7hvTycdNcK](https://discord.gg/7hvTycdNcK) + +## **flashbots.mev\_summary** + +This table contains summary of all the classified transactions + +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 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. + +Query examples can be found here: [Total Arb Protocols](https://dune.com/queries/626076/1167481) + +| **Column name** | **Type** | **Description** | +| ---------------------- | --------- | --------------------------------------------- | +| 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** + +Liquidation is another MEV strategy. This table contains details related to executed liquidations. + +Query examples can be found here: [Liquidations by Protocol](https://dune.com/queries/625715/1166880) + +| **Column name** | **Type** | **Description** | +| ------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------- | +| 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** + +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 | 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 | 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 number | +| block\_timestamp | timestamp | Block timestamp | diff --git a/data-tables/data-tables/decoded-data.md b/data-tables/data-tables/decoded-data.md new file mode 100644 index 0000000..8c64ca4 --- /dev/null +++ b/data-tables/data-tables/decoded-data.md @@ -0,0 +1,83 @@ +--- +description: >- + We decode the data emitted by smart contracts and store them in easy-to-use + tables. +--- + +# Decoded Data + +## Decoded smart contract data + +Instead of working with the traces, logs, and traces, Dune decodes smart contract activity into nice human-readable tables. + +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"` + +**function calls:** `projectname."contractName_call_eventName"` + +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). + +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? + +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). + +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) + +We usually take about 24-48 hours to decode smart contracts. + +Check out [this guide](../../duneapp/adding-new-contracts.md) to learn more about the Decoding process. + +## How to understand decoded data? + +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. + +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. + +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. + +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 + +Many dApps have numerous smart contracts that are deployed with the same bytecode. This can be: yield aggregator pools,distinctive options, liquidity pools etc. + +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>) + +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"; +``` + +will give you all the unique Uniswap Pairs with a Token Purchase event. + +[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 new file mode 100644 index 0000000..2247bcf --- /dev/null +++ b/data-tables/data-tables/erc-20-balances.md @@ -0,0 +1,120 @@ +--- +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 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. + +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: + +* 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 + wallet_address, + amount, + day, + token_symbol +from erc20."view_token_balances_daily" +where token_address = '\x429881672B9AE42b8EbA0E26cD9C73711b891Ca5' +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 + + CASE WHEN wallet_address = '\xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf' then 'dill' + WHEN wallet_address = '\xdc98556Ce24f007A5eF6dC1CE96322d65832A819' then 'uniswap' + WHEN wallet_address = '\xC52139a20A57c9002e9F5188901EF0ffC63c7205' then 'smart_treasury' + WHEN wallet_address = '\x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf' then 'polygon' + WHEN wallet_address = '\x6cc5f688a315f3dc28a7781717a9a798a59fda7b' then 'OKEX' + WHEN amount between 0 and 10 then 'Plankton(0-10)' + WHEN amount between 10 and 100 then 'shrimp(10-100)' + 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)' + --note that the order of case statements matters here + end as classification, + +sum(amount) as amount, +token_symbol +from erc20."view_token_balances_latest" +where token_address = '\x429881672B9AE42b8EbA0E26cD9C73711b891Ca5' +and wallet_address != '\x0000000000000000000000000000000000000000' +and wallet_address != '\x000000000000000000000000000000000000dead' +and amount > 0.1 --filter out dust amounts, adjust this for different tokens based on economic value +group by 1,3 +``` + +## Dashboard example: + +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 + +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 | 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 | 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 + +**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 | 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 + +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 | 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 new file mode 100644 index 0000000..6539c7a --- /dev/null +++ b/data-tables/data-tables/labels.md @@ -0,0 +1,194 @@ +# Labels + +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. + +**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_. + +Browse addresses and and labels at the [**labels page**](https://dune.xyz/labels). + +## What labels looks like + +Check out [this dashboard](https://dune.xyz/hagaetc/labels) for examples on what can be created with labels. + +**Address label examples** + +The address [0xD551234Ae421e3BCBA99A0Da6d736074f22192FF](https://dune.xyz/ethereum/address/0xD551234Ae421e3BCBA99A0Da6d736074f22192FF) can be labeled like this: + +| **type** | **name** | +| ----------- | -------- | +| owner | binance | +| wallet type | exchange | + +The address is controlled by the exchange Binance. + +The address [0xe65040f61701940b62e18da7a53126a58525588b](https://dune.xyz/ethereum/address/0xe65040f61701940b62e18da7a53126a58525588b) can be labeled like this: + +| **type** | **name** | +| ---------- | ------------ | +| dapp usage | uniswap user | +| activity | dex trader | + +The address in the past interacted with Uniswap. + +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. Directly to an address via our labels page** + +Good for specific labels like “this is a binance wallet”. + +**2. Via a Dune query** + +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. + +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: + +* 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. + +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 are stored in the new `labels.labels` table which has the following schema: + +| column name | data type | description | +| ----------- | ----------- | -------------------------------------------------------- | +| 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. + +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')`. + +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 + +> We encourage you to run these queries in Dune while you read this + +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) +FROM dex.trades +WHERE token_a_symbol = 'DAI' +AND block_time > now() - interval '24 hours' +GROUP BY 1 +ORDER BY 3 DESC +LIMIT 10; +``` + +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) + FROM dex.trades + WHERE token_a_symbol = 'DAI' + AND block_time > now() - interval '24 hours' + and not labels.get(trader_a) isnull + GROUP BY 1 + ORDER BY 2 DESC + LIMIT 100; +``` + +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) + FROM dex.trades + WHERE token_a_symbol = 'DAI' + AND block_time > now() - interval '24 hours' + and not labels.get(trader_a) isnull + GROUP BY 1 + ORDER BY 2 DESC + 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) + FROM dex.trades + WHERE token_a_symbol = 'DAI' + AND block_time > now() - interval '24 hours' + and not labels.get(trader_a) isnull + GROUP BY 1 + ORDER BY 2 DESC + LIMIT 100; +``` + +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) + FROM dex.trades + WHERE token_a_symbol = 'DAI' + AND block_time > now() - interval '24 hours' +GROUP BY 1, 2 + ORDER BY 3 DESC + 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. + +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. + +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" +FROM uniswap_v2."Pair_evt_Swap" +WHERE EXISTS( + SELECT * + FROM labels.labels + WHERE address="to" + AND type='dapp usage' + AND name='1inch user' + ) +LIMIT 10; +``` + +The above query will give you 10 address that has swapped on Uniswap and traded on 1inch. + +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" ++++ SELECT "to", labels.get("to") + FROM uniswap_v2."Pair_evt_Swap" + WHERE EXISTS(SELECT * FROM labels.labels WHERE address="to" AND type='dapp usage' AND name='1inch user') + LIMIT 10; +``` + +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 new file mode 100644 index 0000000..21e0d06 --- /dev/null +++ b/data-tables/data-tables/nft.trading.md @@ -0,0 +1,152 @@ +--- +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.trades + +## **An easy way of querying for NFT data** + +`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. + +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 (They get traded in their own contracts) +* Foundation +* LooksRare + +All of this data is easily accessible with very simple queries like these: + +* [**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' --this is the cryptopunks address +``` + +* [**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 nft.trades + +where platform = 'OpenSea' --only shows trades on given Platform + +and block_time > now() - interval '24hours' +``` + +* [**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 + +where block_time > now() - interval '365 days' + +group by 2,3 +``` + +### + +### Basic Understanding + +#### Single Item Trade + +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. + +**Bundle Trade** + +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. + +**Aggregator 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. + +**Platform and Royalty Fees** + +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. + +### **Sample dashboards** + +**Dashboard that utilize parameters** + +[**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** + +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. + +Also read the section "[abstractions](abstractions.md)" about this topic. + +**Table contents** + +| column\_name | data\_type | description | +| ---------------------------- | ------------------------ | --------------------------------------------------------------------------------- | +| 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 | event index | +| trade\_id | integer | n/a | + +## **Credits** + +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 new file mode 100644 index 0000000..9bb0300 --- /dev/null +++ b/data-tables/data-tables/prices.md @@ -0,0 +1,51 @@ +# Prices + +#### Centralized exchanges trading data + +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** + +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.** + +|

column name

| description | +| ------------------------- | --------------------------------------------- | +| 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** + +This table also supports layer 1 assets on other blockchains. + +| column name | description | +| ----------------- | --------------------------------------------- | +| 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** + +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 | 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 new file mode 100644 index 0000000..87dc82b --- /dev/null +++ b/data-tables/data-tables/raw-data/README.md @@ -0,0 +1,17 @@ +# Raw Data + +{% content-ref url="ethereum-data.md" %} +[ethereum-data.md](ethereum-data.md) +{% endcontent-ref %} + +{% content-ref url="xdai-data.md" %} +[xdai-data.md](xdai-data.md) +{% endcontent-ref %} + +{% content-ref url="../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 new file mode 100644 index 0000000..4d9d06e --- /dev/null +++ b/data-tables/data-tables/raw-data/ethereum-data.md @@ -0,0 +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 data + +## Ethereum.Blocks + +| **Column Name** | **datatype** | **Description** | +| ------------------- | ------------ | ---------------------------------------------------------------------------------------- | +| 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 + +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. + +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 | 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 + +| **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 + +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 new file mode 100644 index 0000000..e5ccf36 --- /dev/null +++ b/data-tables/data-tables/raw-data/xdai-data.md @@ -0,0 +1,93 @@ +# xDai Data + +### xDai.Blocks + +| **Column Name** | **datatype** | **Description** | +| ----------------- | ------------ | ---------------------------------------------------------------------- | +| 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 + +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. + +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 | 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 | 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 + + 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 | | | +| 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 | | + +**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 new file mode 100644 index 0000000..2578bd4 --- /dev/null +++ b/data-tables/data-tables/solana-data/README.md @@ -0,0 +1,158 @@ +--- +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 Data + +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. + +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 + +This table contains the block data within Solana’s blockchain. It can be used to identify block activity and transaction changes over time. + +Query examples can be found here: [Solana blocks over time](https://dune.xyz/queries/389979) and [Transactions per day](https://dune.xyz/queries/390045) + +| 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 + +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 | 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\ | 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\ | 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 | The instruction number that failed | +| message | string | The error message | + +## Solana.vote\_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. + +An example query that demonstrates that is available here: [Solana transactions past 30 days](https://dune.xyz/queries/389976/743760) + +## Solana.rewards + +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. + +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 | 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 + +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 new file mode 100644 index 0000000..494cc7f --- /dev/null +++ b/data-tables/data-tables/solana-data/changelog.md @@ -0,0 +1,47 @@ +--- +description: >- + The changelog contains the updates being made to the Solana tables while in + beta. +--- + +# Changelog + +### 2022-03-25 + +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 + +Released the `solana.account_activity` table that contains all of the information about an account’s usage in a transaction. + +The table is optimized to run with ‘WHERE address = …’ queries + +### 2022-03-01 + +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. + +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. + +What this means for your existing queries using `solana.transactions`: + +* 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 +``` + +* 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 new file mode 100644 index 0000000..4a2b52b --- /dev/null +++ b/data-tables/data-tables/special-tables.md @@ -0,0 +1,43 @@ +# Token standards + +## Interfaces + +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 | 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 | + +[See this table in action](https://dune.xyz/queries/39012) + +**erc721."ERC721\_evt\_Transfer"** + +| **c**olumn name | **data type** | **description** | +| ------------------ | ------------- | ----------------------------------------------- | +| 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 | + +[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 new file mode 100644 index 0000000..43e58b3 --- /dev/null +++ b/data-tables/data-tables/user-generated.md @@ -0,0 +1,175 @@ +--- +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 + +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. + +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/). + +### 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 +('iETH'::text, '\x9Dde7cdd09dbed542fC422d18d89A589fA9fD4C0'::bytea, 18::numeric, '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'::bytea), +('yDAI'::text, '\x9D25057e62939D3408406975aD75Ffe834DA4cDd'::bytea, 18::numeric, '\x6B175474E89094C44Da98b954EedeAC495271d0F'::bytea), +('yUSDC'::text, '\xa2609b2b43ac0f5ebe27deb944d2a399c201e3da'::bytea, 6::numeric, '\xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'::bytea), +('ySUSD'::text, '\x36324b8168f960A12a8fD01406C9C78143d41380'::bytea, 18::numeric, '\x57Ab1ec28D129707052df4dF418D58a2D46d5f51'::bytea), +('yUSDT'::text,'\xa1787206d5b1bE0f432C4c4f96Dc4D1257A1Dd14'::bytea, 6::numeric, '\xdAC17F958D2ee523a2206206994597C13D831ec7'::bytea), +('yCRV'::text,'\x9Ce551A9D2B1A4Ec0cc6eB0E0CC12977F6ED306C'::bytea, 18::numeric, '\x6B175474E89094C44Da98b954EedeAC495271d0F'::bytea), +('yBTC'::text, '\x04EF8121aD039ff41d10029c91EA1694432514e9'::bytea, 8::numeric, '\x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'::bytea) +``` + +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. + +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. + +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. + +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). + +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 + + SELECT + dexs.block_time, + erc20a.symbol AS token_a_symbol, + erc20b.symbol AS token_b_symbol, + token_a_amount_raw / 10 ^ erc20a.decimals AS token_a_amount, + token_b_amount_raw / 10 ^ erc20b.decimals AS token_b_amount, + project, + version, + category, + 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, + coalesce( + usd_amount, + token_a_amount_raw / 10 ^ erc20a.decimals * pa.price, + token_b_amount_raw / 10 ^ erc20b.decimals * pb.price + ) as usd_amount, + token_a_address, + token_b_address, + exchange_contract_address, + tx_hash, + tx."from" as tx_from, + tx."to" as tx_to, + trace_address, + evt_index, + row_number() OVER (PARTITION BY tx_hash, evt_index, trace_address) AS trade_id + FROM ( + + --Uniswap v3 + SELECT + t.evt_block_time AS block_time, + 'Uniswap' AS project, + '3' AS version, + 'DEX' AS category, + t."recipient" AS trader_a, + NULL::bytea AS trader_b, + abs(amount0) AS token_a_amount_raw, + abs(amount1) AS token_b_amount_raw, + NULL::numeric AS usd_amount, + f.token0 AS token_a_address, + f.token1 AS token_b_address, + t.contract_address as exchange_contract_address, + t.evt_tx_hash AS tx_hash, + NULL::integer[] AS trace_address, + t.evt_index + FROM + uniswap_v3."Pair_evt_Swap" t + INNER JOIN uniswap_v3."Factory_evt_PoolCreated" f ON f.pool = t.contract_address + + ) dexs + INNER JOIN ethereum.transactions tx + ON dexs.tx_hash = tx.hash + LEFT JOIN erc20.tokens erc20a ON erc20a.contract_address = dexs.token_a_address + LEFT JOIN erc20.tokens erc20b ON erc20b.contract_address = dexs.token_b_address + LEFT JOIN prices.usd pa ON pa.minute = date_trunc('minute', dexs.block_time) + AND pa.contract_address = dexs.token_a_address + LEFT JOIN prices.usd pb ON pb.minute = date_trunc('minute', dexs.block_time) + AND pb.contract_address = dexs.token_b_address +``` + +[https://dune.xyz/queries/42779](https://dune.xyz/queries/42779) + +### Testing Abstractions + +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 + +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 + +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 +-- 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, + srcnsp.nspname AS src_schemaname, + srcobj.relname AS src_objectname, + tgtobj.oid AS dependent_viewoid, + tgtnsp.nspname AS dependant_schemaname, + tgtobj.relname AS dependant_objectname +FROM pg_class srcobj + JOIN pg_depend srcdep ON srcobj.oid = srcdep.refobjid + JOIN pg_depend tgtdep ON srcdep.objid = tgtdep.objid + JOIN pg_class tgtobj ON tgtdep.refobjid = tgtobj.oid AND srcobj.oid <> tgtobj.oid + LEFT JOIN pg_namespace srcnsp ON srcobj.relnamespace = srcnsp.oid + 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%' +``` + +You need to temporarily break the dependencies in order to be able to change `view1`. + +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 new file mode 100644 index 0000000..cc9470a --- /dev/null +++ b/dune-engine-v2-beta/abstractions-in-dunev2.md @@ -0,0 +1,5 @@ +# Abstractions in Dune V2 + +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 new file mode 100644 index 0000000..7bbce60 --- /dev/null +++ b/dune-engine-v2-beta/dunes-new-query-engine.md @@ -0,0 +1,49 @@ +# Dune V2 Intro + +### **Introduction** + +**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. + +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: + +* ****[**Raw tables**](../data-tables/data-tables/raw-data/)**** + * Ethereum + * Gnosis Chain + * BNB Chain + * Optimism + * 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 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: + +* 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 + +**You can read more about the changes here:** + +{% content-ref url="query-engine.md" %} +[query-engine.md](query-engine.md) +{% endcontent-ref %} + +### Abstractions + +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 + +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 new file mode 100644 index 0000000..41d9ccb --- /dev/null +++ b/dune-engine-v2-beta/query-engine.md @@ -0,0 +1,139 @@ +# Query Engine + +### Welcome to DuneV2 + +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: + +* 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 <> 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: + +| Description | DuneV1 | DuneV2 | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| **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'

| + +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. + +{% embed url="https://docs.databricks.com/sql/language-manual/sql-ref-functions-builtin.html" %} + +### Changes in how the database works + +**How does a database work?** + +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). + +#### **Row oriented database** + +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. + +![row oriented database (Postgres)](<../.gitbook/assets/row based database (1).png>) + +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. + +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** + +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. + +![column oriented database (Spark)](<../.gitbook/assets/column oriented database.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" %} + +**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. + +### Indexes or rather no Indexes + +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. + +![schematic view of mix/max values](<../.gitbook/assets/minmax schema.JPG>) + +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. + +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. + +### Query examples + +Equipped with this knowledge, let's look at some queries on the new Dune V2 engine. + +**Querying for transaction hashes** + +```sql +Select * from ethereum.transactions +where hash = '0xce1f1a2dd0c10fcf9385d14bc92c686c210e4accf00a3fe7ec2b5db7a5499cff' +``` + +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. + +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. + +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 +where block_number = 14854616 +and hash = '0xce1f1a2dd0c10fcf9385d14bc92c686c210e4accf00a3fe7ec2b5db7a5499cff' +``` + +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** + +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 +``` + +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. + +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 + +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. + +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/duneapp/adding-new-contracts.md b/duneapp/adding-new-contracts.md new file mode 100644 index 0000000..648ee10 --- /dev/null +++ b/duneapp/adding-new-contracts.md @@ -0,0 +1,113 @@ +--- +description: >- + Everything you should know about the submission process to successfully decode + new contracts +--- + +# Adding new contracts + +The Dune App contains an extensive catalog of decoded contracts in the form of [call and event tables](../data-tables/data-tables/decoded-data.md#decoded-smart-contract-data). These contracts are brought into Dune by wizards through a process commonly referred to as [Decoding](../data-tables/data-tables/decoded-data.md). + +## Quick tour + +{% embed url="https://www.youtube.com/watch?v=4v9zEYZvv34" %} + +## Submitting a new contract + +Contracts can be submitted for decoding through the New contract form, which can be accessed via [My Creations > Contracts](https://dune.xyz/browse/contracts/authored) or within the dataset explorer in the query editor's sidebar: + +![](<../.gitbook/assets/Screen Shot 2022-01-03 at 15.46.22.png>) + +Clicking there will pop up a new browser tab with the contract submission form, which consists of 2 steps: + +### 1. Blockchain and address + +We first ask for the contract's address and blockchain. Requesting this data first has two purposes: to anticipate potential duplicate contracts and pending submissions, and to automate parts of the submission process where we can. The latter is usually accomplished by fetching potentially useful metadata from Dune and other third party sources where relevant. + +For instance, below we submit the USDT contract (`0x94b008aA00579c1307B0EF2c499aD98a8ce58e58`) in Optimism: + +![](<../.gitbook/assets/Screen Shot 2022-01-03 at 16.02.19.png>) + +If we can find the contract through a third party source, we will show a green check mark next to the address field. This means we were able to fetch information such as the contract's name and ABI. + +### 2. Contract details + +Then, after pressing Next, you will be prompted for other information about the contract that we need in order to decode it: + +![](<../.gitbook/assets/Screen Shot 2022-01-03 at 16.05.07.png>) + +If we found the contract through other third party sources, you will only have to fill in the project name. We have some naming conventions on that, partly due to our technical setup and also to make finding data more predictable. + +Once you submit it, you are done! The contract will be stored in our queue, which we manually review for quality assurance purposes. Your submission might take a few days to get processed. + +### Advanced options + +In some instances, Dune can automatically detect and index multiple contract addresses under the same submission. This is useful for examples such as AMM pools where there often exists one contract instance per pair. + +We have two strategies for detecting other contracts for decoding: + +1. **Bytecode match.** We use the bytecode of the contract address in the submission to find other matches in the whole chain history. +2. **Factory instances.** We find all other contracts created by the same address as the one responsible for creating the submitted contract. + +In both cases, we assume that all the contracts found through either method correspond to the same blockchain, project name, contract name and ABI. + +If you want us to index more than one contract, toggle on Advanced options and select "Yes" to the first question. Then, to the question of "Is it created by a factory contract?" select "No" to index all other contracts with the same bytecode or "Yes" to index all other contracts originating from the same creator. + +{% hint style="warning" %} +Only use these options if you know what you're doing and are extremely familiar with the project's architecture and deployment hierarchy. + +Incorrectly applying these settings may lead to a rejected submission. +{% endhint %} + +## Tracking your submissions + +You can view your submissions and their processing status at any time by navigating to [My Creations > Contracts](https://dune.xyz/browse/contracts/authored): + +![](<../.gitbook/assets/Screen Shot 2022-01-03 at 14.43.07.png>) + +## Frequently Asked Questions + +### Submitting contract information manually + +Although we try to fetch contract information such as the ABI, sometimes this information might not be available through our sources. + +In those instances, you will need to manually input the contract's name and its ABI. This information should be available in block explorers such as [Etherscan](http://etherscan.io/) or [Blockscout](https://blockscout.com/) if the contract is verified in any of those sites. + +{% hint style="info" %} +If the contract being manually submitted is a Proxy contract, we recommend you to move on to the next section. +{% endhint %} + +### Submitting a Proxy contract + +In order to properly decode transactions towards contracts that fit the Proxy pattern, Dune needs to map the Proxy contract's address with the implementation contract's ABI. + +We avoid monitoring the implementation contract's address because its logic is accessed via usage of Delegatecall in transactions. This would cause us to miss out on any event logs in the implementation contract's logic, since these are actually fired by the caller (the Proxy in this case) when calling a function through Delegatecall. + +**When submitting proxy contracts to Dune, you should input the address of the Proxy contract.** We then will attempt to fetch the proxy's contract name and the implementation address it's pointing towards. After, we will attempt to source the implementation contract's ABI. + +{% hint style="info" %} +For correctly decoding a Proxy contract, Dune needs the **Proxy address** and the **Implementation ABI**. +{% endhint %} + +### Re-submitting a contract + +Dune assumes each address in the blockchain can map to at most 1 contract. For this reason, submitting a contract with an address that already exists in `ethereum.contracts` will override it for Decoding purposes. This has a couple potential dangerous side effects: + +* If the project or contract name has changed, we will generate new tables for all of the contract's methods and events. In turn, previous tables will stop updating, data will be fragmented, and queries will stop working. +* If the ABI has changed in a way that modifies an existing table's parameters, queries that depend on such table might break or become inaccurate. + +If you attempt to submit an already existent contract, make sure to include extra context as part of the submission so we can assess whether it's worth overriding the contract's data. + +Sometimes, the risk of accepting a re-submission is higher than the perceived value by us, and my result in a rejection. If you disagree, feel free to reach out to us at #decoding in the Dune Discord and we'll see what we can do. + +### Decoding of Diamond Proxy contracts + +Similar to vanilla Proxy contracts, [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535) contracts can be supported by passing in the address of the Diamond Proxy as well as **a single ABI representing the totality of all the facets interfaces**. + +### My submission got rejected, why? + +In the interest of data quality, we reject duplicative, incorrect or low quality submissions. To avoid that, make sure to submit accurate contract information. + +### Other questions + +Head over to #decoding on our [Discord](https://discord.gg/ErrzwBz) and we'll be happy to help! diff --git a/duneapp/dashboards.md b/duneapp/dashboards.md new file mode 100644 index 0000000..2d074ec --- /dev/null +++ b/duneapp/dashboards.md @@ -0,0 +1,84 @@ +--- +description: Dune's Dashboards allow you to easily aggre +--- + +# Dashboards + +### Dashboards are where Dune's content lives and gets discovered. + +Dashboards on Dune consist of widgets. Widgets can either be visualizations or a text box. It is also possible to embed images/gifs inside of the text box. + +You can freely resize every widget to match the layout you want to create. + +### Creating a Dashboard + +You can create a new dashboard by navigating to our "Discover" page and clicking on the "new dashboard" button on the right. + +The initial name that you give to your dashboard will also be the url slug. You can't change the url slug afterwards, so be mindful of the name you choose. Changing the dashboards display name is always possible though. + +![creating a dashboard](<../.gitbook/assets/2021-11-03 16-59-42 (2).gif>) + +### Adding Visualizations + +You can simply add visualizations to your dashboard by going into the editor mode and clicking on the corresponding button. To go into editor mode first open one of your own dashboards and click on the edit button on the top right. + +![](<../.gitbook/assets/2021-11-09 13-17-41.gif>) + +### Adding text boxes + +To add text boxes to your dashboard you have to go into editor mode first and can afterwards click on "add text widget". This will open a simple text editor window. + +![](<../.gitbook/assets/2021-11-09 13-20-39.gif>) + +Text boxes support a subset of markdown. You can manipulate text and embed images and gifs. + +#### Text manipulation + +This is a short list to markdown syntax. A more advanced markdown guide can be found [here](dashboards.md#dashboards-are-where-dunes-content-lives-and-gets-discovered.). + +| Element | Markdown Syntax | +| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| [Heading](https://www.markdownguide.org/basic-syntax/#headings) |

# H1
## H2
### H3

| +| [Bold](https://www.markdownguide.org/basic-syntax/#bold) | `**bold text**` | +| [Italic](https://www.markdownguide.org/basic-syntax/#italic) | `*italicized text` | +| [Ordered List](https://www.markdownguide.org/basic-syntax/#ordered-lists) |

1. First item
2. Second item
3. Third item

| +| [Unordered List](https://www.markdownguide.org/basic-syntax/#unordered-lists) |

- First item
- Second item
- Third item

| +| [Code](https://www.markdownguide.org/basic-syntax/#code) | `` `code` `` | +| [Horizontal Rule](https://www.markdownguide.org/basic-syntax/#horizontal-rules) | `---` | +| [Link](https://www.markdownguide.org/basic-syntax/#links) | `[title](https://www.example.com)` | + +#### + +### Embedding Images and GIFs + +Our text boxes can also be used to embed images or gifs into your dashboard. + +The Syntax for embedding images is: + +| [Image](https://www.markdownguide.org/basic-syntax/#images-1) | `![alt text](image url)` | +| ------------------------------------------------------------- | ------------------------ | + +Since you can't store images locally on our servers, you need to upload your images somewhere else or find the raw file somewhere on the internet. + +In practice this might look like this: + +``` +![text](https://pbs.twimg.com/media/FEWVLQwWUAQcqLY?format=jpg&name=medium) +--this is an image stored on twitters servers +``` + +You can resize the image by simply resizing the widget it is contained in. + +You can combine images and text in one widget. + +![embedding an image and resizing it](<../.gitbook/assets/2021-11-18 16-23-05.gif>) + +### Arranging the layout of the dashboard + +You can arrange the different widgets on the dashboard in whatever way you like. + +Widgets will always try to move upwards, so if you want to create a visual divider section in your dashboard it is advised to create a big text box as a divider. + + + +![](<../.gitbook/assets/2021-11-19 01-22-49.gif>) diff --git a/duneapp/parameters.md b/duneapp/parameters.md new file mode 100644 index 0000000..38657d9 --- /dev/null +++ b/duneapp/parameters.md @@ -0,0 +1,107 @@ +--- +description: >- + Parameters are an easy and powerful way to add variables to your + query/dashboard. This allows you and others to customize queries and + dashboards without having to touch the code. +--- + +# Parameters + +## What are Parameters? + +**Parameters are a specialized feature of dune that allow you to implement variables in certain parts of your query code. This variable can be changed from dashboards and therefore allows you to make an interactive dashboard.** + +Parameters allow you to make changes to certain defined parameters of your code with a few simple clicks. For instance instead of hard coding `contract_address` , `symbol` or `date ranges` you can just use the parameter function to change these aspects of your code using a parameter. This allows you to build an interactive dashboard or customizable query that the viewer can use to query for exactly the data he needs. + +Parameters are defined in the query code as `{{parametername}}` and will appear below the query and in any dashboards in which a query visualization with parameters is used in. + +You can pass on input to the parameter below the query or in the parameter field on a dashboard. \ +\ +Simply run the query to apply the parameter for a query within the query editor.\ +\ +On a dashboard you can either click `apply all` at the top or change the parameters individually and hit `Enter`. The `Enter` submission also works for dropdowns and the date picker. + +Parameters in a Dashboard can be shared between different queries, just make sure to use the same name, type and default value between all of them. + +![](<../.gitbook/assets/image (30).png>) + +![](<../.gitbook/assets/image (30) (1).png>) + +![](<../.gitbook/assets/image (29).png>) + +## How to use Parameters? + +You can simply add a parameter to your queries by writing `{{parametername}}` or using the button below the query. + +You can edit the properties of single parameters by clicking on the gear wheel next to the parameter in the query editor. This allows you to set a default value, define a list of possible parameters or change the type of of the parameter. If you want to share parameters between different queries on a dashboard make sure they exactly match in regards to name, type and default value. + +![](<../.gitbook/assets/2021-12-10 15-41-07.gif>) + + + +## Example Query + +This query returns the running total of Gas Paid in USD. + +The Query Author has chosen to include a parameter for `wallet address`, `start date` and `end date`. + +```sql +with alltransactions +AS ( +SELECT + block_time, + success, + gas_price/10^9 AS gas_prices, + gas_used, + (gas_price*gas_used)/10^18 AS eth_paid_for_tx, + hash +FROM ethereum.transactions +WHERE "from" = CONCAT('\x', substring('{{1. Eth Address}}' from 3))::bytea +AND block_time >= '{{2. Start Date}}' +AND block_time < '{{3. End Date}}') + +SELECT + date_trunc('minute', block_time), + SUM(eth_paid_for_tx*price) over (ORDER BY date_trunc('minute', block_time)) AS "Total Gas Fees Paid in USD" +FROM alltransactions +LEFT JOIN + (SELECT + minute, + price + FROM prices.usd + WHERE + symbol = 'WETH' AND + minute > '{{2. Start Date}}') AS prices +ON date_trunc('minute', block_time) = minute +ORDER BY block_time DESC +``` + +Find this query [here](https://dune.xyz/queries/64430/128463) + +## Embedding parameterized Dashboards and Queries + + + +## **Example Dashboards** + +**Find interesting stats on Ethereum Wallets with this dashboard:**\ +[https://dune.xyz/kevdnlol/Transaction-Breakdown](https://dune.xyz/kevdnlol/Transaction-Breakdown) + +_The author has included the parameters `wallet address`, `start date` and `end date` in this Dashboard._ + +**Drill down into the single pools of Barnbridge's Smart Yield Product:**\ +[https://dune.xyz/0xBoxer/Barnbridge-or-Smart-Yield](https://dune.xyz/0xBoxer/Barnbridge-or-Smart-Yield) + +_The Author has chosen to make the parameter `poolsymbol` into a drop down list here. This allows for easy access to all the relevant pools and detailed statistics on those._ + +**Find out how many people are participating in Yearn Vaults:**\ +[https://dune.xyz/msilb7/Yearn-How-Many-Addresses-are-Participating](https://dune.xyz/msilb7/Yearn-How-Many-Addresses-are-Participating) + +**Find out how your investment in $KLIMA is doing:** + +****[**https://dune.xyz/0xrusowsky/KLIMA-Wallet-Activity**](https://dune.xyz/0xrusowsky/KLIMA-Wallet-Activity)**** + +## Summary + +Parameters allow you to make a certain part of your SQL query dynamic and thereby offer you to make queries and dashboards interactive. That way you can easily display detailed data on your dashboard since it allows the viewer to customize the dashboard for his needs.\ +You could think of parameters like filters, but the possibilities of using this feature go beyond that. diff --git a/duneapp/query-editor.md b/duneapp/query-editor.md new file mode 100644 index 0000000..8f941a9 --- /dev/null +++ b/duneapp/query-editor.md @@ -0,0 +1,89 @@ +# Query Editor + +**The query editor is the place to query for your data.** + +![](<../.gitbook/assets/image (46).png>) + +The Query Editor consists of three parts: + +* the [**data explorer**](query-editor.md#data-explorer) on the left +* the [**query window**](query-editor.md#query-window) on the right +* the [**query results**](query-editor.md#query-results) at the bottom + +You can change the sizing of each of these parts by dragging the dune logo around. + +![changing the layout is easy](<../.gitbook/assets/2021-12-08 22-33-19.gif>) + +Let's take a look at each of these parts in more detail. + +### Data explorer + +The data(-set) explorer allows you to search for datasets to use in your queries. + +To learn more about Dune's datasets, please visit the [section datasets](../data-tables/data-tables/). + +![](<../.gitbook/assets/2021-12-08 22-44-18.gif>) + +You can simply put in any keywords, protocol names, contract names or anything else into the search bar at the top to filter the list of available datasets down to only those you might need at that moment.\ +The search bar also accepts spaces, that way you can construct a multi keyword search. + +\ +Let's explore a few examples of querying for tables to further elaborate on this:\ +\ +Searching for `uniswap_v2.` \_\_ will bring up all tables related to _the_ `uniswap_v2` _schema_ + +Searching for `uniswap_v2. evt` will bring up only event tables related to the `uniswap_v2` schema + +Searching for just `uniswap` will bring up all tables that contain the keyword `uniswap` in some form. + +**Takeaways** + +* Always query for data schemas where applicable +* Use spaces to filter down for events, calls or specific contracts after a schema.\\ + +### Query window + +The query window is where you can work your magic in Dune.\ +\ +You can input any SQL code and execute it. + +![](<../.gitbook/assets/image (45).png>) + +**Autocomplete function** + +You can enable/disable the autocomplete function of the query editor using the gear wheel in the top right corner. The autocomplete feature will only bring up PGSQL keywords and already used tables and aliasses.\ +\ +![](<../.gitbook/assets/image (36).png>) + +**Shortcuts** + +A few shortcuts to make working in the query editor easier are provided below.\\ + +| Shortcut | Action | +| ------------- | ------------------------------ | +| ctrl + enter | execute the query | +| ctrl + # or / | comments out the selected code | +| ctrl + space | brings up a list of keywords | +| crtl + z | undoes your last changes | +| ctrl + y | redoes your last changes | +| ctrl + f | search for keywords | +| ctrl + h | search and replace keywords | + +### Query results + +The query results section contains a table with the results of your query. + +![](<../.gitbook/assets/image (58).png>) + +You can change the formatting and appearance of your table with the options below the table. We don't currently support hiding individual columns for displaying this table on a dashboard, but we are looking to implement this function soon. + +The tick formats follow this logic: + +| Value | Tick format | Output | Description | +| ------------ | ----------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1256784.3745 | left blank | 1256784,3745000 | Display the full number and 7 decimals | +| 1256784.3745 | 0 | 1256784 | Only Display whole numbers | +| 1256784.3745 | 0,0 | 1,256,784 | Only displays whole numbers with comma separator | +| 1256784.3745 | 0,0.00 | 1,256,784.38 | Displays the value with decimals points according to the count of zeroes after the dot | +| 1256784.3745 | 0\[.]0a | 1.2m |

Displays the value in an abbreviated format.

Will display decimals of the abbreviated number according to count of zeroes after the dot.

| +| 1256784.3745 | $0\[.]0a | $1.2m | Adheres to the same methods as before, but adds a $ prefix. | diff --git a/duneapp/visualizations/README.md b/duneapp/visualizations/README.md new file mode 100644 index 0000000..e2abe39 --- /dev/null +++ b/duneapp/visualizations/README.md @@ -0,0 +1,49 @@ +--- +description: Visualizations make your data come alive! +--- + +# Visualizations + +Visualizing your query results makes the results accessible and allows you to effectively communicate your findings to your audience. + +Dune offers you a variety of different visualization options: + +* bar charts +* area charts +* scatter charts +* line charts +* pie charts +* counters + +Combining these in a thoughtful manner allows you to best communicate your data to your audience. + +### Creating Visualizations + +You can create visualizations from any query results in seconds using our visualization engine. + +Simply click on the `New visualization` button and configure the visualization to your needs. + +One query can have multiple visualizations. + + + +![](<../../.gitbook/assets/2021-11-26 13-08-16.gif>) + +**Read more about the different visualization options here:** + +{% content-ref url="graphs.md" %} +[graphs.md](graphs.md) +{% endcontent-ref %} + +{% content-ref url="counters.md" %} +[counters.md](counters.md) +{% endcontent-ref %} + +{% content-ref url="pie-charts.md" %} +[pie-charts.md](pie-charts.md) +{% endcontent-ref %} + +## What you can do with Visualizations + +Visualizations can either live on your [dashboard](../dashboards.md) or be embedded on their own using the [embedd function](../../sharing/embeds/) + diff --git a/duneapp/visualizations/counters.md b/duneapp/visualizations/counters.md new file mode 100644 index 0000000..6000991 --- /dev/null +++ b/duneapp/visualizations/counters.md @@ -0,0 +1,57 @@ +# Counters + +#### Counters are a great way to provide your audience with immediate "on a glance" stats. + +!["on a glance" stats in https://dune.xyz/0xBoxer/NFT](<../../.gitbook/assets/image (41).png>) + +## Configuring your counter + +![](<../../.gitbook/assets/image (49).png>) + +### Counter options + +In this section you can define what kind of data the counter should display. + +#### Title + +* The Title will appear in all instances of this graph prominently at the top +* If left blank the query name will be the only thing that is left standing + +#### Column + +* In this field you can define which column the counter should show. + +#### Row + +* This field can be used to define which row of the underlying datatable you want displayed e.g. row 1 +* Usually this requires you to sort or limit your query results in order for row 1 to show the wanted results. + +### Formatting + +**Prefix** + +* This field allows you to define a prefix for your counter value. +* e.g.: `$`, `€`, `Ξ`, `฿` + +**Suffix** + +* This field allows you to define a suffix for your counter value. + +**Label** + +* This field allows you to define a label for your counter value. +* The label will appear beneath the counter value as text. + +**Decimals** + +* In this field you can choose how many decimals you want displayed for your counter +* This is currently limited to 3 decimal places. + +### Counters explained + +Here is an example to bring some points explained earlier home. + +![label](<../../.gitbook/assets/image (39).png>) + +![label configuration](<../../.gitbook/assets/image (57).png>) + diff --git a/duneapp/visualizations/graphs.md b/duneapp/visualizations/graphs.md new file mode 100644 index 0000000..08c9c37 --- /dev/null +++ b/duneapp/visualizations/graphs.md @@ -0,0 +1,187 @@ +--- +description: Graphs are good for condensing data points into a visualization. +--- + +# Graphs + +**Graphs are great for condensing data points into a visualization.** + +![a graph with mixed line and scatter graphs](<../../.gitbook/assets/image (48).png>) + +![a stacked bar chart](<../../.gitbook/assets/image (60).png>) + +### Dune offers you to create the following graph types: + +* bar charts +* area charts +* scatter charts +* line charts + +You can mix all of these graph types together in one visualization**.**\ +**** + +### Configuring your visualizations + +All graph visualizations share a common editing schema. + +In essence, you can define your visualization in detail here. The three different sections of this are explained below. + +![](<../../.gitbook/assets/image (34).png>) + +### Chart options + +This section allows you to define how to display your data. + +![see explanations below](<../../.gitbook/assets/image (59).png>) + +**Title** + +* The title will appear in all instances of this graph prominently at the top. +* The graph will always keep the name of the query, even if you edit this. + + + +* [ ] **Show chart legend** + + + +* Ticking this box will enable or disable the legend for the chart. + + + +* [ ] **Enable stacking** + + + +* If applicable, ticking this box will stack the chart values on top of each other based on the x-axis values. +* If this is not turned on, the values will be plotted individually on the y-axis. +* The calculation underpinning this will always group the value corresponding to one value on the x-axis. Make sure your data is clean in able for this to work (avoid gaps in your data). + + + +* [ ] **Normalize to percentage data** + + + +* This will normalize the chart to display percentage values of the chosen data table. +* The calculation underpinning this will always group the value corresponding to one value on the x-axis. Make sure your data is clean in able for this to work (avoid gaps in your data). + + + +* [ ] **Show data labels** + + + +* Ticking this box leads to the display of the individual datapoints inside of the graph. +* This only makes sense in cases where you have few datapoints that are spread out far enough from each other to not overlap. + +### Result data + +Here you can pick the data points that are to be displayed. + +![see explanations below](<../../.gitbook/assets/image (47).png>) + +You can choose one **x-axis** and multiple **y-axis.** + +Alternatively, you can also choose one data series on the y-axis and choose to group it by a different column of your table (as shown in the example above). + +### **X-axis options** + +Using these options you can influence how your x-axis data gets displayed. + +![see explanations below](<../../.gitbook/assets/image (37).png>) + +**Axis title** + +* This field allows you to specify a title for your x-axis. + + + +* [ ] **Sort Values** + + + +* by ticking this box you can specify if you want the values in your chart to be ordered. +* If your x-axis is a timeseries, this will automatically happen. + + + +* [ ] **Reverse value** + + + +* Ticking this box will reverse the order of the values on the x-axis. + + + +* [ ] **Logarithmic** + + + +* Ticking this box will make your x-axis values display __ logarithmically. + +### **Y-axis options** + +With these options you can influence how your x-axis data gets displayed. + +![see explanations below](<../../.gitbook/assets/image (40).png>) + +**Axis title** + +* This field allows you to specify a title for your y-axis. + + + +* [ ] **Logarithmic** + + + +* Ticking this box will make your x-axis values display __ logarithmically. + + + +* [ ] **Enable right y-axis** + + + +* Ticking this box will enable an additional y-axis that you can plot values on. +* You can choose in the [chart series section](graphs.md#ordering-your-series) what you want to be displayed on the left and right axis. + +### **Tick formats** + +****![](<../../.gitbook/assets/image (61).png>)**** + +Tick formats will change how values in your chart and the axis labels will get displayed. + +It follows this logic: + +| Value | Tick format | Output | Description | +| ------------ | ----------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1256784.3745 | left blank | 1256784,3745000 | Display the full number and 7 decimals | +| 1256784.3745 | 0 | 1256784 | Only Display whole numbers | +| 1256784.3745 | 0,0 | 1,256,784 | Only displays whole numbers with comma separator | +| 1256784.3745 | 0,0.00 | 1,256,784.38 | Displays the value with decimals points according to the count of zeroes after the dot | +| 1256784.3745 | 0\[.]0a | 1.2m |

Displays the value in an abbreviated format.

Will display decimals of the abbreviated number according to count of zeroes after the dot.

| +| 1256784.3745 | $0\[.]0a | $1.2m | Adheres to the same methods as before, but adds a $ prefix. | + +### Ordering your series + +![](<../../.gitbook/assets/image (52).png>) + +In this section of the visualization editor you can finalize your graph. + +* You can rename the "series" by simply clicking into the field. +* You can change the chart type by clicking into the dropdown. +* You can change the colors by clicking into the color box. +* Finally you can also change the order of the series. + +### Picking Colors + +You can pick colors with your browser native color selector. + +This might look slightly different for you depending on which browser you use. + + + +![Choose any color you want!](<../../.gitbook/assets/2021-11-26 17-25-04.gif>) + diff --git a/duneapp/visualizations/pie-charts.md b/duneapp/visualizations/pie-charts.md new file mode 100644 index 0000000..1585e25 --- /dev/null +++ b/duneapp/visualizations/pie-charts.md @@ -0,0 +1,39 @@ +# Pie Charts + +**Pie charts are great for showing the composition of something.** + +![Marketshare of different decentralized exchanges on https://dune.xyz/hagaetc/dex-metrics](<../../.gitbook/assets/image (51).png>) + +## Configuring your pie chart + +![](<../../.gitbook/assets/image (55).png>) + +### Chart Options + +#### Title + +* The Title will appear in all instances of this graph prominently at the top +* If left blank the query name will be the only thing that is left standing + + + +* [ ] **Show data labels** + + + +* Ticking this box leads to the display of the individual datapoints inside of the graph. +* This only makes sense in cases where you have few datapoints that are spread out far enough from each other to not overlap. + +### Result data + +Here you can pick the data points that are to be displayed. + +![The configuration for the chart above](<../../.gitbook/assets/image (33).png>) + +You can choose one **x-axis** and one y-axis. + +### Pie Options + +**Label format** + +* This field allows you to define the [tick format](https://docs.dune.xyz/duneapp/visualizations#tick-formats) of the data labels. diff --git a/faq/does-dune-have-a-token.md b/faq/does-dune-have-a-token.md new file mode 100644 index 0000000..dcd51c8 --- /dev/null +++ b/faq/does-dune-have-a-token.md @@ -0,0 +1,3 @@ +# Does Dune have a Token? + +**Dune does not have token.** diff --git a/faq/does-dune-have-an-api.md b/faq/does-dune-have-an-api.md new file mode 100644 index 0000000..3a8032f --- /dev/null +++ b/faq/does-dune-have-an-api.md @@ -0,0 +1,7 @@ +# Does Dune have an API? + +**Dune is currently working on an API!** + +If you'd like to express interest in receiving early access and would be willing to tell us more on how you expect to use the API - please complete our [API Interest form](https://docs.google.com/forms/d/e/1FAIpQLSdoF4\_LC1BdPumRq1TJguxAsKC-g5i6u2f7-sac5v14EubLsw/viewform). + +Until then, [paid plan users](https://dune.com/pricing) can export results as CSV and anyone can embed Dune charts on their page for free by clicking "[Embed](../sharing/embeds/)" on any query visualisation. diff --git a/faq/how-are-results-refreshing.md b/faq/how-are-results-refreshing.md new file mode 100644 index 0000000..83f27d7 --- /dev/null +++ b/faq/how-are-results-refreshing.md @@ -0,0 +1,7 @@ +# How are results refreshing? + +When a visualisation 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. + +This means that dashboards will always be kept up to date when they are being viewed and the query creator does not need to set a refresh schedule. + +Note that the query execution queue is separate from each individual users queue when they create and run queries in the query editor. diff --git a/faq/how-does-dune-get-its-data.md b/faq/how-does-dune-get-its-data.md new file mode 100644 index 0000000..fbbe601 --- /dev/null +++ b/faq/how-does-dune-get-its-data.md @@ -0,0 +1,7 @@ +# How does Dune get it's data ? + +We are working together with node providers across the Industry to ingest data into our database. This includes all raw historical data from these blockchains. It does not include state data.\ + + +We don't discriminate against any smart contract, you can submit any contract via our [decoding page](../data-tables/data-tables/decoded-data.md) and work with it in a matter of hours. The only prerequisite for this is an ABI so we can actually decode the contract (usually the ABI is already on etherscan, but there are edge cases). + diff --git a/onboarding/onboarding-to-dune.md b/onboarding/onboarding-to-dune.md new file mode 100644 index 0000000..95b6146 --- /dev/null +++ b/onboarding/onboarding-to-dune.md @@ -0,0 +1,28 @@ +# Onboarding to Dune + +### Dune is an open platform that anyone can build on + +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. **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. + + + diff --git a/resources/press-kit.md b/resources/press-kit.md new file mode 100644 index 0000000..71f0f33 --- /dev/null +++ b/resources/press-kit.md @@ -0,0 +1,70 @@ +--- +description: Get the Dune brand assets and learn about the usage guidelines +--- + +# Press Kit + +## Primary - Standard Logo + +This is the primary Dune logo. It should be used in this format whenever possible. + +![](../.gitbook/assets/dune-horizontal-logo-cover.png) + +{% file src="../.gitbook/assets/dune-standard-logo.svg" %} +Standard logo (SVG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-standard-logo@2x (1).png" %} +Standard logo (PNG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-standard-logo-dark.svg" %} +Standard logo dark (SVG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-standard-logo-dark@2x.png" %} +Standard logo dark (PNG) +{% endfile %} + + + +## Vertical logo + +![](<../.gitbook/assets/dune-vertical-logo-cover (1).png>) + +{% file src="../.gitbook/assets/dune-vertical-logo (1).svg" %} +Vertical logo (SVG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-vertical-logo@2x (1).png" %} +Vertical logo (PNG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-vertical-logo-dark.svg" %} +Vertical logo dark (SVG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-vertical-logo-dark@2x (1).png" %} +Vertical logo dark (PNG) +{% endfile %} + +## Icon only + +![](../.gitbook/assets/dune-icon-only.svg) + +{% file src="../.gitbook/assets/dune-icon-only.svg" %} +Icon only (SVG) +{% endfile %} + +{% file src="../.gitbook/assets/dune-icon-only@2x.png" %} +Icon only (PNG) +{% endfile %} + +## Complete set of all logos + +{% file src="../.gitbook/assets/Dune-logo-Full.zip" %} +All logos in SVG and PNG format (ZIP) +{% endfile %} + + + diff --git a/sharing/attribution.md b/sharing/attribution.md new file mode 100644 index 0000000..30b1852 --- /dev/null +++ b/sharing/attribution.md @@ -0,0 +1,28 @@ +--- +description: Content on Dune is community created and should be attributed accordingly! +--- + +# Attribution + +### Attribution + +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)_"._ + +You can find the twitter tags and more information of most creators in their [profile page](https://dune.xyz/rchen8). + + + +![opening the profile of a creator](<../.gitbook/assets/opening up profile.gif>) + +\ + + +![Be the galaxy brain! Meme by https://dune.xyz/eliasimos/](https://pbs.twimg.com/media/E2YSaD2WUAAU7RU?format=png\&name=900x900) + +## + diff --git a/sharing/embeds/README.md b/sharing/embeds/README.md new file mode 100644 index 0000000..a6e75a0 --- /dev/null +++ b/sharing/embeds/README.md @@ -0,0 +1,64 @@ +--- +description: Embeds allow you to enjoy beautiful, updating dune charts across the web! +--- + +# Embeds + +## Using Embeds + +**Screenshots are boring and tech of the past.** + +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 + +Here is a couple of exemplary use cases for Dune embeds: + +{% content-ref url="discord.md" %} +[discord.md](discord.md) +{% endcontent-ref %} + +{% content-ref url="twitter.md" %} +[twitter.md](twitter.md) +{% endcontent-ref %} + +{% content-ref url="mirror.xyz.md" %} +[mirror.xyz.md](mirror.xyz.md) +{% endcontent-ref %} + +{% content-ref url="webpages.md" %} +[webpages.md](webpages.md) +{% endcontent-ref %} + + + +### Known Issues + +Unfortunately, embeds do not work in a couple of fairly popular sites, this includes: + +* substack +* medium +* gitbook diff --git a/sharing/embeds/discord.md b/sharing/embeds/discord.md new file mode 100644 index 0000000..6c4c434 --- /dev/null +++ b/sharing/embeds/discord.md @@ -0,0 +1,16 @@ +--- +description: Dune's embeds display beautifully in Discord! +--- + +# 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 new file mode 100644 index 0000000..c9b8ade --- /dev/null +++ b/sharing/embeds/known-issues.md @@ -0,0 +1,11 @@ +--- +description: Sadly not every website wants to make it. +--- + +# Known Issues + +These websites currently sadly do not support dune embeds: + +* substack +* medium +* gitbook diff --git a/sharing/embeds/mirror.xyz.md b/sharing/embeds/mirror.xyz.md new file mode 100644 index 0000000..feb56a9 --- /dev/null +++ b/sharing/embeds/mirror.xyz.md @@ -0,0 +1,11 @@ +--- +description: Dune embedds work in Mirror.xyz! +--- + +# Mirror.xyz + +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 new file mode 100644 index 0000000..83e670a --- /dev/null +++ b/sharing/embeds/twitter.md @@ -0,0 +1,20 @@ +--- +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 new file mode 100644 index 0000000..a56031e --- /dev/null +++ b/sharing/embeds/webpages.md @@ -0,0 +1,22 @@ +--- +description: You can embedd Dune's Visualizations on most Websites with ease. +--- + +# Webpages + +### Dune Charts can live in your website! + +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. + +A great showcase for this is the [cryptoart.io](https://cryptoart.io/data) website. + + + + +