Skip to content

Commit

Permalink
Support to upload signatures to arweave
Browse files Browse the repository at this point in the history
  • Loading branch information
artyukh committed Apr 24, 2023
1 parent 150c159 commit d357713
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 26 deletions.
26 changes: 6 additions & 20 deletions .default.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOCKER_ID=_0

# provide senrty dsn *optional
# provide sentry dsn *optional
SENTRY_DSN=

# --------------------
Expand All @@ -17,22 +17,6 @@ POSTGRES_USER=postgres
# TODO: update with your value
POSTGRES_PASSWORD=postgrestestpassword

# --------------------
# orbitdb is disabled now
# --------------------
# IPFS_URL=http://ipfs-daemon${DOCKER_ID}:5001/api/v0
# ORBITDB_PORT=3000
# ORBITDB_NODE_OPTIONS=--max_old_space_size=8192

# # TODO: update with your value
# ORBITDB_JWT_SECRET=jsnfkfjsnkfjnksf
# # TODO: update with your value
# ORBITDB_LOGIN=login
# # TODO: update with your value
# ORBITDB_PASSWORD=password
# # Note: ORBITDB_PORT and DOCKER_ID should be initialized before next line
# ORBITDB_URL=http://orbitdb${DOCKER_ID}:${ORBITDB_PORT}

# --------------------
# debridge node
# --------------------
Expand Down Expand Up @@ -62,9 +46,9 @@ ENABLE_DATAFIX=true
SOLANA_DATA_READER_PORT=3007
# TODO: update with your value
SOLANA_RPC=
# TODO: set to mainnet program address
DEBRIDGE_PK=
SETTINGS_PK=

DEBRIDGE_PK=DEbrdGj3HsRsAzx6uH4MKyREKxVAfBydijLUF3ygsFfh
SETTINGS_PK=DeSetTwWhjZq6Pz9Kfdo1KoS5NqtsM6G8ERbX4SSCSft

SOLANA_DATA_READER_API_BASE_URL=http://debridge-solanadatareader${DOCKER_ID}:${SOLANA_DATA_READER_PORT}
# provide senrty dsn *optional
Expand All @@ -74,3 +58,5 @@ SOLANA_GET_EVENTS_BATCH_SIZE=200
SOLANA_API_REQUEST_TIMEOUT=30000
# SOLANA_API_WAIT_BATCH_INTERVAL default 1000 ms if empty in env
SOLANA_API_WAIT_BATCH_INTERVAL=1000

BUNDLR_NODE=http://node2.bundlr.network
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

