Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
dca6f8e
removed indexer from repository
randomlogin Oct 3, 2024
8021689
rework of frontend with new indexer
randomlogin Oct 15, 2024
ce1decb
adjusted txs view and orphan blocks view
randomlogin Oct 16, 2024
d7836bb
search box redirect
randomlogin Oct 17, 2024
86cac2c
reworked styles
randomlogin Oct 25, 2024
2b183a7
fixed block header appearence
randomlogin Oct 25, 2024
6ef7e73
removed drizzle orm
randomlogin Oct 25, 2024
b6b04a0
refactoring
randomlogin Oct 25, 2024
eb309c7
refactor
randomlogin Oct 25, 2024
a83a2dc
added addresses
randomlogin Oct 28, 2024
7d080e1
reworked styling
randomlogin Oct 29, 2024
f7ea5d1
added sha256 browser
randomlogin Oct 29, 2024
8bcf7ae
solved address parsing problems
randomlogin Oct 30, 2024
c4456d1
fixed missing address parser, improved view
randomlogin Oct 30, 2024
19c0e6e
added missing address parser
randomlogin Oct 30, 2024
3c7a9a8
removed twice loading of the block
randomlogin Oct 30, 2024
1e2f860
optimized build
randomlogin Oct 30, 2024
620a2aa
solved header styling problem
randomlogin Oct 30, 2024
2acd736
added tx time on address page
randomlogin Oct 30, 2024
50527cd
staging
randomlogin Nov 12, 2024
8f2054f
staging
randomlogin Nov 12, 2024
45c23a3
moved back the timeline
randomlogin Nov 13, 2024
8bff96c
removed orphan block from space query
randomlogin Nov 13, 2024
d90a17a
removed orphan block from space query
randomlogin Nov 13, 2024
5dced21
added auction pages
randomlogin Nov 18, 2024
9b83b0d
reworked empty data presentation
randomlogin Nov 18, 2024
e578da5
reworked recent actions
randomlogin Nov 18, 2024
ce27f45
adjusted future block time in the stats
randomlogin Nov 18, 2024
4e1c96c
removed lucid icons
randomlogin Nov 18, 2024
2fef492
polishing
randomlogin Nov 19, 2024
00116f9
added rollout page
randomlogin Nov 19, 2024
766bf1b
updated rollouts
randomlogin Nov 20, 2024
26808a0
changed testnet header message
randomlogin Nov 20, 2024
798cf64
a bit of cleanup
randomlogin Nov 20, 2024
2874a51
rollout order fixed
randomlogin Nov 20, 2024
8a139b8
changed default auction sort, fixed rollout block estimate
randomlogin Nov 26, 2024
e2d5486
reformulated time interval
randomlogin Nov 26, 2024
d09efe7
solved sorting problem of current auctions
randomlogin Dec 4, 2024
8176c45
fixed timeline bugs, added recent actions page
randomlogin Dec 11, 2024
98ad564
made downcase the titles
randomlogin Dec 11, 2024
49c6531
fixed auction status in timeline
randomlogin Dec 11, 2024
3aa1442
fixed auction status
randomlogin Dec 11, 2024
ab2d64b
fixed auction status
randomlogin Dec 11, 2024
fe25f51
changed internal queries for auctions
randomlogin Dec 17, 2024
7a72f9a
changed the default sort direction
randomlogin Dec 17, 2024
8cb1aac
rephrased
randomlogin Dec 18, 2024
8d78998
added scriptsig
randomlogin Dec 19, 2024
289c648
added additional logging and robots.txt
randomlogin Dec 23, 2024
89a2dff
added mempool endpoint, fixed mobile version
randomlogin Dec 25, 2024
1fe77db
tx block index not shown for mempool tx
randomlogin Dec 26, 2024
4ee2360
fixed broken links
randomlogin Dec 26, 2024
3b6a9aa
mempool work #4
randomlogin Dec 27, 2024
69c4f5f
removed shadow line from stats
randomlogin Dec 27, 2024
58f5447
added mempool block to recent action
randomlogin Dec 27, 2024
eb5d55a
added background for mempool tx
randomlogin Dec 27, 2024
f9b7cd8
added tooltip
randomlogin Dec 27, 2024
152062f
removed address endpoint
randomlogin Jan 3, 2025
ee8ea69
added timestamp to the logs, clened output
randomlogin Jan 3, 2025
3e24826
mobile menu
randomlogin Jan 7, 2025
1cff8fc
updated view of tx details
randomlogin Jan 20, 2025
b364fed
fixed search bar
randomlogin Feb 3, 2025
bb9878e
improved view of the space page
randomlogin Feb 21, 2025
2bdea30
optimized mobile view
randomlogin Feb 21, 2025
5371487
removed error cause by theme detection
randomlogin Feb 21, 2025
39afbdd
added bid value to the table in ended acutions
randomlogin Feb 21, 2025
ce0e44a
improved layout
randomlogin Feb 21, 2025
60803a4
added punycode support
randomlogin Mar 12, 2025
a083baa
added txoutput highligh
randomlogin Mar 12, 2025
dfbadc0
solved problems with not found name
randomlogin Mar 19, 2025
853b61c
added root anchors endpoint
randomlogin Apr 8, 2025
834df22
added marketplace link
randomlogin Jun 18, 2025
247be60
changed db pool settings
randomlogin Aug 25, 2025
3c2a4ee
Various changes for the new db
randomlogin Oct 17, 2025
991241d
reworked display
randomlogin Oct 21, 2025
7069c80
added background
randomlogin Oct 21, 2025
2a09aa6
outpoint
randomlogin Oct 21, 2025
26c5dbd
added subspaces commitments v1
randomlogin Dec 10, 2025
d39c1e0
Adding history hashes, main page events
randomlogin Dec 10, 2025
4a9927a
added basic sptr support
randomlogin Jan 14, 2026
c827da1
added README
randomlogin Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
npm-debug.log
Dockerfile
.dockerignore
.git
.gitignore
README.md
.env
*.log
5 changes: 0 additions & 5 deletions .editorconfig

