Skip to content

Instantly share code, notes, and snippets.

View Bunjin's full-sized avatar
:octocat:
Bazinga

Vincent Bunjin

:octocat:
Bazinga
View GitHub Profile
@Bunjin
Bunjin / betting.py
Last active June 28, 2016 00:31 — forked from vessenes/betting.py
from random import randint
win_if_lte = 17
payoff = 2.0
block_reward = 5.0
def bet_n_times(n, bet_size):
profit = 0
for i in range(n):
var Web3 = require("web3");
if(typeof web3 !== 'undefined')
web3 = new Web3(web3.currentProvider);
else
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
var abiArray = [{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"recipient","type":"address"},{"name":"amount","type":"uint256"},{"name":"description","type":"string"},{"name":"votingDeadline","type":"uint256"},{"name":"open","type":"bool"},{"name":"proposalPassed","type":"bool"},{"name":"proposalHash","type":"bytes32"},{"name":"proposalDeposit","type":"uint256"},{"name":"newCurator","type":"bool"},{"name":"yea","type":"uint256"},{"name":"nay","type":"uint256"},{"name":"creator","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"minTokensToCreate","outputs":[{"name":"","type":"u
@Bunjin
Bunjin / Cloner.sol
Created February 28, 2017 13:29 — forked from holiman/Cloner.sol
A generic 'cloner' contract which clones other contract instances
pragma solidity ^0.4.4;
contract X{
string junk;
function y() returns(string){
//Uncomment the 'junk' below to make gas-measurements
//junk="0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345
@Bunjin
Bunjin / ethereum_delayed_computations.md
Created March 9, 2017 14:12 — forked from VictorTaelin/ethereum_delayed_computations.md
Make Ethereum massively scalable today with delayed computations

Make Ethereum massively scalable today with delayed computations

Suppose you're writing a contract which involves a huge amount of participants. As an example, think of an online, blockchain-based Trading-Card Game with tournaments. How would you program a playCard function? You might be thinking of something like this:

function playCard(uint player, uint card){
    ...
    else if (card == PROFESSOR_OAK){
        // shuffles the player's hand on his deck
 shuffleHand(player)
0x0c26a6dbf6b285145ca4f64397a521f8b5e49a79
@Bunjin
Bunjin / RNG.sol
Last active September 12, 2019 10:24
Blockhash RNG immune to tampering for PoS and PoW
contract RNG {
bytes32 encrypted_seed;
bytes32 revealed_seed;
bytes32 revealed_secret;
uint odds;
uint bet_blocknumber;
uint bet_input;
bool bet_made;
uint bet_result;
string log;

Keybase proof

I hereby claim:

  • I am bunjin on github.
  • I am vincent_eli (https://keybase.io/vincent_eli) on keybase.
  • I have a public key ASAmWzyld13wa9c2LsD4J3ORk9y0BQmuydfe7KfbrBTb3Qo

To claim this, I am signing this object: