Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAJOR update, including addition of MariaDB with config support, URIToken, with initial Hookset/invoke #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 36 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
#____API Section

API_ENABLED=true
API_PORT=3000

#_____NODE SERVER Section

#mainnet
# XRPL_CLIENT=wss://xrplcluster.com
# XRPL_CLIENT=wss://s2.ripple.com
# XAHAU_CLIENT=wss://xahau.network
# XRPL_LEDGER_INDEX=83525625
# XAHAU_LEDGER_INDEX=2

#testnet
XRPL_CLIENT=wss://s.altnet.rippletest.net:51233/
XAHAU_CLIENT=wss://xahau-test.net
XRPL_LEDGER_INDEX=41790000
XAHAU_LEDGER_INDEX=7159000
XAHAU_LEDGER_INDEX=2082589


#___DATABASE Section

DB_TYPE=sqlite
#DB_TYPE=mariadb

#testnet
DB_HOST=127.1.1.1
DB_PORT=25500
DB_USER=username
DB_PASS=password
DB_NAME=b2m_testnet

#mainnet
# DB_HOST=127.1.1.1
# DB_PORT=25500
# DB_USER=username
# DB_PASS=password
# DB_NAME=b2m_mainnet
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
db/:account:
db/:record:
db/_account.sqlite3
db/_record.sqlite3
log/ERR.txt
log/INF.txt
node_modules/
log/WRN.txt
node_modules/
tester.js
.vscode
.npm
.env
70 changes: 56 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Burn2Mint Indexer

Index through the XRPL & Xahau for B2M traffic via rippled & xahaud websocket API. This indexer is serverless and is meant to be hosted 24/7.
Will Index through the XRPL & Xahau ledgers for B2M traffic, URITokens Hooks via configured websocket API.
after indexing through ledgers, it will listen for ongoing transactions.
This indexer is serverless and is meant to be hosted 24/7.

> This indexer supports indexing/logging of XRP burns, XAH Import Mints, URITokens, and basic HookSet/Invoke log.
> Its mainly been tested with MariaDB due to the speed of that DB, sqlite works ok if theres not much action due to "SQL_BUSY" errors

> This indexer is only supports XRP-to-XAH B2M's.

### Installation

Install nodejs dependencies:
```
npm install
```
this installs and sets up all the packages thats are listed in packages.json

### Set up .env file

Expand All @@ -18,26 +23,63 @@ To copy the default (sample) `.env` file:
cp -r .env.sample .env
```

**NOTE**: For testing purposes, you can put any arbitrary ledger index to start from.
**NOTE**: For testing purposes, you can put any arbitrary ledger index to start from, the basic setting should get you going.

`.env` file is use to set up the envirment varibles
so it can enable the API, set the API_PORT, choose the Database type etc
the sample .env has been split into section to make it a little clearer

`.env` structure:
```
XRPL_CLIENT=XRPL node wss address
XAHAU_CLIENT=Xahau node wss address
XRPL_LEDGER_INDEX=The ledger containing the first Burn tx
XAHAU_LEDGER_INDEX=The ledger in which XahauGenesis went live
```
#API section
API_ENABLED=true - to enable or discable the API server
API_PORT=3000 - the API port the server will listen on

#node server section
XRPL_CLIENT=XRPL - node wss address
XAHAU_CLIENT=Xahau - node wss address
XRPL_LEDGER_INDEX= - The ledger containing the first Burn tx
XAHAU_LEDGER_INDEX= - The ledger in which XahauGenesis went live

##database section
DB_TYPE=sqlite3 - the database type it will use, currently either sqlite, or mariadb

#testnet
DB_HOST=127.1.1.1 - ip/host of the maria db
DB_PORT=25500 - port the db is using
DB_USER=esername - username of the db
DB_PASS=password - password of the db
DB_NAME=b2m_testnet - and the database name
```

## Run B2M-indexer

Location: `/src`
all the main programs are in file Location: `/src`

but the coding is setup so that the "working directory" is the root location for eg

To run `B2M-indexer`:
```
node main.js
node src/main.js
```

To check B2M stats, run:
To run and check local B2M stats, run:
```
node src/stats.js
```
node stats.js
```

## API Server
the API server has the same info than the stat.jjs has.
the root, for exmple, if this was your PC's IP, and you kept the default PORT;
>http://192.168.0.1:3000

would give the stats

`/all` gives a list of all accounts and details.

`/account/<address>` allows you to search a single account.

`/history/daily` gives you info split by day, or specify the date `/history/daily/<YYYY-MM-DD>`

`/history/monthly` gives you info split by month, or specify the month `/history/monthly/<YYYY-MM>`

`/uri/<uriTokenID>` allows you to search for a URIToken via its URITokenID
Loading