Skip to content

Instantly share code, notes, and snippets.

@danfinlay
danfinlay / different_sig_verification.js
Created July 20, 2017 00:20
Another approach to verifying an eth.sign call. I need a test suite on this.
var ethUtil = require('ethereumjs-util')
var address = '0x1dba1131000664b884a1ba238464159892252d3a'
var msg = 'https://www.reddit.com/r/ethereum/comments/6obofq/a_modified_version_of_a_common_multisig_had_a/'
var claimed = '0xe7bf6c80979b6633dc9bdc7ae556f40ceb43eee2ba8b2a7deaf9b838dd8b21d46858b62b0b01b257f7194de03366f09aa89115717f8860b4620d8a6c92cbeec71c'
const msgHash = ethUtil.hashPersonalMessage(new Buffer(msg))
const sigParams = ethUtil.fromRpcSig(claimed)
const publicKey = ethUtil.ecrecover(msgHash, sigParams.v, sigParams.r, sigParams.s)
@danfinlay
danfinlay / check_claim.js
Last active July 20, 2017 00:10
Checking reddit user's claim of being the Parity wallet white hat.
var ethUtil = require('ethereumjs-util')
var address = '0x1dba1131000664b884a1ba238464159892252d3a'
var msg = 'https://www.reddit.com/r/ethereum/comments/6obofq/a_modified_version_of_a_common_multisig_had_a/'
var claimed = '0xe7bf6c80979b6633dc9bdc7ae556f40ceb43eee2ba8b2a7deaf9b838dd8b21d46858b62b0b01b257f7194de03366f09aa89115717f8860b4620d8a6c92cbeec71c'
const msgHash = ethUtil.hashPersonalMessage(new Buffer(msg))
const sigParams = ethUtil.fromRpcSig(claimed)
const publicKey = ethUtil.ecrecover(msgHash, sigParams.v, sigParams.r, sigParams.s)
@danfinlay
danfinlay / baeraer
Created April 27, 2017 22:56
aerarar
0xFDEa65C8e26263F6d9A1B5de9555D2931A33b825
@danfinlay
danfinlay / an-address.txt
Created April 25, 2017 21:34
rinkeby faucet gist
0xF61807b9488374c44a8fE022273855B5fA7E61f3
@danfinlay
danfinlay / GHRegistry.txt
Created March 22, 2017 03:06
An attestation of my ethereum address
flyswatter
0x55e2780588aa5000F464f700D2676fD0a22Ee160
@danfinlay
danfinlay / transaction-polling.js
Last active January 29, 2017 01:48
Simple example of sending a token with ethjs and polling for receipt.
var Eth = require('ethjs')
var tokenAbi = require('human-standard-token-abi')
var tokenAddress = '0x48ff0cbac0acefedf152281ee80e9a0a01d5da63'
var secondAddress = '0xC5b8dBAc4c1d3F152cDeb400E2313F309c410aCb'
var eth, token
window.addEventListener('load', function() {
if (typeof window.web3 !== undefined) {
eth = new Eth(web3.currentProvider)
// Now enjoy! Use it!
@danfinlay
danfinlay / ethjs-token-example.js
Last active July 28, 2017 06:32
ethjs token example
var Eth = require('ethjs')
var tokenAbi = require('human-standard-token-abi')
var tokenAddress = '0x48ff0cbac0acefedf152281ee80e9a0a01d5da63'
var secondAddress = '0xC5b8dBAc4c1d3F152cDeb400E2313F309c410aCb'
var eth, token
window.addEventListener('load', function() {
if (typeof window.web3 !== 'undefined') {
eth = new Eth(web3.currentProvider)
// Now enjoy! Use it!
@danfinlay
danfinlay / guitardino.ino
Last active January 20, 2017 01:06
Guitarduino Basic Analog
#include <toneAC.h>
const int stringInput = A4; // The input pin for the string-like soft pot.
int stringValue = 0; // variable to store the value coming from the sensor
const int pickX = A1; // The input pin for the joystick's X axis.
int pickXCenter = 0;
int pickXValue = 0; // The value of the joystick's X axis.
const int pickY = A2; // Same as above, but for Y.
@danfinlay
danfinlay / Arduino-Print-Analog-to-Console.ino
Last active January 13, 2017 21:12
Arduino-Print-Analog-to-Console
/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().
The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
@danfinlay
danfinlay / contract-error.json
Created December 21, 2016 00:22
metamask browser-solidity compilation error bug
{
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9": {
"address": "0xac39b311dceb2a4b2f5d8461c1cdaf756f4f7ae9",
"name": "Account 1"
},