Research/Bitcoin Dev Archive / lightning-dev list
Lightning fees vs miner fees
11 messages, Oct 27 to 28, 2015. Started by Anthony Towns.
Anthony Towns (5), Benjamin Cordes (2), Rusty Russell (2), Pierre, CJP
Hi all,
A question that's been raised a few times in various places [0] is what the impact of a fully armed and operational lightning network on miners fees will be -- lightning depends on the security of the blockchain to be functional, but the blockchain will eventually rely on transaction fees to be secure, so lightning had better leave sufficient transactions for the blockchain!
A trivial answer to this is "market forces will work it out" -- too many lightning transactions reduces security, reduces lightning transactions, so it will presumably stabilise at something sane, and everyone lives happily every after.
But I think it's actually a tractable question, so we can probably actually work out numbers!
Basic assumptions:
1. devs/miners limit the number of transactions per block
2. miners choose the transactions that pay the highest fees to fill
blocks
3. bitcoin watch what miners accept, and all settle on the smallest
per-transaction fee that will get them included in a block
4. some people would like to use bitcoin, but are priced out because
there are cheaper alternatives at the given per-transaction fee.
eg at 8c/tx, it might be cheaper to send 50c by paypal (at 5c+5%)
than the blockchain; whereas at 7c/tx bitcoin would be preferred.
If blocks were unlimited, miners would accept every transaction, no matter how small the fee (2), which would set the per-tx fee to ~1 satoshi (3). Rational miners will thus limit the number of txs they accept (1) to ensure fees don't go to zero.
Market assumptions:
5. the only thing preventing bitcoin from replacing credit card
transactions at point of sale is (a) adoption of bitcoin, and (b)
the transaction fees -- ie, if Visa/Mastercard is cheaper, people
will keep using it.
6. Visa does around $7e12 (7 trillion) in volume per year in the US;
and about 60e9 (60 billion) transactions [1]; on average that's 1900
tx/s, and about $117 per transaction.
7. The micropayments market is very small by comparison, with only
$1e10 (10 billion) in volume per year, counting anything under $12
as a "micropayment".
8. Imagine payments are distributed in a log-normal distribution,
then we can use the figures from (6) and (7) to get parameters
median=exp(mu)=77.669, sigma=0.9021.
9. Visa charges about 20c+2% per transaction
10. Lightning will charge 1% for a full transaction (eg, 8 hops,
0.125% per hop)
Basic conclusions:
A. First thing to note is that of the three alternatives, ie, Visa,
lightning and blockchain; that Visa and lightning get more expensive
as the transaction amount increases, but bitcoin doesn't.
Additionally, lightning is (by assumption) always chepaer than Visa.
B. Without lightning, then, the highest value N transactions will go
via the blockchain filling it up, at a fee equal to about 20c+2%
of the smallest transaction. (If the fee were any lower, smaller
transactions would be eligible for the blockchain, and higher value
transactions would bid higher fees to ensure they were included first)
So if the fee turned out to be 40c, transactions above $10 would be
in the blockchain, and smaller than that would be via Visa.
C. Without lightning, as bitcoin adoption increases, either fees rise,
or number of transactions per block increases proportionally. If
1% of people know about bitcoin, and use it whenever it's cheap;
then 2% of people knowing about bitcoin gives twice as many
transactions at any given price level. If blocks accepted 2000 txs,
and there were 1000 $20 tx/block and 1000 $10 tx/block, then
doubling adoption either means having 2000 $20 tx/block and a new
fee of about 60c (versus 40c), or doubling the block size and
keeping the fee.
D. Without lightning, fees increase rapidly with adoption: there are
1900 tx/s on Visa with an average value of $120, so there are probably
around 900 tx/s with a value greater than $100. With a 1MB block
allowing 2000 tx every 10 minutes, 0.4% adoption of bitcoin allows
everyone of those transactions to be worth over $100, which in turn
means the per transaction fee could be up to $2.20 (compared to
about 2c at present)
E. Without lightning, by this analysis, miners fees are mostly subject
to what the competition charges -- if Visa drops their rates from
20c+2% to 5c+1.5%, bitcoin transaction fees will drop
correspondingly.
F. With lightning, the only part of the above that changes is the
comparison to Visa -- instead of the only alternative to putting
your transaction in the blockchain being to pay 20c+2% to Visa; you
can pay 1% to lightning nodes to route your payment; so the outcome
to miners is exactly the same as if Visa dropped its rates to a
flat 1%. If the number of transactions per block stays constant,
the transactions actually selected will also be the same, but fees
paid to miners will reduce by about half (ie $2.20 to $1, 60c to 20c,
40c to 10c)
Numerical conclusions:
G. 60e9 transactions per year is 164M transactions per day or 1.13M
transactions every ten minutes. If each megabyte of block size allows
2000 transactions, then handling 1.13M transactions every 10 minutes
would require 565MB per block. However this would also drive fees down
to zero; so there is a smaller blocksize that induces optimal fees.
H. Given the log-normal distribution in (8), at 100% adoption and 100%
availability of lightning, this turns out to occur with a blocksize
of about 83MB, and a corresponding fee of about $2.02. This implies
a rate of 276 tx/second on the blockchain, and miner revenue of
about $335,000 in fees per block (compared to the inflation reward
of about $7500 per block, at 25 BTC and $300/BTC).
J. In such a scenario, lightning would be cheaper for any
transaction with a value under $202, by far the majority of
transactions. Lightning nodes would thus take the remaining 1624
tx/second, and earn what works out to be about $107M in fees per
day, or, for comparison purposes, about $750,000 in fees per block.
Collectively, lightning nodes would be handling 5.8 times as many
transactions for about 2.2 times as much in fees.
K. In the same scenario as above, but without lightning (and thus Visa
as the only alternative, pushing fees up), the optimal blocksize
works out to be 90MB, with a corresponding fee of about $4 per
transaction. That works out a rate of 300 tx/second, and miner
revenue of $720,000 in fees per block. Visa would handle the
remaining transactions, earning $232M per day, or for comparison
purposes about $1,615,000 per block.
L. If people adopt bitcoin and lightning independently of their
transaction amounts, and the log-normal model above is accurate,
those figures scale fairly simply: with lightning, $2.02 remains the
revenue-maximising per-transaction fee for miners; optimal blocksize
scales proportionally; ie with 10% adoption, an 16000 transactions per
block or about 8MB is optimal, and with 1% adoption, 1600 transactions
per block or about 800kB is optiomal.
M. Varying the fee lightning nodes charge in the scenario above has a
direct effect on the bitcoin fee, but does not change the optimal
block size for a given level of adoption. So halving the lightning
fee to 0.5% would result in the optimal fee also halving, with miners'
revenue halving to about $168,000 per block.
N. If lightning had fees at 0.22%, the optimal bitcoin fee would be
about 45c per transaction (with lightning still cheaper for
transactions below $200 in value); at 10% adoption, optimal blocksize
would be about 8MB or 16000 transactions per block, which would
result in about $7200 per block in fee to miners, which is about
24BTC per block given a price of $300/BTC. This might be a plausible
set of figures to target -- reasonable volume, reasonable profit,
still fairly cheap, and with wide but not completely crazy adoption?
Caveats:
Z. The log-normal distribution might not be reasonable. I've no idea of
anything better though. Also, the numbers from Visa might be
inaccurate or incomplete in the first place. They're also a couple
of years old, don't include Mastercard, Amex, etc.
Y. Visa, bitoin and lightning aren't exact subsititutes:
* Neither Visa nor Lightning can execute "smart contracts" like
bitcoin can; so the blockchain has additional demand on it beyond
Visa's current market.
* Visa is expensive or unsuitable for micropayments while lightning
is designed for them, so the potential demand may be larger than
estimated above (7).
* Unlike Visa, lightning and bitcoin do not naturally support
payments on credit or fraud protection for consumers, so some
proportion of Visa's market is probably not addressable by lightning
or bitcoin.
* Lightning payments are confirmed immediately, unlike bitcoin
transactions which take some time to be confirmed and can be
unconfirmed for a short period afterwards, and unlike Visa where
chargebacks are possible for month.
X. Increased adoption probably has some correlation to transaction
sizes rather than being completely independent; ie early adopters
probably have a different distribution of transaction amounts compared
to late adopters. No idea /how/ that's likely to differ though...
W. Current fees of up to ~2c/tx differs wildly from the above estimates
of $2 to $4 as the revenue maximising fees for miners above, given
alternative methods of payment take 1%-2% in fees. Maybe that just
means miners aren't maximising fee revenue at present (given low
adoption, and high inflation reward that's probably reasonable);
but maybe it means the distribution of payment sizes in bitcoin is
wildly different to the estimated distribution of Visa transactions
above (and skewed much lower). Alternatively, maybe it means that
miners aren't an effective cartel, and thus can't force fees to rise
to maximise revenue; that doesn't seem likely to me though...
Cheers, aj
[0] https://www.reddit.com/r/Bitcoin/comments/3n89cu/lightning_network_onion_routing_proposal/cvlvskx https://www.reddit.com/r/bitcoinxt/comments/3hf74y/lighting_network_ultimately_takes_fees_away_from/ http://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-October/011523.html
[1] http://investor.visa.com/files/doc_downloads/annual%20meeting/Visa%20Annual%20Report%202013%20final%20website.pdf
On Tue, Oct 27, 2015 at 03:40:29PM +1000, Anthony Towns wrote:
Quoted text (3 lines)
> 7. The micropayments market is very small by comparison, with only > $1e10 (10 billion) in volume per year, counting anything under $12 > as a "micropayment".
Ooops. [2]
[2] http://letstalkpayments.com/payment-entrepreneurs-go-micropayments-segment-13-b-opportunity-globally/
Cheers, aj
Hello aj,
This is very interesting, thanks!
You seem to be considering that bitcoin tx and lightning tx are completely independent, which is not entirely true because of anchor transactions. While this is certainly a valid assumption, maybe it would be worth stating it explicitely ?
Cheers,
Pierre
Quoted text (2 lines)
>> But I think it's actually a tractable question, so we can probably actually work out numbers!
The whole point of a market would be that you get users to work out "the numbers". If Bitcoin would have a market then capacity would be set by its use and more demand would trigger supply, and vice versa. Fixing that in code is inevitably going to lead to bad results. So these discussions about blocksize and capacity went fundamentally going in the wrong direction. There is no sensible algorithm to determining prices of anything without using the input of people in the market. Its not really clear Bitcoin could build in a mechanism to handle that.
It would be advantageous if fees would be variable by transaction size. Bitcoin should handle large nominal volumes and low transaction volumes and a possible second layer handle low nominal values and high transaction volumes. So it's good to consider BTC amount transferred per bytes. The higher that number the better for Bitcoin's capacity.
On Tue, Oct 27, 2015 at 10:38 AM, Pierre <pm+lists at acinq.fr> wrote:
Quoted text (19 lines)
> Hello aj, > > This is very interesting, thanks! > > You seem to be considering that bitcoin tx and lightning tx are completely > independent, which is not entirely true because of anchor transactions. > While this is certainly a valid assumption, maybe it would be worth stating > it explicitely ? > > Cheers, > > Pierre > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev > >
To make myself more clear. If I assume (roughly based on BCI data):
1000 tx / block 1 BTC volume per tx 300$ BTC/USD => 300.000$ of dollar volume moved per block => 36B$ dollar volume capacity per year
One of the key aspects of scaling would be to move low value transactions to a 2nd layer, and leave high value transactions for the most secure mechanism. Assume for instance that Bitcoin only processes transactions which have a dollar nominal value of say 100$ and everything else is handled by 2nd layer. I don't know the statistical distribution, but I assume this would cut e.g. 95% of transaction volume and brings the average to 100 BTC. Then the total dollar volume capacity increases by a factor of 100, that is 3600B$ with the same 1 MB blocksize. The key to scaling in my opinion is to figure out some way to make this split work based on nominal value of the transaction. That's already how the financial system is organised. Banks make huge transaction volumes on closed systems. Hubs in Lightning and banks in the fiat money system would be very similar things.
On Tue, Oct 27, 2015 at 10:46 AM, Benjamin <benjamin.l.cordes at gmail.com> wrote:
Quoted text (40 lines)
> >> But I think it's actually a tractable question, so we can probably actually > work out numbers! > > The whole point of a market would be that you get users to work out "the > numbers". If Bitcoin would have a market then capacity would be set by its > use and more demand would trigger supply, and vice versa. Fixing that in > code is inevitably going to lead to bad results. So these discussions about > blocksize and capacity went fundamentally going in the wrong direction. > There is no sensible algorithm to determining prices of anything without > using the input of people in the market. Its not really clear Bitcoin could > build in a mechanism to handle that. > > It would be advantageous if fees would be variable by transaction size. > Bitcoin should handle large nominal volumes and low transaction volumes and > a possible second layer handle low nominal values and high transaction > volumes. So it's good to consider BTC amount transferred per bytes. The > higher that number the better for Bitcoin's capacity. > > On Tue, Oct 27, 2015 at 10:38 AM, Pierre <pm+lists at acinq.fr> wrote: > >> Hello aj, >> >> This is very interesting, thanks! >> >> You seem to be considering that bitcoin tx and lightning tx are >> completely independent, which is not entirely true because of anchor >> transactions. While this is certainly a valid assumption, maybe it would be >> worth stating it explicitely ? >> >> Cheers, >> >> Pierre >> >> _______________________________________________ >> Lightning-dev mailing list >> Lightning-dev at lists.linuxfoundation.org >> https://www.learnbitcoin.com/archive/lists/lightning-dev >> >> >
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (5 lines)
> C. Without lightning, as bitcoin adoption increases, either fees rise, > or number of transactions per block increases proportionally. If > 1% of people know about bitcoin, and use it whenever it's cheap; > then 2% of people knowing about bitcoin gives twice as many > transactions at any given price level.
Metcalf's law? Both sides need to "know about bitcoin".
Say: 1 billion people, each initiating 100 txs per year. But only 1% know about bitcoin, so those 10M can only use it for 1 of their annual transactions. At 2%, 20M can use it for 2 of their annual transactions...
Not sure how this alters the rest of your calculations.
Cheers, Rusty.
Quoted text (3 lines)
> Alternatively, maybe it means that > miners aren't an effective cartel, and thus can't force fees to > rise to maximise revenue; that doesn't seem likely to me though...
Why not?
Anyway, it will most likely be the case if we somehow manage to re-decentralize mining (e.g. let individual miners make the blocks instead of letting pool operators do that).
So, how do your calculations work out if the miners are not a cartel, but instead completely non-organized? What if, in the style of the prisoners dilemma / tragedy of the commons, each miners' actions are targeted towards maximizing its own profits, even if that comes with a disproportional cost for other miners?
For a miner it makes sense to include transactions that have much lower fees than the "cartel optimum": if you don't do that, you don't get the fees, but some other miner will still include them and "spoil the market", so it might as well be you who takes the profit. This is how a free market with many independent actors leads to lower prices than a market operated by a monopoly / cartel.
Still, even under such conditions, there will be natural limits, since there are costs related to including transactions in your own blocks. I made some estimations based on the assumption that, in the absence of an artificial block size limit, the limiting factor is how long it takes other miners to download+verify your block, which is assumed to be proportional to block size. Long download+verification times reduce the chance that other miners start building on top of your block before another block is found.
My conclusion was that miners will continue to include transactions until it takes almost ten minutes to download + verify a block. The "almost" is a bit dependent on the distribution of fees people are prepared to pay: if all transactions use the same fee/kB it equals 10 minutes; if a small part of the transactions pays the majority of the fees, miners are better off including those transactions but excluding most of the rest. The same is true in the presence of a large inflationary block reward (current situation): that is effectively a single transaction with a very large transaction fee. Miners don't want to risk losing that reward by including lots of low-fee transactions.
I haven't taken into account that it takes different miners different times to download+verify blocks.
CJP
On Tue, Oct 27, 2015 at 10:38:52AM +0100, Pierre wrote:
Quoted text (4 lines)
> You seem to be considering that bitcoin tx and lightning tx are completely > independent, which is not entirely true because of anchor transactions. > While this is certainly a valid assumption, maybe it would be worth stating > it explicitely ?
Yep.
I'm not sure what the frequency of anchor transactions is likely to be. If you consider 10% adoption to be 30M users (10% of US population), each of whom does an anchor and claim once a month, that would be 720M transactions, at 500B/tx that's an extra 7MB per block, compared to the 8MB of high value transactions we were taking from Visa at 10% adoption. If anchor/claim happens once a year on average, instead of every month, that would be an extra 570kB compared to the same 8MB.
(Using Metcalfe's law, 10% adoption by transaction volume might actually require 94M users (P(tx via btc) = P(userA has btc) * P(userB has btc) = 94/300*94/300 = 0.098 ~= 10%; so 21MB or 1.8MB in lightning anchor/tx txs compared to 8MB of high-value ex-Visa transactions per block)
Cheers, aj
On Wed, Oct 28, 2015 at 06:03:25AM +1030, Rusty Russell wrote:
Quoted text (7 lines)
> Anthony Towns <aj at erisian.com.au> writes: > > C. Without lightning, as bitcoin adoption increases, either fees rise, > > or number of transactions per block increases proportionally. If > > 1% of people know about bitcoin, and use it whenever it's cheap; > > then 2% of people knowing about bitcoin gives twice as many > > transactions at any given price level. > Metcalf's law? Both sides need to "know about bitcoin".
I think Metcalf's law would be a lower bound -- you're more likely to adopt bitcoin if the people you transact with use bitcoin, so they're not independent. ie,
P(tx via bitcoin | bitcoin is cheaper than alternatives)
= P(consumer can use bitcoin) *
P(merchant can use bitcoin | consumer can use bitcoin)
If those are independent and P(consumer)=P(merchant), you get Metcalf's law. If P(merchant|consumer)=1 you get my assumption above.
I assume reality would be somewhere in between; because I think once a merchant had a few customers asking for bitcoin they're more likely (though not certain) to offer it as a payment method. Getting an actual model would probably depend on what marketing strategy was undertaken for lightning.
Quoted text (3 lines)
> Say: 1 billion people, each initiating 100 txs per year. But only 1% > know about bitcoin, so those 10M can only use it for 1 of their annual > transactions. At 2%, 20M can use it for 2 of their annual transactions...
Yeah, so if Metcalf's law applied directly, you'd just have:
p_tx = p_u^2
or p_u = sqrt(p_tx), where p_u is the proportion of users with access to bitcoin, and p_tx is the proportion of transactions that could be done on bitcoin (what I called "adoption").
Quoted text (1 line)
> Not sure how this alters the rest of your calculations.
I don't think I actually used the proportion of users in any calculations in the original mail.
It would matter for adoption rates, and I think it matters for comparing how many bytes are needed for lightning anchor txs on the blockchain (as per my previous mail) though.
Cheers, aj
CJP <cjp at ultimatestunts.nl> writes:
Quoted text (5 lines)
>> Alternatively, maybe it means that >> miners aren't an effective cartel, and thus can't force fees to >> rise to maximise revenue; that doesn't seem likely to me though... > > Why not?
I deleted my own reply. I think we're entering an already-inflamed area of debate which is not productive for lightning. Recommend bitcoin-discuss.
Cheers, Rusty.
On Tue, Oct 27, 2015 at 10:34:12PM +0100, CJP wrote:
Quoted text (4 lines)
> > Alternatively, maybe it means that > > miners aren't an effective cartel, and thus can't force fees to > > rise to maximise revenue; that doesn't seem likely to me though... > Why not?
Trivially, if a majority of hashpower wanted to act as a cartel, they could just use the soft-fork protocol to make and enforce any decisions (eg, versionbits to vote on decisions, then orphan any non-compliant blocks to enforce it).
Quoted text (2 lines)
> So, how do your calculations work out if the miners are not a cartel, > but instead completely non-organized?
I don't see how to come up with a figure for fees or miner revenue other than than maximising revenue for miners (ie, the same fees they'd charge if they were a cartel) or minimising costs for users (ie fees at 0 or 1 satoshi per tx). The supply constraints for transactions per block aren't really tied to miners' costs, so supply capacity doesn't particularly increase with costs, and so supply/demand curves don't help much.
If you choose somewhere in between those extremes, that might mean the blockchain gets used for transactions above $20 or $100 rather than only above $200; but given we're talking about lightning payments being below about $10 each, that seems fine.
Quoted text (4 lines)
> What if, in the style of the > prisoners dilemma / tragedy of the commons, each miners' actions are > targeted towards maximizing its own profits, even if that comes with a > disproportional cost for other miners?
Hmm. Having miners accept txs with different fees introduces a timing aspect -- ie, it's not just "is it worthwhile to pay Bob $5 if it costs 45c?" it's "is it worth paying Bob $5 in 10 minutes for 45c; or in 60 minutes for 20c?"
Once you add that complication to the analysis I think you have to figure a cartel would take it into account too. If every 10 minutes you had a new set of transactions from people with the following willingness to pay:
1000 tx worth 100c in 10 minutes or 20c in 60 minutes 500 tx worth 90c in 10 minutes or 20c in 60 minutes 200 tx worth 30c in 10 minutes or 25c in 60 minutes 100 tx worth 20c in 10 minutes or 20c in 60 minutes
Then I think you'd optimise your revenue by accepting any transactions at 90c or more immediately, along with any transactions that are at least 50 minutes old at 25c or more. Or you could just include 17% of 25c txs from the mempool in each block for roughly the same effect. That would make you around $1400 in fees, and does better than:
$1350 in fees if you just accept 90c txs asap $1000 in fees if you just accept 100c txs asap $510 in fees if you just accept 30c txs asap $360 in fees if you accept 20c txs at anytime up to 50m
If a non-cartel miner comes into the picture with 17% hashpower (so gets one block an hour roughly), they could have a different policy. (If they had less hashpower, they couldn't affect prices) They'd still get the 1500 90c fees that were set based on assuming a cartel member would only pick them up immediately at that price. They could pick up all the 20c fee transactions, without having to let them age 50m as well, for maybe $1650 in total fees. But if the non-cartel miner accepted 20c transactions as well, users would notice, realise they can just offer 20c in fees and still be fairly reliably accepted within an hour, and that miner would only end up collecting $360 in fees, rather than $1650.
(Accepting all the 25c transactions actually means consumers would be paying 25c to get their transaction accepted in about 55 minutes rather than 60 minutes which might also affect prices, but the analysis is hard enough already...)
Quoted text (4 lines)
> For a miner it makes sense to include transactions that have much lower > fees than the "cartel optimum": if you don't do that, you don't get the > fees, but some other miner will still include them and "spoil the > market",
Because you only get blocks in relation to your hashpower, and people care about timeliness of confirmations, I don't think you can spoil the market easily just by being a miner with a small percent of hashpower.
*Alternative* payment methods to publishing on the blockchain (like lightning, altcoins, or fiat payments) can undercut prices and steal marketshare though. So I think prices will still end up at "free market" rates rather than anything really extortionate -- ie, lightning fees of 1% and bitcoin txs would cap bitcoin fees at about $2/tx even with an absolutely effective revenue-maximising bitcoin miner cartel.
(Calling bitcoin miners a cartel is probably unfair; you don't call "Visa" a cartel just because it sets its own fees at a profit-maximising level. You'd only really have a cartel if the /industry/ cooperated like that, so Visa, Amex and Mastercard all coordinating fees. Likewise you'd only have a blockchain cartel if Bitcoin and litecoin and other altcoins coordinated fees; switching to an altcoin seems about as easy as changing credit card providers)
Anyway, this is pretty tangential to lightning at this point. Followups to bitcoin-discuss or direct mail?
Cheers, aj