Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am banteg on github.
  • I am banteg (https://keybase.io/banteg) on keybase.
  • I have a public key whose fingerprint is D07D 93C0 D514 B6E5 EE6E F713 7B6E 8BE9 B131 9FD3

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1PPDacCeRus3KdQXRSkzqPtAdnCAmLwHnK https://explorer.blockstack.org/address/1PPDacCeRus3KdQXRSkzqPtAdnCAmLwHnK
@banteg
banteg / eos.py
Last active December 5, 2017 11:00
interact with eos token sale contract from python
from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host='localhost', port='8545'))
address = '0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf'
abi = [{'constant': True, 'inputs': [{'name': '', 'type': 'uint256'}, {'name': '', 'type': 'address'}], 'name': 'claimed', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'type': 'function'}, {'constant': False, 'inputs': [{'name': 'owner_', 'type': 'address'}], 'name': 'setOwner', 'outputs': [], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'time', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'totalSupply', 'outputs': [{'name': '', 'type': 'uint128'}], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'foundersAllocation', 'outputs': [{'name': '', 'type': 'uint128'}], 'payable': False, 'type': 'function'}, {'constant': False, 'inputs': [{'name': 'day', 'type': 'uint256'}], 'name': 'claim', '
@banteg
banteg / script.js
Created December 5, 2017 10:01
cryptokitty rare cards (script for tampermonkey)
// ==UserScript==
// @name Crypto Kitty Info Extension
// @namespace https://github.com/HaJaeKyung/CryptoCatAdd
// @version 0.18
// @description Adds stat info to the site
// @author HaJaeKyung
// @match *.cryptokitties.co/*
// @grant none
// @require http://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
@banteg
banteg / contracts.yml
Created December 5, 2017 20:22
import cryptokitties in elasticsearch
auction:
address: '0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C'
abi: [{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPrice","type":"uint256"},{"name":"_endingPrice","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_seller","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"lastGen0SalePrices","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"fu
import os
from operator import itemgetter
from json import JSONDecodeError
from time import sleep
import click
import requests
import pendulum
@banteg
banteg / lto.md
Last active January 23, 2019 21:30

How to access LTO node dashboard/API

To enable API in the docker-compose.yml, add these lines to the envoronment section:

      - LTO_API_KEY=your super secret password
      - LTO_ENABLE_REST_API=true

Access the node using SSH tunnel

import requests
from tqdm import trange
from web3 import Web3, HTTPProvider
w3 = Web3(HTTPProvider('http://127.0.0.1:8545', {'timeout': 120}))
def get_contract(address):
resp = requests.get(
"""
estimates remaining time to sync tezos node.
dependencies:
pip3 install click requests python-dateutil
"""
import requests
from requests.exceptions import ConnectionError
from dateutil.parser import parse
from datetime import datetime, timedelta, timezone
import click
from web3 import Web3, HTTPProvider
from datetime import datetime, timezone
abi = [{'constant': True,
'inputs': [],
'name': 'name',
'outputs': [{'name': '', 'type': 'string'}],
'payable': False,