text:
BTC Stolen from Blockchain
My bitcoin is stolen and following is how it happened?
A guy named, "David Robin" from Fremont,California US (obviously a fake one),  connected in a social network told me that I can mine for bitcoin when I connect my blockchain wallet to the blockchain mining network with the help of a antminer s9 hardware.
He asked me to register a blockchain account and send him the wallet id and password so he can do the connections.
He also said that once he is done with the connections, I will change my password.
I shared with him my user name and password information. He did something with it.
I changed my password and then topped up the Blockchain account with 0.198899 BTC, approx. $3,200/- on 27/12/17.
Within half an hour my wallet was empty.
I will appreciate if someone can explain how it has happened and if there is any way to get my BTC back?

You gave someone your username and YOUR PASSWORD (from blockchain.info?)... What do you want us to tell you? You obviously got scammed.

even if I changed my password?

The others explained it already. If the scammer has the private keys or the seed, he can do anything with your coins, irrelevant wheather you change any password.

Please put your stollen bitcoin address here to can see where this scammer put the money.

I'm sorry you were scammed. One of the reasons that many experts don't think bitcoin is ready for mass adoption or retail use is precisely because people don't understand how to keep them secure.
You gave someone access to your key and they made a copy of it, then you locked out their access to your key. That didn't do any good though, because they had already made a copy.
Changing your password prevents anyone from using that password to access your wallet and keys. It doesn't prevent anyone who already knows your secrets from just creating another wallet with the same secrets.
About your only hope for getting the money back is tracking down the scammer.

Thanks for your response, any recommendation on how to track down this scammer?

There is no way to track him with the blockchain-transction-data. Maybe he used his real IP adress to communicate in the social network. That's the only possibility to track him.

Sorry to say, you were scammed.
If you sent him your wallet id and password, he could log in and copy your seed/private keys. So it wouldn't matter if you later changed your password, he could recreate your wallet on another device, and wouldn't need your password to access it on that device.
You'll have to contact the scammer to ask for your btc back, otherwise they're gone.

So my blockchain wallet is gone forever? I cannot use the same wallet anymore?

You would not want to use a wallet that someone else has the keys to. The site you used should have had a page (likely when you changed your password) explaining that changing a password doesn't lock out anyone who already has access but only prevents new people from gaining access.


text:
I just sent my Bitcoins to a Bitcoin Cash wallet. Did I lose my coins?
I just sent my Bitcoins to a Bitcoin Cash wallet by mistake. Did I lose my coins or will they be converted to Bitcoin Cash coins after August the first?

Assuming you wait until the market decides what value exists in the Bitcoin Cash fork, you should be fine.
If the BCC fork doesn't go anywhere (no liquidity or no value), the BTC fork should still retain your coins and you should be able to spend them later.
If the BCC fork gains popularity, you can trade them there.
You may even be able to trade them both if both forks maintain market liquidity.

Bitcoin Cash is just a future right now:
https://coinmarketcap.com/currencies/bitcoin-cash/
It won't exist until Aug 1st.

yah, but i used BitcoinABC Wallet and the transaction is successfully made.

Even though the fork doesn't exist yet.

If you send btc coins to bcc (bitcoin cash) wallet , all you need to do is import the private key from bcc wallet into btc wallet and you have the coins, cause btc and bcc addresses are same generated .

source: Stack Exchange

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

sort: votes


text:
stuck transaction despite high fee - will it eventually be forgotten?
I made this transaction a few days ago with a normal fee, but it's still stuck.
https://blockchain.info/tx/461df29d7a923491e24688a79d902fb027929d1b3b57fa6e272015a9250394bc
Any suggestions how long this will take? Is the bitcoin network falling apart? For how long will my wallet broadcast it? Will it eventually be forgotten?
thanks

Most likely it has yet to be 'processed' by a miner yet. I can't tell you an actual definite timetable besides the usual 3days - 3+ weeks. It could clear sooner, but it just hasn't been cataloged and processed into and solved in the next block.

how do I know if my wallet (JAXX) keeps broadcasting it?

@Nickpick If you're talking about how you will know the progression of the chain I don't know about that. You can also check into the other thread this was marked as a duplicate of.

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


text:
Is it possible to have a cryptocurrency based on email address?
I would like to know if there is any existing cryptocurrency that lets you control the public and private keys generated.
I just don't like the fact that cryptocurrency keys are randomly generated. Even though I know generating such a pair again is almost impossible. I don't like it because it's "almost" impossible.
I have a few ideas that I would like to be used for the generation of these pairs but because I don't have an understanding of how the blockchain works, these ideas might not be practical.
I am still willing to share here if someone is willing to get back on the feasibility.
PS: Please excuse my poor grammar. English isn't my first language. I can only get the spellings right :)
PSS: I am now editing this to include my idea of a blockchain which I think I could trust:
Like I said, I just don't like the randomness that is involved. I would love to see a cryptocurrency where you have control over both the keys or at least one of the keys, preferabbly the public key.
Is it possible to have a currency with the following features?

Public key is an email address
Every transaction made on the blockchain sends a confirmation to the email address with a secret key. Once this is processed by the user, the blockchain verifies the transaction and either adds it to the blockchain or rejects it.

With such a set up, my coins would be as safe as my email address. To steal my coins, you would have to gain access to the associated email address.

You want another system to email your own secret key to you?  1. Email is pretty simple to compromise.  2 What if the email gets lost / spam-filtered?  Either the system has to retain a copy of your secret key to resend it, or your Coin is lost forever.   Worst Idea Ever

If you want a database that actually exists, see https://haveibeenpwned.com/ for billions of email accounts that have been exposed in breaches -- and that's only the known ones; criminals undoubtedly have many more that weren't detected.

@abelenky No, I don't want the system to email the private key. Only a key pertaining to the transaction initiated by the owner of the public key. The user creates a transaction using his public key (email address) and private key. The system then generates a unique transaction key and emails the user. This would be a sort of two factor authentication method. The user would then need to check his/her email to approve the transaction. And then it would be added to the chain.

@dave_thompson_085 But in that case, isn't the fault on the people? They either used weak passwords, used the password on a compromised system or their passwords weren't stored in an encrypted form in the database. If a person takes all possible precuations, uses a very strong password and uses an email provider that takes security very seriously, I don't see how this would be an issue.

You wrote, "the blockchain sends a confirmation to the email address with a secret key."  I think your words speak for themselves.

I meant a unique secret key for just that transaction. Read my previous comment again.

The dumps are from breaches of servers, over which users have limited control; other types of compromise by humans (eg phishing and doxing), on user devices (eg keylogger) and in transit (eg SSL intercept) don't show up in the dumps. If you secure your own device(s) and use strong passwords (per service!) it certainly reduces risk, but there's no practical way to be certain a provider is 'serious' about security much less that they are and will remain successful -- even security companies have been breached sometimes.

Understood. But what I wrote, is it practically feasible? A system which relies on two things viz. a private key like how things work right now plus an added level of security which requires a transaction to be verified by the owner by clicking on a link they will receive on their email address.
Right now you just need a public key and private key to gain control over an address. Another layer of security would be just awesome.
(continued in next comment)

Do you prefer to sleep at night knowing someone has an improbable chance of randomly coming across your public and private key pair or would you prefer to sleep knowing after that they will also need to crack your email account?

Now that you have https://lbc.cryptoguru.org/about what is the view on the security of Bitcoin addresses?

With Bitcoin and its derivatives, you can already generate a private key any way you like and import it using the importprivkey RPC command.  You may start with any 256 bits of data (i.e. any number between 0 and 2^256-1), convert it to WIF format as explained at https://en.bitcoin.it/wiki/Wallet_import_format, and import it.
However, don't start getting attached to this idea before you understand things better.

I just don't like the fact that cryptocurrency keys are randomly generated. Even though I know generating such a pair again is almost impossible. I don't like it because it's "almost" impossible.

The solution to this is not to invent something new - the solution is for you to learn more math until you are convinced that it is reasonable.  This is the case with everything in cryptography: no attack can ever be made impossible.  But making it sufficiently improbable really is close enough.
If you generate a private key some other way besides randomly, it makes it a lot easier for someone to guess it and steal all your money.  There used to be a fad called "brain wallets" where you would make up some memorable phrase and use it as a private key.  People who did this got their money stolen routinely, because the number of memorable phrases you might come up with is relatively small, and it's very easy for someone with a good computer to just try and guess all of them.  But the universe cannot support a computer good enough to try all 2^256 possible random keys.

Hi Nate. You are right. My math is worse than my english.
The reason for my distrust is sites like these: http://directory.io/
That site has around 904625697166532776746648320380374280100293470930272690489102837043110636675 * 128 keys.
What is your opinion on a database such as this one? Also I just edited my original post and included my idea of what I might trust.

directory.io is a parody specifically to show such a database cannot exist. Those pages are generated on the fly, and if you lived to be a million years old and spent all that time browsing directory.io you would still have essentially no chance of hitting any existing key.

Hi Dave. I know its supposed to be a joke. But it just doesn't sound funny. Remember the time when engineers never considered the year 2000 thinking by then the computers would no longer be in use but still they were.
Similarly, you might not be able to upload 904625697166532776746648320380374280100293470930272690489102837043110636675 * 128 pairs on a database which you can search.
But given enough time, would it still be impossible for a future computer to do this?
Are we to assume bitcoin is just going to be used for a few years? (continued in next comment)

I remember 17 years back a friend of mine bought an 8 GB hard drive over 250 USD and I was like wow! Both for the price he paid and the storage he got. But just a week back I purchased a 2 TB hard drive for 100 USD. Back in that day I only had  a hard drive of less than 1 GB. Now I have combined storage of over 4 TB spanning three hard drives. To assume a computer will never be able to take a go on something improbable just isn't satisfying.

this looks worrisome - https://blockchain.info/address/1LBCPotwPzBvBcTtd7ADGzCWPXXsZE19j6
they are taking away coins ?
https://lbc.cryptoguru.org/trophies


text:
How do we verify the signature on a raw transaction using Bitcoinj?
I managed to create a raw tx using Bitcoinj but not able to figure out how to verify its signatures.
Assuming I know the addresses corresponding to the (supposedly) unspent outputs used as inputs to the Tx, what is the easiest way to verify the Tx?

