text:
What happens if I buy Bitcoins and the price goes down?
What happens if I buy Bitcoins and the price goes down. Will I lose a quantity of my money?
Consider:

If you bought a bar of gold at $1200 / ounce, then the price of the gold drops to $600 / ounce, you wouldn't actually lose any money at all unless you decided to sell your gold at that time.  However, if you wait until the price of gold rises to $1800 / ounce, then sell it, you will gain money.  The key is an ounce of gold is still an ounce of gold, regardless of the "price" in some other currency.
Same goes for bitcoin, or indeed any currency.  If you trade it at one price, then subsequently trade it at a different price, you'll either gain or lose money.
Tax law is a completely different area. Consult a tax attorney or accountant in you jurisdiction for details applicable to your scenario.

If you bought one bitcoin and the price goes down, you still have one bitcoin.  If the price goes up...still one bitcoin.
This is just like everything else, including groceries, gasoline, gold, stock certificates, etc...  Measurements of value in fiat (such as dollars) does not affect the amount something you own, only the price at which you will be able to sell that something.

tl;dr-  This is called a capital loss.  You're said to realize the capital loss if you sell the Bitcoins at the lower price, such that you lost money due to having bought/sold them.  However, note that this isn't legal advice and I'm unsure about what the current legal statutes are surrounding Bitcoin.

Bitcoin's a capital asset (at least conceptually; dunno about legally):

A capital asset is defined to include property of any kind held by an assessee, whether connected with their business or profession or not connected with their business or profession. It includes all kinds of property, movable or immovable, tangible or intangible, fixed or circulating. Thus, land and building, plant and machinery, motorcar, furniture, jewellery, route permits, goodwill, tenancy rights, patents, trademarks, shares, debentures, securities, units, mutual funds, zero-coupon bonds etc. are capital assets.
-"Capital asset", Wikipedia [links omitted]

When a capital asset appreciates in value, it's called a capital gain, and may be subject to capital gains tax.  And when a capital asset depreciates in value, it's called a capital loss (and sometimes results in a reduced tax burden).
Until you actually sell the Bitcoins, the loss is considered unrealized:

What is an 'Unrealized Loss'
An unrealized loss is a loss that results from holding onto an asset after it has decreased in price, rather than selling it and realizing the loss. An investor may prefer to let a loss go unrealized in the hope that the asset will eventually recover in price, thereby at least breaking even or posting a marginal profit. For tax purposes, a loss needs to be realized before it can be used to offset capital gains.
-"Unrealized Loss", Investopedia [links omitted]

Once you do sell the Bitcoins, then you know how much money you've gained/loss.  This is called realization:

DEFINITION of 'Realized Loss'
A loss is recognized when assets are sold for a price lower than the original purchase price. Realized loss occurs when an asset which was purchased at a level referred to as cost or book value is then disbursed for a value below its book value. Although the asset may have been held on the balance sheet at a fair value level below cost, the loss only becomes realized once the asset is off the books.
-"Realized Loss", Investopedia [links omitted]

Summary
If you buy Bitcoins and they depreciate in value, then:

You've suffered a capital loss.

Before you sell the Bitcoins, it's an unrealized capital loss.

After you sell the Bitcoins, it's a realized capital loss.

The answer is not unique to bitcoin. It would be the same if you're dealing with (non-crypto) foreign currency, stock, a stock derivative or commodity or commodity futures.
When you buy something like the above, you are giving up your "real money" (fiat currency) to take possession of said commodity/stock/bitcoin/etc (let's call these assets in general). You bought an asset at a particular market value, which can fluctuate over time. If it rises, it's worth more of the fiat currency. If it falls, it's worth less of the fiat currency.
While you're still holding on to said asset, what you're experiencing are called unrealised gains and unrealised losses. The valuation chart fluctuates, but you're not seeing your purse of fiat currency changing in any way after the initial outlay.
You won't actually feel the "pain" of a fall in value until you decide to sell the asset. At this point you will experience a realised loss. You will get back less of the fiat currency (real money) than you put in in the first place. Conversely, if the asset has risen in value, you'll get back more "real money" than you put in and you've made a realised gain.
(I simplified the analysis to omit things like trading overheads - brokerage fees and commissions, etc. that always apply (those things always eat at your gains and losses pretty much equally). And taxes are a complex and murky thing I won't touch. And all this assumes you paid "real money" you actually had in full for the asset. If you borrowed money to buy the asset, that's called trading on margin and it can be much, much riskier - you're losing money in interest all the time and your losses can be more than the amount you borrowed to begin with. But ignore all these complications and focus just on the paragraphs above to give you a head start in understanding. And please learn more (and try trading simulations) before you trade real money for any asset).

Yes, you lose a quantity of your money, at the time you gave it away in exchange for the bitcoin you received.  Subsequent changes in the exchange rate only vary the hypothetical value of what you would get if you wanted to trade back.

Yes and no, depends on your perspective.
No: You lose money when you buy something, and you gain something else in return. In your case you lose money if you buy bitcoin, and you gain money when you sell bitcoin.
Yes: The monetary equivalent value of your assets/wealth decreases if your assets lose value, and increases if your assets gain value. If you own $1'000'000 in Bitcoin and Bitcoins lose half their value, you now hold $500'000 in bitcoin.
Notice that in the No case we count our Bitcoin in terms of # of coins, and in the yes case we thing of bitcoins in terms of $ of Bitcoins. If you were to count the value of all your assets in Bitcoins you'd gain value when the value of Bitcoins drops, because all your non-Bitcoin assets are now worth more Bitcoins, and the Bitcoin assets are still worth the same number of Bitcoins they used to be worth. It's more sensible, however, to value your assets in a currency that is stable and tied to most of your expenses.

Many other answers explained the difference between realised and unrealised loss. I want to add some thoughts:

It seems you are rather new to trading. Please understand that there is no "magic money making" machine, and that trading profits are often viewed as the compensation for accepted risks. So be cautions with investing money whose loss you cannot afford.
Bitcoin is highly volatile, meaning that the price changes in rapid succession. It might be hard for a beginner to handle. You can, of course, but be extra cautious compared to trading, say, Dow Jones values.
Bitcoin has no intrinsic value. Gold can be used for making jewelry, Coca Cola can still produce more drinks, but for a Bitcoin you need someone else willing to pay for it.   Without spreading too much fear and doubt, it bears some reminiscence to once highly-priced collector cards.

I would like to add another aspect: minimize loss, in case you want to protect your principal (and commission paid when you bought Bitcoin). Please look into 'stop loss order' in case you want to get out of the position while minimizing the loss because you are not certain when the price will return enough to get your position back to 'gain'.

The answer depends quite  a lot on the semantics of the word "money". If money is those rectangular printed papers or circular metal discs made by the Federal Reserve in the United States of America as well as many other institutions in other nations then the answer is NO. You gave away (traded) some of those items when you bought the bitcoins. But a lowering of bitcoin value after that trade does not further diminish the amount of papers and discs you have.
But I would rather use the definition of money used by wikipedia:

Money is any item or verifiable record that is generally accepted as
payment for goods and services and repayment of debts in a particular
country or socio-economic context. The main functions of money are distinguished as: a medium of exchange; a unit of account; a store of value; and, sometimes, a standard of deferred payment.Any item or verifiable record that fulfills these functions can be considered as money.

The papers and discs fit that definition so no money loss there. But, what else fits that definition?
BITCOINS
Before they got lowered in price you could go to Newegg and purchase a certain ammount of items. What happens if you go to Newegg after they got lowered in price?

If the answer is "I can buy the same" then no, you did not lose a quantity of your money.
If the answer is "I can buy less for the same ammount of bitcoins than I could before the lowering" then yes, you did lose a quantity of your money. They are diminished as a medium of exchange, now you can exchange those bitcoins for less than you could before.

I think there is an interesting point here, although perhaps not well expressed: the bitcoins might be exchanged for something other than the original currency. However, if it were possible to exchange Bitcoins valued at USD10 for USD20 worth of goods, this would be an anomaly that the market would correct for by adjusting one or both prices. Otherwise, it would be the economic equivalent of a perpetual motion machine: buy BTC for USD -> buy goods for BTC -> sell goods for twice the original USD -> buy twice as many BTC -> repeat.

@IMSoP - arbitrage is what happens when you trade a good or asset through multiple exchanges and make a profit.  i.e. if you sell BTC -> BCH -> USD -> BTC, and come out with more BTC at the end, that's arbitrage.  And yes, normally the "market" will sort that out extremely quickly, since stakeholders take advantage of the arbitrage forcing equilibrium.


text:
Why do so many bitcoin exchanges have their bank accounts closed and have problems establishing bank accounts?
I find it really strange that it happens that so many Bitcoin exchanges have their bank accounts closed.
Outside of the Bitcoin world, I find it very unusual to have a bank account closed, for a reason other than inactivity. The only case I remember is Julian Assange's Swiss Postfinance.ch account closed.
Maybe it's a specific practice of banks in certain countries?
Many banks that I had been dealing with, seemed to have the attitude that everyone with a passport (for individuals) or company papers (for companies) can just open an account, no matter what his business is - whether he is trading spaghetti, sand on the beach, air or voucher codes - it's none of the bank's business. Their only worry is whether the person who opens the account is really the one who he says he is. The bank doesn't have to understand your business, their business is to verify ID and do maths. The rest is the customer's business and responsibility. Of course, the bank has to report transactions over a certain threshold and/or suspicious to a certain government agency, but closing accounts?
Maybe it's the matter of attitude, common practices, banking culture being different in those countries that the banks closing the accounts where established? The Bitcoin exchanges accounts are closed mostly in "old" western EU (UK, France), and the much more relaxed "no bullshit" attitudes of banks I have encountered is mostly from Central/Eastern EU banks ("new" EU countries).
Is it common for western EU banks to be so picky about customers, and closing accounts despite meeting formal ID requirements of the companies?
The sometimes mentioned claim that it might be illegal to "hold other people's money if you are not licensed to do it" is not very plausible, as any business "holds other people's money" for some time, and there are even ones which sell "numbers which hold a value" for money - prepaid vouchers for mobile phone recharges for example. That voucher is usually a 16-digit long number that holds some value - if that is fine, then Bitcoin must be no different - both are basically selling numbers which hold monetary value.

Have you got some references? All I can find is: http://bitclockers.com/forums/index.php?topic=394.0

Not exactly a bank, but PayPal is also refusing to work with Bitcoin sites.

Bitcoin Solutions LLC has gone through 3 banks.  One bank employee was honest about the situation (Risk related to bitcoins)  the others simply chose to not state a reason.  All three pointed to a section of their terms stating they can close an account for "any reason" and refused to disclose.

The bank doesn't have to understand your business, their business is to verify ID and do maths. ... this might be true in the rest of the world, but it is definitely NOT true in the USA.  There are, unfortunately, laws here called "know your customer" (http://en.wikipedia.org/wiki/Know_your_customer) that force banks to do a lot of law-enforcement type stuff.

Thilo, Paypal is about as far from a bank as you can get.  If they actually were a bank they couldn't do half of the evil stuff they get away with.  Definitely not a bank.  More like a gigantic grandfathered loophole in the VISA/Mastercard merchant agreement.

If you haven't heard of accounts being closed for various reasons, you haven't talked to very many people .  It can be for overdrafting, keeping a low balance, being untruthful on some form or even something completely out of your control, such as depositing a check that bounced.  Usually when they close an account, they won't let you open a new one either and this can also affect your ability to open accounts at other banks.  There is also little legal recourse if it happens to you.

It's a great way for the government to get around due process. A law like "it shall be unlawful for anyone suspected of being a terrorist to buy food" wouldn't pass muster, but if they just say "places that sell food must ensure they don't sell food to terrorists" you get the same effect. And you don't have to investigate, charge people with a crime, or give them any process at all. The restaurant or grocery store just says, "sorry we don't want to do business with you". We get to punish people for being merely suspected. (Except we do this with banking, not food.) http://ow.ly/QiKx30cBIgk

Countries have AML (anti-money laundering) laws that limit activities that could enable money laundering. A Bitcoin exchange arguably can be used for money laundering. Even if the letter of the law doesn't say anything specifically relevant to Bitcoin, banks don't want to take chances.
To be able to respect AML and other laws, banks do need to know a few things about the owner and the business, and they have a "know your client" procedure for it. For most businesses this goes uneventfully, for others (e.g. Bitcoin exchange) it could be a problem.

In the EU, banks tend to follow guidance from their central banks and regulators. That guidance is suggesting that bitcoin operators will fall under the EU e-Money Directive http://ec.europa.eu/internal_market/payments/emoney/index_en.htm because of holding customer funds so if your business is not licensed as an e-money entity, then the banks are being very cautious. A distinction can be made between floating-rate and fixed-rate exchanges if you can get the bank to comprehend this. See my answer to 'exchange legal requirements' http://bitcoin.stackexchange.com/a/2882/916

To clarify AML and KYC (know your customer) - it's enough for the bank to know who you are as long as you are handling your own deals - whatever you buy/sell for the needs of your business. However, if you are pushing third-party deals through that bank, then KYC principle holds the bank responsible also for those third parties; so you practically either have to identify your customers and pass this info to the bank when needed (as various payment gateways/aggregators do), or leave if you can't do it.

I know that one of the Polish exchanges is closing down as they don't want to have problems with possible unpaid taxes and so forth. From what I understand the operations that take place in an exchange would require them to pay taxes and they just don't want to get into that.
It is possible that some exchanges are closing down because they operate illegally, that is, they aren't companies and they don't pay taxes. This would be a perfectly justified reason for the accounts to be closed down.
I don't think it could be some political reasons or otherwise, seeing how WikiLeaks still can receive bank transfers whereas Paypal, Visa and Mastercard all bailed on them.

The polish exchange you are talking about (Bitchange.pl) is an anti-example of what I am talking about, because their bank account was NOT closed, and there are no reports of the bank having anything against it. They where even still using the bank account to process withdrawals for some time after they decided to close and suspended trading. My question is NOT about closing exchanges, only about operating exchanges having their accounts closed and being forced to look for another bank (e.g. MtGox, Intersango).

Well, their bank account was not closed, but the reason for them shutting down is a valid enough reason for their bank account being shut down in the future.

no, the reason for them shutting down is absolutely not a reason for their bank account being closed - they closed because of a small risk of the tax considering their activity as a subject to a special 2% tax (which BTW exists only in Poland and is not about income tax even), and the bank is in absolutely no position to even know, nor to ask, if they where paying the tax or not - there are PLENTY of businesses which run into the risk of a dispute with the tax office as to what kind and value of taxes should be paid and I never heard of a bank closing an account because of it.

Every single business runs into the risk of a dispute with the tax office, because the tax law is very complicated and unclear, and the tax office often has a different view of how to interpret it, and this is simply the risk of doing business - BitChange.pl closed because they saw that the profits from the exchange business where not high enough to be worth taking the risk. The only thing a bank can do is to report what is it obliged to report and to disclose to the tax office - and then its up to the tax office to fine the business, bank doesn't even know what taxes you pay!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
What is the current legal status of Bitcoin around the world?
Has there been any concrete information about the legality of Bitcoin in any country?
Since any information can be injected into the blockchain, then if child porn / copyrighted material is injected into the blockchain, does this make Bitcoin clients illegal in some sense?

Isn't it better to have separate questions like this for each country? If/when this question will have some clearer answers, it will be a mess to find the specific answer for my country, which is probably what most people are interested in. I vote to close for this reason. (Don't misunderstand me though - the questions about legality are very important)

@D.H. My opinion is that I'd like to see the information centered in one question, not scattered into lots of smaller ones.

Alright. I started a discussion about this on meta to try and sort it out. http://meta.bitcoin.stackexchange.com/questions/47/questions-with-different-answers-depending-on-country-region

I suspect this question will need to be updated many times in the coming years. "Current" might not be good enough on such a question, and perhaps it should be closed.

A French court will decide about this soon. https://bitcointalk.org/index.php?topic=41317.0 However I doubt we're close to seeing a stable legal state any time soon.

russian government explicitly outlawed bitcoin recently

http://www.quora.com/What-are-some-interesting-examples-of-illegal-and-or-controversial-data-embedded-in-the-Bitcoin-blockchain || https://www.reddit.com/r/Bitcoin/comments/2ltbgx/putting_copyrighted_material_into_the_block_chain/ || http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html

At this point, the legality of bitcoin remains largely untested. To date, there have been no legal actions brought against any bitcoin exchanges (which would likely be the first place for the legality of bitcoin to be tested, rather than end users) and multiple bitcoin exchanges are seeking legal clarification regarding the jurisdictions they are operating in.
Some non-profits including the EFF have chosen not to accept bitcoin at this point in time because of untested legal issues.

In the United States there is no existing legislation that explicitly makes bitcoins or bitcoin-like currencies illegal.  The closest legal challenge at the moment seems to be the anti money laundering laws which require you to "know your customer" by retaining personal identifying information on people you exchange monetary instruments with (in amounts greater than $1000, per day).

There are potential pitfalls in that it is illegal to create any form of money for the exchange of goods and services unless you are the US Congress per the Constitution.  There is also potential problems with tax evasion, sedition, conspiracy, treason, fraud, and incitement statutes that it could be argued that bit coin violates.  While there may be no statute that says do not create a bit coin there are statutes that say do not do some of the things that bitcoin can do.

@Chad: Citations needed.

@nateEldredge Feel free to downvote and delete... but commenting like this on a post over 2 years old seems a bit douchebaggy

You can see the ongoing regulatory discussions and current status in various U.S. states by looking at the Coin Center's state-by-state listing.
https://coincenter.org/2015/06/state-digital-currency-regulation-tracker/
Since BTC-trading companies will probably have to file for money transmitter licenses in most/all of fifty states, the laws will likely differ in each state.

I found this Wikipedia article very helpful for this exact question:
Legality of bitcoin by country or territory

The legal status of bitcoin varies substantially from country to country and is still undefined or changing in many of them. Whilst the majority of countries do not make the usage of bitcoin itself illegal, its status as money (or a commodity) varies, with differing regulatory implications.

http://www.merkletree.io/ is a good reference. Has a clickable color coded map with links and legal informations. Pros and Cons. So far I like it.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Is there an asset tracking software that supports Bitcoin? (Better than GnuCash)

Possible Duplicate:
Any multi-currency accounting ledger that lets me use BTC?

I'm looking for a way to manage all of my assets. I have various assets in multiple currencies & investment instruments.
I think I would like to try using a software that works with double-entry bookkeeping. I'm trying out GnuCash so far, and it seems to do a decent job:

It can easily track all Fiat currencies and has automatically updated prices.
Can be made to work with Bitcoin using the XXX custom currency code.
Is a tad complicated to begin with, but I think over time it's worth it.

Frankly, the one thing I'm missing is integration of an Mt. Gox price feed and the ugliness of writing XXX instead of BTC.

I think mainline GnuCash will never support bitcoin. They only support ISO4217 currencies, and ISO will never assign BTC to bitcoin. Partially because they want no part in it, and partially because the BT? range of currency codes is already allocated to Bhutan. Perhaps a fork is in order?


text:
What is the current (Feb 2012) "bus factor" of the standard client?
Bus Factor (Youtube) is the

total number of key developers who would need to be incapacitated (as
  by getting hit by a bus) to send the project into such disarray that
  it would not be able to proceed

What is the current bus factor of the Bitcoin standard client?

Are there any known issues that will mean trouble for Bitcoin in the future if there is no future development? i.e could it continue forever without any protocol changes (excluding any undiscovered flaws)?

@kirian - part of what keeps the economy going is that they see a healthy development community. There are various issues to be tackled, features to be added, a massive scaling effort to be designed and implemented. Without core developers, this can't happen.

I agree that there is plenty of room for development and improvement but your question just prompted me to wonder if Bitcoin as it currently is could survive indefinitely without any further work. Maybe it should be a separate question on the stackexchange.

@kirian As to whether it could survive without any work, I would say, not really. Technology is changing quite fast nowadays, so at least minor tweaks are needed every now and then. For example, I don't know whether the current client could be installed on Chrome OS, which might become an important system eventually. Moreover, in about 50 years the power of GPUs should be high enough to brute force the current cryptography of Bitcoin and thus make it obsolete (at least if they follow Moore's law).

