From 1ada6985662f2e4914171aedd48f4a4086aea661 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 14:39:45 +0100 Subject: [PATCH 01/16] Update hostname to split by network --- Connector/eth/config.py | 5 ++++- docker-compose/mainnet/eth.yml | 4 ++-- docker-compose/regtest/eth.yml | 2 +- docker-compose/testnet/eth.yml | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Connector/eth/config.py b/Connector/eth/config.py index f854368e..02640ac5 100644 --- a/Connector/eth/config.py +++ b/Connector/eth/config.py @@ -14,6 +14,9 @@ def __init__(self, coin, networkName): self._rpcPort = "" self._wsPort = "" + def __attachNetworkToHost(self, host): + return f"{host}-{self.networkName}" + def loadConfig(self, config): defaultConfig, err = utils.loadDefaultPackageConf(self.coin) @@ -21,7 +24,7 @@ def loadConfig(self, config): return False, err self.protocol = config["protocol"] if "protocol" in config else defaultConfig["protocol"] - self.host = config["host"] if "host" in config else defaultConfig["host"] + self.host = config["host"] if "host" in config else self.__attachNetworkToHost(defaultConfig["host"]) if "rpcPort" in config: if config["rpcPort"].isdigit(): diff --git a/docker-compose/mainnet/eth.yml b/docker-compose/mainnet/eth.yml index d738979a..d3ac1d65 100644 --- a/docker-compose/mainnet/eth.yml +++ b/docker-compose/mainnet/eth.yml @@ -1,8 +1,8 @@ version: "3" services: - ethereumgo: + ethereumgo-mainnet: image: ethereum/client-go:latest - command: --http --http.addr=ethereumgo --cache=1024 --http.port=8545 --syncmode=full --gcmode=archive --ws --ws.addr=ethereumgo --ws.port=8546 --ws.origins=connector --http.vhosts=ethereumgo + command: --http --http.addr=ethereumgo-mainnet --cache=1024 --http.port=8545 --syncmode=full --gcmode=archive --ws --ws.addr=ethereumgo-mainnet --ws.port=8546 --ws.origins=connector --http.vhosts=ethereumgo-mainnet volumes: - ${BLOCKCHAIN_PATH}/ethereumgo:/root/.ethereum diff --git a/docker-compose/regtest/eth.yml b/docker-compose/regtest/eth.yml index a0aa32d0..5bdc5f3a 100644 --- a/docker-compose/regtest/eth.yml +++ b/docker-compose/regtest/eth.yml @@ -1,6 +1,6 @@ version: "3" services: - ethereumgo: + ethereumgo-regtest: image: trufflesuite/ganache-cli command: -p=8545 -h=0.0.0.0 -m="piece effort bind that embrace enrich remind powder sudden patient legend group" volumes: diff --git a/docker-compose/testnet/eth.yml b/docker-compose/testnet/eth.yml index 0c3045b8..81642681 100644 --- a/docker-compose/testnet/eth.yml +++ b/docker-compose/testnet/eth.yml @@ -1,8 +1,8 @@ version: "3" services: - ethereumgo: + ethereumgo-testnet: image: ethereum/client-go:latest - command: --http --http.addr=ethereumgo --ropsten --cache=1024 --http.port=8545 --syncmode=full --gcmode=archive --ws --ws.addr=ethereumgo --ws.port=8546 --ws.origins=connector --http.vhosts=ethereumgo + command: --http --http.addr=ethereumgo-testnet --ropsten --cache=1024 --http.port=8545 --syncmode=full --gcmode=archive --ws --ws.addr=ethereumgo-testnet --ws.port=8546 --ws.origins=connector --http.vhosts=ethereumgo-testnet volumes: - ${BLOCKCHAIN_PATH}/ethereumgo:/root/.ethereum From 18a74156634e68cb1184af55d097ed8ab96c5c4d Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 14:40:17 +0100 Subject: [PATCH 02/16] Fix uncle type in schemas --- .../rpcschemas/getblockbyhash_response.json | 49 +------------------ .../rpcschemas/getblockbynumber_response.json | 49 +------------------ 2 files changed, 2 insertions(+), 96 deletions(-) diff --git a/Connector/eth/rpcschemas/getblockbyhash_response.json b/Connector/eth/rpcschemas/getblockbyhash_response.json index fa3c6324..d95c4fc7 100644 --- a/Connector/eth/rpcschemas/getblockbyhash_response.json +++ b/Connector/eth/rpcschemas/getblockbyhash_response.json @@ -114,54 +114,7 @@ "uncles": { "type": "array", "items": { - "type": "object", - "properties": { - "blockHash": { - "type": "string" - }, - "blockNumber": { - "type": "string" - }, - "from": { - "type": "string" - }, - "gas": { - "type": "string" - }, - "gasPrice": { - "type": "string" - }, - "hash": { - "type": "string" - }, - "input": { - "type": "string" - }, - "nonce": { - "type": "string" - }, - "r": { - "type": "string" - }, - "s": { - "type": "string" - }, - "to": { - "type": [ - "string", - "null" - ] - }, - "transactionIndex": { - "type": "string" - }, - "v": { - "type": "string" - }, - "value": { - "type": "string" - } - } + "type": "string" } } } diff --git a/Connector/eth/rpcschemas/getblockbynumber_response.json b/Connector/eth/rpcschemas/getblockbynumber_response.json index fa3c6324..d95c4fc7 100644 --- a/Connector/eth/rpcschemas/getblockbynumber_response.json +++ b/Connector/eth/rpcschemas/getblockbynumber_response.json @@ -114,54 +114,7 @@ "uncles": { "type": "array", "items": { - "type": "object", - "properties": { - "blockHash": { - "type": "string" - }, - "blockNumber": { - "type": "string" - }, - "from": { - "type": "string" - }, - "gas": { - "type": "string" - }, - "gasPrice": { - "type": "string" - }, - "hash": { - "type": "string" - }, - "input": { - "type": "string" - }, - "nonce": { - "type": "string" - }, - "r": { - "type": "string" - }, - "s": { - "type": "string" - }, - "to": { - "type": [ - "string", - "null" - ] - }, - "transactionIndex": { - "type": "string" - }, - "v": { - "type": "string" - }, - "value": { - "type": "string" - } - } + "type": "string" } } } From 59e1580807e633999fc632c3f6ff019f39c267ad Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:00:32 +0100 Subject: [PATCH 03/16] Update luna host by network --- Connector/luna/config.py | 5 ++++- docker-compose/mainnet/luna.yml | 2 +- docker-compose/testnet/luna.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Connector/luna/config.py b/Connector/luna/config.py index 646c3aeb..b3ff6a52 100644 --- a/Connector/luna/config.py +++ b/Connector/luna/config.py @@ -13,6 +13,9 @@ def __init__(self, coin, networkName): self._terradHost = "" self._terradPort = "" + def __attachNetworkToHost(self, host): + return f"{host}-{self.networkName}" + def loadConfig(self, config): defaultConfig, err = utils.loadDefaultPackageConf(self.coin) @@ -22,7 +25,7 @@ def loadConfig(self, config): self.terradProtocol = config["terradProtocol"] if "terradProtocol" in config \ else defaultConfig["terradProtocol"] self.terradHost = config["terradHost"] if "terradHost" in config \ - else defaultConfig["terradHost"] + else self.__attachNetworkToHost(defaultConfig["terradHost"]) if "terradPort" in config: if config["terradPort"].isdigit(): diff --git a/docker-compose/mainnet/luna.yml b/docker-compose/mainnet/luna.yml index d72ab941..1faab9c9 100644 --- a/docker-compose/mainnet/luna.yml +++ b/docker-compose/mainnet/luna.yml @@ -1,6 +1,6 @@ version: "3" services: - terrad: + terrad-mainnet: build: ../../packages/nodechain-terrad image: terrad environment: diff --git a/docker-compose/testnet/luna.yml b/docker-compose/testnet/luna.yml index fa6ea041..26e8ea08 100644 --- a/docker-compose/testnet/luna.yml +++ b/docker-compose/testnet/luna.yml @@ -1,6 +1,6 @@ version: "3" services: - terrad: + terrad-testnet: build: ../../packages/nodechain-terrad image: terrad environment: From d6eefccd9f1f1d73df71516455e454e2eca8b819 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:15:10 +0100 Subject: [PATCH 04/16] Change bitcoincore to bitcoinabc in bch --- Connector/bch/apirpc.py | 20 +++--- Connector/bch/config.py | 107 +++++++++++++++++---------------- Connector/bch/defaultConf.json | 10 +-- Connector/btc/config.py | 5 +- docker-compose/mainnet/bch.yml | 6 +- docker-compose/testnet/bch.yml | 6 +- 6 files changed, 80 insertions(+), 74 deletions(-) diff --git a/Connector/bch/apirpc.py b/Connector/bch/apirpc.py index 05bea5a9..05884f58 100644 --- a/Connector/bch/apirpc.py +++ b/Connector/bch/apirpc.py @@ -259,7 +259,7 @@ def getBlockByHash(id, params, config): raise error.RpcBadRequestError(err.message) block = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_BLOCK_METHOD, params=[ @@ -288,7 +288,7 @@ def getBlockByNumber(id, params, config): raise error.RpcBadRequestError(err.message) blockHash = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_BLOCK_HASH_METHOD, params=[params["blockNumber"]]) @@ -316,7 +316,7 @@ def getFeePerByte(id, params, config): ) feePerByte = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=ESTIMATE_SMART_FEE_METHOD, params=[params["confirmations"]]) @@ -355,14 +355,14 @@ def getHeight(id, params, config): latestBlockHeight = int( RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_BLOCK_COUNT_METHOD, params=[] ) ) latestBlockHash = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_BLOCK_HASH_METHOD, params=[latestBlockHeight] @@ -402,7 +402,7 @@ def getTransactionHex(id, params, config): ) rawTransaction = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_TRANSACTION_METHOD, params=[params["txHash"]] @@ -438,7 +438,7 @@ def getTransaction(id, params, config): try: # Parameters: TransactionId, include_watchonly, verbose transaction = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_TRANSACTION_METHOD, params=[ @@ -455,7 +455,7 @@ def getTransaction(id, params, config): for vin in transaction["decoded"]["vin"]: inputTransaction = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_TRANSACTION_METHOD, params=[ @@ -594,7 +594,7 @@ def broadcastTransaction(id, params, config): ) hash = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=SEND_RAW_TRANSACTION_METHOD, params=[params["rawTransaction"]]) @@ -662,7 +662,7 @@ def syncing(id, params, config): raise error.RpcBadRequestError(err.message) blockchainInfo = RPCConnector.request( - endpoint=config.bitcoincoreRpcEndpoint, + endpoint=config.bitcoinabcRpcEndpoint, id=id, method=GET_BLOCKCHAIN_INFO, params=None diff --git a/Connector/bch/config.py b/Connector/bch/config.py index 6f0c0843..b8c66001 100644 --- a/Connector/bch/config.py +++ b/Connector/bch/config.py @@ -9,40 +9,43 @@ def __init__(self, coin, networkName): self._networkName = networkName self._coin = coin - self._bitcoincoreProtocol = "" - self._bitcoincoreHost = "" - self._bitcoincorePort = "" - self._bitcoincoreUser = "" - self._bitcoincorePassword = "" + self._bitcoinabcProtocol = "" + self._bitcoinabcHost = "" + self._bitcoinabcPort = "" + self._bitcoinabcUser = "" + self._bitcoinabcPassword = "" self._electrumCashProtocol = "" self._electrumCashHost = "" self._electrumCashPort = "" self._electrumCashUser = "" self._electrumCashPassword = "" + def __attachNetworkToHost(self, host): + return f"{host}-{self.networkName}" + def loadConfig(self, config): defaultConfig, err = utils.loadDefaultPackageConf(self.coin) if err is not None: return False, err - self.bitcoincoreProtocol = config["bitcoincoreProtocol"] if "bitcoincoreProtocol" in config \ - else defaultConfig["bitcoincoreProtocol"] - self.bitcoincoreHost = config["bitcoincoreHost"] if "bitcoincoreHost" in config \ - else defaultConfig["bitcoincoreHost"] + self.bitcoinabcProtocol = config["bitcoinabcProtocol"] if "bitcoinabcProtocol" in config \ + else defaultConfig["bitcoinabcProtocol"] + self.bitcoinabcHost = config["bitcoinabcHost"] if "bitcoinabcHost" in config \ + else self.__attachNetworkToHost(defaultConfig["bitcoinabcHost"]) - if "bitcoincorePort" in config: - if config["bitcoincorePort"].isdigit(): - self.bitcoincorePort = config["bitcoincorePort"] + if "bitcoinabcPort" in config: + if config["bitcoinabcPort"].isdigit(): + self.bitcoinabcPort = config["bitcoinabcPort"] else: - return False, f"Value {config['bitcoincorePort']} for bitcoincorePort is not digit" + return False, f"Value {config['bitcoinabcPort']} for bitcoinabcPort is not digit" else: - self.bitcoincorePort = defaultConfig["bitcoincorePort"] + self.bitcoinabcPort = defaultConfig["bitcoinabcPort"] - self.bitcoincoreUser = config["bitcoincoreUser"] if "bitcoincoreUser" in config \ - else defaultConfig["bitcoincoreUser"] - self.bitcoincorePassword = config["bitcoincorePassword"] if "bitcoincorePassword" in config \ - else defaultConfig["bitcoincorePassword"] + self.bitcoinabcUser = config["bitcoinabcUser"] if "bitcoinabcUser" in config \ + else defaultConfig["bitcoinabcUser"] + self.bitcoinabcPassword = config["bitcoinabcPassword"] if "bitcoinabcPassword" in config \ + else defaultConfig["bitcoinabcPassword"] self.electrumCashProtocol = config["electrumCashProtocol"] if "electrumCashProtocol" in config \ else defaultConfig["electrumCashProtocol"] self.electrumCashHost = config["electrumCashHost"] if "electrumCashHost" in config \ @@ -76,44 +79,44 @@ def networkName(self, value): self._networkName = value @property - def bitcoincoreProtocol(self): - return self._bitcoincoreProtocol + def bitcoinabcProtocol(self): + return self._bitcoinabcProtocol - @bitcoincoreProtocol.setter - def bitcoincoreProtocol(self, value): - self._bitcoincoreProtocol = value + @bitcoinabcProtocol.setter + def bitcoinabcProtocol(self, value): + self._bitcoinabcProtocol = value @property - def bitcoincoreHost(self): - return self._bitcoincoreHost + def bitcoinabcHost(self): + return self._bitcoinabcHost - @bitcoincoreHost.setter - def bitcoincoreHost(self, value): - self._bitcoincoreHost = value + @bitcoinabcHost.setter + def bitcoinabcHost(self, value): + self._bitcoinabcHost = value @property - def bitcoincorePort(self): - return self._bitcoincorePort + def bitcoinabcPort(self): + return self._bitcoinabcPort - @bitcoincorePort.setter - def bitcoincorePort(self, value): - self._bitcoincorePort = value + @bitcoinabcPort.setter + def bitcoinabcPort(self, value): + self._bitcoinabcPort = value @property - def bitcoincoreUser(self): - return self._bitcoincoreUser + def bitcoinabcUser(self): + return self._bitcoinabcUser - @bitcoincoreUser.setter - def bitcoincoreUser(self, value): - self._bitcoincoreUser = value + @bitcoinabcUser.setter + def bitcoinabcUser(self, value): + self._bitcoinabcUser = value @property - def bitcoincorePassword(self): - return self._bitcoincorePassword + def bitcoinabcPassword(self): + return self._bitcoinabcPassword - @bitcoincorePassword.setter - def bitcoincorePassword(self, value): - self._bitcoincorePassword = value + @bitcoinabcPassword.setter + def bitcoinabcPassword(self, value): + self._bitcoinabcPassword = value @property def electrumCashProtocol(self): @@ -156,10 +159,10 @@ def electrumCashPassword(self, value): self._electrumCashPassword = value @property - def bitcoincoreRpcEndpoint(self): - return f"{self.bitcoincoreProtocol}://" \ - f"{self.bitcoincoreUser}:{self.bitcoincorePassword}@" \ - f"{self.bitcoincoreHost}:{self.bitcoincorePort}" + def bitcoinabcRpcEndpoint(self): + return f"{self.bitcoinabcProtocol}://" \ + f"{self.bitcoinabcUser}:{self.bitcoinabcPassword}@" \ + f"{self.bitcoinabcHost}:{self.bitcoinabcPort}" @property def electrumCashRpcEndpoint(self): @@ -174,11 +177,11 @@ def jsonEncode(self): class ConfigEncoder(JSONEncoder): def encode(self, o): return { - "bitcoincoreProtocol": o.bitcoincoreProtocol, - "bitcoincoreHost": o.bitcoincoreHost, - "bitcoincorePort": o.bitcoincorePort, - "bitcoincoreUser": o.bitcoincoreUser, - "bitcoincorePassword": o.bitcoincorePassword, + "bitcoinabcProtocol": o.bitcoinabcProtocol, + "bitcoinabcHost": o.bitcoinabcHost, + "bitcoinabcPort": o.bitcoinabcPort, + "bitcoinabcUser": o.bitcoinabcUser, + "bitcoinabcPassword": o.bitcoinabcPassword, "electrumCashProtocol": o.electrumCashProtocol, "electrumCashHost": o.electrumCashHost, "electrumCashPort": o.electrumCashPort, diff --git a/Connector/bch/defaultConf.json b/Connector/bch/defaultConf.json index db4e7fe9..41481ce7 100644 --- a/Connector/bch/defaultConf.json +++ b/Connector/bch/defaultConf.json @@ -1,9 +1,9 @@ { - "bitcoincoreProtocol": "http", - "bitcoincoreHost": "bitcoincore", - "bitcoincorePort": "8332", - "bitcoincoreUser": "swapper", - "bitcoincorePassword": "swapper", + "bitcoinabcProtocol": "http", + "bitcoinabcHost": "bitcoinabc", + "bitcoinabcPort": "8332", + "bitcoinabcUser": "swapper", + "bitcoinabcPassword": "swapper", "electrumCashProtocol": "http", "electrumCashHost": "electrum", "electrumCashPort": "30000", diff --git a/Connector/btc/config.py b/Connector/btc/config.py index ec94ad44..a6ba3fc2 100644 --- a/Connector/btc/config.py +++ b/Connector/btc/config.py @@ -27,6 +27,9 @@ def __init__(self, coin, networkName): self._electrumxHost = "" self._electrumxPort = "" + def __attachNetworkToHost(self, host): + return f"{host}-{self.networkName}" + def loadConfig(self, config): defaultConfig, err = utils.loadDefaultPackageConf(self.coin) @@ -36,7 +39,7 @@ def loadConfig(self, config): self.bitcoincoreProtocol = config["bitcoincoreProtocol"] if "bitcoincoreProtocol" in config \ else defaultConfig["bitcoincoreProtocol"] self.bitcoincoreHost = config["bitcoincoreHost"] if "bitcoincoreHost" in config \ - else defaultConfig["bitcoincoreHost"] + else self.__attachNetworkToHost(defaultConfig["bitcoincoreHost"]) if "bitcoincorePort" in config: if config["bitcoincorePort"].isdigit(): diff --git a/docker-compose/mainnet/bch.yml b/docker-compose/mainnet/bch.yml index d0fbe6a2..4e36217b 100644 --- a/docker-compose/mainnet/bch.yml +++ b/docker-compose/mainnet/bch.yml @@ -1,15 +1,15 @@ version: "3" services: - bitcoincore: + bitcoinabc-mainnet: image: uphold/bitcoin-abc:latest - command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoincore -txindex=1 -rpcport=8332 + command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoinabc-mainnet -txindex=1 -rpcport=8332 volumes: - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin electrumx: image: lukechilds/electrumx environment: - DAEMON_URL: http://swapper:swapper@bitcoincore:8332 + DAEMON_URL: http://swapper:swapper@bitcoinabc-mainnet:8332 COIN: BitcoinCashABC PEER_DISCOVERY: "off" SERVICES: tcp://:50001 diff --git a/docker-compose/testnet/bch.yml b/docker-compose/testnet/bch.yml index db35f42f..87e7b16b 100644 --- a/docker-compose/testnet/bch.yml +++ b/docker-compose/testnet/bch.yml @@ -1,15 +1,15 @@ version: "3" services: - bitcoincore: + bitcoinabc-testnet: image: uphold/bitcoin-abc:latest - command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoincore -txindex=1 -testnet -rpcport=8332 + command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoinabc-testnet -txindex=1 -testnet -rpcport=8332 volumes: - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin electrumx: image: lukechilds/electrumx environment: - DAEMON_URL: http://swapper:swapper@bitcoincore:8332 + DAEMON_URL: http://swapper:swapper@bitcoinabc-testnet:8332 COIN: BitcoinCashABC PEER_DISCOVERY: "off" SERVICES: tcp://:50001 From df04a0341a5d8da5eae9e6ef58c9aed45db0b49a Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:16:34 +0100 Subject: [PATCH 05/16] Fix typo --- docker-compose/mainnet/bch.yml | 2 +- docker-compose/testnet/bch.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose/mainnet/bch.yml b/docker-compose/mainnet/bch.yml index 4e36217b..cb758776 100644 --- a/docker-compose/mainnet/bch.yml +++ b/docker-compose/mainnet/bch.yml @@ -4,7 +4,7 @@ services: image: uphold/bitcoin-abc:latest command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoinabc-mainnet -txindex=1 -rpcport=8332 volumes: - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoinabc:/home/bitcoin/.bitcoin electrumx: image: lukechilds/electrumx diff --git a/docker-compose/testnet/bch.yml b/docker-compose/testnet/bch.yml index 87e7b16b..c1ee4ba3 100644 --- a/docker-compose/testnet/bch.yml +++ b/docker-compose/testnet/bch.yml @@ -4,7 +4,7 @@ services: image: uphold/bitcoin-abc:latest command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 -rpcbind=bitcoinabc-testnet -txindex=1 -testnet -rpcport=8332 volumes: - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoinabc:/home/bitcoin/.bitcoin electrumx: image: lukechilds/electrumx From 98f9a55dbb1fcaa601ffe1a0efa4683f30ba7f4b Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:24:03 +0100 Subject: [PATCH 06/16] Fix overwritten environment variable --- docker-compose/mainnet/luna.yml | 2 +- docker-compose/testnet/luna.yml | 2 +- packages/nodechain-terrad/entrypoint.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose/mainnet/luna.yml b/docker-compose/mainnet/luna.yml index 1faab9c9..02650c43 100644 --- a/docker-compose/mainnet/luna.yml +++ b/docker-compose/mainnet/luna.yml @@ -5,7 +5,7 @@ services: image: terrad environment: MAINNET: 1 - NETWORK: columbus-5 + NET: columbus-5 volumes: - ${BLOCKCHAIN_PATH}/terrad:/root/.terra diff --git a/docker-compose/testnet/luna.yml b/docker-compose/testnet/luna.yml index 26e8ea08..c75c1eee 100644 --- a/docker-compose/testnet/luna.yml +++ b/docker-compose/testnet/luna.yml @@ -5,7 +5,7 @@ services: image: terrad environment: TESTNET: 1 - NETWORK: bombay-12 + NET: bombay-12 volumes: - ${BLOCKCHAIN_PATH}/terrad:/root/.terra diff --git a/packages/nodechain-terrad/entrypoint.sh b/packages/nodechain-terrad/entrypoint.sh index 37782ccd..0a23369b 100644 --- a/packages/nodechain-terrad/entrypoint.sh +++ b/packages/nodechain-terrad/entrypoint.sh @@ -1,18 +1,18 @@ #!/bin/bash terrad version --long | grep "version" -terrad init "terra-nodechain" --chain-id ${NETWORK} +terrad init "terra-nodechain" --chain-id ${NET} if [[ -n "${TESTNET}" ]]; then - wget https://raw.githubusercontent.com/terra-money/testnet/master/${NETWORK}/genesis.json && cp genesis.json ~/.terra/config/genesis.json - wget https://raw.githubusercontent.com/terra-money/testnet/master/${NETWORK}/addrbook.json -O ~/.terra/config/addrbook.json + wget https://raw.githubusercontent.com/terra-money/testnet/master/${NET}/genesis.json && cp genesis.json ~/.terra/config/genesis.json + wget https://raw.githubusercontent.com/terra-money/testnet/master/${NET}/addrbook.json -O ~/.terra/config/addrbook.json sed -i 's/minimum-gas-prices = "0uluna"/minimum-gas-prices = "0.01133uluna,0.15uusd,0.104938usdr,169.77ukrw,428.571umnt,0.125ueur,0.98ucny,16.37ujpy,0.11ugbp,10.88uinr,0.19ucad,0.14uchf,0.19uaud,0.2usgd,4.62uthb,1.25usek,1.25unok,0.9udkk,2180.0uidr,7.6uphp,1.17uhkd"/g' ~/.terra/config/app.toml sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/g' ~/.terra/config/config.toml sed -i '1,/enable = false/{s/enable = false/enable = true/g}' ~/.terra/config/app.toml fi if [[ -n "${MAINNET}" ]]; then - wget https://columbus-genesis.s3.ap-northeast-1.amazonaws.com/${NETWORK}-genesis.json && cp ${NETWORK}-genesis.json ~/.terra/config/genesis.json + wget https://columbus-genesis.s3.ap-northeast-1.amazonaws.com/${NET}-genesis.json && cp ${NET}-genesis.json ~/.terra/config/genesis.json wget https://network.terra.dev/addrbook.json -O ~/.terra/config/addrbook.json sed -i 's/minimum-gas-prices = "0uluna"/minimum-gas-prices = "0.01133uluna,0.15uusd,0.104938usdr,169.77ukrw,428.571umnt,0.125ueur,0.98ucny,16.37ujpy,0.11ugbp,10.88uinr,0.19ucad,0.14uchf,0.19uaud,0.2usgd,4.62uthb,1.25usek,1.25unok,0.9udkk,2180.0uidr,7.6uphp,1.17uhkd"/g' ~/.terra/config/app.toml sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/g' ~/.terra/config/config.toml From b367b7a7dae3a80632faf2d04d7b477b0d61b325 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:25:04 +0100 Subject: [PATCH 07/16] Change bch docker host --- docker-compose/mainnet/bch.yml | 6 ++++-- docker-compose/testnet/bch.yml | 5 +++-- packages/nodechain-electron-cash/entrypoint.sh | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docker-compose/mainnet/bch.yml b/docker-compose/mainnet/bch.yml index cb758776..5315a1b2 100644 --- a/docker-compose/mainnet/bch.yml +++ b/docker-compose/mainnet/bch.yml @@ -6,7 +6,7 @@ services: volumes: - ${BLOCKCHAIN_PATH}/bitcoinabc:/home/bitcoin/.bitcoin - electrumx: + electrumx-mainnet: image: lukechilds/electrumx environment: DAEMON_URL: http://swapper:swapper@bitcoinabc-mainnet:8332 @@ -18,9 +18,11 @@ services: volumes: - ${BLOCKCHAIN_PATH}/electrumx:/data - electrum: + electrum-mainnet: build: ../../packages/nodechain-electron-cash image: electrum + environment: + NETWORK: ${NETWORK} networks: default: diff --git a/docker-compose/testnet/bch.yml b/docker-compose/testnet/bch.yml index c1ee4ba3..b888ee9f 100644 --- a/docker-compose/testnet/bch.yml +++ b/docker-compose/testnet/bch.yml @@ -6,7 +6,7 @@ services: volumes: - ${BLOCKCHAIN_PATH}/bitcoinabc:/home/bitcoin/.bitcoin - electrumx: + electrumx-mainnet: image: lukechilds/electrumx environment: DAEMON_URL: http://swapper:swapper@bitcoinabc-testnet:8332 @@ -19,10 +19,11 @@ services: volumes: - ${BLOCKCHAIN_PATH}/electrumx:/data - electrum: + electrum-mainnet: build: ../../packages/nodechain-electron-cash image: electrum environment: + NETWORK: ${NETWORK} TESTNET: 1 networks: diff --git a/packages/nodechain-electron-cash/entrypoint.sh b/packages/nodechain-electron-cash/entrypoint.sh index 5027c7d3..9b2076f5 100644 --- a/packages/nodechain-electron-cash/entrypoint.sh +++ b/packages/nodechain-electron-cash/entrypoint.sh @@ -4,11 +4,11 @@ if [[ -n "${TESTNET}" ]]; then electron_args="--testnet" fi -Electron-Cash/electron-cash setconfig rpchost "electrum" $electron_args +Electron-Cash/electron-cash setconfig rpchost "electrum-${NETWORK}" $electron_args Electron-Cash/electron-cash setconfig rpcuser "swapper" $electron_args Electron-Cash/electron-cash setconfig rpcpassword "swapper" $electron_args Electron-Cash/electron-cash setconfig rpcport "30000" $electron_args Electron-Cash/electron-cash setconfig oneserver "true" $electron_args -Electron-Cash/electron-cash setconfig server "electrumx:50001:t" $electron_args +Electron-Cash/electron-cash setconfig server "electrumx-${NETWORK}:50001:t" $electron_args Electron-Cash/electron-cash daemon $electron_args \ No newline at end of file From ad50c60c2765a4460a4b8cf172f4cf226ac2f6e5 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:26:31 +0100 Subject: [PATCH 08/16] Update electrum host in connector --- Connector/bch/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Connector/bch/config.py b/Connector/bch/config.py index b8c66001..b4943c39 100644 --- a/Connector/bch/config.py +++ b/Connector/bch/config.py @@ -49,7 +49,7 @@ def loadConfig(self, config): self.electrumCashProtocol = config["electrumCashProtocol"] if "electrumCashProtocol" in config \ else defaultConfig["electrumCashProtocol"] self.electrumCashHost = config["electrumCashHost"] if "electrumCashHost" in config \ - else defaultConfig["electrumCashHost"] + else self.__attachNetworkToHost(defaultConfig["electrumCashHost"]) if "electrumCashPort" in config: if config["electrumCashPort"].isdigit(): From 1d48644abe21aa62f73b5a7e3efcf36a9f826a62 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:45:54 +0100 Subject: [PATCH 09/16] Add logger with payload req --- scripts/endpoints.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/endpoints.py b/scripts/endpoints.py index 42a62cb8..16aa62a9 100644 --- a/scripts/endpoints.py +++ b/scripts/endpoints.py @@ -44,6 +44,8 @@ def addApi(args, token, network, port, defaultConfig=True): headers = { 'Content-Type': 'application/json' } + if args.verbose: + logger.printInfo(f"Request payload: {payload}", verbosity=args.verbose) try: req = requests.post( url=f"http://localhost:{port}/admin/{ADD_CURRENCY}", From 5fa723d841e011a7bd2ef22345bee5d69639527d Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 19:48:51 +0100 Subject: [PATCH 10/16] Add logger with payload req --- .flake8 | 2 +- scripts/endpoints.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 9f9ddaea..0e49ae40 100644 --- a/.flake8 +++ b/.flake8 @@ -27,4 +27,4 @@ exclude = Connector/tests/docker-compose, # This contains nginx configuration files nginx, -max-complexity = 10 +max-complexity = 11 diff --git a/scripts/endpoints.py b/scripts/endpoints.py index 16aa62a9..ff7a9b02 100644 --- a/scripts/endpoints.py +++ b/scripts/endpoints.py @@ -69,6 +69,8 @@ def getApi(args, token, network, port): headers = { 'Content-Type': 'application/json' } + if args.verbose: + logger.printInfo(f"Request payload: {payload}", verbosity=args.verbose) try: req = requests.post( url=f"http://localhost:{port}/admin/{GET_CURRENCY}", @@ -107,6 +109,8 @@ def removeApi(args, token, network, port): headers = { 'Content-Type': 'application/json' } + if args.verbose: + logger.printInfo(f"Request payload: {payload}", verbosity=args.verbose) try: req = requests.post( url=f"http://localhost:{port}/admin/{REMOVE_CURRENCY}", @@ -152,10 +156,11 @@ def updateApi(args, token, network, port): "network": network, "config": config } - headers = { 'Content-Type': 'application/json' } + if args.verbose: + logger.printInfo(f"Request payload: {payload}", verbosity=args.verbose) try: req = requests.post( url=f"http://localhost:{port}/admin/{UPDATE_CURRENCY}", From 95b827bea4a8b3a5483d792481811524099099cb Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 20:32:59 +0100 Subject: [PATCH 11/16] Remove unused method from handler --- Connector/bch/handler.py | 4 ---- Connector/luna/handler.py | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Connector/bch/handler.py b/Connector/bch/handler.py index a894dc77..2b5be097 100644 --- a/Connector/bch/handler.py +++ b/Connector/bch/handler.py @@ -21,10 +21,6 @@ def addConfig(self, network, config): logger.printError(f"Configuration {network} already added for {self.coin}") return False, f"Configuration {network} already added for {self.coin}" - defaultConf, err = utils.loadDefaultPackageConf(self.coin) - if err is not None: - return False, err - pkgConfig = Config( coin=self.coin, networkName=network diff --git a/Connector/luna/handler.py b/Connector/luna/handler.py index a894dc77..2b5be097 100644 --- a/Connector/luna/handler.py +++ b/Connector/luna/handler.py @@ -21,10 +21,6 @@ def addConfig(self, network, config): logger.printError(f"Configuration {network} already added for {self.coin}") return False, f"Configuration {network} already added for {self.coin}" - defaultConf, err = utils.loadDefaultPackageConf(self.coin) - if err is not None: - return False, err - pkgConfig = Config( coin=self.coin, networkName=network From 9423908df4cb01e0f82fd1e2e976da62c09b98ac Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 20:34:02 +0100 Subject: [PATCH 12/16] Remove hardcode currencies --- Connector/server.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Connector/server.py b/Connector/server.py index 12dcf772..a8e7cd99 100644 --- a/Connector/server.py +++ b/Connector/server.py @@ -9,7 +9,7 @@ from rpcutils import middleware as rpcMiddleware from wsutils import broker from logger import logger -# from utils import utils +from utils import utils async def onPrepare(request, response): @@ -42,9 +42,7 @@ def runServer(): logger.printInfo("Registering app modules") - # availableCurrencies = utils.getAvailableCurrencies() - - availableCurrencies = ["eth", "btc", "xmr", "bch"] + availableCurrencies = utils.getAvailableCurrencies() for module in (modules + availableCurrencies): importlib.__import__(module) From 45bc948cf8b67c77a15fbc04cd0ba31292afce30 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 20:48:13 +0100 Subject: [PATCH 13/16] fix bch typo --- docker-compose/testnet/bch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose/testnet/bch.yml b/docker-compose/testnet/bch.yml index b888ee9f..a6d84f10 100644 --- a/docker-compose/testnet/bch.yml +++ b/docker-compose/testnet/bch.yml @@ -6,7 +6,7 @@ services: volumes: - ${BLOCKCHAIN_PATH}/bitcoinabc:/home/bitcoin/.bitcoin - electrumx-mainnet: + electrumx-testnet: image: lukechilds/electrumx environment: DAEMON_URL: http://swapper:swapper@bitcoinabc-testnet:8332 @@ -19,7 +19,7 @@ services: volumes: - ${BLOCKCHAIN_PATH}/electrumx:/data - electrum-mainnet: + electrum-testnet: build: ../../packages/nodechain-electron-cash image: electrum environment: From 1dd83125d0cc8318d504d167c0473bf8a1e4b513 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 21:05:46 +0100 Subject: [PATCH 14/16] change BTC host to accept requests by network --- Connector/btc/config.py | 6 ++++-- docker-compose/mainnet/btc.yml | 20 +++++++++++-------- docker-compose/regtest/btc.yml | 18 +++++++++-------- docker-compose/testnet/btc.yml | 20 ++++++++++--------- .../nodechain-electrum-regtest/entrypoint.sh | 4 ++-- packages/nodechain-electrum/entrypoint.sh | 4 ++-- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/Connector/btc/config.py b/Connector/btc/config.py index a6ba3fc2..c5c6916d 100644 --- a/Connector/btc/config.py +++ b/Connector/btc/config.py @@ -66,7 +66,8 @@ def loadConfig(self, config): self.electrumProtocol = config["electrumProtocol"] if "electrumProtocol" in config \ else defaultConfig["electrumProtocol"] - self.electrumHost = config["electrumHost"] if "electrumHost" in config else defaultConfig["electrumHost"] + self.electrumHost = config["electrumHost"] if "electrumHost" in config \ + else self.__attachNetworkToHost(defaultConfig["electrumHost"]) if "electrumPort" in config: if config["electrumPort"].isdigit(): @@ -84,7 +85,8 @@ def loadConfig(self, config): else defaultConfig["bitcoincoreCallbackProtocol"] self.bitcoincoreCallbackHost = config["bitcoincoreCallbackHost"] if "bitcoincoreCallbackHost" in config \ else defaultConfig["bitcoincoreCallbackHost"] - self.electrumxHost = config["electrumxHost"] if "electrumxHost" in config else defaultConfig["electrumxHost"] + self.electrumxHost = config["electrumxHost"] if "electrumxHost" in config \ + else self.__attachNetworkToHost(defaultConfig["electrumxHost"]) if "electrumxPort" in config: if config["electrumxPort"].isdigit(): diff --git a/docker-compose/mainnet/btc.yml b/docker-compose/mainnet/btc.yml index c2c2b21a..d89f30a8 100644 --- a/docker-compose/mainnet/btc.yml +++ b/docker-compose/mainnet/btc.yml @@ -1,35 +1,39 @@ version: "3" services: - bitcoincore: + bitcoincore-mainnet: build: ../../packages/nodechain-bitcoin-core image: bitcoincore command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 - -rpcbind=bitcoincore + -rpcbind=bitcoincore-mainnet -txindex=1 -rpcport=8332 -zmqpubhashblock=tcp://0.0.0.0:28332 volumes: - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrs: + electrs-mainnet: build: ../../packages/nodechain-electrs image: electrs command: -v --timestamp depends_on: - - bitcoincore + - bitcoincore-mainnet environment: - DAEMON_RPC_URL: bitcoincore:8332 + DAEMON_RPC_URL: bitcoincore-mainnet:8332 ELECTRUM_RPC_URL: 0.0.0.0:50001 volumes: - ${BLOCKCHAIN_PATH}/electrs:/build/.electrs - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrum: + electrum-mainnet: build: ../../packages/nodechain-electrum image: electrum + depends_on: + - electrs-mainnet + environment: + NETWORK: ${NETWORK} networks: default: diff --git a/docker-compose/regtest/btc.yml b/docker-compose/regtest/btc.yml index 8fbe216b..2cc849bd 100644 --- a/docker-compose/regtest/btc.yml +++ b/docker-compose/regtest/btc.yml @@ -1,6 +1,6 @@ version: "3" services: - bitcoincore: + bitcoincore-regtest: build: ../../packages/nodechain-bitcoin-core image: bitcoincore command: -rpcuser=swapper @@ -17,29 +17,31 @@ services: -fallbackfee=0.0001 -zmqpubhashblock=tcp://0.0.0.0:28332 volumes: - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrs: + electrs-regtest: build: ../../packages/nodechain-electrs image: electrs command: -v --timestamp depends_on: - - bitcoincore + - bitcoincore-regtest environment: REGTEST: 1 - DAEMON_RPC_URL: bitcoincore:8332 + DAEMON_RPC_URL: bitcoincore-regtest:8332 ELECTRUM_RPC_URL: 0.0.0.0:60401 + NETWORK: ${NETWORK} volumes: - ${BLOCKCHAIN_PATH}/electrs:/build/.electrs - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrum: + electrum-regtest: build: ../../packages/nodechain-electrum-regtest image: electrum depends_on: - - electrs + - electrs-regtest environment: REGTEST: 1 + NETWORK: ${NETWORK} networks: default: diff --git a/docker-compose/testnet/btc.yml b/docker-compose/testnet/btc.yml index c9836b2d..6ec79d95 100644 --- a/docker-compose/testnet/btc.yml +++ b/docker-compose/testnet/btc.yml @@ -1,42 +1,44 @@ version: "3" services: - bitcoincore: + bitcoincore-testnet: build: ../../packages/nodechain-bitcoin-core image: bitcoincore command: -rpcuser=swapper -rpcpassword=swapper -server=1 -rpcallowip=0.0.0.0/0 - -rpcbind=bitcoincore + -rpcbind=bitcoincore-testnet -txindex=1 -prune=0 -testnet -rpcport=8332 -zmqpubhashblock=tcp://0.0.0.0:28332 volumes: - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrs: + electrs-testnet: build: ../../packages/nodechain-electrs image: electrs command: -v --timestamp depends_on: - - bitcoincore + - bitcoincore-testnet environment: TESTNET: 1 - DAEMON_RPC_URL: bitcoincore:8332 + DAEMON_RPC_URL: bitcoincore-testnet:8332 ELECTRUM_RPC_URL: 0.0.0.0:60001 + NETWORK: ${NETWORK} volumes: - ${BLOCKCHAIN_PATH}/electrs:/build/.electrs - - ${BLOCKCHAIN_PATH}/bitcoincode:/home/bitcoin/.bitcoin + - ${BLOCKCHAIN_PATH}/bitcoincore:/home/bitcoin/.bitcoin - electrum: + electrum-testnet: build: ../../packages/nodechain-electrum image: electrum depends_on: - - electrs + - electrs-testnest environment: TESTNET: 1 + NETWORK: ${NETWORK} networks: default: diff --git a/packages/nodechain-electrum-regtest/entrypoint.sh b/packages/nodechain-electrum-regtest/entrypoint.sh index 13723ecd..be4587a4 100644 --- a/packages/nodechain-electrum-regtest/entrypoint.sh +++ b/packages/nodechain-electrum-regtest/entrypoint.sh @@ -3,12 +3,12 @@ electrum_args="--regtest -v" Electrum/run_electrum --offline setconfig host "0.0.0.0" $electrum_args -Electrum/run_electrum --offline setconfig rpchost "electrum" $electrum_args +Electrum/run_electrum --offline setconfig rpchost "electrum-regtest" $electrum_args Electrum/run_electrum --offline setconfig rpcuser "swapper" $electrum_args Electrum/run_electrum --offline setconfig rpcpassword "swapper" $electrum_args Electrum/run_electrum --offline setconfig rpcport "30000" $electrum_args Electrum/run_electrum --offline setconfig oneserver "true" $electrum_args -Electrum/run_electrum --offline setconfig server "electrs:60401:t" $electrum_args +Electrum/run_electrum --offline setconfig server "electrs-regtest:60401:t" $electrum_args Electrum/run_electrum daemon $electrum_args \ No newline at end of file diff --git a/packages/nodechain-electrum/entrypoint.sh b/packages/nodechain-electrum/entrypoint.sh index e3af1d3d..b6231bf1 100644 --- a/packages/nodechain-electrum/entrypoint.sh +++ b/packages/nodechain-electrum/entrypoint.sh @@ -4,11 +4,11 @@ if [[ -n "${TESTNET}" ]]; then electrum_args="--testnet -v" fi -Electrum/run_electrum --offline setconfig rpchost "electrum" $electrum_args +Electrum/run_electrum --offline setconfig rpchost "electrum-${NETWORK}" $electrum_args Electrum/run_electrum --offline setconfig rpcuser "swapper" $electrum_args Electrum/run_electrum --offline setconfig rpcpassword "swapper" $electrum_args Electrum/run_electrum --offline setconfig rpcport "30000" $electrum_args Electrum/run_electrum --offline setconfig oneserver "true" $electrum_args -Electrum/run_electrum --offline setconfig server "electrs:60001:t" $electrum_args +Electrum/run_electrum --offline setconfig server "electrs-${NETWORK}:60001:t" $electrum_args Electrum/run_electrum daemon $electrum_args \ No newline at end of file From 218cfe55cf1fd4cd16c739f61518de68f827e2b1 Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Mon, 14 Mar 2022 21:28:42 +0100 Subject: [PATCH 15/16] change xmr host to accept requests by network --- Connector/xmr/config.py | 5 ++++- docker-compose/mainnet/xmr.yml | 2 +- docker-compose/testnet/xmr.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Connector/xmr/config.py b/Connector/xmr/config.py index b9b3e8c5..a4aaa029 100644 --- a/Connector/xmr/config.py +++ b/Connector/xmr/config.py @@ -14,6 +14,9 @@ def __init__(self, coin, networkName): self._rpcPort = 0 self._rpcPath = "" + def __attachNetworkToHost(self, host): + return f"{host}-{self.networkName}" + def loadConfig(self, config): defaultConfig, err = utils.loadDefaultPackageConf(self.coin) @@ -21,7 +24,7 @@ def loadConfig(self, config): return False, err self.protocol = config["protocol"] if "protocol" in config else defaultConfig["protocol"] - self.host = config["host"] if "host" in config else defaultConfig["host"] + self.host = config["host"] if "host" in config else self.__attachNetworkToHost(defaultConfig["host"]) self.rpcPort = config["rpcPort"] if "rpcPort" in config else defaultConfig["rpcPort"] self.rpcPath = config["rpcPath"] if "rpcPath" in config else defaultConfig["rpcPath"] diff --git a/docker-compose/mainnet/xmr.yml b/docker-compose/mainnet/xmr.yml index c33c601f..1c41bb56 100644 --- a/docker-compose/mainnet/xmr.yml +++ b/docker-compose/mainnet/xmr.yml @@ -1,6 +1,6 @@ version: "3" services: - monerod: + monerod-mainnet: build: ../../packages/nodechain-monerod image: monerod command: --p2p-bind-ip=0.0.0.0 --p2p-bind-port=18080 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=18081 --non-interactive --confirm-external-bind diff --git a/docker-compose/testnet/xmr.yml b/docker-compose/testnet/xmr.yml index 4d48e435..f562ce92 100644 --- a/docker-compose/testnet/xmr.yml +++ b/docker-compose/testnet/xmr.yml @@ -1,6 +1,6 @@ version: "3" services: - monerod: + monerod-testnet: build: ../../packages/nodechain-monerod image: monerod command: --stagenet --p2p-bind-ip=0.0.0.0 --p2p-bind-port=38080 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=38081 --non-interactive --confirm-external-bind From cd469561edfb781c33b3855e41c76c187e08d52d Mon Sep 17 00:00:00 2001 From: swapper-phoenix Date: Wed, 16 Mar 2022 17:53:09 +0100 Subject: [PATCH 16/16] fix ancent typos --- Connector/bch/apirpc.py | 2 +- Connector/btc/apirpc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Connector/bch/apirpc.py b/Connector/bch/apirpc.py index 05884f58..d98c31c6 100644 --- a/Connector/bch/apirpc.py +++ b/Connector/bch/apirpc.py @@ -675,7 +675,7 @@ def syncing(id, params, config): if blockchainInfo["blocks"] != blockchainInfo["headers"]: response = { "syncing": True, - "syncPercentage": f"{str(blockchainInfo['verificationprogess']*100)}%", + "syncPercentage": f"{str(blockchainInfo['verificationprogress']*100)}%", "currentBlockIndex": str(blockchainInfo["blocks"]), "latestBlockIndex": str(blockchainInfo["headers"]), } diff --git a/Connector/btc/apirpc.py b/Connector/btc/apirpc.py index 56e69b45..bff96b39 100644 --- a/Connector/btc/apirpc.py +++ b/Connector/btc/apirpc.py @@ -657,7 +657,7 @@ def syncing(id, params, config): if blockchainInfo["blocks"] != blockchainInfo["headers"]: response = { "syncing": True, - "syncPercentage": f"{str(blockchainInfo['verificationprogess']*100)}%", + "syncPercentage": f"{str(blockchainInfo['verificationprogress']*100)}%", "currentBlockIndex": str(blockchainInfo["blocks"]), "latestBlockIndex": str(blockchainInfo["headers"]), }