Bitcoin Forum
July 31, 2024, 01:58:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 [11] 12 13 14 15 »
201  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 22, 2013, 05:50:03 PM
So a summary of what is happening on testnet and what would happen on mainnet:

1)  Funding transactions will be relayed and immediately* included in blocks in both networks.
2)  Refund transactions, which have a timelock and zero sequence number, are relayed in testnet, but not in mainnet.
3)  Contract transactions are relayed and immediately* included in blocks in both networks, but if a refund transaction has been relayed already, this transaction is marked as invalid since it thinks its a double spend.  Currently only a problem in testnet, since mainnet will not even relay the refund transactions.

Is my understanding correct?  If so, it seems like I only have a testnet issue, since stopping relaying of timelock transactions solves the problem of the nodes not understanding sequence number replacement (at least in my use case, where I don't have a timelock on the overriding transaction).

This can be easily solved in client software that stores transactions and only relays at appropriate times (and worst case scenario, you end up with a refund when someone submits a refund before the timelock expires, and only on testnet).

Yup, long story short: don't relay transactions you don't want mined.

Regarding sequence number replacement, it's a very flawed idea that just another variant of zero-conf transactions. It's been suggested to re-use sequence numbers for something totally different, such as gmaxwell's transaction checkpoints, so it'd be helpful if you only used the sequence numbers 0xFFFFFFFF for final transactions, and 0xFFFFFFFE for ones that are timelocked. A re-use might also include a bump in transaction version number, but it'll simplify things all the same.

On the other hand there is another version of transaction replacement called replace-by-fee. There you simply make the conflicting replacement transaction pay a higher fee, both absolute as well as in terms of fees-per-KB. Any miner has an economic incentive to include the second transaction instead of the first one provided the fee bump is high enough to account for the higher orphan risk. (may or may not be small - complex question) Counter-intuitively this can also be used to make zero-conf transactions fairly safe: https://bitcointalk.org/index.php?topic=251233.msg2669189#msg2669189

In your case it's not totally obvious if you want the refund tx to take priority over the contract one; maybe you don't? Or maybe you want the contract to take priority over the refund? I suspect the latter, in that if the contract is in a state where it can be completed, that's probably what the users want to get mined.

The refund should not take priority, in fact, it should be the other way around.  A contract should override the refund, provided the contract was submitted in the appropriate timeframe (before the refund locktime).  This is to protect users from holding a contract that has been signed by everyone but him until after the external event is known (or significant information changes), then deciding to discard it or not.  Once the contract has been signed and relayed, it should take priority, unless a refund already occurred.  Submitting the refund is an "escape" so you don't have money locked up at a multisig output that the other party might not ever free up.

Malicious users can submit a refund now before the timelock and mess things up on testnet, but that's not a big concern, because it doesn't really cause much harm for users and can be avoided in most cases.  On the main network it should be fine.  The design for this is contracts that are much longer term, so they will be stored in the blockchain and prevent double spends that way, and users will know if they need to refund or the contract went through fairly easily.
202  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 22, 2013, 03:46:02 PM
I suspect the issue is you're bypassing the standard logic that fails to relay timelocked transactions by using sendrawtransaction. If you used bitcoinj to send the tx, it wouldn't enter the mempools at all.

I haven't tested this theory (having two different bitcoin-qt apps could do this), but what I suspect is the problem is it's staying in my local mempool only, which will reject any transactions that it thinks are a double spend.  Since my local client doesn't understand sequence number, it assumes it's a double spend and rejects it without ever accepting it into the mempool on the local machine even before relaying it.  I'm not sure if the timelocked refund transactions ever get relayed (it's my suspicion they are not relayed until the timelock expires).

They aren't.

You have to remember that relaying timelocked transactions enables DoS attacks by just relaying a ton of transactions that will never get mined, either due to the lock being far in the future, or because you mine a conflicting block before the lock expires; to use up 1GiB of RAM on un-mined mempool tx's only requires the attacker to have ~$30k worth of Bitcoins with the current codebase. Sequence numbers have similar problems because you have to make increasing the sequence be accompanies by a higher fee for the exact same anti-DoS reasons.

