Skip to content

Instantly share code, notes, and snippets.

View Isan-Rivkin's full-sized avatar
⛑️
Firefighter

isan_rivkin Isan-Rivkin

⛑️
Firefighter
View GitHub Profile
body
{
background-color: red;
}
p
{
background-color: red;
}
@Isan-Rivkin
Isan-Rivkin / transaction_api_example.json
Created October 10, 2017 08:33
transaction example from the ethereumisrael.org/explorer_api
{
"blockHash": "0xbcee524fd4fab2705b249ead24b7994bceb5766d139716c35f39897515b787fc",
"blockNumber": 4352916,
"condition": null,
"creates": null,
"from": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
"gas": "0xc350",
"gasPrice": "0.00000002",
"hash": "0xa4a3779bfad6e444118ac8ad3b56a0b47b9c821ef82c5259f94b6d60962d0455",
"input": "0x",
@Isan-Rivkin
Isan-Rivkin / account_api_example.json
Created October 10, 2017 08:34
Address example from the ethereumisrael.org/explorer_api
{
"txResults": [
{
"blockNumber": "4352916",
"timeStamp": "1507623958",
"hash": "0xa4a3779bfad6e444118ac8ad3b56a0b47b9c821ef82c5259f94b6d60962d0455",
"nonce": "3519039",
"blockHash": "0xbcee524fd4fab2705b249ead24b7994bceb5766d139716c35f39897515b787fc",
"transactionIndex": "173",
"from": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from src.preformance.TimerClass import Timer
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
def init_driver():
@Isan-Rivkin
Isan-Rivkin / TernaryMerkleTree
Created December 19, 2017 14:48
Ternary Merkle Tree implementation in Python
import hashlib
import random
import time
class MerkleTreeTernary(object):
def __init__(self):
pass
def merkle_hash(self,transactions):
var utils = require('ethereumjs-util');
// private key as argument
console.log("Argument: " + process.argv[2]);
function hexToBytes(hex){
var bytes = [];
for(var i=0; i<hex.length;i+=2){
bytes.push(parseInt(hex.substr(i,2),16));
}
return bytes;
pragma solidity ^0.4.18;
/*
There are two main disadvantages to this approach:
Users must always look up the current address, and anyone who fails to do so risks using an old version of the contract
You will need to think carefully about how to deal with the contract data when you replace the contract
pragma solidity ^0.4.18;
contract MathTests {
uint month = 30 days;
uint endTime = now + month;
uint punishTime = now + (endTime-now)/2; // simulating that punished occured half way the subscription
uint startTime = now;
function getDivided(uint numerator, uint denominator) public constant returns(uint quotient, uint remainder) {
quotient = numerator / denominator;
remainder = numerator - denominator * quotient;
}
pragma solidity ^0.4.18;
// THE EXAMPLES SOURCE https://ethereum.stackexchange.com/questions/1134/what-design-patterns-are-appropriate-for-data-structure-modification-within-ethe/2568
/*
There are two main disadvantages to this approach:
Users must always look up the current address, and anyone who fails to do so risks using an old version of the contract
You will need to think carefully about how to deal with the contract data when you replace the contract