Skip to content

Instantly share code, notes, and snippets.

@Terryhung
Terryhung / api test
Created September 22, 2021 17:04
api test
curl -X POST \
https://enurl.app/v1/anon_shorten \
-H 'Accept: */*' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: enurl.app' \
-H 'Postman-Token: fee2d748-ebe7-46d7-a2bd-0189567bb524,48e1c73d-c1b3-4eb4-a006-3692a27f9fa8' \
-H 'User-Agent: PostmanRuntime/7.15.0' \
-H 'accept-encoding: gzip, deflate' \
server:
http_listen_address: 0.0.0.0
http_listen_port: 9080
positions:
filename: /tmp/positions.yaml
clients:
- url: url
@Terryhung
Terryhung / chain_economics.csv
Created December 3, 2024 08:06
Sample of Chain Economics in Filecoin Chain data
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
"height","parent_state_root","circulating_fil_v2","vested_fil","mined_fil","burnt_fil","locked_fil_v2","fil_reserve_disbursed"
"4154762","bafy2bzacebstn4dpyny73ozxzq6hpnz4yvytix63oslanrcxdkhvjxzwshcti","623284908252744326878977551","450295821935267947743676766","348404017742368660828809424","39928283798894336996226546","152553266587771349927345139","17066618961773405230063046"
"4154763","bafy2bzaceckv4uuudwpidkeumk45iburvpmnwxu3xqzzv2lusbq7yphjbuphw","623284981586766250215024455","450295886909432870371784325","348404068754087742681107067","39928283798894618232865446","152553309239633149835064537","17066618961773405230063046"
"4154764","bafy2bzacedbhpnl3jw3w33huiicf3m575vdnutlyg2eemnamaf4rjzjyfi3xq","623285046917867302842419582","450295951883597792999891884","348404076041404446675331151","39928283798894778457113346","152553316170013563605753153","17066618961773405230063046"
"4154765","bafy2bzaceastgsdb5pa27ft362k77humrqmvdhw2uwb7pzx5ahz3hj2kypmmk","623285109597090009894423847","450296016857762715627999443","34

Lily Mainnet Maintenance

Hardware Minimum Requirements

You'll need a machine with at least 24 cores, 512GB RAM, and a 1TB (or bigger) hard drive with 10,000+ IOPS.

Installation Installation Dependencies

Instal related packages

$ apt update
$ apt install -y build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev g++ gcc libc6-dev pkg-config aria2

加密貨幣期貨現貨套利策略簡報

策略簡介

  • 策略名稱: 加密貨幣期貨現貨套利(Funding Rate 套利)
  • 策略目標:
    透過對沖現貨與期貨倉位,在永續期貨資金費率機制下捕捉收益。
  • 基本概念:
    • 當 funding rate 為正:多頭支付費用,空頭獲得收益 → 策略:做空期貨、持有現貨
    • 當 funding rate 為負:反之則操作 → 策略:做多期貨、空現貨
@Terryhung
Terryhung / review.md
Last active April 1, 2025 17:52
Test Review

func updateSafrole (Safrole)

處理與 Safrole 協議相關的狀態更新。Safrole 負責驗證者的選擇、輪換和 Ticket 管理

目的是根據最新的 slot、entropy、offenders 以及 extrinsics 中提交的 tickets 來更新 Safrole 狀態。最終返回更新後的 SafrolePostState,並根據不同條件可能附帶返回 epochMark 以及 ticketsMark

架構

  1. 初始化與驗證: 讀取配置、計算當前與新 epoch/phase,並驗證 slot 以及 extrinsics 的合法性。

  2. VRF:

@Terryhung
Terryhung / state_check.md
Created April 2, 2025 17:38
test state check in each mode

Fallback

ParentHash
ParentStateRoot
ExtrinsicHash
Slot

Safrole

包含 Fallback 所有 fields