text:
BitCoinJ for Cloud based application
I am currently working on a cloud based project that will be accepting payments using bitcoins.
I intend to use BitCoinJ to handle the payment. Unfortunately the only help I am able to get is from the JavaWorld demo, which seems to be out of sync with the current code. Could you please point me to some better/updated helping links/material.

There are some examples in the bitcoinj library itself which are always up to date (as they are part of the build).
The command line tool 'WalletTool' that Mike wrote is pretty useful for the basics of wallet creation, sending, receiving etc.

WalletAppKit kit=new WalletAppKit(MainNetParams.get(), new File("."), "mywalletfilename");
kit.setAutoSave(true);
kit.startAsync();
kit.awaitRunning();
kit.wallet().addEventListener(new WalletListener());

while listener looks like:
public class WalletListener  extends AbstractWalletEventListener {
public WalletListener() {
}

@Override
public void onCoinsReceived(org.bitcoinj.core.Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
    System.out.println("-----> coins resceived: " + tx.getHashAsString()+" prevBalance = "+prevBalance.getValue()+" newBal="+newBalance.getValue());
    System.out.println("received: " + tx.getValue(wallet));
}

@Override
public void onTransactionConfidenceChanged(org.bitcoinj.core.Wallet wallet, Transaction tx) {
    System.out.println("-----> confidence changed: " + tx.getHashAsString());
    TransactionConfidence confidence = tx.getConfidence();
    System.out.println("new block depth: " + confidence.getDepthInBlocks());
}

@Override
public void onCoinsSent(org.bitcoinj.core.Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
    System.out.println("coins sent");
}

@Override
public void onReorganize(org.bitcoinj.core.Wallet wallet) {
}

@Override
public void onWalletChanged(org.bitcoinj.core.Wallet wallet) {
}

@Override
public void onKeysAdded(List<ECKey> keys) {
    System.out.println("new key added");
}

    /*@Override
    public void onScriptsAdded(Wallet wallet, List<Script> scripts) {
        System.out.println("new script added");
    }*/

}
Should be working enough for receiving BTC ;) dont forget TXConfidence changed where it tells you that TX confirmations count changed and to what it changed...
;-)


text:
bitcoind json-rpc requests per second
I'm starting up a new bitcoin based commerce site and am wondering how many transactions per second the bitcoin JSON-RPC API can accept? A user can have an account balance in bitcoin and I was initially thinking of storing all transactions in a database and then querying that to determine their account balance, but after reading up on blockchain reorgs and whatnot decided against it.
So is it feasible to just use the bitcoin API directly, or should I implement some sort of caching/load balancing?

If you're building a web-based wallet, you should look at the software that blockchain.info has open-sourced. https://github.com/blockchain

Thanks I'll take a look! Any reason why I shouldn't just use the standard client that you can think of?

Is there something in particular that you are after which you could not work out yourself by running some benchmarking?  Things like this are usually very hardware-dependent so any answer provided here is likely to be inaccurate for your own needs.

Benchmark it and see, although be aware that bitcoind has never been optimized for handling thousands of accounts with hundreds of thousands of transactions. In particular, calls like 'getbalance' get slower the more transactions that are in the wallet.
Happily, there are now other implementations that claim to be better at handling lots of accounts/wallets/transactions.

Would you be able to point me in the direction of any of those implementations? Thanks!

source: Stack Exchange

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

sort: votes


text:
Lost my BTC or they've been stolen
I have a blockchain.info wallet. Last night I decided to set up a wallet for my daughter so I signed out of my account. Created one for her and then had difficulty signing in to mine, I had about 8 attempts then gave up. I then noticed in my email I had an email from blockchain telling me of each of the failed attempts which was me. I then managed to get into my wallet and 99% of my BTC had gone. Is this a security feature or has someone stolen them? Thanks. I have checked the new wallet in case they were there but sadly they are not.

By blockchain, are you referring to blockchain.info? How secure of a password did you set on the first account?

Have a look at the transaction history for the relevant addresses - when were the coins transferred away?

Blockchain.info's My Wallet stores your Bitcoin wallet in encrypted form. This means that anyone that knows your wallet identifier can retrieve the encrypted form of your wallet. One can of course only use/open the wallet with the encryption password.
This does however mean that anyone that retrieved your wallet identifier can try to guess your password as many times as they want. Once they got the encrypted version of your wallet, they can use smart brute force techniques to crack your password.
So, you could have been hacked if both

Someone got hands on your wallet identifier. Maybe you mailed it or mentioned it somewhere. Maybe you got malware or a spoofing browser extension.
You have a weak password so that regular password crackers were able to find your password fairly easily. Try to avoid passwords consisting of only existing words or only lower case characters f.e.

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


text:
Shares mostly rejected mining with an FPGA
I am using an FPGA to mine bitcoins in a pool, as you can see below I am not really very successful:
[1 accepted, 48 failed, 148.90 +/- 21.27 Mhash/s]
It is running at 150 MhZ but I only have 1 accepted share out of 49.
I guess this quota does not look to healhty. Anyone an idea what could
be wrong?

Is this a p2pool? Or perhaps a mining pool with a non-standard share difficulty?

Which miner software and version? And is the pool using variable difficulty ("var diff") ?

I am using this pool here: host = "api2.bitcoin.cz"

I am not sure what it means to use var diff, where can I find this out?

Give me the make of the FPGA and the name of FPGA binary you are using.
It could well be that you are over-clocking the FPGA too far, due to the way that many of these cores are designed, there is a race condition, where the  "success" flag, gets out of sync with the "nonce".
Basically the FPGA flags the "hit", but by the time it gets to copying the "nonce", it has changed......
and so fails.


text:
Get the number of confirmations for an external address
I'm building an application that tracks transactions between two points for multiple currencies, currently:
BTC, BQC, BTB, FTC, LTC, NMC, NVC, PPC, TRC, WDC & YAC.
I need a way to check the number of confirmations for the latest transaction to a list of external addresses.  For BTC i discovered that i could do this (in a somewhat round about way) like so:
At start get the balance: http://blockexplorer.com/q/getreceivedbyaddress/ADDRESS/0
Then later i can check that again, specifying 1 confirmations.
/q/getreceivedbyaddress/ADDRESS/1
and see if the balance has increased from the start point, if it has, i know a transaction that is 1 confirmation in has occured. then i can check:
/q/getreceivedbyaddress/ADDRESS/2 and so on and so forth.
This works fine.  But for all the other coins there is no blockexplorer.com, but there is what is most commonly used, bitcoin ABE.
In bitcoin abe you can do a similar call, for example:
http://bbq.cryptocoinexplorer.com/chain/BBQCoin/q/getreceivedbyaddress/ADDRESS
but from what i can tell bitcoin abe does not support the /N parameter at the end to specify the number of confirmations.
So now i am stuck.  I looked into running local instances of all the different coin deamons like bitcoind. But, although bitcoind has getreceivedbyaddress, bitcoind does not support this for external addresses.  Since i do not know the private keys of these addresses i cannot add them locally, and so bitcoind does not work for my purposes.
Since all the other altcoin clients are based on bitcoind, they all share the same problem as well.
Any help is greatly appreciated!

Looks like the functionality i am looking for is getting added to bitcoind.  Hopefully most of the devs responsible for their clones of bitcoin will update accordingly and eventually this functionality will be available for all cryptos.
https://github.com/bitcoin/bitcoin/pull/2121
EDIT: Also see this pull: https://github.com/bitcoin/bitcoin/pull/2861
Hopefully it gets merged into master soon.


text:
Would my ISP consider my Bitcoin client to be a server?
I was reading about Google's Fiber installations, with first deployment in Kansas City.  There's a controversy where the terms of service restricts what services can run on their Fiber network.
Some relevant items:

http://www.dslreports.com/shownews/Kansas-City-Google-Fiber-Rallies-Take-Off-Running-120594

"Can I run a server from my home?
Google Fiber is intended as a residential Internet service. Our Terms of Service prohibit running a server."

http://fiber.google.com/legal/network.html

Would running the bitcoin node on Google Fiber be considered to be a server, and thus prohibited?

Google refers to server as a business grade hosting with a very different usage profile then personal use. This is not intended to catch someone using home server, but if a small business tries to power their rack of servers, then there is grounds for termination.

The Fiber Services are intended for the personal use of you and others with whom you share your residence (including, within reason, guests who are visiting you). You agree not to resell or repackage the Services for use by people other than those with whom you share your residence. If you wish to use the Google Fiber Services to provide Internet service to others, you must enter a separate agreement with Google Fiber that specifically authorizes you to do so.

Google Fiber Terms of Service

Here are some common-sense rules that you should keep in mind when using services provided by Google Fiber:

Your Google Fiber account is for your use and the reasonable use of your guests. Unless you have a written agreement with Google Fiber permitting you do so, you should not host any type of server using your Google Fiber connection, use your Google Fiber account to provide a large number of people with Internet access, or use your Google Fiber account to provide commercial services to third parties (including, but not limited to, selling Internet access to third parties).

Learn about Google Fiber terms of service

The Bitcoin client is not a server by the usual definition of a server. By definition, a server exists to provide a service to its clients. If the client is a server, what would be the client?
For example, Wikipedia says (emphasis added):

In pure peer-to-peer systems the entire network consists solely of equipotent peers.

This describes the Bitcoin network.

i find it stupid that one limits what one can do with the internet. There is no need to pay an extra few thousand a month just to get rid of the terms of service which prohibit the use.
Comcast prohibits use of servers, but many still host servers on their network.
So this means i cant put up a multiplayer game to play with friends? Most games have the ability for one to host a game by using their own computer as the host, in order to play mods or to not be interrupted by other random people joining the game.
Whether or not google says they prohibit it, many still will attempt and be successful to host a long term server on their network as google spreads their availability throughout the usa.
Unless they portscan every customer and check for open ports on the customers network every day and night, they will not find anyone who may be hosting a server. And port scanning can take a long time depending on the number of ports that they check.
i couldnt just be limited to viewing videos, and loading web pages. You wont be taking advantage of the gigabit speeds you are provided. And for one thing, providing a server does not have to be commercial, have any income (make money) or be widely popular. As a server can be limited to just small things, such as playing a quick game with friends or sharing a bit of information over FTP rather than having to upload the data, then have them download it making the file transfer a bit longer.


