Lagrange's avatar
Lagrange
npub1qq30...7nsu
Somewhere in the #Bitcoin rabbit hole. Learning to write plugins for c-lightning.
Lagrange's avatar
Lagrange 2 years ago
I have been fixing renepay lately and thanks to some insightful discussions and brainstorming with René Pickhardt we have had great improvements. In summary, the current Mininum Cost Flow algorithm (MCF) cannot allocate fees as part of the payment amount due to the sats conservation assumption that the only source and sink of flow are the sender and recipient nodes. Once fees are added on top this resulted in channels being asked to forward more sats than their probable available liquidity and consequently possibly an infinite loop of failures. To fix this we take the routes computed by the MCF and reduce their sending amount to fit all liquidity constraints: fee, uncertainty and max_htlc; then deficit in the delivering amount is redistributed among the other routes or reallocated in a new MCF computation if necessary. More details at this PR: before: image after: image
Lagrange's avatar
Lagrange 2 years ago
Yesterday evening a person ask me: "If bitcoin keys are generated randomly by the software, isn't there a probability that two different people can generate the same private key?" This probability is astronomically small and we can compute it approximately. To solve this we need to take into account that there are N = 2^256 = 10^77 possible private keys, but what we should look is the space of bitcoin addresses, because to spend a P2PKH or P2WPKH output it suffices to have a private key that produces the same public key hash in the transaction output, ie. some private key that produces a specific bitcoin address. Since bitcoin addresses are computed from RIPEMD160 hashes, this means that the space of bitcoin address is M=2^160=10^48. If we consider x=10^10 people (8 billion at the time of writing) in the world would generate y=10^6 addresses in their lifetime; to put into perspective there are 800000 hours in the lifetime of a 100 year old person. Then the probability of no collision at all is the number of possible ways to hit different addresses in the address space: M (M-1) (M-2) ... (M-xy+1) = M! / (M-xy)! divided by the number of possible choices: M^(xy) hence the probability of no collisions is prob0 = M! / (M-xy)! / M^{xy} since M!/(M-xy)! is approximately M^{xy} - (1+2+...+xy) M^{xy-1} = M^{xy} - (xy)^2 /2 M^{xy-1} we have prob0 = 1 - (xy)^2 / 2 / M Now, the probability of having at least one collision is prob1 = 1-prob0 which for large numbers at leading order becomes prob1 = (xy)^2 / 2 / M The square in the numerator the responsible for the so called birthday paradox, ie. in a group of 20 people the chances of a birthday collision is very high because 20^2/2 = 200 which is comparable to the number of days in the year. The collisions in the case of bitcoin are so unlikely because (xy)^2 = 10^32 while M=10^48 so that prob1 = 1/10^16 = 0.000 000 000 000 000 1 not as small as the probability of a private key collission but still very unlikely.
Lagrange's avatar
Lagrange 2 years ago
My Pull Request for Pickhardt payments implementation in core-lightning has passed all CI tests.
Lagrange's avatar
Lagrange 2 years ago
how much did you pay today in LN fees? image
Lagrange's avatar
Lagrange 2 years ago
Ordinals and BRC-20s are flooding the mempool. Whoever is behind this is currently throwing 5 btc per block to miners. To keep it up they'll spend 720 btc a day. I wonder how many Bitcoin do they own. Maybe someone with on-chain analysis skills could estimate this based on the addresses being used so far to pay for the attack.
Lagrange's avatar
Lagrange 2 years ago
What if we could host #nostr relays over tor?
Lagrange's avatar
Lagrange 2 years ago
Can anyone please tell me what the 13% means. #[0] , #[1] image