http://bitcoin.stackexchange.com/questions/32305

You're interested in the following API calls:
public List<TransactionInput> Transaction.getInputs()
public Script TransactionInput.getScriptSig() throws ScriptException
public void Script.correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey)

Use them like so:
Transaction tx = ...
List<TransactionInput> inputs = tx.getInputs();
for(int i = 0; i < inputs.size(); i++) {
    TransactionInput input = inputs.get(i);
    Script scriptSig = input.getScriptSig();
    Script scriptPubKey = ...
    scriptSig.correctlySpends(tx, i, scriptPubKey);
}

The tricky bit is getting scriptPubKey. If you have the transactions you're spending in memory, it's as simple as input.getConnectedOutput().getScriptPubKey();
If it isn't, then you can make an educated guess by converting the address to a P2PKH scriptPubKey.
public static Script ScriptBuilder.createOutputScript(Address to)

This creates an edge case where if someone tries to spend a P2PK output, it will appear to be signed incorrectly to your program. (Both are represented by addresses.)

Seems to answer the question. Will check and revert. Thanks for mentioning the P2PK outputs. The transactions are created by me and are standard so I can probably ignore this.

correctlySpends requires a 4th boolean parameter (enforceP2SH). What is that?

@Jus12 It's for implementing a rare edge case of BIP0016. Set it to true. P.S. You are using an old version of BitcoinJ. You should update it.

Thanks. I set it to true. There are significant changes from 0.11 to 0.12. I tried to upgrade but it breaks my code (requires some refactoring). Will get to it eventually. Are there any serious issues in using 0.11?

@Jus12 I tried to upgrade but it breaks my code (requires some refactoring) Ah, fair enough. Are there any serious issues in using 0.11? Well, people on the internet will assume you're using the latest version. :) But there's nothing specific I can think of.

As an update, there are actually some serious in using 0.11 based on this bug report: https://github.com/bitcoinj/bitcoinj/issues/1082


text:
With Mike Hearn quitting Bitcoin, what seems to be the future of bitcoinj?
Mike Hearn has apparently sold all his Bitcoins. So what is to be expected about the development of bitcoinj? (and Java based clients in general).

Hopefully, bitcoinj will now be maintained by other people that based projects on it. From what I've read and the commit list it seems that Andreas Schildbach, who also initiated the Bitcoin Wallet for Android, now takes a leading role in maintaining of bitcoinj.


text:
How to extract the signature of a transaction using bitcoinj
I am trying to extract the signatures from a transaction. What is the best way to do this given a com.google.bitcoin.core.Transaction object I just received from the network?

This works for P2PK, and P2PKH, but multisig will not work.
int index = (the index you want);
List<TransactionInput> inputs = Transaction.getInputs()
TransactionInput input = inputs.get(index);
Script scriptSig = input.getScriptSig();
List<ScriptChunk> signature_and_pubkey = scriptSig.getChunks();
ScriptChunk sig_chunk = signature_and_pubkey.get(0);
bytes[] sig_bytes = sig_chunk.data;

If you want a TransactionSignature object instead of raw bytes:
TransactionSignature ts = TransactionSignature.decodeFromBitcoin(sig_bytes, false)

how can I get a TransactionSignature object from this? I tried com.google.bitcoin.crypto.TransactionSignature.decodeFromBitcoin(sig_chunk.data, false) but sometimes it gives an error.

@Jus12 RuntimeError or VerificationError?

Here is the error I got (happens in few cases only):
java.lang.RuntimeException: java.io.IOException: DER length more than 4 bytes: 112 at com.google.bitcoin.core.ECKey$ECDSASignature.decodeFromDER(ECKey.java:358)


text:
How exactly can I generate a transaction id?
I'd like to create a transaction object from scratch. I've read that the tx id for a transaction is the double SHA-256 hash of a serialized transaction, but havent been able to find details on exactly how the data is formatted before its serialized or how it is serialized for that matter.
Could someone, perhaps, provide an example of how the data is organized before it's serialized and/or describe the manner of serialization taking place?

The serialized format is described here.


text:
Traditional VC investment vs. bitcoin IPO
There are few Bitcoin "stock exchanges" trading mainly BTC mining company pass-through shares, like

https://btct.co/
https://bitfunder.com/

We are planning to get investment for our Bitcoin-related business. Instead of traditional Silicon Valley-style venture capital investment, we are investigating the opportunity of doing "Bitcoin IPO" and liquidate some of the company shares through pass-through exchanges.
We are looking for 0,7M - 1,5M USD investment. This money would be spent to expand and internationalize our business and enable Bitcoin interaction for more people in across the world. We really need to convert the investment to fiat currency in some point, as for marketing efforts (Google ads, etc.) are paid in fiat currency.
Now I am looking for advice on what would be pros and cons of both options: VC investment vs. Bitcoin crowdfunding. We are pretty sure that doing a Bitcoin IPO first would close the door for VC investment, as our stock and IPR would get tainted with nameless Bitcoin investors of whose shares could not be bought back easily (am I correct?). However, we are also keen on doing a Bitcoin IPO because that way we could have more control over the company (not giving away voting rights) and steer the company to the direction more beneficial to the Bitcoin ecosystem instead of a 4-5 years exit plan.
I am mainly looking advice on:

Valuation in both scenarios. We believe we could get higher valuation through a Bitcoin IPO.
How much goodwill Bitcoin fans and current Bitcoin millionaires have to build the ecosystem
Credibility: a VC investment would give us more real-world credibility
Bitcoin is hot in old-fashioned VC industry right now. We have been contacted by several world-class VCs by themselves to discuss with us.
The legal implications: what is the relationship between pass-through shares and real shares? Should we move to live underground after a Bitcoin IPO to avoid possible later legal mess?
Should we found the company in some tax haven where laws are more relaxed (e.g. Seychelles)
It seems that the Bitcoin stock exchange industry is little shady, and it's hard to trust pseudonyms. Is it still too early to go there, as it might be that stock exchanges will be crashing within a year, like fiat money exchanges have, and we end up with a complete mess and lost information on shareholders, dividends and ownership?

Also we are mapping out the willingness of people to invest to bitcoin IPO here on this form: https://localbitcoins.com/ipo

You speak of a 0.7M-1.5M USD investment and your survey asks for EUR... Consistency for the win!

@StevenRoose: Thanks for pointing out. We decided to use USD here because bitcoin.SE.com is mainly US centric site. The form was created for Sauna Demo Day event in Nordic.

You definitely need to consult with lawyers experienced with VC and crowd funding.
In this climate, it would be pretty easy for you guys to get very favorable VC terms, considering the general funding environment, the recency of other VC events in bitcoin, and their relative valuations. Given the popularity of your service, it probably wouldn't be too difficult to raise the money you needed through bitcoin ipo either. Having options is good, as you can play the options against each other for better valuation and terms. I am not familiar with bitcoin IPOs, so I will comment mostly on going on the VC track or not.
VC funding could boost you to the next level
Strategically, it really depends on what you guys want the money for, how you perceive future risks, and where you see yourself in the future. VC money typically ties you into a fast hiring and fast growth track, and execution towards an exit in 4-5 years as you guys already noted. If you find yourself strained because of growth capital, engineering talent, lack of the right contacts, and you think it is a land grab situation, then VC funding makes total sense. If you need top engineers, VC money could help with legitimacy and source talent. If you need industry advisors, VC funding could help you get in touch with important and busy people. But VC funding comes at a price.
VC funding could kill you
In an emerging environment like bitcoin, the strings attached with VC funding could kill you. An example I saw was the emergence of penny auction websites a couple years ago. There were many sites with a lot of VC funding. Off the top of my head, swoopo ($14 million), bigdeal ($4.5 million). They both failed to navigate the legal compliance, customer satisfaction, credit card processing, and user acquisition aspects of penny auctions, and are now dead. In contrast, there are still several privately funded penny auctions that are very much thriving, including quibids, bidcactus, beezid. I personally think the VC funded startups were not able to deploy the funds effectively, and weren't able to stay scrappy and flexible long enough to get big like the non-VC funded penny auctions.
Another Alternative - Angel Investors
You also leave out a 3rd option: Angel Investors. This group are not bound by the restrictions of a formal investment thesis and time sensitive returns expectations. If you are looking for $700k to $1.5 million, raising an angel round maybe viable.
What Would I Do?
Keep in mind, I am some random guy on the internet, who has cursory knowledge of your business. I view VC funding as rocket fuel, only to be used when the rocket is already pointed and going in the right direction. Given the general uncertainty of bitcoin and early phases of adoption, and given your strong position as a more decentralized bitcoin exchange, I would try to hold off VC funding for X months, and try to use other funding sources while maintaining flexibility and control. Revisit the issue after X months and decide if the lack of it has caused you to miss your goals.

Thanks for very insightful response John. We are not sure if there is angel investors available in 700k-1500k class, but all tips are welcome. We are pretty sure we are going to do what you would do in "What would I do" :)

I think the best approach for you guys is to find an "anchor" angel that adds value, you guys get along with really well, is credible, and willing to put up the first funds. I'd be open to a quick online chat or a few emails to figure out if I could help you guys more. I think what you've done so far is great, btw.

Hi John. Can you drop an email to support at localbitcoins dot com.

Now I am looking for advices what would be pros and cons of both options: VC investment vs. bitcoin crowdfunding.

LocalBitcoins provides an escrow that facilitates person-to-person transfer of cash in exchange for bitcoins.  The U.S. regulator FinCEN has provided guidance that clearly describes that as being a money transmitter service.
If LocalBitcoins wants to raise funds from investors from the U.S., including from venture capitalists, it will likely need to pivot to where it is registered as a money transmitter (in all states where it is necessary) and comply with the AML/KYC requirements that such licensing entails.  In this manner, those who trade through LocalBitcoins might be serving as agents of LocalBitcoins.  That is a huge shift from LocalBitcoin's current approach.
If LocalBitcoins wants to raise funds via direct investment (e.g., IPO and listing through a cyber-equities market exchange) then it should be aware of the current status of equity crowdfunding in the U.S. -- (i.e., it is still not legal to solicit investment from the U.S. as the SEC is still doing rulemaking for equity crowdfunding).  Regardless, no cyber-equities exchanges (such as BitFunder) would be considered to be a "crowdfunding portal" so even once the SEC has completed their rulemaking raising funds through cyber-equities markets would still not be something that could be offered and comply with the securities regulations.
LocalBitcoins has already built a core Bitcoin exchange service and possibly could raise capital without having to solicit funds from U.S. investors, regardless of whether that is from venture capital or via equity crowdfunding.