text:
Finding the address of a physical coin
I have a physical bitcoin which has a 8 digit number. Is it possible to get the address of the coin without paperwork, as none accompanied the coin when a family member gave it to me.
I also have a Blockchain.info wallet and it says "Scan Pairing Code". When I do that, it shows little blue dots and takes a photo.
Can you tell me if I need the letter or address that comes in paper form?

What markings are on the coin? There are different types of physical bitcoins, more info is needed to help.

It would help to identify the coin (and therefore how to use it) if you edit your question to include sharp photos of both sides of the coin  with a ruler next to it for scale. Black out any numbers in a photo editor before uploading.

The first step is to identify the specific type of coin and what company created it.
See Coindesk - 10 physical bitcoins - If your coin looks like any of those, you can find out whether it has any value and how to use it.

There are many variations:

Many physical bitcoins are novelty items and have no value.
A few may have some intrinsic value from the materials they are made of (gold, silver etc). I imagine most do not.
Some physical coins have an associated bitcoin value which can be redeemed if the company that issued the coins is still in business and honest. For example, Titan bitcoin say:

If you ever want to spend or transfer a 2FA coin’s bitcoin value, simply peel back the coin’s security hologram and enter the redemption code on our website, along with your registration info.

Some physical bitcoins have a private key concealed inside them or under a tamper-evident sticker. You can probably type that into a bitcoin wallet to import the key. An example is the discontinued
series-1 Casascius Coin

How they work: The "private key" is on a card embedded inside the coin and is protected by a tamper-evident hologram.  The hologram leaves behind a honeycomb pattern if it is peeled. If the hologram is intact, the bitcoin is good. If you have purchased a 2-factor item, the private key is encrypted and will need to be decrypted using your original preselected passphrase before you can redeem the funds.
The 8-character code you see on the outside of the coin is the first eight characters of the Bitcoin address assigned specifically to that coin.  You can verify the coin's balance on Block Explorer.  There is a mathematical relationship between the Bitcoin address and the private key inside the coin. The digital bitcoin is actually located on the public "block chain" stored on the internet, but it is completely inaccessible to anyone unless the private key from the coin is loaded into a Bitcoin wallet.

My emphasis - I'd guess this may be the coin you have.
Note that the issuer may have records of those private keys. If the issuer went out of business or the records fell into the hands of others, it is possible that someone else will have subsequently removed any bitcoin value associated with the private key.

Useful references

Bitcoin Magazine - Physical bitcoins

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


text:
How to open channel with output of closing channel? [Lightning Network]
How can I automatically open a new channel while closing another, avoiding to create an unnecessary intermediate transaction?
Do any wallets support it at the moment, or would I have to do it with a CLI?

