@anon
sign up
@anon
sign up
pull down to refresh
0 sats
\
0 replies
\
@bren
18 Dec
\
parent
\
on: Borrow against your Bitcoin
bitcoin
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.")
write
preview
reply
100 sats
Directories for persistent data
/bitcoin") ARMORY_DATA = os.path.expanduser("/.armory")Create directories if they don't exist
Set permissions for directories
Pull necessary Docker images
Replace 'your-armory-image' with the actual Docker image name if needed
Start the Bitcoin daemon
Verify Bitcoin daemon logs
Configure X11 for GUI forwarding (Linux systems only)
Run Armory