Bitcoin Forum
July 07, 2024, 10:49:23 PM *
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 »
241  Bitcoin / Legal / Re: Chess and gambling on: August 07, 2013, 09:33:17 PM
Is starting an online chess bitcoin gambling site like online poker sites illegal? I've heard that because chess is a game of pure skill it does not fall under the typical illegal status in the United States. Is this true? Supposing that online chess gambling was legal in the United States what would happen if players from outside the United States started using the site? Could the company running the site from United States be in legal trouble with regards to the law in other countries because their citizens accessed the site and gambled?

The legality depends greatly state to state.  There is skill gambling on sites like worldwinner (although the site is highly flawed because the site rigs it so you only compete against people nearly identical in skill to you, and the house just collects huge fees, and bans you if you win too much).  I remember the site not letting me play when I was in Arizona, but was legal elsewhere.

Poker is one of those grey areas where it hasn't really been tested in courts, although some states are super strict with this stuff and others aren't.  Some have rules about the house taking a cut, etc...
242  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 07, 2013, 09:08:52 PM
No, your understanding is correct. You were talking about replacements and so on without mentioning that, so just wanted to double check.

I probably should have mentioned it.  I'm glad I understood it correctly, it's one of those things I was a bit shaky on.  From my understanding, everything should work as expected with both the way everything is currently set up and should continue to work even if transaction replacement is enabled in the future.
243  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 07, 2013, 09:06:21 PM
FWIW if you happen to be in Toronto tonight I'm giving a talk about one-time-password wallet protection which will also include information about the oracle application. My apologies for the 2.5 hour notice; it's rather last minute because I was called in to substitute for a different speaker.

http://www.meetup.com/Bitcoin-Toronto/events/130155842/

alp: I'll look at your design more later. In the meantime replace your use of RIPEMD160 with HASH160 - you want these scripts to have the same security as standard scripts, and HASH160 adds an additional SHA256 step which makes a flaw in RIPEMD160 less likely to cause problems. More importantly, you are using P2SH which already depends on HASH160, so there is no reason to use a mechanism that could have a different flaw thus making you vulnerable to two types of flaws rather than just one.

I am agnostic to the hashing algorithm used, so I can easily switch.  The only reason I used RIPEMD160 is I had some test cases that I ran through an online hash webpage that used RIPEMD160 and it let me calculate the hash values independently.

I'll change the code when I get home, but I just need to calculate the nonce hashes using that algorithm, which I believe should be pretty easy to do using the same webpage I used to calculate the nonce hashes.

If you have any notes from the presentation, I'd be interested in seeing how it applies to the oracle application.  I'll likely try to present something to our local meetup group in the future.  It's a tough balance to tread between being overly technical and simplistic with these audiences.  I think it would be a lot better to have a sample app that people could use to play with and really touch and feel.  In the mean time, I might try to put together some type of youtube video that shows how it might work in action.
244  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 07, 2013, 06:38:04 PM
Recall that transaction replacement doesn't work. Sequence numbers are essentially useless on todays networks.

I need to understand exactly what the limitation is.  My understanding is the network won't even relay anything that has a timelock < currenttime.  In this case, the sequence number doesn't cause any issues, as the transactions are ignored, since every sequence 0 is timelocked.  The sequence number is used just in case the network starts relaying these transactions (and supports replacement).

Unless I am way off on how what the limitations are.
245  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: August 07, 2013, 12:49:36 PM
I was able to make quite a bit of progress on this and completed all the main test cases.  I need to start creating a test app and a protocol for communicating for users.

I had to make some very basic changes to the script to get it to work.  Here is a quick summary of the process that is used:

Each user drafts a funding transaction that goes to a 2 of 2 mulitisig output, but does not sign or broadcast it.

Each user sends the draft to each other along with a refund transaction that spends each funding transaction by sending it back to its owner.  The other user signs this transaction and sends back the signature so each user has a way to get their money out of the 2 of 2 multisig output in case the other user never signs and broadcasts his funding transaction.  The refund transactions have a sequence number of 0 and a lock time of 1 hour after the current time.

