Skip to content

Instantly share code, notes, and snippets.

@axic
axic / README.md
Last active December 15, 2021 03:14
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:

@amiller
amiller / TinyDuplex.sol
Last active May 13, 2019 20:38
TinyDuplex.sol: minimalist duplex micropayment channel for Ethereum
pragma solidity ^0.4.22;
// ECE 398 SC - Smart Contracts and Blockchain Security
// http://soc1024.ece.illinois.edu/teaching/ece398sc/spring2018/
// Simpest possible duplex-micropayment channel
// - Funded with an up front amount at initialization
// - The contract creator is called "alice". The other party, "bob", is passed
// as an argument to the Constructor
// - There is no fixed deadline, but instead any party can initiate a dispute,
// which lasts for a fixed time
@GNSPS
GNSPS / ProxyFactory.sol
Last active October 9, 2021 08:47
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.5]
/***
* Shoutouts:
*
* Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
* Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here: https://gist.github.com/izqui/7f904443e6d19c1ab52ec7f5ad46b3a8
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe: https://github.com/gnosis/gnosis-safe-contracts
*
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory: https://github.com/gnosis/gnosis-safe-contracts/blob/master/contracts/ProxyFactory.sol
@danfinlay
danfinlay / sendMutableTransaction.md
Last active January 17, 2018 01:41
An idea for a new web3 method, sendMutableTransaction

New Web3 Method Proposal: sendMutableTransaction

Today, when a dapp calls eth_sendTransaction, the parameters are sent up to the signer, and the app is called back once, with the resulting transaction hash.

This is a great way to allow a dapp to track the progress of a signed transaction, assuming that transaction is static and not mutable.

Recent transaction backlogs have forced us at MetaMask to add a button on long-pending transanctions to "Retry with higher gas price", but if a dapp or service was tracking the signed transaction by hash, it has no way of discovering that this transaction was ever resubmitted successfully.

This is only a problem for apps that submit a transaction, and continue tracking that specific transaction hash until it is mined, but for dapps with that problem, one solution could be to add a new method, maybe called eth_sendMutableTransaction, which calls back not wit

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider("http://localhost:8545"))
PERCENTILE = 0.6
NUMBLOCKS = 43200
# NUMBLOCKS = 1000
def getMinGasPrice(block):
minPrice = None
// https://www.reddit.com/r/ethdev/comments/7jyzlw/50_in_ether_prize_for_puzzle_in_this_tweet/
// npm i bip39 ethereumjs-wallet allcombinations shuffle-array
const bip39 = require("bip39");
const hdkey = require('ethereumjs-wallet/hdkey');
const allcombinations = require('allcombinations');
const shuffle = require('shuffle-array');
let words = 'bright summer public tenant avocado chef depend romance school reason help start';
@zsfelfoldi
zsfelfoldi / ulc.txt
Last active February 19, 2018 10:09
Here are some pointers to implementing the ULC mode. Just take a look at the relevant code, then feel free to ping me whenever you have questions (I guess it will happen a few times, I tried to document the most important parts but some of the code is still a bit messy, which I apologize for in advance).
- adding the ultra light client option:
Add an extra option for light client mode where the user can specify a text/json ULC config file that contains a list of trusted server enodes and N out of M parameters (which may depend on how many servers we are connected to, there may be 5 servers listed but we can still accept 2 out of 3 connected).
Geth parameters are implemented like this:
https://github.com/ethereum/go-ethereum/blob/master/cmd/utils/flags.go#L162
Search for LightModeFlag or LightServFlag to find out how it is wired through the code.
- requesting signed headers
pragma solidity ^0.4.18;
library BytesUtils {
struct slice {
uint len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
@saguinav
saguinav / Example.java
Created June 15, 2017 02:09
Polymorphic deserialization with Moshi
package com.square.moshi.example;
import com.squareup.moshi.RuntimeTypeJsonAdapterFactory.RuntimeType;
public class Example {
static class Animal {
String type;
String name;

Release 1.6 call

In a nutshell: the 1.6 release will be an API breaking release. All minor future releases will be similar; they mark the dawn of breaking API changes and new features will be developed on top of those. Critical- and security issues will be backported to the previous release (i.e. we will continue to support the last two versions).

Notes (20 Feb 2017):

  • Whisper v5 should make its first alpha appearance in Geth v1.6.0. This may require some code modifications from people already using v2 of the protocol, so ideally we'd need either a documentation for v5, a transition document from v2->v5, or preferrably both.
  • New flag --mode={full, light, fast}. Deprecate --fast, --light. Default --mode=fast.
  • Optionally switch to a new logging system, retain the vmodule and have structured logging
  • 1.6 no changes to the geth subcommand system. @basvk will write up a proposal for 1.7