Skip to content

Instantly share code, notes, and snippets.

View frozeman's full-sized avatar

Fabian Vogelsteller frozeman

View GitHub Profile
@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 / 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 / createContract.js
Last active September 5, 2018 18:57
Deploy contracts on Ethereum and reliable get the contract address
// -> Soldity
// **********
// Your Soldity contract
event Created(bytes32 indexed identifier);
contract MyContract {
function MyContract(bytes32 identifier) {
Created(identifier);
}
@frozeman
frozeman / gist:b3f016de58b04c99cfc3
Created November 11, 2014 20:27
Steps in phantomjs
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.onLoadStarted = function() {
loadInProgress = true;
console.log("load started");
};
@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 / 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 / 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 / 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 / ercevocer.js
Created April 28, 2017 12:48
Use solidity ecrecover with signature calculated with eth_sign
// Change accountToSignWith to the address of your account.
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var accountToSignWith = '0xbedcf417ff2752d996d2ade98b97a6f0bef4beb9';
var message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Eaedem res maneant alio modo.'