For the record C-lightning could support it (fundchannel_start the new channel, [gather the closing transaction id], fundchannel_complete, close with the destination parameter) but you would have to get the transaction id manually (which isn't very practical...)

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


text:
what is referred as coin in bitcoin network?
I gathered information about bitcoin from various resources. All those resources said that when a transaction is done, the transaction get added to a block. So when Alice send 2 btc to Bob, network checks all transactions having Alice's wallet address to calculat balance Alice has. If he has 2 btc then transaction is happen.
So in this process, system just checks for total balance Alice has. There is no file or a record for each bitcoin. There's only blocks containing transaction data.
But I found about bitcoin mixers. Those mixers claims that they mix coins. That is, when you give them some coins, they will give you same btc amount back but you receive different coins than the ones you deposited. Also I found many websites using the term coin ("coins transfered", "coins recieved" etc.) But I could find what exactly the "coin" means. There are 'blocks' and 'transactions' but 'coins'?
So the question is, what a coin is? Is it something like block or transaction? Is it a seperate file, so that bitcoin mixers can mix them up?
What is referred as 'coin'?

TL;DR: When bitcoiners refer to a 'coin' they really mean a UTXO, unspent transaction output of any amount from 1/10,000,000th of a BTC to 21million BTC.
When someone sends bitcoin to another person, it gets added to the blockchain as you said. When signed by the sender's (Alice) key and verified by the miners, that transaction becomes a new UTXO.
When Bob goes to spend the 2 BTC that Alice sent him, his wallet will create a new transaction that says, in effect "take the UTXO from X address (that Alice sent him) and transfer it to the following Y address ..." That then creates a new UTXO.
In this example there is simply two bitcoin in each transaction. But what if Bob only spends 1 of the 2 Alice sent him? His transaction will then say "take the UTXO from Y address, send 1 BTC to 'Z' address (his recipient) and return 1 BTC to my wallet at the following 'change address, A The change address, A, is in Bob's wallet, so it can again be spent by him at a later date. In this example, the single UTXO (aka coin) that Alice sent Bob has become two of half the size each. Thus the absolute number of 21 million bitcoin is preserved.

What is referred as 'coin'?

A lot of Bitcoin terms don't really make a lot of sense if you look at them closely. There really aren't anything truly like coins.
As Mike answered, the nearest thing to a coin is a transaction output, specifically an unspent transaction output (UTXO). But if this is a coin, it is a type of coin that only gets used once and then is circulated no further but melted down and cast into new coins. It is a type of coin where almost all coins have a different face value. This is a very weird kind of coin.
As I understand it, a coin mixer works by taking as inputs a large number of unrelated UTXOs from a variety of unrelated people and, to follow the coin analogy, melting down those coins and re-casting the total amount of metal into a variety of new coins that are paid to a large number of new addresses. An outsider can't tell which input coins relate to which output coins because the transaction data doesn't keep track of that information.
So coins don't exist in anything like the form of a normal coin that passes unaltered through hundreds of transactions, which is fungible (indistinguishable from other coins), which is contained in only one wallet or pocket or purse at a time.
If a UTXO is a coin, then every coin exists in everyone's wallet at the same time. Every full node contains every UTXO.
The fungibility of Bitcoin does not come from the fungibility of the coins - every UTXO is distinguishable from every other UTXO. It comes from the melting and recasting process.
In a similar way:

Bitcoin wallets are not like wallets - they don't really "contain" money.
Bitcoin's "ledger" (the blockchain) is not like an accounting ledger - it is more like an accounting journal.
Bitcoin balances are not calculated by the network, not by miners, not by other people's wallets  - they doesn't need to.
Bitcoin addresses don't identify locations or people. Things are not really sent to addresses.
Bitcoin keys don't really open locks.

All the things I listed are really just analogies. Like most analogies, if you look at them too hard they don't make sense. So don't look too hard, be happy.
Why do people write about coins? Because it is a convenient shorthand, more familiar seeming than UTXOs - We use the word coins even though coins don't really exist in any especially coin-like way.


text:
Why didn't Satoshi make the nonce space larger?
I know Satoshi isn't around to ask anymore, so this might be futile to ask, but I'm hoping someone might have some insight about this.
Bitcoin mining typically utilizes an extraNonce (bnExtraNonce in the coinbase tx's scriptSig) and a nonce field (32 bits). Why didn't Satoshi just make the nonce field larger, and then there wouldn't even be a need for the bnExtraNonce? Is there some reason why the nonce field needed to be kept to 32 bits? Seems like it would have been simpler to have a 64 bit integer in the block header. Even if he was worried about having an integer that was more than 32 bits, the header could have just been interpreted as two 32 bit integers nonce1 and nonce2.

There were many good answers to this question. After reading through them, I'm going to take a stab at the answer as well.
The coinbase field of the coinbase transaction (as it is called) is really just a scriptSig which doesn't have to pass any validation about its contents (except that it is less than 100 bytes, and the newer BIP34 requirements). Satoshi knew you could put arbitrary contents in here, and so he put a timely news headline in the genesis block's scriptSig: "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks". A message like this also helps confirm that no pre-mining was done, as the message could not have been put into the block before the date that the article was published.
I think that Satoshi thought that a 32 bit nonce-space was overkill. A standard computer, like the one I am writing this on, can get about 3 MH/s, which is about 0.07% of the way through a single nonce-range before you can increment nTime and get a whole new range of nonces. That's not to say that Satoshi thought that there would only ever be single computer CPUs mining (this post shows he didn't), but I bet he thought that each miner would have it's own address in this case.
I don't think Satoshi envisioned pools happening, especially in the fairly centralized way that they exist today, and the flexibility of the coinbase field was just utilized by mining pools (as somewhat of a hack) when hash power became large enough to go through more than a single nonce-range per second.

It's much more trivial for a mining pool to simply assign extra addresses that the central pool operator "deals out" to the pool rigs, than to assign an extra nonce to all mining servers to allow pooling to one central address.  Bitcoin's key pair system is such that collisions are practically impossible anyway, so using MANY addresses is not a problem whatsoever-- in fact it's how bitcoin best practices its privacy (no key reuse).

From the protocol rules, there is no such thing as an extra nonce.
There is only a 32-bit nonce in the block header (which can be iterated over very quickly), and up to 100 arbitrary bytes in the coinbase input. The block generation code inside the reference client has traditionally put an 'extra nonce' in those arbitrary bytes, but the contents can be anything.

So why do you think he put the coinbase field there initially? Tyler suggested that it might be there to allow for arbitrary changes to a block even in a situation where there are no changes in terms of transactions. Not sure why changing the merkle root would be better than just changing a second nonce field, though. David suggested that it was probably used for debugging. Seems like that is something that could have just been printed to a debug file, though.

Maybe he didn't even mean to put anything there, it's just a transaction with a scriptSig that you don't have to validate, so you can put anything in there that you want and it won't cause errors...

But he put the message in the genesis block's coinbase transaction, so he obviously knew it could be changed. I think miners are just lucky that there was something that could be changed so easily, as Satoshi didn't give enough nonce space.

The 32-bit nonce in a block header is good for 4 Ghash. The timestamp in the header makes that 4 Ghash/s. A 32-bit extranonce (which means recomputing the merkle tree however) is sufficient for 16 exahash/s. What are you talking about it not being enough?

I meant that nNonce alone is not enough for current uses, so pools resort to altering the coinbase.

My guess: It seems clear that Satoshi didn't expect pooled mining.
In a world without pooled mining, you'd simply have each piece of mining hardware capable of up to 4 gigahashes per second (GH/s) use its own public key, guaranteeing that it produced a unique coinbase transaction output.  The time field can be updated every second, so the nonce can be reset to 0 whenever time is updated.
In a world with pooled mining, multiple people are all creating identical coinbase transaction outputs (paying whoever the pool operator says to pay) and they're collectively hashing at much faster than 4 GH/s, exhausting the nonce range before the time is supposed to be updated.  This makes the extra nonce required to avoid having multiple miners check the same header hashes.
So why did Satoshi create the extra nonce in the first place?  It looks like it was an easy way to see how many hashes the miner has used since being started.  If you look at the coinbase from block 1 (the first block after the genesis block), you see it is:
 04 ......... Push 4 bytes to stack
 ffff011d ... The same as the nBits field
 01 ......... Push 1 byte to the stack
 04 ......... Number of times nonce was reset so far: 4  <= 20 GH

By block 10 it's 0x36 (54 <= 220 GH).  In short, the original extra nonce may just be an extra debugging tool.  You can use nBits and the extra nonce to calculate how many blocks on average the miner should've produced, and if that's very different from how many blocks it did produce, you might have a problem.

Thanks, this is helpful! So you think that he thought the 32 bit nonce space would be enough, and then the coinbase field in the coinbase transaction was added later as a way to both avoid changing the block header and give miners a larger nonce space? Or, if it was there from the beginning for debugging, that doesn't explain he needed to even put it in the block chain. It seems like you could just write to a debug file every time the nonce overflowed and it would be easier.

Maybe he wanted how many hashes the miner had to do publicly available in the blockchain. Also, does that mean we just got lucky that Satoshi even did put in the coinbase field in the coinbase transaction, and so pooled mining is possible? (Still would have been possible with two nonces in the header)

The coinbase field was always there.  Changes to the coinbase field do change the header (the merkle root).  I don't think the original extra nonce implementation was used to give miners a larger nonce space---I think it was used for debugging.  Miners started to use it for other things when they began to pool, and the current extra nonce usage began when ASIC hardware became available that could hash much faster than 4 GH/s.  (Before that, miners used hacks like nRollTime.)

If the coinbase field wasn't there, miners could just add a zero-value output script starting with OP_RETURN to create an extra nonce field.

I thought of that too, but it wouldn't have been a standard transaction type (or maybe there was no such thing as standard transaction types back then?). What do you mean by 'debugging'? What did he debug? I'm just not seeing why any  of this has to be in the coinbase field and change the merkle root, rather than just having a larger nonce space in the header.

It would be more convenient to current mining if header nonce was larger.  Your question was why Satoshi didn't anticipate that since he seems to have anticipated the need for an extra nonce field to update the merkle root.  My guess is that the purpose of the original extra nonce field was not to update the merkle root (though it did do that) but to track statistics about how many hashes were checked.  Miners who need to use extra nonce as an auxiliary header nonce are not mining the way Satoshi intended with a unique public key per piece of mining equipment.

The extra nonce has always been there. Even the genesis block itself has an extranonce (with value 4). And OP_RETURN not being standard is irrelevant for miners, as they are the ones deciding what to put in a block.

Actually the extra nonce is an arbitrary precision integer (http://satoshi.nakamotoinstitute.org/posts/bitcointalk/115/)
I conjecture that it's there to allow for arbitrary changes to a block even in a situation where there are no changes in terms of transactions. This would make it even less likely that there could be an unsolvable empty block in a transaction-less period. (Already almost impossible. But hashes are inherently unpredictable so Satoshi may have just been extra paranoid in adding it.)

In fact we do not need 32-bit nonce in block header at all. Everything can be put into coinbase input script. So, the question should be: can we deal with 76-bytes block header instead of 80-bytes?

If there were no nonce field in the block header, you would need log(N) SHA256d hashes for each hash you do, where N is the number of transactions. Thus, people who don't include transactions would have a clear advantage.

Ahh, because the nonce field makes it so that you don't have to recalculate the merkle root each time. I still don't see why satoshi would want you to have to mess with the merkle root so much when we could just have a larger nonce-space.

Thanks, Nick ODell for clearing. May be Satoshi thinked that 32-bit nonce is enough. 80-byte for header - is a round number. Recalculating merkle hash after 4 bln attempts is not a big problem

Wouldn't it actually be 2N hashes for every one block header hash? The height of the merkle tree would be log(N), but the number of hashes need to calculate the merkle root is about 2N, I think.

@StephenM347 Yes, but you're only changing the coinbase, so you only have to recalculate some of the merkle tree.

Ahh, makes sense. So that explains why the nonce range isn't all in the coinbase, but not why it wasn't all put in the block header... What benefit comes from having anything in the coinbase? It just seems like a work around.

@StephenM347: Shorter block headers, which result in 5% reduction in SPV client resource consumption among other things.

@MeniRosenfeld, that's interesting, but hardly seems worth it, or planned. See my answer above for how I, at least, rationalize the limited nonce space.


text:
How do people in developing countries buy Bitcoin?
When there are only bank accounts of small bank institutes in undeveloped countries, how do people there buy Bitcoins? When there are only limited possibilities for global money exchange, how can people there participate in Bitcoin?


text:
Broadcast a signed transaction
I sent money from 4 inputs to 2 outputs, one of which I don't control. The transaction's fee is too small (didn't change my settings and the transaction fees got a lot higher, recently) and will not confirm anytime soon.
I then created a new transaction spending 2 of the 4 inputs of the original transaction to 1 output. This transaction is obviously doubple-spending.
After trying to breadcast the second transaction via Electrum and with several online services, still not a single one broadcasted it. They all know it's a double-spend and won't broadcast double-spends.
Subsequently, I installed bitcoin-qt, hoping to be able to send the transaction directly to my peers.
I never used the bitcoin-qt console before, so I hope this is correct:
sendrawtransaction 010000000189

I cut the string off after 12 characters. The entire signed transaction is 382 hexadecimal digits long. Do I need to use quotes, some kind of brackets, a semicolon, something else?
The error message it returned is this:

Missing inputs (code -25)

I don't know what this error message means exactly but in case it means that the inputs were not found in the UTXO set generated from the part of the blockchain that was already downloaded:
bitcoin-qt doesn't know my inputs as they are only between a few months and a few weeks old but it shouldn't have to to send a signed transaction.
It doesn't know my private keys either, but again, it shouldn't have to.
Can I force it to do so even if it can't check whether the inputs exist? The reason is that I'm on a super slow internet connection and downloading the blockchain would take several days, even if nothing else went over the connection during that time.

I think the best you can do is, unfortunately, wait. Your transaction with low fees will not likely be included into a block, but it is in the mempool of the Bitcoin nodes, since, according to what you said, several online services do not forward your doble-spending transaction, that is, there is a conflict with the new one you want to create a then old one they already have. Eventually the old transaction will be deleted from them mempool, and you will be able to spend then output again.

@sr_gi Unfortunately, I think I will still have to send a conflicting transaction via a client as online services seem to have really big mempools and keep transactions for a long time. I don't know how big the mempools of Electrum's servers are. Do you know of any different wallet which will let me broadcast raw transactions? (Possibly in the future.)

Not really, I've normally used bitcoind or online API like blockr's or blockexplorer's. However, even though Electrum may keep transactions in their nodes' mempool for a longer time than others (I do not know about this), this do not mean that you could not use other services to broadcast the "double-spend transaction". As long as other nodes start relaying the new transaction (once they purge the old one from their mempool), it will end in the blockchain.

I came across a new solution that may be useful. Check it out!

It doesn't seems to be a better solution than waiting. The original transaction (the 4 inputs 2 outputs one) has been relayed by the Electrum node that received it and spread over the network, therefore, it's in the mempool of the network nodes. Every transaction that tries to spend the same UTXO referred by the first transaction will be marked as double-spending until the first transaction is pruned from the mempool. Hence, waiting is unfortunately the only solution that comes to my mind.
Edit: Answering another question I came across a thing that could also be useful for you. You can use a CPFP approach. To do so, try to spend from the transaction that is pending to be confirmed with a new one with high fee. This new transaction will be like a candy for miners, and in order to include it in a block, they must include the previous also.
Edit2: Regarding the error message provided, there is a problem in how the transaction that the author wants to send (T1 from now on) has been build. The scriptSig of the transaction is not properly set.
The serialised T1 is:
01000000018964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612010000001976a9140043be27e16b93c275413e9b4411f08f2cd8bef088acffffffff0120082f08000000001976a9140b01599fd09ef602d71827601871e5a1081459f688ac00000000
Is we decode T1 we will get something like:
version: 01000000
number of inputs: 01 (1)
input 0
     previous txid (little endian): 8964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612 (12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489)
     previous tx output (little endian): 01000000 (1)
     input script (scriptSig) length: 19 (25)
     input script (scriptSig): 76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac
     nSequence: ffffffff
number of outputs: 01 (1)
output 0
     Satoshis to be spent (little endian): 20082f0800000000 (137300000)
     output script (scriptPubKey) length: 19 (25)
     output script (scriptPubKey): 76a9140b01599fd09ef602d71827601871e5a1081459f688ac
nLockTime: 00000000

At this point, we can notice that the scriptSig is incorrect. Analysing it carefully, we can notice that it has the structure of a P2PKH scriptPubKey instead of the corresponding signature that should complement the scriptPubKey of the previous transaction (T0 from now on):
76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac =
OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

If we want to be definitely sure about this, we can check the scriptPubKey of the UTXO from T0 we are trying to spend, and analyse both scripts.
The UTXO from T0 we are interested in can be identified by (id:index):
12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489:1

If we look for the specific scriptPubKey that contains that UTXO, we will find:
OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

That curiously matches with the scriptSig that we have found in T1.
Conclusion
T1 scriptSig (input 0) and T0 scriptPubKey (output 1) shared the sames script. T1 scriptSig must provide the signature required in T0 scriptPubKey in order to pass the validation:
scriptSig:  [signature]
sciptPubKey: OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

That approach, unfortunately, won't work. I thought about doing CPFP, too, but the one output I control is too small to make a difference.

Can't you use it together with another UTXO you own, not necessarily associate with the same address, to build a transaction in which include a fee that does the trick?

Ah, thanks! I have no idea why I didn't think of this. Do you know what bitcion-qt's message means, though? Knowing this could be useful for the future when I want to send raw transactions.

Not exactly, but it seems to be, indeed, that an input is missing.
https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/qa/rpc-tests/rawtransactions.py#L67
However, the error code corresponds to a generic error when submitting a block/transaction.
https://github.com/bitcoin/bitcoin/blob/62f2d769e45043c1f262ed45babb70fe237ad2bb/src/rpc/protocol.h#L49

But in that case, the input actually doesn't exist. In my case, the inputs do exist. They only aren't downloaded. At this point, the coins' existence is checked. view.AccessCoins should point to (I haven't checked in an IDE, just read through it on GitHub) this method where

FetchCoins is called which in turn calls GetCoins. I don't see how that method gets the coins, though. But if it does, it looks like you can send raw transactions even if you yourself haven't downloaded the blockchain to the point where the coins are introduced.

It is strange though, do yo mind providing the full serialized tx? That way I would try to check it field by field.

It's this: http://pastebin.com/Qef0YU2k

Alright, now I see. The input script of the transaction (scriptSig) is not correct. How have you built the transaction? I leave you why its wrong editing the answer, have no space here.

How did you build the transaction by the way, I'm quite curious about how that scriptSig ended up being there.

I used https://coinb.in to create the transaction. I entered the address the money is stuck in to identify the UTXO. It then looked for it and found it.

Ok, I see. Once you created the transaction, did you signed it using the signing function from the coinb.in web, if not, that could be the reason why the sigScript was containing incorrect data. Anyway, looks like the transaction finally got confirmed. Maybe we should close this.

Short answer; you will have to wait. It will end up resolving, but may take a day or more. There's a longer answer I could provide; but it won't change the fact that waiting is all you can do.

The transaction's fee is 0.15 mBTC (around 17 ¢, right now), whereas transactions which go through currently have at least 3 times that as a fee. It won't confirm for quite some time and possibly will have been removed from many mempools way before it goes through. Is there a way to make bitcoin-qt send the raw transaction I prepared? It could propagate after enough nodes removed the first transaction from their mempools. Is there an alternative Bitcoin software which can do this? (Send it directly via my IP, not via an external service.)

You can do nothing but wait. If the transaction has already been seen by (N) nodes, those nodes will need to eventually timeout and drop the transaction, which is when it will be returned to you. Rebroadcasting it, or having more nodes "see" it will not increase it's chance of a block accepting it; because the node which finds a block already knows about it; it's out there; been broadcast (and based off of the fee the block finding node will include or not include it based off their own settings of fees they accept). That said; your transaction is in the mempool. All you can do is wait.


text:
Easiest way to buy Bitcoin from Montreal/Canada
Apart bank wire is there a fastest/cheapest way to buy Bitcoin? I checked the map with the live seller but there is none in Montreal.
Thank's.

Marginally more specific than How can I get bitcoins in Canada?

possible duplicate of How do you obtain bitcoins?

I'm the original poster of this thread. It looks like the option are plentiful since then. Here is my updated list:

http://cavirtex.com
https://harbor.ly/
https://www.canadianbitcoins.com
http://cadbitcoin.com
https://www.bitcoinscanada.ca
http://www.nanaimogold.com
https://quickbt.com
https://btcquick.com
Peer-to-peer: https://localbitcoins.com

Last update: 6 January 2015

If you feel that your answer is now the best, you may accept it in order to help others that find this question.

Deposit cash at a bank is a deposit method for CAVirtex.   TD or CIBC banks.  You don't need to have an account to deposit.

https://en.bitcoin.it/wiki/VirtEx

Update:
CaVirtEx no longer allows cash deposits at any bank. You now make a Bill Payment to an established Payee, and CaVirtEx credits your account about 2-3 days later.

https://www.cavirtex.com/news

There is a new service called harborly which allows you to buy and sell bitcoins in Canada directly with your bank account.

https://harbor.ly

The easiest way is to simply go to your bank and send money to MtGox via Bank Transfer. MtGox provides you with their Swift code and bank account information, and it's straightforward and easy. Follow MtGox instructions they provide. I've done it multiple times with RBC - you can even do it online, I've done that too, it's called an International Remittance at RBC. (Online transfers are limited to $2500 a day).


text:
Decrypting BitcoinJ/MultiBit key (scrypt/aes-256) from protobuf with NodeJS
I'm trying to decrypt an encrypted private key from an encrypted Multibit Classic .wallet file but the resulting public key / wif doesn't match the original.
Here is my code:
'use strict'
var fs = require('fs')
var crypto = require('crypto')
var scrypt = require('scrypt')
var protobuf = require('protobufjs')
var bitcore = require('bitcore-lib')
var network = bitcore.Networks.livenet

function parseWallet (wallet, cb) {
  protobuf.load('bitcoin.proto', function (err, root) {
  if (err) cb(err, null)

  var buffer = fs.readFileSync(wallet)
  var walletMessage = root.lookup('wallet.Wallet')
  var message = walletMessage.decode(buffer)
  console.log('protobuf:', JSON.stringify(message, 0, 1))

  message.key.forEach(function (k) {
    var res = {}
    var address = new bitcore.PublicKey(k.publicKey.toString('hex'))

    res.encryptionType = message.encryptionType
    res.pubkey = address.toAddress(network).toString()
    res.iv = k.encryptedPrivateKey.initialisationVector
    res.salt = message.encryptionParameters.salt
    res.encryptedPrivateKey = k.encryptedPrivateKey.encryptedPrivateKey

    cb(null, res)
    })
    // var message = walletMessage.decode(buffer)
  })
}

parseWallet('dev.wallet', function (err, res) {
  if (err) throw err

  console.log('parsed:', res)
  var passphrase = new Buffer('dev123456')
  var scryptParams = {N: 16384, r: 8, p: 1}
  var derivedKeySize = 32
  var derivedKey = scrypt.hashSync(passphrase, scryptParams, derivedKeySize, res.salt)
  var decipher = crypto.createDecipheriv('aes-256-cbc', derivedKey, res.iv)
  var decryptedPrivateKey = decipher.update(res.encryptedPrivateKey)

  var privateKey = new bitcore.PrivateKey(decryptedPrivateKey.toString('hex'))
  var publicKey = privateKey.toPublicKey()
  var address = publicKey.toAddress()

  var output = {}
  output.decryptedPrivateKey = decryptedPrivateKey.toString('hex')
  output.pubKey = address.toString()
  console.log('output:', JSON.stringify(output, 0, 0))
})

The public key / private key doesn't match after the decryption. I suspect that I'm missing something about encoding and I would appreciate any help.
protobuf: {
 "networkIdentifier": "org.bitcoin.production",
 "lastSeenBlockHash": "AAAAAAAAAAAzUIO4ArpXPqbCZNnaltVmjJsWob3cLb4=",
 "key": [
  {
   "encryptedPrivateKey": {
    "initialisationVector": "CiKlKV+J1LhmMZWtiPHJKA==",
    "encryptedPrivateKey": "0C7HTASrcjsvPHxZE5OLr2MS4oFdfEC4BID81WH+prFhUunkQNb8itg4vimaBln5"
   },
   "publicKey": "AqrhHqufQRw63h4EDHK7ylZlWktTZxANdPpGun6JKwsO",
   "creationTimestamp": "1486547219000"
  }
 ],
 "encryptionType": "ENCRYPTED_SCRYPT_AES",
 "encryptionParameters": {
  "salt": "J7kt6NuBTIo="
 },
 "majorVersion": 2,
 "extension": [
  {
   "id": "org.multibit.walletProtect.2",
   "data": "AA==",
   "mandatory": true
  }
 ]
}

parsed: { encryptionType: 2,
  pubkey: '1MWq1EiwYh79GHu9PLnVBuPQu66Fs2ph6Z',
  iv: <Buffer 0a 22 a5 29 5f 89 d4 b8 66 31 95 ad 88 f1 c9 28>,
  salt: <Buffer 27 b9 2d e8 db 81 4c 8a>,
  encryptedPrivateKey: <Buffer d0 2e c7 4c 04 ab 72 3b 2f 3c 7c 59 13 93 8b af 63 12 e2 81 5d 7c 40 b8 04 80 fc d5 61 fe a6 b1 61 52 e9 e4 40 d6 fc 8a d8 38 be 29 9a 06 59 f9> }

output: {"decryptedPrivateKey":"ae0ee2bacc68e3f67dce176a99663ced485885a45f685208794c5356c7795a25","pubKey":"1By9rGSNZDMXCv8iSaZF5BpiMnpZKx5k4e"}


text:
Is there any way the Bitcoin network could resist a viral tainted-coin tagging system implemented by regulators?
Already it's possible for MtGox etc. to detect spends of coins that have certain well-known thefts in their history. If regulators forced audits on exchanges and key popular merchants, as well as keeping track of coins they deemed to have been involved in illegal activities, they could make these exchanges and merchants pay a small tax on these 'tainted' transactions and pass this cost on to the consumer.  As the regulators 'tainted' coin list would be public, it would become in more and more peoples interest to use wallet software which subscribes to the 'taint' list in order to reject coins they know will incur a penalty upon spending. The more the regulator raises the tax at the exchanges and audited merchants, the more people must join.
Audited exchanges and merchants would have to submit batches of all bitcoin addresses involved in their transactions to the regulator. Agents could perform random transactions with exchanges and merchants to make sure 100% of transaction IDs are reported.
Is this scenario realistic, and wouldn't this make Bitcoin ultimately a very controlled environment indeed?
('tainted' coins would still have value on black markets, creating a split system where bitcoins are no longer completely fungible)

I suppose the corollary question is should the bitcoin network even try to resist it? Software will simply adapt and tell you where you can and can't spend your coins depending on what blacklist they're on and what discount/penalty to apply based on how dirty the coins are. The regulators wouldn't be the only ones who could define blacklists - there could be public interest tags designed to boycott certain things.

What makes you think the regulators do not already have a controlled environment with respect to the exchanges?
There are more than enough people reporting that their withdrawal was well within the daily and monthly limit yet found that to get funds released they had to submit a passport and other identification.

Yes, I think the exchanges are already somewhat restricted/controlled - but not to the point where they're automatically reporting all bitcoin transaction ids.  (although - maybe those would be available upon subpoena)

Note that 'to reject coins' isn't really directly possible - but wallet software subscribing to the blacklists would presumably know to isolate those coins and either allow sending those specific coins back to abort the deal, or to quarantine them. The user might choose to accept them but ask for further payment as they place a lower value on tainted coins.

In a scenario where bitcoin becomes widely adopted and an important part of the economy, governments instituting such black lists is plausible.
There are no technical means of resisting this. The only defense would be a social one, where people agree to only use exchanges, merchants, e-wallets and clients that don't discriminate against black-listed coins.

This is patently wrong, see @David's answer.

I don't think the scenario is realistic because it would only punish innocent people. By the time coins could be marked as tainted, they would already be in the hands of innocent people. Governments don't do similar things with other currencies. For example, if you deposit dollar bills in a bank that turn out to have been stolen, the government could charge the bank a "fee" to clean the bills which the bank could pass on to you. But governments don't do that because they recognize that by the time the bills could get on a "hot list", they're already in the hands of innocent people.
There are also specific features of Bitcoin that make this difficult. Transactions put all the input Bitcoins into a big pile which they dole out as outputs. There's no concept of particular output Bitcoins corresponding to particular inputs. Bitcoins don't have a serial number that can be traced through the block chain. So any such tracking rules would be basically arbitrary.
It's just not something realistic. It's more realistic with physical currencies which have serial numbers and are widely used to facilitate crimes and buy contraband. And governments don't do it with physical currencies -- largely because they know it would only punish the innocent.

"it would only punish innocent people"  This isn't necessarily so. It would by necessity inconvenience them, but may only 'punish' them if they refuse to subscribe to the taint-information provided, or refuse to cooperate. A slightly delayed taint would still be useful to authorities as a way to incentivise(quite strongly so) cooperation in tracing the taint to the earliest known spend points. People who don't cooperate, risk having their coins heavily (or completely) taxed at the audited merchant/exchange points, people who do cooperate have their address branch untainted.

I suppose that's true, but if it were feasible, I think it would be done with currency first, since that's a much larger problem and it would work equally well.

I don't agree with your assertion that specific features of Bitcoin make this difficult. Please expand on this.  I know that an initial tainted address could end up fanning out to taint a large number of   other addresses - this is why the taxation/penalty at audited popular merchants/exchanges would create the conditions for it to go viral assuming on the whole that individuals act to preserve their wealth in preference to resisting a government mandate which claims to fight crime.(A pretty reasonable assumption I think). Subscribers don't get punished, anyone else may to varying degrees.

I think it would be much harder to do this with ordinary currency. The 'taints' on the blockchain could be automatically pruned as they narrow down the earlier spend-points of the 'bad money' - so that many consumers will not even be notified that their coin has the taint in it's history, because their branch has already been negated as not of interest.

You could do the same thing with currency. Have a hot list of serial numbers available on the Internet and remove serial numbers once bills are untainted. With Bitcoins, there are no coin serial numbers. There is no good way to say that a particular coin is tainted. (If 1 tainted coin and 800 good coins go into a transaction, do 801 tainted coins come out?)

If traditional ransom drops were as impossible to intercept as  a bitcoin payment, perhaps kidnapping/extortion would be so common that scanning each note at the checkouts would be in place by now. For cash it's also only something that would be becoming practical in recent years.  Sure 1 coin would taint 801. The risk of taint-penalty is high if you don't subscribe -hence the virality. With cash, they can now get info that marked notes are appearing in an area. With bitcoin, a more passive monitoring like that wouldn't be so useful precisely because of this taint-expansion you mentioned.

@JulianNoble: makes no sense, who would ever use such a coin?

in some countries, one has the feeling that it is realistic because it would only punish innocent people. :(

It may depend on the jurisdiction, but if you accept a (literally) tainted bank note (such as can happen with currency stolen from places with tamper evident systems), you would be unable to keep the value of this, as you knew, or should have known, this was a tainted note. The parallels with the proposed system are obvious, and thus provide evidence that "innocent poeple would be punished" may not be that high a barrier to a law being enacted.

As all transactions are transparent and can be seen by anyone, there is no way of resisting it other than by the unwillingness of the community. Only problem I can see with the discrimination against certain coins, are transactions that have multiple inputs and outputs, which would either "wash" the dirty coins, thus making the point moot, or "taint" new coins, thus being able to "infect" many more addresses.
Say I had 100 infected coins and sent each known address a Satoshi. At the moment the main client would accept that transaction and add the infected coin to your wallet. If you went with the tainting scenario, this would effectively taint the whole system. Of course, by then the clients would become more discriminatory about the coins they accept.

yes - the taints could become quite widespread initially, which is why I suspect the penalties would be applied gradually as small percentages.

The problem with tainted lists is that it requires a trusted body to declare which coins are tainted.

Note that tracking coins isn't trivial. If I make a transaction with a tainted 10 BTC input, a clean 10 BTC input, and a 20 BTC output, is the output tainted? Half-tainted? Whatever the answer, the system will be complex and unintuitive and people won't be eager to go along with it.

I would assume the whole lot would be tainted - hence the strong incentive to subscribe to the lists.  There might be legal challenges to such blacklists though. Having received money 'in good faith' - why should the government be allowed to penalize you? (e.g if the taint was added to the database after you received them)

So if the whole lot is tainted then I could send 1 tainted satoshi to every single public address known and taint every coin in the Bitcoin universe.  Right?

@DeathAndTaxes: Weren't we over this already? In this scenario every address will have a tainted 1 satoshi output, which doesn't stop it from using its clean outputs. In my example I explicitly specified that a single transaction mixes clean with tainted coins.

I don't think your scenario is realistic. In particular, the idea of paying a penalty fee to "clean" tainted coins would indicate tacit acceptance of these illegal transactions. It seems more likely that they would forbid the acceptance of tainted coins altogether.
You may have considered this eventuality and rejected it as the taint would spread as mentioned in https://bitcoin.stackexchange.com/a/2128/684. You might imagine that the system would grind to a halt as nearly all coins become tainted.
However, there is a mechanism to untaint coins which were tainted accidentally or in retrospect found to be tainted when some of the coins long in the past are suddenly declared tainted. All that is required is for the same value as the tainted coins be sent back to the tainted "address". Slightly more technically, a new transaction with the tainted coins value is written with a scriptPubKey indentical to to scriptPubKey of the originally declared tainted transaction. "Taintexplorer" software, similar to Blockexplorer would be able to see the taint entering the transaction chain at a certain place and exiting later on. The remaining coins would be deemed to be untainted.
In this fashion, a clear distinction can be maintained between tainted and untainted coins. The most important feature of this is that the total value of coins declared tainted need only be as large as the aggregate value of the transactions declared tainted.
I believe that if the Bitcoin system gains widespread acceptance then policing of businesses and transactions in the fashion described is inevitable.

I would say something simple. If there are a tainted list, it is really very easy to avoid it. Anyone here know what was 1mdc (1mdc.com)? It was a service that "bailed in/out" e-golds. A similar service/coin will make possible bitcoin transactions "outside" of the Bitcoin blockchain. So, you see... Once you bail-in your bitcoins there will be no way to track it back as it will be spend using another system - no public transactions then. Let's say you have 100 bitcoins. You use the 1mdc alike system to bail-in your bitcoins. Once it happened no more transactions with this 100 coins will be made in the bitcoin blockchain until you bail-out it. But you do not need to bail-out the coins... Use the 1mdc alike coins where it is accepted. Voilà! tainted list is useless.

Could you make a custom client that doesnt process tainted coins? That would stop the spender if no one added his transaction to the block chain.

If you outlaw tainted coins, only outlaws will have tainted coins.
And in short order they would get mixed back in.

I don't know what you're trying to say here.  Tainted coins can be marked clean again by the regulator after passing through a merchant/exchange where the penalty fee has been paid. When checking the taint list - a tainted address way back doesn't necessarily mean your current coinset is tainted because it might have passed through an address which was marked as 'fee-paid clean'. Other coins with the original taint may still be dirty.


text:
How would one go about creating a new alt-coin?
I'm looking to create an alt-coin for a club I'm a part of.  All the members of the club will be mining this currency - and we will use it for trade between members. It will also be a learning experience for everyone.
What is the fastest way for me to create this new alt-coin - and assuming everyone will be GPU mining - what would be the best alt-currency to base it off of (or would it be better to base it off of the original bitcoin)?
What programming skills would we need to re-use existing code?
Thanks for your help!
CC

People who downvote, please add a comment explaining to the user why you think this is a bad question. This is especially important when the user is new to the site. Thanks!

Try looking at these pages:
First, a "Complete Guide on How to Create a New Alt Coin" which, as the name says is a fairly step-by-step guide on how to create a new alt-coin.
Secondly, another thread started by someone who asked essentially the same question as yours: "How do you create an altcoin?"
The discussion which follows is a bunch of people discovering for themselves how to do it. Note that I haven't read through the entire thread (it's 15 pages long as of this posting), so I'm not sure if they ever successfully make an alt-coin or if they give up somewhere along the way. But it's an interesting read to see them figure things out and discover things together as a group.
And finally, A Psuedo [sic] Guide on how to Build an AltCoin, which doesn't go into as much detail as the Complete Guide linked above. In fact, it mostly just links to other threads on bitcointalk.org. That said, it may link to some information that answers some questions left from the other links.

I would recommend a basic knowledge of C++, and to play with Litecoin source code. If you have compiled programs in Linux, you're on the right path.

Could you please elaborate on the general level of technical proficiency of your group, as well as the time commitment folks are willing to make?
Since you say that you are looking for the fastest way to create an alt coin, you could use a paid service like http://www.coingen.io/, which costs 0.05 BTC.
You could also consider using existing code but mining on an isolated network.  This would be your own chain, although not technically your own coin.
You could also choose an obscure coin with very few miners (the bitcointalk forums has a sub-board for alternative cryptocurrencies where such coins abound).
I would leverage the bitcoin and bitcoin-dev freenode IRC channels during the process, as well as stack exchange (obviously!), as you encounter specific issues.
Austin's reply contains some very useful resources and summaries of what's involved with creating an alt coin.  Be forewarned that it is a highly non-trivial endeavor.  That being said, great idea for a club activity!  Best of luck and enjoy yourselves!!


text:
What are the usability limitations of Core?
Some I know are:

No HW wallet support
No SPV mode
Hard to use as an offline wallet

Are there any others?

For the first one, it's implemented externally: https://github.com/bitcoin-core/HWI . For the second one, i think some contributors plan to implement a BIP158 version (needs confirmation). For the third one: it's a bit contradictory for a P2P client to be offline ?

Are there any others?

No support from mnemonic recovery phrases, also known as seed phrases or backup phrases.

although it will be supported in the next release (0.21) which is expected in late Jan/early Feb 2021 (a few weeks from now)


text:
Can't spend Watch-Only coins, have I been scammed?
Inspired by Murch's format of Why is there no such thing as a redirected, forged, or fake transaction? to create one question that is well-worded and accessible through search engines.
Recently, I've imported an address to my wallet that contains the bitcoins I have earned. Now I want to spend them, but my wallet shows it as "Watch only" or "Non spendable" and says "Private key for address not found"
How can I claim back my bitcoins and spend them?
D U
P
L
I
C
A
T
E
S

A watch-only address means an address your wallet is tracking the balance of, and not more than that. To own an address, which means to be able to spend from it, one is required to know its private key. All addresses generated by a wallet software have their private keys stored by and known to the wallet.
A common scam using watch-only addresses is as below:

A user is told "invest today, earn 100 times soon"
The victim pays the malicious actor.
Later the malicious actor says "We have your profits, now you need to import them to your wallet"
The victim is instructed to import the address as "watch-only" to their wallet and not the private key required to spend the coins.
It takes time for the victim to notice that they can't spend their balance. However, the malicious actor has already vanished.

Remember that Bitcoin is a cryptocurrency, which means it's possible to make transactions!!! If the malicious actor was honest, he'd ask for the user's address so that they could make a transaction and send their earnings, but importing to wallet should always be considered fishy.


text:
ASIC resistant PoW mechanism that generates new hash functions. How does that work?
From Vitalik Buterin's post regarding "On Mining", he mentions:

The second approach is somewhat different: create a mechanism for
  generating new hash functions, and make the space of functions that it
  generates so large that the kind of computer best suited to processing
  them is by definition completely generalized, ie. a CPU. This approach
  gets close to being “provably ASIC resistant” and thus more
  future-proof, rather than focusing on specific aspects like memory...

My question is how would such a mechanism work and how might it be implemented or realized?
What's unclear to me is how can you have a PoW mechanism that's able to just create new never-before-seen hash functions on its own and somehow have all the nodes on the network derive this hashing algorithm in an independent, trustless manner? A second major concern is how can you be sure that this derived algorithm is even cryptographically secure?
Note, I found a similar question here. But there is a crucial difference: that question is in regards to picking from a finite set of predefined cryptographically vetted hash functions and changing their call orders dynamically. The method Vitalik is suggesting, the mechanism is deriving a new hash function that never existed before and using that as the PoW function for a given block at that point in time.

Similar to http://bitcoin.stackexchange.com/questions/18633/could-an-algorithm-be-made-asic-resistant-by-simply-adding-deterministic-permuta

I've contacted Vitalik to see if he can weigh in on this

That would be helpful. Hope he response, maybe even give an answer here himself.

Even though i'm a beginner in everything that concerns cryptocurrencies, please let me propose a guess, that others more prepared will correct. The idea is that an ASIC is a very specialized piece of hardware, dedicated to a single algorithm. If you keep changing the algorithm, there will be no way to create an ASIC that will mimick it; to implement such an algorithm, you'd have to use a piece of hardware so generalized that it would have to be a CPU.

My question isn't about what makes this ASIC resistant because that's obvious. My question is how can something like this be implemented. Even a simple example to illustrate. So this response doesn't answer my question.

Dear @greatwolf, that is a matter of implementation technique and would certainly need serious studies to see what ASIC designers can't do.
But a guess would be to use a hash function that was the concatenation of many different hash functions, maybe randomly selected. As long as their number was large enough, it would not be economically feasible to implement all of them in hardware.
It`s important to mention that Vitalik's proposal doesn't really exclude such an alternative.


text:
Why is bitcoin-qt not launching?  Using linuxmint-12-lisa
i'm using LinuxMint-12-lisa and installed bitcoin-qt as described
Installing Bitcoin-Qt on Ubuntu
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoin-qt
bitcoin icon appeared to Application list and available to execute, but nothing happened after start. Please help

Can you post what, if anything, appeared in ~/.bitcoin after attempting to run bitcoin? What happens when you run bitcoin-qt -? in a terminal, or just bitcoin-qt? (Comment from Matt Corallo as requested)

There is a bin folder that contains the binary. There are two folders in that folder, "32" and "64". You have to know what type of system your mint/computer is. It either a 32 bit system or 64 bit system. If you click on on a 32 bitcoin-qt on a 64 bit computer it will not start and vice versa.


text:
How secure is a private key?

Possible Duplicate:
Is it possible to brute force bitcoin address creation in order to steal money?

I've tried brainwallet.org and now I wonder, what happens if someone starts to generate a lot of private keys and add them to his wallet (or MtGox account)? That person will eventually get somebody else's private key and be able to use his/her Bitcoins. Am I missing something?

Assuming there are 1 million addresses with a non-zero balance, and you can import 1 million keys per second, you will on average get a hit after approximately 3.5 billion billion times the age of the universe.

Hi Tomas and welcome! See the link now added to the OP.

I get a similar number to Pieter: age_of_universe = 60 * 60 * 24 * 365.25 * 14.6e9; keys_per_second = funded_addresses = 1e6; keys = 2**160; keys / keys_per_second / funded_addresses / age_of_universe -> 3.1720679605540234e+18    I expect he used something other than 14.6 billion years for the age of the universe to get his slightly higher answer.

@ChrisMoore Thanks. Really good explanation. I just though that if BTC is the future money, billons of active addresses will be around but that is still really improbable.

Even billions of active addresses is not at all a problem.


text:
What are the problems with normal currency that may be solved by using Bitcoins?
I've watched the video on weusecoins.com and read some of the FAQ, read information about wallets etc, but I still can't find any information about why we should use Bitcoins? What are the issues with normal currency?
I know that this is a very beginner question.
The only things I can find so far are:

It's not controlled by a government or company. But what further advantages of this are there?
Open source, but why should currencies be open source?
It has very good security, but don't banks spend billions on security as well?
BTCs are limited in number: Is this to prevent artificial inflation of currency?

Please note: This is not some kind of horrible troll question, I'm genuinely trying to learn about BTC.

One thing is online payment, paying online with your credit card is very bad (e.g. you have to trust 3. party, you can't know who stole your CC number, credit card fraud is a huge problem, etc). Bitcoin is designed to give us secure web payment "normal currency" is not.

The fact that banks spend millions on security doesn't mean banks have good security. Actually banks spend millions on hushing any security incident not to damage their "secure" image. Open source nature assures anyone can inspect security of bitcoin while extreme secrecy of banks makes spotting any flaws difficult.

Thanks for all the great answers, I'll be reading through this again several times.

One answer is that it makes many things that are hard to do with fiat money trivial. Including:

Send money electronically from one entity to another without the need for an intermediary. (Beneficial because those intermediaries often charge fees as well as imposing their own terms and conditions).
Enable more anonymity in electronic transactions. (Note that this does have advantages and disadvantages.)
Provide a means of exchange that largely ignores state borders. (Again, this has advantages and disadvantages. At least from the perspective of those states.)
Provide for more sophisticated transaction types that can be currently accomplished easily. One example being contracts .

Another answer is that a digital system of currency has the potential to make exchange easier and cheaper. Much of the cost of fiat currencies has to do with legacy infrastructure and regulation. Note that this doesn't necessarily have to imply cryptocurrency like Bitcoin, it could just be digital accounts like Dwolla, but Bitcoin also has these benefits. And, unlike Dwolla/Flooz/Paypal and other non-crypto digital transfer systems, Bitcoin doesn't make this ease of transfer dependent on the survival of the intermediary. (Flooz intentionally included in those examples to show the hazards of the non-crypto approach.)
An example of that is that I just sent a donation to a developer. Just 15 mBTC. If I had used Paypal, or iTunes, or Stripe, the merchant fees would have meant that most of my donation went to the merchant, not the developer. Similarly, my coffee roaster has a sign up saying that they prefer cash (and won't accept cash for transaction under $10) because the fees from their credit card vendor are too onerous. In a world of digital money, I find this absurd. Cryptocurrency is a way that we can drastically reduce these fees.

Paper fiat currencies issued by Governments could work perfectly well, provided they used the money for the benefit of society.
IE, if they  had the discipline of the Bitcoin code, we wouldn't need Bitcoin, the trouble is, Govts become corrupted, they are tempted to fund projects they can't afford or otherwise should not get involved in (wars) by printing money.
Printing money is a phrase we see bandied around a great deal, but if Govts only printed new money to pay for their pet projects, it wouldn't be so bad, what compounds the issue is that they BORROW this extra money from Private international Bankers who simply conjure the money out of thin air.
Taxes against the People are required to pay back this totally unnecessary Borrowing.
For more on this goto youtube and search 'Bill Still' 'the secrets of OZ' 'fiat money' 'fractional reserve lending'
More money in circulation means the money you have earned is devalued through inflation. Yes, you may still have $1000 in the Bank, but it's purchasing power is being devalued, it is becoming worth less because of all the extra money  being printed (borrowed) and put into circulation.
Another problem with central control is the issue of Liberty, currently, as in the case of Julian Assange, the state can freeze your assets, switch off your access to banking.
This is potentially very sinister, do some research and you will see that totalitarian Govts often shut off access to money, food and water as a means of controlling large numbers of people.
Bitcoin addresses several of these important issues, firstly, it's a limited supply, whereas there is virtually unrestrained money printing going on, and there might even be new Gold and Silver deposits found, there will NEVER be more than 21 Million BTCs. These are divisible up to 8 Billion times so BTC has the potential to serve as a Global currency. There's no central control, Your Bitcoins cannot be blocked as they are sent person to person.
As people buy in, driving the price higher, instead of buying a meal for 1 BTC we will be using fractions of a BTC, a whole BTC becoming worth a considerable amount of money, this is called deflation, this is the opposite of what we have now with inflation devaluing our currency.
Pensions too could be transformed by this, simply work 20 to thirty years, buying BTC allowing them to deflate (increase in value) to a sizeable Nest egg, then retire when YOU want to.,
Currently, there's money pouring into Bitcoin, people say it's a speculative bubble that may eventually crash.
I believe though that Bitcoin is a Global asset, it is a peer to peer, anonymous version of Western Union, so if Bitcoin has no value then Western Union has no use to society either.
I think the thing that will determine bitcoin's ultimate success is if underneath the speculation, real industry and businesses can spring up using BTC.
For those early adopters who've gained, probably the best way to preserve those BTC Gains is to take 1% of your gains and help young BTC industries to flourish.

Not being controlled by the government means that the government can't change its value without consent of the people, nor sieze it.  In Cyprus, this is happening right now.  Also, it's more anonymous.  And because the government doesn't (can't) regulate it, it can be transferred faster.
Open source means that others can inspect it and prove that it is impossible to steal or control, by the government for instance.
Banks spend a lot on security but bitcoins might provide the same or better security for less money.  I worked out that the cost of all the electricity of the miners is around 5000USD/second right now.  That sounds like a lot but imagine that it replaces the cost of the security of all banks of all the world.  JP Morgan's operating expenses for last year, according to the income statement, came out to about 2000USD/second.  And that's just one bank.  All of them together, way more than 5000USD/second.  In time, the cost will stabilize to the value of the security that we're getting.
BTC (BC is not the right acronym, get used to BTC) are limited to prevent inflation.  In fact, it guarantees deflation because society is creating value all the time.  This is a controversial decision.


text:
RPC FundRawTransaction: FeeRate
I want to pass feerate argument to Bitcoin Unlimited while using fundrawtransaction.
I tried
fundrawtransaction ["020000000001e80300000000000017a914f65d061c8966ae9d0d6add32879a492d99bce5848700000000" {"feeRate":0.00001}]

However, it says
Error: Error parsing JSON:{feeRate:0.00001}]

How can I pass the feeRate argument like these lines (param0=02000..., param1=feerate) do, but using Core's RPC Debug window?

After a little research, it appears that the syntax is valid for Core (these lines), but Bitcoin Unlimited doesn't have that code.


text:
What are the legal processes that someone would have to go through in order to get a Bitcoin exchange operational?
One of the main perceived difficulties in getting started with Bitcoin is obtaining some in the first place.
Naturally, for an exchange to be accepted into the mainstream it needs to be a recognised and approved legal entity within the country it is operating in.
So my question is this - what are the legal processes that someone would have to go through in order to get a Bitcoin exchange operational?
If possible, it would be useful to have each answer target a particular country with suitable edits to become a solid reference.

I started a discussion on Meta to try to decide whether questions like this should be specific for a country or not. http://meta.bitcoin.stackexchange.com/questions/47/questions-with-different-answers-depending-on-country-region

Interesting update to this open question: https://bitcointalk.org/index.php?topic=49862.0

+1, despite disagreeing with the premise "The more exchanges there are worldwide then the easier this becomes for people"

sorry for spamming a question of mine, but I think it's related enough to be worth a mention here: http://bitcoin.stackexchange.com/questions/2783/do-you-have-to-pay-taxes-on-bitcoin-revenues

@Lohoris I like the referential links but prefer a friendly link like this Do you have to pay taxes on Bitcoin revenues?

@makerofthings7 how to do that, i.e. which syntax?

At the present moment, no country recognizes bitcoin as actual "currency" so the laws for exchanging, buying, selling or trading in bitcoin are exactly as they would be for simply setting up a shop. For legal purposes, pretend bitcoins are any other object, let's say a chair...
If you set up a web site that exchanges chairs for USD and you sell enough chairs, you'll probably need a business license, it would probably be smart to incorporate your chair-selling business at some point as well. If you "mine" (assemble?) chairs then you have a cost of production and you make a profit. If the profit exceeds some amount which your state/country has established then you must pay taxes on those profits. Transactions which take place using bitcoin are essentially barter transactions: whatever laws would apply if you traded an equally-valued number of chairs for that XBox 360 apply to purchasing it with bitcoins as well.
I qualify all of this with "at the present moment" because it's all quite likely to change at some point. Bitcoin is only unregulated at the present time because lawmakers are, for the most part, unaware of its presence. Once they become aware, wheels turn slowly but eventually new legalities will inevitably spring up around the bitcoin community. If you intend for your exchange to last for more than a few years it may be worthwhile to set up shop offshore in a country like Panama, where the laws are more favorable to exchanging currency.
Edit: I must also mention that bitcoins may be recognized as a "value store" without being recognized as a currency. I am not a lawyer so this should not be taken as legal advice. If you have concerns about the legality of any service you wish to run, you should contact a lawyer - though even this is of questionably little help since at present there is not (to my knowledge) any precedent for just about anything we do with Bitcoin. As with all young technologies, expect legislation to spring up around it and expect things to change soon and often.

As commented on MaxSan's answer, this advice may not be current because bitcoins can be subject to certain laws without being recognised as currency.  See https://bitcointalk.org/index.php?topic=5627.msg82745#msg82745

@eMansipater: Edited for clarity and completeness. Hopefully my extra paragraph clears up your concerns.

The biggest problem is the whole "the laws for exchanging, buying, selling or trading in bitcoin are exactly as they would be for simply setting up a shop. For legal purposes, pretend bitcoins are any other object" part.  It's simply wrong.

There is not yet any legal precedent to declare Bitcoin anything other than a digital item, manufactured at some cost and resold at a markup. When the first court case has a final judgement we can revisit the issue, but at present moment there are no "simply wrong" answers, only good guesses and bad guesses.

Go back and read that link carefully.  Since the question is specifically about setting up an exchange (as opposed to merely accepting bitcoins at your business) there is an explicit FinCen suggestion that money service bureau rules apply in the U.S. once transactions exceed a value of $1000.  So just like for a gold exchange, there are "legal processes someone would have to go through" (quoting from the question).

And I can find a dozen other threads on the forum which say the exact opposite. The forums have been cluttered with discussion of Bitcoin's legality since day one and there is no educated concensus so I fall back on a basic tenet of the American legal system: Things are legal by default until otherwise specified. There is no legal precedent regarding Bitcoin just yet.

The issue is not so much with the exchange itself but with the national currency bank accounts and payment mechanisms that provide for the two-way conversion into and out of the exchange. We must distinguish between floating-rate and fixed-rate exchanges. In the former, customers are placing funds to be held at the exchange. In the latter, customers are making an immediate one-time purchase. It is similar to the difference on eBay between auction bids and the "Buy It Now" button.
A floating-rate exchange has to become a licensed entity itself or it has to contract with a third-party entity that is licensed to hold and segregate the customer funds. Currently, a fixed-rate exchange does not have to worry about that because they are not holding customer funds and they are selling a harmless crypto "math puzzle" or RPOW at a certain price known in advance.
Regarding jurisdiction on floating-rate exchange operators, I can only speak to the US and EU jurisdictions. The US is covered by Money Service Business regulations under the Department of the Treasury http://www.fincen.gov/financial_institutions/msb/  whereas the EU is covered under the newly-revised e-Money Directive http://ec.europa.eu/internal_market/payments/emoney/index_en.htm
Also, bear in mind that test cases have not been brought forward that specifically deal with the bitcoin exchange issue; however, some preliminary statements and guidance have suggested that this is how floating-rate exchanges will be interpreted by the respective jurisdictions and the banks are following that guidance.

Your answer is spot-on, except for the part mentioning the European e-Money directive, it doesn't apply in this particular case. It doesn't apply to the fiat side because the fiat balance seen on the exchange reflects an actual bank or payment account balance held with a regulated financial institution and it doesn't apply to the Bitcoin side because Bitcoin doesn't qualify as e-currency (e-currency being defined by the European regulations as an electronic claim on the issuer expressed in fiat).

As Bitcoin is not a legal tender there is very little you have to do.

You do not require to be authorized by the financial authority.
It would involve a regular tax rate no special rate as they are not defined as a special value by any government. (Even this may be difficult for them)
The exact same process would be involved as there would be for any other business operational in your country of choice.

This is correct at this time it may in time change. I cant speak for everywhere in the world but im rather positive this applies to the western world.
There is nothing to stop you registering a business and selling bitcoins as you would any other product.
Im UK.

I'm not sure this is correct. I did a quick look against the FSA website in the UK and found this: http://www.fsa.gov.uk/Pages/About/What/International/emoney/index.shtml which seems to indicate that all forms of electronic money are regulated.

Yes, all forms of electronic money are regulated, but bitcoins are not legal tender. They are technically not money even though we decided they have a value.

That's a very interesting take on it. I'll go off and do some research in this area and feed it back.

@MaxSan this is not good advice.  However you define "legal tender" there are plenty of regulations that can apply to something which is not legal tender.  For example, there are some preliminary indications that the U.S. may treat bitcoins as a form of stored value and any buying and selling of more than $1000 worth per day makes the business involved a "money services bureau" subject to stringent requirements.

Well, I've just got off the phone with the UK FSA and they currently do not have any guidance regarding Bitcoins. They currently do not view it as e-money under their definition but this information is subject to change once they have reviewed it. They are aware of it's existence.

@Gary does the UK have "stored value" laws as well, like the U.S., which apply to gold, etc. ?

@eMansipater I have never herd of anything of the likes in the UK and was never aware of its existance. Its very much a grey area and as exchanges are not licenced I cant see this being the case (currently). We can only speak as the situation is at the moment.

@eMansipater IANAL but I don't think there are any "stored value" laws. It certainly seems that right at this moment, in the UK, Bitcoins can be treated as "chairs" like David Perry alludes in his answer. I have written to the FSA (on their request) to get further information about their current position and will report back as I get more information.

It appears that the UK has something similar for gold at least, but with higher limits: http://customs.hmrc.gov.uk/channelsPortalWebApp/channelsPortalWebApp.portal?_nfpb=true&_pageLabel=pageVAT_ShowContent&id=HMCE_CL_000104&propertyType=document#P280_22758  And this seems to suggest that dealing in any goods worth 15,000 euros or more invoke money laundering registration requirements: http://www.hmrc.gov.uk/mlr/getstarted/register/who.htm

None, but in order to instill trust with the traders getting a proper business license and showing and aptitude for Internet security will help.


text:
In Ripple, when an IOU is defaulted upon, who gets hurt?
Let's say there are five people.

Alice <-> Bob <-> Charlie <-> David <-> Eve

Each of them trusts the person next to them. For instance, Charlie trusts Bob and David, but not Alice or Eve.
Alice run a donut shop. One day, Eve comes in and asks to buy a donut. Eve creates an IOU, then uses the web of trust to resolve it. Eve leaves with the donut.
Eve then flees the country. Complicating the situation, David is broke, and was relying on Eve's IOU to pay Charlie.
Who gets hurt in this situation?

In this case, anyone bob or charlie can pay, as they directly hold (or through web of trust) IOU for david or eve. Alice sells donut because, she can reach Eve through his web of trust, and intermediate links hold enough IOU.

There are two very important concepts here:

You can only be hurt by someone you chose to trust.
A chain only exists instantaneously while a payment is made.

The answer to your question depends on whether David pays Charlie or not. If David pays Charlie, then David gets hurt because he trusted Eve and she betrayed him. If David doesn't pay Charlie, then Charlie gets hurt because he trusted David and David betrayed him.
David learns a valuable lesson here. If you trust someone, you may wind up on the hook for the full amount you were willing to trust them for. Your choice will be to make good on them or betray the trust that people have extended to you.
Alice still holds an IOU from Bob and she agreed to trust Bob. Unless Bob betrays her, she's safe.
Now, this may not be exactly what happens. For example, if David can find someone else who will take Eve's IOUs that leads to a payment path to Charlie, he can meet his obligations and stick someone else who chose to trust Eve with her worthless IOUs. So you may get a game of "hot potato" with someone getting stuck with it last.
It is important to understand that when you extend trust to someone in Ripple, you are trusting them to hold your money -- money you may owe to other people. It should not be done lightly, except perhaps in small amounts.

That's interesting. Your total potential liability is the amount of trust you extend. In effect, the trust CREATES the currency.

@David Does the protocol allow intermediaries to charge fees for the risk that they're taking?

@NickODell: Yes. I prefer to think of it as for the liquidity they are providing.


text:
In stratum mining pools, are most miners working on the same set of transactions?
When miners connect to the server, they get a "job" message back with a merkle_branch field that has hashes that correspond to transactions that will be included in the block being worked on.
What I'm wondering is, does the pool server bother changing that transaction set very often, or do they just wait for a block to be solved, and only then broadcast a new job with a different list?
In other words, in between block solvings, is everyone in the pool generally working on the same set of transactions?

The stratum pool managing software I'm familiar with is https://github.com/zone117x/node-stratum-pool, so I can tell you what they do. Stratum is a protocol, though, so multiple pieces of software could implement it differently.
This parameter is controlled by the blockRefreshInterval in the config. Every blockRefreshInterval milliseconds, the stratum server checks the bitcoin core node, via RPC, for new blocks using getblocktemplate. If there hasn't been a new block since the last time getblocktemplate was called, then it sets the current job, which is returned to all new requests for work.
The polling interval suggested in the config is every 1 second. Miners may request work at very different rates as well, so some may be working on older work. As long as it's work for the next block, it's considered valid though. The pool does use the same node and mempool data to build blocks, though. So, given all these variables, miners most likely won't be working on the exact same transaction set.
Relevant bits of code:

https://github.com/zone117x/node-stratum-pool/blob/02e78da1ab53a2409bbb8721f9771346c373482b/lib/pool.js#L555-L562
https://github.com/zone117x/node-stratum-pool/blob/02e78da1ab53a2409bbb8721f9771346c373482b/lib/jobManager.js#L138
https://github.com/zone117x/node-stratum-pool/blob/02e78da1ab53a2409bbb8721f9771346c373482b/lib/pool.js#L492

Ok, thanks this is good stuff. From what I see initially (might take me a while to digest this) processTemplate will just return false if the block hasn't changed. So I'm still missing where the data gets refreshed if the block hasn't changed. Seems like it will keep the same data unless the block changes, which means all miners would be working on the same job essentially, and the same set of txs. I'll keep looking at it though.

Now that I look at it again, I think you're right. This seems like a poor strategy, though, because newer transactions wouldn't get mined. It could be done intentionally, if it had some benefit for miners, but I don't see any benefits off hand. The regular get block template polling seems to only use the result if there has been a new block. Maybe we should open a github issue about this.

Judging by their commit log and un maintained issues list, though, I don't think it will do any good. You might try looking at https://github.com/int6/CoiniumServ or https://github.com/slush0/stratum.

Needless to say, the way it SHOULD work in any decently implemented stratum server is that you regularly check for new transactions (so that new transactions get mined), and update the current job to be given out from here forward (until a new block is found). Any work done for any jobs given out that build on the most recent block are valid. So, in the expected behavior, miners would not be mining on exactly the same transaction set most of the time.

Ok, thanks. I'm going to mark this as the answer. I think with the comments above it provides enough info. Also of course there are other stratum pool implementations that may work differently than this code base. So ultimately maybe figuring out what the top mining pools are doing is what I really need to do.


text:
Is the scriptPubKey of a previously unseen transaction in an incoming block checked? If so, where?
Today I was reading bitcoind src, and trying to find out where scriptPubKey is executed when a node received new block with transaction, for example transaction from new block may not be exist in mempool.

Find function that execute script:
https://github.com/bitcoin/bitcoin/search?utf8=%E2%9C%93&q=EvalScript

src/script/interpreter.cpp   in this file source code of EvalScript function

Used only in this 2 files:

src/policy/policy.cpp
src/script/sign.cpp

Review sign.cpp
Evalscript -> CombineSignatures -> /src/bitcoin-tx.cpp: MutateTxSign -> MutateTx -> CommandLineRawTx -> main
This functions used when we create new transactions
Review   policy.cpp
Evalscript -> AreInputsStandard -> /src/main.cpp: AcceptToMemoryPool
AcceptToMemoryPool

src/main.cpp   later
src/wallet/wallet.cpp   -> CommitTransaction    -  this is create own transaction functional
src/rpcrawtransaction.cpp -> sendrawtrnsaction - rpc function send rawtx
src/txmempool.cpp  -> no calls only comments

Last one is  src/main.cpp
AcceptToMemoryPool -> ProcessMessage  on message  "tx" , new single tx to pool received
  AcceptToMemoryPool -> DisconnectTip
DisconnectTip -> InvalidateBlock    invaludate block and send all transaction back to pool with all verifications and script eval
DisconnectTip -> ActivateBestChainStep :
  // Disconnect active blocks which are no longer in the best chain.
bool fBlocksDisconnected = false;
while (chainActive.Tip() && chainActive.Tip() != pindexFork) {
    if (!DisconnectTip(state))
        return false;
    fBlocksDisconnected = true;
}

If we have orphan take out transactions from orphan to pool with all verifications
NO more other links found
From this I can conclude that in case node with bitcoind received new block
with transactions that not in mempool we add this tx to blockchain without scriptPubKey executing.
Consequently if same "honest" miner include tx with invalid script, at example incorrect signature that spent same one coins, all bitcoind nodes add it to blockchain without eval script and not detect this
It is not possible to be true!  Where is my error?

The behaviour of the mempool or orphan tx pool should not influence the validity of blocks at all.
When a block comes in:

main.cpp:ProcessMessage deals with processing messages, and dispatches to:
main.cpp:ProcessNewBlock deals with specifically processing block messages, which stores it on disk using AcceptBlock and then calls:
main.cpp:ActivateBestChain tries to verify the potentially new best chain and switch to it. For every atomic "reorganization" step, it calls:
main.cpp:ActivatebestChainStep which will try to verify new blocks to be added to the tip of the chain using:
main.cpp:ConnectTip which does the actual processing using:
main.cpp:ConnectBlock, which will iterate through the block's transactions and verify their inputs using:
main.cpp:CheckInputs which builds up a list of CScriptCheck objects for each script execution to be performed, which are verified from another thread. ConnectBlock waits for these threads to finish and deal with the result. In those threads, we call:
main.cpp:CScriptCheck::operator() which performs a single encapsulated script execution, using:
script/interpreter.cpp:VerifyScript to do a verification of script, which consists of executing a scriptPubKey + its spending scriptSig using:
script/interpreter.cpp:EvalScript.

So, EvalScript() should be executed for all scriptPubKeys which are spent by a block, before that blocks ends up being accepted as a tip.


text:
Namecoin: This transaction requires a transaction fee...But I have NMC
When I am attempting to reserve a name using the command:
namecoind.exe name_new d/
I keep getting this error...
error: {"code":-4,"message":"Error: This transaction requires a transaction fee of at least 0.005 because of its amount, complexity, or use of recently received funds "}
However, I have more than .005 in my namecoin wallet, that I am attempting to register from. I have .01 in fact.
What is going on here?

I'm not that familiar with NMC, but my bet is that you have enough to reserve the name (the .01 network fee) but then not enough to pay the transaction fee. If you wait a day or so for the coins to age, it might work.

@davidschwartz ah... that was totally it.

You have enough to reserve the name (the .01 network fee) but then not enough to pay the transaction fee. If you wait a day or so for the coins to age, it might work.