Skip to content

Instantly share code, notes, and snippets.

typed-data-encoder example

  1. Clone this gist and cd into the directory.
  2. yarn
  3. node genTypedData.js to print the JSON payload
  4. Paste a signature into verifyTypedData.js
  5. node verifyTypedData.js to print the signer address for the pasted signature
@yondonfu
yondonfu / start_and_monitor_livepeer.sh
Last active June 21, 2021 20:26
Bash script to start livepeer and monitor logs for CUDA_ERROR_ILLEGAL_ADDRESS
#!/bin/bash
# Usage: ./start_and_monitor_livepeer.sh <LIVEPEER_ARGS>
# <LIVEPEER_ARGS> should be the flag arguments you would use with the livepeer binary
# Ex. `livepeer -network mainnet -orchestrator -transcoder` would instead be:
# `./start_and_monitor_livepeer.sh -network mainnet -orchestrator -transcoder`
trap cleanup EXIT
livepeer_args=$@
@yondonfu
yondonfu / README.md
Last active January 22, 2023 19:56
Mark expired tickets

This gist contains a script for marking expired tickets in a node's DB so the node does not continuously try to redeem tickets that have expired. This will be fixed in the node in an upcoming release, but for now you can use this script to address this issue.

Usage

First, make sure you have sqlite3 installed. You can check by running which sqlite3 and if there is a path returned you have sqlite3 installed. If you do not have sqlite3 installed:

  • OSX: brew install sqlite3
  • Ubuntu: apt-get install sqlite3
  1. git clone https://gist.github.com/ea57cfe9510b6526288d456229a3d61e.git
@yondonfu
yondonfu / main.go
Last active November 20, 2019 15:17
Orchestator selection
package main
import (
// "encoding/csv"
// "encoding/hex"
"encoding/csv"
"encoding/hex"
"fmt"
"log"

Roll Up Meeting 0 Agenda

Meeting Time/Date: Thursday 13 Sept 2018 at 12:00 UTC

Agenda

  1. Introductions
  2. zknifty update
  3. Requirements for zknifty to become good PoC example of an application using roll_up
  4. How do we get to minimal viable roll_up?

The findings below pertain to the Livepeer protocol smart contract code at Git commit hash 2889ad2d5f20507d58701acf4d47a0551e593c04.

Findings

1. If a registered transcoder A is delegated to another registered transcoder B, transcoder A will not be able to claim its reward cut as a transcoder

Description

Whenever a transcoder calls BondingManager.reward(), the newly minted inflationary tokens are placed in a reward pool for the round in which the tokens were minted. Both transcoders and delegators claim their reward shares for reward pools in past rounds by either explicitly

res=$(curl -s -X POST -H "Content-Type: application/json" localhost:8545 --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' | jq '.result')
temp=${res%\"}
temp=${temp#\"}
blk=${temp:2}
blk=$((0x${blk}))
while (( $blk <= 5264265 ))
do
echo $blk
sleep 2
const abiDecoder = require("abi-decoder")
const ABI = require("./JobsManager.json")
const main = async data => {
abiDecoder.addABI(ABI)
const decoded = abiDecoder.decodeMethod(data)
console.log(decoded)
}
@yondonfu
yondonfu / keybase.md
Created January 12, 2018 03:00
Keybase

Keybase proof

I hereby claim:

  • I am yondonfu on github.
  • I am yondon (https://keybase.io/yondon) on keybase.
  • I have a public key whose fingerprint is 97FC 1D37 94EC 6B9F 930B 6245 ECDC C2B1 0013 32F9

To claim this, I am signing this object:

# Run with geth 1.7.2-unstable
# Go contract bindings generated with abigen
node scripts/parseTxData.js 09633db800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000e0f1f6b7c1b634ae7f7a2b6a0ade62dbf993f143415b94498c01fc71954521f4352702376a74866efb182ca7d2a932c122fd02f650a61230f7f428e0fc1c9b1a87000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002e516d56684b50686f447976613257797447585241527462633257454c69466959477a58554e5368423738546e6647000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004106a0ab7f19817c671bdc5971a98a03e24e434c9c00faffacb426a85b04b2d4ac4eb009c10538c72069b7de451fe249256f1035d065c5a7e079a45d707c5cd4c8000000000000000