Skip to content

Instantly share code, notes, and snippets.

View holiman's full-sized avatar
💭
<i>foo</i>

Martin HS holiman

💭
<i>foo</i>
View GitHub Profile
@holiman
holiman / spam.md
Last active July 16, 2018 16:09
Description of how Ethereum can be used to fight spam

Stopping spam

This blog post by Jonathan Brown suggested replacing SMTP with Ethereum blockchain; specifically, utilizing the log channel to monitor events.

With this approach, emails wouldn't actually be stored within the EVM (Ethereum Virtual Machine) storage, but every email would still be present in the blockchain blocks. The EVM log mechanism would make it simple for a full node to monitor and be alerted whenever an email was submitted.

I don't believe that this would be feasible in the real world, for several reasons

  • There are lots of email being sent, some of them quite large
  • Most people wouldn't want their emails forever on the blockchain, the future resiliency of GPG is unknown, and GPG encryption does not provide perfect forward secrecy. Once a key is compromised, all is revealed.
@holiman
holiman / generic_proxy.sol
Created June 15, 2016 16:32
Example of creating a 'generic' proxy in Solidity/EVM Assembly. Further details at http://martin.swende.se/
contract complex{
address add;
uint aa;
uint bb;
function thrower()
{
throw;
}
contract DeliveryBoy{
/*
* Delivery boy is very important, but not so clever
*/
function deliver(address recipient){
selfdestruct(recipient);
}
}
contract MailMan{
contract DropBox{
/*
Central Bank of Ethereum
A very minimalistic bank/dropbox where Ether can be sent.
This makes it simple for a service to pay recipients without directly
invoking any unknown (potentially hostile) contracts.
Instead, the value transfer becomes a 2-step handover, where the service
deposits to the bank, and the recipient cashes out later.
@holiman
holiman / Cloner.sol
Last active April 9, 2024 16:36
A generic 'cloner' contract which clones other contract instances
pragma solidity ^0.4.4;
contract X{
string junk;
function y() returns(string){
//Uncomment the 'junk' below to make gas-measurements
//junk="0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345

Keybase proof

I hereby claim:

  • I am holiman on github.
  • I am holiman (https://keybase.io/holiman) on keybase.
  • I have a public key whose fingerprint is CA99 ABB5 B36E 24AD 5DA0 FD40 683B 438C 05A5 DDF0

To claim this, I am signing this object:

@holiman
holiman / MultisigWalletAudit.md
Last active February 3, 2021 02:37
This is an audit of the Consensus multisig wallet, by Martin Holst Swende

Background

In EIP-255 , @karalabe proposes a PoA-scheme which reuses the current header-fields. The PoA-scheme has the following scheme to handle forks (caused by malicious minters or general latency):

If the number of authorized signers are N, and we allow each signer to mint 1 block out of K, then at any point in time N-K miners are allowed to mint. To avoid these racing for blocks, every signer would add a small random "offset" to the time it releases a new block. This ensures that small forks are rare, but occasionally still happen (as on the main net). If a signer is caught abusing it's authority and causing chaos, it can be voted out.

This gist outlines another scheme, by using the difficulty header.

Description

/*
This is a script to dump out the 4byte identifier for the last N transactions,
along with some other stats about recent transactions.
execute with
$./build/bin/geth js dumper.js > dump.json
@author mhswende
@holiman
holiman / 10kblocks.json
Created May 8, 2017 11:06
4-byte identifiers, for all calls betweem
{"endblock":3649998,"ids":{"0x00000000":360,"0x005b9b48":3,"0x0121b93f":3,"0x02f2008d":2,"0x03496dae":1,"0x058aace1":8,"0x05f21815":1,"0x07946f50":2,"0x07da68f5":1,"0x07daf2df":3,"0x084da883":1,"0x095ea7b3":312,"0x0a19b14a":346,"0x0d381cad":2,"0x0d59b564":1,"0x0f2c9329":3757,"0x0fb59f95":6,"0x114d081d":4,"0x11610c25":1,"0x11a125ce":4,"0x144fa6d7":2,"0x148105ab":4,"0x154652c8":3,"0x15891148":168,"0x173825d9":2,"0x17be89f0":1,"0x186f161b":11,"0x18cf4469":1,"0x19b667da":1,"0x19c12795":3,"0x1a695230":268,"0x1bbfb029":31,"0x1e9a6950":23,"0x1f21cebb":1,"0x2016890c":1,"0x20987e64":10,"0x20ba018a":1,"0x213ac932":58,"0x219f037a":3,"0x23b872dd":317,"0x257bcd6a":490,"0x25fda176":6,"0x266710ca":1,"0x269673af":1,"0x26cfd794":1,"0x278b8c0e":104,"0x27dc297e":5,"0x29b5b30c":22,"0x29cbdc86":1,"0x29ff4f53":1,"0x2bffc7ed":2,"0x2d580ef6":10,"0x2e1a7d4d":120,"0x2e92abdd":4,"0x2eaed480":1,"0x2ebec916":1,"0x2f54bf6e":1,"0x303017bd":1,"0x30301aa0":1,"0x303029ef":1,"0x30302bee":1,"0x30303614":1,"0x30303a3d":1,"0x30303c6a":1,"0x30303c