Skip to content

Instantly share code, notes, and snippets.

@benjaminion
benjaminion / kraken_tracker.php
Created April 24, 2017 14:07
PHP script for checking asset balances at Kraken and private ETH accounts
<html>
<head>
<title>Kraken tracker</title>
<style>
td.curr {text-align:right;}
td.rate {text-align:right;}
th {text-align:left;}
</style>
<meta name="viewport" content="width=400"/>
</head>
@benjaminion
benjaminion / set_up_cpp_eth.js
Last active July 30, 2017 19:25
Demo code for web3.js error message
var Web3 = require('web3');
var net = require('net');
//var web3 = new Web3('http://localhost:8545');
var web3 = new Web3(new Web3.providers.IpcProvider('/tmp/testeth/geth.ipc', net));
var params = {
sealEngine: 'NoProof',
options: {},
params: {
accountStartNonce: '0x',
@benjaminion
benjaminion / gist:235c8b31c32482c92d0172ab27dbab9a
Created October 6, 2017 08:08
Set up Quorum 7nodes example without using Vagrant
git clone https://github.com/jpmorganchase/quorum-examples
cd quorum-examples/vagrant/
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y build-essential unzip libdb-dev libsodium-dev zlib1g-dev libtinfo-dev solc sysvbanner wrk
wget -q https://github.com/jpmorganchase/constellation/releases/download/v0.0.1-alpha/ubuntu1604.zip
unzip ubuntu1604.zip
int a; int b; int c;
for (k = 0; k < n; ++k) {
for (i = 0; i < n; ++i) {
a = d[i * n + k];
if (a == INF) continue;
for (j = 0; j < n; ++j) {
b = d[i * n + j];
c = d[k * n + j];
if (c == INF) continue;
@benjaminion
benjaminion / get_entrants.js
Last active April 3, 2018 07:37
Get `entrants_` list from the theCyberGatekeeper contract. Run with `node get_entrants.js`. Insert a node's RPC or IPC interface before using - Infura is convenient, and you can leave that in place if you like.
// Prints out all members of the `entrants_` list in order of appearance
// from the theCyberGateKeeper contract.
// Insert a node's RPC or IPC interface
const RPC_URL = 'https://mainnet.infura.io/';
// The theCyberGateway contract
const CONTRACT = "0x44919b8026f38D70437A8eB3BE47B06aB1c3E4Bf";
const IDX = "0000000000000000000000000000000000000000000000000000000000000001";
@benjaminion
benjaminion / boilerplate.txt
Created December 5, 2018 17:54
Search for source files lacking the copyright boilerplate
/*
* Copyright 2018 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
@benjaminion
benjaminion / OptionalLong.java
Created March 1, 2019 12:17
Source code of OptionalLong
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.util;
import java.util.function.LongConsumer;
import java.util.function.LongSupplier;
import java.util.function.Supplier;
did:muport:QmQjwBnKvrymWsS7WF2D1AHgubYXnSLCVyzJLkGQ9ByjSd
@benjaminion
benjaminion / BLSTestSuite.java
Created July 10, 2019 15:26
Ingesting the Eth2 reference tests
/*
* Copyright 2019 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
@benjaminion
benjaminion / aggregate_pubkeys.yaml
Created August 1, 2019 17:44
I had to add line 9 `AggregatePubkeys:` to get `PrepareTests` to grok it
title: BLS aggregate pubkeys
summary: BLS Aggregate public keys
forks_timeline: mainnet
forks: [phase0]
config: mainnet
runner: bls
handler: aggregate_pubkeys
test_cases:
- input: ['0xa491d1b0ecd9bb917989f0e74f0dea0422eac4a873e5e2644f368dffb9a6e20fd6e10c1b77654d067c0618f6e5a7f79a',
'0xb301803f8b5ac4a1133581fc676dfedc60d891dd5fa99028805e5ea5b08d3491af75d0707adab3b70c6a6a580217bf81',