As of today, perhaps 20
Generally what makes a "core developer" as opposed to a "contributing developer" is an ongoing interest in the codebase that typically equates to near full-time employment. Should all core developers fall under the wheels of this continent-spanning bus of doom then Bitcoin would suffer a significant blow.
For a while.
Then various contributing developers (of which there are legion) would likely step up to act as replacements. The discussions on the forums, IRC channels, mailing lists and version control systems will be read and acted upon. Bugs will be fixed and life will go on.
Edit: So where does this number "20" come from? Well it's based largely on my experiences from reading the development mailing list, IRC logs and various Google+ circles. There is no real exact number, though, activity varies over time and various people are "core" to a particular issue as it passes through.

Unless someone with admin access to all key resources (website, repository) survives, there are going to be splits, which could ultimately kill the whole project.

There do not need to be splits even if everyone with admin access to all key resources disappears. You just need to find a new group of key resources that the majority accepts.

I upvoted your answer, but I can't accept it yet without some sort of reference, or at least explaination of the number. Is 20 a made up number? A true estimate based on ... something?

Edited to show sources for my estimate

Eleven.  The answer is definitely eleven.

:) From all people, I thought you would be the one the most capable to give a serious answer, or at least a serious attempt.

And obviously, I'm just trying to gauge an estimate here.

Not sure is serious

It's somewhere between zero and a hundred million. I don't think anyone can place it any more narrowly than that.

Not the most useful of answers.