This file was deleted.

3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DB_URL=postgres://postgres:postgres@127.0.0.1/postgres?sslmode=disable
PUBLIC_BTC_NETWORK=testnet4
MARKETPLACE_URI=http://localhost:3000
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
.env
.svelte-kit
pgdata
.vscode
pgdata
build
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .

# Accept build-time argument for network configuration
ARG PUBLIC_BTC_NETWORK=mainnet
ARG MARKETPLACE_URI

# Set as environment variable for build
ENV PUBLIC_BTC_NETWORK=$PUBLIC_BTC_NETWORK
ENV MARKETPLACE_URI=$MARKETPLACE_URI

RUN npm run build

FROM node:20-alpine
WORKDIR /app
# Copy built assets from builder
COPY --from=builder /app/build ./build
COPY --from=builder /app/package*.json ./
# Install production dependencies only
RUN npm ci --production
# Expose the port your app runs on
EXPOSE 3000

# Use an entrypoint script to handle environment variables
CMD ["node", "build"]
203 changes: 54 additions & 149 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,180 +1,85 @@
# SpacesProtocol Explorer & Indexer
# Spaces Protocol Explorer

This is a monorepo containing two projects located in the `explorer` and `indexer` directories.
A web block explorer for the [Spaces Protocol](https://explorer.spacesprotocol.org). Browse blocks, transactions, spaces, auctions, space pointers.
Frontend gets data only from the database, it doesn't connect to a bitcoin node, neither to a space daemon.

## Indexer
It's possible to browse mempool transactions (however without `sptr` data, it will be added once `getsptrpackage` or
something similar is added to spaced).

Indexer is a script written in TypeScript that runs every minute and fetches new blocks from `bitcoind` daemon, queries `spaced` for information about the fetched blocks and writes the relevant information to the database.
## Tech Stack

### Prerequisites
- **Framework**: SvelteKit 2 with Svelte 5
- **Database**: PostgreSQL, it imports drizzle ORM, however it only uses raw SQL queries (for perfomance reason)
- **Styling**: TailwindCSS + DaisyUI
- **Runtime**: Node.js

Make sure to install:

- Bitcoin Core: <https://bitcoincore.org/en/download/>
- Rust: <https://www.rust-lang.org/tools/install>
## Prerequisites

### Testnet sync
- Node.js 18+
- PostgreSQL database with spaces protocol data