One of the users also creates a contract transaction that uses a P2SH output that spends the two funding transactions.  He sends it to the other user to sign.  This transaction has a higher sequence number for its inputs and a final lock time, so it should replace the refunds once it is signed and valid.  After both signatures are added, this transaction can be broadcast.  The script for the output is as follows:

OP_RIPEMD160 OP_DUP [trueNonceHash] OP_EQUAL
OP_IF
 OP_DROP [trueUserPubKey] OP_CHECKSIG
OP_ELSE
 [falseNonceHash] OP_EQUAL
 OP_IF
  [falseUserPubKey] OP_CHECKSIG
 OP_ELSE
  2 [trueUserPubKey] [falseUserPubKey] 2 OP_CHECKMULTISIG
 OP_ENDIF
OP_ENDIF

It's a slight modification of the one retep suggested.  To spend it, you have a few options.  If you can cash it in alone because you know the nonce values, need to add the nonce and your signature to the scriptSig.  If you want to redeem it with the mulitisig option (for example, if the oracle disappears or you wish to have an early buy-out), you need to add a scriptsig of 0 [trueUserSig] [falseUserSig] 0.  The first 0 is there to get hashed by the RIPEMD160 function and not be equal so we get to the final else case.  The last zero is there to account for a bug in checkmultisig that pops an extra item off of the stack.

Users can automatically create the "no oracle refund" ahead of time as well, and set a lockTime on the transaction of well past the event (say a week) in case the oracle cannot be found, and set it with a 0 sequence number on the input.  Then the transaction is replaced by anyone who can redeem it.

I've only run basic unit tests on this code so far, need to clean it up a bit before publishing, but plan to start making a very basic app for testnet to actually start publishing some transactions and seeing if this works.  If it does, I'll try to start working on the protocol and possibly some demo websites that anyone can use (on testnet for now).
246  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 06, 2013, 03:35:30 PM
User error in raw transactions and in code are something to be very careful of.  This has happened a lot.

Explicitly calling out the fee is a good improvement, and seems like something that should be considered in the future (all blocks after N need to have correct outputs, and have a way to tell miners).  That's a nasty fork, and I'm not sure how much benefit there is to it.  
Sometimes the correct thing to do is obvious. And, I suspect that regulators like to look at issues like this one and just shake their heads and ask why, why, why? K.I.S.S.

The benefit is to the user (i.e., the customer), and by extension, to bitcoin itself.

Update:
I am curious to know if there are any statistics on users accidentally making this error of overpaying. Also, if anyone has written any code which would cull the blockchain looking for transactions that appear to fallen into this trap. Sometimes in order to see how big a problem is, you have to quantify it.

Almost all users are using clients that do not overpay.  Very few people mess with raw transactions.  There are instances of people screwing up testing stuff or trying to be cute.  You are trying to solve a problem that virtually does not exist and cannot be solved.  If you want to use this use case, code it without making a mistake and test the hell out of it.  Then your users won't screw up.
247  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 06, 2013, 01:48:16 AM
In this use case, you don't broadcast the transaction until after you receive a "refund" transaction.   So no nodes see it except yourself (if you are doing it right).  The refund is then given back to you, which you can't broadcast until after you broadcast the funding transaction.

Ok gotcha, missed that part. 

Yeah there is no good way to avoid user error here.  No possibility of malicious attack but if the user creates the tx1 incorrectly (i.e. has a 100 BTC output instead of 10 BTC output) then the tx2 would return 10 BTC and create 90 BTC in miner's fee.  Ooops. 