This is ultimately a question where you may have to choose between liquidity and control.  Traditional VC investments are a lot more liquid, in other words, they likely have a lot more money to offer, than any bitcoin stock market.  At the current exchange rate, the amount you'd like to raise is equivalent to roughly 15,000 bitcoins (on the 1.5 million end of the the range, anyway).
Localbitcoins - you're a popular enough exchange that you may very well be able to raise that much in a bitcoin IPO.
I imagine it'd be a lot easier with a traditional VC to make that kind of money though, and that would be in fiat already for the marketing efforts that you're planning.  But the catch is that the money the VC provides will likely have strings attached, they'll want some control of your business in return for that kind of money, or as you said, the 4 - 5 year exit plan.
The other issue that you have to consider here is this: what are you looking for in return for this money?  Are you just thinking of the money going towards shares of stock, as in a bitcoin exchange?  Or do you want business advice for your business as well?  A bitcoin exchange can definitely provide liquidity, how much, I don't know.  But if you want business advice, then you are likely better off with a traditional VC since they will be able to provide that for you.

I don't understand what kind of advice you expect to receive without providing even a hint about what is it that you are trying to develop. How can you possibly get any "fans" without explaining the idea.
0,7M - 1,5M USD investment???? Nothing in this industry costs that much, unless you spend most of that on massive business promotion. But, if that's the case you do not need to get all the funds at once, from the start, especially if the idea is any good.

Thank you for very good criticism. We have loyal users who have asked us if we accept their investments to the service.

Answer to Lonulo: You can check our service at localbitcoins.com. We are not collecting money for a new idea, but an existing venture which already has quite a good traction. For example, we have about 300 new registrations/day. We might be the most popular OTC bitcoin exchange existing. We are cash-flow-positive with 4-engineer team.

I recommend http://mpex.co , because unlike other exchanges:
It had shown (most recently for S.MG) it is capable to raise the amount of money you need quickly.
You are entering into PGP signed contract with real person who runs it.
As for the law questions, you need to see lawyer in any case. Most of the. bitcoin stocks currently listed are bitcoin economy enterprises with little footprint in fiat economy, thus they can get away with staying in the gray zone. If your business allows this, you can do likewise.
Update: Maybe you can hire as a consultant someone who is experienced in murky waters of bitcoin finance and has proven reliable service. Make proper agreement with incentives for things to go smoothly. I'd like to recommend myself based on CoinBr.com service which is running since October already.

Definately do consider angel groups, in particular Bit Angels. They're a distributed worldwide group of angel investors interested in investing in Bitcoin businesses.
Outside of Bit Angels, you can definately raise around USD 1M from angels, though you'll have to pitch many of them. Gust and AngelList are the best platforms. See this Quora question for the difference between.


text:
What goes in the id/BTCUSD field for Mt. Gox "submit an order" API call?
I am trying to place a new order using Mt. Gox's submit an order API call. However I keep on getting the error object
{ result: 'error', error: 'Bad API call' }

I'm fairly certain I'm doing everything right, except I suppose the order Id which is referred to as BTCUSD in the documentation.
https://data.mtgox.com/api/1/BTCUSD/private/order/add

It gives no other explanation on what this field is, and I have found other projects calling it ID, so I'm using the node-uuid v1() method to generate a unique ID for the field.
So this is the URL I create:
/api/1/36c1f990-a4a4-11e2-84fd-a100a9f27dd2/private/order/add

and the object I send with it
{ type: 'ask', amount_int: '100000.000', price_int: '20000000' }

What am I doing wrong?

This field is used to spcify the currency pair type of the return data, so leaving in BTCUSD works fine or changing it to a different accepted currency pair, such as BTCEUR, also works and just changes the currency denomination of the returned data.


text:
Why isn't there a fast blockchain update inside a LAN behind a router between two Bitcoin clients?
This is the scenario:

2 computers on a LAN with private IPs (192.168.X.X)
router forwards port 8333 only to one of them (the 2nd one).
one computer has the full blockchain updated in its Bitcoin client,
the 2nd computer has only half the size of the block chain (Bitcoin client has not been run for a long time).

Why doesn't the Bitcoin client from the second computer detect the first computer and receive the remaining missing blocks at high LAN speed?
What i see is a very slow update of the chain on the 2nd computer.

How slow is 'very slow'? About how many blocks per second?

You can run Bitcoin with the -connect=192.168.1.3 (or whatever) switch to connect one local node to another one.
This will still not get the blocks super quickly, since the second node still needs to build a database and verify every transaction in the chain.

A typical PC will only be able to verify about 40 blocks per second, regardless of how fast it can receive them. So a typical PC will need more than an hour to go from zero blocks to fully synched.

Note that not "every transaction in the chain" is verified, only transactions after the most recent checkpoint.  See a post I made about this here: https://bitcointalk.org/index.php?topic=74275.msg823763#msg823763


text:
Why must some bitcoin clients download the block chain and others not?
What does it mean that some Bitcoin clients download the entire block chain (all transactions ever happened) and others not?

Security of Bitcoin as a whole depends on the Block Chain being held in full by many people. Currently, the Standard Client does exactly that. However, given enough copies of the Chain, one can assume the system is secure enough from the data being lost and rely on other nodes to provide the information we require when we need it.
This is where Thin Clients appear - they only store the information that is useful to them and discard all the excess. Thin Clients usually scan and verify the entire Block Chain on the go to look for any information that is of interest to them during the first synchronisation. They get that data from the Standard Clients operating in the Network, while not providing the same services to other Clients themselves.
Next type of Client relies on external servers to store and verify all the data for them and provide it when needed. They only store their Wallet locally and use it to sign transactions created from provided information. The servers supply them with information about their balance, list of unspent transaction and the like.
Last type of Client could be considered an eWallet, where all the information is stored by the server, including one's private keys used to sign transactions. With this you don't need to store any data locally and instead rely fully on third party to secure your money for you.
All in all, the more data a Client stores, the more independent it is from others. Some Clients sacrifice security for convenience, and there are many levels available for both.

The clients have different security and usability parameters. I won't repeat the information that exists - a few links that will help you understand:

What is an SPV client?
https://en.bitcoin.it/wiki/Thin_Client_Security

It's up to the user to choose how paranoid he is, what security assurances he wants, and how exactly he wants the client's usability to behave.


text:
How to make Abe query MySQL instead of reading from the bitcoin block.dat for each request?
After getting abe set up and running, I tried querying it, eg: ...:2750/chain/Bitcoin .. but looking at the abe output, I notice every page load - abe was opening the blk00000.dat  file rather than using MySQL [which I have configured abe to use].
My abe.conf looks like this;
dbtype MySQLdb
connect-args {"user":"test","db":"abe","passwd":"test"}
upgrade
port 2750
host localhost

I have checked the 'abe' MySQL database and the data is in there, I am just unable to figure out why abe isn't querying that and instead opening the blk00000.dat file. . . which is making every request I make to abe unbearably slow.
So my question is:
How to make Abe query MySQL instead of reading from the bitcoin block.dat for each request ?

I'm still loading the blockchain into my database, but are you starting Abe with the --config option pointing to your configuration file?
See line 49 in https://github.com/bitcoin-abe/bitcoin-abe/blob/master/README-MYSQL.txt

