Headshop Wiki Everything You Need To Know Puffing Bird

BIP 199 HTLC initial stack state

Hey fellow bitcoiners and redditors

I'm trying to understand how HTLCs (Hashed Time-Locked Contracts) can be implemented in Bitcoin and BIP-199 turned out to be the best resource for that purpose.

TL;DR
Question answered!
  1. Does the stack need to feature the secret/image twice in the OP_IF case? => call the script with [pubKey, signature, 1]
  2. How can the OP_ELSE flow ever be executed successfully (since this requires the stack to be empty, but [pubKey, signature] are required for OP_CHECKSIG at the very end of the script )? => call the script with [pubKey, signature, 0]

Full story
This is the example HTLC script I copied from BIP-199:
OP_IF
[HASHOP] OP_EQUALVERIFY OP_DUP OP_HASH160
OP_ELSE
[TIMEOUTOP] OP_DROP OP_DUP OP_HASH160
OP_ENDIF
OP_EQUALVERIFY
OP_CHECKSIG

IF-Case (seller can claim the buyers deposited BTCs)
TL;DR: detailed debug log of this path. Question: Can I avoid providing the preimage twice?

Before running this script, the preimage should be known and the stack should looks:
preimage
preimage
pubKey
signature

  • So since the stack is not empty, it will jump into the OP_IF clause.
    • the OP_IF will pop the top value => stack is now: [preimage, pubKey, signature]
  • [HASHOP] will hash the preimage
    • the preimage on the stack will, be replaced by the image => stack: [image, pubKey, signature]
  • digest (a synonym for image) will be pushed
    • => stack: [image, image pubKey, signature]
  • OP_EQUALVERIFY checks the two top items for equality: image == image => true
    • ...and removes them, if they are equal => stack: [pubKey, signature]
  • OP_DUP will duplicate the pubKey, => stack: [pubKey, pubKey, signature]
  • OP_HASH160 will double-hash the pubKey => stack: [p2pkhAddress, pubKey, signature]
  • represents the p2pkhAddress => stack: [p2pkhAddress, p2pkhAddress, pubKey, signature]
  • OP_EQUALVERIFY checks the two top items for equality: p2pkhAddress == p2pkhAddress => true
    • ...and removes them, if they are equal => stack: [pubKey, signature]
  • OP_CHECKSIG checks the signature
  • Done, all fine!
  • Question: This flow requires the secret to be on the stack twice before starting the script; Can I avoid that somehow?

ELSE-Case (buyer claims refund of his/her deposited BTCs)
Since the script runs an OP_CHECKSIG at the very end. This means the stack has to contain at least [pubKey, signature] before the execution pointer moves to OP_IF. However, OP_IF returns true "If the top stack value is not False". So how can the script possibly ever execute the OP_ELSE flow?

Disclaimer
  • My mother tongue is not English, please forgive me any mistakes. :)
  • I'm just getting started with BTC scripting, please forgive me any noob mistakes.
  • I also searched the whole stackexchange/search engine/reddit/github universum for this issue, obivously without success.
PS - buy Bitcoin :)
submitted by redditeraya to Bitcoin [link] [comments]

8-BitRyan - YouTube Laptop Battery Analyzer NLBA1 - Smart Battery System Part-1 Chris Chan  Keep Sonic Original  BasedShaman Review YouTube a-ha - Take On Me (Live From MTV Unplugged) - YouTube

I believe that most of us that own a bong could never stand our bong getting all those black or brown or tar-like goo stuck on the inside, another article on Puffing Bird Wiki had mentioned some formulas for cleaning your bong. Water bongs have percolators. Percolators help to sufficiently mix the smoke and the water so you can get a smooth hit. But except for beaker bongs, percolator bongs ... Hashop.IO - Bitcoin Wiki; New BIP (0199) - HTLC transactions · bitcoin/[email protected] Hashop.io - Bitcoin Cloud Mining. - Bitcoin Forum; GHash.IO Bitcoin Mining; Re: Hashop.io - Bitcoin Cloud Mining. « Reply #3 on: April 18, 2014, 11:01:57 AM » Hashop.io offers 4 promotional Plans for 20, 50, 100 or 200 GHs with an amazing price of $4.9 per 1 GHs. Hashop.IO. Hashop.IO is one of the ... Hashop.io guarantees daily payouts and no additional fees except the maintenance fee. The user is required to make a one-time payment that implies a 2-year contract. The company accepts credit cards, wire transfer and Bitcoin payments via Bitpay, BIPS and Coinbase. Hashop.io has an on-going discount system. In addition according to the company’s promotional scheme, the users can receive a ... Wikimedia Deutschland e. V. Über uns. Stellenangebote. Impressum & Kontakt. Mitwirken. Mitglied werden. Jetzt spenden. Mittelverwendung. Vereinskanäle. Unser Blog Hashop.IO; Hashrate; Hashra Astro; Hashra Astro Warp 3; Hashra Moonraker 1THS; Hashra Moonraker 2THS; Hashra Moonraker 3THS ; Hash Exchange; Helena Bitcoin Mining; HHTT; Higher difficulty pooled mining; HIS R9 390 (30 Mh/s for Ethash) Honest Mining; Horizen; I. IBeLink DM384M; IceDrill; Ice Rock Mining ICO; ICoin IEO; INNO3D GTX 760 (9 Mh/s for Ethash) Is bitcoin mining profitable; J. Jonny ...

[index] [47132] [4167] [29588] [4501] [34212] [28724] [5832] [11258] [12427] [2001]

8-BitRyan - YouTube

Shower Speaker: http://amzn.to/1MWLUoe UK Shoppers: http://amzn.to/214Q9IP Filmed On Canon 60D: http://amzn.to/1MWM12T Lights Behind Me On TV: http://amzn.to... Delmenews.de ist das lokale Nachrichtenportal für die Stadt Delmenhorst bei Bremen. Jeden Tag gibt es aktuelle Meldungen aus der kreisfreien Stadt. Der Delme... Welcome to my channel, my name is Ryan! You can expect to see a variety of gaming content based around just about every genre out there! If this is your thin... Chris Chan Keep Sonic Original BasedShaman Review - Chris Chan was a huge Sonic the Hedgehog fan and didn't want Sonic's arms to be changed in the Sonic Boom video game. This showed that Chris ... Taken from the forthcoming album/DVD a-Ha: MTV Unplugged Summer Solstice (17 Hits + 2 Cover Versions + 2 brand new Songs) Pre Order here: http://lnk.to/aha-u...

#