text:
Can a competing cryptocurrency make Bitcoin obsolete?
If a new cryptocurrency is created, with some unknown property that Bitcoin does not have, can Bitcoin be adapted to include this property, or will Bitcoin become obsolete?
(I believe I know the answer, but I still think it's an important question. Spurred by this reddit post)

I am shocked that this question is not closed. It's like the cultural revolution in this sub site...

If it is a feature for the client that doesn't affect the Bitcoin network (like say, stronger wallet encryption or something like that), it is not a problem.
If the feature is related to the cryptographic security (say, SHA-2 becomes somehow obsolete), then adoption might be problematic. First of all, the developers would have to prepare the change and schedule it in advance (for example, "Starting with block X, we will be using SHA-3"). This would require all the clients, both standard and alternative, to get updated before that time or risk not being able to connect to the network.
Moreover, if the change is related to a vulnerability of a cryptographic algorithm of Bitcoins, then the entire network might get compromised before the update could happen. For example, if securing the old coins would require one to send them to a new address, then in a short period of time before everyone would do it, someone could potentially steal a lot of coins. Luckily, a scenario like this is very unlikely.
All in all, adopting new features into Bitcoin is possible, although time and consideration is required. Bitcoin's value is in its stable nature, so revolutionary changes could only destabilize it.

That's not how I would have phrased the answer. I would have said, in a positive manner, that for most new features of ant alt, if it would be important enough to make Bitcoin obsolete, than it would almost certainly be possible to adjust the protocol, with coordination by most of the miners and client, to include the new feature.

@ripper234 I think that the only feature that would make Bitcoin obsolete is related to underlying security. Smaller features like convenience or some versatility improvements would not Bitcoin obsolete, just less convenient. Similarly to C and C++, the latter has many vast improvements over the first one, but C is still used.


text:
What are the most secure-yet-convenient ways of creating a wallet, that require just remembering a password?
A friend just asked me "where are the 11 BTC I bought from you half a year ago? ... I don't remember where I put them." He formatted his computer a few months ago, and the money is probably lost (all of your BTCs just got 5.2E-7 more valuable).
I'd like to recommend an easy to use wallet with the following requirements:

You only have to remember a password/passphrase to access all your BTC. Bonus: transaction history as well.
It's super secure. I mean, I'd like 2-factor authentication, and keys should not be stored on the server (maybe only half a key). Let's assume the client computer is Trojan infected as well.
No ID/bloodwork/whatever is needed to use it (I don't know what Mt. Gox requires of "verified" users nowadays).
It is developed by a relatively trusted company/people. Trust is subjective, but still you can provide concrete evidence of why company X is "more trusted by the community" than company Y.
I'd prefer a no-install browser based wallet, but not if it conflicts with any of the above requirements.

Are there wallets that comply with most/all of these requirements?

I think I won't accept an answer for a while ... I'd like to see some upvotes before we can conclude an online wallet is really "trusted".

Take a password.
Hash it with SHA.
Use the hash as a private address.
Generate your public address from that private address.

Guess this would be the easiest algorithm for having a deterministic wallet. One could easily make a web service or a program to generate those addresses, but people generally don't trust third party services like this.
EDIT:
StrongCoin allows one to generate a private key from any sentence, and given that they encrypt the private key before your browser sends it out, one can trust them not to know it. Then, you can decrypt the private key (as far as I know, also on your machine), and import it wherever one needs (provided you don't want to keep your coins online). It is a small workaround, but seems to fulfil your friends' needs.

I'm looking for something my friend can actually use. Himself. The same friend who just lost his wallet due to formatting his hd, even though I warned him to back it up and encrypt it. So I take it your answer means that none of the existing lite wallets do what he needs?

Hmm, actually, StrongCoin seems to do something like that, editing my answer now...

A post on the forum suggested that Electrum, with its mnemonic seed, is also a good candidate.

MtGox can hold your Bitcoins if you want. I got a free Yubikey for being an oldie and it is really secure.

Mt. Gox imposes limits on withdrawl for non-verified account. I want none of that, thank you.

Wait, "an oldie"? Your profile says "I am currently studying High School"

@ripper234: I'm guessing "oldie" in this context means he's been an mtgox user for a long time.

@Meni - right :)

I have been in Bitcoin before it broke the dollar for the first time, "fun" time back then and no scammers in the forums.


text:
Is anyone working on / has implemented a "two-factor paper wallet"?
I just created this wiki page.
I'm coining the term here, I think ... not sure what was it called when discussed on Bitcointalk.
My question is: Has anyone implemented this "2 factor paper wallet"? Is it being worked on?

xpost to bitcointalk: https://bitcointalk.org/index.php?topic=97485.0

If it later turns out that the keypair generated by the third party is defective, your money is forever lost. You could just as easily create the initial pair yourself as validate it. In any event, it's not really two factor since both factors are the same (something you have).

@DavidSchwartz - a probabilistic verification process: you order 100 key pairs, and test 99 of them. If they're ok, it's very unlikely that the hundredth one (which you'll use for real) is defective.

Also, you can generate the two keys yourself on N different devices (Android + Windows + Mac + Linux), and test each part separately. The odds that all four systems have Trojans are vastly reduced. https://en.bitcoin.it/wiki/User:Casascius/Base58Check-encoded_objects_proposal#Proposed_specification_for_a_multi-part_key_using_EC_multiplication

It's not that hard to make sure your key generation systems aren't trojaned. The hard part is securing your key storage systems. This just seems to make more problems than it solves. Though I suppose maybe somebody has a problem that it solves.


text:
Did BitGo terminate its "BitGO instant" service? Why?
This is the launch announcement.
https://www.bitgo.com/instant is a dead link now.

I can't say for sure, as I don't use the service, but the current page appears to be here: https://www.bitgo.com/info/solutions#instant .  It's linked in the Solutions menu on the header of every page, so they're not hiding it.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Why satoshi client's UPnP part maps to a fixed external port (8333 by default)?
Why satoshi client's UPnP part maps to a fixed external port (8333 by default)?
If there are multiple clients behind the NAT router, won't there be a conflict?

Doesn't a router route to specific ip addresses? So multiple clients behind a router won't be a problem unless they have conflicting ip addresses.

They have different internal IP, but may have the same external IP.

A router runs connection tracking software to make sure all connected in the network get differentiated.

I don't understand. If a peer from outside want to connect (external_ip, 8333), how can the router tell which internal ip should it forward to?

It's a long Wikipedia article on how exactly it's done but it's done in the same way you can browse (port 80) on the internet on two computer without loading pages another computer loads.

We are talking about if there are two servers behind that 80 port, and using the same external IP, can how can a client specify which server it want to talk with?

A fixed external port is used so that other clients on the internet can connect to your client by knowing only your IP address. They will use the fixed port number to connect.
If you have multiple clients behind a NAT device, then only one client will be able to negotiate with the NAT device to listen on port 8333 (and have incoming connections translated to its client address).
Note that the above assumes the clients actually are behind a NAT devices (which is very common, especially in home networking setups). If instead the router is really just a router and not a NAT device, then each client behind the router will have its own public IP address, and there won't be any conflict between more than one of them listening at the same time on port 8333.

Is there a viable solution for having multiple clients behind the same NAT? Can the satoshi client peer advertise itself with another port if required?

@LordOfThePigs Yes, you can change the listen port.  Specify 'port=nnnnn' in bitcoin.conf to use another port.


text:
When MtGox was hacked on 15th June 2011, how many bitcoins were actually stolen?
When MtGox was hacked on 15th June 2011, how many bitcoins were stolen?
I remember at the time that news articles reporting the incident talked about the size of the sell order the hacker placed within the site, but failed to state the amount of bitcoins the thief managed to withdraw. Most of the stolen bitcoins were unable to be withdrawn, so MtGox was able to retrieve those by claiming them back from the controlled website account.
Please provide a link to support your answer.
Related question:
Were all funds stolen from Mt. Gox finally returned to all users?

Are you asking how many the hacker theif was able to sell within the exchange, or how many were successfully withdrawn before the site disabled withdrawals?

Two fairly complete summaries:

http://blog.zorinaq.com/?e=55
http://www.dailytech.com/Inside+the+MegaHack+of+Bitcoin+the+Full+Story/article21942.htm

@StephenGornick, I'm asking how many were withdrawn. I tried to word the question clearly, but would welcome edits to improve it.

According to MtGox, the hacker got about 2000 BTC.  A few real customers also appear to have purchased bitcoins at an artificially low price during the incident, withdrawn them, and kept them. This is estimated to amount to less than 650 BTC.
The details given at the above link are:
~June 2011 Mt. Gox Incident
Time: 2011-06-19T18:00 ± 1 h (theft), days ensuing (hacks & withdrawals)
Victim: Mt. Gox (some claim also customers)
Status: Thief uncaught
Amount:
Stolen by thief: 2000 BTC (official estimate)
Additional withdrawn from Mt. Gox: 643.27 BTC (lower bound)
Total: Lower bound 2643.27 BTC
Equivalent USD: 46970.91 $ (used last trade value; actual price at the time was not reliable)
Transactions: none released officially
The event's scale was widely disputed; some report a theft of almost 500000 BTC due to related account hacking. At this time, these reports seem to be unfounded and closer inspection puts the losses at closer to 2500 BTC. Some additional money was stolen by traders capitalizing on the dropping price and withdrawing in time, including toasty of the bitcointalk.org forums. Mt. Gox claims it has reimbursed customers for this theft.

Great post, thanks! I tried to find that information myself and didn't manage to.


text:
Why BIP32 derive address does not match with BIP39?
How is that the same xPub rsults different address in BIP32 and BIP39? :)

It doesn't. You read it wrong, first snippet shows you account key for m/44'/0'/0'/0 derivation path, second snippet for m/44. As the derivation paths are different - obviously the accounts' keys are different too.


text:
Why BIP32 extended public key differs from BIP32 derived private key?
I put the same input into iancoleman site and BIP32 site, but both derive different result. Why?
I expected derived address will be the same. Do you see what I set wrong?

1FyAoRf82ZRYsjvCD5CFkcJTbvjmuypkJo

1GNsZGjnqj9rt5K2NLfgZRCztJKR1UVQrG

different derivation path?

Your first screenshot has a BIP44 derivation path 44'/0'/0'/0'. Your second screenshot has a derivation path of 40'/0'/0'/0'.


text:
Is it possible derive pathes without prive key? If so in which wallet?
I implement a webshop, basically it is more than a wehshop a marketplace and I would offer Bitcoin payment. There are 3 roles: buyer, seller, and the marketplace.
The procedure I imagined, that that seller has the private key. Seller derive adresses, where one would epxect the incomes. Seller hands those addresses to marketplace.
When buyer comes and want to purchase a product, marketplace return an address. Marketplace record in DB which buyer and address belongs together. Later Maketplace pull Blockchain, and check wether amount appeared in the specified address. If so, than pruduct can be shipped.
So:
Is it possible derive pathes without prive key? If so in which wallet?

Yes, you can use a hierarchical key ("xpub") to do that. The seller will generate a wallet and provide you with their wallet's "xpub" public key, and they keep the corresponding private key "xprv". You can use the "xpub" to generate addresses for their wallet, and the seller can use their "xprv" private key to spend from those addresses.
I believe most wallet software supports this by default.


text:
Which "address" should be used when wallet is made with iancoleman page?
If I have generated / choosen the 12 word memnonic with bip39 here
https://iancoleman.io/bip39/
which address I should fill in Binance as the destination address when withdrowing coins?

Account Extended Public Key or
BIP32 Extended Public Key or
choose one of the Derived Addresses from the table?

If option 1 or 2 is used, is it possible that tranfer will "override" one of the previous address, or it "checks" always wether new "sub" address is empty?

I would use the first of the "Derived Addresses" that you have not previously used.
However, first of all I would test recovery from a written copy of the "BIP39 mnemonic" using an offline non-custodial wallet (e.g. Electrum etc) and check that it can generate the same address.


text:
account id & bitcoin amount & message ?-> show website content
I am planning to make an website / wordpress plugin. Site will ask visitor's account id.
Site will show content only if a bitcoin transaction with specified  account id & bitcoin amount & message exist.
My big plan let visitor to track how a software have been made. Like in a version control system, like in Github visitor could track changes. But!! certain changes / commits the developer could charge some dollar.
My specific question is: Can I query all the bitcoin transactions back to the past and filter with a predicate contains the following fields: account id = 'abc'  & bitcoin amount = 123 & message = 'def'?

Do you have a specific technical question? This site is better suited for technical questions, rather than forum-style request for comments.

right, I fine-tuned my question


text:
How to find a block containing a transaction using transaction hash only?
Well, the title says it all.
I have  a transaction hash and I want to find this transaction in the blockchain.
I am working with bitcoinj.
I am probably missing something very obvious here, but I cannot find how to do it.

The transaction does not know the block in which it was integrated.
https://en.bitcoin.it/wiki/Protocol_specification#tx
There are many services around like blockchain.info or blockexplorer.com which stores the blockchain and have indexed all transactions, which you can search.

Some transactions are in multiple blocks, for instance: https://blockchain.info/tx/392655224c035f4ace1dfb3d95f86406bfc82e646b27b731faeab052209e0b0a

The link only shows one transaction, and what you are suggesting is a double-spend. You cannot spend the same transaction outputs twice or more.

@T9b the link shows that it was included in the following blocks (one's an orphan, the other made it onto the main chain, both height 297359): https://blockchain.info/block-index/401024 https://blockchain.info/block-index/401025 So orphaned blocks are an exception to the rule, and probably not the point of the question.

Maybe not the point of the question, but i am showing that there is not always a unique answer. ... Another one, this time in 2 very early mainchain blocks (height 91722 and 91880):  https://blockchain.info/tx/e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468

@WillemHengeveld how is that possible?

looking at http://blockexplorer.com/b/91880  there is a remark about a bug in the miner that mined that block.

Does the p2p protocol support this?


text:
How to pass passphrase to BTCRecover?
I try to use BTCRecover, because I can not recover my old Copay app. All I have

12 word
a BTC address
passphrase (a good guess on it)

Checking this video: https://www.youtube.com/watch?v=8q65eqpf4gE
https://github.com/3rdIteration/btcrecover
Installed the environment.
I did not found any example where all the 3 info is passed. Usually script input is

12 word
a BTC address

But when I installed years ago Copay, I did set a password also. As I remember. :)
My expectation is to find out what was the derivation path at that time with Copay, maybe it was different then now. Basically I would validate all the 3 source are ok.
1: Am I on the right track?
2: Which scipt / setting I need to pass the passphrase?
I started based on this example:
python seedrecover.py --wallet-type bip39 --addrs bc1qv87qf7prhjf2ld8vgm7l0mj59jggm6ae5jdkx2 --mnemonic "element entire sniff tired miracle solve shadow scatter hello never tank side sight isolate sister uniform advice pen praise soap lizard festival connect" --addr-limit 5

Passwords and Pass-phrases

I have [...] passphrase (a good guess on it)

...

when I installed years ago Copay, I did set a password also.

I'm not 100% certain that you mean two different things by the words I highlighted. People play fast and loose with these words.
Password or Pass-phrase can refer to the same thing or to different things.

A Password or Pass-phrase can be used to protect the wallet. Typically by using it, directly or indirectly, as an encryption key to encrypt the wallet contents. This is not needed when using the seed-phrase to recover control over money and create a new wallet.

A BIP-39 pass-phrase is, as I understand it, simply additional words appended to the seed-phrase. This pass-phrase is chosen by the user, the seed-phrase is typically generated randomly by the wallet, not chosen by the user. The seed-phrase is sometimes called a recovery-phrase or backup-phrase.

So if your pass-phrase is just a multi-word password, as in case 1 above, you can ignore it.
BTCRecover
See https://github.com/gurnec/btcrecover/blob/master/TUTORIAL.md

BIP-39 Passphrases
Some BIP-39 compliant wallets offer a feature to add a “BIP-39” or “plausible deniability” passphrase to your seed (mnemonic),

It seems to me that you use the bip-39 option and just add the BIP-39 pass-phrase to the token list, but a careful study of the documentation ought to make this clear.


text:
How to get private key from 12-word backup and public key?
It turned out, to one 12-word backup, billion address could belong. It is not always sure app like Copay found all the address contains money.
Is it a way to infer the private key from 12-word backup and wallet ID / (public key).
It seems the only way to restore my balance is based on private key.


text:
Why Copay sends amount from address to address?
I received a payment to my Copay wallet, and in some reason Copay regularly send it from address to an other address and so forth. I can see it in https://blockchain.info What is the purpose of it? Anyway the balance is slightly falling what irritates me a bit. Why? What is the purpose behind it? Because starting application, because updating iOS?.

Does this only happen when you use the wallet to make payments? Or are transactions happening that have nothing to do with anything you requested?

Change address & miner fees?

If you receive a payment in your wallet, it should stay there unless you make any transactions yourself by purpose. Anything else would get me worried to say the least.


text:
How to generate specific private keys from 12-word backup and wallet address?
A single seed can lead to billions of addresses. Some wallets are unable to scan and find all used addresses.
Is it a way to infer the private key from 12-word backup and wallet ID / (public key).
It seems the only way to restore my balance is based on private key.

Mnemonic seeds are based on the BIP39 (seeds) and BIP44 (accounts/multiple currencies).
When deriving addresses, one uses a derivation path to get to a specific addresses. The default paths are defined in the BIP specs, but some wallets may use different ones due to an error or intentionally (for instance, Ledger's Vertcoin derivation uses Monero's derivation path due to a coding error).
You can use tools such as Ian Coleman's BIP39 tool (preferably offline) to play around with your seed and derivation paths until you see your addresses. The tool has preloaded the common paths, so you should usually be able to access your wallet pretty easily, unless you were using an extremely unusual client.
Many wallets also publish their derivation paths in their support pages, and you could pull your original wallet's path from there.
Wallets such as Electrum will also let you import a seed and specify the derivation path, saving you from having to generate and import individual keys.
As long as your seed was generated by a wallet that complies with BIP44, and you are importing it into another wallet that also complies with BIP44, you should be able to recover all your keys with no additional work.

Strange, I tried recover with Copay and Electrum from the same 12-word backup, and none of them could do it.

Did you select Options->BIP39 when entering the seed in Electrum? Electrum will default to a non-BIP39 seed, so you must specify it explicitly. Have you ensured your derivation path is correct?

Yes, set BIP39. I think Copay and Electrum has the same 'derivation path'. Though I have no clue what it is good for. m/44'/0'/0'

If you're confident the derivation path is correct, then your seed must be incorrect. It's hard to debug further without more details, but it also looks like copay is using a few non-standard paths: https://github.com/bitpay/copay/wiki I would try all of them, particularly m/45'/2147483647/0/. Do you remember if your address starts with 1 or 3? If you were using a copay multisig, you will need more keys to recreate it in electrum

Addresses in wallet start all with 1.

@János if you have any extra word (passphrase) and you didn't set, you may get a different master key therefore addresses.

Just wanted to vouch for Ian Coleman's tool. It's awesome, has saved me a couple of times, and the code is all open source: https://github.com/iancoleman/bip39


text:
Prepare transaction with multiple recipient
Do you think it is possible programmatically prepare a Bitcoin transaction that has multiple recipient to send the amount to?
Do you think I can show this trasaction in QR code, so payer can scan it with any of the available wallet app?

This is possible, but I don’t believe there is any standard protocol defined for how to do it. In any case, any such protocol will require the sender’s wallet to include this functionality, and currently most wallets don’t support paying to multiple addresses afaik (and for those that do, it’s a more manual process).


text:
What is the order of block hashes in block-locator array?
I have to compose a "getblocks" command found in https://en.bitcoin.it/wiki/Protocol_specification#getblocks
The "getblocks" command contains the "block locator hashes". In essence, I inform a remote node of block hashes that I'm aware of already. There is a rule of how to construct the block locator. Except I’ve no idea of what “pushing”, “going back” or “newest back” means. I cannot figure out the order of block hashes in what I call a locatorArray.
Let’s assume I want to advertise three block hashes:

Block hash of block number zero.
Block hash of block number one.
Block hash of block number two.

Let’s assume I have an array of three elements. For example, I might walk through the array in a for loop as follows:
for ( int i = 0; i < locatorArrayLength; i++ )
{

}

The block hash of which block number should be in locatorArray[0]?
The block hash of which block number should be in locatorArray[2]?

Where did this data come from, the daemon, an API? Some context would be helpful.

I don't understand what data you want in locatorArray.

I've made the statement of my problem more lucid.

@u2843 Did you read the snippet of code provided alongside the documentation?

@Nick ODell I didn't read it. I looked at it. I don't know the language it's written in. I've no idea of what's going on in there. I don't need to know the mechanics of the code. All I care about is whether, using my example, the block number zero is in locatorArray[0] and block number two is in locatorArray[2], or block number two is in locatorArray[0] and block number zero is in locatorArray[2].

The code on that wiki page is how Bitcoin Core constructs block locators, and it's a good method, but the method isn't enforced by the protocol. All you need to do is list a bunch of block hashes that you know about, ordered by descending block height. So in your example your locator could be (2,1,0), (2,1), (1), etc., but not (1, 2).


text:
AVA0: Get avalon read got err 0
I am trying to connect my Avalon Controller to my Raspberry Pi (raplacing the TP-Link module with an Raspberry Pi)
When I use:
cgminer -o uk1.ghash.io:3333 -O x.x:x -D --verbose --avalon-options 115200:16:10:45:1024:55 --api-allow "W:127.0.0.1" --api-listen

I get an error like:
AVA0: Get avalon read got err 0

Someone can help me with this?
Here is the cgminer log:
 [2014-01-30 13:41:59] Started cgminer 3.8.5
 [2014-01-30 13:41:59] USB scan devices: checking for AVA devices
 [2014-01-30 13:41:59] RES: thread starting
 [2014-01-30 13:42:00] AVA looking for and found BTB 0403:6001
 [2014-01-30 13:42:00] USB lock avalon 1-6
 [2014-01-30 13:42:00] RES: avalon (1:6) lock=1
 [2014-01-30 13:42:00] USB res lock avalon 1-6
 [2014-01-30 13:42:00] RES: avalon (1:6) lock ok=1
 [2014-01-30 13:42:00] USB init, iManufacturer mismatch - BTB device 1:6
 [2014-01-30 13:42:00] Found FTDI vs Burnin Electronics
 [2014-01-30 13:42:00] USB free BTB
 [2014-01-30 13:42:00] USB init, iManufacturer mismatch - BBF device 1:6
 [2014-01-30 13:42:00] Found FTDI vs Burnin Electronics
 [2014-01-30 13:42:00] USB free BBF
 [2014-01-30 13:42:00] USB init - AVA device 1:6 usbver=0200 prod='FT232R USB UART' manuf='FTDI' serial='A801XEE2'
 [2014-01-30 13:42:00] AVA0: reset got err 0
 [2014-01-30 13:42:00] AVA0: latency got err 0
 [2014-01-30 13:42:00] AVA0: data got err 0
 [2014-01-30 13:42:00] AVA0: setbaud got err 0
 [2014-01-30 13:42:00] AVA0: setmodemctrl got err 0
 [2014-01-30 13:42:00] AVA0: setflowctrl got err 0
 [2014-01-30 13:42:00] AVA0: setmodemctrl 2 got err 0
 [2014-01-30 13:42:00] AVA0: setflowctrl 2 got err 0
 [2014-01-30 13:42:00] Avalon: Sent(1):
 [2014-01-30 13:42:00] 00000000   ad                                               |.               |
 [2014-01-30 13:42:00] AVA0: usb_write got err 0
 [2014-01-30 13:42:00] AVA0: Get avalon read got err 0
 [2014-01-30 13:42:00] AVA0 reset: get:
 [2014-01-30 13:42:00] 00000000   aa 55 aa 55 00 00 00 00  d0 1f 69 01 70 94 06 00 |.U.U......i.p...|
 [2014-01-30 13:42:00] 00000010   d0 1f 69 01 34 9a 06 00  d0 9a 06 00 80 43 69 01 |..i.4........Ci.|
 [2014-01-30 13:42:00] 00000020   80 43 69 01 00 cc f2 b6  00 00 00 00 01 00 00 00 |.Ci.............|
 [2014-01-30 13:42:00] 00000030   70 94 06 00 d0 1f 69 01  d0 9a 06 00 38 52 02 00 |p.....i.....8R..|
 [2014-01-30 13:42:00] AVA0: Reset failed! not an Avalon? (8: aa 55 aa 55)
 [2014-01-30 13:42:00] Avalon: Sent(96):
 [2014-01-30 13:42:00] 00000000   ac 20 2d 10 0b 00 40 1f  74 01 00 00 00 00 00 00 |. -...@.t.......|
 [2014-01-30 13:42:00] 00000010   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 [2014-01-30 13:42:00] 00000020   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 [2014-01-30 13:42:00] 00000030   00 00 00 00 00 00 00 00  00 00 00 00 99 99 99 19 |................|
 [2014-01-30 13:42:00] 00000040   32 33 33 33 cb cc cc 4c  64 66 66 66 fd ff ff 7f |2333...Ldfff....|
 [2014-01-30 13:42:00] 00000050   96 99 99 99 2f 33 33 b3  c8 cc cc cc 61 66 66 e6 |..../33.....aff.|
 [2014-01-30 13:42:00] AVA0: usb_write got err 0
 [2014-01-30 13:42:00] Avalon: Sent(96):
 [2014-01-30 13:42:00] 00000000   a4 20 2d 10 0b 00 40 1f  74 01 00 00 00 00 00 00 |. -...@.t.......|
 [2014-01-30 13:42:00] 00000010   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 [2014-01-30 13:42:00] 00000020   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
 [2014-01-30 13:42:00] 00000030   00 00 00 00 00 00 00 00  00 00 00 00 99 99 99 19 |................|
 [2014-01-30 13:42:00] 00000040   32 33 33 33 cb cc cc 4c  64 66 66 66 fd ff ff 7f |2333...Ldfff....|
 [2014-01-30 13:42:00] 00000050   96 99 99 99 2f 33 33 b3  c8 cc cc cc 61 66 66 e6 |..../33.....aff.|
 [2014-01-30 13:42:00] AVA0: usb_write got err 0


text:
Is it safe not to record private keys for paper wallets?
That may sound like a silly question, but if I have created my keys using a passphrase in “brain wallet” at bitaddress.org, why do I need to record the private key, if I can recreate it at any time by using my downloaded version of bitaddress.org?
To be sure that I can do that safely, I need to know whether the algorithm to generate a private key from a passphrase with a downloaded copy of bitaddress.org is deterministic.

possible duplicate of How safe is a brain wallet?

NO DUPLICATE: The question above does not ask about the entropy of the brain wallet passphrase. The question asks whether it is safe only to retain the passphrase so that the private key can be re-created at a later date.

Alright, I retracted my close vote. However, I am still not quite sure I understand your intent: Is your question "Is the algorithm to generate a private key with bitaddress.org deterministic?" i.e. does it always give the same result for the same input? Or is it "Is there only one way to generate private keys from a passphrase?", i.e. can I use any tool to re-generate the private-key and don't have to retain a copy of Bitaddress.org?

Let me explain. I use dice to create a 160 bit passphrase. I enter the 62 digits into my offline copy of bitaddress.org “brain wallet” and get my keys, which I copy onto a sheet of paper.
My question is this: why can’t I just keep my passphrase and not bother recording the keys, as I can always create these electronically with my passphrase and bitaddress.org when I want them?

Thanks. Perhaps you should replace the last sentence of your question with something along the lines of "Is the algorithm to generate a private key from a passphrase with bitaddress.org deterministic?", as it seems that is what you wanted to ask. I'd say that your approach is viable, if a) you make sure that a copy of bitaddress.org remains available to you, and b) the algorithm used by bitaddress.org is in fact deterministic, which I don't know for sure.

I am not sure whether the algorithm used by bitaddress.org is deterministic or not, which is why I won't rely on merely noting down the passphrase. But if it were, it would make working with paper wallets much simpler, hence my (even if badly worded) question

Well, you can always edit your question to improve it, and I think the phrasing I suggested would help convey your underlying intent. – Then we might find out for sure. ;) You might also add the tag "bitaddress.org" which is very appropriate in this case. – I mean of course I can edit it, but I'd rather "teach the man to fish than give him a fish." ;)

To answer your question: bitaddress.org uses the SHA-256 hash of the password you provided as the private key. Therefore, you can always derive that private key from your password. If you can write a few lines of code, you can test this yourself (I just did).
However, if you generated your passphrase using dice then you are unlikely to memorize it. Therefore, it's not really a brain wallet. The SHA-256 step is really unnecessary, you might as well use the numbers from the dice rolls as a private key (you'd have to convert it to binary, encode it as 32 bytes and then convert it into the wallet import format).
The only reason to do what you just did is if you don't trust the random number generator in your browser. Now that you have a private key, you might as well write that down and forget the input to the SHA-256 hash.

