Skip to content

Instantly share code, notes, and snippets.

@mks-m
Forked from romanz/fullnode.md
Last active November 13, 2023 14:26

Revisions

  1. mks-m revised this gist Mar 28, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions fullnode.md
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,9 @@

    - Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
    - Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
    - Attach 40GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.
    - Attach 150GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.

    The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    The pricing would be ~$15/month.
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.

    ## Installing
  2. mks-m revised this gist Mar 28, 2017. 1 changed file with 14 additions and 5 deletions.
    19 changes: 14 additions & 5 deletions fullnode.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C
    ```
    $ sudo dd if=/dev/zero of=/opt/swapfile bs=1M count=1024
    $ sudo mkswap /opt/swapfile
    $ sudo swapon /opt/swapfile
    $ sudo swapon /opt/swapfile
    $ mkdir ~/.bitcoin/
    $ sudo add-apt-repository -y ppa:bitcoin/bitcoin
    $ sudo apt-get update -y
    @@ -27,8 +27,7 @@ $ sudo apt-get install bitcoind -y
    - Add the following to /etc/fstab configuration:

    ```
    # /dev/xvdf is EXT4 filesystem under /home/ubuntu/.bitcoin
    /dev/xvdf /home/ubuntu/.bitcoin ext4 defaults 0 0
    /dev/xvdf /home/ubuntu/.bitcoin ext4 noatime,nodiratime,data=writeback,barrier=0,errors=remount-ro 0 0
    /opt/swapfile swap swap defaults 0 0
    ```

    @@ -37,7 +36,16 @@ Mount them using:
    ```
    sudo mount -a
    ```
    - Torrent `bootstrap.dat` for speed, as described [here](https://bitcoin.org/bin/blockchain/README.txt).

    If you're getting an error when mounting a volume that you've created manually, you need to create a filesystem on it (and optionally tune it):

    ```
    sudo mkfs.ext4 /dev/xvdf
    sudo tune2fs -O has_journal -o journal_data_writeback /dev/xvdf
    sudo tune2fs -O dir_index /dev/xvdf
    sudo e2fsck -D /dev/xvdf
    ```

    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    ```
    @@ -59,6 +67,7 @@ LINKCEIL="1gbit"
    #limit outbound Bitcoin protocol traffic to this rate
    LIMIT="200kbit"
    #defines the address space for which you wish to disable rate limiting
    #verify that subnet matches eth0 by running ifconfig
    LOCALNET="172.31.0.0/16"
    #delete existing rules
    @@ -95,7 +104,7 @@ iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK
    }
    ```

    - Use the following crontab:
    - Add the following to crontab by running `crontab -e`:

    ```
    @reboot bitcoind
  3. @romanz romanz revised this gist Jul 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fullnode.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.

    ## Installing
    (based on http://www.reddit.com/r/Bitcoin/comments/1se3zd/how_to_create_a_full_bitcoin_node_in_a_5_ubuntu/)
    (based on the [following](http://www.reddit.com/r/Bitcoin/comments/1se3zd/how_to_create_a_full_bitcoin_node_in_a_5_ubuntu/) reddit post)

    - Run as superuser:

  4. @romanz romanz revised this gist Jul 28, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fullnode.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.

    ## Installing
    (based on http://www.reddit.com/r/Bitcoin/comments/1se3zd/how_to_create_a_full_bitcoin_node_in_a_5_ubuntu/)

    - Run as superuser:

  5. @romanz romanz revised this gist Jul 28, 2014. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions fullnode.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,6 @@
    - Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
    - Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
    - Attach 40GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.
    - Attach 1GB EBS volume for swap to /dev/sdp.

    The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.
    @@ -15,9 +14,12 @@ See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C
    - Run as superuser:

    ```
    $ sudo dd if=/dev/zero of=/opt/swapfile bs=1M count=1024
    $ sudo mkswap /opt/swapfile
    $ sudo swapon /opt/swapfile
    $ mkdir ~/.bitcoin/
    $ sudo add-apt-repository -y ppa:bitcoin/bitcoin
    $ sudo apt-get update -y
    $ mkdir ~/.bitcoin/
    $ sudo apt-get install bitcoind -y
    ```

    @@ -26,8 +28,7 @@ $ sudo apt-get install bitcoind -y
    ```
    # /dev/xvdf is EXT4 filesystem under /home/ubuntu/.bitcoin
    /dev/xvdf /home/ubuntu/.bitcoin ext4 defaults 0 0
    # /dev/xvdp1 is a swap partition
    /dev/xvdp1 none swap sw 0 0
    /opt/swapfile swap swap defaults 0 0
    ```

    Mount them using:
  6. @romanz romanz revised this gist Jul 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fullnode.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@

    - Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
    - Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
    - Attach 40GB EBS volume for blockchain storage to /dev/sdf.
    - Attach 40GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.
    - Attach 1GB EBS volume for swap to /dev/sdp.

    The pricing should be ~3$ for the first year (assuming 30GB upload per month).
  7. @romanz romanz revised this gist Jul 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion fullnode.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,7 @@ Mount them using:
    ```
    sudo mount -a
    ```
    - Torrent `bootstrap.dat` for speed, as described [here](https://bitcointalk.org/index.php?topic=145386.0).
    - Torrent `bootstrap.dat` for speed, as described [here](https://bitcoin.org/bin/blockchain/README.txt).
    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    ```
  8. @romanz romanz revised this gist Jul 26, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions fullnode.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,7 @@ Mount them using:
    ```
    sudo mount -a
    ```
    - Torrent `bootstrap.dat` for speed, as described [here](https://bitcointalk.org/index.php?topic=145386.0).
    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    ```
  9. @romanz romanz renamed this gist Jul 26, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. @romanz romanz renamed this gist Jul 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md → aws-fullnode-howto
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Running Bitcoin Full Node on AWS Free Tier
    # Bitcoin Full Node on AWS Free Tier

    ## Provisioning

  11. @romanz romanz revised this gist Jul 26, 2014. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -15,10 +15,10 @@ See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C
    - Run as superuser:

    ```
    add-apt-repository -y ppa:bitcoin/bitcoin
    apt-get update -y
    mkdir ~/.bitcoin/
    apt-get install bitcoind -y
    $ sudo add-apt-repository -y ppa:bitcoin/bitcoin
    $ sudo apt-get update -y
    $ mkdir ~/.bitcoin/
    $ sudo apt-get install bitcoind -y
    ```

    - Add the following to /etc/fstab configuration:
    @@ -30,6 +30,11 @@ apt-get install bitcoind -y
    /dev/xvdp1 none swap sw 0 0
    ```

    Mount them using:

    ```
    sudo mount -a
    ```
    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    ```
  12. @romanz romanz revised this gist Jul 26, 2014. 1 changed file with 79 additions and 3 deletions.
    82 changes: 79 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Bitcoin Full Node on AWS Free Tier
    # Running Bitcoin Full Node on AWS Free Tier

    # Provisioning
    ## Provisioning

    - Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
    - Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
    @@ -10,7 +10,7 @@
    The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.

    # Installing
    ## Installing

    - Run as superuser:

    @@ -29,3 +29,79 @@ apt-get install bitcoind -y
    # /dev/xvdp1 is a swap partition
    /dev/xvdp1 none swap sw 0 0
    ```

    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    ```
    server=1
    daemon=1
    connections=40
    rpcuser=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    rpcpassword=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
    disablewallet=1
    ```

    - Use the following traffic control script (`.bitcoin/utils/tc.sh`) for bandwidth throttling:

    ```
    #network interface on which to limit traffic
    IF="eth0"
    #limit of the network interface in question
    LINKCEIL="1gbit"
    #limit outbound Bitcoin protocol traffic to this rate
    LIMIT="200kbit"
    #defines the address space for which you wish to disable rate limiting
    LOCALNET="172.31.0.0/16"
    #delete existing rules
    tc qdisc del dev ${IF} root
    #add root class
    tc qdisc add dev ${IF} root handle 1: htb default 10
    #add parent class
    tc class add dev ${IF} parent 1: classid 1:1 htb rate ${LINKCEIL} ceil ${LINKCEIL}
    #add our two classes. one unlimited, another limited
    tc class add dev ${IF} parent 1:1 classid 1:10 htb rate ${LINKCEIL} ceil ${LINKCEIL} prio 0
    tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} prio 1
    #add handles to our classes so packets marked with <x> go into the class with "... handle <x> fw ..."
    tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10
    tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11
    #limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network
    iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2
    iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2
    ```

    - Use the following logrotate script (`.bitcoin/utils/rotate.conf`):

    ```
    "/home/ubuntu/.bitcoin/debug.log" {
    daily
    missingok
    rotate 5
    copytruncate
    compress
    }
    ```

    - Use the following crontab:

    ```
    @reboot bitcoind
    @reboot sudo /home/ubuntu/.bitcoin/utils/tc.sh
    @daily logrotate /home/ubuntu/.bitcoin/utils/logrotate.conf
    ```

    # Testing

    - Run bitcoin server and watch its log file:

    ```
    bitcoind
    tail -F ~/.bitcoin/debug.log
    ```

    - Connect to its public IP from https://getaddr.bitnodes.io/, to make sure it is accepting connections from other nodes.
  13. @romanz romanz revised this gist Jul 26, 2014. 1 changed file with 13 additions and 66 deletions.
    79 changes: 13 additions & 66 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Running Bitcoin Full Node on AWS Free Tier
    # Bitcoin Full Node on AWS Free Tier

    # Provisioning

    @@ -14,71 +14,18 @@ See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C

    - Run as superuser:

    add-apt-repository -y ppa:bitcoin/bitcoin
    apt-get update -y
    mkdir ~/.bitcoin/
    apt-get install bitcoind -y
    ```
    add-apt-repository -y ppa:bitcoin/bitcoin
    apt-get update -y
    mkdir ~/.bitcoin/
    apt-get install bitcoind -y
    ```

    - Add the following to /etc/fstab configuration:
    # /dev/xvdf is EXT4 filesystem under /home/ubuntu/.bitcoin
    /dev/xvdf /home/ubuntu/.bitcoin ext4 defaults 0 0
    # /dev/xvdp1 is a swap partition
    /dev/xvdp1 none swap sw 0 0

    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    server=1
    daemon=1
    connections=40
    rpcuser=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    rpcpassword=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
    disablewallet=1

    - Use the following traffic control script (`.bitcoin/utils/tc.sh`) for bandwidth throttling:

    #network interface on which to limit traffic
    IF="eth0"
    #limit of the network interface in question
    LINKCEIL="1gbit"
    #limit outbound Bitcoin protocol traffic to this rate
    LIMIT="200kbit"
    #defines the address space for which you wish to disable rate limiting
    LOCALNET="172.31.0.0/16"

    #delete existing rules
    tc qdisc del dev ${IF} root

    #add root class
    tc qdisc add dev ${IF} root handle 1: htb default 10

    #add parent class
    tc class add dev ${IF} parent 1: classid 1:1 htb rate ${LINKCEIL} ceil ${LINKCEIL}

    #add our two classes. one unlimited, another limited
    tc class add dev ${IF} parent 1:1 classid 1:10 htb rate ${LINKCEIL} ceil ${LINKCEIL} prio 0
    tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} prio 1

    #add handles to our classes so packets marked with <x> go into the class with "... handle <x> fw ..."
    tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10
    tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11

    #limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network
    iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2
    iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2

    - Use the following logrotate script (`.bitcoin/utils/rotate.conf`):

    "/home/ubuntu/.bitcoin/debug.log" {
    daily
    missingok
    rotate 5
    copytruncate
    compress
    }


    - Use the following crontab:

    @reboot bitcoind -daemon
    @reboot sudo /home/ubuntu/.bitcoin/utils/tc.sh
    @daily logrotate /home/ubuntu/.bitcoin/utils/logrotate.conf
    ```
    # /dev/xvdf is EXT4 filesystem under /home/ubuntu/.bitcoin
    /dev/xvdf /home/ubuntu/.bitcoin ext4 defaults 0 0
    # /dev/xvdp1 is a swap partition
    /dev/xvdp1 none swap sw 0 0
    ```
  14. @romanz romanz renamed this gist Jul 26, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  15. @romanz romanz created this gist Jul 26, 2014.
    84 changes: 84 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,84 @@
    # Running Bitcoin Full Node on AWS Free Tier

    # Provisioning

    - Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
    - Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
    - Attach 40GB EBS volume for blockchain storage to /dev/sdf.
    - Attach 1GB EBS volume for swap to /dev/sdp.

    The pricing should be ~3$ for the first year (assuming 30GB upload per month).
    See [here](http://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-7C655B73-FA35-40F0-9518-4773E3E4A8C7) for more details.

    # Installing

    - Run as superuser:

    add-apt-repository -y ppa:bitcoin/bitcoin
    apt-get update -y
    mkdir ~/.bitcoin/
    apt-get install bitcoind -y

    - Add the following to /etc/fstab configuration:
    # /dev/xvdf is EXT4 filesystem under /home/ubuntu/.bitcoin
    /dev/xvdf /home/ubuntu/.bitcoin ext4 defaults 0 0
    # /dev/xvdp1 is a swap partition
    /dev/xvdp1 none swap sw 0 0

    - Use the following configuration file (`.bitcoin/bitcoin.conf`):

    server=1
    daemon=1
    connections=40
    rpcuser=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    rpcpassword=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
    disablewallet=1

    - Use the following traffic control script (`.bitcoin/utils/tc.sh`) for bandwidth throttling:

    #network interface on which to limit traffic
    IF="eth0"
    #limit of the network interface in question
    LINKCEIL="1gbit"
    #limit outbound Bitcoin protocol traffic to this rate
    LIMIT="200kbit"
    #defines the address space for which you wish to disable rate limiting
    LOCALNET="172.31.0.0/16"

    #delete existing rules
    tc qdisc del dev ${IF} root

    #add root class
    tc qdisc add dev ${IF} root handle 1: htb default 10

    #add parent class
    tc class add dev ${IF} parent 1: classid 1:1 htb rate ${LINKCEIL} ceil ${LINKCEIL}

    #add our two classes. one unlimited, another limited
    tc class add dev ${IF} parent 1:1 classid 1:10 htb rate ${LINKCEIL} ceil ${LINKCEIL} prio 0
    tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} prio 1

    #add handles to our classes so packets marked with <x> go into the class with "... handle <x> fw ..."
    tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10
    tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11

    #limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network
    iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2
    iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2

    - Use the following logrotate script (`.bitcoin/utils/rotate.conf`):

    "/home/ubuntu/.bitcoin/debug.log" {
    daily
    missingok
    rotate 5
    copytruncate
    compress
    }


    - Use the following crontab:

    @reboot bitcoind -daemon
    @reboot sudo /home/ubuntu/.bitcoin/utils/tc.sh
    @daily logrotate /home/ubuntu/.bitcoin/utils/logrotate.conf