Skip to content

Instantly share code, notes, and snippets.

@elichai
elichai / gist:ee492cba1c682088108f31c8770cd380
Last active January 9, 2024 11:08
bitcoin nodes stats
total : 7104
Core : 5704
Classic : 134
BU : 792
UASF : 347
XT : 49
Other : 78
Core :
/Satoshi:0.13.0(bitcore)/ : 2
@elichai
elichai / gist:19f23049108b4c66624c032c0e13facb
Created November 3, 2021 15:50
libsecp256k1 Context Discussion
[2021-10-13 02:26:15] <real_or_random> sipa gmaxwell andytoshi: it would be nice to hear your opinion on https://github.com/bitcoin-core/secp256k1/pull/988#issuecomment-938650194 ... also wrt rust-secp256k1 which I believe is the main user user of _context_no_precomp
[2021-10-13 17:45:02] <elichai2> Hmm I really want `secp256k1_context_no_precomp` to work for signing mostly for the ergonomics of rust-secp in a fully no-std mode
[2021-10-13 17:45:08] <elichai2> But I can see the arguments against it
[2021-10-13 17:45:42] <elichai2> at the very least the name should change, although that's a breaking change
[2021-10-13 17:45:44] — elichai2 sigh
[2021-10-13 17:58:42] <real_or_random> well, let's say that's an opportunity then to change the semantics ...
[2021-10-13 20:51:02] <gmaxwell> real_or_random: I don't really understand the question on the no-precomp. The change to static tables should make the functions that need the additional setup check for that, rather than the tables... so that they don't run whil
@elichai
elichai / Q&A.md
Last active October 15, 2021 09:29
Rust Bitcoin core

Q: Pathway wise is this even possible to have a parallel Rust thing going at the same time?
A: Yes, Rust is a compiled non-gc languange just like C++, Rust can call easily call into C functions and easily expose a C API (Rust can also do this with C++ but less "easily").

Q: At the same time there are a lot of big companies making that same bet... I wish I had more examples than that but I don’t off the top of my head
A:

  1. Google is actively using Rust in multiple projects: Fuchsia[[0]] CrosVM(part of Chromium OS)[[1]], and probably more[[2]][[3]]
  2. Microsoft, it was already said but microsoft is using Rust in Windows[[4]], wasm related tools[[5]], and more[[6]] they also have people whose all job is making rust+windows experience better[[7]]
  3. Facebook is both experimenting with rust[[8]][[9]] and using it in production[[10]]
  4. Dropbox main sync engine is written in Rust[[11]].
@elichai
elichai / configuration no lto
Created January 29, 2020 09:27
LTO performance
CC=clang-10 CXX=clang++-10 LDFLAGS=-fuse-ld=lld-10 ./configure --with-incompatible-bdb
Build Options:
with endomorphism = no
with ecmult precomp = yes
with jni = no
with benchmarks = no
with coverage = no
module ecdh = no
@elichai
elichai / TaprootProposalV2.md
Last active July 22, 2019 21:42 — forked from jachiang/TaprootDescriptorProposal.md
TaprootProposalV2

Taproot Descriptor Proposal

Status: Proposal Co-Authors:

Output descriptor support in Bitcoin Core provide an intuitive language which simplifies how wallets determine which UTXOs they can sign and spend. A descriptor expression today expands to a single output script of a given output.

However, with the introduction of Taproot, a given output can now have multiple spending paths at different heights of the taproot tree. We wish to propose a taproot output descriptor which encapsulates both individual tapscripts and mid-level tapscript descriptors whilst encoding the intended taptree structure.

The proposed taproot descriptor design prioritizes:

@elichai
elichai / TaprootProposal.md
Created July 22, 2019 19:51 — forked from jachiang/TaprootProposal.md
Taproot Proposal

Taproot Descriptor Proposal

Status: Proposal Co-Authors:

Output descriptor support in Bitcoin Core provide an intuitive language which simplifies how wallets determine which UTXOs they can sign and spend. A descriptor expression today expands to a single output script of a given output.

However, with the introduction of Taproot, a given output can now have multiple spending paths at different heights of a taproot tree. We wish to propose a taproot output descriptor which encapsulates both individual tapscripts and mid-level tapscript descriptors whilst encoding the intended taptree structure.

The proposed taproot descriptor design prioritizes:

@elichai
elichai / CMakeLists.txt
Last active July 9, 2019 18:29
Bitcoin Cmake Hack
cmake_minimum_required(VERSION 2.8.4)
project(bitcoin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
file(GLOB_RECURSE SOURCES_FILES CONFIGURE_DEPENDS src/*.cpp src/*.c src/*.h)
include_directories(SYSTEM src
src/bench
src/compat
@elichai
elichai / schnorr_tweaks.md
Last active July 2, 2019 14:09
Schnorr constructions

Pay to Contract

P' = P + H(P||S)G
d' = d + H(P||S)
Examples:

  1. P is a public key, S is a bitcoin script with a locktime for a different Key(Q).
    The owner of P can sign for P' and spend the output regularly(by signing with d').
    OR the owner of Q can provide P and S and then get evaluated by S as a regular script. (and if the script evaluates to true he can get the money)

  2. S is a hash of a document and this is used to timestamp data, not the best way since you need this to be able to sign on the transaction later and this isn't saved anywhere.

def jacobi_symbol(numerator, denominator):
numerator %= denominator
res = 1
while numerator != 0:
while numerator % 2 == 0:
numerator /= 2
tmp = numerator % 8
if tmp == 3 or tmp == 5:
res = -res
:~/gits/bitcoin/bitcoin-submittx$ ./bitcoin_submittx mainnet 2cc20585f6e31f1ea56b150e2e163ecde0a9d0b7a4d26a840aac5ef8db0b2092^C08.59.12.163 163.172.12.242 108.59.12.167 213.91.205.134 207.226.141.253 elichai2@Lenovo-G510:~/gits/bitcoin/bitcoin-submittx$ bitcoin-cli getrawtransaction 2cc20585f6e31f1ea56b150e2e163ecde0a9d0b7a4d26a840aac5ef8db0b2092
0100000001921b2e1ca11e877a7f03eaeafce84c208bc1b18ee3004455bd6c8a84413316c9000000006b4830450221009c524f903f36a3049803544a43f58bc9794a6126158dab758eb4f54b8373e95e02205b5bba1a3b72e00e8c683c60e0fb9750de0913293906fceb339308241869686e012103dc41a4c4f39738dd6cd79770e15210147cfeeab31d732a3479e27d241e811ff0ffffffff01d0d18500000000001976a9142d966be0ad57fc520214349901e1dd6c1a8da5b388ac00000000
elichai2@Lenovo-G510:~/gits/bitcoin/bitcoin-submittx$ ./bitcoin_submittx mainnet 0100000001921b2e1ca11e877a7f03eaeafce84c208bc1b18ee3004455bd6c8a84413316c9000000006b4830450221009c524f903f36a3049803544a43f58bc97