Skip to content

Commit

Permalink
Merge pull request #37 from debridge-finance/develop
Browse files Browse the repository at this point in the history
Add sentry, removed access keys, upload statistic to api
  • Loading branch information
artyukh authored Oct 27, 2021
2 parents 84b14d6 + 5571bde commit 4e489db
Show file tree
Hide file tree
Showing 48 changed files with 3,381 additions and 15,189 deletions.
9 changes: 6 additions & 3 deletions .env → .default.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ JWT_SECRET=FNJjknsjsnfnsfjskjnf
#debridge test api URL
API_BASE_URL=https://testnetvalidatorsapi.debridge.io

#need to get from debridge team
DEBRIDGE_API_ACCESS_KEY=8a4b8a1b-82e9-4497-b2d2-68b447aa9c14

DEBRIDGE_NODE_PORT=3001

API_LOGIN=login
API_PASSWORD=password


SENTRY_DSN=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
secrets/*
pgdata/

Expand All @@ -8,3 +9,5 @@ dist/
/debridge_node/ipfs
/debridge_node/test/orbitdb/orbitdb
/debridge_node/test/orbitdb/ipfs
data
/debridge_node/keystore.json
74 changes: 61 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,40 @@ In order to set up the validation node, the following steps should be performed:
- Arbitrum
- [Polygon](https://docs.polygon.technology/docs/validate/technical-requirements/)
2. Update HTTP RPC URL in /config/chains_config.json
3. Change default POSTGRES_PASSWORD, POSTGRES_USER credentials in .env file. During the first run (point 9) Postgres database will be automatically created with these credentials.
deBridge launcher has an embedded API that is implemented to send internal commands to the launcher. The set of methods for this API will be expanded in the future (e.g. query last scanned blocks, rescan blockchain from the specific block). By default deBridge node is deployed on DEBRIDGE_NODE_PORT from .env file. Update JWT_SECRET to randomly generated one
5. Create a keystore file for the validation node. Script from `generate-keystore` folder can be used. To start generating new keystore info:
3. Copy `.default.env` file and rename it to `.env`. Change default POSTGRES_PASSWORD, POSTGRES_USER credentials in .env file. During the first run (point 9) Postgres database will be automatically created with these credentials.
deBridge launcher has an embedded API that is implemented to send internal commands to the launcher. The set of methods for this API will be expanded in the future (e.g. query last scanned blocks, rescan blockchain from the specific block). By default deBridge node is deployed on DEBRIDGE_NODE_PORT from .env file. Update JWT_SECRET to randomly generated one. Change API_LOGIN and API_PASSWORD to authorize in debridge_node public API. If you are using sentry, please update SENTRY_DSN at .env file.

4. Create a keystore file for the validation node. Script from `generate-keystore` folder can be used. To start generating new keystore info:
- npm i
- node index.js

The script will show the newly generated Ethereum address, private key, password for keystore, and keystore info. Copy password to `.env KEYSTORE_PASSWORD`, keystore info to /`secrets/keystore.json`

5. Put the keystore file under `secrets/keystore.json`.
6. Store the password that decrypts the key from `keystore` in the .env file KEYSTORE_PASSWORD.
7. Make your wallet public address to be whitelisted by deBridge governance (contact the deBridge team for that)
8. Contact deBridge team to get DEBRIDGE_API_ACCESS_KEY. Put it in .env
9. Run the command `docker-compose up --build -d`.
10. Backup and do not delete any files from the following directories:
- `./debridge_node/orbitdb`
- `./debridge_node/ipfs`
11. Run `docker-compose logs | grep "started at: /orbitdb/"` command that will show two addresses of orbitdb databases.
Send the output to deBridge team so that your database addresses can be reflected in deBridge explorer and be pinned by other nodes for persistency

11. If there is a need to start multiple instances of the launcher (e.g. one for testnet and one for mainnet) on one server you can:
7. Contact deBridge team to make your wallet address to be whitelisted by deBridge governance
8. Run the command `docker-compose up --build -d`.
9. Backup and do not delete any files from the following directories:
- `./data/orbitdb`
- `./data/ipfs`
10. Run `docker-compose exec ipfs_daemon ipfs bootstrap add "/ip4/${PINNER_HOST}/tcp/4001/p2p/${PINNER_PEER_ID}"` command that will add pinner node address to the ipfs bootstrap list. You can find full list of pinner multiaddresses in the [pinners list](#pinners-list). Please add all pinners to the IPFS bootstrap list.
11. Run `docker-compose exec ipfs_daemon ipfs config profile apply server` command that will apply [server profile](https://docs.ipfs.io/how-to/configure-node/#profiles) which disables local host discovery and recommended when running IPFS on machines with public IPv4 addresses.
12. If there is a need to start multiple instances of the launcher (e.g. one for testnet and one for mainnet) on one server you can:
- checkout or copy repo to the new directory
- change DOCKER_ID variable in .env
- start as described above


# Pinners list
- `/ip4/139.59.164.64/tcp/4001/p2p/12D3KooWA84FLvoJb2QPut134ej9s4hukwmwpZ5DQXbebNBfogdk`
- `/ip4/161.35.31.27/tcp/4001/p2p/12D3KooWAfR9K7y4Y63dbCJ3io58dgTtFM3F2nycFWLo1LJg3Z1k`
- `/ip4/164.90.237.61/tcp/4001/p2p/12D3KooWDZxx4TMUjQzqqQAdZKUWNWAamcoBkMWBKfNnfLMSM6mP`

Please add all pinners to the IPFS bootstrap list. To do it, you can use the command:
```shell
docker-compose exec ipfs_daemon ipfs bootstrap add "$PINNER_ADDRESS"
```

# Miscellaneous

Connect to the database(if you use docker-compose):
Expand All @@ -78,3 +88,41 @@ docker exec -it $(docker-compose ps | grep postgres | awk '{print $1}') psql -v
- database
- deBridge node
3. It's recommended to check `docker-compose logs` for ERROR

# Changelog
## 27.10.2021
- Change javascript instance of IPFS to separate service, which runs [go-IPFS](https://github.com/ipfs/go-ipfs) daemon.
- Move orbitdb mounting directory on the host to the top level at `./data/orbitdb`.
- Added ARBITRUM testnet to [config/chains_config.json](https://github.com/debridge-finance/debridge-launcher/tree/master/config)
- Added Sentry. If you are using sentry, please update SENTRY_DSN at .env file.
- Removed DEBRIDGE_API_ACCESS_KEY. We support validators auth by singing message with private key

### How to migrate
```shell
# stop running containers
docker-compose down -v

# remove old directories with ipfs and orbitdb data
rm -r ./debridge_node/ipfs/ ./debridge_node/orbitdb/

# get the latest changes
git pull

# run containers
docker-compose up --build -d

# update config for IPFS daemon
docker-compose exec ipfs_daemon ipfs config profile apply server

# add all pinners addresses to the IPFS bootstrap list. You can find full pinners list in the `pinners list` section.
docker-compose exec ipfs_daemon ipfs bootstrap add "/ip4/139.59.164.64/tcp/4001/p2p/12D3KooWA84FLvoJb2QPut134ej9s4hukwmwpZ5DQXbebNBfogdk"
docker-compose exec ipfs_daemon ipfs bootstrap add "/ip4/161.35.31.27/tcp/4001/p2p/12D3KooWAfR9K7y4Y63dbCJ3io58dgTtFM3F2nycFWLo1LJg3Z1k"
docker-compose exec ipfs_daemon ipfs bootstrap add "/ip4/164.90.237.61/tcp/4001/p2p/12D3KooWDZxx4TMUjQzqqQAdZKUWNWAamcoBkMWBKfNnfLMSM6mP"


# restart containers
docker-compose restart

# check if any errors occured
docker-compose logs -f | grep -i "error"
```
91 changes: 50 additions & 41 deletions config/chains_config.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
[
{
"chainId": 97,
"name": "BSC",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 13166523,
"provider": "https://data-seed-prebsc-1-s1.binance.org:8545/",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 42,
"name": "KOVAN",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 27667253,
"provider": "https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 256,
"name": "HECO",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 9056329,
"provider": "https://http-testnet.hecochain.com",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 80001,
"name": "MATIC",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 20097196,
"provider": "https://rpc-mumbai.maticvigil.com",
"interval": 10000,
"blockConfirmation": 100,
"maxBlockRange": 5000
}
[{
"chainId": 97,
"name": "BSC",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 13166523,
"provider": "https://data-seed-prebsc-1-s1.binance.org:8545/",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 42,
"name": "KOVAN",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 27667253,
"provider": "https://kovan.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 256,
"name": "HECO",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 9056329,
"provider": "https://http-testnet.hecochain.com",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 5000
},
{
"chainId": 80001,
"name": "MATIC",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 20097196,
"provider": "https://rpc-mumbai.maticvigil.com",
"interval": 10000,
"blockConfirmation": 100,
"maxBlockRange": 1000
},
{
"chainId": 421611,
"name": "ARBITRUM",
"debridgeAddr": "0x68D936Cb4723BdD38C488FD50514803f96789d2D",
"firstStartBlock": 5518867,
"provider": "https://rinkeby.arbitrum.io/rpc",
"interval": 10000,
"blockConfirmation": 12,
"maxBlockRange": 1000
}
]
3 changes: 3 additions & 0 deletions config/ipfs_client_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"IPFSNodeAddress": "http://ipfs_daemon:5001/api/v0"
}
24 changes: 0 additions & 24 deletions config/ipfs_config.json

This file was deleted.

12 changes: 12 additions & 0 deletions debridge_node/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
8 changes: 6 additions & 2 deletions debridge_node/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ KEYSTORE_PASSWORD = BesdWswvLALbnXtqPeUc7qpe9Y7metS5w3CJqz3z
JWT_SECRET=FNJjknsjsnfnsfjskjnf



API_BASE_URL=https://testnetvalidatorsapi.debridge.io

#need to get from debridge team
DEBRIDGE_API_ACCESS_KEY = '8a4b8a1b-82e9-4497-b2d2-68b447aa9c14'
API_LOGIN=login
API_PASSWORD=password


SENTRY_DSN=
4 changes: 0 additions & 4 deletions debridge_node/.prettierrc copy

This file was deleted.

100 changes: 100 additions & 0 deletions debridge_node/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Business Source License 1.1

License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
"Business Source License" is a trademark of MariaDB Corporation Ab.

-----------------------------------------------------------------------------

Parameters

Licensor: Mongoose Orchestra Limited (BVI Co. No: 2067815)

Licensed Work: deBridge V1
The Licensed Work is (c) 2021 Mongoose Orchestra Limited

Additional Use Grant: Any uses listed and defined at
v1-license-grants.dbr.eth

Change Date: The earlier of 31 December 2022 or a date specified at
v1-license-date.dbr.eth

Change License: GNU General Public License v2.0 or later

-----------------------------------------------------------------------------

Terms

The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.

Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.

If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.

All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.

You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.

Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.

This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).

TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.

MariaDB hereby grants you permission to use this License’s text to license
your works, and to refer to it using the trademark "Business Source License",
as long as you comply with the Covenants of Licensor below.

-----------------------------------------------------------------------------

Covenants of Licensor

In consideration of the right to use this License’s text and the "Business
Source License" name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:

1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where "compatible" means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.

2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text "None".

3. To specify a Change Date.

4. Not to modify this License in any other way.

-----------------------------------------------------------------------------

Notice

The Business Source License (this document, or the "License") is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.
Loading

0 comments on commit 4e489db

Please sign in to comment.