Skip to content

Instantly share code, notes, and snippets.

@elichai
elichai / Q&A.md
Last active May 4, 2021
Rust Bitcoin core
View Q&A.md

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]].
View configuration no lto
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
View TaprootProposalV2.md

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:

View TaprootProposal.md

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 Jul 9, 2019
Bitcoin Cmake Hack
View CMakeLists.txt
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 Jul 2, 2019
Schnorr constructions
View schnorr_tweaks.md

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.

View gist:51398a32d736ffbc6fe710dc41378488
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
View gist:ee492cba1c682088108f31c8770cd380
total : 7104
Core : 5704
Classic : 134
BU : 792
UASF : 347
XT : 49
Other : 78
Core :
/Satoshi:0.13.0(bitcore)/ : 2
View gist:ae716137579f3f705dd2441da2b93754
:~/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
View gist:65161a52271914af0e5b13e884bf0912
:~/gits/bitcoin/bitcoin-submittx$ ./bitcoin_submittx mainnet 0100000001921b2e1ca11e877a7f03eaeafce84c208bc1b18ee3004455bd6c8a84413316c9000000006a47304402201e27907716cc42cd50d24c75f98b22b754db6f9cfd887cd2e605b3a8676f015702205717fdea16f539912d966722a8dad7dff47fed7277915b1b4b584792ac277976012103dc41a4c4f39738dd6cd79770e15210147cfeeab31d732a3479e27d241e811ff0ffffffff017b858500000000001976a914015e18a647724bd375103bc2e2c071c97400567488ac00000000 108.59.12.163 163.172.12.242 108.59.12.167 213.91.205.134 207.226.141.253
Attempting broadcast of 1 transactions to 5 peers in 10 seconds
connecting to 108.59.12.163:8333 through None
connecting to 163.172.12.242:8333 through None
connecting to 108.59.12.167:8333 through None
connecting to 213.91.205.134:8333 through None
connecting to 207.226.141.253:8333 through None
send msg_version(nVersion=60002 nServices=0 nTime=Thu Sep 29 21:19:29 2016 addrTo=CAddress(nTime=0 nServices=1 ip=163.172.12.242 port=8333) addrFrom=CAddress(nTime=0 nServices=1 ip=0.0.0.0 port=0) nNonce=0x4A