Skip to content

Instantly share code, notes, and snippets.

View gavofyork's full-sized avatar

Gavin Wood gavofyork

View GitHub Profile
@gavofyork
gavofyork / solidity-original
Last active October 14, 2022 14:13
solidity
**NOTE. This was first published by Gavin Wood on the cpp-ethereum wiki on August 29th, 2014. The original can be retrieved from the [git repo](https://github.com/ethereum/cpp-ethereum.wiki.git)**. Shouts to Lefteris, Christian and Liana for implementing it!
An ABI is intended to serve as the de facto method for encoding & decoding data into & out of transactions.
For this ABI, contracts are treated as objects. They export a particular interface, not dissimilar from that of an OO language, for example for a contract `Foo`:
```
contract Foo
{
function sam(string32 in1) { ... }
JSON.stringify(web3.eth.getBlock(2686351).transactions.map(t => web3.eth.getTransactionReceipt(t)))
"[{"blockHash":"0xf8cc76d0d05cc059893d979569f7637f32f415496a250c0e1bd35976e7a67151","blockNumber":2686351,"contractAddress":null,"cumulativeGasUsed":28210,"gasUsed":28210,"logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0xd6025228164e7c8efd1c93e055dc8bd89900a542d86ce3e3c952d0b54cc3bdfc","transactionHash":"0x4ef7fd73084b5665dfa63450af2a7d2a2ce0bbf38aa4189555303fb81f0532f4","transactionIndex":0},{"blockHash":"0xf8cc76d0d05cc
This file has been truncated, but you can view the full file.
Import Failure InvalidReceiptsStateRoot
Guru Meditation #00504980.16cbb233…
✘ 00:55:44|alethzero Report:
{
"block" : "f90293f901ffa09ff4de714e01da9f8b61992efdab9b51ca14ac42d43f4c24df1d002a1239b1e9a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347941cdc8315bdb1362de8b7b2fa9ee75dc873037179a0287172322ed7156590d814f5802af4c4020f747fbf3dee1a18455dfb1c3994f6a0f6fc8fd03dbdfa29d5e5bed1decf1ec134066cca419e3da35df40a8664c214e8a0c6567a388fe7e8ef317918fcfc0c1d127462cee0cdfe4aad61ddaca11cd746ecb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@gavofyork
gavofyork / witness
Created August 23, 2015 11:49
The Witness Algorithm: Privacy Protection in a Fully Transparent System
# The Witness Algorithm: Privacy Protection in a Fully Transparent System
By **Vlad Gluhovsky** and **Gavin Wood**
# Introduction
Being based upon a quasi-Turing-complete (quasi because it's actually bounded) virtual machine, Ethereum is an extremely versatile system. However one of its greatest strengths---universal auditability---seems to lead to a fatal flaw, namely an inescapable lack of privacy. Here we demonstrate an algorithm in order to prove that this is not the case.
The algorithm could be used to make an Ethereum contract which, given two sets of addresses sources, `src`, and destinations, `dest`, will guarantee exactly one of two possible eventualities:
- For each address in `src`, the controller of that address controls a corresponding address in `dest` (though the two cannot be related *a priori*).
[
"0xd4fe7bc31cedb7bfb8a345f31e668033056b2728",
"0xb3fb0e5aba0e20e5c49d252dfd30e102b171a425",
"0x2c19c7f9ae8b751e37aeb2d93a699722395ae18f",
"0xecd135fa4f61a655311e86238c92adcd779555d2",
"0x1975bd06d486162d5dc297798dfc41edd5d160a7",
"0xa3acf3a1e16b1d7c315e23510fdd7847b48234f6",
"0x319f70bab6845585f412ec7724b744fec6095c85",
"0x06706dd3f2c9abf0a21ddcc6941d9b86f0596936",
"0x5c8536898fbb74fc7445814902fd08422eac56d0",
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="500"><defs/><g><g transform="translate(250,250)"><g transform="rotate(0,0,0) translate(0,-242)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 8 0 A 8 8 0 1 1 7.999996000000333 -0.007999998666671365"/></g><g transform="rotate(5.070422535211267,0,0) translate(0,-242)"><path fill="#e6007a" stroke="none" paint-order="stroke fill markers" d=" M 4 0 A 4 4 0 1 1 3.9999980000001667 -0.003999999333335683"/></g><g transform="rotate(10.140845070422534,0,0) translate(0,-242)"><path fill="#e6007a" stroke="none" paint-order="stroke fill markers" d=" M 4 0 A 4 4 0 1 1 3.9999980000001667 -0.003999999333335683"/></g><g transform="rotate(15.211267605633806,0,0) translate(0,-242)"><path fill="#e6007a" stroke="none" paint-order="stroke fill markers" d=" M 4 0 A 4 4 0 1 1 3.9999980000001667 -0.003999999333335683"/></g><g transform="rotate(20.28169014084507,0,0) translate(0,-242)"><path fi
➜ offline-phragmen git:(gav-subids) ✗ cargo run -- --network polkadot --at 9cba39fee8cd98da4b0cee583ca5841ff6cce87d3b078fbc67fa27be35f8d110 staking --count 197 --reduce --iterations 0
warning: unused import: `Style`
--> src/network.rs:12:25
|
12 | use ansi_term::{Colour, Style};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: function is never used: `query_info`
➜ offline-phragmen git:(gav-subids) ✗ cargo run -- --network polkadot --at 9cba39fee8cd98da4b0cee583ca5841ff6cce87d3b078fbc67fa27be35f8d110 staking --count 197 --reduce --iterations 100
warning: unused import: `Style`
--> src/network.rs:12:25
|
12 | use ansi_term::{Colour, Style};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: function is never used: `query_info`
39040031805ac57b11f08d45a9ce1f8f83128f729ebf82ea43be5b392547691ac51b00db2e67a09b1d0e805b61166185c1542fe4ecf2c42e44c684ef0588b9aa3d5302558a079c12e32a87518dcf292728b8b1b33c15da34773175f5c0e9b3b0657002a066542204f9de0d283352ecab65b01b73edf42a207df35d944bf4ab2896710425974163400e75234a829aac61e26a270b426d1d85341a3d9c0715ee64c8760485e39a6a05e8afc9067a1e2d2532078528fda04b2c6307a8fa0f8909e1082f04e8d6142fe5832dee07cc37ab997153cd9de2db5969b685800d995d59b0160a04e8d6148618ba57fe1b57dca5f7d64018ab49d7f41fdbb08c55e6562eff2d7005095ecece751cfdb5a0d8b04c40735b0ec9f120c4dc4d0e5bbb06a8c6c47f0806dcf0a0be1fc37194141915b5b85f478086db021a52f406930567e76a7907b207b778e38c0cc56969c4a645dc77407af778d32002ed3caadf13bc04d77830c3080cff9ca0965c7f6ac6e847975ed2acb15720f4a8f79467bddb70c3a04f7cbf080cffa3fbbf5d805e6ada1cacbc4fdbb227b2679579112a2766543e0a75d7d8080d05bce9994b49a9acf0336cc021a47dcfe5dac3500aa3ad5632e37a702077080d05c3967f5001ee681db6ab7fa59c96285074fdb3775b1e25ffea6b6b8f2e080d05ca557a885e1c472add0a9d8f7ec90481ff2294a94587bdf02daa08
error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
|
= note: "arm-linux-gnueabihf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/usr/local/rustup/toolchains/1.41.1-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.0.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.1.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.10.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.11.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.12.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polkadot_cli.polkadot_cli.nxg2vjwc-cgu.13.rcgu.o" "/home/rust/src/target/armv7-unknown-linux-gnueabihf/release/deps/polk