Skip to content

Minimalistic and simple Bitcoin address generation by xpub. Use with python, or php

Notifications You must be signed in to change notification settings

uniquemecanique/simplebtcbyxpub

Repository files navigation

simplebtcbyxpub

Minimalistic and simple Bitcoin address generation by xpub. Use with python or php
My first project on github ever

Simple Bitcoin address generation by xpub (public key)

  1. Installing requirements

    sudo apt update && apt install python3 python3-pip -y
    sudo apt-get install python3-pip
    pip3 install bitcoin
    pip install git+https://github.com/primal100/pybitcointools.git@master

    if errors, you can try: bash requirements.sh (not tested!)

  2. CLI python usage

    1. python3 btc_by_xpubindex.py
      Please enter your xpub: [YOUR-XPUB]
      Please enter the index number: [ANY-NUMBER]
      [outputs address]

    2. python3 list_by_xpub.py

      Please enter your xpub: [YOUR-XPUB]
      [outputs list of 100 btc addresses]

  3. PHP usage

    1. if you dont have lamp (php, mysql) installed, use this simple line
      sudo apt install lamp-server^

    2. copy all files to your local server e.g. /var/www/html/

    3. simply create config database using bash create_config_db.sh enter your database's username, password and give a name to a new db

    4. configure 'db.php' file. enter database's username, password and name of created db

    5. goto localhost from ur favorite browser

    6. Index page will show first bitcoin address. Updating page will output next address.

    7. goto localhost/manual_input.php to manualy enter xpub and select address, you wanna see.

    !!! remember that 0 = first address !!!
    1. To use it for assignment personal address on user registration: edit index.php : comment, or remove this line:
      echo $xpub_address;
      I guess, your index file should content anything other: you should rename source index.php, e.g. getbtc.php
      sudo mv index.php getbtc.php
      add line require_once('getbtc.php'); in your registration file and $xpub_address should output a new address every time.
Like my code? Buy me a ☕️: bc1qqzun677gyh4w856zkztt7jkzv87ca305439cly
Bitcoin QR code
Thank you!