docker-compose
This commit is contained in:
parent
28ba4bad50
commit
38e4f74afb
@ -2,5 +2,3 @@ NET_ID=42
|
||||
RPC_URL=https://kovan.infura.io/v3/a3f4d001c1fc4a359ea70dd27fd9cb51
|
||||
PRIVATE_KEY=
|
||||
MIXER_ADDRESS=0x30AF2e92263C5387A8A689322BbfE60b6B0855C4
|
||||
DEFAULT_GAS_PRICE=1
|
||||
GAS_ORACLE_URLS=https://www.etherchain.org/api/gasPriceOracle https://gasprice.poa.network/
|
@ -4,11 +4,14 @@
|
||||
2. `cp .env.example .env`
|
||||
3. Modify `.env` as needed
|
||||
|
||||
## Run
|
||||
## Run localy
|
||||
1. `npm run start`
|
||||
2. `curl -X POST -H 'content-type:application/json' --data '<PROOF>' http://127.0.0.1:8000/relay`
|
||||
Relayer should return a transaction hash.
|
||||
|
||||
## Run in Docker
|
||||
1. `docker-compose up -d`
|
||||
|
||||
## Proof example
|
||||
```json
|
||||
{
|
||||
|
@ -5,6 +5,6 @@ module.exports = {
|
||||
rpcUrl: process.env.RPC_URL || 'https://kovan.infura.io/v3/a3f4d001c1fc4a359ea70dd27fd9cb51',
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
mixerAddress: process.env.MIXER_ADDRESS || '0x30AF2e92263C5387A8A689322BbfE60b6B0855C4',
|
||||
defaultGasPrice: process.env.DEFAULT_GAS_PRICE || 1,
|
||||
gasOracleUrls: process.env.GAS_ORACLE_URLS ? process.env.GAS_ORACLE_URLS.split(' ') : ['https://www.etherchain.org/api/gasPriceOracle', 'https://gasprice.poa.network/']
|
||||
defaultGasPrice: 1,
|
||||
gasOracleUrls: ['https://www.etherchain.org/api/gasPriceOracle', 'https://gasprice.poa.network/']
|
||||
}
|
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
relayer:
|
||||
image: relayer
|
||||
build: ./
|
||||
restart: always
|
||||
ports:
|
||||
- 8000:8000
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
env_file: ./.env
|
6
index.js
6
index.js
@ -1,13 +1,13 @@
|
||||
const { fetchGasPrice, isValidProof } = require('./utils')
|
||||
const { numberToHex, toWei, toHex } = require('web3-utils')
|
||||
|
||||
const Web3 = require('web3')
|
||||
const express = require('express')
|
||||
|
||||
const app = express()
|
||||
app.use(express.json())
|
||||
|
||||
const { netId, rpcUrl, privateKey, mixerAddress, defaultGasPrice } = require('./config')
|
||||
const { fetchGasPrice, isValidProof } = require('./utils')
|
||||
|
||||
const Web3 = require('web3')
|
||||
const web3 = new Web3(rpcUrl, null, { transactionConfirmationBlocks: 1 })
|
||||
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey)
|
||||
web3.eth.accounts.wallet.add('0x' + privateKey)
|
||||
|
Loading…
Reference in New Issue
Block a user