[bitcoin-dev] Bandwidth-Efficient Transaction Relay for Bitcoin

2019-05-27 Thread Gleb Naumenko via bitcoin-dev
Hi all, We are making public our latest work on Erlay, an efficient transaction relay protocol for Bitcoin. It is available here: https://arxiv.org/abs/1905.10518 The main idea is that instead of announcing every transaction to every peer, announcements are only sent directly over a small numbe

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Kostas Karasavvas via bitcoin-dev
On Sun, May 26, 2019 at 5:07 PM Aymeric Vitte via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > I realized recently that my segwit implementation was not correct, > basically some time ago, wrongly reading the specs (and misleaded by > what follows), I thought that scriptsig would

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Aymeric Vitte via bitcoin-dev
Well, OK, then back to non standard stuff and bitcoin considers that an OP_1 or empty scriptpubkey is something that can exist, sipa does not like my questions on this list but this is a bit frightening in fact to see that after 10 years an OP_1 scriptpubkey or empty one can be a use case, thanks T

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Thomas Kerin via bitcoin-dev
The scriptSig when evaluated populates the stack so opcodes can operate on them. A witness is essentially a list of data elements, quite similar to the script stack (the witness is passed in as the script stack in fact) OP_0 when evaluated pushes a _zero length_ value onto the stack, hence the 00

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Aymeric Vitte via bitcoin-dev
I did not phrase correctly in fact, what I meant is: if the validator sees empty or witness script in scriptSig, then this is a segwit input, and doing this one by one the validator can associate the correct segwit data to the correct segwit input, so 00 does not look to be needed Le 26/05/2019 à

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Pieter Wuille via bitcoin-dev
On Sun, May 26, 2019, 07:07 Aymeric Vitte via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > I realized recently that my segwit implementation was not correct, > basically some time ago, wrongly reading the specs (and misleaded by > what follows), I thought that scriptsig would go i

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Aymeric Vitte via bitcoin-dev
OK, thanks, understood for OP_0 but still for the 00 number of witness data for non segwit inputs the one that is doing the transaction knows which inputs are segwit or not, then parsing the transaction you can associate the correct input to the correct witness data, without the need of 00, so I mu

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Johnson Lau via bitcoin-dev
Empty scriptSig doesn’t imply segwit input: if the previous scriptPubKey is OP_1 (which does not allow witness), it could still be spent with an empty scriptSig Similarly, a scriptSig looking like a spend of P2SH-segwit doesn’t imply segwit input: if the previous scriptPubKey is empty, it could

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Johnson Lau via bitcoin-dev
This is not how it works. While the transaction creator may know which inputs are segwit, the validators have no way to tell until they look up the UTXO set. In a transaction, all information about an input the validators have is the 36-byte outpoint (txid + index). Just by looking at the outpoi

Re: [bitcoin-dev] Two questions about segwit implementation

2019-05-27 Thread Johnson Lau via bitcoin-dev
> On 26 May 2019, at 7:56 AM, Aymeric Vitte via bitcoin-dev > wrote: > > I realized recently that my segwit implementation was not correct, > basically some time ago, wrongly reading the specs (and misleaded by > what follows), I thought that scriptsig would go into witness data as it > was, bu

Re: [bitcoin-dev] An alternative: OP_CAT & OP_CHECKSIGFROMSTACK

2019-05-27 Thread Anthony Towns via bitcoin-dev
On Wed, May 22, 2019 at 05:01:21PM -0400, Russell O'Connor via bitcoin-dev wrote: > Bitcoin Script appears designed to be a flexible programmable system that > provides generic features to be composed to achieve various purposes. Counterpoint: haven't the flexibly designed parts of script mostly

Re: [bitcoin-dev] SIGHASH_ANYPREVOUT proposal

2019-05-27 Thread Rusty Russell via bitcoin-dev
Anthony Towns writes: > On Wed, May 22, 2019 at 12:17:31PM +0930, Rusty Russell wrote: >>I prefer to >>change the bip introduction to expliclty shout "THESE SIGNATURE >>HASHES ARE UNSAFE FOR NORMAL WALLET USAGE.", and maybe rename it >>SIGHASH_UNSAFE_ANYPREVOUT. > >> 4. "Rebinding