Skip to content

Instantly share code, notes, and snippets.

View frozeman's full-sized avatar

Fabian Vogelsteller frozeman

View GitHub Profile
@frozeman
frozeman / test-genesis.json
Created August 10, 2015 15:22
Test genesis block
{
"nonce": "0x0000000000000042",
"difficulty": "0x1",
"alloc": {
"990ccf8a0de58091c028d6ff76bb235ee67c1c39": {
"balance": "200909800000000000000000000"
},
"343c98e2b6e49bc0fed722c2a269f3814ddd1533": {
"balance": "1000009800000000000000000000"
}
@frozeman
frozeman / isSynching.md
Last active September 9, 2015 15:04
eth_isSyncing proposal

This method should notify a dapp when the node is syncing (e.g. importing more than 10 blocks), so that dapps can stop asking nodes or process incoming blocks for performance reasons.

We might add fields in the future for state db syncing.

eth_syncing

Returns an object object with data about the sync status.

@frozeman
frozeman / MyToken.js
Last active March 9, 2018 09:20
MyToken solidity contract
/*
This creates a public tradeable fungible token in the Ethereum Blockchain.
https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs
Unmodified this will create a cryptoasset with a fixed market cap
wholly owned by the contract creator. You can create any function
to change this contract, like allowing specific rules for the issuance,
destruction and freezing of any assets. This contract is intended for
educational purposes, you are fully responsible for compliance with
present or future regulations of finance, communications and the
@frozeman
frozeman / mistweb3.js
Last active July 22, 2021 01:00
Mist web3 loading proposal
/*
Basically "web3" comes from Mist,
but "Web3" CAN come from the dapp.
A Dapp has 3 ways to use web3.
2. and 3. would work when in Mist and outside.
*/
// 1. simply use, web3 comes already defined
@frozeman
frozeman / token.md
Last active October 23, 2022 00:47
Token proposal

This is outdated: The ERC-20 is here: ethereum/EIPs#20

Token

Methods

totalSupply

Process: Electron [17945]
Path: /Users/USER/Sites/*/Ethereum-Wallet.app/Contents/MacOS/Electron
Identifier: com.ethereum.wallet
Version: 0.3.8 (0.3.8)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Electron [17945]
User ID: 501
Date/Time: 2016-01-07 17:04:31.448 +0100
@frozeman
frozeman / web3changes.md
Last active April 15, 2020 18:28
web3.js API changes

TODO: update web3.js examples ?

  • uses BN instead of BigNumber
  • added websockets and new events for these providers (web3.currentProvider.on 'connect', 'end', 'error', 'timeout')
  • changed web3.eth.sendRawTransaction -> web3.eth.sendSignedTransaction
  • added web3.eth.subscription
    • web3.eth.subscription('logs', {address: '0x12', topics: [], fromBlock: ''}) allows only fromBlock, use web3.eth.getPastLogs for a specifc range of past blocks.
    • subscriptions return events like:
      • for "logs": "error", "log", "deleted/reverted"
      • for syncing: "error", "started", "processing", "ended"
@frozeman
frozeman / contract.js
Last active February 17, 2016 17:13
New contract object
// un"addresses" contract object
var myContrac2 = new web3.eth.contract(abi)
myContrac2.address = '0x12345678...'; // add address later
// initiate with address
var myContrac = new web3.eth.contract(abi, address)
// deploy contract
eventemitter = new web3.eth.contract(abi).deploy(param1, {data: '0x23456'});
@frozeman
frozeman / addressfixes.js
Last active September 4, 2022 01:04
Fixes the wallet links in the ethereum wallet
// Open the wallet console: Menu -> Develop -> Toggle console ...
// Run the following script
_.each(Wallets.find().fetch(), function(item){
if(item.address)
Wallets.update(item._id, {$set: {address: item.address.toLowerCase()}});
});
_.each(CustomContracts.find().fetch(), function(item){
if(item.address)
CustomContracts.update(item._id, {$set: {address: item.address.toLowerCase()}});
@frozeman
frozeman / bruteforce-presale.js
Last active March 28, 2017 05:41
Presale wallet file brute force tools. This is to help people who don't exactly remember their passwords
const spawn = require('child_process').spawn;
var bruteForce = function(path, pw, callback) {
var error = false;
// start import process
var nodeProcess = spawn(nodeBinary, ['wallet', 'import', path]);
nodeProcess.once('error',function(){
error = true;