More information about the project can be also found in the [documentation portal](https://docs.debridge.finance/)

deBridge node is a software that is run by deBridge validators who were elected by the protocol governance and perform validation of all cross-chain transactions passed through the protocol. All active validators are listening for events emitted by transactions that pass through deBridge smart contract and once an event achieves its finality validator signs the unique id of the event by private key and stores signature to Orbitdb - public IPFS database. In order to have transaction executed in the target chain user or arbitrary keeper needs to collect minimal required signatures of deBridge validators from IPFS and pass them alongside all transaction parameters to the deBridge smart contract in the target chain. The smart contract will validate all signatures and execute message/data passed in the transaction
deBridge node is a software that is run by deBridge validators who were elected by the protocol governance and perform validation of all cross-chain transactions passed through the protocol. All active validators are listening for events emitted by transactions that pass through deBridge smart contract and once an event achieves its finality validator signs the unique id of the event by private key and stores signature to Bundlr. In order to have transaction executed in the target chain user or arbitrary keeper needs to collect minimal required signatures of deBridge validators from IPFS and pass them alongside all transaction parameters to the deBridge smart contract in the target chain. The smart contract will validate all signatures and execute message/data passed in the transaction

In order to set up the validation node, the following steps should be performed:

Expand Down Expand Up @@ -76,6 +76,14 @@ The script will show the newly generated Ethereum address, private key, password
- checkout or copy repo to the new directory
- change DOCKER_ID variable in .env
- start as described above
10. debridge_node allow to save signatures in the arweave. To enable this feature need to generate arweave wallet and fill balance.
Generate [arweave](https://www.arweave.org/) wallet
```
cd generate-arweave-wallet
npm i
npm index.js
```
Copy private key to secrets/bundlr_wallet.json
## Update debridge node to the latest version
```shell
Expand Down
26 changes: 26 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@

# Changelog

## v2.5.7(25.04.2023)
* upload signatures to bundlr
* up packages

## How to update to v2.5.7
### Pull latest changes
```shell
git checkout mainnet
git pull origin mainnet
```

### Generate bundlr wallet
```
cd generate-arweave-wallet
npm i
npm index.js
```
Copy private key to secrets/bundlr_wallet.json

### Add to env
```
BUNDLR_NODE=http://node2.bundlr.network
```

### remove from env

## v2.4.5(12.12.2022)
* add support running without deBridge api (set empty API_BASE_URL on env)
* change Solana sync algorithm (save intermediate progress, wait SOLANA_API_WAIT_BATCH_INTERVAL between batch requests)
Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
networks:
- debridge-node-network
debridge-solanadatareader:
image: debridgefinance/solana-events-reader-api:1.1.4
image: debridgefinance/solana-events-reader-api:1.2.0@sha256:7d7e1e177a2b902456b2892b2f9b65df56100b549875bb3732d67d88d03f4289
restart: unless-stopped
container_name: debridge-solanadatareader${DOCKER_ID}
environment:
Expand All @@ -37,12 +37,14 @@ services:
networks:
- debridge-node-network
debridge-node:
image: debridgefinance/debridge-node:2.4.8
image: debridgefinance/debridge-node:2.5.7@sha256:bf73890a589539b174b72ac3dd711b40bb1ee9fe81654f079465caa907961d60
container_name: debridge-node${DOCKER_ID}
restart: unless-stopped
secrets:
- source: keystore
target: /app/keystore.json
- source: bundlr_wallet
target: /app/bundlr_wallet.json
volumes:
- ./stats/debridge-node:/app/stats
- ./config:/app/dist/config
Expand All @@ -68,10 +70,8 @@ services:
- SOLANA_GET_HISTORICAL_BATCH_SIZE=${SOLANA_GET_HISTORICAL_BATCH_SIZE}
- SOLANA_GET_EVENTS_BATCH_SIZE=${SOLANA_GET_EVENTS_BATCH_SIZE}
- SOLANA_API_REQUEST_TIMEOUT=${SOLANA_API_REQUEST_TIMEOUT}
- ORBITDB_LOGIN=${ORBITDB_LOGIN}
- ORBITDB_PASSWORD=${ORBITDB_PASSWORD}
- ORBITDB_URL=${ORBITDB_URL}
- SOLANA_API_WAIT_BATCH_INTERVAL=${SOLANA_API_WAIT_BATCH_INTERVAL}
- BUNDLR_NODE=${BUNDLR_NODE}
depends_on:
- postgres
networks:
Expand All @@ -82,3 +82,5 @@ networks:
secrets:
keystore:
file: ./secrets/keystore.json
bundlr_wallet:
file: ./secrets/bundlr_wallet.json
3 changes: 3 additions & 0 deletions generate-arweave-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Generate new keystore
npm i
npm index.js
12 changes: 12 additions & 0 deletions generate-arweave-wallet/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Arweave = require('arweave');

const arweave = Arweave.init({});

async function main() {
const privateKey = await arweave.wallets.generate();
const address = await arweave.wallets.jwkToAddress(privateKey)
console.log(`address: `, address);
console.log(`privateKey: `, JSON.stringify(privateKey));
}

main();
96 changes: 96 additions & 0 deletions generate-arweave-wallet/package-lock.json

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

14 changes: 14 additions & 0 deletions generate-arweave-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "generate-arweave-wallet",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index"
},
"author": "",
"license": "ISC",
"dependencies": {
"arweave": "1.13.5"
}
}

0 comments on commit d357713

Please sign in to comment.