Skip to content

Instantly share code, notes, and snippets.

View alexbosworth's full-sized avatar

Alex Bosworth alexbosworth

View GitHub Profile
@alexbosworth
alexbosworth / geohash.swift
Last active April 13, 2020 04:19
Swift Geohash
//
// Geohash.swift
// mn_ios
//
// Created by Alex Bosworth on 11/26/14.
// Copyright (c) 2014 adylitica. All rights reserved.
//
import Foundation
import MapKit

Install LND

Install LND by cloning and building

Install Make

sudo apt-get install -y build-essential
const sub = lnd.sendPayment();
sub.on('error', err => {
console.log("ERR", err);
})
sub.on('end', () => console.log("END"));
sub.on('status', status => console.log("STATUS", status));
sub.on('data', data => {
console.log("PAYMENT", data);

Install Go

In order to build lnd, Go is required

Fetch Binaries

Note: when upgrading first remove the existing Go: sudo rm -rf /usr/local/go

sudo apt-get update && sudo apt-get -y upgrade

Tools for LND Instance

Emacs

Install Emacs

sudo apt update && sudo apt upgrade -y && sudo apt install -y emacs
emacs
// Quit

Tor Install

Install and Setup Tor for use with Bitcoin Core

Install Tor

sudo apt-get update && sudo apt install -y apt-transport-https

sudo emacs /etc/apt/sources.list.d/tor.list

Setup Bitcoin.conf

bitcoin.conf flags for LND integration

rpcpassword= // make a strong password
rpcuser=bitcoinrpc
server=1
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28332

Setup iptables

Limit the number of incoming TCP connections

sudo iptables -N syn_flood
sudo iptables -A INPUT -p tcp --syn -j syn_flood
sudo iptables -A syn_flood -m limit --limit 1/s --limit-burst 3 -j RETURN
sudo iptables -A syn_flood -j DROP
sudo iptables -A INPUT -p icmp -m limit --limit 1/s --limit-burst 1 -j ACCEPT

Setup UFW

Turn on the firewall

sudo ufw logging on
sudo ufw enable
// PRESS Y
sudo ufw status
sudo ufw allow OpenSSH

Install ETCD

sudo apt install etcd

sudo emacs /etc/default/etcd

ETCD_NAME="controller"
ETCD_DATA_DIR="/var/lib/etcd"
ETCD_INITIAL_CLUSTER_STATE="new"