This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pnpm init | |
// pnpm i -D bech32 ts-node @types/node | |
// npx ts-node stride-vanity-address.ts | |
import { bech32 } from "bech32"; | |
// Debug: Test all possible values to find what maps to "1" | |
for (let i = 0; i < 32; i++) { | |
const test = bech32.encode("stride", [i]); | |
console.log(`Value ${i} maps to ${test.charAt(7)}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestVerifySignature(t *testing.T) { | |
txBytes := []byte{ | |
10, 234, 1, 10, 131, /// ... | |
} | |
cdc := MakeEncodingConfig() | |
var tx sdktx.Tx | |
err := cdc.Codec.Unmarshal(txBytes, &tx) | |
require.NoError(t, err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eth_address = "0x" + hex(keccak256(pubkey_raw)[-20:]) | |
cosmos_address = bech32(prefix, ripemd160(sha256(pubkey_compressed))) | |
cosmos_evmos_address = bech32(prefix, keccak256(pubkey_raw)[-20:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fromBase64, fromHex, toBase64, toHex } from "secretjs"; | |
import { TxRaw } from "secretjs/dist/protobuf/cosmos/tx/v1beta1/tx"; | |
import { sha256 } from "@noble/hashes/sha256"; | |
async function main() { | |
const txhash = | |
"2b324cd8d36ace2ff1d26145df2109bbaec9d508aa465d36ff88fcd72aa985a8".toUpperCase(); | |
const tcpStream = fromHex( | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Usage: ./whisper3-json-to-srt.py output.json > output.srt | |
import sys | |
import json | |
if len(sys.argv) > 1 and sys.argv[1] != '-': | |
with open(sys.argv[1]) as file: | |
data = json.load(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run this code with `ts-node main.ts` | |
import { IbcClient, Link } from "@confio/relayer"; | |
import { stringToPath } from "@cosmjs/crypto"; | |
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; | |
import { GasPrice } from "@cosmjs/stargate"; | |
import Long from "long"; | |
import { fromHex } from "secretjs"; | |
export async function createIbcConnection(): Promise<Link> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fatal error: unexpected signal during runtime execution | |
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7f12160ac000 pc=0x7f125f3d931f] | |
runtime stack: | |
runtime.throw({0x1c913b1?, 0x7f125f3d92d6?}) | |
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0x7f12168aacd0 sp=0x7f12168aaca0 pc=0x44189d | |
runtime.sigpanic() | |
/usr/local/go/src/runtime/signal_unix.go:819 +0x369 fp=0x7f12168aad20 sp=0x7f12168aacd0 pc=0x458389 | |
goroutine 1 [syscall]: | |
runtime.cgocall(0x187fe50, 0xc004846138) | |
/usr/local/go/src/runtime/cgocall.go:158 +0x5c fp=0xc0048460a0 sp=0xc004846068 pc=0x40b79c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
BroadcastMode, | |
coinsFromString, | |
SecretNetworkClient, | |
Wallet, | |
} from "secretjs"; | |
import { BaseAccount } from "secretjs/dist/grpc_gateway/cosmos/auth/v1beta1/auth.pb"; | |
import { AminoWallet } from "secretjs/dist/wallet_amino"; | |
function sleep(ms: number) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch $'curl -s localhost:26657/status | | |
jq .result.sync_info.latest_block_time | | |
perl -pe "s/\.\d+Z/Z/" | | |
jq -r \'"Last block: " + (now - (. | fromdate) | floor | tostring) + " seconds ago"\'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/assafmo/01d7ee0d131a99518d2a4189a9250460 | |
BLOCK_WINDOW="${1}" # e.g. 100000 blocks in the past | |
UPGRADE_TIME="${2}" # e.g. 2023-03-02T19:07:13Z | |
LCD="${3}" # e.g. https://lcd.secret.express or https://api.pulsar.scrttestnet.com | |
LATEST="$(curl -s "$LCD/cosmos/base/tendermint/v1beta1/blocks/latest")" |
NewerOlder