Yes I specify the absolute path to the config file when firing up abe, still nothing working :(

Did you ever find a solution for this? I am having the same problem.


text:
Difference in hashrate between two GPUs
I am a gamer who simply uses his rig to mine when idle. A year ago I was getting 0.5 Ghs using a Radeon HD7970 3072MB 384bit OC Boost, then due to a technical issue I stopped mining for a few months and eventually replaced the Radeon with GeForce GTX770 4096MB 256bit OC...
On which I am currently getting a consistent 126Mhs.
What follows may be a dumb question, but did anything change (eg some network property), that would explain a much lower hashrate on a better card? Or is there something wrong with my setup?
I'm using: BTCGuild and BitMinter, GUIMiner, Win7

possible duplicate of ATI OpenCL V.S. NVidia Cuda Cores

Should you be mining Bitcoin with a graphics card? You should look into other more profitable currencies to mine with those...

The general answer is that your card replacement caused the huge drop in hash-rate. Radeon cards are generally better for mining (faster and more efficient) compared to Nvidia. There is a nice chart that approximates hash rate per card here: https://litecoin.info/Mining_hardware_comparison
You should really consider mining scrypt algorithm at either a profitability pool (I think BTCGuild has one now) that will mine the most profitable coin and convert it to BTC for you, for a small fee of course. This should increase your mining yield by 10fold or so!
You also might try Cudaminer instead of GUIMiner for nvidia cards. I have had better using cudaminer for nvidia gpus than both cg and bfgminer.

you need to be using the cudaminer for Nvidia..
and now you should be using x11 to hash..
my GTX650ti went from 200kh scrypt to 1100kh x11 coins..
hit up a multipool like blackcoin.co/mining/
check out http://www.blackcoin.co/..
that card should scream.. especially with those specs.. maybe 2.4 to 3.4MH
I make 12 BC a day @ about .00024 Btc each a day..
http://cryptomining-blog.com/wp-content/files/ccminer-1.0-windows-new.zip
Nvidia is kicking ass right now..

Please use proper sentences and don't overuse abbreviations that uninitiated won't understand. The answer seems to be spending a bigger portion on a tangent than on the actual question. It would be beneficial if an explanation were given why the asker should be using Cudaminer.


text:
Is it possible to calculate the difficulty purely by the number of blocks generated in e.g. 3 month and the staring difficulty?
The background of this question is wether the distribution of the block generation does matter? Lets say we have a period of 12 weeks. If the number of blocks created in this time is 6*2016 then the difficulty should not change. If the number of blocks is (6*2016)*1,1 (10% more) the difficulty what have risen 6 times by 10%. This both statements should be true if the generation of the blocks is (more or less) equally distributed over the time.
I wonder now if this is true for different distributions.
I know there are this limits in difficulty adjustment (4 and 1/4) but if they are not reached it should be possible?

As you indicated in your comment, the distribution does matter and you can't average over a long period. So you would have to know:

The starting difficulty and which height it's provided for.
The time for each subsequent block that falls on a height divisible by 2016
The current height or target height at which you want to calculate the new difficulty.

Also note that difficulty adjustments every 2016 blocks are capped, so the new difficulty can be 4x higher or lower than the previous.

You should know the current difficulty to adjust the next value.
It can not be found only by number of blocks for past 3 monthes

ok - sure - I will edit my question. Of course you need to know the starting difficulty - but then the question is still open. My latest thought is: the answer is no. If the difficulty increases it increases more if the blocks are distributed evenly - thus the distribution does matter.


text:
Is it possible to give a public read only access to a Bitcoin account?
Is it possible to give a public read only access to a Bitcoin account using the Bitcoin client?
For example if for an non-profit organisation it can be useful to have read only access to it's Bitcoin account.
I know it is possible to make an web-service that is displaying this kind of data, but this requires a third part authority.

If you want the person to see the balance of each address, give them an encrypted wallet used by you. This way they can see any transaction coming in, but they won't be able to spend anything. However, this requires them to run a Bitcoin client themselves, which can be a pain at times.
Use the Block Explorer and search for the single address you will be using. Case in point - all donations made to Wikileaks - http://blockexplorer.com/address/1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v (warning, this page can load for awhile).

Thanks. You are right encrypted wallets show balance without decoding them.

Re 1: They will also not be able to see change that returns into your wallet when you spend something (because it goes to a new address). You'd have to send them an updated version of the encrypted wallet from time to time. And I am not sure if I would give anyone my wallet, even encrypted. Better to export all public keys and send those.

I agree with @Thilo Giving away the encrypted wallet is an really bad idea: it exposes you with a completely unnecessary risk; despite it being small, being unnecessary makes it very bad. Just give the public keys instead!

The My Wallet service from http://BlockChain.info/wallet lets you create paper wallets and then you can remove the private keys from the browser-based wallet.
Another service that might be of use is: http://bitping.net


text:
What information does a wallet contain?
What information does the Bitcoin wallet file used by the Bitcoin.org client contain?
Is the owner's Bitcoin balance written in the wallet.dat file, or does it contain a list of transactions that have been made since the beginning of wallet creation?  Does the wallet's filesize grow bigger as more transactions are made?

Now that there are clients with their own wallet formats, I clarified the question by specifying that it is referring to the Bitcoin.org client.

From looking at the code, the wallet.dat can contain entries of the following types:

name - an address book name
tx - a transaction
acentry - an accounting entry
key - a pair of public and private keys
mkey - a master key
ckey - an encrypted key
defaultkey - the default receiving address' key
pool - a keypool entry
version - the version of the software that wrote this wallet
minversion - the earliest version of the software that can read this wallet
cscript - a script
bestblock - a pointer to the end of the best blockchain seen
wkey - a private key (no longer used)
setting - used to store user interface settings (no longer used, except to hold an invalid setting to stop pre-0.4.0 versions of the client which don't understand minversion from loading wallets that are too new for them)

See also this answer.

wkey is not used anymore, afaik, it is a private key with some metadata. key contains both public and private key. There is also 'bestblock' with a locator of the last seen tip of the blockchain.

A default bitcoin wallet contains a list of private and pub key pairs. A number of keys are created on generation this is to allow for "swap" as you send money from it, these are not visible directly. This does not affect your balance which you use.
Your transactions are stored within the blockchain. If you generate new address to receive to then your wallet size will grow. If your wallet is moved to a new computer, with no blockchain, it will appear empty until you download blocks up until your transactions are known by the client.

Yes, but the wallet also contains a copy of the transactions that affect your balance.  If you restore an old backup of wallet.dat you'll find it is missing transactions that happened after the backup until you use the -rescan command line option to get it to look through the blockchain and copy the relevant new transactions into the wallet.dat.

Not all clients store this information as far as im aware.

I guess I assumed the question was about the Satoshi client.  Is there another one which keeps its wallet in "wallet.dat" and rescans the entire blockchain every time you run it?

Your correct. I took wallet as generic rather than the specific client. Il modify my answer.


text:
Is the current number of confirmations visible somewhere in the raw block?
Is the current number of confirmations visible somewhere in the raw block output created by blockexplorer or blockhain.info?
Is this information available in the raw stream or is the number of confirmations always "live" calculated by counting the confirmations and not "saved" in the raw stream?

The number of confirmations is (height of most recent block - height of the block containing the transaction + 1). The contents of the specific block containing the transaction are fixed, while the number of confirmations keeps increasing, so the number of confirmations cannot be in the raw block data.

The genesis block had a height of 0.  The next block had a height of 1.  And so on.  It's the "block number".  There can be multiple blocks with the same number, such as when two miners solve a block at around the same time.

@ChrisMoore: What's the context of this comment?

@MeniRosenfeld I asked "what is height of the block". I found out the correct answer a few minutes later and deleted my question. Chris Moore probably answered at the same time as I delete my question.

I was answering a comment which asked "what is the height of a block"?  The comment was later deleted.


text:
Remove address from sequence in HD wallet
Is there a way to eject an address out of the sequence of an HD wallet?
Lets say an address was used for a political donation to a regime in Namibia that may get international condemnation a few decades in the future (can never tell with political parties, maybe they don't invade Russia in the winter and end up writing the history books) or perhaps anyone that donated to a campaign against zombie equality rights is now condemned publicly in the unforeseen future even after the majority population donated and voted the same way you did
Therefore I don't want that to appear in my wallet, whether I restore a seed on a different device or future wallet. But I only thought of this after the address was used. This is considering the possibility that in some future, I may accidentally mix inputs to other addresses, providing for blockchain analysis of addresses I own, or perhaps I simply leave my computer unlocked at some point in the future and someone is able to see my addresses.
Is there a way to eject that address from the HD sequence or perhaps is this simply a GUI thing that software clients would have to do on there own?

The problem with dropping an address from an HD wallet is that they are deterministic, so how do you change the determined sequence? The only way I see is creating a new HD wallet (a new sequence), transfer all your money there, and then denying the original affected one was yours (this may need coin mixing).

No, there is no way to 'drop address' from an HD sequence. You could sweep your funds(mix them) and move them into a (cleaner)different HD wallet if you're worried being able to getting linked to that address.


text:
Pros/Cons/Limitations of Mnemonic Phrases - BIP39
BIP39 mnemonic phrases replace considerations about how to store one private key, with considerations about how to store the seed to a series of private keys.
The idea is that the private keys are hard to remember, worse to write down, and prone to discovery when stored digitally, so the solution is that you can have a phrase of words that act as a seed to a hierarchical deterministic series of addresses.
It seems like this idea has been lost in translation as the phrase length of mnemonic phrases has increased from 12 words, to 24 words, with the "more secure than thou" using even longer words and phrases, and security minded companies alike promote writing down the mnemonic phrase, in multiple places.
or splitting the phrase, or putting an additional passphrase on top of the HD sequence, or using Shamir's secret key.....
all of which simply create more points of failure.
Ultimately: instead of one paper wallet compromising one private key, your paper phrase will compromise ALL of your private keys. OOPS. or you forget the secret key, or you lose a piece of the phrase, or you misspell it
At least we can be confident that the words themselves contain enough entropy to prevent guessing, RIGHT GUYS? RIGHT?
What are the pros, cons, limitations of BIP39, or at least my concerns. I have read the wiki and the github markdown on BIP39, and these do nothing to alleviate these concerns because these BIPs are a centralized process

to answer the first part;
generally speaking people will want to backup their whole wallet, not specific PKs.
so using a HD wallet and making a backup of the seed (either the seed or a BIP39 mnemonic doesn't matter) matches what people using 'normal' wallets do, you backup your whole wallet in 1 place (most wallets have a backup/export file for the whole wallet).
BIP32 - HD Wallets - (and BIP39) isn't supposed to replace being able to split your backups into multiple private keys being scattered around, it replaces a single wallet being backed up in a 'traditional' way, 1 file (or print) for the whole wallet.
also a BIP39 paper backup has the same issues as normal private key backups that you mention, if you loose the passphrase or mispel it ... it's gone ...
But if you want to spread the risk by splitting your bitcoins across multiple backups then you should just have multiple wallets to split them.
BIP39 is also only the process of converting a seed to mnemonic and back, your (above discussed) concerns are actually with HD wallets in general, which is BIP32 ;-)
now your only real concern regarding BIP39 is about the words containing enough entropy!
and they do, because the words are generated from a 128 or 256 bit entropy to begin with, the hex entropy is split into chunks of 11, which means you have a list of 0-2047 integers as a result.
that list of integers is translated to the words (and back to the hex and to the binary entropy when you use it).
Let me demonstrate that by showing you how one of the official test vectors is converted:
hex of entropy: 7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f
bits of entropy: 011111110111111101111111011111110111111101111111011111110111111101111111011111110111111101111111011111110111111101111111011111111000
chunked into 11 length parts:
 [0] => 01111111011
 [1] => 11111011111
 [2] => 11011111110
 [3] => 11111110111
 [4] => 11110111111
 [5] => 10111111101
 [6] => 11111101111
 [7] => 11101111111
 [8] => 01111111011
 [9] => 11111011111
[10] => 11011111110
[11] => 11111111000
those parts converted into words using the default word list:
legal winner thank year wave sausage worth useful legal winner thank yellow
the mnemonic together with the password TREZOR converted to a seed hex:
2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607
now the cool part actually is that if you use a different password with the same mnemonic you get a different seed and thus a different wallet, you could have 2 wallets and if you get robbed only hand over the BTC in one of them ;-)

"BIP39 is also only the process of converting a seed to mnemonic and back" - BIP39 uses one-way hash to derive the BIP32 seed. There's no way back.

Bitcoin-explorer passes the BIP-39 test vectors. Look at the bitcoin-explorer examples below to answer questions above.
1) echo "0" | bx base16-encode | bx sha256
effcce8fe9c6da7e1b50cccdfc082cdf8d1b135aed519bc27cfd5cacb16269d6
2) echo "effcce8f" | bx mnemonic-new
useful toy phrase
3) echo "e9c6da7e" | bx mnemonic-new
truth cycle panic
4) echo "effcce8fe9c6da7e" | bx mnemonic-new
useful toy physical squeeze horror disease
5) echo "effcce8fe9c6da7e1b50cccdfc082cdf8d1b135aed519bc27cfd5cacb16269d6" | bx mnemonic-new
useful toy physical squeeze horror disease hood book social theory arctic sample spider meadow hill pretty orange become dismiss rich slam raise point soon
6) echo "effcce8fe9c6da7e1b50cccdfc082cdf8d1b135aed519bc27cfd5cacb16269d6" | bx mnemonic-new --language en
useful toy physical squeeze horror disease hood book social theory arctic sample spider meadow hill pretty orange become dismiss rich slam raise point soon
7) echo "effcce8fe9c6da7e1b50cccdfc082cdf8d1b135aed519bc27cfd5cacb16269d6" | bx mnemonic-new --language es
trozo tez opinar sauna honra dar hombre azafrán rubí talón amapola puré salvar mármol héroe pánico norma ascenso dátil posible ritmo perla otro ruptura
8) echo "useful toy physical squeeze horror disease" | bx mnemonic-to-seed
ab226a6e34d87c6a469cfca5d034d7c053ee6f5478bccb1589bc3b216759cb263cab74503471c2f44cbe3d5c06e1e1a774a3feb51a8dfdcc4dd4aece392802e2
9) echo "useful toy physical squeeze horror disease" | bx mnemonic-to-seed -p TREZOR
a1e90b6de07f62e8e09268a138761e9a93296afa221fbefc7b4bcaefef71aac6d4a385af7a0ca34d96b275953d4bbd12d442d9738f1559c855f292e7a4a75daa
10) echo "useful toy physical squeeze horror disease hood book social theory arctic sample spider meadow hill pretty orange become dismiss rich slam raise point soon" | bx mnemonic-to-seed
4703dc4343298d2ea7ddfa5f60b8a359f87c73f356b7eb684596f15390e1d8f67e42c5b224765bf10a4ed3437d3fd6b6110edb2c235ec997b1d969693bc12d18