Testnet however *does* relay timelocked transactions right now because that test was implemented in the IsStandard() code, which is turned off on testnet. I think it's time we change that and make relaying a timelocked tx fail on testnet too; it'll never be possible to relay timelocked transactions on the network directly due to the DoS attack risk, so we shouldn't confuse developers.

So a summary of what is happening on testnet and what would happen on mainnet:

1)  Funding transactions will be relayed and immediately* included in blocks in both networks.
2)  Refund transactions, which have a timelock and zero sequence number, are relayed in testnet, but not in mainnet.
3)  Contract transactions are relayed and immediately* included in blocks in both networks, but if a refund transaction has been relayed already, this transaction is marked as invalid since it thinks its a double spend.  Currently only a problem in testnet, since mainnet will not even relay the refund transactions.

Is my understanding correct?  If so, it seems like I only have a testnet issue, since stopping relaying of timelock transactions solves the problem of the nodes not understanding sequence number replacement (at least in my use case, where I don't have a timelock on the overriding transaction).

This can be easily solved in client software that stores transactions and only relays at appropriate times (and worst case scenario, you end up with a refund when someone submits a refund before the timelock expires, and only on testnet).
203  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 22, 2013, 02:18:32 PM
I suspect the issue is you're bypassing the standard logic that fails to relay timelocked transactions by using sendrawtransaction. If you used bitcoinj to send the tx, it wouldn't enter the mempools at all.

I haven't tested this theory (having two different bitcoin-qt apps could do this), but what I suspect is the problem is it's staying in my local mempool only, which will reject any transactions that it thinks are a double spend.  Since my local client doesn't understand sequence number, it assumes it's a double spend and rejects it without ever accepting it into the mempool on the local machine even before relaying it.  I'm not sure if the timelocked refund transactions ever get relayed (it's my suspicion they are not relayed until the timelock expires).
204  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 22, 2013, 01:18:04 PM
I am starting to test throwing some basic external state contracts into the testnet blockchain.  I ran into a minor issue with testing, but I think it's due to sequence number not working quite like I thought.

I have TX1, TX1Refund, TX2, TX2Refund, and ContractTX.  TX1 comes from user 1, TX2 comes from user 2.  TXRefund spends with a timelock of currenttime+60 minutes and has a sequencenumber of 1 for the input it is associated with.  ContractTX takes TX1 and TX2 as inputs, but with a MAX sequence number and no timelock.

I have not been using bitcoinJ to propogate transactions, but instead sending them through the bitcoin-qt console using "sendrawtransaction".  If I send the refunds, I cannot submit the contract.  Once sequence number is fully supported, I should be able to do this.

What my understanding of the situation, without getting into the bitcoin-qt code, is that the timelocked transactions (refunds) are held in the mempool (I can see this with getrawmempool), and since sequence number is not being honored, it sees it as a double spend if I try to submit the ContractTx, so it rejects the transaction and does not relay it.  The timelocked transactions are held in the mempool but not relayed.  I likely could send a raw transaction of the contract on another client that has not seen the refunds, since they aren't being relayed (until lock time).

This is unfortunate, but not a roadblock.  I can just make the app not submit refunds until after the lock time, thus not making it look like a double-spend.

Is my understanding of what is happening correct?

The worst I can think of that will happen is someone will somehow get the contract refund tx (which expires some time after the nonces should have been published) and gets that transaction into the mempool of a lot of miners, and it blocks the correct user from redeeming the transaction.  Probably not a concern.

BTW, here are some sample transactions in the chain if anyone is curious:

Funding Transaction 1 - Funds from wallet 1 into multisig address
Funding Transaction 2  - Funds from wallet 2 into multisig address
Contract Transaction - Spends funding inputs to a redeemable location by either a) wallet 1 once nonce1 is known, b) wallet 2 ocne nonce2 is known, or c) wallet 1 + wallet2 at any time.
Contract Refund TX - I made a mistake on this one and accidentally divided the fee wrong and ended up paying a huge fee and only refunding half the funding amounts, oops!  This has been fixed.  This is an example of spending with both signatures.
205  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 21, 2013, 08:59:04 PM
Well when the difficulty chart is only heading one direction, who would take the other side of the deal.  If you find someone, I will buy immediately.

You don't bet if it's going up or down.  No one is going to bet that it's going down, of course.  The idea is no one really knows what the difficulty will be in December.  Let's use a block 10 increases in the future from now as an example.  If I'm a miner, my profitability will vary tremendously based on what that difficulty is (along with every other along the way).  I cannot make an accurate assessment of whether my investment is profitable.  However, you can have difficulty futures, such that if the difficulty is above X it pays one party, and if it's below it pays the other party.  Both parties put in money up front, and get paid out in December whatever the results are.  It does not matter what X is, there is a price that someone could theoretically pay for both sides.

So you have various levels of X, and they require different contribution shares from each party.  The winner of each contract wins 1 BTC.  For example, you may have:
DifficultyPrice to win if overPrice to win if under
500,000,000.01BTC.99BTC
400,000,000.25BTC.75BTC
300,000,000.60BTC.40BTC
200,000,000.90BTC.10BTC
100,000,000.99BTC.01BTC

The prices will roughly track the probability of the difficulty being at that level.  For example, with these made up numbers, it would infer there is a 1% chance of being > 500M, a 25% chance of being above 400M, a 60% chance of being above 300M, a 90% chance of being above 200M, and 99% chance of being above 100M.  These kinds of prices will allow him calculate how much BTC he should mine in those 2016 blocks based on current expectations.  In addition, he can also buy some of these contracts, such as above 400M and above 500M, such that it will compensate him if difficulty rises too much, he can at least recover some of his investment.  This has a cost, but if it is lower, he will make up for it in extra bitcoins mined.

Why would someone take the opposite side?  Profit.  Say I think the difficulty will only be above 400M 10% of the time.  So I can bet 75 BTC against it going above 400M.  10% of the time, I lose my 75BTC.  90% of the time, I win 25 BTC.  This means I profit 60BTC.  I still win even if the difficulty rises to 399M.

Taking it an additional step forward, someone could offer a more complicated contract such that the miner only needs to pay a simple price, and the result of the payout would be proportional to the difficulty.  Say a miner only wanted to hedge above 400M in this case.  He could be paid Expectations of Mining at 400M - what he would make mining at the actual difficulty.  So if it was 405M, he would get a small payout, and if it was 600M, he would get a larger payout.  He would pay a small amount for this service, and would use it to make his expectations much more known in the present and make his decision making on expanding rigs, etc... easier to plan.
206  Bitcoin / Development & Technical Discussion / Re: Decentralization idea: Encourage mining network distribution among pools on: August 21, 2013, 08:37:27 PM
- Decreasing chances for small pools to create blocks and attract more mining power to grow. With no reward on mid-size pools all miners should prefer to mine on big pools with better expectations for return on investment, rather than supporting new pools.
I stopped reading here. This isn't correct. Expected return is not increased by using a larger pool. Mining is not a race, it's a random lottery.

But I understood that if a pool has more people it has more chances of winning the lottery, is this incorrect?

Yes, but the winnings are split proportionally among those extra people.

That said, with a larger pool it's less likely that your block reward will be orphaned by another block that manages to propagate to the network faster than yours. But that's not a big effect right now in terms of profitability because fees aren't very important - a rational miner will keep their blocks small to keep that orphan risk down.

That makes sense to me.

