Skip to content

Instantly share code, notes, and snippets.

View vivekteega's full-sized avatar
💭
Booyakasha

Vivek Teega vivekteega

💭
Booyakasha
View GitHub Profile
@vivekteega
vivekteega / start.sh
Created April 4, 2021 12:45
Flosight Docker - start.sh
#!/bin/bash
cd /flosight
# Use Env variables in Config
## Change Network Config if needed
echo "Setup configs..."
if [ "$NETWORK" == "testnet" ]
then
sed -i 's/livenet/testnet/g' flocore-node.json
fi
@vivekteega
vivekteega / Dockerfile
Last active April 4, 2021 12:55
Dockerfile for spawing a Flosight instance
FROM node:10-stretch-slim
# Install Dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential git libzmq3-dev python nginx curl && \
rm -rf /var/lib/apt/lists/*
# Install flosight
WORKDIR /flosight
ADD https://api.github.com/repos/oipwg/flocore-node/git/refs/heads/master flocore-node-version.json
@vivekteega
vivekteega / flocore-node.json
Created April 5, 2021 10:05
Flosight Docker - flocore-node.json configuration file
{
"version": "5.0.0-beta.44",
"network": "livenet",
"port": 3001,
"services": [
"address",
"block",
"db",
"fee",
"header",
@vivekteega
vivekteega / last_reorg_crash.txt
Last active April 6, 2021 18:19
Flosight error type 1
[info] (peer) Initializing witness compact blocks (91.206.16.214:7312).
[info] (net) Received 143 addrs (hosts=561, peers=8) (34.83.237.202:7312).
[info] (peer) Peer initialized compact blocks (mode=0, version=2) (91.206.16.214:7312).
[info] (net) Received 1 addrs (hosts=561, peers=9) (91.206.16.214:7312).
[2021-03-28T02:18:51.402Z] info: ::ffff:127.0.0.1 "GET /api/sync" 200 121 3.126 "curl/7.52.1"
[info] (chain) Block 17ce39716ee51f064095b29e435a281c178b8cf045657a14ba17fc2f3adee6fd (4702567) added to chain (size=249 txs=1 time=13.015312).
[2021-03-28T02:19:10.518Z] info: Block Service: The best block hash is: 17ce39716ee51f064095b29e435a281c178b8cf045657a14ba17fc2f3adee6fd at height: 4702567. Time between the last 2 blocks (adjusted): 30 minute(s). 27 second(s). 0 millisecond(s).
[2021-03-28T02:19:10.521Z] info: ::ffff:127.0.0.1 "GET /api/block/17ce39716ee51f064095b29e435a281c178b8cf045657a14ba17fc2f3adee6fd" 200 579 3.714 "python-requests/2.23.0"
[2021-03-28T02:19:10.529Z] info: ::ffff:127.0.0.1 "GET /api
@vivekteega
vivekteega / flosight.log
Created April 7, 2021 19:30
Sample of a good reorg operation in Flosight
[warning] (chain) WARNING: Reorganizing chain.
[info] (node) Spawning worker process: 2.
[info] (node) Spawning worker process: 3.
[warning] (chain) Chain reorganization: old=cd4802927759720336278fe1cfac8708123b350202ceae558017b76c2791b3f9(4699808) new=4ca28d40e34cbc61053a49cf9edac4bf7ee466016f6c64e47fc0bc44bd0b1ed9(4699809)
[info] (chain) Block 4ca28d40e34cbc61053a49cf9edac4bf7ee466016f6c64e47fc0bc44bd0b1ed9 (4699809) added to chain (size=330 txs=1 time=280.809984).
[info] (chain) Block 1279c0c05d7fe2bf7f487c307218e3edab161a4707306c55f71277ab5990b547 (4699810) added to chain (size=330 txs=1 time=4.230457).
[2021-03-26T00:18:45.417Z] warn: Header Service: Reorganization detected, current tip hash: cd4802927759720336278fe1cfac8708123b350202ceae558017b76c2791b3f9, new block causing the reorg: 4ca28d40e34cbc61053a49cf9edac4bf7ee466016f6c64e47fc0bc44bd0b1ed9
[2021-03-26T00:18:45.417Z] info: Header Service: Getting last header synced at height: 4697808
[2021-03-26T00:18:45.507Z] info: localhost-header unsubscribe:
@vivekteega
vivekteega / gist:ea68e976ee7163bd39cf620dbde5d077
Created April 8, 2021 08:11
Flosight reorg logs in which the code doesn't go ahead to find common ancestors and download new blocks. Because after downloading the new headers, it says "saved tip is good to go"
[2021-04-08T07:36:18.791Z] warn: Header Service: Reorganization detected, current tip hash: f62e02f4cae72d26f2868a7e57e94ee2b250f1957fa795d440ee24fb9884dd69, new block causing the reorg: ac91262919b5bec88909bd0037371768990599e326e6f408d90d475b6fb22451
[2021-04-08T07:36:18.792Z] info: Header Service: Getting last header synced at height: 4700266
[2021-04-08T07:36:18.823Z] info: Block Service: download progress: 4703767/4703767 (100.0000%)
[2021-04-08T07:36:18.823Z] info: Block Service: starting p2p block subscription.
[2021-04-08T07:36:18.823Z] info: localhost-block subscribe: p2p/block total: 2
[2021-04-08T07:36:18.823Z] info: Mempool Service: Mempool enabled.
[2021-04-08T07:36:19.115Z] info: localhost-header unsubscribe: p2p/headers total: 0
[2021-04-08T07:36:19.115Z] info: localhost-header unsubscribe: p2p/block total: 1
[2021-04-08T07:36:19.115Z] info: Header Service: Gathering: 20000 header(s) from the peer-to-peer network.
[2021-04-08T07:36:19.115Z] info: Header Service: subscribed to p2p headers.
@vivekteega
vivekteega / Dockerfile
Created April 30, 2021 11:28
Changed Flosight docker file
FROM node:10-stretch-slim
# Install Dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential git libzmq3-dev python nginx curl && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get install ca-certificates -y
RUN update-ca-certificates
@vivekteega
vivekteega / docker.log
Created May 11, 2021 11:38
Flosight docker container sz changes logs
[2021-05-11T10:37:38.949Z] info: ::ffff:127.0.0.1 "GET /api/blocks?limit=5" 200 - 0.869 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
[2021-05-11T10:37:38.953Z] info: ::ffff:127.0.0.1 "GET /api/blocks?limit=5" 200 - 0.729 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
[2021-05-11T10:37:38.954Z] info: ::ffff:127.0.0.1 "GET /api/blocks?limit=5" 200 - 0.840 "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
[2021-05-11T10:37:38.955Z] info: ::ffff:127.0.0.1 "GET /api/block/2ec05413b14d1811be71a15b124db43f7a3d6660227ebdaaa692d3c8bb245485" 200 656 2.738 "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
[2021-05-11T10:37:38.959Z] info: ::ffff:127.0.0.1 "GET /api/block/0571d8c24da0c47af8c92c5ac6bf6e3720561bf5f2f144e9ca7f2ea85cb317c3" 200 656 1.724 "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"
[2021-05-1
@vivekteega
vivekteega / flosight.logs
Created May 14, 2021 09:42
Flosight - 2 lines comment - last 1000 lines
[2021-05-14T09:00:54.256Z] info: ::ffff:127.0.0.1 "GET /api/block/52cccfed1de4f88aef8d842739af92fa60d14443800e1e7fe6c943b19fc45d14" 200 666 2.480 "python-requests/2.23.0"
[2021-05-14T09:00:54.276Z] info: ::ffff:127.0.0.1 "GET /api/tx/773fb34ad0af413e4979ebcb84b43d9b096170317f96f78a71030f7058633d8b" 200 927 2.987 "python-requests/2.23.0"
[2021-05-14T09:00:54.302Z] info: ::ffff:127.0.0.1 "GET /api/block-index/3974100" 200 80 0.414 "python-requests/2.23.0"
[2021-05-14T09:00:54.322Z] info: ::ffff:127.0.0.1 "GET /api/block/c308caa48cd172c910d9197dc2868a8d1acec6c9d70d18a752b4847939477c94" 200 667 3.611 "python-requests/2.23.0"
[2021-05-14T09:00:54.343Z] info: ::ffff:127.0.0.1 "GET /api/tx/f74527cd997bc94d74f17cff218f1377b9bed694bb64ae9499b94a08e9baf3e5" 200 912 3.254 "python-requests/2.23.0"
[2021-05-14T09:00:54.368Z] info: ::ffff:127.0.0.1 "GET /api/block-index/3974101" 200 80 0.457 "python-requests/2.23.0"
[2021-05-14T09:00:54.387Z] info: ::ffff:127.0.0.1 "GET /api/block/2c11f22b3e31195d1db6fdc3305ce5743d75
@vivekteega
vivekteega / component.js
Created December 8, 2021 09:52
CC export
const smButton = document.createElement('template')
smButton.innerHTML = `
<style>
*{
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
:host{