You can tell if the address is deterministic - you can create a "second" private key with the same password. If the algorithm is deterministic, you will get the same answer!
Beware, however, that if they change their algorithm, or if the website disappears, and you don't have your private key, your bitcoin are gone forever!
I would not take the risk.

Unless you already have a copy downloaded and safe for that purpose.

I specifically put in "and you dont have your key".

Sorry, I should have been clearer. I meant a copy of the bitaddress.org website.

Ah I see what you mean :)

Yes, there clearly is a risk as you would have to guard both your passphrase AND your downloaded version of bitaddress.org. I withdraw the suggestion. (My earlier thinking was that it would be easier, and just as effective, to write down the passphrase which you already had rather than relying on copying down the private key which appears on screen.)


text:
When you sweep a private key at Blockchain can you sweep the key in HEX format?
It would be useful to know this because I have made a 64 character hex private key by hand and generated the address without storing the key in WIF format. I don’t want to go online, input the hex key and have it rejected.
Of course I could try it out with a small amount in a sloppy wallet, but it would be easier for someone to tell me.

WIF stands for "Wallet Interchange Format" - the standard way for importing/exporting bitcoin private keys. Yes, it is possible to keep private keys in HEX, BASE64 and 100500 other formats. But why should anyone implement them?

Why? Because I made a random 64 character hex key not using a computer. And offline, I found the B58Check address which that key makes and then paid some Bitcoin into it.  I now want to redeem the money.

You can use https://brainwallet.github.io/ (1) set "Get Address From" to "Secret Exponent" (2) type your hex key into the field "Secret Exponent" (3) get your private key in WIF format in the field "Private Key"

@amaclin: That is precisely what he says, in his second sentence, that he doesn't want to do.


text:
Sent bitcoin with no fee, waited and bitcoins disappeared
I sent about $425 to an adress from my bitcoin-qt wallet and forgot to include a fee. So I googled and googled and waited around for 4 or 5 days for it to stop broadcasting but I get on my computer today to check my transaction on blockchain and its not found anymore. My bitcoin wallet is empty and on the transaction log its status is still "0/unconfirmed". What do I do to get my coins back?!

Export the private key of the address with the stuck transaction, import the PK into something like Electrum, and transfer the entire balance to another of your addresses.

If the transaction didn't confirm, the funds never moved.

Alright so I got the private key imported into Electrum and my history on electrum states that the bitcoins were recieved to the address and then sent to the address which I sent them to which still leaves me with 0 bitcoin balance in my electrum wallet. Are there any other suggestions?

And the wallet that i sent the bitcoins to says that the bitcoins i sent are pending and have 0 confirmations.

@David: I thought it might be a problem with bitcoin-qt not updating to remove the stuck transaction from its memory pool. Hence the advice to try to force a send from the same address using a different wallet (it's faster than a rescan).
It sounds like the transaction is still hanging around in the memory pool of some relay nodes, even if blockchain.info has forgotten it. Try waiting a couple of days longer and see what happens.

@420blzit, Is the problem still there?

I know comments are not suppost to say "thank you", but sometimes a +1 just doesn't do it. Last night my father recovered his bitcoins that were lost for a year, by importing the private key into the blockchain.info wallet.

Your wallet thinks the coins are spent, yet they're stuck in limbo. According to this bitcointalk post, you can force the TX to be dropped from your mempool, and then you'll get back the balance:

If the transaction is associated with your wallet, you can do one of two things:
*restart bitcoin with the -zapwallettxes option. This will cause bitcoin core to 'forget' all transactions associated with your wallet, and rescan the blockchain for transactions associated with addresses in your wallet.
*use the RPC command removeprunedfunds, which will remove the transaction from your wallet.
Please note that removing a transaction from your mempool will not affect any other node's mempool, and your transaction can still confirm in the future as long as it is valid.


text:
Delete bitcoin address using Pywallet
sorry for the stupid question but I can not understand that I have missed.
I'm trying to use the wallet for removing unused addresses. I get a message has been deleted successfully, but the client I still see those addresses, it seems that the removal does not work. Maybe I missed something, please help.

Hmm this is very strange, make sure that on deleting your bitcoin client (Bitcoin QT etc) is closed.


text:
Bitcoin testnet: "Bitcoin is downloading blocks..." and other problem
I'm trying to setup a local testnet with multiple nodes. Currently I have three nodes, and their mining powers are almost the same.
Things have been quite ok so far, except some problems that I need to ask from you.

When I run the getblocktemplate rpc call (because I later want to run a pool), it returns the message as in the title. For example:
./src/bitcoin-cli -datadir=./localnet getblocktemplate
error: {"code":-10,"message":"Bitcoin is downloading blocks..."}

although there are already 10 blocks in the blockchain maintained by the node. Its the same for other nodes as well. So why does that happen?

The nodes do not sync up very often although they are all connected together (each node has 2 inbound connections and 2 outbound connections). It is so often that one node is 2 block ahead of other and remains so for a long time. Thus, again, why does that happen? I thought after finding a valid block, the node will broadcast that to every connected node and the network will work on top of that block?

Please let me know if you can help answer either one or all the questions.

For your first question, the message "Bitcoin is downloading blocks" is produced if the client hasn't yet downloaded all the checkpoint blocks.  For testnet, there is exactly one checkpoint block, at height 546.  So until your client has mined 546 blocks, you will continue to get this message.
Unfortunately, when you do mine block number 546, it will be rejected since its hash won't match the hardcoded checkpoint, and you will still get this message anyway.  So you will have to remove the checkpoint from the code and replace it with a zero-height checkpoint matching your genesis block.

I just add one more question, please check if you can help @Nate

@Loi.Luu: You should really remove it and ask it as a separate question. Multi-question posts are discouraged as they make it harder for future users to find what they need.

Thanks, I thought it would be a more helpful thread... Will do it immediately.

Btw, your answer does solve the second problem also :)


text:
What is the file wallet.dat.rewrite?
In my %APPDATA%\Bitcoin folder (in Windows 7) I have a file called wallet.dat.rewrite
It was apparently last modified on 12th May 2011.
I don't think it's a file I created manually, so what is it?

Sometimes the wallet file must be rewritten from scratch entirely (in particular when encrypthing it), to prevent unencrypted material to remain in old never-overwritten areas of the file. To do this, bitcoin writes a new file (wallet.dat.rewrite) and then renames it to wallet.dat. If this process is interrupted, it's possible that the wallet.dat.rewrite file remains. You can delete it safely.

Actually you should delete it, since it possibly contains your unencrypted private keys, and could maybe be used by a thief to gain access to your bitcoins without knowing your wallet password.

No, it is the file to which the rewritten version is written. It is not a copy of the old file.

Fair enough then.  :)  So is it possible that OP's wallet.dat file is still unencrypted since wallet.dat.rewrite wasn't renamed over top of it?


text:
How can I verify a signed message?
I can send a signed message using the standard client, but if I see a signed message in, say, a forum, how can I verify it?
I understand this hasn't yet been implemented in the GUI for the standard client.

Shifted my answer from this question  http://bitcoin.stackexchange.com/q/4131/516 because the question was changed to ask for pseudocode

According to this bitcointalk thread, it can be done via the JSON-RPC API:
Code:
verifymessage [address] [signature] [message]

This feature has also been included in the GUI of the Armory client:

To Verify a Signature Block with Armory (works fine in offline mode):
Open Armory, go to the menu, "Tools"-->"Message Signing"
Click on "Import Signature Block" at the bottom of the screen.
Paste the signature block, and click "Okay"
Address will be checked against public key, public key checked against signature for the given message

None of this requires the blockchain, so if you are on a system that
  couldn't normally run Armory, you only need to run with the
  "--noblockchain" option.  This allows you to verify Armory signature
  blocks without even having an Armory wallet!  If you're intrigued, try
  this one:  (get Armory if necessary)

You can also do it online. For example here:
https://brainwallet.github.io/#verify

brainwallet seems to be dead


text:
Once a wallet file is initially created, does the reference client generate additional private keys?
I'm just assuming that the wallet.dat file created by the reference client contains just one private key. (Correct me if I'm wrong here)
I want to know if the client generates additional private keys and if so, under what circumstances? Does a keypoolrefill affect the quantity of private keys? Does generating a given number of addresses cause an additional private key to be generated? etc...

When a wallet is created, it contains 100 keys in its "key pool". Only one of them is made visible, but when you create a new address, it actually just takes one key from the pool. The reason for this is so you don't need to backup your wallet.dat file after every transaction or new address,
New keys are generated every time one is pulled from the key pool, if possible, to keep the key pool at size 100. In an encrypted wallet, the passphrase is required to store new keys, so the key pool is only filled when the wallet gets unlocked.

So then, is it a certainty that one private key has just one public key associated with it?

Every EC private key has exactly one EC public key associated with it. This public key can be serialized in compressed or uncompressed form, though, and as the address is derived from the hash of the serialized public key, there are really two addresses for every private/public key. In Bitcoin we solve this by separating all of them: the private keys get a marker byte, and we consider the compressed and uncompressed public key to be separate.

what does EC stand for?

Elliptic Curve.


text:
how to parse input script of a transaction in blkzzzz.dat file?
In data files, an input script of a transaction appears to be in this form:
[funky byte 1][signature][funky byte 2][public key]
Bitcoind displays an input script in this shape:
[signature][blank space][public key]
My questions are:
1. In general, how should I parse an input script?
2. What are the funky bytes?
3. How should I interpret/recognize the funky bytes during parsing?

The funky bytes, as you call them, are data-pushing op codes.  The wiki has a complete list of op codes.
For example, the op code before a signature is probably OP_71 (0x47) which pushes 71 bytes to the stack as data.  Without these data-pushing codes, there would be no way for Bitcoin to tell the difference between an arbitrary sequence of bytes (such as a signature) and op codes which need to be evaluated.
Parsing is simple:

The first byte is an op code.  Read it and do what it says.  If it's a data-pushing op code, read that many more bytes and push them onto the stack as data.
The next byte after that is an op code.  Read it and do what it says.  Repeat until all bytes have been processed.


text:
How do I query a remote bitcoin node like RPC?
I know how to query the blockchain stored on my machine programmatically using bitcoind commands. Is it possible to do the same on a public node?
For example, is it possible to send “getblockcount” over the internet to bitcoinstats.com, hard-coded in the bitcoin source, or to inductivesoul.us, found in the bitcoin.it wiki? What are the steps to do so?
Edit
The quick answer is:

No, you cannot use bitcoind commands.
You have to communicate with a remote node using TCP.
You have to use a different set of commands found in the Protocol Specification.