The centralization problem is that a new small mining pool or an existing pool that becomes small after the arrival of a new ASICs pool has no incentives to continue mining because the expected time to find a block could become bigger than a lifetime. Therefore, it's better join the bigger pool to receive a fraction of the reward now at current difficulty than expect a large reward in an infinite time frame, specially with increasing difficulty.
This is exactly what happens right now with solo mining.

But the reward is much bigger.  Each miner can choose the appropriate risk/reward they want.  Huge pools with low variance should be able to charge more fees (since most miners prefer low variance), therefore the incentive to have a smaller pool works out.
207  Bitcoin / Mining / Re: Thoughts on the future of mining? on: August 20, 2013, 09:09:05 PM
Difficulty is rising sharply as price stagnates, so I can't help but worry that as small-time miners are squeezed out of the game there will be more and more opportunities for other alt-coins/payment systems to steal Bitcoin's market share. I say this because I have always felt that a driving force of the Bitcoin economy was the fact that a large subset of users were profiting from mining, and when and if this opportunity erodes for the casual bitcoiner, the entire economy will be put at risk by the threat of new systems offering better incentives (or at least the chance of an incentive). Is Bitcoin still fine just as it is?

Why would a bunch of miners going to alt-coins make them valuable?  Bitcoin has already been bootstrapped, there is no need to provide a free lunch anymore to get people to use it.
208  Alternate cryptocurrencies / Altcoin Discussion / Re: Idea for {drawingthesuncoin} on: August 16, 2013, 09:00:50 PM
A+ subject change.
209  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 16, 2013, 08:30:40 PM
Insurance works because risks spread across a large number of customers can be assessed and forecast to within some defined error.

So I would have no interest in 'difficulty insurance' because I would be sure that any such organisation would be unable to survive - the people behind it would either be fools, or scammers.

This is just a simple misunderstanding due to my simplification of how it would work.  This is merely a hedge.  This exists today without any need for scamming through securities.  You have someone put up capital to cover a fixed payout and lock it in the blockchain.  You know the funds are there, and you know you can access it once the difficulty is adjusted.

The price would be determined by those willing to bet on the difficulties.  If the price was priced too low, non-mining speculators could invest in it, driving the price up, and if too high, speculators would flock to the other side.  Those who are best able to predict the price profit, those who are worse lose, and the miners who purchase the insurance get a fair price and can accurately calculate the best guess at difficulty (and can hedge against any unexpected rises).

Yup, okay - I can definitely see a market for hedging.   Stop using the Insurance word tho...

My main concern [now] would be that the US CFTC would be all over it, if only because it would regain a bit of credibility for them after what'isname said that BitCoin itself was a derivative, and then had to retract and came out of it looking like a fool.



Insurance was used as a simplification for those who don't compare about implementation, but perhaps it was the wrong choice.

Obviously there are legal issues that need to be brought up.  A P2P nature of such a system might negate some of those challenges.  For example, while sports books might be illegal, there are often no legal challenges with two friends who put up a social wager with each other.  Sports also poses challenges, but things like prediction markets (which this could very well be a component) are certainly less grey.

