Avatar
Bitcoin Dev Project
78631371f159c1e696665da1a8b41546d75655b1085b4fe1a1a8d05b9a0d7a4e
The go-to resource for developers to learn bitcoin and related technologies. Get inspired to kickstart and grow your career in bitcoin open source software (โ‚ฟOSS).

๐Ÿš€ ICYMI we recently launched a common application for bitcoin grants!

Apply for funding once. Reach multiple bitcoin grant organizations.

https://technicaldifficulties.io/nostr/bdp/grants-app-demo.mp4

Are you a bitcoin open-source software (โ‚ฟOSS) contributor? Are you tired of filling out multiple applications for funding?

Now you donโ€™t have to.

The Common Grants App is one application that gets you in front of:

- nostr:nprofile1qythwumn8ghj7ct5d3shxtnwdaehgu3wd3skuep0qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcqypu8xwr40lp96ewdj2fef408wy70gd3carf9n6xu7hrnhq6whpgly925h0z

- nostr:nprofile1qyxhwumn8ghj7mn0wvhxcmmvqywhwumn8ghj7mn0wd68yttsw43zuam9d3kx7unyv4ezumn9wsqzpqz8m7vp497agx6g7422cq8fp0tzxj87v5uyez809ypj6afg2u2ru5xv7m

- nostr:nprofile1qy88wumn8ghj7mn0wvhxcmmv9uq32amnwvaz7tmjv4kxz7fwv3sk6atn9e5k7tcqyzxjxz0jph4wzhu9pm874ywll0d73mtd4tsu4zzpahp5th07ldgnkqdy7cf

- Brink

- Maelstrom

- - - - - - - - - -

Hereโ€™s how it works:

1. Fill out one form

2. Pick the orgs

3. Submit

4. Each org receives your app

5. They contact you if they are interested

- - - - - - - - - -

Why this matters:

โœ… Saves time

โœ… Saves effort

โœ… Reach 5 bitcoin funding orgs

โœ… No duplicate work

More time building. Less time on the paperwork.

โŒ No chasing 5 different forms across 5 sites

โŒ No unnecessary overhead

โœ… One unified application flow

- - - - - - - - - -

Whoโ€™s it for?

- โ‚ฟOSS contributors

- App builders

- Educators

- Privacy researchers

- Anyone building for Bitcoin

- - - - - - - - - -

Built with โ™ฅ๏ธ by nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcppemhxue69uhkummn9ekx7mp0qqs8sccnw8c4ns0xjen9mgdgks25d46k2kcssk60uxs635zmngxh5ns3quvtq

Big thanks to nostr:nprofile1qqsgdnqyst2jr03flphaa5rg5f872k2rhzxchu4nzu2trt2an7wd84gdx04uy, nostr:nprofile1qyx8wumn8ghj7cnjvghxjmcpz4mhxue69uhk2er9dchxummnw3ezumrpdejqqgr4fag972ezc7x8gc57gpg62d5pqmjantx7ydmu2kvh0p3sgqez2gclgh4s , nostr:nprofile1qyxhwumn8ghj7mn0wvhxcmmvqywhwumn8ghj7mn0wd68yttsw43zuam9d3kx7unyv4ezumn9wsqzqn0hksan5nd5hx0rmwkkh58cggn8ymhavwh8uqnljxktmyd5mwjghk6vgm

- - - - - - - - - -

Ready to apply? ๐Ÿ‘‡

https://grants.bitcoindevs.xyz/

๐Ÿงฐ Too much bitcoin tech knowledge is trapped in videos and podcasts

If only there was an easy way to unearth those insights and gemsโ€ฆ ๐Ÿค”

We wondered that too, so we redesigned Bitcoin Transcripts! ๐Ÿš€

๐Ÿ” Bitcoin Transcripts is a filterable library of transcripts from:

โ€ข dev meetups

โ€ข conferences

โ€ข podcasts

โ€ข panels

Skim talks, quote insights, and search by keyword.

All in one place.

๐Ÿ‘‰ https://btctranscripts.com

โ›๏ธ Missed a workshop or podcast episode?

No worries.

You can now quickly search by keyword or topic and read the conversation in minutes instead of watching hours of video,

Accelerating your speed to insights.

๐Ÿง‘โ€๐Ÿซ Bitcoin Transcripts is perfect for:

- bitcoin devs digging into prior research

- educators creating content

- researchers analyzing protocol history or

- enthusiasts who prefer reading over listening

Taproot workshops, Lightning panels, itโ€™s all in there.

Open-source and built by the community ๐Ÿงก

