Title: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 05, 2012, 01:37:19 PM I think I've found a way to combine hashcoin's method for Instant TX for established business relationships (https://bitcointalk.org/index.php?topic=25786.0) and Gavin's more recent ideas for Off-the-chain transactions (http://gavintech.blogspot.co.il/2012/07/off-chain-transactions.html) to allow any party to send bitcoins to any other party, with instant confirmation, without adding to the transaction count of the blockchain (thus scalability-friendly), with absolutely minimal need for trust in a third party. The disadvantage is that it requires bitcoins to be tied up, so it is less effective the more time value bitcoins have.
hashcoin's method (https://bitcointalk.org/index.php?topic=25786.0), if I understand it correctly, allows establishing a payment channel from user A to user B with the following properties: 1. A has to tie up X BTC for a period of time decided in advance (say a month). 2. During this time, A can't do anything with those bitcoins other than paying to B. 3. Establishing a channel does not constitute payment. B can't take the money, and if B vanishes A will still get it back at the end of the period. 4. While the channel is up, A can use it to pay B multiple times, up to a total of X BTC. 5. Each such payment is done by private communication between A and B, doesn't require communication with the network or a separate transaction, and is instantly confirmed - once B gets the necessary information from A, he can be sure it cannot be reversed. 6. At the end of the term, all payments are settled together with 2 small transactions. 7. If A vanishes mid-term, B can still claim his payments so far at the end. If B vanishes mid-term, A can still claim everything that he hasn't paid yet, and in some cases even the funds that he has paid. 8. The receiver can close the channel before its expiration date if it's no longer needed, freeing the tied up funds. The question is what to do if I don't know in advance who I'm going to pay. And the answer is simple - have an eWallet of sorts that never holds anyone's money, but simply establishes payment channels to and from each of its customers. Say Alice and Bob are both users of the payment processor Trent. Trent establishes channels to Alice and Bob, and Alice and Bob establish channels to Trent. The amounts and period will be determined by how much money each expects to move. If Alice needs to pay Bob, she pays Trent through the channel, and informs him that Bob is the recipient. Trent then pays Bob through the channel. The payments are instantly confirmed and there is no need to add a transaction to the blockchain for this. Instead of one transaction per payment, we have about 4 transactions per user per period over which there can be many payments. And the processor is never trusted with more than the amount of a single payment by a single customer. The BTC amount of the channel, which is constantly tied up, should suffice for the payments that are expected to be made over the period. The shorter the period, the less funds need to be tied up, but the more transactions need to enter the blockchain in a time unit. There's a tradeoff for which an optimal solution will be found on a case-by-case basis. No doubt, Trent will charge his customers for the service of tying up his own funds for the downstream channel. Either party of course can create a new channel when the current channel end up not sufficing, at the cost of more blockchain transactions. There is no need for Alice and Bob to be using the same payment processor. The processors can have reciprocity agreements between them and allow funds to be sent from one to another. If there is some trust between them, they can cancel out small payments without saturating the channel, reducing the amount they need to tie up for this. There is very little barrier of entry to becoming a processor, so there will be many highly competitive processors. Unlike the current version of Gavin's idea, this is resistant to collusion, to accounting errors of the processor, and to the processor vanishing thus making the coins unspendable. It may be hard to imagine anyone tying up his funds for this, when weekly interest rates of 2% are easy to be found. But this isn't going to last forever - as Bitcoin grows and stabilizes, ROI for safe investments will settle down, and the time value of money will approach what we are familiar with in traditional economics (probably even less, because there is no inflation). It will be reasonable to keep bitcoins as-are as a long-term investment, and by that point one may as well tie them up in a channel to his payment processor. EDIT: It appears I've missed this comment (https://bitcointalk.org/index.php?topic=25786.msg480826#msg480826) by jav, where he also mentions the receiving end can be a payment processor. But he doesn't go as far as suggesting that the processor should also use outgoing channels. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 05, 2012, 02:37:01 PM I think it would work, but I can't see how the payment processor makes any money. As you said, his own funds are tied up in multiple connections; so all that money has to be rented somehow, and that doesn't even cover the costs of running the service itself. I think that this would work great for long term reciprocity agreements between major online bitcoin payment processors, but in order for this to be beneficial there must be more than 4 transactions between users of a service. For most this is unlikely, as most paypal users don't average one a month. Reciprocity agreements between large online wallet services, however, can expect to have at least dozens of transactions between their userbases in any given day; many of which will simply cancel out. A pair of payment processors could choose to tie up, say 1000 bitcoins in each others' service (or use this method to do so with a meta-processor) with the agreement that, should the transactions total to an imbalance of more than 50% of the funds in either direction, the processor that owes produces a 500 bitcoin transaction automaticly, thus rebalancing the flow. This can consolidate hundreds, if not thousands, of individual transactions on the bitcoin network if the mutual buffer is large enough to permit many small transactions between userbase members, most of which simply cancel out.
Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 05, 2012, 02:58:54 PM I think it would work, but I can't see how the payment processor makes any money. As you said, his own funds are tied up in multiple connections; so all that money has to be rented somehow, and that doesn't even cover the costs of running the service itself. The operational costs are very low. The time value of money will have to be paid by the customer, but it shouldn't be prohibitive. If the interest rate is 0.5% per month, that's more or less the cost of using this scheme (better than Bit-Pay's 1% or PayPal's 3%+), and you get instant payments which can be arbitrarily small. And if you make it shorter than 1 month it is proportionally less - with 6 days it's 0.1%. And, if a customer both sends and receives payment, and is willing to trust the processor with a small amount, he can cancel out most payments and thus not need a large channel, decreasing the cost per transaction. I think that this would work great for long term reciprocity agreements between major online bitcoin payment processors, but in order for this to be beneficial there must be more than 4 transactions between users of a service. For most this is unlikely, as most paypal users don't average one a month. Bitcoin and its ecosystem isn't supposed to replace just PayPal. It should replace cash, checks, credit card, bank transfers etc., and allow a whole new world of microtransactions. The latter is one key issue this proposal solves - for small transactions 0.5% isn't much, but the cost of processing the transaction by all network nodes in the world is.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: jim618 on July 05, 2012, 03:53:00 PM Can you explain in a bit more detail what exactly a channel is ?
(as that is where the magic seems to happen) Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 05, 2012, 04:23:58 PM Can you explain in a bit more detail what exactly a channel is ? The explanation is at the linked thread (https://bitcointalk.org/index.php?topic=25786.0). I'm building up on hashcoin's work, not redoing it. I added another link in the OP.(as that is where the magic seems to happen) Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 05, 2012, 05:26:01 PM I think it would work, but I can't see how the payment processor makes any money. As you said, his own funds are tied up in multiple connections; so all that money has to be rented somehow, and that doesn't even cover the costs of running the service itself. The operational costs are very low. The time value of money will have to be paid by the customer, but it shouldn't be prohibitive. If the interest rate is 0.5% per month, that's more or less the cost of using this scheme (better than Bit-Pay's 1% or PayPal's 3%+), and you get instant payments which can be arbitrarily small. And if you make it shorter than 1 month it is proportionally less - with 6 days it's 0.1%. And, if a customer both sends and receives payment, and is willing to trust the processor with a small amount, he can cancel out most payments and thus not need a large channel, decreasing the cost per transaction.This is all fine, but if a customer is willing to trust the processor with a small deposit, then he doesn't need any funds tied up into the channels. Once again, I think that this idea is sound, but is more likely to be used at the macro level. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: nedbert9 on July 05, 2012, 05:45:41 PM I think it would work, but I can't see how the payment processor makes any money. As you said, his own funds are tied up in multiple connections; so all that money has to be rented somehow, and that doesn't even cover the costs of running the service itself. The operational costs are very low. The time value of money will have to be paid by the customer, but it shouldn't be prohibitive. If the interest rate is 0.5% per month, that's more or less the cost of using this scheme (better than Bit-Pay's 1% or PayPal's 3%+), and you get instant payments which can be arbitrarily small. And if you make it shorter than 1 month it is proportionally less - with 6 days it's 0.1%. And, if a customer both sends and receives payment, and is willing to trust the processor with a small amount, he can cancel out most payments and thus not need a large channel, decreasing the cost per transaction.This is all fine, but if a customer is willing to trust the processor with a small deposit, then he doesn't need any funds tied up into the channels. Once again, I think that this idea is sound, but is more likely to be used at the macro level. Agreed. What are the friction points for this channel arrangement and how might that affect it's adoption at the micro level? Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 05, 2012, 05:56:48 PM I think it would work, but I can't see how the payment processor makes any money. As you said, his own funds are tied up in multiple connections; so all that money has to be rented somehow, and that doesn't even cover the costs of running the service itself. The operational costs are very low. The time value of money will have to be paid by the customer, but it shouldn't be prohibitive. If the interest rate is 0.5% per month, that's more or less the cost of using this scheme (better than Bit-Pay's 1% or PayPal's 3%+), and you get instant payments which can be arbitrarily small. And if you make it shorter than 1 month it is proportionally less - with 6 days it's 0.1%. And, if a customer both sends and receives payment, and is willing to trust the processor with a small amount, he can cancel out most payments and thus not need a large channel, decreasing the cost per transaction.1. The customer pays unpredictably, so he doesn't want to "waste" a channel which he ends up not using - he'd rather send a deposit and use it if and when he needs. 2. The customer receives and sends payment frequently, and he wants the deposit to act as a buffer to cancel out adjacent sends and receives. In this scenario even a deposit much less than the volume can absorb most of it, decreasing the channel requirement. Either one of just a channel or just a deposit is fine for some use cases, but their combination is much more powerful and flexible. What are the friction points for this channel arrangement and how might that affect it's adoption at the micro level? The friction is the need to broadcast 2 transactions per channel, and tying up the amount of the channel for its duration (the tradeoff is - longer channels need more funds to tie up, but require less transactions per time unit). This means that this system has a cost, which depends on the time value of money and the use pattern.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 05, 2012, 06:39:08 PM This is all fine, but if a customer is willing to trust the processor with a small deposit, then he doesn't need any funds tied up into the channels. Once again, I think that this idea is sound, but is more likely to be used at the macro level. Without a channel, he loses the ability to make instant payments which are larger than the deposit.Wait, what? Are you saying that the user would be able to make instant payments in excess of the funds he has tied up into the channel? Quote Funds in the deposit are also tied up and require a transaction to replenish, so they only make sense if: 1. The customer pays unpredictably, so he doesn't want to "waste" a channel which he ends up not using - he'd rather send a deposit and use it if and when he needs. Which covers the use case of 99% of all Paypal members, which was my point. Quote 2. The customer receives and sends payment frequently, and he wants the deposit to act as a buffer to cancel out adjacent sends and receives. In this scenario even a deposit much less than the volume can absorb most of it, decreasing the channel requirement. Which covers the use case of half of the remaining 1% of Paypal users. Quote Either one of just a channel or just a deposit is fine for some use cases, but their combination is much more powerful and flexible. This I can agree with. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 05, 2012, 06:50:24 PM This is all fine, but if a customer is willing to trust the processor with a small deposit, then he doesn't need any funds tied up into the channels. Once again, I think that this idea is sound, but is more likely to be used at the macro level. Without a channel, he loses the ability to make instant payments which are larger than the deposit.Wait, what? Are you saying that the user would be able to make instant payments in excess of the funds he has tied up into the channel? Quote Funds in the deposit are also tied up and require a transaction to replenish, so they only make sense if: Which covers the use case of 99% of all Paypal members, which was my point.1. The customer pays unpredictably, so he doesn't want to "waste" a channel which he ends up not using - he'd rather send a deposit and use it if and when he needs. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: theymos on July 05, 2012, 07:29:43 PM Neat idea. The loan that the processor gives you is entirely risk-free, so it'd probably be pretty cheap. I could see this being commonly used for micropayments and instant transfers. It might even be the main transaction method in the future if the max block size stays fixed at 1 MB and blockchain transactions get really expensive. Even this might create too many transactions, though.
I'd guess that channels for receiving BTC would be free. The main benefit is to senders, who get their product instantly and don't have to pay fees for every transaction. But payment providers can only offer these benefits when recipients have channels set up. Someone should make a diagram describing hashcoin's payment system. It's kind of difficult to understand. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: RodeoX on July 05, 2012, 07:38:09 PM That's an awesome idea Meni! This does open up new markets that won't tolerate delays.
Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: jallen on July 05, 2012, 07:53:18 PM I have not understand all the details you have exposed but I think that something like ripple (https://ripplepay.com/) could ease to obtain most of the benefits you are looking for.
Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 05, 2012, 08:52:57 PM As I said Bitcoin is not a replacement for just PayPal. Actually the average person's expenses are fairly predictable - they're equal to his income minus the amount he's saving. Many of the specific payments are also known in advance, bills, groceries etc. But the use case that we are examing here is comparable to one or more paypal-like services. So the comparisons are valid. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 05, 2012, 08:58:11 PM I have not understand all the details you have exposed but I think that something like ripple (https://ripplepay.com/) could ease to obtain most of the benefits you are looking for. Yes, we are all very familiar with ripple. It has it's place, but doesn't remove trust from the metric. Something ripple like would be useful as a overlay network, perhaps permitting bitcoin users to use the ripple like network to send/receive small payments indirectly to/from vendors that they don't personally know without tiny transactions on the bitcoin network. Something similar might be usesful for smaller online wallet services to participate in off-bitcoin-network micropayments without actually having a reciprocity agreement with the other party's service. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Serith on July 05, 2012, 09:04:13 PM You should rely on Mike Hearn's proposal. As far as I know it's the one that already partially implemented.
To do this, a protocol similar to one proposed by hashcoin can be used:
This continues until the session ends, or the 1-day period is getting close to expiry. The AP broadcasts the last transaction it saw, replacing the original that was pending. Once the lock time passes, the value transfer is committed. Alternatively, if the session end is negotiated cleanly, the user can sign a transaction that's final (sequence number of UINT_MAX), which signals that no more data quota will be purchased, allowing instant commitment of the transaction. The lock time and sequence numbers avoid an attack in which the AP provides connectivity, and then the user double-spends the output back to themselves using the first version of TX2, thus preventing the cafe from claiming the bill. If the user does try this, the TX won't be included right away, giving the access point a window of time in which it can observe the TX broadcast, and then broadcast the last version it saw, overriding the user's attempted double-spend. from etotheipi in mailing: On 04/26/2012 01:30 PM, Peter Todd wrote: > >> More difficulty shortens the safe time we can transact large volumes in, >> which is good for the network. >> >> I'm not sure of the current implementation of replacement transactions, can >> anyone on the core team speak to this? Can I replace transactions, or is >> that part of the spec unimplemented or deprecated right now? > My understanding is it's completely disabled. Went on a scavenger hunt with Gavin a couple weeks concerning tx replacement. The conclusion was that if, (1) Transaction has lock-time in the future AND (2) Transaction has non-maximum sequence number Then the transaction will both propagate and be accepted into nodes' memory pools, but will not go into any block until locktime expires. If the lock-time is in the past OR sequence number on all TxIns is 0xffffffff, then it will be immediately valid and included in the blockchain. But the actual "replacement" mechanism is disabled. Therefore, the nodes accept the tx as if it's replaceable, but don't allow it to be replaced. This means that it is effectively replaceable *once*, but only if you inject a final transaction into the blockchain. You can't broadcast a final version of the same tx, because it will conflict with the non-final one sitting in all the other nodes' memory pools. You need a miner to agree to remove the non-final tx from their memory pool and specifically include your replacement. -Alan Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 06, 2012, 04:07:15 AM You should rely on Mike Hearn's proposal. As far as I know it's the one that already partially implemented. To me it looks identical to hashcoin's, what am I missing?Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: MoonShadow on July 06, 2012, 04:18:41 AM You should rely on Mike Hearn's proposal. As far as I know it's the one that already partially implemented. To me it looks identical to hashcoin's, what am I missing?Looks identical to me, except that it's intended to pay for a wifi hotspot access, not just anything. Question, can Lock_Time be extended with newer revisions? If it can, then there is no reason that this process cannot extend much longer than the initial lock_time, allowing the user to extend the agreement from the original period (be it a day or a month) out for as long as the counterparty would allow. Somehow, though, I suspect that extending a lock_time is prohibited for some technical reason that I don't understand. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 06, 2012, 04:25:03 AM You should rely on Mike Hearn's proposal. As far as I know it's the one that already partially implemented. To me it looks identical to hashcoin's, what am I missing?Looks identical to me, except that it's intended to pay for a wifi hotspot access, not just anything. Question, can Lock_Time be extended with newer revisions? If it can, then there is no reason that this process cannot extend much longer than the initial lock_time, allowing the user to extend the agreement from the original period (be it a day or a month) out for as long as the counterparty would allow. Somehow, though, I suspect that extending a lock_time is prohibited for some technical reason that I don't understand. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: theymos on July 06, 2012, 04:26:30 AM Question, can Lock_Time be extended with newer revisions? No. If the lock time is extended after the channel is established, transactions after the lock time is extended can be easily reversed by the sender. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Serith on July 06, 2012, 06:58:24 AM You should rely on Mike Hearn's proposal. As far as I know it's the one that already partially implemented. To me it looks identical to hashcoin's, what am I missing?The difference is what they mean when saying - "set sequence number to zero" 3) To start off, Tx B has seq 0 and gives all coins in TxA back to you. When you need to give mtgox money, you send him a signed replacement of TxB that is final, and sends some of TxA to him and the rest back to you. These are all offline, not sent to network.
hashcoin and Mike Hearn argued about necessity of transaction replacement protocol. Quote from: https://en.bitcoin.it/wiki/Contracts#Theory Each transaction input has a sequence number. In a normal transaction that just moves value around, the sequence numbers are all UINT_MAX and the lock time is zero. If the lock time has not yet been reached, but all the sequence numbers are UINT_MAX, the transaction is also considered final. Sequence numbers can be used to issue new versions of a transaction without invalidating other inputs signatures, e.g., in the case where each input on a transaction comes from a different party, each input may start with a sequence number of zero, and those numbers can be incremented independently. As hashcoin says, tx replacement is indeed designed to be used along with multi-sig outputs. If you look at the contracts that use it on the wiki, you can see that it's most often used to prepare a default/fallback option that closes the contract if one of the parties goes away or stops agreeing to changes in the primary contract. What I was asking/wondering is where you actually need replacement rather than just locktime. I don't understand the utility of the TX replacement mechanism. It seems to me to serve no purpose. locktime is what is needed for the escrow, not replacements. In general, if a transaction is going to be "updated" it must not be finalized or else nothing prevents a miner from including it. Either it should be missing required signatures, or future-dated. In any case, the first valid TX incorporated into a block gets to spend a given output. Replacements are pointless because to a miner, a TX is either ready-to-include-in-a-block-right-now, or not. If not he should just ignore it. There's no reason to hold invalid TX around. The party who broadcast the TX should just hold onto it themselves and broadcast it when the time is right. This confusion comes up again and again and seems to be the reason many people object to enabling locktime, because replaceable TX are hard to reason about. I agree, which is why I suggest Enable nlocktime only, NOT replaceable TX. Locktime is easy for everyone to understand: it's just a post-dated check. If I take a post-dated check to deposit at a bank, they should turn me away and tell me to come back in the future. They should not hold onto it in their "memory pool" and agree to deposit on that date, provided it is not "updated". Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: theymos on July 06, 2012, 07:10:55 AM Replacement isn't needed for this. The two parties can communicate their tx versions directly.
Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 06, 2012, 07:35:45 AM Ok, now I'm confused. You don't need a replacement for every new version of transaction 2; but you do need a replacement for the first version. Alice won't sign transaction 1 before she is sure she can get the money back in the end; this happens after Bob signs the first version of transaction 2. But after that Bob needs the power to replace this first version with the version that pays him; for that he needs replacement.
Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Serith on July 06, 2012, 07:59:19 AM Replacement isn't needed for this. The two parties can communicate their tx versions directly. That was the major point of the thread: Rapidly adjusted micropayments and multisig/P2SH (https://bitcointalk.org/index.php?topic=66521.0), and that seems to be the resolution: I see now why you argue replaceable TX are needed. I'd argue this memory pool policy is a bug. Well, you can certainly argue for alternative designs but Satoshi designed it to work this way, the software is working as designed, therefore it's not a bug. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Mike Hearn on July 06, 2012, 11:27:34 AM The writeup on the wiki is identical to hashcoins initial proposal, I think, except with a motivating example (wifi hotspots) to illustrate why it's useful.
The reason for nLockTimed transactions to stay in the memory pool and be replaceable is to provide a kind of predictable "negotiating table" for the parties. This is a common point of confusion. Hashcoin eventually understood this and decided he still didn't like it :) but that's more because it got disabled at some point and we'll need to reactivate it. Preferably ASAP but we're all busy with other projects right now, it seems. Replacement is required because otherwise as you increase the value sent via the channel, one party (the paying party) can always reclaim any value sent on it by broadcasting the first transaction to the network. It doesn't matter that the receiver has a signed, valid transaction giving them more value, the miners memory pool is already full with the earliest tx and the later versions of the transaction will be treated as double spends. With replacement, if the payer tries that, the receiver has a window of time (until nLockTime) to broadcast the later versions and override the senders broadcast. As long as you cleanly terminate the channel shortly before the end of the lock period, this protocol is safe for both parties. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: genjix on July 06, 2012, 10:03:36 PM This system has a flaw lol.
Merchant: fuck you, you are not getting your 8 BTC. Sign & Take 2 BTC or 0. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 07, 2012, 05:55:14 PM This system has a flaw lol. I'm not sure what you are talking about, but did you actually read how the system works? The receiver can't confiscate funds he wasn't specifically paid, he could die and the sender still receives the tied up funds at the end of the term. You might be confusing this with an escrow transaction, where this could be an issue.Merchant: fuck you, you are not getting your 8 BTC. Sign & Take 2 BTC or 0. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: CodesInChaos on July 10, 2012, 11:22:45 AM This scheme clearly needs working replacement and time-locks. So unless replacement gets implemented in some form, it's unusable.
Personally I think the replacement counter as it is in the specification doesn't make much sense, since it doesn't coincide with miner interests. A natural system uses the value of the time-lock as primary version number, and the transaction fee(per byte) as tie breaker. Btw with a better scripting language you could trust the processor even less. You'd need a signature verification operation that takes the message it should validate as an additional parameter, instead of implicitly using the current transaction. That way the processor can only redeem the money you sent him by producing a signature that unlocks a transaction from him to the receiver. ---- On important point you didn't mention is that the receiving end can terminate the channel at any time. So the bindup effect isn't as severe as some think. This also allows terminating the bidirectional channel when both sides cooperate. ---- One thing this system lacks is strong untraceability. I didn't find a way that offers anonymity while not entrusting the bank with any money, so untraceable transactions still need to trust the bank a bit. But at least this scheme allows relatively low trust together with few on-chain transactions. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 10, 2012, 11:49:57 AM On important point you didn't mention is that the receiving end can terminate the channel at any time. So the bindup effect isn't as severe as some think. This also allows terminating the bidirectional channel when both sides cooperate. He can? Transaction A has LockTime, so even if transaction B sending the coins back is released, the sender can't use them.One thing this system lacks is strong untraceability. I didn't find a way that offers anonymity while not entrusting the bank with any money, so untraceable transactions still need to trust the bank a bit. But at least this scheme allows relatively low trust together with few on-chain transactions. For untraceability you could use a different method (or combination) with a different set of tradeoffs, such as oblivious mixing transactions (https://bitcointalk.org/index.php?topic=54266.0), Open Transactions, etc.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: CodesInChaos on July 10, 2012, 12:08:44 PM On important point you didn't mention is that the receiving end can terminate the channel at any time. So the bindup effect isn't as severe as some think. This also allows terminating the bidirectional channel when both sides cooperate. He can? Transaction A has LockTime, so even if transaction B sending the coins back is released, the sender can't use them.The sender can't terminate the channel by himself, but he can ask the receiver to terminate the channel. There is no reason for the receiver not to comply. One thing this system lacks is strong untraceability. I didn't find a way that offers anonymity while not entrusting the bank with any money, so untraceable transactions still need to trust the bank a bit. But at least this scheme allows relatively low trust together with few on-chain transactions. For untraceability you could use a different method (or combination) with a different set of tradeoffs, such as oblivious mixing transactions (https://bitcointalk.org/index.php?topic=54266.0), Open Transactions, etc.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 10, 2012, 12:36:08 PM On important point you didn't mention is that the receiving end can terminate the channel at any time. So the bindup effect isn't as severe as some think. This also allows terminating the bidirectional channel when both sides cooperate. He can? Transaction A has LockTime, so even if transaction B sending the coins back is released, the sender can't use them.I'm just lamenting that you can't combine the trustless nature of this scheme with the untracability of chaumian cash. My planned project requires strong anonymity, so I need to trust the bank more than I'd like to. Mixing transactions don't require you to trust anyone. Though that by default doesn't give you instant/scaleable transactions.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Mike Hearn on July 10, 2012, 12:47:16 PM Quote The last transaction isn't timelocked, but its input is the output of the first transaction, which is timelocked, so it can't be executed before the timelock expires. A transaction that has not yet reached its nLockTime but which has finalized sequence numbers is finalized. See the code: Code:
So if you have an open micropayment channel, if both sides sign a transaction with UINT_MAX sequence numbers and broadcast it, it will replace the timelocked transaction and the transaction will confirm immediately. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: CodesInChaos on July 10, 2012, 01:28:19 PM Not sure if you or me misunderstand hashcoin's scheme. But I independently designed a scheme which looks equivalent to me. Perhaps the description from my design docs is a bit clearer:
Quote 1. Create a multi sig address `Escrow` co-owned by `Alice` and `Bob`. Transactions `T5`, and their input `T2` aren't time-locked. So Bob can claim his money at any time, giving the remainder to Alice at the same time.2. Create an unsigned transaction `T2` with amount `n` from `Alice` to `Escrow`. 3. Create a transaction `T3` with amount `n` that consumes the output of `T2` that transfers everything to `Alice`. This transaction is timelocked. Both `Alice` and `Bob` sign it. 4. Alice signes `T2` and executes it. (This step takes about an hour) 5. Now Alice can create transactions `T5` which consume `T2` and send an amount `m` to `Bob` and an amount `n - m` to `Alice`. She signs those transactions and sends sends them to Bob. This means Alice can send a slowly increasing amount of money to bob, without incuring the overhead of a transaction each time. Still these transactions can't be reversed, and Alice is guaranteed to get the remaining amount `n - m` back once the timeout transaction `T3` can be executed. If Bob waits for the timeout he won't get anything, so it's in his interest to executed the variant of `T5` most benefitial to him (i.e. the latest one). While the amount can only ever increase, that's no problem in practice. One can simply execute the same scheme, with Alice and Bob reversed, and have Bob increase the amount he gives Alice, instead of decreasing the amount Alice gives Bob. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Meni Rosenfeld on July 10, 2012, 01:43:48 PM Not sure if you or me misunderstand hashcoin's scheme. But I independently designed a scheme which looks equivalent to me. Perhaps the description from my design docs is a bit clearer: You're right, I misunderstood/misremembered the method.Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Serith on July 13, 2012, 05:47:12 PM I believe developers underestimate how transaction replacement feature is important, e.g. utilizing this proposal a business dealing with customers bitcoins wouldn't be required to hold private keys with a substantial balance and the Bitcoinica hacks (I stumbled on typing the word "hack" in plural) wouldn't have such devastating results.
Another thing about transaction replacement is that it would enable a lot of unique uses of Bitcoin e.g. mesh network where every node has monetary incentive to provide bandwidth, new business model for hostings and web sites where a user pays per kilobyte of downloaded content, ability to pay for extra bandwidth on ToR network which would explode the amount of nodes. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Gavin Andresen on July 13, 2012, 08:21:17 PM I believe developers underestimate how transaction replacement feature is important, e.g. utilizing this proposal a business dealing with customers bitcoins wouldn't be required to hold private keys with a substantial balance and the Bitcoinica hacks (I stumbled on typing the word "hack" in plural) wouldn't have such devastating results. Relevant recent IRC discussion: http://bitcoinstats.com/irc/bitcoin-dev/logs/2012/07/11/6#l3981048Bottom line: I think transaction replacement is important, but if we just enable it as-is then I think we open up the entire network to an easy DoS attack. And I think the incentives for miners aren't right. I think the rule for what version of a transaction will be included in blocks has to be something like "the one that pays miners most OR the one that pays miners first (if there are several with the same fee)." So I think a scheme where transaction fees are increased, or lock times are decreased, with every transaction replacement is the right way to go. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Mike Hearn on July 14, 2012, 09:12:19 AM There are several discussions in parallel in that IRC log.
To summarize, Gavins concerns are a) That being able to replace transactions could allow attackers to DoS the network by constantly replacing transactions (you still need to check the signatures each time). b) That miners have an incentive to not perform the replacement if the new tx has lower or equal fees to the version currently in the memory pool. My responses were a) We should rethink/rework DoS protection as a prioritization problem. TX replacements should be prioritized lower than new transactions and compete for whatever CPU time is available. Replacements of transactions that were recently replaced get prioritized lower than others. The result would be that you could drive CPU usage on the network to 100% for a while but it wouldn't achieve the "denial" part of DoS, making such an attack worthless. b) Miner incentives are already not entirely aligned with pure selfishness, as we see sometimes with miners who drop fee-paying transactions or don't include any at all. Despite that Bitcoin still works. If miners routinely broke the rules and rolled back transactions to claim higher fees, the feature would simply become worthless and nobody would rely on it anymore, wiping out entire classes of applications that depend on micropayment channels (and other constructs that need replacement to work). That wouldn't kill Bitcoin but would reduce its utility a lot. So I don't think miners will routinely start to do this, even if there were easy patches available. It'd be a very short term strategy. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: blueadept on July 14, 2012, 01:49:59 PM And I think the incentives for miners aren't right. I think the rule for what version of a transaction will be included in blocks has to be something like "the one that pays miners most OR the one that pays miners first (if there are several with the same fee)." So I think a scheme where transaction fees are increased, or lock times are decreased, with every transaction replacement is the right way to go. Minor nitpick: I think it's better to mine the transaction with the earliest lock time over the transaction with the highest fee. That increases the probability the miner gets any fee at all. Combining that with Mike's suggestion of prioritization, I think there's no need for any increase in fees at all for any transaction replacement that isn't actually trying to flood the network. As long as there's any fee at all, miners should mine the earliest expiring transaction. If the sender is unwilling/unable to make the lock time earlier, she would have to increase the fee. Title: Re: Trustless, instant, off-the-chain Bitcoin payments Post by: Mike Hearn on July 16, 2012, 08:29:18 AM Yes, that makes sense. But it's only necessary if there's a large conspiracy of miners who are trying to do this all at once.
If you're just worried about your counter-party trying to mine a rollback block, it's not really a concern because they'd have to get very lucky to mine the next block after the lock time expires. And for micropayments, well, who cares. I'd probably start by just using a constant lock time for simplicities sake. If miners do all start modifying the code to allow rollbacks to higher-fee-paying transactions, the micropayment channel code can be updated to count-down nLockTime (I guess it'd be specified in terms of blocks to make this easy), which should change the incentives again, at a small cost of complexity and perhaps inconvenience/efficiency. But the fact that this adaptation exists means hopefully that conspiracy should never occur. Good. I'm happy now :) Looks like the work boils down to: a) Writing unit tests b) Doing work prioritization for tx verification |