Skip to content

Instantly share code, notes, and snippets.

View obycode's full-sized avatar

Brice obycode

View GitHub Profile

Keybase proof

I hereby claim:

  • I am obycode on github.
  • I am obycode (https://keybase.io/obycode) on keybase.
  • I have a public key ASAMBtx_fzUcmRnprB8YqwISnj3igGDJ2TCUpIN1dlRrbgo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1GrN9mLeqtHsTX9a15vDT7wXinVQHF7VYX https://explorer.blockstack.org/address/1GrN9mLeqtHsTX9a15vDT7wXinVQHF7VYX
Verifying my Blockstack ID is secured with the address 1JYJoyBvMkqNvnmK8NaD18SwLsMpXUCqEM https://explorer.blockstack.org/address/1JYJoyBvMkqNvnmK8NaD18SwLsMpXUCqEM
Verifying my Blockstack ID is secured with the address 1JYJoyBvMkqNvnmK8NaD18SwLsMpXUCqEM https://explorer.blockstack.org/address/1JYJoyBvMkqNvnmK8NaD18SwLsMpXUCqEM
@obycode
obycode / DAP
Created May 18, 2022 19:26
This is a sample series of DAP packets to test the clarinet DAP debugger
Content-Length: 412
{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"clarinet","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true},"type":"request","seq":1}Content-Length: 304
{"command":"launch","arguments":{"type":"clarinet","request":"launch","name":"Call .foo.bar","manifest":"/home/brice/work/debugger-demo/Clarinet.toml","expression":"(contract-call? .foo hello .bar)","__configurationTarget":5,"__sessionId":"a76fc891-252b-4982-9a2c-3780e76afc50"},"type":"request","seq":2}Content-Length: 219
{"command":"setBreakpoints","arguments":{"source":{"name":"bar.clar","path":"/home/brice/work/debugger-demo/contracts/bar.clar"},"lines":[19],"breakpoints":[{"line":19}],"sourceModified":false},"type":"request","seq":3}Content-Length: 89
{"comm
@obycode
obycode / mock-miner.md
Last active October 20, 2022 14:57
How to run a Stacks mock miner

First, build stacks-node:

cd testnet/stacks-node
cargo build --features monitoring_prom,slog_json --release
# if build is successful, stacks-node is in stacks-blockchain/target/release/

Then, make sure you have the chainstate. A snapshot can be downloaded from the Hiro Archiver.

@obycode
obycode / block-costs.py
Last active October 4, 2023 14:26
Check the fullness of a block
import requests
import argparse
from datetime import datetime, timedelta
from termcolor import colored
def time_ago(epoch_timestamp, current_time=None):
timestamp = datetime.utcfromtimestamp(
epoch_timestamp
) # Convert epoch to UTC datetime
@obycode
obycode / block-checker.js
Last active January 19, 2024 21:49
Block Fee Analysis
const axios = require("axios");
async function fetchTransactionsAndFeeRates(baseUrl, blockHeight) {
let offset = 0;
const limit = 50; // Batch size
let totalCount = 0;
let isFirstRequest = true;
let feeRates = [];
while (isFirstRequest || offset < totalCount) {
@obycode
obycode / bootup.md
Last active March 8, 2024 14:12
Epoch 3 testnet boot up
  1. The stacks-node mines blocks up to epoch 2.5 height at which point, pox-4 is deployed (along with other new boot contracts)
  • Look for:
    Applying epoch transition, new_epoch_id: 2.5, old_epoch_id: 2.4
    
  • Note: This happens during reward cycle 6 with the default test config (20 block cycles with 5 block prepare phases)
  1. Before the prepare phase starts, stackers must successfully call stack-stx
  • Look for something similar to:
    Contract-call successfully processed, txid: adc91171be4f7edb614f80d3707f75f3cc29650f88ff791133f55ebd71e24108, origin: STRYYQQ9M8KAF4NS7WNZQYY59X93XEKR31JP64CP, origin_nonce: 0, contract_name: ST000000000000000000002AMW42H.pox-4, function_name: stack-stx, function_args: [u1000080000000000, (tuple (hashbytes 0x31ef5ee9a226a792b93f2bfbfbc54f523eba7818) (version 0x00)), u109, u2, (some 0x331cb6e41dcb335f6851bb42e6dc39816ad4a2fe3bda4c8836f43e51fec9c2e401a35ef7b676af27214716ce8e22e57fdc60b1a29f087b031a6486e2989d5fcc01), 0x038e3c4529395611be9abf6fa3b6
    
#!/bin/bash
# Variables
FILE="stacks-core-log.txt"
START_TIME="2024-10-08T16:40:00.000000000Z"
END_TIME="2024-10-08T16:50:00.000000000Z"
OUTPUT_FILE="results.txt"
# Get file size
FILE_SIZE=$(stat -c%s "$FILE")