This project stands on the shoulders of contributors like Bryan Bishop (https://heybryan.org/) who manually transcribed hundreds of talks.

Now, with modern tools, we can scale that effort for the whole community.

Many thanks to our contributors:

- Dev: nostr:nprofile1qqsd7kasecd3feyqqczsvx05vqyey3prqhsmsl0haldenwskhmq038cmf7k9s , Jamal (https://github.com/jrakibi), Emmanuel (https://github.com/Emmanuel-Develops), nostr:nprofile1qyx8wumn8ghj7cnjvghxjmcpz4mhxue69uhk2er9dchxummnw3ezumrpdejqqgr4fag972ezc7x8gc57gpg62d5pqmjantx7ydmu2kvh0p3sgqez2gclgh4s

- Data & architecture: Andreas (https://www.kouloumos.com/), Urvish (https://github.com/urvishp80)

- Vision: nostr:nprofile1qyxhwumn8ghj7cnjvghxjme0qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcqyp5qk5wd3kkux53y2tsynmwlw8y7dq2hr60yjpmyycvdgcx3s0lwcduz4ak

- Design: Tobi (https://x.com/Adeoye_G), Khush (https://x.com/ikhushh7), nostr:nprofile1qyshwumn8ghj7en9v4j8xtnwdaehgu3wvfskuep0w3uhqetnvdexjur5qy88wumn8ghj7mn0wvhxcmmv9uqzpxvff4mhj5snxn95nyf7yvupuxt2rwcsuklrahkcu857pqplmpndukqdk5

- Product: nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcpr4mhxue69uhkummnw3ezumt4w35ku7thv9kxcet59e3k7mf0qqswafckahdl7g8qgh7rp5lg9aps3dvtluhzwm52k3rgzyajas0paksutez5h

- Inspiration: Bryan Bishop (https://heybryan.org/)

Whatโ€™s next?

Weโ€™ll keep adding transcripts from upcoming events and backfill any important historic talks we missed. ๐Ÿ”

Would love your help editing transcripts as well.

Dive in, explore, and let us know what you think! ๐Ÿ‘‡

btctranscripts.com

Wait, before you go! There is a contributor missing from the thank you tweet, https://github.com/IgboPharaoh ! We are so sorry. Thank you for your efforts building Bitcoin Transcripts.

The social media intern responsible for this mistake has been assigned to mailroom duty until further notice.

๐Ÿงฐ Too much bitcoin tech knowledge is trapped in videos and podcasts

If only there was an easy way to unearth those insights and gemsโ€ฆ ๐Ÿค”

We wondered that too, so we redesigned Bitcoin Transcripts! ๐Ÿš€

๐Ÿ” Bitcoin Transcripts is a filterable library of transcripts from:

โ€ข dev meetups

โ€ข conferences

โ€ข podcasts

โ€ข panels

Skim talks, quote insights, and search by keyword.

All in one place.

๐Ÿ‘‰ https://btctranscripts.com

โ›๏ธ Missed a workshop or podcast episode?

No worries.

You can now quickly search by keyword or topic and read the conversation in minutes instead of watching hours of video,

Accelerating your speed to insights.

๐Ÿง‘โ€๐Ÿซ Bitcoin Transcripts is perfect for:

- bitcoin devs digging into prior research

- educators creating content

- researchers analyzing protocol history or

- enthusiasts who prefer reading over listening

Taproot workshops, Lightning panels, itโ€™s all in there.

Open-source and built by the community ๐Ÿงก

This project stands on the shoulders of contributors like Bryan Bishop (https://heybryan.org/) who manually transcribed hundreds of talks.

Now, with modern tools, we can scale that effort for the whole community.

Many thanks to our contributors:

- Dev: nostr:nprofile1qqsd7kasecd3feyqqczsvx05vqyey3prqhsmsl0haldenwskhmq038cmf7k9s , Jamal (https://github.com/jrakibi), Emmanuel (https://github.com/Emmanuel-Develops), nostr:nprofile1qyx8wumn8ghj7cnjvghxjmcpz4mhxue69uhk2er9dchxummnw3ezumrpdejqqgr4fag972ezc7x8gc57gpg62d5pqmjantx7ydmu2kvh0p3sgqez2gclgh4s

- Data & architecture: Andreas (https://www.kouloumos.com/), Urvish (https://github.com/urvishp80)

- Vision: nostr:nprofile1qyxhwumn8ghj7cnjvghxjme0qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcqyp5qk5wd3kkux53y2tsynmwlw8y7dq2hr60yjpmyycvdgcx3s0lwcduz4ak

- Design: Tobi (https://x.com/Adeoye_G), Khush (https://x.com/ikhushh7), nostr:nprofile1qyshwumn8ghj7en9v4j8xtnwdaehgu3wvfskuep0w3uhqetnvdexjur5qy88wumn8ghj7mn0wvhxcmmv9uqzpxvff4mhj5snxn95nyf7yvupuxt2rwcsuklrahkcu857pqplmpndukqdk5

- Product: nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcpr4mhxue69uhkummnw3ezumt4w35ku7thv9kxcet59e3k7mf0qqswafckahdl7g8qgh7rp5lg9aps3dvtluhzwm52k3rgzyajas0paksutez5h

- Inspiration: Bryan Bishop (https://heybryan.org/)

Whatโ€™s next?

Weโ€™ll keep adding transcripts from upcoming events and backfill any important historic talks we missed. ๐Ÿ”

Would love your help editing transcripts as well.

Dive in, explore, and let us know what you think! ๐Ÿ‘‡

btctranscripts.com

Slots are filling up fast for our Warnet track at Friday's #MITBitcoinExpo Hackathon!

We stand up a network of Bitcoin Core nodes. You use Bitcoin Core's functional test framework to write attacks in Python and take them down.

This event is open to hackers around the globe. Participants can be in-person or remote. And did we mention the $3,000 prize from the MIT Bitcoin Club?

๐Ÿ‘‰ Head over to https://mitbitcoin.devpost.com to sign up today!

We'll also have weโ€™ll have additional prizes for Warnet track winners that are able to join in person. These gorgeous coasters by A+ Engrave are just one example! ๐Ÿคฉ

๐“๐ก๐ž ๐๐ข๐ญ๐œ๐จ๐ข๐ง ๐ƒ๐ž๐ฏ ๐๐ซ๐จ๐ฃ๐ž๐œ๐ญ ๐ก๐š๐ฌ ๐š ๐ญ๐ซ๐š๐œ๐ค ๐š๐ญ ๐ญ๐ก๐ž ๐Œ๐ˆ๐“ ๐๐ข๐ญ๐œ๐จ๐ข๐ง ๐„๐ฑ๐ฉ๐จ ๐‡๐š๐œ๐ค๐š๐ญ๐ก๐จ๐ง, ๐š๐ง๐ ๐ข๐ญ ๐ก๐š๐ฌ ๐š $๐Ÿ‘,๐ŸŽ๐ŸŽ๐ŸŽ ๐ฉ๐ซ๐ข๐ณ๐ž!

Participants have 30 hours, starting April 4 and are welcome to hack from around the globe.

๐ŸŒ We repeat, you do not have to attend in person ๐ŸŒŽ

๐Œ๐จ๐ฌ๐ญ ๐ก๐š๐œ๐ค๐š๐ญ๐ก๐จ๐ง ๐ญ๐ซ๐š๐œ๐ค๐ฌ ๐š๐ซ๐ž ๐š๐›๐จ๐ฎ๐ญ ๐›๐ฎ๐ข๐ฅ๐๐ข๐ง๐ , ๐›๐ฎ๐ญ ๐ง๐จ๐ญ ๐ญ๐ก๐ข๐ฌ ๐จ๐ง๐ž. ๐“๐ก๐ข๐ฌ ๐ข๐ฌ ๐š๐›๐จ๐ฎ๐ญ ๐›๐ซ๐ž๐š๐ค๐ข๐ง๐  ๐Ÿ”จ

For the Bitcoin Dev Project track, the goal is to take down the bitcoin network. We stand up a network of bitcoin core nodes. You and your team take down as many as possible.

Whichever team brings down the most in the shortest amount of time wins. Monitor extreme and yet unknown network behaviors, discover vulnerabilities, and build a stronger, more resilient bitcoin.

This track is for hackers with some level of coding skill, & the ability to use the command line interface (CLI). Familiarity with Bitcoin Core, esp. the JSON-RPC interface is useful. A general understanding of how blockchains and distributed networks work will come in handy.

Who's ready to win? Sign up below! ๐Ÿ‘‡

https://mitbitcoin.devpost.com/

New tool in Decoding Bitcoin!

REORG CALCULATOR โš’๏ธ

Computes the probability that an attacker could reorganize z blocks with a given % of the total network hashrate

Hereโ€™s the probability of an attacker reorganizing 6 blocks with 30% of the total hashrate

https://bitcoindevs.xyz/decoding/reorg-calculator

Buckle up for today's #DecodingBitcoin post. It's a long one but we promise it's worth your time.

Today we're going to break down how to sign a #bitcoin segwit transaction using a real example from the BIP-143 test vectors (thatโ€™s one of the segwit BIPs!)

๐‘๐‘œ๐‘ก๐‘’: ๐‘กโ„Ž๐‘–๐‘  ๐‘’๐‘ฅ๐‘Ž๐‘š๐‘๐‘™๐‘’ ๐‘–๐‘  ๐‘“๐‘œ๐‘Ÿ ๐‘Ž ๐‘ ๐‘’๐‘”๐‘ค๐‘–๐‘ก ๐‘ฃ0 ๐‘ก๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘› ๐‘ ๐‘œ ๐‘ ๐‘œ๐‘š๐‘’ ๐‘œ๐‘“ ๐‘กโ„Ž๐‘’ ๐‘ ๐‘๐‘’๐‘๐‘–๐‘“๐‘–๐‘๐‘  ๐‘Ž๐‘Ÿ๐‘’ ๐‘‘๐‘–๐‘“๐‘“๐‘’๐‘Ÿ๐‘’๐‘›๐‘ก ๐‘“๐‘œ๐‘Ÿ ๐‘™๐‘’๐‘”๐‘Ž๐‘๐‘ฆ ๐‘Ž๐‘›๐‘‘ ๐‘ก๐‘Ž๐‘๐‘Ÿ๐‘œ๐‘œ๐‘ก (๐‘ ๐‘’๐‘”๐‘ค๐‘–๐‘ก ๐‘ฃ1) ๐‘ก๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘›๐‘ . ๐ป๐‘œ๐‘ค๐‘’๐‘ฃ๐‘’๐‘Ÿ, ๐‘กโ„Ž๐‘’ ๐‘”๐‘’๐‘›๐‘’๐‘Ÿ๐‘Ž๐‘™ ๐‘๐‘œ๐‘›๐‘๐‘’๐‘๐‘ก๐‘  ๐‘Ž๐‘Ÿ๐‘’ ๐‘ ๐‘ก๐‘–๐‘™๐‘™ ๐‘กโ„Ž๐‘’ ๐‘ ๐‘Ž๐‘š๐‘’!

The transaction we'll be working with has two inputs. The first is a legacy P2PK inputโ€“we wonโ€™t be covering that today.

Instead, weโ€™re going to focus on the second input, the P2WPKH (native segwit) one.

Since this example came from one of the BIP-143 test vectors, we know what the final, signed transaction looks like. The goal is to recreate this:

First, we create the base transaction, the transaction without any signatures.

Weโ€™ll start with the

- version number

- marker & flag fields (to indicate the tx is segwit)

- locktime

๐ด ๐‘›๐‘œ๐‘ก๐‘’ ๐‘œ๐‘› ๐‘ ๐‘’๐‘”๐‘ค๐‘–๐‘ก ๐‘ฃ๐‘ . ๐‘™๐‘’๐‘”๐‘Ž๐‘๐‘ฆ ๐‘ก๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘›๐‘ : ๐ต๐‘’๐‘๐‘Ž๐‘ข๐‘ ๐‘’ ๐‘Ž๐‘ก ๐‘™๐‘’๐‘Ž๐‘ ๐‘ก ๐‘œ๐‘›๐‘’ ๐‘œ๐‘“ ๐‘กโ„Ž๐‘’ ๐‘–๐‘›๐‘๐‘ข๐‘ก๐‘  ๐‘–๐‘  ๐‘ ๐‘’๐‘”๐‘ค๐‘–๐‘ก (๐‘›๐‘Ž๐‘ก๐‘–๐‘ฃ๐‘’ ๐‘œ๐‘Ÿ ๐‘ค๐‘Ÿ๐‘Ž๐‘๐‘๐‘’๐‘‘), ๐‘กโ„Ž๐‘’ ๐‘ก๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘› ๐‘–๐‘  ๐‘Ž๐‘™๐‘ ๐‘œ ๐‘๐‘œ๐‘›๐‘ ๐‘–๐‘‘๐‘’๐‘Ÿ๐‘’๐‘‘ ๐‘ ๐‘’๐‘”๐‘ค๐‘–๐‘ก.

Hereโ€™s what we have so far:

Letโ€™s add inputs! Recall that all inputs come from existing transactions. That means for each input, we need to find the transaction it came from and get:

1. that transactionโ€™s ID

2. the output index

๐–๐ก๐š๐ญโ€™๐ฌ ๐š๐ง ๐จ๐ฎ๐ญ๐ฉ๐ฎ๐ญ ๐ข๐ง๐๐ž๐ฑ?

Every transaction has a list of outputs. The โ€œoutput indexโ€ is a way to reference a specific output from the list.

We need to ask, "from a transactionโ€™s list of outputs, which one corresponds to the input I care about?โ€

For each input, two more things are needed: the ๐ฌ๐œ๐ซ๐ข๐ฉ๐ญ๐’๐ข๐  (placeholder for data required to spend the input), and a ๐ฌ๐ž๐ช๐ฎ๐ž๐ง๐œ๐ž ๐ง๐ฎ๐ฆ๐›๐ž๐ซ (usually 0xFFFFFFFF)

After adding all the inputs, the transaction looks like this:

Remember when we said the scriptSig would be a placeholder? Hereโ€™s why those fields are currently empty:

Time to add outputs! For each output, we include the

- amount (in satoshis)

- scriptPubKey: the locking script that defines the rules for how the output can be spent

Things are starting to come together!

A few more things are needed before we can get to signing. First is setting up the ๐ฐ๐ข๐ญ๐ง๐ž๐ฌ๐ฌ field.

This is where the signature and corresponding public key go for segwit transactions.

The witness field starts off empty. This is different from legacy transactions where signatures are placed directly in the scriptSig field.

The next thing thatโ€™s needed is the ๐ฌ๐œ๐ซ๐ข๐ฉ๐ญ๐‚๐จ๐๐ž.

The scriptCode for a P2WPKH (pay-to-witness-public-key-hash) input is:

๐‘Šโ„Ž๐‘Ž๐‘กโ€™๐‘  ๐‘กโ„Ž๐‘Ž๐‘ก 20 ๐‘๐‘ฆ๐‘ก๐‘’ ๐‘๐‘ข๐‘๐‘˜๐‘’๐‘ฆ โ„Ž๐‘Ž๐‘ โ„Ž?

๐ธ๐‘Ž๐‘Ÿ๐‘™๐‘–๐‘’๐‘Ÿ ๐‘ค๐‘’ ๐‘ ๐‘Ž๐‘ค ๐‘’๐‘Ž๐‘โ„Ž ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก โ„Ž๐‘Ž๐‘  ๐‘Ž ๐‘ ๐‘๐‘Ÿ๐‘–๐‘๐‘ก๐‘ƒ๐‘ข๐‘๐พ๐‘’๐‘ฆ (๐‘Ÿ๐‘ข๐‘™๐‘’๐‘  ๐‘“๐‘œ๐‘Ÿ โ„Ž๐‘œ๐‘ค ๐‘ก๐‘œ ๐‘ ๐‘๐‘’๐‘›๐‘‘ ๐‘กโ„Ž๐‘’ ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก). ๐ด๐‘™๐‘ ๐‘œ, ๐‘Ÿ๐‘’๐‘๐‘Ž๐‘™๐‘™ ๐‘กโ„Ž๐‘Ž๐‘ก ๐‘กโ„Ž๐‘’ ๐‘–๐‘›๐‘๐‘ข๐‘ก ๐‘ก๐‘œ ๐‘œ๐‘›๐‘’ ๐‘ก๐‘Ÿ๐‘Ž๐‘›๐‘ ๐‘Ž๐‘๐‘ก๐‘–๐‘œ๐‘› ๐‘–๐‘  ๐‘กโ„Ž๐‘’ ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก ๐‘“๐‘Ÿ๐‘œ๐‘š ๐‘Ž๐‘›๐‘œ๐‘กโ„Ž๐‘’๐‘Ÿ.

๐‘‡โ„Ž๐‘’ 20 ๐‘๐‘ฆ๐‘ก๐‘’ ๐‘๐‘ข๐‘๐‘˜๐‘’๐‘ฆ โ„Ž๐‘Ž๐‘ โ„Ž ๐‘–๐‘  ๐‘’๐‘ฅ๐‘ก๐‘Ÿ๐‘Ž๐‘๐‘ก๐‘’๐‘‘ ๐‘“๐‘Ÿ๐‘œ๐‘š ๐‘กโ„Ž๐‘’ ๐‘๐‘œ๐‘Ÿ๐‘Ÿ๐‘’๐‘ ๐‘๐‘œ๐‘›๐‘‘๐‘–๐‘›๐‘” ๐‘œ๐‘ข๐‘ก๐‘๐‘ข๐‘ก'๐‘  ๐‘ ๐‘๐‘Ÿ๐‘–๐‘๐‘ก๐‘ƒ๐‘ข๐‘๐พ๐‘’๐‘ฆ.

Hereโ€™s the ๐ฌ๐œ๐ซ๐ข๐ฉ๐ญ๐‚๐จ๐๐ž for the example weโ€™re working on:

Lastly, three important hashes are required.

The first is ๐ก๐š๐ฌ๐ก๐๐ซ๐ž๐ฏ๐จ๐ฎ๐ญ๐ฌ. Itโ€™s the double SHA256 hash of all input outpoints (outpoint = the transaction id + output index)

The second is ๐ก๐š๐ฌ๐ก๐’๐ž๐ช๐ฎ๐ž๐ง๐œ๐ž, the double SHA256 hash of all input sequence numbers.

The third is ๐ก๐š๐ฌ๐ก๐Ž๐ฎ๐ญ๐ฉ๐ฎ๐ญ๐ฌ, the double SHA256 hash of all outputs.

Thatโ€™s everything (finally!). Letโ€™s put it all together into something that can be signed!

When signing a transaction, the spender actually signs a hash of the transaction data, not the entire transaction itself. This hash is called the ๐ฌ๐ข๐ ๐ก๐š๐ฌ๐ก.

The data used to create the sighash is called the ๐ฉ๐ซ๐ž๐ข๐ฆ๐š๐ ๐ž.

For a transaction input, the preimage is made of these items:

The sighash_type indicates which parts of the transaction the signature is committing to.

After hashing the preimage twice with SHA-256, weโ€™re left with the sighash.

At last! Itโ€™s time to do some signing!

There are a few steps for signing a segwit (v0) transaction.

First, the signerโ€™s private key is used to create an ECDSA signature for the sighash.

The resulting signature has two parts, ๐‘Ÿ and ๐‘ .

In ECDSA, there are actually two valid s values for every signature: a "high" value and a "low" value.

Both are mathematically valid, but bitcoin requires using the low s value to prevent transaction malleability (that means altering a transaction's ID!)

After selecting the low s value, the signature must be encoded into DER format. This is how itโ€™s structured:

And hereโ€™s what the DER encoded signature looks like for our example:

The last step is to add a byte at the end for the sighash type. If we look back at the preimage made earlier we see this example is using SIGHASH_ALL (0x01).

The full code for the signing step looks like this:

Remember the transaction witness field we set space aside for? Itโ€™s now time to put the signature in it ๐Ÿš€

This is how the witness field is structured:

Which works out to be this for our example:

With the completion of the witness field, the transaction is now signed!

This is what the final signed transaction hex looks like broken down:

Bonus: You can use the Bitcoin Core CLI decoderawtransaction command to examine all the parts of the raw transaction hex

* ~ * ~ * ~ * ~ * ~ * ~

If you made it to the end, give yourself a pat on the back. If you enjoyed it, be sure to like this post so we know to make more like it!

* ~ * ~ * ~ * ~ * ~ * ~

This material is from Decoding Bitcoin, your go-to resource for understanding bitcoin, #privacy, and #decentralization.

You can visit https://bitcoindevs.xyz/decoding/transaction-signing for the full lesson with all the code examples, as well as more free, interactive content.

For more of a challenge, play chapters 4, 5, and 6 of nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcppemhxue69uhkummn9ekx7mp0qqsxzd8vy8dftm4uds7hx0ecyn0yrs9n36h30q0mgz38w6uk60xd6vsclfqsf (https://savingsatoshi.com) to learn about public-private key cryptography, digital signatures, and transaction building ๐Ÿ˜บ

Hope you learned something new about transaction signing. If you enjoyed this, share it with a friend and donโ€™t forget to follow us, nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcppemhxue69uhkummn9ekx7mp0qqs8sccnw8c4ns0xjen9mgdgks25d46k2kcssk60uxs635zmngxh5ns3quvtq for more content like this.

Thanks for reading!

Weโ€™ve got a good #DecodingBitcoin post for you today. The topic? ๐„๐ง๐๐ข๐š๐ง๐ง๐ž๐ฌ๐ฌ, AKA the order of bytes in a computerโ€™s memory.

When we put it like that it sounds a little boring, but thereโ€™s something interesting, and dare we say ๐‘Ž๐‘›๐‘›๐‘œ๐‘ฆ๐‘–๐‘›๐‘”, about how bitcoin handles endiannessโ€ฆ

Before we get to that, letโ€™s better understand what endianness is.

Imagine reading directions in different languages: while English is written and read from left to right, Arabic text flows from right to left.

Similarly, computers have two ways to store data:

1. ๐๐ข๐ -๐ž๐ง๐๐ข๐š๐ง (BE): Most significant byte first

2. ๐‹๐ข๐ญ๐ญ๐ฅ๐ž-๐ž๐ง๐๐ข๐š๐ง (LE): Least significant byte first

When computers with different byte orders try to communicate, they can misread each other. Itโ€™s like two people reading numbers from opposite directions.

๐๐ข๐ -๐ž๐ง๐๐ข๐š๐ง ๐ฌ๐ญ๐จ๐ซ๐ž๐ฌ ๐ญ๐ก๐ž ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž ๐Ÿ๐ข๐ซ๐ฌ๐ญ. This is similar to how humans read numbers and Hex in most cases: starting with the most important information.

Suppose we want to store the number 12345678 (hexadecimal: 0x00BC614E) in memory. In big-endian, the bytes are stored in this order:

00 BC 61 4E

Observe that:

- The ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (00) is stored at the ๐ฅ๐จ๐ฐ๐ž๐ฌ๐ญ ๐ฆ๐ž๐ฆ๐จ๐ซ๐ฒ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (00).

- The ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (4E) is stored at the ๐ก๐ข๐ ๐ก๐ž๐ฌ๐ญ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (03).

Big-endian is considered more "human-readable" because the data is stored in the order we naturally read it.

๐‹๐ข๐ญ๐ญ๐ฅ๐ž-๐ž๐ง๐๐ข๐š๐ง ๐ฌ๐ญ๐จ๐ซ๐ž๐ฌ ๐ญ๐ก๐ž ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž ๐Ÿ๐ข๐ซ๐ฌ๐ญ. This might feel counter intuitive to humans but is more efficient for modern processors.

Using the same number 12345678 (0x00BC614E), here's how it looks in little-endian:

4E 61 BC 00

This time, the ๐ฅ๐ž๐š๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (4E) is stored at the ๐ฅ๐จ๐ฐ๐ž๐ฌ๐ญ ๐ฆ๐ž๐ฆ๐จ๐ซ๐ฒ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (00).

The ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐ข๐ ๐ง๐ข๐Ÿ๐ข๐œ๐š๐ง๐ญ ๐›๐ฒ๐ญ๐ž (00) is stored at the ๐ก๐ข๐ ๐ก๐ž๐ฌ๐ญ ๐š๐๐๐ซ๐ž๐ฌ๐ฌ (03).

This "reversal" of bytes is common in the Bitcoin Core codebase.

In bitcoin, most data like transaction IDs, block headers, and amounts are all in little-endian format or with the bytes reversed.

๐‘๐‘œ๐‘ก๐‘’: ๐ธ๐‘›๐‘‘๐‘–๐‘Ž๐‘›๐‘›๐‘’๐‘ ๐‘  ๐‘œ๐‘›๐‘™๐‘ฆ ๐‘Ž๐‘๐‘๐‘™๐‘–๐‘’๐‘  ๐‘ก๐‘œ ๐‘–๐‘›๐‘ก๐‘’๐‘”๐‘’๐‘Ÿ๐‘ . ๐ผ๐‘ก ๐‘–๐‘  ๐‘›๐‘œ๐‘ก ๐‘๐‘œ๐‘Ÿ๐‘Ÿ๐‘’๐‘๐‘ก ๐‘ก๐‘œ ๐‘ ๐‘Ž๐‘ฆ ๐‘Ž โ„Ž๐‘Ž๐‘ โ„Ž ๐‘–๐‘  ๐‘™๐‘–๐‘ก๐‘ก๐‘™๐‘’-๐‘’๐‘›๐‘‘๐‘–๐‘Ž๐‘›. ๐‘†๐‘–๐‘›๐‘๐‘’ ๐‘กโ„Ž๐‘’๐‘Ÿ๐‘’โ€™๐‘  ๐‘›๐‘œ ๐‘œ๐‘“๐‘“๐‘–๐‘๐‘–๐‘Ž๐‘™ ๐‘ก๐‘’๐‘Ÿ๐‘š ๐‘“๐‘œ๐‘Ÿ ๐‘กโ„Ž๐‘–๐‘  ๐‘ค๐‘’ ๐‘ ๐‘Ž๐‘ฆ โ€œ๐‘๐‘ฆ๐‘ก๐‘’ ๐‘ ๐‘ค๐‘Ž๐‘๐‘๐‘’๐‘‘โ€ ๐‘œ๐‘Ÿ โ€œ๐‘Ÿ๐‘’๐‘ฃ๐‘’๐‘Ÿ๐‘ ๐‘’ ๐‘๐‘ฆ๐‘ก๐‘’๐‘ โ€.

For readability, the bytes are swapped back to the style of big-endian when this data is displayed to humans. A block explorer is one example of where you can see this.

Bitcoin Coreโ€™s JSON-RPC interface was the first time block hashes were printed for human consumption. That was when someone decided to reverse the ordering of hash so that it looked like a human readable integer.

It turns out the real block hash, the actual sha256 value you get if you compute the hash yourself, is:

e4b1d56439d46d9070e58c4368cccc97596fa908daf101000000000000000000

The zeros are actually on the right! At first glance it looks like this is a very large number, but we know the integer value of a block hash actually gets smaller as the difficulty increases.

It's clear that the bytes are reversed and in the style of little-endian. But why? We can thank Satoshi for that. Satoshi decided to interpret the block hash as a little-endian integer. The more zeroes there are on the right side, the smaller the (little-endian) integer.

Since most modern CPUs are little-endian, bitcoin uses it to optimize performance.

However, network protocols typically use big-endian, creating a mismatch ๐Ÿ™€

Big-endian is used for network communication (network byte order). Little-endian is used for bitcoinโ€™s internal storage.

This duality requires developers to frequently, and sometimes frustratingly, convert between the two formats when working with bitcoin data.

Have you been the victim of an endianness oversight when writing bitcoin code? It's a common source of pain for developers new to bitcoin (and even the seasoned ones!)

As covered by the transaction ID example earlier, byte order confusion can be common.

Another gotcha is length specification. When converting to little-endian, always specify the correct byte length:

Hope you learned something new about endianness today. If you enjoyed this, share it with a friend and donโ€™t forget to follow us, nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcppemhxue69uhkummn9ekx7mp0qqs8sccnw8c4ns0xjen9mgdgks25d46k2kcssk60uxs635zmngxh5ns3quvtq !

This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization.

Visit https://bitcoindevs.xyz/decoding for the full lesson, and more free, interactive content.

Thanks for reading!

There is an oft-repeated sentiment in the community that bitcoin does not need you. While bitcoin is designed to be resilient, we ๐‘‘๐‘œ need you. Bitcoin needs all the talent and energy it can gather to solve some of the most difficult technical problems of our time.

Bitcoin in your hands changes everything.

Thank you! We will pass your kind words onto our designers :)

Itโ€™s #DecodingBitcoin time! Letโ€™s go over the basic elements of a transaction.

Alice wants to send 5 BTC to Bob. She needs to create a bitcoin transaction using the unspent outputs (UTXOs) in her wallet.

UTXOs are unspent transaction outputs. They can be used as inputs for new transactions.

Think of them as "coins" in a wallet, waiting to be spent.

Alice checks her wallet and finds two UTXOs:

To create a transaction, Alice has to specify exactly which UTXOs to spend.

A UTXO is identified by the transaction it came from, specifically

- the transaction ID and

- an index that says where the UTXO is in the list of transaction outputs

Wallets usually store this information for you but you can also look it up on the blockchain.

Alice's wallet shows these available UTXOs:

- UTXO #1: 4 BTC (from Transaction 1, Output Index 1)

- UTXO #2: 2 BTC (from Transaction 2, Output Index 0)

Together, they provide enough funds (4 BTC + 2 BTC = 6 BTC) for the payment and any transaction fees.

Now Alice has everything she needs to identify her UTXOs. As she adds them to the transaction, she saves space for the signatures she will make later. These signatures authorize the spending of the UTXOs.

Now that the transaction inputs have been taken care of, itโ€™s time to look at the outputs!

Alice needs to create two outputs:

- 5 BTC to Bob (the payment amount)

- 0.99 BTC back to Alice as change (there is a 0.01 BTC transaction fee)

Why do we have to make a separate output for change?

UTXOs must be spent in their entirety. You cannot partially spend a UTXO. Instead, you create a new output that sends the excess amount back to yourself as change.

Looks good! The transaction structure is now complete, but itโ€™s not yet valid. Alice must sign it to prove she owns the inputs. Weโ€™ll cover that in a future lesson ๐Ÿ™‚

Follow us nostr:nprofile1qyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcppemhxue69uhkummn9ekx7mp0qqs8sccnw8c4ns0xjen9mgdgks25d46k2kcssk60uxs635zmngxh5ns3quvtq to stay updated!

This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization.

If you enjoyed it, visit https://bitcoindevs.xyz/decoding for the full lesson, and more free, interactive content.

Thanks for reading!

Are you tired of searching for "lightning" only to get results about sparks in the sky and ice hockey teams in Florida?

So are we. That's why we built Bitcoin Search, which pulls from a curated list of credible #bitcoin tech sources.

https://bitcoinsearch.xyz

We've built the world's largest collection of technical bitcoin-related resources: articles, podcast transcripts, blog posts, and more.

Sources are regularly monitored to make sure your search results are up-to-date.

We hand-pick sources for their contributions to technical bitcoin concepts. Examples include the Bitcoin-dev Mailing List, LN dev Mailing List, Bitcoin Optech, and many more.

Bookmark it and try it out today!

What's the deal with #bitcoin fees? How are they calculated? Where do they go? Let's have a look with a #DecodingBitcoin post:

A transaction's fee is equal to the total amount of bitcoin in the inputs, minus the total amount of bitcoin in the outputs.

Here's how to calculate the fee for this transaction: https://mempool.space/tx/c27c4d2236fce2a7542e024408d7f89b95e50e42a2c3d10be499c3102ccb45ef

Fee = Input - (Output1 + Output2)

Fee = 299.99430000 - (0.00140000 + 299.99240000)

Fee = 299.99430000 - 299.99380000

Fee = 0.00050000

Fee = 50,000 sats

Remember: Sum(Inputs) should always be greater than Sum(Outputs)

Fees incentivise miners to include transactions in blocks. Without fees, miners would have little reason to put transactions into blocks!

In addition to fees, miners also receive a block reward.

Total miner revenue = fees + block reward

How do miners decide what transactions go into a block?

The short answer is miners will usually maximize revenue by prioritizing transactions with the highest fee rate (we've got a whole lesson fee rates coming!)

While miners can choose which transactions to include based on fees, there's a minimum threshold, a "minimum relay fee" that must be met just for a transaction to be relayed through the network.

Transactions below this threshold are rejected by nodes. It helps prevent spam and DoS attacks on the network

This brings us to an important question: What happens if you submit a transaction with a fee rate above the minimum but still too low for current network conditions?

That transaction could sit in the mempool for hours because the fee rate is too low for the high level of network activity. Even if you met the minimum, there can still be plenty of transactions with higher fee rates than yours, ones that miners will choose first.

At this point, you have two main ways to "unstick" it:

1. RBF (Replace-by-Fee)

2. CPFP (Child Pays for Parent)

--------------------------------

That's all for now! We'll dive deeper into fee rates, RBF, and CPFP in a future post.

This material is from Decoding Bitcoin, your go-to resource for understanding #bitcoin, privacy, and decentralization.

If you enjoyed it, visit https://bitcoindevs.xyz/decoding for the full lesson, and more free, interactive content!

And don't forget to follow us for more posts about bitcoin tech and tools to help you in your developer journey ๐Ÿš€

Psst. Don't have enough hours in the day to read the mailing list and Delving Bitcoin? We have a secret weapon for you.

Bitcoin TLDR has daily summaries, available by post or by thread: https://tldr.bitcoinsearch.xyz

Here's today's summary of the bitcoin-dev mailing list:

- Ava Chow announced Bitcoin Core version 28.1. It makes adjustments to p2p configurations to enhance usability & reduce startup failures. It also has internal ID counting updates, enhancements in key handling, build system improvements, & a call for community participation in reporting bugs and joining the announcement list

- nostr:nprofile1qy08wumn8ghj7mn0wd68yttsw43zuam9d3kx7unyv4ezumn9wshsz8nhwden5te0dehhxarj94c82c3wwajkcmr0wfjx2u3wdejhgtcpr4mhxue69uhkummnw3ezucnfw33k76twv4ezuum0vd5kzmp0qyv8wumn8ghj7mn0wd68ytnvdac8qtnnda3kjctv9uq3wamnwvaz7tmwdaehgu3wwe6kcur9d5hxxmmd9uq3wamnwvaz7tmwdaehgu3wwe6kcur9d5hxxmmd9uq3zamnwvaz7tmwdaehgu3wwa5kuef0qyt8wumn8ghj7ur4wfcxcetjv4kxz7fwvdhk6tcpzemhxue69uhhqatjwpkx2un9d3shjtnrdakj7qg4waehxw309aex2mrp0yhxgctdw4eju6t09uq32amnwvaz7tmjv4kxz7fwv3sk6atn9e5k7tcpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtcprpmhxue69uhhyetvv9ujumn0wd68y6trdqhxgef0qyv8wumn8ghj7un9d3shjtnwdaehgunfvd5zuer99uq3jamnwvaz7tmjv4kxz7fwdehhxamgv4ex2tnrdakj7qghwaehxw309aex2mrp0yh8xar0dejhytnrdakj7qgnwaehxw309amk7apww468smewdahx2tcqyrmj3k0xuuzgxk88pyc0tjnykzthwrvcnnxcdp20ucvwm2wg5wqsv8rdmde raised concerns about the reliability of transaction timestamp data, specifically the vulnerability of nLockTime. It can be manipulated for unfair prioritization benefits, undermining the effectiveness of new prioritization rules.

- Yuval Kogman critiqued misconceptions around privacy mechanisms, focusing on wabisabi credentials & Wasabi wallet. He sheds light on the challenges with safeguarding privacy and security, emphasizing transparency, comprehensive security measures, & ethical considerations.

Thanks for sharing Ross ๐Ÿ˜€

Enjoy!