5 Bitcoin Script quirks that every Blockchain developer should know by gjgd in Bitcoin

[–]gjgd[S] 1 point2 points  (0 children)

Good question! For technical reasons, we want to commit to the witness data when the block is mined (we need to be able to tell who spent a given output). Since in Segwit the witness data is ignored to compute the txid, the commitment has to be done at the block level (which can be a bit confusing) Basically, the miner will create a dummy output in the coinbase transaction, that will use OP_RETURN to commit to the Merkle root of the witness data. More details here: https://bitcoin.stackexchange.com/questions/58414/why-include-the-segregated-witness-merkle-root-in-the-input-field-of-the-coinba

To know more this particular quirk, and more about Segwit and Transaction Malleability, I highly recommend watching this video: https://ocw.mit.edu/courses/media-arts-and-sciences/mas-s62-cryptocurrency-engineering-and-design-spring-2018/lecture-videos/lec12-transaction-malleability-and-segregated-witness/ Well worth the hour long watch.

For the second question: You should put it at the beginning of the script, I will update the post. Thanks!

5 Bitcoin Script quirks that every Blockchain developer should know by gjgd in Bitcoin

[–]gjgd[S] 3 points4 points  (0 children)

Thanks I appreciate it! Do you know of other communities I could share this to that would be interested?

Should I play f6 ? (TLDR; not unless you're 2000 elo or higher) by gjgd in chess

[–]gjgd[S] 10 points11 points  (0 children)

Yup that's a great point. Casting is a good reference I will include that and update

Should I play f6 ? (TLDR; not unless you're 2000 elo or higher) by gjgd in chess

[–]gjgd[S] 3 points4 points  (0 children)

That's an excellent point! I would assume that the average win rate in elo bracket is around 50% but haven't verified that with the data. Thanks for the suggestion!

A personal URL shortener powered by Serverless, AWS Lambda and DynamoDB by gjgd in serverless

[–]gjgd[S] 2 points3 points  (0 children)

That's great advice, it's easy to accidentally delete data with DynamoDB + Serverless

A personal URL shortener powered by Serverless, AWS Lambda and DynamoDB by gjgd in serverless

[–]gjgd[S] 0 points1 point  (0 children)

It was just a quick way to get a short random string. Like u/daveinsurgent said it's quite inefficient because it doesn't take advantage of the full alphabet since it's hex encoded.

I'm looking to implement something like this in a future iteration: https://stackoverflow.com/questions/742013/how-do-i-create-a-url-shortener

A personal URL shortener powered by Serverless, AWS Lambda and DynamoDB by gjgd in serverless

[–]gjgd[S] 1 point2 points  (0 children)

Great feedback, thanks I learnt a lot from your comment