streamline wallet deployment, setup non-custodial payment verification,
setup subscription workflowmain
parent
543736704b
commit
b7a5d042f7
@ -0,0 +1,3 @@
|
||||
.venv
|
||||
.git
|
||||
/data
|
@ -0,0 +1,38 @@
|
||||
FROM ubuntu:21.10
|
||||
|
||||
ENV MONERO_HASH 59e16c53b2aff8d9ab7a8ba3279ee826ac1f2480fbb98e79a149e6be23dd9086
|
||||
ENV MONERO_DL_URL https://downloads.getmonero.org/cli/monero-linux-x64-v0.17.2.0.tar.bz2
|
||||
ENV MONERO_DL_FILE monero.tar.bz2
|
||||
ENV MONERO_SUMS_FILE sha256sums
|
||||
|
||||
WORKDIR /opt/monero
|
||||
|
||||
# Update system and install dependencies
|
||||
# Download Monero binaries from Github
|
||||
# Confirm hashes match
|
||||
# Install binaries to system path
|
||||
# Clean up
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get upgrade -y
|
||||
RUN apt-get install -y tar wget bzip2
|
||||
|
||||
RUN wget -qO ${MONERO_DL_FILE} ${MONERO_DL_URL}
|
||||
RUN echo "${MONERO_HASH} ${MONERO_DL_FILE}" > ${MONERO_SUMS_FILE} \
|
||||
&& sha256sum -c ${MONERO_SUMS_FILE}; \
|
||||
if [ "$?" -eq 0 ]; \
|
||||
then \
|
||||
echo -e "[+] Hashes match - proceeding with container build"; \
|
||||
else \
|
||||
echo -e "[!] Hashes do not match - exiting"; \
|
||||
exit 5; \
|
||||
fi \
|
||||
&& mkdir ./tmp \
|
||||
&& tar xvf ${MONERO_DL_FILE} -C ./tmp --strip 1 \
|
||||
&& mv ./tmp/* /usr/local/bin/ \
|
||||
&& rm -rf ./tmp ${MONERO_SUMS_FILE} ${MONERO_DL_FILE}
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY bin/run_wallet.sh /run_wallet.sh
|
||||
|
||||
WORKDIR /data
|
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
export RPC_CREDS="${2}"
|
||||
export DAEMON_ADDRESS=singapore.node.xmr.pm
|
||||
|
||||
# Define the network we plan to operate our wallet in
|
||||
if [[ "${1}" == "stagenet" ]]; then
|
||||
export NETWORK=--stagenet
|
||||
export PORT=38081
|
||||
elif [[ "${1}" == "testnet" ]]; then
|
||||
export NETWORK=--testnet
|
||||
export PORT=28081
|
||||
else
|
||||
export NETWORK=
|
||||
export PORT=18089
|
||||
fi
|
||||
|
||||
# Create new wallet if it doesn't exist
|
||||
if [[ ! -d /data/wallet ]]; then
|
||||
monero-wallet-cli ${NETWORK} \
|
||||
--generate-new-wallet /data/wallet \
|
||||
--daemon-address http://${DAEMON_ADDRESS}:${PORT} \
|
||||
--trusted-daemon \
|
||||
--use-english-language-names \
|
||||
--mnemonic-language English
|
||||
fi
|
||||
|
||||
# Run RPC wallet
|
||||
monero-wallet-rpc ${NETWORK} \
|
||||
--daemon-address http://${DAEMON_ADDRESS}:${PORT} \
|
||||
--wallet-file /data/wallet \
|
||||
--password "" \
|
||||
--rpc-login ${RPC_CREDS} \
|
||||
--rpc-bind-port 8000 \
|
||||
--rpc-bind-ip 0.0.0.0 \
|
||||
--confirm-external-bind \
|
||||
--log-file /data/wallet-rpc.log \
|
||||
--trusted-daemon
|
@ -0,0 +1,17 @@
|
||||
from monero.wallet import Wallet
|
||||
from monero.exceptions import WrongAddress
|
||||
|
||||
from xmrbackers import config
|
||||
|
||||
def check_tx_key(tx_id, tx_key, wallet_address):
|
||||
try:
|
||||
check_data = {
|
||||
'txid': tx_id,
|
||||
'tx_key': tx_key,
|
||||
'address': wallet_address
|
||||
}
|
||||
w = Wallet(port=8000, user=config.XMR_WALLET_RPC_USER, password=config.XMR_WALLET_RPC_PASS)
|
||||
res = w._backend.raw_request('check_tx_key', check_data)
|
||||
return res
|
||||
except:
|
||||
raise Exception('there was a problem i dont feel like writing good code for right now')
|
Loading…
Reference in New Issue