From cce9c1397a26c5f7244cd58ace99dc03d1e123c0 Mon Sep 17 00:00:00 2001 From: jash Date: Sun, 7 Oct 2018 19:39:25 +0200 Subject: [PATCH] bump --- .../{000_cyphernode.js => 000_proxy.js} | 22 +++++++++++-------- .../generators/app/features/100_bitcoin.js | 7 ++++++ .../generators/app/features/200_lightning.js | 3 --- .../generators/app/features/300_electrum.js | 3 --- .../app/features/400_opentimestamps.js | 3 --- .../generators/app/index.js | 15 ++++++------- .../app/templates/bitcoin/bitcoin.conf | 10 +++++++-- .../app/templates/proxy/env.properties | 19 ++++++++++++++++ install/script/install.sh | 2 +- 9 files changed, 55 insertions(+), 29 deletions(-) rename install/generator-cyphernode/generators/app/features/{000_cyphernode.js => 000_proxy.js} (66%) create mode 100644 install/generator-cyphernode/generators/app/templates/proxy/env.properties diff --git a/install/generator-cyphernode/generators/app/features/000_cyphernode.js b/install/generator-cyphernode/generators/app/features/000_proxy.js similarity index 66% rename from install/generator-cyphernode/generators/app/features/000_cyphernode.js rename to install/generator-cyphernode/generators/app/features/000_proxy.js index d861437..a0142a1 100644 --- a/install/generator-cyphernode/generators/app/features/000_cyphernode.js +++ b/install/generator-cyphernode/generators/app/features/000_proxy.js @@ -1,4 +1,4 @@ -const name = 'cyphernode'; +const name = 'proxy'; module.exports = { name: function() { @@ -15,8 +15,8 @@ module.exports = { }, { type: 'list', - name: 'cyphernode_net', - default: utils._getDefault( 'cyphernode_net' ), + name: 'net', + default: utils._getDefault( 'net' ), message: 'What net do you want to run on?'+'\n', choices: [{ name: "Testnet", @@ -28,16 +28,20 @@ module.exports = { }, { type: 'input', - name: 'cyphernode_xpub', - default: utils._getDefault( 'cyphernode_xpub' ), + name: 'xpub', + default: utils._getDefault( 'xpub' ), message: 'What is your xpub to watch?'+'\n', validate: utils._xkeyValidator + }, + { + type: 'input', + name: 'derivation_path', + default: utils._getDefault( 'derivation_path' ), + message: 'What is your address derivation path?'+'\n', + validate: utils._derivationPathValidator }]; }, - env: function( props ) { - return 'VAR0=VALUE0\nVAR1=VALUE1' - }, templates: function( props ) { - return []; + return [ 'env.properties' ]; } }; \ No newline at end of file diff --git a/install/generator-cyphernode/generators/app/features/100_bitcoin.js b/install/generator-cyphernode/generators/app/features/100_bitcoin.js index 71ff5b4..a18e156 100644 --- a/install/generator-cyphernode/generators/app/features/100_bitcoin.js +++ b/install/generator-cyphernode/generators/app/features/100_bitcoin.js @@ -63,6 +63,13 @@ module.exports = { name: 'bitcoin_expose', default: utils._getDefault( 'bitcoin_expose' ), message: 'Expose bitcoin full node outside of the docker network?'+'\n', + }, + { + when: bitcoinInternal, + type: 'input', + name: 'bitcoin_uacomment', + default: utils._getDefault( 'bitcoin_uacomment' ), + message: 'Any UA comment?'+'\n', }]; }, env: function( props ) { diff --git a/install/generator-cyphernode/generators/app/features/200_lightning.js b/install/generator-cyphernode/generators/app/features/200_lightning.js index 768fddf..60a2617 100644 --- a/install/generator-cyphernode/generators/app/features/200_lightning.js +++ b/install/generator-cyphernode/generators/app/features/200_lightning.js @@ -41,9 +41,6 @@ module.exports = { message: 'What external ip does your lightning node have?'+'\n', }]; }, - env: function( props ) { - return 'VAR0=VALUE0\nVAR1=VALUE1' - }, templates: function( props ) { return templates[props.lightning_implementation] } diff --git a/install/generator-cyphernode/generators/app/features/300_electrum.js b/install/generator-cyphernode/generators/app/features/300_electrum.js index e0b7deb..c374918 100644 --- a/install/generator-cyphernode/generators/app/features/300_electrum.js +++ b/install/generator-cyphernode/generators/app/features/300_electrum.js @@ -26,9 +26,6 @@ module.exports = { ] }]; }, - env: function( props ) { - return 'VAR0=VALUE0\nVAR1=VALUE1' - }, templates: function( props ) { return []; } diff --git a/install/generator-cyphernode/generators/app/features/400_opentimestamps.js b/install/generator-cyphernode/generators/app/features/400_opentimestamps.js index fba60f2..238c45e 100644 --- a/install/generator-cyphernode/generators/app/features/400_opentimestamps.js +++ b/install/generator-cyphernode/generators/app/features/400_opentimestamps.js @@ -11,9 +11,6 @@ module.exports = { prompts: function( utils ) { return []; }, - env: function( props ) { - return 'VAR0=VALUE0\nVAR1=VALUE1'; - }, templates: function( props ) { return []; } diff --git a/install/generator-cyphernode/generators/app/index.js b/install/generator-cyphernode/generators/app/index.js index 3582907..63cdc9b 100644 --- a/install/generator-cyphernode/generators/app/index.js +++ b/install/generator-cyphernode/generators/app/index.js @@ -22,7 +22,9 @@ module.exports = class extends Generator { if( fs.existsSync(this.destinationPath('props.json')) ) { this.props = require(this.destinationPath('props.json')); } else { - this.props = {}; + this.props = { + 'derivation_path': '0/n' + }; } this.featureChoices = featureChoices; @@ -51,9 +53,7 @@ module.exports = class extends Generator { fs.writeFileSync(this.destinationPath('props.json'), JSON.stringify(this.props, null, 2)); for( let m of featurePromptModules ) { - const name = m.name(); - fs.writeFileSync(this.destinationPath(name+'.properties'), m.env()); - + const name = m.name(); for( let t of m.templates(this.props) ) { const p = path.join(name,t); this.fs.copyTpl( @@ -62,7 +62,6 @@ module.exports = class extends Generator { this.props ); } - } } @@ -80,12 +79,10 @@ module.exports = class extends Generator { _ipOrFQDNValidator( host ) { host = (host+"").trim(); - if( !(validator.isIP(host) || validator.isFQDN(host)) ) { throw new Error( 'No IP address or fully qualified domain name' ) } - return true; } @@ -94,10 +91,12 @@ module.exports = class extends Generator { if( !coinstring.isValid( xpub ) ) { throw new Error('Not an extended key.'); } - return true; } + _derivationPathValidator( path ) { + return true; + } _trimFilter( input ) { return (input+"").trim(); diff --git a/install/generator-cyphernode/generators/app/templates/bitcoin/bitcoin.conf b/install/generator-cyphernode/generators/app/templates/bitcoin/bitcoin.conf index 44c6232..715f372 100644 --- a/install/generator-cyphernode/generators/app/templates/bitcoin/bitcoin.conf +++ b/install/generator-cyphernode/generators/app/templates/bitcoin/bitcoin.conf @@ -1,4 +1,4 @@ -<% if (cyphernode_net === 'testnet') { %> +<% if (net === 'testnet') { %> # testnet testnet=1 <% } %> @@ -14,7 +14,13 @@ zmqpubrawtx=tcp://0.0.0.0:18502 #proxy=127.0.0.1:9050 #listen=1 -rpcconnect=btcnode +rpcconnect=bitcoin rpcuser=<%= bitcoin_rpcuser %> rpcpassword=<%= bitcoin_rpcpassword %> + +# why? rpcwallet=ln01.dat + +<% if ( bitcoin_uacomment != null && bitcoin_uacomment != '' ) { %> +uacomment=<%= bitcoin_uacomment %> +<% } %> \ No newline at end of file diff --git a/install/generator-cyphernode/generators/app/templates/proxy/env.properties b/install/generator-cyphernode/generators/app/templates/proxy/env.properties new file mode 100644 index 0000000..5ed7afa --- /dev/null +++ b/install/generator-cyphernode/generators/app/templates/proxy/env.properties @@ -0,0 +1,19 @@ +TRACING=1 +WATCHER_BTC_NODE_RPC_URL=btcnode:<%= (net === 'mainnet')?'8332':'18332' %>/wallet/watching01.dat +WATCHER_BTC_NODE_RPC_USER=<%= bitcoin_rpcuser %>:<%= bitcoin_rpcpassword %> +WATCHER_BTC_NODE_RPC_CFG=/proxyuser/watcher_btcnode_curlcfg.properties +SPENDER_BTC_NODE_RPC_URL=btcnode:<%= (net === 'mainnet')?'8332':'18332' %>/wallet/spending01.dat +SPENDER_BTC_NODE_RPC_USER=<%= bitcoin_rpcuser %>:<%= bitcoin_rpcpassword %> +SPENDER_BTC_NODE_RPC_CFG=/proxyuser/sender_btcnode_curlcfg.properties +PROXY_LISTENING_PORT=8888 +# Variable substitutions don't work +DB_PATH=/proxyuser/db +DB_FILE=/proxyuser/db/proxydb +# Pycoin container +PYCOIN_CONTAINER=pycoinnode:7777 +# OTS container +OTS_CONTAINER=otsnode:6666 + +DERIVATION_PUB32=<%= xpub %> +DERIVATION_PATH=<%= derivation_path %> +WATCHER_BTC_NODE_PRUNED=<%= bitcoin_prune?'true':'false' %> diff --git a/install/script/install.sh b/install/script/install.sh index a94aaef..b1979b2 100755 --- a/install/script/install.sh +++ b/install/script/install.sh @@ -16,7 +16,7 @@ trace "Updating SatoshiPortal dockers" # ## build cyphernode images #build_docker_image ../../cron_docker/ proxycronimg -#build_docker_image ../../proxy_docker/ btcproxyimg +build_docker_image ../../proxy_docker/ btcproxyimg #build_docker_image ../../pycoin_docker/ pycoinimg # ## build setup docker image