One thing I have always considered useful in an alt-coin would be to specify the miner fee in the tx header.  This issue (and others related to lost coins in malformed raw txs) comes from the fact that Bitcoin doesn't explicitly specify the miner fee.  The miner's fee is computed implicitly by SUM(in) - SUM(out).  While it works fine as long as no mistake is made, there have been plenty of instances in the past when tx were incorrectly created that gave large sums to miners.  It would be an improvement for future alt-coins to add an explicit "tx fee" field to the tx header.  This would simply result in malformed txs to be invalid and dropped by the network. In this example if a user created a tx1 which SHOULD pay a 10 BTC deposit but accidentally paid a 100 BTC deposit then the tx2 would specify (the output as 10 BTC and fee as 0 BTC).  Even if the user broadcasted both txs, tx2 would be rejected (value of input: 100 BTC, value of outputs: 10 BTC, value of fees: 0 BTC = tx invalid).  The website could then recreate tx2 to the correct amount, half sign it and send it to the user.  Note the user loses some security here, the site "could" hold the funds hostage but this hostage situaiton would only occur where the user a) creates tx1 incorrectly and b) broadcasts tx1 before realizing tx2 is invalid.

User error in raw transactions and in code are something to be very careful of.  This has happened a lot.

Explicitly calling out the fee is a good improvement, and seems like something that should be considered in the future (all blocks after N need to have correct outputs, and have a way to tell miners).  That's a nasty fork, and I'm not sure how much benefit there is to it. 

Bitcoin will almost certainly not be forked for that.  However you can add it to a laundry list of things which would make sense for an alt-coin to implement.  There are lots of things which can be improved and tightened up, require compressed pub keys, explicitly include blockheight in blockheader, explicitly include tx fees in tx header, remove pubkey from input (can be recovered from signature), require all signatures to be in canonical form (reduce signature mallability), etc.  Some significant tightening up of the protocol combined with a solid modular code base (i.e. separate wallet operations, from the node codebase from standardized library used to build the reference node) would produce some real value.  Of course all alt-coins to day are merely pump & dump junk so they take wholesale all the bugs/quirks in bitcoin.  In theory though someone "could" make a better alt-coin ... someday.

Better will need to have real tangible benefits to overcome networking effects, and if they did, it might be worth the fork then, especially if it was planned out well in advance.  It will be interesting to see how things play out, and it's tough for the first version of anything to survive long term, almost always something is left out and someone improves.  Bitcoin has a pretty huge first player advantage, though.
248  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 06, 2013, 01:37:54 AM
In this use case, you don't broadcast the transaction until after you receive a "refund" transaction.   So no nodes see it except yourself (if you are doing it right).  The refund is then given back to you, which you can't broadcast until after you broadcast the funding transaction.

Ok gotcha, missed that part.  

Yeah there is no good way to avoid user error here.  No possibility of malicious attack but if the user creates the tx1 incorrectly (i.e. has a 100 BTC output instead of 10 BTC output) then the tx2 would return 10 BTC and create 90 BTC in miner's fee.  Ooops.  


One thing I have always considered useful in an alt-coin would be to specify the miner fee in the tx header.  This issue (and others related to lost coins in malformed raw txs) comes from the fact that Bitcoin doesn't explicitly specify the miner fee.  The miner's fee is computed implicitly by SUM(in) - SUM(out).  While it works fine as long as no mistake is made, there have been plenty of instances in the past when tx were incorrectly created that gave large sums to miners.  It would be an improvement for future alt-coins to add an explicit "tx fee" field to the tx header.  This would simply result in malformed txs to be invalid and dropped by the network. In this example if a user created a tx1 which SHOULD pay a 10 BTC deposit but accidentally paid a 100 BTC deposit then the tx2 would specify (the output as 10 BTC and fee as 0 BTC).  Even if the user broadcasted both txs, tx2 would be rejected (value of input: 100 BTC, value of outputs: 10 BTC, value of fees: 0 BTC = tx invalid).  The website could then recreate tx2 to the correct amount, half sign it and send it to the user.  Note the user loses some security here, the site "could" hold the funds hostage but this hostage situaiton would only occur where the user a) creates tx1 incorrectly and b) broadcasts tx1 before realizing tx2 is invalid.

