Skip to content

Commit

Permalink
Merge pull request #25 from ferritecoin/master
Browse files Browse the repository at this point in the history
ferrite init
  • Loading branch information
koh-gt authored Jul 24, 2024
2 parents ef430ab + 45ad5f1 commit ac5cc13
Show file tree
Hide file tree
Showing 143 changed files with 993 additions and 873 deletions.
10 changes: 5 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
LITE.SPACE
Copyright (c) 2019-2023 The Mempool Open Source Project Developers
Copyright (c) 2023 Litecoin Foundation
Copyright (c) 2023 Ferrite Foundation

This program is free software; you can redistribute it and/or modify it under
the terms of (at your option) either:

1. the GNU Affero General Public License as published by the Free Software
Foundation, either version 3 of the License or any later version approved by a
proxy statement published on <https://litecoinspace.org/about>; or
proxy statement published on <https://ferritecoin.com/about>; or

2. the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License or any later version approved by a
proxy statement published on <https://litecoinspace.org/about>.
proxy statement published on <https://ferritecoin.com/about>.

This website is not affiliated or endorsed by Mempool Space K.K.

The Litecoin Space explorer is a fork of the mempool.space™ repo, an open source Bitcoin
The Ferrite Space explorer is a fork of the mempool.space™ repo, an open source Bitcoin
explorer, developed by Mempool Space K.K. In accordance with Section (III) of their
trademark policy, Litecoin Space does not include any usage of "Word Marks", "Logos",
trademark policy, Ferrite Space does not include any usage of "Word Marks", "Logos",
or "Trade Dress", except where necessary to display licensing and original copyright
authors. See Mempool Space K.K's full Trademark Policy and Guidelines for more
details, published on <https://mempool.space/trademark-policy>.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Litecoin Space
# Ferrite Space

<br>

