Skip to content

Instantly share code, notes, and snippets.

View fkbenjamin's full-sized avatar
🤓
Coding

fkbenjamin

🤓
Coding
View GitHub Profile
@fkbenjamin
fkbenjamin / pull_votes_from_chain.go
Created January 31, 2022 14:23 — forked from jeremyletang/pull_votes_from_chain.go
Pull votes for ethereum event on vega chain
package main
import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"path"
const Transport = require("@ledgerhq/hw-transport-node-hid").default;
const bs58 = require("bs58");
const nacl = require("tweetnacl");
const INS_GET_PUBKEY = 0x05;
const INS_SIGN_MESSAGE = 0x06;
const P1_NON_CONFIRM = 0x00;
const P1_CONFIRM = 0x01;
This file has been truncated, but you can view the full file.
{
"genesis_time": "2019-03-20T22:00:00Z",
"chain_id": "gaia-13003",
"consensus_params": {
"block": {
"max_bytes": "200000",
"max_gas": "2000000",
"time_iota_ms": "1000"
},
"evidence": {
This file has been truncated, but you can view the full file.
{
"genesis_time": "2019-03-20T22:00:00Z",
"chain_id": "gaia-13003",
"consensus_params": {
"block": {
"max_bytes": "200000",
"max_gas": "2000000",
"time_iota_ms": "1000"
},
"evidence": {
@fkbenjamin
fkbenjamin / example.go
Created July 12, 2019 13:14
ChainSafe Polkadot Testnet Decoder Example / Issue
package main
import(
"fmt"
"github.com/ChainSafe/gossamer/codec"
"net/http"
"io/ioutil"
"bytes"
"encoding/json"
)
This file has been truncated, but you can view the full file.
{"app_hash":"","app_state":{"accounts":[{"account_number":"679","address":"cosmos1qqp837a4kvtgplm6uqhdge0zzu6efqgujllfst","coins":[{"amount":"60091022","denom":"uatom"}],"delegated_free":null,"delegated_vesting":null,"end_time":"0","original_vesting":null,"sequence_number":"4","start_time":"0"},{"account_number":"678","address":"cosmos1qq2c4klc6q3cu6nay4y08kxpxz7lx6w22f9vfe","coins":[{"amount":"58165690000","denom":"uatom"}],"delegated_free":null,"delegated_vesting":null,"end_time":"0","original_vesting":null,"sequence_number":"0","start_time":"0"},{"account_number":"677","address":"cosmos1qp8danhdx66c9mhnlmsfk9zj45e0yju82r5a7h","coins":[{"amount":"1134000000","denom":"uatom"}],"delegated_free":null,"delegated_vesting":null,"end_time":"0","original_vesting":null,"sequence_number":"0","start_time":"0"},{"account_number":"676","address":"cosmos1qp7mt75j9g3vtq238gkytjc70zpzkz783hhyl2","coins":[{"amount":"11307000000","denom":"uatom"}],"delegated_free":null,"delegated_vesting":null,"end_time":"0","original_vestin
@fkbenjamin
fkbenjamin / redelegate.sh
Last active December 12, 2018 15:47
Auto Redelegation for Cosmos Testnet (Nothing fancy)
read -s -p "Enter Passphrase: " passphrase
chain="gaia-1234"
name="name"
address="cosmos1..."
validator="cosmosvaloper1..."
echo ""
while true
do
echo $passphrase|gaiacli tx dist withdraw-rewards --is-validator --chain-id=$(echo $chain) --from=$(echo $name)
balance=$(gaiacli query account $(echo $address) --trust-node|jq -r '.value.coins[0].amount')
@fkbenjamin
fkbenjamin / propsal_alert.sh
Last active September 5, 2018 21:08
Alerts via SMS if a new proposal on the Cosmos Testnet is found.
#!/bin/bash
phone=$1
last_proposal=$(gaiacli gov query-proposals | tail -1)
echo "Queried last proposal"
echo $last_proposal
while true
do
sleep 10s
new_last_proposal=$(gaiacli gov query-proposals | tail -1)
if [ "$last_proposal" != "$new_last_proposal" ]
#! /bin/bash
echo localhost > nodes.log
while [ -s nodes.log ]
do
# get first node from TODO list and store a copy
node=$(head -n1 nodes.log)
echo "Now accessing node $node."
if grep -Fxq "$node" nl.log
then
# code if found
@fkbenjamin
fkbenjamin / missing_blocks.sh
Last active August 2, 2018 11:53
Monitor missed blocks on gaia-7004 // jq needs to be installed (sudo apt-get install jq)
#!/bin/bash -ex
current_height=1
addr=$(curl -s http://localhost:26657/status | jq -r ".result.validator_info.address")
lbh=$(curl -s http://localhost:26657/status | jq -r ".result.sync_info.latest_block_height")
until [[ $current_height == $lbh ]]; do
precommit=$(curl -s http://localhost:26657/commit?height=$current_height| jq -r ".result.SignedHeader.commit.precommits | .[] | select(.validator_address==\"$addr\")")
if [ -z "$precommit" ]; then
echo "Missed precommit at Block $current_height"
echo "Missed precommit at Block $current_height" >> missing.log
fi