feat: start working on monero implementation
feat: monero files and config feat: monero interface feat: monero rpc digest request feat: add monero to wallet wizard splash fix: tarball unzipping fix: monero files fix: monero zipped folder path fix: undefined variable chore: xmr stagenet fix: prune-blockchain flag fix: monero wallet arguments chore: rpc-bind-port on monero wallet chore: monero wallet directory fix: fetch digest request fix: monero authentication fix: monero address creation fix: monero config port fix: wallet creation fix: wallet rpc daemon login fix: get monero funding fix: unauthorized issue with multiple requests on Promise.all fix: generate funding addresses fix: destination address balance for XMR cashout fix: transaction creation feat: transaction recommended mixin and ring size fix: monero wallet error handling fix: error handling fix: monero wallet error feat: guide to add new cryptos chore: small code shortcuts fix: crypto implementation guide chore: add XMR to exchange files
This commit is contained in:
parent
9ec871e163
commit
c0808e9bd7
11 changed files with 445 additions and 14 deletions
|
|
@ -48,6 +48,11 @@ const BINARIES = {
|
|||
url: 'https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v23.1.0/bitcoin-cash-node-23.1.0-x86_64-linux-gnu.tar.gz',
|
||||
dir: 'bitcoin-cash-node-23.1.0/bin',
|
||||
files: [['bitcoind', 'bitcoincashd'], ['bitcoin-cli', 'bitcoincash-cli']]
|
||||
},
|
||||
XMR: {
|
||||
url: 'https://downloads.getmonero.org/cli/monero-linux-x64-v0.17.2.0.tar.bz2',
|
||||
dir: 'monero-x86_64-linux-gnu-v0.17.2.0',
|
||||
files: [['monerod', 'monerod'], ['monero-wallet-rpc', 'monero-wallet-rpc']]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,11 +76,24 @@ function es (cmd) {
|
|||
return res.toString()
|
||||
}
|
||||
|
||||
function writeSupervisorConfig (coinRec, cmd) {
|
||||
function writeSupervisorConfig (coinRec, cmd, walletCmd = '') {
|
||||
if (isInstalledSoftware(coinRec)) return
|
||||
|
||||
const blockchain = coinRec.code
|
||||
|
||||
if (!_.isNil(coinRec.wallet)) {
|
||||
const supervisorConfigWallet = `[program:${blockchain}-wallet]
|
||||
command=nice ${walletCmd}
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stderr_logfile=/var/log/supervisor/${blockchain}-wallet.err.log
|
||||
stdout_logfile=/var/log/supervisor/${blockchain}-wallet.out.log
|
||||
environment=HOME="/root"
|
||||
`
|
||||
|
||||
writeFile(`/etc/supervisor/conf.d/${coinRec.code}-wallet.conf`, supervisorConfigWallet)
|
||||
}
|
||||
|
||||
const supervisorConfig = `[program:${blockchain}]
|
||||
command=nice ${cmd}
|
||||
autostart=true
|
||||
|
|
@ -89,7 +107,10 @@ environment=HOME="/root"
|
|||
}
|
||||
|
||||
function isInstalledSoftware (coinRec) {
|
||||
return fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`)
|
||||
return !_.isNil(coinRec.wallet)
|
||||
? fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`)
|
||||
&& fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}-wallet.conf`)
|
||||
: fs.existsSync(`/etc/supervisor/conf.d/${coinRec.code}.conf`)
|
||||
}
|
||||
|
||||
function fetchAndInstall (coinRec) {
|
||||
|
|
@ -104,7 +125,9 @@ function fetchAndInstall (coinRec) {
|
|||
const binDir = requiresUpdate ? binaries.defaultDir : binaries.dir
|
||||
|
||||
es(`wget -q ${url}`)
|
||||
es(`tar -xzf ${downloadFile}`)
|
||||
coinRec.cryptoCode === 'XMR'
|
||||
? es(`tar -xf ${downloadFile}`)
|
||||
: es(`tar -xzf ${downloadFile}`)
|
||||
|
||||
if (_.isEmpty(binaries.files)) {
|
||||
es(`sudo cp ${binDir}/* /usr/local/bin`)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ const PLUGINS = {
|
|||
DASH: require('./dash.js'),
|
||||
ETH: require('./ethereum.js'),
|
||||
LTC: require('./litecoin.js'),
|
||||
ZEC: require('./zcash.js')
|
||||
ZEC: require('./zcash.js'),
|
||||
XMR: require('./monero.js')
|
||||
}
|
||||
|
||||
module.exports = {run}
|
||||
|
|
|
|||
30
lib/blockchain/monero.js
Normal file
30
lib/blockchain/monero.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const path = require('path')
|
||||
|
||||
const { utils } = require('lamassu-coins')
|
||||
|
||||
const common = require('./common')
|
||||
|
||||
module.exports = {setup}
|
||||
|
||||
const coinRec = utils.getCryptoCurrency('XMR')
|
||||
|
||||
function setup (dataDir) {
|
||||
common.firewall([coinRec.defaultPort])
|
||||
const auth = `lamassuserver:${common.randomPass()}`
|
||||
const config = buildConfig(auth)
|
||||
common.writeFile(path.resolve(dataDir, coinRec.configFile), config)
|
||||
const cmd = `/usr/local/bin/${coinRec.daemon} --data-dir ${dataDir} --config-file ${dataDir}/${coinRec.configFile}`
|
||||
const walletCmd = `/usr/local/bin/${coinRec.wallet} --stagenet --rpc-login ${auth} --daemon-host 127.0.0.1 --daemon-port 38081 --trusted-daemon --daemon-login ${auth} --rpc-bind-port 38083 --wallet-dir ${dataDir}/wallets`
|
||||
common.writeSupervisorConfig(coinRec, cmd, walletCmd)
|
||||
}
|
||||
|
||||
function buildConfig (auth) {
|
||||
return `rpc-login=${auth}
|
||||
stagenet=1
|
||||
restricted-rpc=1
|
||||
db-sync-mode=safe
|
||||
out-peers=20
|
||||
in-peers=20
|
||||
prune-blockchain=1
|
||||
`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue