Skip to content

Instantly share code, notes, and snippets.

View frozeman's full-sized avatar

Fabian Vogelsteller frozeman

View GitHub Profile
Mapping
bytes10 + bytes2(0) + <whatever> (bytes20) or bytes20 //
0x112233445566778899001122 0000 000000000000112233445566778899001122
MappingWithGrouping
bytes6 + <whatever> (max bytes4) or bytes4 + bytes2(0) + <whatever> or bytes20 (max bytes20)
0x112233445566 11223344 0000 00000000000000000001122334455667788
@frozeman
frozeman / SymbioticBlockCreation.md
Last active April 25, 2022 22:44 — forked from blazejkrzak/SymbioticBlockCreation.md
Symbiotic block creation with Pandora and Vanguard orchestrated

Block creation

Pandora and Vanguard orchestration when producing a new block.

Terminology

Orchestrator - client written in go. Its responsibility is to orchestrate the Pandora and Vanguard to verify blocks.

Pandora - modified fork of go-ethereum (geth). Responsible to create valid execution blocks. P2P is enabled to share txpool and propagate blocks. It requires symbiotic connection with the orchestrator/validator client.

Vanguard - modified fork of prysm client. Responsible to run consensus algorithm (CASPER) with add execution layer data for shard0.

@frozeman
frozeman / isValidSignature.sol
Created June 25, 2020 11:39
Signature verification in solidity, taken from 0x
/// @dev Verifies that a hash has been signed by the given signer.
/// @param hash Any 32 byte hash.
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof that the hash has been signed by signer.
/// @return True if the address recovered from the provided signature matches the input signer address.
function isValidSignature(
bytes32 hash,
address signerAddress,
bytes memory signature
)
@frozeman
frozeman / ricoABI.json
Created April 29, 2020 10:35
rICO ABI - april 2020
[
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
@frozeman
frozeman / test.js
Created June 13, 2019 12:14
RICO test
Refundable ICO
Test 1
allocation phase
--------
blockNumber: 0
Current Flow: 0.1
investorETH: 100
projectETH: 0
available for project: 0
ETH in RICO: 100
@frozeman
frozeman / rico.md
Last active January 3, 2019 17:50
Reversible ICO - RICO

Reversible ICO

To increase fairness and responsibility in the ICO space, we propose a new model for an ICO, which we call a ”Reversible ICO” (RICO). This type of ICO improves the power balance between coin buyer and project by flowing funds slowly to the project and allowing coin buyers to withdraw their funds at any point in time.

The ERC 20 Token Standard [Fab] spurred a new era of projects that run ICOs on th Ethereum Blockchain. This is mainly due to the flexibility of a smart contract interface standard, meaning it only defines how to interact with it, but not how it should internally work. This flexibility allows ERC 20 tokens to be used in all kind of smart contract based protocol, and be issued by other smart contracts, like an ICO smart contract.

Current ICOs deploy a smart contract that receives ETH and return tokens (cryptocurrencies, assets, utility tokens, protocol tokens, access tokens, etc.) based on a set ratio. This ratio is sometimes changing over time while the ICO is running, and ma

@frozeman
frozeman / whisper-api-test.js
Created June 27, 2017 15:31
Whisper web3.js 1.0 api test
var net = require('net');
var Web3 = require('./src/index.js'); var web3 = new Web3(new Web3.providers.IpcProvider('/Users/frozeman/Library/Ethereum/geth.ipc', net));
var shh = web3.shh;
var identities = [];
var subscription = null;
Promise.all([
shh.newSymKey().then((id) => {identities.push(id);}),
shh.newKeyPair().then((id) => {identities.push(id);})
@frozeman
frozeman / chat.js
Created June 19, 2017 12:52 — forked from bas-vk/chat.js
whisper chat demo
var chat = {
username: "<not set>",
topic: "0xfeedbabe",
key: "",
identity: "",
pollInterval: null,
filter: null,
setUsername: function(name) {
this.username = name;
@frozeman
frozeman / rpc-test.js
Last active January 18, 2018 22:36
Test RPC in node.js
/*
- $ geth --shh
- install node.js and npm
- $ mkdir testFolder
- $ npm install oboe
- $ node
- copy the code below
- exceute: send('eth_blockNumber', []);
*/
@frozeman
frozeman / whisper-api-v5.md
Last active May 17, 2017 14:37
Whisper API spec

Whisper API 5.0

This is the proposed API for whisper v5.

Specs

shh_version

Returns the current semver version number.