diff --git a/README.md b/README.md index e73680d9d..af846e1f2 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,95 @@ -# SATONOMICS +
+
+
+
+ A better, FOSS, Bitcoin-only, self-hostable Glassnode. +
## Description -kibō (hope) is a better, FOSS, Bitcoin-only, self-hostable Glassnode. - While [mempool.space](https://mempool.space) gives a very micro view of the network where you can follow the journey of any address, this tool is the exact opposite and very complimentary by giving you a much more global/macro view of the flow and various dynamics of the network via thousands of charts. To promote even more transparency and trust in the network, this project is committed to making on-chain data accessible and verifiable by all, no matter your intentions or financial situation. That is why, the whole project is completely free, from code to services, including a real-time API with thousands and thousands of routes which can be used at will. **Having anyone be able to easily do a health-check of the network is incredibly important and should be wanted by every single bitcoiner.** -## Warning - -This project is in a very early stage. The web app will have bugs, the API might break and the data can definitely to be false or slightly false. - ## Donations -The project is a lot of work and being worked on full-time. It doesn't have any ads and solely relies on donations. If you find this project useful, any sat would really help make it even better and would be really appreciated. +This project was started as an answer to the outrageous pricing from Glassnode (and their third tier starting at $833.33/month !). -You can donate on the project's [Geyser Fund](https://geyser.fund/project/satonomics/). +But it is a lot of work and has been worked on _**full-time since November of 2023**_ and has also been operational since then without any ads. + +_**At the time of writing (2024-09-12), this project has made around 2,200,000 sats, which is around $1300 or $120/month. It's unsustainable.**_ + +So if you find this project useful, [please send some sats](https://geyser.fund/project/satonomics/), it would be really appreciated. + +[Geyser Fund](https://geyser.fund/project/satonomics/) + +## Warning + +This project is in a very early stage. Until more people look at the code and check the various computations, the datasets might be in the worst case completely false. ## Instances -Web App: - -- [app.satonomics.xyz](https://app.satonomics.xyz) - -API: - -- [api.satonomics.xyz](https://api.satonomics.xyz) -- [api-bkp.satonomics.xyz](https://api-bkp.satonomics.xyz) +- [kibo.money](https://kibo.money) +- [backup.kibo.money](https://backup.kibo.money) ## Structure - `parser`: The backbone of the project, it does most of the work by parsing and then computing datasets from the timechain. -- `server`: A small server which automatically creates routes to access through an API all created datasets. -- `app`: A web app which displays the generated datasets in various charts and dashboards. +- `website`: A web app which displays the generated datasets in various charts and dashboards. +- `server`: A small server which will serve the -## How to run +## Setup ### Requirements -- `rustup` +- 1 TB of free space (will use 60-80% of that) +- A running instance of bitcoin-core with txindex=1 and rpc credentials -### Parser +### Docker + +Coming soon + +### Manual + +#### Hardware + +#### 1. Rust ```bash -./run.sh --datadir=$HOME/Developer/bitcoin +# https://www.rust-lang.org/tools/install +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +# https://github.com/watchexec/cargo-watch?tab=readme-ov-file#install +cargo install cargo-watch --locked ``` -### Server +#### 2. Parser + +```bash +# The first run needs several information about your bitcoin-core config +./run.sh --datadir=$HOME/Developer/bitcoin --rpcuser=satoshi --rpcpassword=nakamoto + +# Next time you can just do: ./run.sh +# As everything is saved in +``` + +#### Server ```bash -# Install rustup -# Update ./run.sh if needed ./run.sh ``` Then the easiest to let others access your server is with `cloudflared` which will also cache requests. - -## Limitations - -- Needs to stop the node to parse the files (at least for now) -- Needs a **LOT** a disk space for databases (~700 GB for data from 2009 to mid 2024) - -## Goals / Philosophy - -Adjectives that describe what this project is or strives to be, in no particular order: +## Philosophy - **Best**: Replace Glassnode as the go to - **Diverse**: Have as many charts/datasets as possible and something for everyone @@ -83,46 +103,25 @@ Adjectives that describe what this project is or strives to be, in no particular - **Versatile**: You can view the data in charts, you can download the data, you can fetch the data via an API - **Accessible**: Free Website and API with all the datasets for everyone -## Milestones +## Logo -Big features that are planned, in no particular order: +The dove (borrowed from [svgrepo](https://www.svgrepo.com/svg/351969/dove) for now) represents _**hope**_ (kibō in japanese). + +The orange background represents Bitcoin and when in a circle, it also represents the sun, which means that while it's our hope for a better future, we still have to be careful with our collective goals and actions, to not end up like Icarus. + +## Roadmap -- **Homepage**: A landing page to explains the project and what it does - **More Datasets/Charts**: If a dataset can be computed, it should exist and have its related charts - **Dashboards**: For a quick and real-time view of the latest data of all the datasets -- **NOSTR integration**: First to save preferences, later to add some social functionnality -- **Datasets by block timestamp**: In addition to having datasets by block date and block height +- **Nostr integration**: First to save preferences, later to add some social functionnality +- **Datasets by block timestamp**: In addition to having datasets by date and height - **Descriptions**: Add text to describe all charts and what they mean -- **Start9 Add-on**: By making the whole suite much easier to self-host, it's quite rough right now +- **Start9 support**: By making the whole suite much easier to self-host, it's quite rough right now - **API Documentation**: Highly needed to explain what's what -_Maybe_: +## Iterations -- A Desktop app -- A mobile app - -## Brand - -- **Name**: Willing to change if someone thinks of something better ! -- **Logo**: Most likely a placeholder - -## Collaboration - -- Repositories: - - [Github](https://github.com/satonomics-org/satonomics) - - [Codeberg](https://codeberg.org/satonomics/satonomics) -- Issues: - - [Github](https://github.com/satonomics-org/satonomics/issues) - - [NOSTR](https://gitworkshop.dev/r/naddr1qq99xct5dahx7mtfvdesz9thwden5te0wp6hyurvv4ex2mrp0yhxxmmdqgsfw5dacngjlahye34krvgz7u0yghhjgk7gxzl5ptm9v6n2y3sn03srqsqqqaueek2h03/issues) -- Proposals: - - [Github](https://github.com/satonomics-org/satonomics/pulls) - - [NOSTR](https://gitworkshop.dev/r/naddr1qq99xct5dahx7mtfvdesz9thwden5te0wp6hyurvv4ex2mrp0yhxxmmdqgsfw5dacngjlahye34krvgz7u0yghhjgk7gxzl5ptm9v6n2y3sn03srqsqqqaueek2h03/proposals) - -## Proof of Work - -Aka: Previous iterations - -The initial idea was totally different yet morphed over time into what it is today: a fully FOSS self-hostable on-chain data generator. +A list of all the previous versions and ideas: - https://github.com/drgarlic/satonomics - https://github.com/drgarlic/satonomics-parser diff --git a/parser/stop.sh b/parser/stop.sh deleted file mode 100755 index 20ecf25dd..000000000 --- a/parser/stop.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# if [ "$(uname)" == "Darwin" ]; then -# if [ mdutil -s / | grep "disabled" ]; then -# sudo mdutil -a -i on -# fi -# fi - -bitcoin-cli -datadir=/Users/k/Developer/bitcoin stop diff --git a/server/Cargo.lock b/server/Cargo.lock index 9a60b8dbd..2a9828552 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -2482,6 +2482,7 @@ version = "0.4.0" dependencies = [ "axum", "bincode", + "chrono", "color-eyre", "derive_deref", "itertools", @@ -2492,7 +2493,6 @@ dependencies = [ "serde_json", "swc", "swc_common", - "swc_ecma_minifier", "tokio", "tower-http", ] diff --git a/server/Cargo.toml b/server/Cargo.toml index 5d5239dca..2df390c75 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -5,17 +5,17 @@ edition = "2021" [dependencies] axum = "0.7.5" -color-eyre = "0.6.3" -itertools = "0.13.0" -regex = "1.10.6" bincode = { git = "https://github.com/bincode-org/bincode.git" } +chrono = "0.4.38" +color-eyre = "0.6.3" +derive_deref = "1.1.1" +itertools = "0.13.0" +parser = { path = "../parser" } +regex = "1.10.6" reqwest = { version = "0.12.7", features = ["json"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = { version = "1.0.128" } -tokio = { version = "1.40.0", features = ["full"] } -tower-http = { version = "0.5.2", features = ["compression-full"] } -parser = { path = "../parser" } -derive_deref = "1.1.1" swc = "0.286.0" swc_common = "0.37.5" -swc_ecma_minifier = "0.205.2" +tokio = { version = "1.40.0", features = ["full"] } +tower-http = { version = "0.5.2", features = ["compression-full"] } diff --git a/server/run.sh b/server/run.sh index 7ba09fa05..e3378de35 100755 --- a/server/run.sh +++ b/server/run.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if cargo watch --help &> /dev/null; then TRIGGER="./in/datasets_len.txt" diff --git a/server/src/api/handlers/dataset.rs b/server/src/api/handlers/dataset.rs index 422e20bd7..d6f0c9d59 100644 --- a/server/src/api/handlers/dataset.rs +++ b/server/src/api/handlers/dataset.rs @@ -6,7 +6,7 @@ use axum::{ response::{IntoResponse, Response}, }; use color_eyre::{eyre::eyre, owo_colors::OwoColorize}; -use reqwest::{header::HOST, StatusCode}; +use reqwest::StatusCode; use serde::Deserialize; use parser::{log, Date, DateMap, Height, HeightMap, MapChunkId, HEIGHT_MAP_CHUNK_SIZE, OHLC}; @@ -14,10 +14,11 @@ use parser::{log, Date, DateMap, Height, HeightMap, MapChunkId, HEIGHT_MAP_CHUNK use crate::{ api::structs::{Chunk, Kind, Route}, header_map::HeaderMapUtils, - response::typed_value_to_response, AppState, }; +use super::response::typed_value_to_response; + #[derive(Deserialize)] pub struct Params { chunk: Option