Question: which bx library are you using - that one: https://github.com/libbitcoin/libbitcoin-explorer potentially?

Yep that is the source code. Binaries are available at https://github.com/libbitcoin/libbitcoin-explorer/wiki/Download-BX.

Can you please have a look at the discrepancy? https://imgur.com/a/HDssr

Looks like the executable being used was using the boost without icu.  Examine install.sh for building with icu.

Too busy, too many other projects, unlikely to dive into the core issue.

It's the output of echo "0". These produce four different results: "0", "00" 0 and 00. bx base-16 encode converts any data to base16..."The binary data to encode as Base16. This can be text or any other data."

Any limitation resulting from a non-ICU build would be reflected as an error output.

I believe that the best way to regard BIP39 is as a way to create portability for your keys.  You can then move them from one wallet to the next, and/or back the mnemonic up in a variety of ways.  You're not tied to one wallet or system of backup.  Previously, backing up or moving your keys to another wallet was an arduous affair, done one key at a time.  Most people didn't bother, and when their hard drive failed, or they forgot their wallet password, all was basically lost.
Does this really address theft risks?  No.  In an ideal world, you would have a reliable way to regenerate your seed on the fly, and only use a mnemonic to move from one wallet to another.
Theft risks are handled by other systems: airgapping, adding a password to your  mnemonic, imprinting mnemonics on metal and storing them in a bank vault or other reliable physically secure storage system, using a hardware wallet, etc.

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