After installing Bitcoin Core, create a directory for Bitcoin testnet data:
For the actual schema, please refer to the [indexer repository](http://github.com/spacesprotocol/indexer).

```bash
mkdir $HOME/bitcoin-testnet

# Create a configuration file with RPC credentials
echo "rpcuser=test" > $HOME/bitcoin-testnet/bitcoin.conf
echo "rpcpassword=test" >> $HOME/bitcoin-testnet/bitcoin.conf

# Start Bitcoin Core in testnet mode
bitcoind -testnet -datadir=$HOME/bitcoin-testnet
```

Spaces protocol is activated on Bitcoin testnet block `2865460` - wait for bitcoind to sync up to that block before proceeding.

### Install spaced

spaced is a tiny layer on top of Bitcoin Core allowing you to interact with Spaces. To compile spaced, you need to install Rust and then

```bash
# Clone the repository
git clone https://github.com/spacesprotocol/spaced && cd spaced

# Build the release version
cargo build --release

# Install the binaries
cargo install --path node

# Ensure Cargo's bin directory is in your PATH
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

Verify you have spaced and space-cli installed:

```bash
spaced --version
space-cli --version
```

### Connect to Bitcoin Core

Make sure to run `spaced` with block indexing enabled:

```bash
spaced --chain test --block-index --bitcoin-rpc-user test --bitcoin-rpc-password test
```

### Preparing the Indexer

Install dependencies:

``` bash
cd indexer
npm install
```

Create an `.env` file:

```bash
cp .env.example .env
```

If needed, make changes to the `.env` file but if you fully followed this guide everything should work with the default values.

### Setting up Postgres database

Same database is used by both the Explorer and the Indexer.

You can start the database using Docker or set up your own database.

To run it via Docker run the following command from the root directory, i.e. the directory where the `docker-compose.yml` is located:
## Setup

```bash
docker compose up -d
```
1. Clone the repository

Create the database schema:
2. Install dependencies:
```bash
npm install
```

```bash
cd indexer
npx drizzle-kit push
```
3. Configure environment variables:
```bash
cp .env.example .env
```

### Starting the Indexer
Edit `.env.local`:
```
DB_URL=postgres://user:password@localhost/spaces_protocol_explorer
PUBLIC_BTC_NETWORK=testnet4 # or mainnet
MARKETPLACE_URI=https://spaces.market
```

You can start the indexer directly in the terminal or make it run in the background using `pm2` and have it running even when you exit the terminal.
MARKETPLACE_URI is used in conjunction with spaces marketplace to show the users whether a particular space is on the
secondary market.
Consult [spaces protocol secondary marketplace repository](https://github.com/spaceprotocol/marketplace) for the
exact API used.

To start it in the terminal run:
4. Start the development server:
```bash
npm run dev
```

```bash
npm run start
```

To run it via `pm2` make sure to first install `pm2`:

```bash
npm i -g pm2
```
The app will be available at http://localhost:5173

Then build the app and run it:
## Production

Build and run:
```bash
npm run build
pm2 start dist/index.js
node build/server.js
```

Make sure it's running:
The server runs on port 3000 by default.

```bash
pm2 status
```
Consider using docker for the production setup.

## Explorer
## Notes

### Install dependencies
Type definitions might be out of date.

```bash
cd explorer
npm install
```

### Add an `.env` file

```bash
cp .env.example .env
```
Some CSS styling is inconsistent and redefined and per page basis.

If needed, make changes to the `.env` file but if you fully followed this guide everything should work with the default values.
Same stands for the code style: use your own linter settings.

### Run the explorer
Previously the explorer indexed the whole blockchain data from the genesis block, also it indexed the addresses,
therefore some remnants of this structure might be present in the repository, despite them not being used live.

You can start the explorer directly in the terminal or make it run in the background using `pm2` and have it running even when you exit the terminal.
The routes can be found in `src/routes`, they contain both `api` routes and the frontend routes.
Reusable components can be found in `src/lib/components`

To start it in the terminal run:

```bash
npm run dev
```

Then you can open the browser at: `http://localhost:5173/`

To run it via `pm2` make sure to first install `pm2`:

```bash
npm i -g pm2
```

Then build the app and run it:

```bash
npm run build
pm2 start build/server.js
```

Make sure it's running:

```bash
pm2 status
```
## License

You can then open the explorer in a browser: `http://localhost:3000`
MIT
21 changes: 12 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
version: '3.8'

services:
db:
image: postgres:16.3
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: spacesprotocol_explorer
web:
build: .
ports:
- "5432:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
- "3000:3000"
environment:
- DB_URL=${DB_URL}
- PUBLIC_BTC_NETWORK=${PUBLIC_BTC_NETWORK}
networks:
- spacesprotocol-explorer

networks:
spacesprotocol-explorer:
external: true
File renamed without changes.
2 changes: 0 additions & 2 deletions explorer/.env.example

This file was deleted.

6 changes: 0 additions & 6 deletions explorer/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions explorer/drizzle.config.ts

This file was deleted.

Loading