User error in raw transactions and in code are something to be very careful of.  This has happened a lot.

Explicitly calling out the fee is a good improvement, and seems like something that should be considered in the future (all blocks after N need to have correct outputs, and have a way to tell miners).  That's a nasty fork, and I'm not sure how much benefit there is to it. 
249  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 06, 2013, 01:05:06 AM
Yes, but the website won't be able to see the transaction because the website only received a hash of the transaction. Well, until it is posted on the blockchain.

Where do you get this idea from.  Nodes rapidly share tx even before they are confirmed (included in a block).  If the server has a properly running bitcoind they should "see" the transaction (as unconfirmed) within seconds at most.


The site can then report to the user, "tx received (unconfirmed)" and update the status once included in a block "tx received (1 confirmation)" and update the confirmation count as the blockchain is extended.

In this use case, you don't broadcast the transaction until after you receive a "refund" transaction.   So no nodes see it except yourself (if you are doing it right).  The refund is then given back to you, which you can't broadcast until after you broadcast the funding transaction.

Ok the scenario just requires that tx1 not be broadcast.  It can't be broadcast because it isn't yet signed by both parties.  However don't prohibits the depositor from sharing the unsigned tx DIRECTLY (i.e. not using Bitcoin network) with the website.  The user doesn't lose any security.  The security comes from the fact that the site can't spend the funds without the tx signed by the user's private key. As long as the user keeps their private key secure they are fine.

Yes, it might even be preferred for the website to have the unsigned transaction, as he has no clue what he is signing.  If the website is not careful, the transaction could possibly be a spend out of one of his addresses (he would have to ensure that no one deposits funds into the address of his public key, or inspect each transaction).  The website would have no idea if the transaction matches one of his unspent outputs or not since he doesn't have the connected script or the transaction being generated.
250  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 06, 2013, 12:32:18 AM
Yes, but the website won't be able to see the transaction because the website only received a hash of the transaction. Well, until it is posted on the blockchain.

Where do you get this idea from.  Nodes rapidly share tx even before they are confirmed (included in a block).  If the server has a properly running bitcoind they should "see" the transaction (as unconfirmed) within seconds at most.


The site can then report to the user, "tx received (unconfirmed)" and update the status once included in a block "tx received (1 confirmation)" and update the confirmation count as the blockchain is extended.

In this use case, you don't broadcast the transaction until after you receive a "refund" transaction.   So no nodes see it except yourself (if you are doing it right).  The refund is then given back to you, which you can't broadcast until after you broadcast the funding transaction.
251  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 05, 2013, 11:27:24 PM
Users are unlikely to be creating raw transactions like this, though, so some software will need to present it to them what is going on.  That makes it far less likely that a mistake will be mad in creating these transactions.
252  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 05, 2013, 09:29:05 PM
This is an issue that Armory had.

You want to be able to look at a transaction and make sure that you are not spending a 10 BTC coin to pay for a 0.1BTC item (without seeing the input transactions)?
Or say the website decides to set the deposit fixed to the current $10usd exchange rate value in bitcoin (i.e., 0.0938174btc). A 10btc deposit seems like quite a bit to be a deposit for a website (i.e., at current rates), but I'm cheap.

The value of bitcoin goes up 8.4-fold 3 months from now making the new deposit a different amount (e.g., .0111687btc). A hacker could change the value being displayed to the user, getting them to pay more than they should. You ask, so a transaction fee is sent to some miner, what's the harm in that? Well, what if the hacker had a vested interest.

Is there or will there be a way to make this set of transactions more secure? (i.e., with the current protocol)?

The website could set the deposit and give refunds earlier by having a higher sequence number that refunds some, and locks up the rest.  This would have to be worked out after the deposit is there with the refund.

Users can see the contents of transactions, so I have no clue why you think a hacker would be able to change any of this.

There is no need to make this "more secure", the data is all there to the party that cares the most (the user), and once published to the blockchain, it's available for the website.

The 10BTC deposit is an example, you could do it with any amount larger than dust and it would work the same.

