Skip to content

Commit

Permalink
update sql example
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Jan 16, 2025
1 parent 3a9e954 commit d3d5d65
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion blocks/antelope/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protogen:

.PHONY: parquet
parquet:
rm -rf state.yaml && substreams-sink-files run "$(NETWORK).substreams.pinax.network:443" substreams.yaml map_events "./out" 413423197:413423198 --encoder parquet --file-block-count 1 --parquet-default-column-compression snappy
substreams-sink-files run "$(NETWORK).substreams.pinax.network:443" substreams.yaml map_events "./out" 414957000: --encoder parquet --file-block-count 1 --parquet-default-column-compression snappy

.PHONY: s3
s3:
Expand Down
4 changes: 2 additions & 2 deletions blocks/solana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ cache-foundational:

.PHONY: gui
gui:
substreams gui substreams.yaml -e solana.substreams.pinax.network:443 map_events -s 203100000 --network solana
substreams gui substreams.yaml -e solana.substreams.pinax.network:443 map_events -s 311081162 --network solana

.PHONY: parquet
parquet:
substreams-sink-files run solana.substreams.pinax.network:443 substreams.yaml map_events './out' 203100000:203100001 --encoder parquet --file-block-count 1 --development-mode
substreams-sink-files run solana.substreams.pinax.network:443 substreams.yaml map_events './out' 311081162: --encoder parquet --file-block-count 50 --development-mode

.PHONY: deploy
deploy:
Expand Down
62 changes: 60 additions & 2 deletions snowflake/solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ This dataset offers a detailed view of Solana based blockchain activity, providi

Free access to the dataset on the [Snowflake Data Marketplace](https://app.snowflake.com/marketplace).

```markdown
## Tables/Views

| Data Type | Description |
Expand All @@ -18,6 +17,66 @@ Free access to the dataset on the [Snowflake Data Marketplace](https://app.snowf
| `vote_instruction_calls` | Instruction calls associated with vote transactions, sharing the same structure as `instruction_calls`. |
| `vote_account_activity` | Account activity related to voting, structured similarly to general account activity. |

## Sample SQL Queries

**Daily Active Users (DAU)**

```sql
SELECT
block_date,
count(distinct address) AS user
FROM solana.account_activity
GROUP BY block_date
ORDER BY block_date ASC;
```

**Top Contracts**

```sql
SELECT
account AS contract,
count(*) AS actions
FROM wax.actions
WHERE block_date = '2025-01-01'
GROUP BY contract
ORDER BY actions DESC
LIMIT 10
```

**Tokens**

```sql
SELECT
a.tx_id,
a.address,
a.token_mint_address,
a.pre_token_balance,
a.post_token_balance,
a.token_balance_change,
a.block_time
FROM
solana.account_activity a
WHERE
a.token_mint_address IS NOT NULL
ORDER BY
a.block_time DESC
LIMIT
100;
```


**View the first and last block indexed**
> This query tells you how fresh the data is.
```sql
SELECT
MIN(number) AS "First block",
MAX(number) AS "Newest block",
COUNT(1) AS "Total number of blocks"
FROM
solana.blocks;
```

## Data Dictionary

### `blocks`
Expand Down Expand Up @@ -196,4 +255,3 @@ Free access to the dataset on the [Snowflake Data Marketplace](https://app.snowf
**Note:** The schema for `vote_account_activity` is identical to the `account_activity` table.

</details>
```

0 comments on commit d3d5d65

Please sign in to comment.