Skip to content

Commit

Permalink
Unisat Compatibility Checked
Browse files Browse the repository at this point in the history
  • Loading branch information
artdoge committed Jun 13, 2023
0 parents commit 56ec70b
Show file tree
Hide file tree
Showing 59 changed files with 8,863 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CHANGELOG.md
coverage
node_modules
npm-debug.log
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Symbol names of tokens to index from ord indexer
DRC_20_SYMBOLS=drc-20
# The block until which the startup mode should run
START_BLOCK=4753897
# The block with first shibescription https://wonky-ord.dogeord.io/shibescription/15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62ei0
# This is the value for Dogecoin mainnet
STARTUP_BLOCK=4609723
# The last block to index (mainly for testing, development)
END_BLOCK=9712647
# The base url of the ord indexer
ORDINALS_BASE_URL=https://wonky-ord.dogeord.io
# false = startup mode, true = daemon mode
DAEMON=false

# Redis settings
# You can use a redis socket or a redis url
USE_REDIS_SOCK=false
REDIS_PATH=/var/run/redis/redis-server.sock
REDIS_URL=redis://127.0.0.1:6379

# How many blocks behind the chain should the indexer be
SLOW_DOWN_MODE_BLOCK_COUNT=100
# Set to true to slow down the indexer to cover reorgs
SLOW_DOWN_MODE=false
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
.env.btc
.env.doge
.env.btc.*
.env.doge.*

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Google API auth credentials file
credentials.json

.idea
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:18-alpine AS build

# Create App dir
RUN mkdir -p /app

# Set working directory to App dir
WORKDIR /app

# Copy project files
COPY . .

RUN cp .env.example .env

# Install deps
RUN npm install && npm install -g typescript && npm run build

FROM node:18-alpine as app

COPY --from=build /app .

WORKDIR /app
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Verydogelabs DRC-20 Indexer

The Verydogelabs DRC-20 Indexer is an advanced software tool that enables users to efficiently index DRC-20 tokens using two different modes. It is designed to work seamlessly with the Ord Indexer, providing robust and reliable indexing performance.

## Modes

This tool operates in two modes:

1. **Startup Mode**: This mode is optimized for rapid data acquisition from the Ord Indexer. It does not execute the generation of inscription transfers nor does it initiate any DRC-20/Doge-20 indexing tasks.
2. **Daemon Mode**: This mode allows all tasks to run continuously, ensuring constant indexing.

## Usage

Here are the recommended steps to use the DRC-20 Indexer:

1. Run the startup mode (**DAEMON=false**) until the specified startup block is reached.
2. Switch to daemon mode by setting **DAEMON=true** in the environment variables.
3. Optionally, set **SLOW_DOWN_MODE=true** to reduce the indexing speed in order to accommodate for any potential blockchain reorganizations.

## Environment Variables

Here is a list of the environment variables used by the DRC-20 Indexer along with their explanation and example values.

```shell
# Symbol names of tokens to index from ord indexer
DRC_20_SYMBOLS=drc-20
# The block until which the startup mode should run
START_BLOCK=4753897
# The block with first shibescription https://wonky-ord.dogeord.io/shibescription/15f3b73df7e5c072becb1d84191843ba080734805addfccb650929719080f62ei0
# This is the value for Dogecoin mainnet
STARTUP_BLOCK=4609723
# The last block to index (mainly for testing, development)
END_BLOCK=9712647
# The base url of the ord indexer
ORDINALS_BASE_URL=https://wonky-ord.dogeord.io
# false = startup mode, true = daemon mode
DAEMON=false

# Redis settings
# You can use a redis socket or a redis url
USE_REDIS_SOCK=true
REDIS_PATH=/var/run/redis/redis-server.sock
REDIS_URL=redis://127.0.0.1:6379

# How many blocks behind the chain should the indexer be
SLOW_DOWN_MODE_BLOCK_COUNT=100
# Set to true to slow down the indexer to cover reorgs
SLOW_DOWN_MODE=false
```
15 changes: 15 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.1"

services:
cache:
image: redis:7-alpine
restart: always
ports:
- "6379:6379"
command: redis-server --maxmemory 4294967296 --maxmemory-policy allkeys-lru --tracking-table-max-keys 100000 --save 20 1 --loglevel warning --requirepass 123456
volumes:
- cache:/data

volumes:
cache:
driver: local
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.8"
services:
indexer:
build: .
working_dir: /app
restart: always
env_file:
- .env
command: npm run start
volumes:
- /var/run/redis/redis-server.sock:/var/run/redis/redis-server.sock:rw
12 changes: 12 additions & 0 deletions init.d/reorg-watcher.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Reorg Watcher
After=network.target

[Service]
ExecStart=/bin/bash -c "exec /<dir-where-this-repo-is>/d20-indexer/scripts/reorg_watcher.sh"
WorkingDirectory=/<dir-where-this-repo-is>/d20-indexer/scripts
StandardOutput=append:/var/log/reorg-watcher.log
StandardError=append:/var/log/reorg-watcher.log

[Install]
WantedBy=default.target
8 changes: 8 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
};
Loading

0 comments on commit 56ec70b

Please sign in to comment.