Skip to content

Instantly share code, notes, and snippets.

@esomore
esomore / main.go
Created June 24, 2018 23:47
bifrost stellar setup-script
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"time"
sudo snap install --beta multipass --classic
multipass launch --name microk8s-vm --mem 16 --disk 80G
multipass exec microk8s-vm -- sudo snap install microk8s --classic
multipass exec microk8s.status
multipass exec microk8s-vm -- sudo iptables -P FORWARD ACCEPT\n
multipass exec microk8s-vm -- /snap/bin/microk8s.config > $KEYBASE_HOME/clusters/microk8s
multipass exec microk8s-vm -- /snap/bin/microk8s.enable dns dashboard
multipass exec microk8s-vm -- /snap/bin/microk8s.kubectl get all --all-namespaces
### create new cluster and call it cosmic ###
doctl kubernetes cluster create cosmic
### add a secondary node-pool with bigger droplets for timescale ###
doctl kubernetes cluster node-pool create cosmic --name tsdb --count 4 --size s-6vcpu-16gb
### delete the default node-pool ###
doctl kubernetes cluster node-pool delete cosmic cosmic-default-pool
### list node-pools ###
kubectl apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
### (you might need to run this twice if it fails on the first run) ###
kubectl apply -k https://github.com/cosmicrocks/monitoring.git
### port-forward to grafana ###
kubectl -n monitoring port-forward $(kubectl -n monitoring get pods -l app=grafana -o jsonpath='{.items[*].metadata.name}') 3000:3000 &
and browse to https://127.0.0.1:3000
(username and password are 'admin')
### the good guys at kubedb provided us with this easy one liner ###
curl -fsSL https://raw.githubusercontent.com/kubedb/cli/0.12.0/hack/deploy/kubedb.sh | bash
### verify that the setup is successful ###
kubectl get pods --all-namespaces -l app=kubedb
kubectl get crd -l app=kubedb
### deploy custom timescaledb postgres image ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/postgres-version.yaml
### deploy custom postgres user password ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/timescale-auth.yaml
### deploy timescale postgres kubedb crd ###
kubectl apply -f https://raw.githubusercontent.com/cosmicrocks/timescaledb/master/k8s/timescaledb/timescale.yaml
### deploy pg_admin ###
# download jdk from oracle
# install jenv
jenv enable-plugin export
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
jenv global 1.8.0.211
jenv enable-plugin maven
jenv enable-plugin export
jenv doctor

Keybase proof

I hereby claim:

  • I am esomore on github.
  • I am itamarperez (https://keybase.io/itamarperez) on keybase.
  • I have a public key ASBQUA5rkGf4jDxCZrhoQYTEVyunBvr0r41tRDXMWQmgqwo

To claim this, I am signing this object:

@esomore
esomore / gist:fc04bc74c2ef0e25ba2230d7b007ca8c
Created September 12, 2023 04:56
# GHOSTDAG Protocol vs. Bitcoin's Decentralization
# GHOSTDAG Protocol vs. Bitcoin's Decentralization
While pruned nodes present an innovative solution to address the storage problem brought about by high TPS, it's crucial to consider the broader implications of this approach on network decentralization and neutrality. The **GHOSTDAG protocol**, as detailed by Sutton and Wyborski, introduces a set of rules that miners must follow to support secure pruning of the DAG. The protocol's main proposition suggests that if certain conditions are met, blocks can be safely pruned without compromising the integrity of the network.
In contrast, **Bitcoin**, the original decentralized cryptocurrency, has been tested over a decade and has proven its commitment to neutrality and decentralization. Its consensus mechanism ensures that no single entity can control or dominate the network<sup>1</sup>. As Bitcoin's popularity grew, so did its transaction volume, leading to scalability challenges. However, the Bitcoin community has explored and implemented several scaling solut