text:
Does blockchain.info's json-rpc api return invalid json?
example response for getting a block:
{"id":"0","result":{"tx":[1ddd2f103625405389705637ab69603de692a22e86f06428a2...

there should be a " after the "tx":[

Can you give an example query that produces the output you have shown? A request such as https://blockchain.info/rawblock/00000000000000008daa21d98148ef94f8710cc1809f0d74288b55c3cdc8fec6 appears to produce well-formed JSON output.

That request isn't using the json-rpc api.
I'm talking about something like curl 'http://foo:bar@rpc.blockchain.info:80' -d'{"method": "getblock", "params": ["000000000000000011d19133cf716fb977c3a89a1b5cba9598d745a50ba118e5"], "jsonrpc": "2.0", "id": 0}' -H"Content-Type: applicaton/json"

Ok yeah, that helps. I get the same sort of result as you describe and that certainly doesn't seem to be valid JSON.


text:
How do I get my cash back into dollars in Nicaraua?
Suppose I sell my house and get a pile of cash. The USA government wants to get some or all of my money if I try to move it to another country. That's not fair. It's mine and I already worked for it and paid income tax on it. I want ALL of my home money. Can I put it into bitcoin in the USA and visit Nicaragua and get my money out a bit at a time, as needed, there?

Is there a way? Probably. Is there a legal way? Doubt it. P.S. don't add signatures in your post.

Bitcoin has no concept of borders.
There are many trades in which the buyer doesn't know the seller and vice-versa (or both, like in a dead drop where neither knows anything about the other).
So it is entirely plausible to cash out bitcoins in a foreign country without any other parties other than you and the seller knowing about the transaction.
Your example describes where you have a "pile of cash".  It doesn't matter if the cash is from the proceeds after selling a house or whatever, those funds can be converted to bitcoins in any number of ways.
So yes, bitcoin is like cash, and can be traded for cash.  Where it differs from cash is that it can be transported across borders physically, electronically, or in no form other than words you keep in your brain.
Because bitcoin transactions are traceable, those preferring to transact privately can employ method called "mixing".  This gives bitcoin user-defined anonymity.


text:
"Failed to read Block"
I encountered a error whilst downloading Bitcoin-Qt on my Macbook version 10.6.8; it says "Failed to read block"
How do I fix this error without losing the bitcoins currently in my wallet?
Your assistance will be greatly appreciated.

You say that you are 'downloading Bitcoin-Qt'. Are you using a browser to download Bitcoin-Qt, or are you using Bitcoin-Qt to download the blockchain?

This question helped me with the same issue: http://bitcoin.stackexchange.com/questions/10295/bitcoin-qt-read-block-error

Start the client with the -reindex command-line option.

If you backup the wallet.dat file, then you should be able to remove everything else, and then Bitcoin-Qt will redownload the block chain.

This will work, but is overkill.


text:
How is the hash that is signed calculated?
I'm a bit confused about the signature contained in the scriptSig of a transaction. My question is: what do we really sign? Is it the hash of the previous transaction?

scriptSig contians a signature of the concantenation* of the previous transaction's script and the new transaction.  It has to be both because if it were a signature of just the previous transaction, someone could swap the output address in the new transaction and relay the transaction sending the coins to himself!
scriptSig also contains the public key to verify the signature because the previous transaction only has the hash of the public key.  The hash of a public key is an address.
Source: https://en.bitcoin.it/w/images/en/7/70/Bitcoin_OpCheckSig_InDetail.png
* Not really concatenated, it's inserted in the middle.


text:
What is a previous transaction?
I'm new in the bitcoin field and I need to understand about transactions.
When Bob is sending bitcoins to Alice, Bob will create a tx, he will add Alice's address, sign it and broadcast it in the network. But what is the previous transaction in this case? Is it a different tx from the one between Bob and Alice?

It's the transaction (or transactions) that bob got his bitcoins from.

What if that previous transaction is old? Does this matter?

@user2016355 If the previous transaction is old, then the bitcoin network will give the new transaction special treatment.

Thanks Nick. Is it possible to explain more? is there any link that I can read on the internet for that special treatment?

@user2016355 https://en.bitcoin.it/wiki/Transaction_fees Look for "Technical info"


text:
How do I recover an encrypted bitcoin wallet to which I don't know the password?
My husband died recently.  He had a Bitcoin-Qt wallet with some bitcoins.  I don't know the password and the wallet is locked and encrypted.  Is there anyway to regain access to the wallet?

Sorry for your loss.
If he used early versions of Bitcoin, he may have made an unencrypted backup of his wallet.dat file somewhere. Cracking a password may be impossible, so this might be your next best option.
Wallet encryption is a feature that was implemented in version 0.4.0 on 23rd Sep 2011, so if you do find a wallet.dat file older than that it's probably not encrypted.
Bitcoin users that are aware they are holding a substantial amount of bitcoins also are probably aware that they need to back their wallet.dat file up to a location different to their PC's hard disk in case of failure. You might find it on a DVD, thumb drive, or maybe somewhere like Google Drive.

There is a discussion about the subject, including a script for password cracking, at https://bitcointalk.org/index.php?topic=85495.0;all


text:
Why should I use multiple workers?
Why should I use multiple workers for different computers? In which case should I create another worker?

You should use multiple workers if you want separate statistics for them, or if the pool you are using limits the number of connections that are allowed per worker.

You have to create a worker per machine.
This way, the mining pool will be able to track each system's contribution to the work being done.

Yeah, but other than that


text:
Why was this transaction allowed on testnet?
I'm a bit confused on how testing stuff for Bitcoin on the testnet currently works.
For example, bitcoin core 0.10 enables only 40 bytes in OP_RETURN, but I'm not sure if 0.10 is the latest version allowed on the testnet.
I know that there are OP_RETURN transactions in the testnet block chain that are up to 64 bytes, as seen in this transaction:
{
  "transaction_hash": "91615716a4d3c42cafc240b594d79782709c2c359bd0d5a1d30fa2ee8294bcd3",
  "hex": "37356365626362356462366363636537383565633837646134353564373332646162653661313462636362623235393338643465663163373539346232303934",
  "text": "75cebcb5db6ccce785ec87da455d732dabe6a14bccbb25938d4ef1c7594b2094",
  "receiver_addresses": [

  ],
  "sender_addresses": [
    "mmHWy49WWGFQgmeZt7wYKvWSh7Szi9XQAm"
  ]
}

source
Is the code for the testnet differences within the most recent bitcoin github repo, or is it a separate repo I must download, compile, and point towards the testnet?
Some clarification on how this works would be great.

For example, bitcoin core 0.10 enables only 40 bytes in OP_RETURN, but I'm not sure if 0.10 is the latest version allowed on the testnet.

40 bytes in OP_RETURN has always been legal. It was just non-standard, meaning that the standard client wouldn't mine or relay those transactions, but would allow them if they were already in a block.
However, testnet disables all standardness rules.

Is the code for the testnet differences within the most recent bitcoin github repo, or is it a separate repo I must download, compile, and point towards the testnet?

It's the same program with the -testnet switch passed at the command line. (Or in your bitcoin.conf. Either works.)

Is there somewhere I can find the differences between testnet and mainnet enumerated or listed in human-readable fashion?

@bvpx I don't know if it's human readable, but the best resource I know of is https://github.com/bitcoin/bitcoin/blob/00820f921d8fcaa031e561ee641c50e77a909670/src/chainparams.cpp#L30

Thanks. So the major differences are the block generation / difficulty constants (in that file) and the absence of enforcement of isStandard.


text:
What is a midstate? How does using a midstate speed up hashing?
This defines "midstate" as the "precomputed hash state after hashing the first half of the data."
I've heard "midstate" used in the context of speeding up hashing. How does using a midstate speed up hashing?

Possible duplicate of http://bitcoin.stackexchange.com/q/5034/18196.

People often talk about SHA256 like it's a single operation, but it isn't. Rather, the input is broken up into 64-byte chunks, and then each chunk is put into a compression function. The state of the hash partway through hashing something does not depend on future parts of the data. Since the nonce is found in the second chunk, changing the nonce doesn't change the the state of the hash function after hashing the first chunk.
This is useful in other applications. For example, if you're hashing a large file, it means that you can hash it without loading the entire file into memory at once or loading it from disk multiple times.
The practical consequence of this for Bitcoin miners is that 99.99999998% of the time, you only need 2 iterations of the SHA256 compression function to check a possible block solution, instead of 3. In other words, you can mine 50% faster. Of course, since everyone else does this, that just means that the difficulty is higher for everyone.
midstate is literally the state midway through hashing.
See also: Did Satoshi intend to allow midstate computation to speed up hashing?

I thought it was broken up into 32 bit chunks. At least that's how I interpret sha256_generic.c.

@Geremia It's split into 64 byte chunks, then copied, 32 bits at a time, into the message schedule array. 16 times 32 divided by 8 equals 64.

But we're talking about double SHA-256 (SHA-256d) here. How does that factor into things?

SHA-256d (b) on input data is: b=SHA(a=SHA(data)). Thus is a the "midstate"?

@Geremia a isn't the midstate itself. You can use the midstate to more efficiently compute a because the first half of data doesn't change. b must be done from scratch (although because a is only 32 bytes long, computing b only involves a single SHA-256 block).

related discussion

Unless I'm corrected otherwise, I'll offer this analogy:
There's two closets filled with files. You've searched through Closet 1 already (personally, or work done by another team) and want to save yourself the time of searching the same closet again the next day. So you (cryptographically) seal the door so as to be certain the state remains (no one alters files). This allows you to concentrate your efforts on the second closet.
Again, I am on the fence between whether to comment or answer but I've chosen the latter

This doesn't seem like a very good analogy. You're not trying to narrow the search space, you're trying to speed up individual attempts.


text:
Android BTC clients that remotely use my Bitcoin Core wallet?
Are there any Android BTC clients that remotely use my Bitcoin Core wallet so I don't have to use another wallet specific for my phone? I am running my own BTC node.

No. Something like that would be problematic security wise because it means you have to open up your computer running Bitcoin Core to the rest of the internet. Having two seperate wallets is not really much of an inconvenience because it is easy to send bitcoins between them.

The Bitcoin Core's JSON-RPC server supports SSL, so it could be possible securely.


text:
Repeated error synchronizing Bitcoin client
I've tried unsuccessfully 2 times to download the application from this site https://www.weusecoins.com/en/getting-started. Last failure stopped at around 16,000 blocks. I am trying to get setup with a wallet and begin buying BTC's. I do not want to use an online wallet service.
The only other applications that I had open during the download was Firefox and I use AVG Free Antivirus, but do not know how to disable it. I have restarted the OS.
What to do?
Thank you very much in advance.

Can you clarify the failure you're seeing? Does it just stop, or do you see an error?

Also, which operating system (version) and which version of the Bitcoin client?

possible duplicate of What can I do when the blockchain synchronization is stuck at a specific block?

You may have more luck if you just use a bootstrap file. Download one and put it in your bitcoin data directory (remove everything else from the directory, but let wallet.dat stay). Name the file bootstrap.dat and then start the client.
The bootstrap file I linked to only contains 190.000 blocks, so after that you still need to download ~40.000 blocks.
Also, as Abei Villafane said, be careful with overclocking. It only takes a single memory error for the chain download to break, and those are far less likely when not overclocking.

If your computer is overclocked, this may fail repeatedly. Even overclocks that are stable in other situations can fail during this CPU/memory intensive sync process. Go back to stock settings and try again.


text:
Work rejected. Server says: Stale or alien proof of work
I get this error using BitMinter Client v1.3.2:
Work rejected. Server says: Stale or alien proof of work

about every 15 - 45 minutes, just mining on my GPU.
What is happening? What does it mean to have a proof of work rejected? How can I prevent it?

I have no idea what alien proof of work is. Perhaps somebody should ask him on twitter.

There will always be some stale work that is rejected by the server.
When there is a new block on the network (from any pool) we need to switch to building on top of this new block, at the new height. The server sends out new work data to all workers. But some of them are sending in work results at that moment, and it gets rejected because it is based on the old work data.
I would consider a reject ratio of 0.5% or lower to be normal and acceptable.


text:
Does NBitcoin use hardened private derivation?
When writing the following code:
            ////////////////1st offline SERVER//////////////////
            //Create Master Private Key with a seed
            ExtKey privateKey = new ExtKey("16236c2028fd2018eb7049825e6b4f0191de4dbff003579918de7b7348ff06ac");
            //create master public key from this privateKey
            ExtPubKey pubKey = privateKey.Neuter();

            //save it's wifStr as key to the next server to use and generate all child keys
            string wifStr = pubKey.ToString(Network.Main);
            ////////////////END//////////////////

            ////////////////2nd online SERVER//////////////////
            ExtPubKey key = ExtPubKey.Parse(wifStr);
            //The payment server receive an order, note the server does not need the private key to generate the address
            uint orderID = 1001;
            //address created with only extendet publik key
            BitcoinAddress address = key.Derive(orderID).PubKey.GetAddress(Network.Main);

            Console.WriteLine(address);
            ////////////////END//////////////////

Am I using hardened private derivation function ? please explain why .
I know that in order to use hardened private derivation function I should derive it from a hardened parent, but how do I know that the parent is hardened parent ?

Am I using hardened private derivation function?

No. You're using nonhardened derivation. That's the only kind of derivation that you can use when you only have the public key.
Hardened derivation looks like this:
BitcoinAddress address = privateKey.Derive(orderID, true).Key.PubKey.GetAddress(Network.Main);

It requires the private key. It also doesn't matter if the parent is hardened or not.
I would recommend using nonhardened keys for most applications.

Why so ? in the book "Mastering bitcoin" the recommendation to use hardened keys, for using nonhardened keys and leak of a private Key can expose the all brunch from the extended Publik Key.  I don't understand the issue in using hardened keys where you have to give the top private key so how can it create a "firewall" ?

@HaddarMacdasi If you're using hardened keys, then the private key needs to be present whenever you want to generate addresses. That is, in practice, less secure.


text:
What is the wallet in MultiBit?
What is the actual wallet? The slight confusion comes from the install note -
"Backup all your wallets.

You can do this by exporting your private keys
using 'Tools | Export Private Keys'."

If a new wallet is created and called newwallet.wallet,
is that the wallet, the other file with a date string newwallet-2013xxxxxxxxxx.wallet, the exported private keys, or all of them?
Which one is to be backed up, or to be saved and imported into another system?
Also, are these multibit wallets only compatible with multibit, or can they be imported into other programs. On other programs they are called wallet.dat?

There is a section in the help which describes what each file is and the the data it contains. It is in the section 'More technical details' called 'File descriptions'.
The wallet file (without the numbers) is the main wallet file. It contains your private keys and the relevant transactions.
The wallet file with the numbers in the name is a rolling backup file. The numbers are a timestamp and it is 'the wallet that was saved just beforethe last save'.
The files with the suffix 'info' contain the labels for your addresses.
Private key exports are typically given the extension 'key'.
You can backup your wallet either by :

Closing MultiBit and then copying the wallet and info files.

Or

Exporting your private keys to a private key export file. This only contains private keys (no labels,  no transactions). You can import it into a new wallet and it regenerates the wallet (but currently you lose your address labels).

For higher value wallets I recommend backing up using both techniques and to two separate devices (just to be on the safe side).
Note that the MultiBit wallets are not deterministic so if you create more receiving addresses you will have new private keys created. You will want to redo your backups. You can choose how many new receiving addresses to create at a time (1, 5, 20 or 100) so I normally add more than I think I'll need for that wallet to save me the bother of re-backing up.
The wallet format is in a format called protobuf. This is the format used in the bitcoinj library and is also used in the Schildbach Bitcoin Wallet.
Developers can easily read and write this file format in other languages like C, C++, python though to my knowledge no-one has written parsers for the data format yet.
Different clients tend to have import and export at the private key level (as that is the crucial data) and it's more standardised. The MultiBit private key export files can be imported directly into blockchain.info and the individual private keys can be transferred to and from anything that supports the WIF private key format. Pretty much all the clients import/ export this private key format.


text:
What is the maximum number of names (domains) that can be registered with NameCoin?
Is it 21,000,000 / 0.01 (the cost of naming) = 2.1B?
from docs: "The name_firstupdate transaction has a network fee. The network fees represents namecoins (NC) that are destroyed. "
Am I missing something? If not, it seems like quite a small number.

Why isn't 2.1 billion enough? There are only 252 million domain names in the standard DNS system.

Namecoin isn't exclusively for domains. It can be used for personal 'ids' and other purposes as well. There are over 8 billion people in the world, and with the advent of 'Internet of things' the number domains needed is likely to explode.

Given increased use of Namecoin, which would lead to a shortage of namecoins as you describe, the fee would be reduced. I have previously seen plans to reduce the network fee to 0.001 or lower, but can not find it now.
These changes would require a hard fork of Namecoin, but it is important to note a fee is only destroyed upon a new registration. Updates of DNS records and domain renewal go to miners.
I am not aware of any hard block size limit, but should one exist (or be implemented with a hard fork) it would be unlikely to get anywhere near the 2.1 billion names as you describe.


text:
How secure would it be to use my toy bingo machine to generate a bitcoin private key?
Am I right in thinking there are 90! possibilities.
Would it be random?
Would you trust this technique?
https://i.sstatic.net/4RYbc.jpg

But only if you always fill up all 90 fields. If you also allow shorter combinations there are even more! ;)

The address space has 2160 possible addresses, so to fully benefit from that space, you'd need to surpass a space of

2160 = 1.46E48 combinations.

This is achieved by picking 26 numbers from your toy bingo machine as

90!/64! = 1.17E49

while you keep track of the order in which they are picked.

To achieve at least 64 bit of entropy, you'd need 10 numbers (order recorded) from your toy bingo machine:

90!/80! = 2.07E19 > 1.84E19 = 264

Which was suggested as a minimum on the related question: How many throws of a dice are necessary to defeat a brute force attack?
All numbers are assuming that the toy bingo machine acts reasonably random.


text:
how does bitcoind functions in bitcoin exchange model?
i mean exchange allows every users a unique BTC deposit address
different users sends btc to different addresses but BTC endsup in same wallet
can i create multiple receiving address by bitcoind (getnewaddress)  or i will have to use HD wallet for that for our users (we are building lotto system on bitcoin)

If your project is sufficiently developed it would be great to see it published on GitHub.

A wallet is not the same as an address. A wallet is a collection of addresses. Wallets usually also contain the private keys for the addresses and any relevant transactions.
You can get as many addresses from bitcoind as you want with getnewaddress and they will all be part of the same wallet. Any coins sent to those addresses will be part of your wallet.
Also, Bitcoin Core is an HD wallet, but there is no need for you to have an HD wallet to do what you want. HD wallets are only relevant for backups.

we are working on project like an exchange its a lotto system plus lotto trading people can trade their lotto before declaration day,i wants to know if all coins will be part of our system wallet then there will be too many private keys for users right? if yes then how we can get regular backups of users private keys and public keys if they wants their private keys back

The private keys are your private keys, not the users private keys. They are part of your site's wallet. The user should never be giving you any private keys, nor should you be giving users any private keys. They are depositing money into your website; the money is yours.

Ok,thanks a lot .one more question : are you open for consultation we can pay for that by d way because i have at least 6 questions so i will need much help of your knowledge


text:
How to recover blockchain wallet on iPhone with address & PIN?
My iPhone crashed and I lost access to blockchain app. I have my savings in that wallet which I can't access anymore. Is there anyway I can recover my previous wallet?
I have the transaction history and the address I also have 4 digit PIN that I used at the time (nothing other then that). Please help I want to get out of this situation.

It is impossible to spend coins (aka recover them in your case) without having the private keys. You do not have enough information to have the private keys (address is not enough, 4 digit PIN is only for unlocking the wallet). Thus your coins may be lost.
However, blockchain.info is an online wallet. You should be able to go to their website and access your Bitcoin that way. You will need to have the account identifier (or wallet identfier, whatever it is called) and your password.


text:
How can I transfer my BitCoins to my PayPal?
How can I transfer my bitcoins to PayPal?

If you have them in an exchange like coinbase.com: (1) sell them into your bank account, (2) connect your bank account to PayPal, (3) transfer them from your bank account to PayPal. If you have them on your hard-drive, step (0) is to open an account on an exchange like coinbase.com and send them to your account.

@AlinTomescu It would be useful if you would write your response as an answer.

If you have them in an exchange like coinbase.com: (1) sell them into your bank account, (2) connect your bank account to PayPal, (3) transfer them from your bank account to PayPal.
If you have them on your hard-drive, step (0) is to open an account on an exchange like coinbase.com and send them to your coinbase.com account. Then go to steps (1), (2) and (3).


text:
What are the pros and cons of premined altcoins?
When starting an altcoin from scratch, how would distributing premined coins to a certain community affect the currency?

pro's:

dev gets paid
some bounties and coin distribution can occur

con's:

depending on the size of the premine, developer could get an unreasonably large amount of coins for what is essentially a copy and paste job.
negative preconceived opinions about the coin because it is premined.
dev could be a scammer and dump all the coins, rapidly deflating the price(ie, a pump and dump)
those who claim the bounties may run with the money and pull the services at a moments notice once the bounty is paid.
coin may be subject to 51% attacks, difficulty stranding attacks, and other undocumented forking attacks from anti-premine "activists", who may be the vocal minority but often have the majority of hash on any given coin.
the coin will be under constant attack from trolls

I'd say a fair distribution of premined coins has these benefits:

Gives the coin visibility over the 80+ altcoins out there, some with competing target markets (e.g. PesetaCoin vs SpainCoin - latter is premined and will be distributed)
Creates interest in it (mostly from the group that can potentially receive them)
A lot of people end up with at least some of those coins, increasing the possibilities some will use such coins to pay for stuff (kick-starting an economy using this coin) rather than simply cashing them right away
Even for those who do cash the coins right away, it's literally money fallen from the sky, created ex-nihilo. Just like fiat, but directly benefiting them.

With 100% premined coins, this means that at the time the coin start to be used all the coins are already sent to people. This reduce the inflation since all coins are already sent.
One of the problems of premined coins is that it removes the need of mining and mining is an important thing, because its "the process of adding transaction records to Bitcoin's public ledger of past transactions.". Mining is needed to make things secure but without an incentive to mine no one will do it.
One solution to the mining problem is to have an transaction fee, so when you receive some money, an ultra small % of what you received goes back to the system, the problem is that the transation must be ultra small or no one will use the coin. But if the transaction fee is small, then almost no one will want to mine just for those few coins. There is also the problem that the coin is premined, and deflation will occur, at some moment the coin will be worth alot, and the and the transaction fee, if it is X coins instead of Y% of the coins you received, those X coins that were just an small fee, will now be a big amount of money.
Another problem of premined coins is that people usually think the way its distributed to people is not fair, if developers sell the coins before it start some may consider it a scam.
This problem could be solved by having people mine numbers instead of coins, this would happens before the coin is sent to people, after X months or years, they get those numbers people mined, and share the total amount of coins based the amount of numbers people mined.
As some example, if just 2 guys mined numbers, and the first mined 1 number and the other mined 99 numbers. The first one will get 1% of all coins and the other 99% of all coins, at the time the coins are shared to people. If 4 guys only mine, and each one get 50 numbers, they will get 25% of the coins when the coins are shared.


text:
Is there a logging system for bitcoind, and if so then where is the log?
Where and what is the name of log files of bitcoind?
If I make a command like "sendtoaddress", will the command and the arguments (like the amount of bitcoin I sent and which address I sent) all be logged?

The default data location of bitcoind is ~/.Bitcoin on unix and %APPDATA%\Bitcoin on windows. In it, bitcoind will write a debug.log file which is automatically trimmed every once in a while. I'm not sure what is in it, but it should be easy to check. You can also start bitcoind with a commandline parameter to send its debug info to stdout, if you wish.


text:
does bitcoind download bad blocks?
i haven't read the source code for bitcoind, but i want to know if it downloads bad blocks which will later be rejected by the network (and presumably later removed from bitcoind's block files)?
i have a script which parses block files into a database and if a block is in the files at one point in time, then gets removed later then my script (as it currently stands) will end up importing the incorrect block.
if bitcoind does download bad blocks, how should i avoid importing these into my database? should i just wait and never import the latest, say, 5 blocks?

Bitcoin will store a block on disk as soon as it has verified its proof-of-work.
Blocks are stored append-only in the block files, and never deleted or overwritten. You cannot judge from the block files which are considered valid, or which are considered the currently best chain - that information is kept in the block index database.


text:
How to generate a zcash vanity address?
Is the main network address version for zcash already known? Is it possible to generate a mainnet address already?
This could allow miners to start from minute 0 to mine on a anonymous pool. The addresses can exist without the network as they are just a cryptographic keypair.
I checked the chain params at the source repository.
It looks like t-type addresses start with t1, and multisig with t3.
// guarantees the first 2 characters, when base58 encoded, are "t1"
base58Prefixes[PUBKEY_ADDRESS]     = {0x1C,0xB8};
// guarantees the first 2 characters, when base58 encoded, are "t3"
base58Prefixes[SCRIPT_ADDRESS]     = {0x1C,0xBD};

And from the protocol:

In Bitcoin a single byte is used for the version field identifying the address type. In Zcash two bytes are used. For addresses on the production network, this and the encoded length cause the first two characters of the Base58Check encoding to be fixed as “ t3 ” for P2SH addresses, and as “ t1 ” for P2PKH addresses. (This does not imply that a transparent Zcash address can be parsed identically to a Bitcoin address just by removing the “ t ”.)

But how to generate them? Never seen dual prefixes berfore. Also, what's the address version? My vanitygen is unable to cope.

To simply generate a new main network address, you can use the official zcash-cli like that:
$ zcash-cli getnewaddress
t1fMAAnYrpwt1HQ8ZqxeFqVSSi6PQjwTLUm

Or:
$ zcash-cli z_getnewaddress
zcHTYUQRA54WGdcNtLRx1yRyvEJjLD8NAK4S7FbEGoqB1s5En4syEStMnJPRMAD8XmF9xgeKnCEuZ7g35LcNpMhRDZX4PDw

Vanity is a bit tricky, but there is an offline wallet generator available here (forum, gitub).
It can be installed via go:
$ export GOPATH="$GOPATH;/home/user/.go"
$ go get -u github.com/btcsuite/btcutil
$ go get -u github.com/blackkeyboard/mneumonic
$ go get -u github.com/blackkeyboard/zgenerate
$ go install github.com/blackkeyboard/zgenerate

After that it can generate valid (?) zcash addresses.
$ ~/.go/bin/zgenerate
2016/10/28 10:42:09 Wallet generated!
2016/10/28 10:42:09 Passphrase: afraid master w...
2016/10/28 10:42:09 Address                                Private key
2016/10/28 10:42:09 t1eTNgQHp7ei42ZtVRJ8jmUrsfu3rQqpXKt    cQM...

Now, generating vanity needs some bash tricks for now. And a lot of disk space, as long as nobody codes a proper vanity generator.
First, generate a lot of addresses and pipe the output to a file:
$ while true; do ~/.go/bin/zgenerate -n 99 >> keypairs.txt 2>&1; done

And in another shell, look for the results
$ grep -i t1 keypairs.txt | awk '{print $3}' | grep -i 5chd
t1MniMQux3755CHdMdVEtk71GzDkrLjmMbL
t1QMERYYnhCTdpreFwp5chdhqejr7NxRJvK
t1euq6Yg5chDcdEd9LCmwDPizqAU6uBF5Lt
t1PqrCEUW5ChDcaxe9qsQjPiCVt5qd727qH
t1h5ouE263Ccuo5ChDwWRn9HJCMrT3DR7gN
t1Qo5cHDbNBaoaFTKJLrWHBFPoqBZjRRLAS
t1W5cHDhrAnHERt9Tv3r6cgRh9hKybRbn7q
t1dViyc3SQatNZXnoMwcFLB1ELTHNwT5chD
t1e7D5qgdpbxNLoi5ChdTpLFauz8VrQJ2He
t1Va5cHdqLWmnHeAycS9y3qoP3rDAyPJubD
t1UszZECKVPgFpjkYKubyC5chduhSTQscPz
t1LjhytxXj9YLzeBikShm2kj78N5chdkJkm
t1MyW2vggvzHKjPCZDcd5cHdDPsvYMXCp8F
t1UMn4PpwnvPBH6hiunhoXbXRqBoJz5CHDo
t1aohPrSU7bFsC5CHDEPi5Ed7mVxvnNjeuq
t1cMAXhkVSaPcGmzVwN15cHduRKpbLtFJ1H
t1NZRXnKdACxU9xYH9P5chdTcNZfFQ6mT5L
t1QXXyYidirdW4KQz5ChDtYGestzDJ9FyiS
t1cHMeeWtGqnduj5chDFXka8krJMLtDoiJb
t1Pv4zxf5ChDXsCiKkajeJ1qpkQyv1MbSTd
t1KftUZAas3mAyKL5chd97nbDz8S2iF8PQF
t1WQYSvAWPLFHh9gyg6m635CHD3A49C9AvH
t1cuG5ChdTvE864hCKbM9tpToYNU4u8QWA6
t1bTuRMnbJMG1z2tRySoz5cHD1VB6mNFKAX
t1MX7GuYdMcKH9nWgc5chDj99qgd9H1186i
t1VvKMh2LRiTeUY3B5p5oa5CHDWhzK5ZMxB
t1Z34PDzF5CHDfnvJdRFUsQQCWTys2Wv4FE

Stop if you are satisfied.


text:
How do I get to the value in the 'scriptPubKey' part of the transaction ?
How do I get to the value in the 'scriptPubKey' part of the transaction ?

The sender knows only the address (1A3XjcuZmcszX2tGoVn1TrMNchuHwdAxZV) so how did he get into 63339ebf4914d964fbc729b0dc4c1a44c4fb8f80 ?
I've tried ripemd160(sha256(address)) didn't work .
I've tried sha256(sha256(address)) didn't work.

Addresses are kept in Base58Check format. Here's how you decode it.

Decode the base58 encoding (similar to Base64). You should have 25 bytes.
Check that the 1st byte is 0x00 (the version byte of Bitcoin)
Check that the last 4 bytes are a correct checksum of the rest. This is done (in Python) by:
sha256(sha256(data[0:21]))[:4] == data[-4:]

(Or, "take the first 4 bytes of a double-SHA256 of the first 21 bytes of the decoded data, then compare to the last 4 bytes of the decoded data.")
Take the middle 20 bytes (data[1:21]) and insert it into the following scriptPubKey.
OP_DUP OP_HASH160 <x> OP_EQUALVERIFY OP_CHECKSIG

Here are some libraries that will do steps 1-3:

libbasse58 (C)
base58perl (Perl)
python-bitcoinlib (Python)
bitcoinj (Java)
byte[] hash160 = new Address(NetworkParameters.prodNet(),
    <addr>).getHash160();

coinstring.js (node.js)
require('coinstring').decode(<addr>)

Various examples on rosetta code

Worked well accept
"Check that the last four bytes are a correct checksum" , of what ?

@HaddarMacdasi Does the edit make it more clear?

I'm trying with an online tool. can't seem to work it out. The checksum part.

If you are using C# with NBitcoin
var address = new Script("OP_DUP OP_HASH160 ... OP_EQUALVERIFY OP_CHECKSIG").GetDestinationAddress(Network.Main);

It has the nice effect to work with P2SH addresses too.


text:
Does value 'True' at the middle of stack is valid transaction?
If at the middle of the execution of scriptSig + scriptPubKey we get the value 'True', while there are remaining values or operators in the stack, is the transaction valid? Or should the stack be empty + top result is 'True' ?
I believe it is not because someone can just send unlocking script with the 'OP_TRUE' and cause any UTXO to be unlocked.

Contrary to the book Mastering Bitcoin, there is no boolean value of "True" in Bitcoin Script. An executed transaction script is valid when the top item remaining in the stack at the conclusion of execution is non-zero. To combat transaction malleability BIP62 (transaction version 3) also introduces the additional validity requirement that the stack must contain no additional data elements, only the single non-zero value.

I suspect you may have a misconception over how the script is executed, and what the stack contains during execution.
First, remember that the full script is created by adding the two partial scripts together in this order: scriptSig + scriptPubKey.
Each element of the full script is either a value which is pushed onto the stack, or an operation which examines and/or manipulates the stack.
A valid script is executed left to right until either the end is reached, or an operation indicates a failure. If the script completes without any operation indicating an early failure, then the top of the stack (alone) indicates the failure/success. As user Bitcoin has already said, any non-zero value is considered a success, and any items beneath the stack's top are (currently) ignored.
If someone tried to create a tx whose scriptSig was simply OP_TRUE, the entire script would typically look like:
OP_TRUE OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG

The first script step pushes 1 onto the stack, next it's duplicated, and then the duplicate on top is hashed. After executing these first three script instructions, you'd have:
Stack:
HASH160(1)  <-- stack top
1

Remaining (unexecuted) script: <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG

Next <PubkeyHash> is pushed onto the stack, and then the two top elements (<PubkeyHash> and HASH160(1)) are compared, which causes the script to fail.
In short, because scriptPubKey is added after scriptSig, scriptSig has no way to "override" what scriptPubKey tells the script interpreter to eventually execute. (There's no such instruction as "exit immediately with success" that scriptSig could include.)
Finally, user Bitcoin also mentioned that BIP62 changes the "in the end, ignore everything but the top of the stack" rule. This will probably be true one day (and would make no difference in this example anyways), however as of today the rules in BIP62 haven't yet been implemented (except for the one also mentioned in BIP66).


text:
Sending bitcoins to myself
If I send bitcoins from my wallet to an address I created in my wallet, will I get more than 1 confirmation eventually?  And do I have to wait for all the block to be downloaded to my wallet so I can get coins sent to me?

Yes and yes. Nobody other than you knows that you are sending to yourself since they can't see any connection between two bitcoin addresses. So it will be just like any other transaction. If you want fast confirmation you should include a fee.
And if you are using bitcoin-qt then it's always downloading blocks automatically. The latest transactions are contained in the latest blocks so it will have to download them before it realises that you have the coins. You don't have to worry about this since it is all automatic.
Edit: To clarify the second question you can always receive coins no matter what. But to see the latest receipts in your bitcoin-qt window and to spend those coins you have to be in sync with the network.

will I get more than 1 confirmation in time?

What do you mean with "in time"? No one knows this is a transaction to yourself, it will be confirmed at the same speed than other transactions. Since you sent the transaction yourself, there is no risk of fraud, so waiting for confirmations for security has no effect.

do I have to wait for all the block to be downloaded to my wallet so I
  can get coins sent to me?

I don't really see this question to be related to the previous one. You never need to be synced (all blocks downloaded) to receive coins. However, when you are not synced, you cannot see new transactions being added to your balance.
So, you can give your address to other people for them to send coins to, but you can only see their payments appear when you are synced up. (Or you can enter the address in an online block chain browser like blockexplorer.com or blockchain.info.)

Ok, wallet should be synced to see the payment received in it. and If I send coins to address in my wallet it goes the same why as for any other address (with confirmation), 10x.


text:
How does blockchain.info api works?
Calling
https://blockchain.info/multiaddr?cors=true&active=15PFsB56YYXwXSW6byaxHXfgGz2ySWnDzN

I get a json response which I can not figure out if it has some sort of error or that I'm mistaken.
The response show results in transaction 1206412 = 0.01206412BTC added to balance 0BTC should get 1206412 = 0.01206412BTC, however we get balance = 1201206412 = 12.01206412BTC, I think it's error in blockchain.info api or could you explain how the balance is calculated.

The issue was with how the transactions are sorted. The balance was being calculated with 9c8f1b918e6a6a2 being sorted before 46d529d722d1 (which is incorrect) despite them being ordered correctly in the json. Regardless it should be fixed now.

I can see it's now working, and take a look at
http://bitref.com/15PFsB56YYXwXSW6byaxHXfgGz2ySWnDzN
They use this API, now it is sorted as well at their table