Skip to content

Instantly share code, notes, and snippets.

@3rdstage
3rdstage / contract-meta-famous-paintings.json
Created June 13, 2022 04:48
Sample contract metadata file according to OpenSea guideline
{
"name": "Most Famous Paintings",
"description": "Historically famous and well-knwon paintings",
"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg/606px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg",
"seller_fee_basis_points": 300,
"fee_recipient": "0xAd7A83c471C7E050F7fC9EC2476966d920D88612"
}
var passphrase = 'none';
var accts = personal.listAccounts;
if (accts.length == 0){
var keys = [
"ba75c5fd16ae1151dc9f961e94e219994c6335a5b4148c624142243fb76306d6",
"097dd6aedb87b3b5e541cfb9ef8d4beb7a66084dd80d99c2e51aeabeae320980",
"abae82647f5881a398f7eede8910803d65470a7cbaee9ddda90dcdcdc8dcdacf",
"cc1af47cbc9de0c9a1e1049c1a62ddb9e08440d16093803d74e93f1cea3458ee",
"3e48c4e748b8f5baf6f870c5c4d2a0147390c94e778a9ca67de945bffeb2f72a"
@3rdstage
3rdstage / FunctionBuilder.java
Created April 21, 2020 05:30
Solidity Function Builder class prototype - builder pattern and method chaining style applied
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
#! /bin/bash
function print_help {
echo "Executes some basic Ethereum JSON RPC method to check the specified Ethereum client."
echo ""
echo "Usage:"
echo " $ ${0##*/} [-h | --help | rpc_addr]"
echo ""
echo "If '-h' or '--help' is given, only display this help and quit."
echo "If rpc_addr is given, execute some basic Ethereum JSON RPC "
Data + Nonce SHA-256(Data + Nonce)
Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
Hello, world!2 0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
... ...
Hello, world!4248 0x6e110d98b388e77e9c6f042ac6b497cec46660deef75a55ebc7cfdf65cc0b965
Hello, world!4249 0xc004190b822f1669cac8dc37e761cb73652e7832fb814565702245cf26ebb9e6
Hello, world!4250 0x0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9
Data + Nonce SHA-256(Data + Nonce)
Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
Hello, world!2
0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
fault total recursions messages
1 4 OM(1), OM(0) 4·3 + 4·3·2
2 7 OM(2), OM(1), OM(0) 7·6 + 7·6·5 + 7·6·5·4
3 10 OM(3), OM(2), OM(1), OM(0)
10·9 + 10·9·8 + 10·9·8·7 + 10·9·8·7·6
def mine(full_size, dataset, header, difficulty):
  target = zpad(encode_int(2**256 // difficulty), 64)[::-1]
  from random import randint
  nonce = randint(0, 2**64)
  while hashimoto_full(full_size, dataset, header, nonce) > target:
    nonce = (nonce + 1) % 2**64
  return nonce
fault total recursions
1 4 OM(1), OM(0)
2 7 OM(2), OM(1), OM(0)
3 10 OM(3), OM(2), OM(1), OM(0)
... ...
...
fault total recursions
1 4 OM(1), OM(0)
2 7 OM(2), OM(1), OM(0)
3 10 OM(3), OM(2), OM(1), OM(0)
... ... ...
m 3m + 1 OM(m), OM(m - 1), OM(m - 2), OM(m - 3), ... , OM(2), OM(1), OM(0)