Skip to content

Instantly share code, notes, and snippets.


Alex Beregszaszi axic

Block or report user

Report or block axic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
axic /
Last active Jun 1, 2019
Eth 2 Phase Crossover EE

"Crossover" EE

The "crossover" execution environment aka Eth1-esque abstraction over Phase2

The current proposals for Eth 2 Phase 2 revolve around a purely stateless architecture, where the only stored information is the state root of each "execution environment" on a shard. This is in stark contrast to the stateful mode of operation on Eth1.

This model expects higher level abstractions to be built atop this simple system. Here follows one proposal to achieve a familiar environment as a higher level abstraction.

View qimalloc.c
* QIMalloc - Quick, incremental malloc.
* This is a dummy malloc implementation, without the option to free memory space.
static int __malloc_ptr = 0;
static int __malloc_end = 0;
void *malloc(size_t size) {
axic / Create2Proxy.sol
Created Feb 28, 2019
CREATE2 proxy for constantinople/petersburg
View Create2Proxy.sol
// CREATE2 proxy for constantinople/petersburg which allows easy deploying of
// contracts using the same address on multiple chains.
// Idea by @Arachnid. Some code by @axic.
pragma solidity ^0.5.0;
contract Create2Proxy {
function() external payable {
assembly {
axic /
Created Jan 9, 2019
Handshake - Keys and Addresses

Handshake - Keys and Addresses

DISCLAIMER: There is no warranty for any of the below be correct, up to date, or valid in any form. This is not a specification, only the braindump of some code digging. In fact it is very likely all of this is incorrect and useless. DO NOT PUT TOKENS INTO ADDRESSES GENERATED USING THE INFORMATION BELOW.

From their website:

Decentralized certificate authority and naming

An experimental peer-to-peer root DNS.

Handshake aims to "airdrop" a large quantity of the tokens to developers (backed by Github and Freenode profiles) or well known people (backed by PGP WoT).

axic /
Last active Jul 17, 2019
ewasm “WRC20” token contract coding challenge

ewasm “WRC20” token contract coding challenge

This document describes a simple contract in pseudocode and gives a couple of test cases for it.

The challenge is designed to be fairly easy to implement in a language of choice, compiled to wasm and interacted with. It is loosely based on the ERC20 token standard, named "WRC20", where the W stands for WebAssembly.

External interface

The contract has two features:

View gist:cc094cf1c339d3fbd5351687ea475cdc
eWASM and Backwards Compatibility
High Level
- ease transition: legacy EVM compatible with eWASM
axic / ERC20SafeTransfer.sol
Last active Jan 26, 2019
Safe transfer workaround for not fully ERC20 compatible tokens.
View ERC20SafeTransfer.sol
* WARNING: Proof of concept. Do not use in production. No warranty.
* Safe transfer workaround for not fully ERC20 compatible tokens.
* Well, ERC20 had a lot of revision, who I am to say something is not compatible :)
* Read the following for more explanation:
* In short:
* The final ERC20 standard (IIRC) requires the transfer function to return a boolean. Some tokens do not return anything
axic / contracthelper.sol
Created Apr 16, 2018
Check if a Solidity contract function is running as part of a constuctor
View contracthelper.sol
* This is a helper to check if a Solidity contract function is running as part of a constructor.
library ContractHelper {
function runningInConstructor() internal view returns (bool ret) {
assembly {
ret := iszero(iszero(extcodesize(address)))
axic /
Last active Jan 26, 2018
"Hello World" in Brainf* compiled to eWASM using
;; "Hello World" in Brainf* compiled to eWASM using
(func $callDataCopy (import "ethereum" "callDataCopy") (param i32 i32 i32))
(func $return (import "ethereum" "return") (param i32 i32))
(global $writeptr (mut i32) (i32.const 1))
(global $readptr (mut i32) (i32.const 0))
(func $getchar
(result i32)
axic / dummymetering.wasmhex
Last active Jan 21, 2018
Dummy eWASM sentinel contract
View dummymetering.wasmhex
You can’t perform that action at this time.