pull down to refresh

LORE

  • Stumble across Bitcoin, heard about it's P2P aspect
  • Initially thought fees are calculated in proportion to the payment amount
  • Quickly learned about UTXOs, TX input + output etc
  • Confused as to why some TXs have cheaper or more expensive TX fee even though they looked similar from quick glance
  • Learned script types, tryna find out how each script type are weighted and found these 1, 2 tools
  • Interested to know more & want to verify the information by myself
  • Conduct my own investigation
  • Results found, decided to share it on SN
  • Am i cooking ?

CLASSIFICATION & CORE ASPECTS

Script TypeOther
P2PKCoinbaseInput-only (can't spend to Coinbase)
P2PKHOP_ReturnOutput-only (can't spend from OP_Return)
P2MSP2QRHStill in the proposal-phase, add it anyway
P2SHP2AHaven't learned much of it, add it anyway
P2WPKHNon-standard
P2WSH
P2TR
Pre-SegWitPost-SegWit
OverheadnVersionnVersion
Input CountInput Count
Output CountOutput Count
nLocktimenLocktime
Mark & Flag
Input FieldOutpointOutpoint
scriptSig LengthscriptSig Length
scriptSignSequence
nSequenceWitness Items
Output FieldnValuenValue
scriptPubkey lengthscriptPubkey Length
scriptPubkeyscriptPubkey
Block Size/Weight [1]1 Megabyte4 Million Weight Units
4 Mega Virtual Bytes

RESULTS

OverheadInput VSizeOutput VSize
Coinbase≥ 48 ?
OP_Returm≥ 34 ?
P2PK10113 ~ 11576
P2PK (Raw)1011444
P2PKH10147 ~ 14934
P2PKH10179 ~ 18134
P2MS 1-of-110113 ~ 11546 or 78
P2MS 1-of-110148 ~ 15446
P2MS 1-of-210114 ~ 11680 or 112 or 144
P2MS 2-of-210187 ~ 18980 or 144
P2MS 1-of-310114 ~ 115114 or 146
P2MS 2-of-310186 ~ 189114 or 210
P2MS 3-of-310258114 or 210
P2SH 1-of-11079 or 15332
P2SH 1-of-110184 ~ 18632
P2SH 1-of-210186 ~ 18832
P2SH 1-of-21025232
P2SH 2-of-210260 ~ 26132
P2SH 2-of-210326 ~ 32832
P2SH 2-of-310293 ~ 29832
P2SH 2-of-31032932
P2SH 2-of-41033132
P2SH 3-of-410530 ~ 53432
P2SH 2-of-51036432
P2SH 3-of-510436 ~ 43832
P2SH 8-of-910936 ~ 93932
P2SH-P2WPKH10.590.75 ~ 9132
P2SH-P2WSH 1-of-110.510432
P2SH-P2WSH 2-of-210.5130.75 ~ 13132
P2SH-P2WSH 2-of-310.5139 ~ 139.2532
P2WPKH10.567.5 ~ 6831
P2WSH 1-of-110.569.2543
P2WSH 2-of-210.595.75 ~ 9643
P2WSH 2-of-310.5104 ~ 104.543
P2WSH 3-of-510.5139.25 ~ 139.7543
P2WSH 11-of-1510.5397.25 ~ 398.7543
P2TR10.557.5 ~ 57.7543

EXAMPLES

PartSizeTransactions Example
P2PK input1131, 2, 3, 4
1141, 2, 3
1151, 2
Raw P2PK input1141, 2
Raw P2PK output441, 2
P2PKH input1471, 2, 3, 4
1481 (2nd), 2 (except 1st), 3 (1st), 4 (all)
1491, 2, 3, 4 (1st)
1791, 2, 3 (2nd), 4 (2nd)
1801, 2, 3, 4
1811, 2, 3 (all), 4 (1st)
P2MS 1-of-1 input1131
1151
1481
1541
P2MS 1-of-1 output461, 2, 3, 4
781
P2MS 1-of-2 input1141, 2, 3, 4
1151, 2, 3, 4
1161
P2MS 1-of-2 output801, 2, 3, 4
1121, 2, 3
1441
P2MS 2-of-2 input1871, 2 (2nd)
1881, 2 (1st), 3 (2nd), 4 (2nd)
1891, 2, 3 (1st), 4
P2MS 2-of-2 output801, 2, 3
1441, 2, 3, 4
P2MS 1-of-3 input1141 (1st), 2 (2nd), 3 (2nd)
1151 (3rd), 2 (2nd)
P2MS 1-of-3 output1141, 2, 3 (3rd), 4
1461, 2, 3, 4
P2MS 2-of-3 input1861, 2
1871, 2, 3, 4
1881, 2, 3, 4
1891
P2MS 2-of-3 output1141, 2, 3
2101, 2, 3, 4
P2MS 3-of-3 input2581
P2MS 3-of-3 output1141
2101
P2SH 1-of-1 input791
1531
1841
1851, 2 (all)
1861, 2
P2SH 1-of-2 input1861, 2
1871, 2 (3rd), 3, 4
1881, 2
2521
P2SH 2-of-2 input2601, 2
2611
3261, 2
3271, 2
3281
P2SH 2-of-3 input2931 (1st), 2
2961, 2 (4th), 3
2971 (all), 2
2981 (5th), 2
3291
P2SH 2-of-4 input3311
P2SH 3-of-4 input5301 (1st)
5311 (2nd), 2, 3 (1st)
5331 (2nd)
5341 (3rd)
P2SH 2-of-5 input3641
P2SH 3-of-5 inout4361, 2
4371, 2
4381
P2SH 8-of-9 input9361 (3rd)
9381, 2 (2nd)
9391 (1nd)
P2SH-P2WPKH input90.751 (2nd), 2
911 (1st), 2, 3, 4
P2SH-P2WSH 1-of-1 input1041
P2SH-P2WSH 2-of-2 input130.751, 2
1311 (1st)
P2SH-P2WSH 2-of-3 input1391
139.251, 2, 3, 4
P2WPKH input67.751 (1st & 4th), 2, 3, 4
681, 2 (2nd & 3rd), 3, 4
P2WSH 1-of-1 input69.251
P2WSH 2-of-2 input95.751, 2, 3 (1st), 4 (1st)
961 (2nd)
P2WSH 2-of-3 input1041, 2, 3, 4
104.251, 2
104.51
P2WSH 3-of-5 input139.251, 2
139.51 (all), 2
139.751
P2WSH 11-of-15 input397.251 (3rd)
397.51, 2
397.751, 2 (2nd), 3, 4
3981, 2, 3 (all), 4
398.251, 2, 3, 4
398.51 (1st), 2, 3, 4
398.751
P2TR input57.51, 2, 3, 4
57.751 (all), 2, 3, 4

CLOSING BIT

Tools used :

Aight, i can't get any example of Pay-to-Anchor TX on mainnet yet. But who's gonna stop me from mentioning it ? Here are several examples of P2A TX on Testnet4 :

As output (receiver side)As input (spender side)
11
22

Now, if the law of TX size calculation on Testnet4 is the same as Mainnet, then a P2A script would have 13 vb output size or 41 vb input size. CMIIW tho, i only sampled one address i found here.

Historically, we've gotten a new address type every 4 years (P2SH 2012, SegWit 2017, Taproot 2021), but given the slow adaptation of P2TR and long process of development, we are not gonna get P2QRH next year. Read the documentation here.

  1. https://bitcoin.stackexchange.com/questions/98810/whats-the-blocksize-limit-after-segwit-and-how-do-legacy-nodes-deal-with-segwit

It's kind of rude to ask questions about a feature that doesn't exist yet, but I'm curious what the sub-board design will look like, the assumptions underlying it, and the features it will include to support the design goals.

For instance: you can imagine that sub-boards could be administered by a moderator; and then the mod gets to say "these are the rules to be here" a la Reddit. But what if the sub is about a contentious topic (e.g., religion, politics, the block subsidy) and douchebags show up to the sub trying to DDOS everything with asshole comments from multiple accounts, etc?

Then I thought: what if a sub could have an "ante" where you have to ante up some number of sats if you want to post, and the ante is timelocked so once you ante, you can't withdraw for a while. The sats are held in reserve in a sub-sub-wallet (ha!). If the user is an asshole, the mod can sweep the funds into the SN rewards pool.

Obviously you can imagine ways the mod can abuse this; but you can also see how market incentives provide strong abuse counter-incentives: a smart mod would be judicious about funds-sweeping, and would make a case for why she was proposing to sweep. If the sub got a bad rep, people would stop anteing up and the sub would quickly die. But there would be a public record of the action, and the user's actions pre-sweep, so people could decide for themselves.

Like the SN version of free-banking. Market in action. Only possible using btc / LN.

reply

There is a seven step procedure to run the backend and connect it to the frontend, so I will go over them here

First step

The first step is something I have to say after the second step

Second step

The second step is to install LNDK according to the instructions on this page: https://github.com/lndk-org/lndk

But notice that the page tells you that first you "need a LND node running at least LND v0.18.0...with the peersrpc, signerrpc, and walletrpc sub-servers enabled"

First step again

So that's the real first step: compile LND with those sub-servers enabled by following the guide they link to

Note on the first two steps

Don't run LND and LNDK as two different linux users like a "good" programmer would do. To control LNDK I opted not to use its api, because I was running out of time, so instead I use the exec command to spin up a terminal inside nodejs and interact with it via stdin and stdout. And for one specific LND command ("trackpayment") the LND API wouldn't work for me (I was probably using it wrong) so I use exec for that too. Which means you must run the server, LND, and LNDK all on the same linux user -- if you separate them, the terminal won't have the lndk-cli and lncli commands available, so the program will fail.

Third step

To run the server, first clone the github and run npm init -y.

Fourth step

Then install the dependencies: npm i crypto noble-secp256k1 ws browserify-cipher request

Also, modify the first few lines of the server.js file so that they contain your LND node's invoice macaroon, admin macaroon (both in hexadecimal format), your LND Rest api endpoint (this is usually https://127.0.0.1:8080), and you can ignore the other four fields -- I intended to use them to let users modify their fee settings and a few other things, but I don't actually use them anywhere in the code, the fees are just hard coded to 10 sats.

Fifth step

Then run node server.js

It should spit out a nostr public key and then wait for incoming messages

We opted to use nostr for communication between the frontend and the backend so that anyone can run this without needing to expose ports

We intended to make it so that people running the backend would announce themselves on nostr, as well as a fee structure (e.g. do they charge a flat fee for forwarding bolt11 payments to a bolt12? A percentage fee? How much?) and the frontend would listen for those announcements and display them to the user. But we ran out of time so we hard coded the nostr pubkey of my backend into the frontend, which is why it stopped working when I turned off my laptop.

Sixth step

To make sure your service is working, edit the index.html file in my github repo and find the line `welder = "<nostr_pubkey>" and change it to yours. Then open up the index.html file, open up its browser console, enter a bolt12 invoice into the form, and hit enter. You should see a message pop up in your nodejs terminal and you should see the frontend and backend interact. Watch the browser console -- eventually you should see a bolt11 invoice in there. (I don't "pop it up" on the page, it only appears in the console.)

Note about the sixth step

As @justin_shocknet has always warned, I have found that the onion messaging aspect of bolt12 is very unreliable. About 2/3 of the time, the server will use the lightning network's onion messaging transport layer to reach out to whatever node issued the bolt12 and something goes wrong: the message does not reach the destination or the reply does not reach my node.

Consequently, most of the time, the service does not work. I find that if, after hitting the "Submit" button on the form, you don't see a bolt11 in your browser console after about 10 seconds, try hitting submit again; and occasionally try restarting all four services: LND, LNDK, and the nodejs file, and the web browser (after entering in your "new" nostr pubkey -- the nodejs service doesn't save it so a new pubkey is created every time you restart the nodejs service).

Eventually it should work and you should see a bolt11 invoice in your browser console.

Seventh step

Pay the bolt11 invoice and you should see a corresponding payment show up in your bolt12-supporting wallet.

Note about the seventh step

I've only tested this with phoenix wallet so it might not work with other wallets. Also, my frontend hard-codes an invoice of 15 sats, and since the server charges a 10 sat flat fee, the bolt11 will be for 25 sats. So don't be surprised when your phoenixd only receives 15 sats even though you paid 25.

reply

Interesting! I've never thought about a full node in that way but my initial reaction is that it still counts as full because i can send/receive any bitcoin with a wallet that uses that node.

reply
reply

how will splicing impact LN node operators?

reply

Love this kind of thinking. Culture is one of those things that can be nudged and affected but it seems nearly impossible to control. I've worked at companies where culture was important but it can't be created by a road map. Being a parent has taught me you can guide and influence but kids are born with their own natures and make their own choices. The best I can hope to do is lead by example, coach, guide, and protect. Most of all love. I think this applies to the broader culture as well.

reply

☑️ morning strength training
☑️Breakfast - 6 eggs and 2 chicken thighs
☑️Doom scrolling stacker.news

reply

A ton for sure.

  • The biggest is probably watch out for implementation-specific issues. But it's incredibly hard to detect these early on.
  • That's why bite the bullet and go multi-node, multi-implementation.
  • You need more than one node anyways for maintenance downtimes.
  • The more an implementation let's you control, the better. Take e.g. CLN's plugin system which let's you write your own low-level stuff like your own payment logic if you don't like the one that is shipped with the node. Or completely abstract the database backend.

Will add more as it comes to mind.

reply

Happy New Year everyone! My New Year's resolutions are to stay focused, determined and to give my best in everything i do.

reply

We fund the earnings rewards through these sources:

  • The fee we take from promotion budgets.
  • Our transaction fees.
  • Our podcaster wallet fees.

Bots / exploits are definitely something we're spending a lot of time on - but the more you contribute to the platform by creating clips, liking clips and comments, and supporting podcasts - the more you earn. Supporting podcasts specifically is something that's hard to fake because you have to send money to do it.

reply

A growing number of people don't WANT to use a bank (who arbitrarily cut service and make you jump hoops to get it back), or payment processors that can go broke and reveal your name, transactions, and balances to the ENTIRE world (mtGox, Celsius).

reply

In the UK, we have this thing called a TV license. It's as ridiculous as it sounds. People who watch state TV (BBC) must by law pay £159 / year.

As you can imagine, not many people cough up the money. The BBC is shit and the law is next to impossible to enforce. So if you're not on the TV license register, the government instead harasses you with angry little letters to try and scare you into paying. I hate these things so much that I ritualistically set fire to them whenever they land in my letter box, which is about every other month.

The longer you ignore the letters, the angrier they get. The first letter is just kind of stern. By the third letter they're screaming at you in big red capital letters about how you're under surveillance and breaking the law. By the fifth letter they threaten to send a "television inspector" to your address if you still haven't gotten back to them.

The inspector almost never comes. It's all hot air. But the fact that there is such a thing as a TV inspector in the first place blows my fuckin' mind. This is surely peak BS, right up there with the poor bastards who print the stupid letters out in the first place.

reply

Jameson's thoughts bring to mind this great quote of Dijkstra that, in my humble opinion, is not as popular as it should be.

https://www.azquotes.com/picture-quotes/quote-simplicity-is-a-great-virtue-but-it-requires-hard-work-to-achieve-it-and-education-to-edsger-dijkstra-75-49-78.jpg

reply

When I was a kid, my dad got fired from his job as a road worker for theft. I refused to believe he could do such a thing, but when I got home, the signs were all there.

reply