Skip to content

Instantly share code, notes, and snippets.

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(
[
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:])
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)
@assafmo
assafmo / stride-vanity-address.ts
Last active December 13, 2024 20:35
Create bech32 vanity addresses for testing purposes
// 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)}`);