Decentralizing and splitting it out might get around some of the challenges (for example, someone who merely reports the difficulty wouldn't be likely to be troubled with it, but reporting difficulty in specific formats (say hashes before hand, and nonces afterward) might).  Having peers form their own bets and use external values might get around some of it.  Having a service that helps peers find each other also may work, or just having it as a p2p network as well could work.  Obviously due diligence is needed with legal experts before actually undertaking anything like this seriously, but first understanding if there is even interest is a first step.  Bitcoin difficulty seemed like a good first target, simply because it is interesting to many people who currently hold coins and that it could actually be beneficial for the Bitcoin community to have such a market exist.
210  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 15, 2013, 11:55:48 PM
Insurance works because risks spread across a large number of customers can be assessed and forecast to within some defined error.

So I would have no interest in 'difficulty insurance' because I would be sure that any such organisation would be unable to survive - the people behind it would either be fools, or scammers.

This is just a simple misunderstanding due to my simplification of how it would work.  This is merely a hedge.  This exists today without any need for scamming through securities.  You have someone put up capital to cover a fixed payout and lock it in the blockchain.  You know the funds are there, and you know you can access it once the difficulty is adjusted.

The price would be determined by those willing to bet on the difficulties.  If the price was priced too low, non-mining speculators could invest in it, driving the price up, and if too high, speculators would flock to the other side.  Those who are best able to predict the price profit, those who are worse lose, and the miners who purchase the insurance get a fair price and can accurately calculate the best guess at difficulty (and can hedge against any unexpected rises).
211  Bitcoin / Mining / Re: Expected monthly difficulty increase? on: August 15, 2013, 10:51:40 PM
It lets you change the numbers to your liking where they don't really let you change the data.  

It does let you change the data. Almost every variable on that page is configurable.  Also you can set a fixed difficulty increase vs percent and so on

Change the numbers until it's profitable!
212  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 15, 2013, 09:30:35 PM
I did some basic calculations on a possibly better way to hedge against difficulty increases.  You have a mining rig that can mine at 1GHash/sec.  At the current difficulty, that's worth .01BTC per day.  Over the entire period, it would be worth .14BTC.  If difficulty increased to infinity, it would be worth 0BTC for the next period.  If it doubled, you would be getting .07BTC for the next period.  So you want the contract for the next period to pay .07 to make up for the loss of mining ability if it doubled.  If it quadrupled, you'd get .035 BTC, so you'd want it to pay out .105BTC.  This comes out to being a x^-1 function with a max payout of .14BTC.  Say you had each share pay out .01BTC, someone with a mining rig might buy 14 shares of it.  Chances are, they get a fraction of the payout (it only goes up 20%).  The further futures out are worth more.  But they could buy those (likely for a higher price), and you could even have a structured amount that pays out for every period from now until a year from now.  You could guarantee an exact profit of bitcoins for your mining rig (you know what it costs to buy the futures, then subtract it out).  A very easy way to find profitability and let other people speculate on getting the price right.  Miners no longer need to be speculators on difficulty, and can know exactly what they are getting into.  The only variable left is the BTC Price and cost of electricity.  But they can know for $X of mining equipment, they will get Y BTC after a year.
213  Bitcoin / Bitcoin Discussion / Re: did ASIC ruin bitcoin ? on: August 15, 2013, 02:09:28 AM
If hashing power rises rapidly within one adjustment period (2016 blocks ~14 days) then the time between blocks can temporarily be shorter however it is that shorter interval which causes the difficulty to rise.  Yes for a short time the time between blocks can be <10 minutes (and in a falling hashpower environment it can be>10 minutes) however the network readjusts difficulty every 2016 blocks
Between difficulty adjustment, overall, it's _never_ been an average of 10 minutes.

The current adjustment calculation is flawed in several ways.
One of which is not retargetting the difficulty based on the historical average time between blocks, to bring it back to an overall average of 10 mins.

This is why http://thegenesisblock.com/at-this-rate-the-last-new-btc-will-be-issued-55-years-ahead-of-schedule/

This assumes having a block time of 10 minutes is really important.  And you may end up with a more flawed mechanism if try to set future difficulty based on expected growth, where you end up setting the difficulty far to high and end up with one really, really long period of a too high difficulty.
214  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 15, 2013, 12:58:47 AM
As the bitcoin mining is getting more profesional, it would be great to have a liquid market of btc derivates for risk hedging against difficulty and btc prize, it would bring less risk to the investors, i think a linear calulation would be better than all or nothing.

You could structure a series of all or nothing bets to get a pretty smooth transaction at different difficulties.  The ideal situation would be where a miner could get a flat payout no matter what difficulty happened.  I haven't thought enough about how that might need to be structured, but it seems reasonable it could be done.
215  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 14, 2013, 08:35:57 PM
The problem I have with these insurances is guaranteeing the insuring party will have sufficient capital to pay in the event required. That is why I wish there was a way to directly short BTC, I think this would help both those long and short BTC.

I agree, and I have a solution for that issue.  It basically requires the capital to be locked up.  And I can do with a transaction that gets put on the block chain that can only be unlocked by the "winning" party once the difficulty adjusts.  It can proportionally pay out with a little bit of logic different (or even some other calculation other than linear), but right now I'm focusing on all-or-nothing.  I'm trying to figure out what kind of things would be useful for the Bitcoin community to hedge against (or offer insurance against), or if it should just be entertainment based (Satoshi Dice seems to be handling that well).
216  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 13, 2013, 07:40:07 PM
One drawback with this approach is the lack of ability to have a proportional payout (e.g. a Bitcoin mining difficulty contract that pays out proportionally based on how close to 100M difficulty the next difficulty will be), but I thought about it a bit more and it at least is possible through having multiple outputs on the contract that kick in at different conditions. It's not entirely as flexible as a purely proportional payout, but you could have it in steps and get virtually the same effect:

For example, rather than betting if the next difficulty increase will be over 80,000,000, you could have a contract that pays proportionally at 10,000,000 increments.

You collect 1BTC from 2 people betting, and then make 10 outputs for example.  Each output will pay to Party A if the difficulty is above 10M*(N+1) (where N is the output number).  If the difficulty ended up being 92M, then the first 9 outputs would pay to Party A, and the last one would pay to Party B.  So you get a close-enough proportional contract in this.  The downside of this is you have 5x as many fees for redeeming as a pure proportional, and it's still got some big chunks.  I'm not sure that's a big enough concern, and of course, a transaction aware oracle could be introduced to handle such cases.  I'm a fan of keeping it simple, and until that becomes unfeasible, or there becomes demand for it, stick with the simple case.
217  Bitcoin / Mining / Re: Difficulty Increase Insurance on: August 13, 2013, 07:34:56 PM

Cool.  That's pretty much what I was thinking of, although that pays out proportionally (well, it won't after we hit 100M difficulty, but theoretically it could pay out proportionally).
218  Bitcoin / Bitcoin Discussion / Re: Every Important Person In Bitcoin Just Got Subpoenaed By New York's Regulator on: August 13, 2013, 12:03:43 AM
The funny part is how they are investigating "consumer complaints about transaction times".  Gotta love people who don't understand Bitcoin whining about how it is broken.