You can write software that displays things to users and double-checks with them and tries to do the correct thing.  Users can take the transactions and try to validate them independently of your software if they so choose.

I literally have no idea what you are worried about or concerned about, these are fairly trivial problems and easy to solve.
253  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 05, 2013, 08:32:12 PM
There is no way to validate it through just the hash.  The user could create the refund transaction and give it to the website (since he knows what the hashed transaction is), or he could tell the website how much to make the refund for.  If he screws up, then he loses (either by paying a huge transaction fee or getting an invalid refund that ends up in limbo until the website grants a new refund).  The user can verify that the refund is for the correct amount before signing and broadcasting anything.  This is *his* responsibility (and likely should be a part of whatever custom wallet he is using to do this).

BTW, I have implemented this in Java if you need sample code.  It's a bit messy now and needs some refactoring but it at least should work.  Disclaimer:  I have only done basic testing with it so far, and need to actually create some transactions on testnet to show it works.
254  Bitcoin / Development & Technical Discussion / Re: Transaction hash on: August 05, 2013, 07:06:44 PM
That is what I thought.

If I were creating a transaction and was provided the input for my transaction (i.e., in hash form), how can I specify the value of the output? My concern being, I do not want change created from the transaction I am creating.

You can specify whatever value you want as an output.  It just won't be valid if it's too high.
255  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: July 29, 2013, 02:33:48 AM
Thanks for the quick reply.

I was digging through the bitcoinJ code and had it mostly figured out.

From my understanding, the new clients (that know about this special rule) will do an extra check, but old clients that don't treat it specially will not do the extra check, thus making a situation where an invalid scriptSig evaluation occurs would validate as correct?  And anyone trying to spend them will only end up in blocks that are mined by old clients, and those blocks will be orphaned since the majority of the network will do the extra validation.  Is this correct?
256  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: July 29, 2013, 01:45:11 AM
I was able to switch to using the nonce-hash script and it so far has gone very well.

I had some questions about P2SH, though.  Here is the example used for it:
scriptSig: [signature] {[pubkey] OP_CHECKSIG}
scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] OP_EQUAL

If I understand how the script processing works, you push all of the scriptSig onto the hash, then start processing the scriptPubKey.  I presume that the {[pubkey] OP_CHECKSIG} in this example is a single piece of data that is pushed onto the stack, and not the actual operations.  It's a bit unclear to me.  So assume its just data.

We end up with the stack as:
{[pubkey] OP_CHECKSIG}
[signature]

Then we get the hash operation, which will replace the top item on the stack with the 20-byte-hash of that data.  So the stack is now:

[hash]
[signature]

We add another hash that should match:

[hash]
[hash]
[signature]

Then we get OP_EQUAL, and the top two items are equal, so we have
1
[signature]

on the stack, and it's valid.

This makes it seem like the signature is not needed at all.  I must be missing something.  What is evaluating the script that's part of the scriptSig?
257  Economy / Economics / Re: Bitcoin Spending and Improving the Bitcoin Economy on: July 27, 2013, 07:29:09 PM
Why would you do this at the expense of Bitcoin's future market share? You do not WANT bitcoins to spread to the mainstream consumer economy? Why should you purposely relegate it to uses that are niche and obscure? Maybe you believe it's impossible to do? I disagree. Once some kind of campaign makes regular people buy Bitcoins, and enough people have them, it will take root. It's like Facebook: not as good as Google+, but we have to use what everyone else is using. That's why we still use dollars. It should end.

I have no idea why you think this has anything to do with doing this at the expense of market share.  I think Bitcoins are great, but when you have a disruptive technology, you need to give a superior experience.  I'm not relegating anything, consumers will (and have).

If Google+ had a significant advantage over Facebook, it would win out.  Same reason why Bitcoin is not winning the fight.  People need to focus on areas where it is WAY better, instead of not really any better (or worse).
258  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: July 27, 2013, 03:12:52 PM


