Skip to content

Instantly share code, notes, and snippets.

@JackyWYX
JackyWYX / msafe.ts
Created February 6, 2024 21:55
MSafe wallet account creation
import { PublicKey, SIGNATURE_FLAG_TO_SCHEME } from '@mysten/sui.js/cryptography';
import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519';
import { MultiSigPublicKey } from '@mysten/sui.js/multisig';
import { OwnerWeightPubKey, PublicKeyWithSchema, Weight } from '@/types';
export const NONCE_PREFIX_MAX_SIZE = 16;
export const NONCE_PK_PREFIX = 'maven';
export const NONCE_PK_WEIGHT = 1;
// Build initial transaction block
const builder = new CoinTransferBuilder(mavenInfo.mavenId, mavenAccount.globals, {
coinType: SUI_COIN,
to: receiver,
amount: MIST_PER_SUI,
});
const tb = await builder.createTransactionBlock();
// Add to propose session and simulate
const session = await mavenAccount.proposeTransaction(tb);
@JackyWYX
JackyWYX / metrics.txt
Created October 29, 2021 20:16
prometheus metrics 2
➜ ~ curl localhost:9900/metrics
# HELP hmy_consensus_blskeys list of bls pubkey
# TYPE hmy_consensus_blskeys gauge
hmy_consensus_blskeys{index="0",pubkey="ea5b6acfb9146ef566bf05bc3a806988180684d7494d9bfe765afacfb2d9467de7864ece64b9ab7150c806c549d9b504"} 0
# HELP hmy_consensus_finality the latency of the finality
# TYPE hmy_consensus_finality histogram
hmy_consensus_finality_bucket{le="800"} 0
hmy_consensus_finality_bucket{le="1000"} 0
hmy_consensus_finality_bucket{le="1250"} 0
hmy_consensus_finality_bucket{le="1562.5"} 0
@JackyWYX
JackyWYX / migration.log
Created June 19, 2021 08:26
A complete grepped log during explorer DB migration
{"level":"info","module":"explorer DB migration to 1.0.0","progress":"7642 / 19680","caller":"/home/yx/go/src/github.com/harmony-one/harmony/api/service/explorer/migration.go:102","time":"2021-06-19T07:22:37.435122529Z","message":"migration in progress"}
{"level":"info","module":"explorer DB migration to 1.0.0","progress":"7642 / 19680","caller":"/home/yx/go/src/github.com/harmony-one/harmony/api/service/explorer/migration.go:102","time":"2021-06-19T07:22:39.434900505Z","message":"migration in progress"}
{"level":"info","module":"explorer DB migration to 1.0.0","progress":"7642 / 19680","caller":"/home/yx/go/src/github.com/harmony-one/harmony/api/service/explorer/migration.go:102","time":"2021-06-19T07:22:41.434917233Z","message":"migration in progress"}
{"level":"info","module":"explorer DB migration to 1.0.0","progress":"7642 / 19680","caller":"/home/yx/go/src/github.com/harmony-one/harmony/api/service/explorer/migration.go:102","time":"2021-06-19T07:22:43.435007447Z","message":"migration in progress"}
{"le
@JackyWYX
JackyWYX / Mainnet.md
Last active June 11, 2021 01:58
A complete prometheus metrics for ddos protection
> curl localhost:9900/metrics
# HELP hmy_consensus_blskeys list of bls pubkey
# TYPE hmy_consensus_blskeys gauge
hmy_consensus_blskeys{index="0",pubkey="000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} 0
# HELP hmy_consensus_finality the latency of the finality
# TYPE hmy_consensus_finality histogram
hmy_consensus_finality_bucket{le="800"} 0
hmy_consensus_finality_bucket{le="1000"} 0
hmy_consensus_finality_bucket{le="1250"} 0
▶ curl -d '{
    "jsonrpc":"2.0",
    "method":"hmy_getAllDelegationInformation",
    "params":[
      0
    ],
    "id":1
}' -H 'Content-Type:application/json' -X POST 'localhost:9500'
@JackyWYX
JackyWYX / harmony.log
Created April 9, 2021 19:14
Leader transaction failed log
```
> tail -n 1000 latest/zerolog-harmony.log | grep "worker.go"
{"level":"error","error":"totalRedelegatable: 0, balance: 1180421619000000000000; trying to stake 1180421679000000000000: insufficient balance to stake","stkTxn":{},"caller":"/mnt/jenkins/workspace/harmony-release/harmony/node/worker/worker.go:201","time":"2021-04-09T01:08:21.149715872Z","message":"Staking transaction failed commitment"}
{"level":"error","error":"totalRedelegatable: 0, balance: 1180421619000000000000; trying to stake 1180421679000000000000: insufficient balance to stake","stakingTxID":"0x6f2e066336c343bdfef83316bc2a12231c33c802b89e7e92e924a9be75f92e31","stakingTx":{},"caller":"/mnt/jenkins/workspace/harmony-release/harmony/node/worker/worker.go:169","time":"2021-04-09T01:08:21.149739914Z","message":"Failed committing staking transaction"}
{"level":"error","error":"totalRedelegatable: 0, balance: 3992323449148802484840; trying to stake 3992323509100000000000: insufficient balance to stake","stkTxn":{},"caller":"/mnt/jenkins/works
@JackyWYX
JackyWYX / gist:adba7bf16bccce479045600660d8454b
Created March 12, 2021 06:11
Commit sig and bitmap data
## Commit signature and bitmap
Following is the data I obtained as binary for block number 1 in binary:
Signature bytes from next header:
```
011100001101110110000001111101000001101110110001000001110101100010000010100000101101101111100001001100101000110010100111010100000100000001110001111001000010011010010010011010001000110100011010000101000100101010100111000001001110010100110000101011111000011100101010010111101100010100101010011010001011100010001111100000101101111110010011110100010101110101011000000000101111011100001001011000010001011110111011111000111111011001000101001000110100111110101011101011010110101001010110010000001011010011111110110111100100001110111011001101110111101100100111101110000111000111011110100011000010000101000001101010000011001101001110100110001111000001001110010111011001101110111011101101010001001000110001011110000110001110100001101110101100101100100001011010010011010000000010
```
@JackyWYX
JackyWYX / Play with new CLI.md
Last active August 13, 2020 04:34
Acquire test cli commands

Download node.sh and binary for CLI test

Use an old node.sh

./node.sh -d -U main_v2

Move downloaded file and binarys to current folder:

@JackyWYX
JackyWYX / Hidden flags.md
Last active August 12, 2020 04:28
Harmony Node Binary CLI

Legacy and hidden flags

This document gives a full list of legacy and hidden flags at harmony CLI interface. There are briefly two types of legacy flags:

  1. Flag is only for developer usage, thus is hidden from user to have a simple interface.
  2. Flag is a legacy from previous versions and exist for backward compatibility.

1. Hidden flags

1.1 IP and Port