That's how I read that sentence as well first time. Upon ponderation, I think they're speaking of things such as the time required to get your USD back in your hand from (e.g.) MtGox.

Perhaps.  But there are a lot of morons who have bought into the "need faster blocks!" idea.
219  Bitcoin / Bitcoin Discussion / Re: Every Important Person In Bitcoin Just Got Subpoenaed By New York's Regulator on: August 12, 2013, 11:33:55 PM

It's technically just informational.  The funny part is how they are investigating "consumer complaints about transaction times".  Gotta love people who don't understand Bitcoin whining about how it is broken.
220  Bitcoin / Mining / Difficulty Increase Insurance on: August 12, 2013, 08:14:34 PM
Just trying to gauge interest to see if any miners would find this valuable.  Right now there is a lot of uncertainty in mining about future difficulty increases of the network, and that can make a huge difference on the profitability of expanding mining rigs.

For example, you could have insurance against difficulty increases by certain blocks, which would pay out if difficulty increased more than expected.  For example, you could buy difficulty insurance that the difficulty after the next was > 70,000,000, where you might pay 1 BTC and get 10 BTC if it was above that level.  Obviously the market would help determine the prices of such insurance.  This could be a way to hedge against unexpected difficulty increases so that you don't lose your mining investment.  Or you could simply do it for fun and try to make money by betting what the difficulty would be.

I am not offering any service of any kind, just trying go gauge general interest.
Pages: « 1 2 3 4 5 6 7 8 9 10 [11] 12 13 14 15 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!