Another way to process arbitrary data is to regularly publish a list of questions
and ask miners to act as arbiter by encoding a few extra bits per block. Vanitygen abuse perhaps?

Assuming it's about typical general interest prediction market stuff like
Dems win/Reps win, BTCUSD higher/lower than last year, major city nuked/not nuked, etc.

What percentage of pools, and miners voting by proxy, would participate?
Can be a small minority, just significantly more than those who would actively sabotage it
and you have your oracle built directly into the client with no need to access outside data sources.




I had a similar idea, might even be an alt-coin with this type of thing, but there needs to be an incentive to give the right answer.  Kenneth Massey (he has a ranking system used in the BCS for college football), has a weighted ranking system where he takes inputs from anyone, and if they don't correlate well to everyone else, they are not weighted as heavily.  Perhaps you cold have a system where pick what event actually happened, and if they answer with the majority, they get rewarded from any saboteurs and any fees that people betting might pay for arbitration.  Still not sure how it would work, maybe some alt-coin just for answering events whether they occur or not?  Might be a lofty goal for down the road, I'm sure someone smart can come up with a way for this to actually work if its possible.
259  Other / Beginners & Help / Re: Potentially silly question concerning paying taxes on cashed-in Bitcoins... on: July 26, 2013, 08:54:17 PM
A lot of really bad advice in this thread so far, so make sure you talk to someone who knows what they are doing.

This is not tax advice but my best understanding of the situation.

If you are running a mining operation like a business, you will take the value of the bitcoins at the time you mine them as income.  This is going to be tricky, since you likely are a part of a mining pool and get lots of payments periodically.  You might be able to deduct the costs of your mining rigs and reasonable other costs (electric bill for the operation, etc...).

You can do capital gains on the value gained from the time you mined the coins to the time you sold them.  Or capital losses if they went down in value.  Long term vs. short term capital gains depends on how long you held them.  You'll also need to worry about self-employment taxes if you treat this as a business.  You may be able to treat it as hobby income, but then you cannot deduct expenses.

To properly report, it will be a huge pain in the ass.  The simpler method that you might be able to use is to take all the money you sold them for on an exchange and report it as other income.  Talk to a tax attorney (not some H&R Block data entry specialist) for a better opinion.  Above all, do not listen to anyone on this forum (including myself).
260  Bitcoin / Development & Technical Discussion / Re: Implementing Oracle Contracts - Feedback Requested on: July 26, 2013, 01:13:54 PM
Mike,

If you could update the wiki, it would be great, I bet it is more clear what needs to be changed to you than me.

One thing about the oracle being stateless, I am considering that right now, where the oracle is split into two entities.  One that will provide external state, and one that will validate it.  The desire for a stateless oracle is nice, but somewhere a state is needed to be maintained (obviously this could be google, a sports website, etc...), I'm just not sure it's as convincing of a use-case and maintaining the nonces seems like a trivial problem.  There's a security risk, but keeping the nonces offline and only transferring when needed could at least give some security.  Splitting the oracle into a "news service" and a signing service shifts the problem around, and it could make the script simplify to "go check this news service with this event and go get its nonce.".  Oracles can be dumb and maintain no state, although the burden just shifts.  But in this case, you pretty much eliminate for the oracle, since you program the hashes of the nonce right into the script.  Maybe there's a use case for both?  When you can easily automate it into a script, the script method, for simple events that will be published in a known way that publishes nonces, use this other way.

retep,

Re: the derivative pubkey, I assume this is mechanism serves a similar purpose to the expression hash in the original proposal?  The oracle doesn't want to sign a transaction unless he agrees it should be paid out, and he has no idea what the contract was if he doesn't have a derivative pubkey to use.  He can validate that the derivative key was in fact the one that should be generated by the original contract.  But if we go with the nonce idea, this all isn't important because oracles become naive to transactions.  Do I understand this correct?

I'll update my proposal based on Mike's changes to the Wiki and make sure I have everything correct before working any more on the code.
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!