pull down to refresh
210 sats \ 2 replies \ @DarthCoin 18 Dec \ parent \ on: Borrow against your Bitcoin bitcoin
No, spend only less of what you earn.
If you need to borrow more money to pay your expenses, it means you have a spending problem not an income problem...
no it doesn't. Read what I said again
reply
import os
import subprocess
def run_command(command, check=True):
"""Run a shell command and print the output."""
try:
result = subprocess.run(command, shell=True, check=check, capture_output=True, text=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
except subprocess.CalledProcessError as e:
print(f"Command failed: {e.cmd}\nError: {e.stderr}")
exit(1)
Directories for persistent data
BITCOIN_DATA = os.path.expanduser("/bitcoin")
ARMORY_DATA = os.path.expanduser("/.armory")
Create directories if they don't exist
os.makedirs(BITCOIN_DATA, exist_ok=True)
os.makedirs(ARMORY_DATA, exist_ok=True)
print(f"Directories created/verified:\n Bitcoin data: {BITCOIN_DATA}\n Armory data: {ARMORY_DATA}")
Set permissions for directories
run_command(f"sudo chown -R $(whoami):$(whoami) {BITCOIN_DATA} {ARMORY_DATA}")
Pull necessary Docker images
print("Pulling Bitcoin Core Docker image...")
run_command("docker pull kylemanna/bitcoind")
print("Pulling Armory Docker image...")
Replace 'your-armory-image' with the actual Docker image name if needed
run_command("docker pull your-armory-image")
Start the Bitcoin daemon
print("Starting Bitcoin daemon in Docker...")
run_command(f"docker run -v {BITCOIN_DATA}:/bitcoin/.bitcoin -d --name bitcoind kylemanna/bitcoind")
Verify Bitcoin daemon logs
print("Checking Bitcoin daemon logs...")
run_command("docker logs -f bitcoind", check=False)
Configure X11 for GUI forwarding (Linux systems only)
if os.name == "posix":
print("Setting up X11 forwarding for GUI...")
run_command("xhost +local:docker")
Run Armory
print("Starting Armory in Docker...")
run_command(
f"docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v {BITCOIN_DATA}:/bitcoin/.bitcoin -v {ARMORY_DATA}:/root/.armory your-armory-image"
)
print("Bitcoin Armory setup and run complete.")
reply