Excellent question, and welcome to the community!
Short Answer
Maybe.
Long answer
Yes, you can send queries to other nodes on the Bitcoin network. Note that these aren't RPC calls, but Bitcoin's underlying communication protocol. That means that all of the calls will be a little different, and some of them won't exist.
Examples:

There's no equivalent to getblockcount in the underlying protocol. Instead, you can connect to a node and listen for its version message, and look at the start_height field.

Instead of getrawmempool, you use mempool.

Instead of getpeerinfo, you use getaddr.

There's no equivalent to stop, because that would be stupid.

Also, if you're trying to query other nodes on the network, one of these libraries will be very helpful:

Python: http://protocoin.readthedocs.org/en/v0.1/index.html
(Use protocoin.clients.BitcoinClient)
Java: https://bitcoinj.github.io/
(Use Peer.sendMessge)
Go: https://github.com/btcsuite/btcd/blob/master/wire/README.md

(If you're not using one of these languages, leave a comment.)

Is there an API library for PHP?

@rishta Don't think so. Didn't find any while googling.

You need to build  Bitcoin protocol messages.
This Python library can help you do it, some example here:
https://github.com/petertodd/python-bitcoinlib/tree/master/examples


text:
Bitcoin Core 0.18.0 in Docker container: Could not connect to the server
This is likely me not understanding how Docker works, but I've tried everything I can think of. I'm trying to start bitcoind in regtest mode inside a Docker container, then execute JSON-RPC commands against the container from the host machine. I'm running Bitcoin 0.18.0.
My Dockerfile looks like
FROM ubuntu:18.04

RUN apt -y update && apt -y install curl
RUN curl -o bitcoin.tar.gz https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz
RUN tar xvf bitcoin.tar.gz

RUN mkdir -p /root/.bitcoin
RUN echo "regtest=1" >> /root/.bitcoin/bitcoin.conf \
    && echo "rpcuser=bitcoin" >> /root/.bitcoin/bitcoin.conf \
    && echo "rpcpassword=test" >> /root/.bitcoin/bitcoin.conf \
    && echo "regtest.rpcallowip=0.0.0.0/0" >> /root/.bitcoin/bitcoin.conf \
    && echo "regtest.rpcbind=127.0.0.1" >> /root/.bitcoin/bitcoin.conf

EXPOSE 18443

CMD ["/bitcoin-0.18.1/bin/bitcoind", "-printtoconsole"]

After building the image, I start the container by running
docker run -it -p 127.0.0.1:18443:18443 <image>

I can spawn a shell in the running container and run bitcoin-cli commands successfully.
When trying to execute a bitcoin-cli command from the host machine I get this:
error: Could not connect to the server 127.0.0.1:18443 (error code 1 - "EOF reached")

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

If I run docker ps I see this:
CONTAINER ID        IMAGE               COMMAND                   CREATED             STATUS              PORTS                        NAMES
b815f8810b6b        90ef5856c984        "/bitcoin-0.18.1/bin…"   25 seconds ago      Up 23 seconds       127.0.0.1:18443->18443/tcp   gallant_rubin

I can run bitcoind on the host machine and successfully execute bitcoin-cli commands against it, so it doesn't appear to be a misconfiguration with the client.
I'm wondering if I'm running into this from the release notes:

The rpcallowip option can no longer be used to automatically listen on all network interfaces. Instead, the rpcbind parameter must be used to specify the IP addresses to listen on. Listening for RPC commands over a public network connection is insecure and should be disabled, so a warning is now printed if a user selects such a configuration. If you need to expose RPC in order to use a tool like Docker, ensure you only bind RPC to your localhost, e.g. docker run [...] -p 127.0.0.1:8332:8332 (this is an extra :8332 over the normal Docker port specification).

Is it even possible run Bitcoin 0.18.0 in a Docker container and use JSON-RPC from the host machine?

try this, it directly addresses the rpcbind change in 0.18.0 for Docker:  https://bitcoin.stackexchange.com/a/88419/63266

If I'm understanding that correctly, I should just have to replace the relevant lines inside bitcoin.conf with regtest.rpcallowip=0.0.0.0/0 and regtest.rpcbind=127.0.0.1, but that doesn't seem to make a difference.

This was a very simple fix. Instead of regtest.rpcbind=127.0.0.1, I used regtest.rpcbind=0.0.0.0. The logs complain with a warning:
WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet

but since I'm using regtest mode for development, it's not a problem.

You if you're on docker, don't publish the RPC port to the host, therefore you're protected, even with rpcbind=0.0.0.0
on docker-compose file, specify the ports in the expose section instead of the ports section
https://docs.docker.com/compose/compose-file/#expose


text:
Services paid in Bitcoin
I am interested in what other internet and other communication services out there are accepting Bitcoins for payment.
I know of http://mullvad.net/ for VPN and a few others, http://www.chundle.com/bitcoin for Usenet.
I doubt there are any ISPs yet or cell services.

I'm sorry, but this question is too localized.  The answers will change over time (perhaps very quickly) thus thwarting this site's intention to be an enduring reference.

Bitcoin Torrents lets you use their uber-fast servers to download a torrent.  Then you can stream it from there at a consistent rate.  Very nice idea!


text:
What's the best way to ask a merchant to accept Bitcoin?
When I buy something off the internet, I'd like to ask the merchant to consider accepting Bitcoin. What's the best way to explain to a merchant what Bitcoin is, and what it would do for them? Any success stories?

Hi NYCBrit, I don't believe that this is a good fit for the Q&A format. "We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion." I'll let others have their say before closing it though.

This probably should be moved to the forum, probably under Project Development.

As a customer, you just don't: it makes no sense and you will be rightly ignored. The only way you can do such a thing is setting up a whole counseling firm aimed to professionally promote Bitcon's use (and helping, for a fee, to set it up).

I like the question... But anyway, I think that suggesting bit-pay is a good idea because they deal with price fluctuation. Accepting bitcoins without a similar mechanism will probably result in heavy losses for the merchant.

Hi D.H., sorry you didn't like the question, I'll try to rephrase it as more of a question requiring facts.

Probably you should approach the merchant with a group of friends, and each one of you should separately ask him over the span of a couple days a question like: "I would like to buy X from you, but I would like to pay for it in Bitcoins. I understand that this is sort of payment gives you more work, so I am willing to pay Y% more. The current exchange rate at https://mtgox.com is Z USD/BTC and going up, so will you consider selling me X for Q amount of Bitcoins?" If the merchant is small, he probably will be okay with accepting Bitcoins for a moderate transaction, you can even offer waiting a bit until the Bitcoin exchange goes through (or say, a down-payment, so the merchant will know how this thing works before committing to anything). You would probably need to follow up a bit on that inquiry explaining some things about Bitcoins, but not including all the details on how the coins work probably works in your benefit (your email doesn't look like soliciting, but as a more genuine inquiry).
A bigger merchant will probably say no (unless they are tech-savvy), but after a couple people would ask about payment in Bitcoins, the lost opportunity costs would start adding up.
Generally, you can try convincing merchants with some benefits of Bitcoin technology, but probably nothing works better than money incentives and business opportunities.
(note: method not tested)


text:
API Authentication via Python
I'm having trouble following LakeBTC's API instructions for connecting to their API via Python.
API Documentation:
https://www.lakebtc.com/s/api
I have my key (email address) and secret. I'm using the API URL: https://www.LakeBTC.com/api_v1
No matter what I try, I get a 401 Error. Below is my code, any ideas?
tonce = str(int(time.time() * 1e6))

p = 'tonce=' + tonce \
    + '&accesskey=' + self.key \
    + '&requestmethod=post' \
    + '&id=1' \
    + '&method=' + 'getAccountInfo' \
    + '&params='

# Create signature
hmac_obj = hmac.new(self.secret, p, hashlib.sha1)

b64 = 'Basic ' + base64.b64encode(self.key + ':' + hmac_obj.digest())

header = {
    'Json-Rpc-Tonce': tonce,
    'Authorization': b64,
    'content-type': 'application/json-rpc',
}

response = requests.post(self.apiUrl, data=p, headers=header)

Am I encrypting and hashing correctly?

What does the returned WWW-Authenticate header say? Is there a body to the response? If so, does it show an error?

No body is returned, here is the returned header: {'status': '401 Unauthorized', 'x-request-id': '94f303be4a3e97e8dc289fbe1881555b', 'x-powered-by': 'Phusion Passenger 4.0.14', 'transfer-encoding': 'chunked', 'x-runtime': '0.002153', 'server': 'nginx/1.6.0', 'connection': 'keep-alive', 'x-ua-compatible': 'IE=Edge,chrome=1', 'cache-control': 'no-cache', 'date': 'Thu, 23 Oct 2014 17:18:16 GMT', 'content-type': 'application/json; charset=utf-8', 'x-rack-cache': 'invalidate, pass'}

A closer look at their API page, you will find LakeBTC has provided a simple code for Python: https://github.com/LakeBTC/lakebtc_python
And others Sample Code you can find here: https://www.lakebtc.com/s/api include PHP, Node.JS, Ruby and Python, maybe will more Code in the future :)

Nice work! I didn't see that on their API page. +1

Indeed! I actually just received an email from them after they added it!

I think I figured out your problem. (Or, one of them, at least.)

Step 6: POST params data in JSON format to this url:
https://www.LakeBTC.com/api_v1

You're not POSTing the the right information; you're POSTing the entire signature.
response = requests.post(self.apiUrl, data=p, headers=header)

Should be something along the lines of:
response = requests.post(self.apiUrl, data=json.dumps(
    {
        "method": method,
        "params":",".join(params),
        "id": 1,
    }, headers=header)


text:
BIP38 or Brain wallet?
I have seen many videos about paper wallets and different ways to store BTC. And I have choose to store using a cold wallet (paper wallet). But I am not sure what option I should choose: a normal BIP38 encrypted paper wallet, or a brain wallet printed in paper.
And plz tell me the differens with BIP38 and brain wallet.Thanks for your answer :D
P.S: Which one is securest?

BIP38 wallets are significantly more secure and are resistant to brute-force attacks when a decent passphrase is used.
Generally the term "Brain Wallet" refers to one in which the private key is derived from a phrase you make up.  These have been shown to be insecure because humans are bad at entropy and generally anything easy enough to remember is not safe.
Note: modern BIP39 wallets will generate a 12, 18 or 24 word "seed" phrase from which unlimited keys can be derived.  These may look like a brain wallet, but are completely safe as long as they were created securely. Remembering these words can be challenging though, so generally better to write them somewhere and store securely.

Brain wallets use your secret phrase to deterministically generate keys for you, meaning that you can never lose your wallet and there is no need to print it (except for extra-safe keeping). Hence the name, "brain" wallet (not paper wallet). But they have the downside that human chosen, and memorable, passphrases are usually easier to break. So in this sense, brain wallets are likely not as secure.
BIP38 wallets are password encrypted private keys stored on paper, and you can store the secret random password in a separate place. You can also do multisig with these wallets, I believe, so this has the potential to be much more secure. For example, if you made a 2 of 3 multisig address that you could send funds to, then even if an attacker got ahold of one key somehow, they still wouldn't be able to spend your funds.
Thus, you can see here the age-old compromise between convenience and security. Brain wallets are more convenient, but BIP38 paper wallets are more secure.

BIP38 allows you to hide your private key in plain sight.  Nobody knows what the private key is until they decrypt it with the password.
A brainwallet is essentially generating a private key by hashing a password or passphrase.
You can generate a private key using random or pseudorandom sources, or you can hash a password or passphrase.  You can then, if you choose, create a paper wallet from that key, and conceal the key with a BIP38 password.
You could conceivably generate a brainwallet and print it out with BIP38 concealment.  The caveat is that BIP38 will not protect a private key that was generated with a weak password/passphrase, regardless of how strong the BIP38 password is.  BIP38 only protects the paper wallet from prying eyes.  If someone already knows what the private key is, BIP38 provides no protection.

I think this is the most accurate answer. Brainwallets do not conflict with BIP38 or seeds; it's just one extra step in order to make it easier to remember (and unfortunately in most cases easier to crack by an attacker).

"If someone already knows what the private key is" - and this will only possible (for BIP38 protected key) if an attacker manages to reverse the public key.

Why limit yourself and have the best of all worlds when you have all the power of bitcoin-explorer command line interface at your fingertips?  The following examples should clearly answer your question with really short and sweet working examples.
Nothing says a 256-bit brain wallet private key has to be the result of a single hash.  Besides picking a high entropy brain wallet phrase not published anywhere, cascading different hashing functions makes it harder to crack and discover a brain wallet's private seed.
%  echo -n "This is a crappy brain wallet example that supports both BIP 38 and BIP 39" | bx base16-encode | bx sha512 | bx sha256 | bx sha256
6227e1e5a65d5791af2e433f42825b00ef30311439798f9f558c6066dfbb8362
% echo -n "This is a crappy brain wallet example that supports both BIP 38 and BIP 39" | bx base16-encode | bx sha512 | bx sha256 | bx sha256 | bx ec-to-ek --version 0 "My BIP 38 Passphrase"
6PYT2EZPT1AWDiPtRU19q9GJPABowwkM7s5WReTUhpgZW5KVyXG2G5FuhK
% echo -n "This is a crappy brain wallet example that supports both BIP 38 and BIP 39" | bx base16-encode | bx sha512 | bx sha256 | bx sha256 | bx ec-to-ek --version 0 "My BIP 38 Passphrase" | bx ek-to-ec "My BIP 38 Passphrase"
6227e1e5a65d5791af2e433f42825b00ef30311439798f9f558c6066dfbb8362
% echo -n "This is a crappy brain wallet example that supports both BIP 38 and BIP 39" | bx base16-encode | bx sha512 | bx sha256 | bx sha256 | bx ec-to-ek --version 0 "My BIP 38 Passphrase" | bx ek-to-ec "My BIP 38 Passphrase" | bx mnemonic-new
giraffe disease just erosion step silver royal silent dismiss beef nothing achieve vessel blush extend connect moon wide glide school hospital tape assault eagle
Additionally, be sure your BIP 39 wallet takes advantage an additional seed phrase of your choosing, also colloquially  referred to as the 25th BIP 39 seed word. This ensures if an untrusted person gets access to your seed words, you have one more layer of defense.
Finally, to round out the examples, here is how to convert a 256-bit hex encoded key into  an uncompressed Wallet Input Format (WIF) encoded key.
% echo 6227e1e5a65d5791af2e433f42825b00ef30311439798f9f558c6066dfbb8362 | bx base58check-encode --version 128
5JZWqe925xSFP9qC1XLVNm35JFKBts4bnQhjEg45b7czsJTpB2v
% echo 5JZWqe925xSFP9qC1XLVNm35JFKBts4bnQhjEg45b7czsJTpB2v | bx base58check-decode
wrapper
{
    checksum 1863987882
    payload 6227e1e5a65d5791af2e433f42825b00ef30311439798f9f558c6066dfbb8362
    version 128
}

BIP38 is a method for encrypting and encoding a private key. It says nothing about the private key itself.
Private keys are usually generated randomly, because Man is not a Particularly Good Source of Entropy and too many people are bad at creating strong phrases—which is why dictionary attacks are a thing. However, there is nothing that states that a private key must be generated randomly. A private key is simply a number between 0 and 2^256 (almost).
What a brainwallet does is to generate a private key from a phrase by converting it into a number between 0 and 2^256—usually by computing its SHA-256 hash. This way, even if you lose your private key, you can always regenerate it as long as you still remember the phrase. Unfortunately, this also means that if someone finds out your phrase, your private key is exposed. This is why brainwallets are not recommended; keeping a phrase secure is actually far more difficult than it first seems.
You can  still encrypt your deterministically generated private key (i.e. brainwallet) with BIP38 and store it in case you ever forget your brainwallet phrase. Brainwallets and BIP38 are two separate things. Although it is not common to see them combined, it is very much possible.


text:
Why wait for several confirmations before shipping?
Suppose customers pay me bitcoins for their purchases. As far as I understand, I could check block chain that the proper payment amount has been made to the address I generate for each customer, and after waiting for several confirmations I should then ship the product. Why several confirmations? Wouldn't one be sufficient?
Also, is the method I described above the best way to identify a paying customer?
Thanks

After one confirmation, the transaction is very unlikely to be double spent. However, each further confirmation reduces the probability exponentially. Basically, the number of confirmations provides additional security that the transaction will not be reversed.
One reason a retail store or individual might wait for more confirmations to ship is time; it only takes an hour for 6 confirmations to go through, which is negligible time for shipping a product, but can provide assurance to the seller.

Easier For the retailer, the answer is very much dependant upon the type of purchase.
If I am buying small discretionary purchses then it is mostly not necessary for the retailer to wait for confirmation. Think of a coffee, $4.40 so as soon as the payment notification arrives I can have my coffee. It is not concevable to steal for benefit with such discretionary purchases because I have to fine a new coffee stand every day if I keep robbing with low transaction fee and double spend method. They would sink my coffee. This is suitable for small items and passing trade, the recovery  is petty.
For slightly more expensive goods, say I purchase $100 of product at the hardware store, the benefit obtained by the trivial theft is more substantial -- theft is never worthwhile -- and so it should be sufficient to wait for one usually, or at most two conformations after the payment notification. Usually this requres a wait up to twenty to thirty minutes long but depends on the transaction fees and network. The wait is not inconvenient, this is easily suitable for online and for retail purchases, it can be call back to pickup or drop over to my home or office service.
If I require maximum surety say for house mortgage and banks then I require a minimum six confirmations and the record of the transaction is considered permanent.
The method you describe does work, many wallets have a built-in display of the current status for any transaction affecting the wallet to make identifying validated payments much easier.
Kar:

Suppose customers pay me bitcoins for their purchases. As far as I understand, I could check block chain that the proper payment amount has been made to the address I generate for each customer, and after waiting for several confirmations I should then ship the product. Why several confirmations? Wouldn't one be sufficient?
Also, is the method I described above the best way to identify a paying customer?

One confirmation is not sufficient. Suppose two miners discover a new block hash at roughly the same time. They each send it to their peers, and then to their peers, so maybe half the Bitcoin network has new block A and the other half has new block B, both believing that it is a valid new block for the next one in sequence.
This situation won't be resolved until the next block is generated after that. It is possible (though increasing unlikely) for this kind of situation to happen repeatedly, which is why you should wait for several confirmations before accepting the payment as valid.

Yes but even if this happens, it's still extremely unlikely that block A will contain the transaction, and block B (nor the further chain of blocks that follow up on B) doesn't. For regular payments (like up to a few thousand euros) a single confirmation is definitely enough. Only if you literally transact tons of money, then I would await a few more confirmations.


text:
Can we assume that the ordering of vout matches n index in json rpc
Just a random transaction for example:
bitcoind getrawtransaction e16829044c498e1d1c8fa9dc831a7c96c3b74f55b984b54a7d48c4d0156ffcf5 1

Gives:
{
    ...
    "vout" : [
        {
            "value" : 0.09076500,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "",
                "hex" : "76a914cc4ac9ecfe26163f4e657e5ce9eee9947d0459b988ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1KdCSYosbepwC4yMKWziwM3ytqWfAGg1n8"
                ]
            }
        },
        {
            "value" : 0.00200000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 04d075b3f501deeef5565143282b6cfe8fad5e94 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a91404d075b3f501deeef5565143282b6cfe8fad5e9488ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1STRonGxnFTeJiA7pgyneKknR29AwBM77"
                ]
            }
        },
        {
            "value" : 0.00200000,
            "n" : 2,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 42d163a80a1fb2579ba05c9dde70152cc1463b19 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a91442d163a80a1fb2579ba05c9dde70152cc1463b1988ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "176JSHRoCTo2jPMFy5ZMR9FHU4LbtZX6Jj"
                ]
            }
        },
        {
            "value" : 0.27422642,
            "n" : 3,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 3871de7b4bd8c08048f8ac112790050406109cba OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a9143871de7b4bd8c08048f8ac112790050406109cba88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "169TFWEpspsX9Xp5Hwq6bu5FyEe4syGu2f"
                ]
            }
        }
    ],
    "blockhash" : "00000000000000006053fc5faf2c099f30be416175488b34e947ea44480aae83",
    "confirmations" : 265,
    "time" : 1400729945,
    "blocktime" : 1400729945
}

My question is about the orders of the vout array.  Can we assume that the ordering matches "n"?  Ie.  The first vout has n=0, the second vout has n=1 etc.
The reason for asking is to take advantage of array index lookups instead of having to loop through looking for matching n values.

Yes, that's how inputs reference outputs as well.