Skip to content

Instantly share code, notes, and snippets.

View ongrid's full-sized avatar
🎯
Focusing on Ethereum DApps

Kirill Varlamov ongrid

🎯
Focusing on Ethereum DApps
View GitHub Profile
@ongrid
ongrid / deploy_daomaker.log
Created September 21, 2022 04:13
daomaker deploy log
In server folder
:server kirill$ ~/google-cloud-sdk/bin/gcloud app deploy --appyaml yaml/app.yaml
Services to deploy:
descriptor: [yaml/app.yaml]
source: [/Users/kirill/Prog/StepApp/steplaunch-app/server]
target project: [step-launchpad]
target service: [default]
target version: [20220921t075001]
@ongrid
ongrid / bip44_generator.py
Last active January 1, 2025 20:23
BIP-44 mnemonic generator
# This snippet generates BIP-39 mnemonic (seed phrase)
# then derives 10 Ethereum private keys from it (with their addresses)
# The same algorithm and paths are used in Metamask, Trust Wallet, Ganache, hardhat
# and other popular wallets and tools.
from bip44 import Wallet
from bip44.utils import get_eth_addr
from mnemonic import Mnemonic
mnemo = Mnemonic("english")
words = mnemo.generate()
ethereum.enable();
var governanceContract = web3.eth.contract([{"constant":true,"inputs":[],"name":"allProposalsFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_targetContract","type":"address"},{"name":"_transaction","type":"bytes"}],"name":"newProposal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"proposals","outputs":[{"name":"finished","type":"bool"},{"name":"yesVotes","type":"uint256"},{"name":"noVotes","type":"uint256"},{"name":"targetContract","type":"address"},{"name":"transaction","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"voters","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"allProposals","outputs":[{"name":"","type":"b
@ongrid
ongrid / veryBadToken.sol
Created June 6, 2019 12:49
Very Bad Token
pragma solidity ^0.5.0;
contract MyToken {
string public name = "Very Bad Token";
string public symbol = "VBT";
uint8 public decimals = 2;
mapping (address => uint256) public balances;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
@ongrid
ongrid / MintableStableCoin.sol
Created April 19, 2019 10:44
MintableStableCoin.sol
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
@ongrid
ongrid / UniGoldToken.sol
Created October 1, 2018 11:49
UniGoldToken.sol
pragma solidity ^0.4.24;
// File: contracts/ERC223ReceivingContract.sol
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
@ongrid
ongrid / MUST_token_audit.sol
Last active June 9, 2018 21:39
MUST token audit line-by-line comments
pragma solidity ^0.4.13;
contract Receiver {
function tokenFallback(address from, uint value, bytes data);
}
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*
@ongrid
ongrid / privkey_from_parity_phrase.py
Created June 7, 2018 10:54
Parity private key from seed phrase
from sha3 import keccak_256
from eth_keys import keys
def privkey_from_parity_phrase(phrase):
h = keccak_256(phrase.encode('utf-8'))
for i in range(16384):
h = keccak_256(h.digest())
while keys.PrivateKey(h.digest()).public_key.to_checksum_address()[0:4] != '0x00':
h = keccak_256(h.digest())
private_key = h
return private_key
@ongrid
ongrid / getBlock.js
Last active May 21, 2018 11:48
getBlock via injected web3.js at browser
/*
Example of web3 call via injected web3 at browser's console
*/
web3.eth.getBlock(100, function(error, result){
if(!error)
console.log(result);
else
console.error(error);
});
@ongrid
ongrid / eth_account.py
Last active May 14, 2018 17:17
Ethereum account generator
"""
pip install eth-hash
pip install eth-keys
"""
from eth_keys import keys
from os import urandom
from eth_hash.auto import keccak
# Generate
private_key = keccak(urandom(4096))
private_key_bytes = private_key