Skip to content

Instantly share code, notes, and snippets.

"""A stateful event scanner for Ethereum-based blockchains using web3.py.
With the stateful mechanism, you can do one batch scan or incremental scans,
where events are added where the scanner left last time.
Copyright 2021 Mikko Ohtamaa, https://twitter.com/moo9000, licensed under MIT
"""
import datetime
import time
@spalladino
spalladino / falsehoods-that-ethereum-programmers-believe.md
Last active May 17, 2024 09:54
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i

@raineorshine
raineorshine / sendRawTransaction.js
Last active December 3, 2022 18:02
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@alanbsmith
alanbsmith / Thin Crust Pizza Recipe.md
Last active August 12, 2017 17:09
My personal pizza recipe

Thin Crust Pizza Recipe

YIELD

This recipe yields 2 14" pizzas 🍕🍕

INGREDIENTS

DOUGH

  • 1 packet yeast
  • 1 tsp sugar (or honey or whatever)
@nonsensery
nonsensery / bigHeads.js
Last active January 15, 2016 23:51
Big Heads for Hangouts
'use strict'
window.bigHeads = window.bigHeads || (function(window, document){
var edgePadding = 10
function makeRect(top, right, bottom, left) {
return { top, right, bottom, left, width: (right - left), height: (bottom - top) }
}
function ftosMaxChars(f, maxChars) {
@Restuta
Restuta / the-bind-problem.jsx
Last active March 16, 2024 00:22
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));
@aphillipo
aphillipo / MainApp.js
Created October 5, 2015 19:26
Wrapping React Native Navigator
class MainApp extends Component {
constructor(props) {
super(props);
}
renderScene(route, navigator) {
var Component = route.component;
return (
<Component route={route} navigator={navigator} />
);
@staltz
staltz / introrx.md
Last active May 17, 2024 07:59
The introduction to Reactive Programming you've been missing
@rcotrina94
rcotrina94 / How to use Images as Radio buttons.md
Last active February 22, 2024 13:29
How to use images for radio buttons (input-radio).
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')