Skip to content

Instantly share code, notes, and snippets.

View gakonst's full-sized avatar

Georgios Konstantopoulos gakonst

View GitHub Profile

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.

Abstract

The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

@KodrAus
KodrAus / Profile Rust on Linux.md
Last active August 12, 2024 12:37
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.

@gititGoro
gititGoro / Recipe.md
Last active September 15, 2023 07:32
Environmental setup for Ethereum Dev as of 14 June 2017

Setting up a private ethereum blockchain for development and pointing your wallet at it

Ethereum tutorials all advise downloading the Mist wallet and beginning dev. The only problem is that the testnet and real blockchain are huge and take hours to download. What follows is a recipe for quickly setting up a small blockchain and pre-mining it with some test ethereum

The following is done in Linux but will work in MacOS and should have equivalent command line options in Windows. Where I don't give detailed instructions, it's because a quick google search will fill in the blanks.

Install geth https://github.com/ethereum/go-ethereum/wiki/geth

install Mist https://github.com/ethereum/mist/releases

Answers to Deep Questions about Solidity

The following list of questions was taken from https://www.reddit.com/r/ethereum/comments/72reba/do_you_have_deep_questions_about_solidity_or_the/

An updated summary on the different ways one could have two contracts interact (DELEGATECALL, STATICCALL, libraries, all that stuff) with clear pros/cons for each (gas cost, whether it requires EVM assembly directives, etc)

Question by /u/drcode

I won't talk about low-level opcodes here because of the brevity of the answer. In general, there are four ways functions can be called in Solidity:

@HarryR
HarryR / schnorr.py
Last active October 22, 2024 05:38
Implementation of Schnorr signatures over secp256k1 - warning, this is vulnerable to the Related Key Attack...
from __future__ import print_function
from random import randint
from hashlib import sha256
from py_ecc.secp256k1.secp256k1 import add, multiply, inv, N, P, G
bytes_to_int = lambda x: reduce(lambda o, b: (o << 8) + ord(b), [0] + list(x))
rands = lambda: randint(1, N - 1)
sbmul = lambda s: multiply(G, s)
hashs = lambda *x: bytes_to_int(sha256('.'.join(['%X' for _ in range(0, len(x))]) % x).digest()) % N
hashp = lambda *x: hashs(*[item for sublist in x for item in sublist])
extern crate ramp;
use ramp::Int;
#[derive(PartialEq, Clone, Debug)]
struct Point {
x: Int,
y: Int,
}
[package]
name = "bigint"
version = "0.1.0"
authors = ["Anon"]
[dependencies]
ramp = "0.3.11"
lazy_static = "1.0.0"
@amir-arad
amir-arad / vorpal.d.ts
Created February 9, 2018 08:34
WIP type descriptors for vorpal
// Type definitions for vorpal 1.12.0
// Project: https://github.com/dthree/vorpal
// Definitions by: Jim Buck <http://github.com/jimmyboh>, Amir Arad <[email protected]>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="inquirer" />
/// <reference types="minimist" />
declare module "vorpal" {
import {ParsedArgs} from 'minimist';
## [It would be nice to import a library, another contract's interface, or a
## parent to inherit from]
## but that's not supported. Yes, inheritance is dangerous, but code reuse can
## be very beneficial as
## well. I believe adoption will be held back by this.
## [Declare a positive number] Why change the type from `uint256`? `num` is
## less descriptive, ie. it could include irrational numbers for all I know.
## Also, will 4-byte identifiers be compatible with solidity?
## ie. `bytes4(keccak256('uint256'))` or `bytes4(keccak256('num'))` ? Or is