Litepool is the fully-featured mempool visualizer, explorer, and API service running at [litecoinspace.org](https://litecoinspace.org/).
Ferritepool is the fully-featured mempool visualizer, explorer, and API service running at [ferritecoin.com](https://ferritecoin.com/).

It is an open-source project developed and operated for the benefit of the Litecoin community, with a focus on the emerging transaction fee market that is evolving Litecoin into a multi-layer ecosystem.
It is an open-source project developed and operated for the benefit of the Ferrite community, with a focus on the emerging transaction fee market that is evolving Ferrite into a multi-layer ecosystem.

# Installation Methods

litepool can be self-hosted on a wide variety of your own hardware, ranging from a simple one-click installation on a Raspberry Pi full-node distro all the way to a robust production instance on a powerful FreeBSD server.
ferritepool can be self-hosted on a wide variety of your own hardware, ranging from a simple one-click installation on a Raspberry Pi full-node distro all the way to a robust production instance on a powerful FreeBSD server.

**Most people should use a one-click install method.** Other install methods are meant for developers and others with experience managing servers.

Expand All @@ -28,8 +28,8 @@ Mempool can be conveniently installed on the following full-node distros:

## Advanced Installation Methods

Litepool can be installed in other ways too, but we only recommend doing so if you're a developer, have experience managing servers, or otherwise know what you're doing.
Ferritepool can be installed in other ways too, but we only recommend doing so if you're a developer, have experience managing servers, or otherwise know what you're doing.

- See the [`docker/`](./docker/) directory for instructions on deploying Litepool with Docker.
- See the [`docker/`](./docker/) directory for instructions on deploying Ferritepool with Docker.
- See the [`backend/`](./backend/) and [`frontend/`](./frontend/) directories for manual install instructions oriented for developers.
- See the [`production/`](./production/) directory for guidance on setting up a more serious Litepool instance designed for high performance at scale.
- See the [`production/`](./production/) directory for guidance on setting up a more serious Ferritepool instance designed for high performance at scale.
70 changes: 35 additions & 35 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Litepool Backend
# Ferritepool Backend

These instructions are mostly intended for developers.

If you choose to use these instructions for a production setup, be aware that you will still probably need to do additional configuration for your specific OS, environment, use-case, etc. We do our best here to provide a good starting point, but only proceed if you know what you're doing. Litepool does not provide support for custom setups.
If you choose to use these instructions for a production setup, be aware that you will still probably need to do additional configuration for your specific OS, environment, use-case, etc. We do our best here to provide a good starting point, but only proceed if you know what you're doing. Ferritepool does not provide support for custom setups.

See other ways to set up Litepool on [the main README](/../../#installation-methods).
See other ways to set up Ferritepool on [the main README](/../../#installation-methods).

Jump to a section in this doc:

Expand All @@ -13,25 +13,25 @@ Jump to a section in this doc:

## Setup

### 1. Clone Litepool Repository
### 1. Clone Ferritepool Repository

Get the latest Litepool code:
Get the latest Ferritepool code:

```
git clone https://github.com/litecoin-foundation/ltcspace
cd Litepool
git clone https://github.com/ferritecoin/fecspace
cd Ferritepool
```

Check out the latest release:

```
latestrelease=$(curl -s https://api.github.com/repos/litecoin-foundation/litepool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
latestrelease=$(curl -s https://api.github.com/repos/ferritecoin/ferritepool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
git checkout $latestrelease
```

### 2. Configure Litecoin Core
### 2. Configure Ferrite Core

Turn on `txindex`, enable RPC, and set RPC credentials in `litecoin.conf`:
Turn on `txindex`, enable RPC, and set RPC credentials in `ferrite.conf`:

```
txindex=1
Expand All @@ -42,13 +42,13 @@ rpcpassword=mempool

### 3. Configure Electrum Server

[Pick an Electrum Server implementation](https://litecoinspace.org/docs/faq#address-lookup-issues), configure it, and make sure it's synced.
[Pick an Electrum Server implementation](https://ferritecoin.com/docs/faq#address-lookup-issues), configure it, and make sure it's synced.

**This step is optional.** You can run Litepool without configuring an Electrum Server for it, but address lookups will be disabled.
**This step is optional.** You can run Ferritepool without configuring an Electrum Server for it, but address lookups will be disabled.

### 4. Configure MariaDB

_Litepool needs MariaDB v10.5 or later. If you already have MySQL installed, make sure to migrate any existing databases **before** installing MariaDB._
_Ferritepool needs MariaDB v10.5 or later. If you already have MySQL installed, make sure to migrate any existing databases **before** installing MariaDB._

Get MariaDB from your operating system's package manager:

Expand All @@ -74,7 +74,7 @@ MariaDB [(none)]> grant all privileges on mempool.* to 'mempool'@'%' identified
Query OK, 0 rows affected (0.00 sec)
```

### 5. Prepare Litepool Backend
### 5. Prepare Ferritepool Backend

#### Build

Expand All @@ -100,15 +100,15 @@ Edit `mempool-config.json` as needed.

In particular, make sure:

- the correct Litecoin Core RPC credentials are specified in `CORE_RPC`
- the correct Ferrite Core RPC credentials are specified in `CORE_RPC`
- the correct `BACKEND` is specified in `MEMPOOL`:
- "electrum" if you're using [electrs-ltc](https://github.com/rust-litecoin/electrs-ltc/tree/master) or [cculianu/Fulcrum](https://github.com/cculianu/Fulcrum)
- "esplora" if you're using [electrs-ltc-esplora](https://github.com/rust-litecoin/electrs-ltc/tree/esplora)
- "electrum" if you're using [electrs-ltc](https://github.com/rust-ferrite/electrs-ltc/tree/master) or [cculianu/Fulcrum](https://github.com/cculianu/Fulcrum)
- "esplora" if you're using [electrs-ltc-esplora](https://github.com/rust-ferrite/electrs-ltc/tree/esplora)
- "none" if you're not using any Electrum Server

### 6. Run Litepool Backend
### 6. Run Ferritepool Backend

Run the Litepool backend:
Run the Ferritepool backend:

```
npm run start
Expand Down Expand Up @@ -144,15 +144,15 @@ Mempool updated in 0.243 seconds
Updating mempool
```

### 7. Set Up Litepool Frontend
### 7. Set Up Ferritepool Frontend

With the backend configured and running, proceed to set up the [Litepool frontend](../frontend#manual-setup).
With the backend configured and running, proceed to set up the [Ferritepool frontend](../frontend#manual-setup).

## Development Tips

### Set Up Backend Watchers

The litepool backend is static. TypeScript scripts are compiled into the `dist` folder and served through a Node.js web server.
The ferritepool backend is static. TypeScript scripts are compiled into the `dist` folder and served through a Node.js web server.

As a result, for development purposes, you may find it helpful to set up backend watchers to avoid the manual shutdown/recompile/restart command-line cycle.

Expand All @@ -174,69 +174,69 @@ nodemon src/index.ts --ignore cache/

Helpful link: https://gist.github.com/System-Glitch/cb4e87bf1ae3fec9925725bb3ebe223a

Run litecoind on regtest:
Run ferrited on regtest:

```
litecoind -regtest
ferrited -regtest
```

Create a new wallet, if needed:

```
litecoin-cli -regtest createwallet test
ferrite-cli -regtest createwallet test
```

Load wallet (this command may take a while if you have lot of UTXOs):

```
litecoin-cli -regtest loadwallet test
ferrite-cli -regtest loadwallet test
```

Get a new address:

```
address=$(litecoin-cli -regtest getnewaddress)
address=$(ferrite-cli -regtest getnewaddress)
```

Mine blocks to the previously generated address. You need at least 101 blocks before you can spend. This will take some time to execute (~1 min):

```
litecoin-cli -regtest generatetoaddress 101 $address
ferrite-cli -regtest generatetoaddress 101 $address
```

Send 0.1 BTC at 5 lit/vB to another address:

```
litecoin-cli -named -regtest sendtoaddress address=$(litecoin-cli -regtest getnewaddress) amount=0.1 fee_rate=5
ferrite-cli -named -regtest sendtoaddress address=$(ferrite-cli -regtest getnewaddress) amount=0.1 fee_rate=5
```

See more example of `sendtoaddress`:

```
litecoin-cli sendtoaddress # will print the help
ferrite-cli sendtoaddress # will print the help
```

Mini script to generate random network activity (random TX count with random tx fee-rate). It's slow so don't expect to use this to test mempool spam, except if you let it run for a long time, or maybe with multiple regtest nodes connected to each other.

```
#!/bin/bash
address=$(litecoin-cli -regtest getnewaddress)
litecoin-cli -regtest generatetoaddress 101 $address
address=$(ferrite-cli -regtest getnewaddress)
ferrite-cli -regtest generatetoaddress 101 $address
for i in {1..1000000}
do
for y in $(seq 1 "$(jot -r 1 1 1000)")
do
litecoin-cli -regtest -named sendtoaddress address=$address amount=0.01 fee_rate=$(jot -r 1 1 100)
ferrite-cli -regtest -named sendtoaddress address=$address amount=0.01 fee_rate=$(jot -r 1 1 100)
done
litecoin-cli -regtest generatetoaddress 1 $address
ferrite-cli -regtest generatetoaddress 1 $address
sleep 5
done
```

Generate block at regular interval (every 10 seconds in this example):

```
watch -n 10 "litecoin-cli -regtest generatetoaddress 1 $address"
watch -n 10 "ferrite-cli -regtest generatetoaddress 1 $address"
```

### Mining pools update
Expand Down
10 changes: 5 additions & 5 deletions backend/mempool-config-testnet.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
},
"CORE_RPC": {
"HOST": "127.0.0.1",
"PORT": 19332,
"USERNAME": "mempool",
"PASSWORD": "mempool",
"PORT": 19573,
"USERNAME": "user",
"PASSWORD": "password",
"TIMEOUT": 60000
},
"ESPLORA": {
"REST_API_URL": "http://127.0.0.1:3002"
"REST_API_URL": "http://127.0.0.1:3011"
},
"DATABASE": {
"ENABLED": true,
Expand All @@ -49,7 +49,7 @@
"PASSWORD": ""
},
"EXTERNAL_DATA_SERVER": {
"MEMPOOL_API": "https://litecoinspace.org/api/v1",
"MEMPOOL_API": "https://ferritecoin.com/api/v1",
"MEMPOOL_ONION": "http://REPLACEME.onion/api/v1"
}
}
18 changes: 9 additions & 9 deletions backend/mempool-config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@
"EXTERNAL_ASSETS": [],
"EXTERNAL_MAX_RETRY": 1,
"EXTERNAL_RETRY_INTERVAL": 0,
"USER_AGENT": "mempoollite",
"USER_AGENT": "mempoolfec",
"STDOUT_LOG_MIN_PRIORITY": "debug",
"AUTOMATIC_BLOCK_REINDEXING": true,
"POOLS_JSON_URL": "https://raw.githubusercontent.com/litecoin-foundation/mining-pools-ltc/master/pools.json",
"POOLS_JSON_TREE_URL": "https://api.github.com/repos/litecoin-foundation/mining-pools-ltc/git/trees/master",
"POOLS_JSON_URL": "https://raw.githubusercontent.com/mempool/mining-pools/master/pools-v2.json",
"POOLS_JSON_TREE_URL": "https://api.github.com/repos/mempool/mining-pools/git/trees/master",
"AUDIT": true,
"ADVANCED_GBT_AUDIT": true,
"ADVANCED_GBT_MEMPOOL": true,
"CPFP_INDEXING": true
},
"CORE_RPC": {
"HOST": "127.0.0.1",
"PORT": 9332,
"USERNAME": "poop",
"PASSWORD": "poop"
"PORT": 9573,
"USERNAME": "user",
"PASSWORD": "password"
},
"ELECTRUM": {
"HOST": "127.0.0.1",
"PORT": 50002,
"PORT": 50011,
"TLS_ENABLED": true
},
"ESPLORA": {
"REST_API_URL": "http://127.0.0.1:3000"
"REST_API_URL": "http://127.0.0.1:3010"
},
"SECOND_CORE_RPC": {
"HOST": "127.0.0.1",
Expand Down Expand Up @@ -105,7 +105,7 @@
"CLEARNET_URL": "https://price.bisq.wiz.biz/getAllMarketPrices"
},
"EXTERNAL_DATA_SERVER": {
"MEMPOOL_API": "https://litecoinspace.org/api/v1",
"MEMPOOL_API": "https://ferritecoin.com/api/v1",
"MEMPOOL_ONION": "http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/api/v1"
}
}
4 changes: 2 additions & 2 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "mempool-ltc-backend",
"version": "2.6.0-dev",
"description": "Litecoin mempool visualizer and blockchain explorer backend",
"description": "Ferrite mempool visualizer and blockchain explorer backend",
"license": "GNU Affero General Public License v3.0",
"homepage": "https://litecoinspace.org",
"homepage": "https://ferritecoin.com",
"repository": {
"type": "git",
"url": "git+https://github.com/mempool/mempool"
Expand All @@ -12,7 +12,7 @@
"url": "https://github.com/mempool/mempool/issues"
},
"keywords": [
"litecoin",
"ferrite",
"mempool",
"blockchain",
"explorer",
Expand Down
14 changes: 7 additions & 7 deletions backend/src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('Mempool Backend Config', () => {
EXTERNAL_RETRY_INTERVAL: 0,
USER_AGENT: 'mempool',
STDOUT_LOG_MIN_PRIORITY: 'debug',
POOLS_JSON_TREE_URL: 'https://api.github.com/repos/litecoin-foundation/mining-pools-ltc/git/trees/master',
POOLS_JSON_URL: 'https://raw.githubusercontent.com/litecoin-foundation/mining-pools-ltc/master/pools.json',
POOLS_JSON_TREE_URL: '',
POOLS_JSON_URL: '',
AUDIT: false,
ADVANCED_GBT_AUDIT: false,
ADVANCED_GBT_MEMPOOL: false,
Expand All @@ -51,9 +51,9 @@ describe('Mempool Backend Config', () => {

expect(config.CORE_RPC).toStrictEqual({
HOST: '127.0.0.1',
PORT: 9332,
USERNAME: 'mempool',
PASSWORD: 'mempool',
PORT: 9573,
USERNAME: 'user',
PASSWORD: 'password',
TIMEOUT: 60000
});

Expand Down Expand Up @@ -96,8 +96,8 @@ describe('Mempool Backend Config', () => {
});

expect(config.EXTERNAL_DATA_SERVER).toStrictEqual({
MEMPOOL_API: 'https://litepool.space/api/v1',
MEMPOOL_ONION: 'http://TODO: litecoin.onion/api/v1',
MEMPOOL_API: 'https://ferritepool.space/api/v1',
MEMPOOL_ONION: 'http://TODO: ferrite.onion/api/v1',
});

expect(config.MAXMIND).toStrictEqual({
Expand Down
Loading

0 comments on commit ac5cc13

Please sign in to comment.