Actually, bitcoins are not IN a wallet. They are and will always be 'ON' the blockchain. The blockchain says how many bitcoins each address owns. Our devices merely save our private keys (you could say, our passwords) for us, since we can't really remember those very well.

If you can extract the private key from your wallet file, you can simply import the private key in pretty much every bitcoin wallet there is out there and claim the coins stored on the addresses.

(Keep your file(s) safe, because anyone with the private key can claim the coins and send them to another address you do not have the private key for!)


What are secure ways to spend lot of bitcoins on offline generated address with keys on paper wallet

As long as you have the private keys, you can spend it yourself without using any third party wallets. This can be done by signing the transaction yourself with by running a node yourself (this is however a long process and will involve downloading the entire blockchain on a machine) and once the node is running you can check out this link to learn how to make the transaction yourself.
This would be the securest way possible since you have the control over your private keys.

As far as large number of bitcoins are considered on different addresses, if you are trying to spend all of them in a single transaction, you would pay slightly higher transaction fees. However you can spend the individual inputs too if the transaction does not require a large number of bitcoins.

The method of spending bitcoins is the same irrespective of the number of inputs you are using, so the security and vulnerability does not change with the number of bitcoins involved.


If Lightning Network takes transactions off Blockchain, would that defeat the whole purpose of having a Blockchain ledger?

Think of the blockchain as a court of law. A perfectly fair and incorruptible court which - if presented with a dispute - always rules justly.
However, like real-world courts, it has high operational costs. Those do not have enough judges and juries to adjudicate every dispute anyone could ever encounter. Thankfully, it doesn't need to. The fact that anyone who has been harmed has the ability to go to court on itself is a deterrent against crime. The primary benefit of the court is incentivizing people to behave honestly.
Lightning, in a way, is applying this principle to Bitcoin. The blockchain (court) has limited capacity, but there is really no need for it to adjudicate every transaction. Here is how it works at a very high level:

Two participants, Alice and Bob, create a "channel": it involves one or both of them putting up some money (on chain!) in a joint address that can only be spent from when they both agree, but with some extra tricks attached (see below).
Once that transaction is confirmed on chain, they can transact with each other by simply updating their idea of how much both of them own. Every time they do this, they hand the receiving party a proof, which will become useful later. This is instant, and very efficient, because it doesn't require telling the whole world.
Multiple such channels can be linked: Bob can connect to Carol as well, and now Alice can instantly pay Carol - by going through Bob as long as that side of the channels has sufficient funds. This is why Lightning is called a network. It is a network of channels.
If one party tries to renege on an update, the harmed party can take the proof they received earlier, and take it to chain. This proof allows them to receive the entire bond put up by the infringing party as reward, and punish the infringing party.
At some point, one or both users want to use the funds locked up in the channel for non-Lightning payments. To do so, they propose closing the channel, and most likely both just sign off and go their merry way. If one party refuses, the other can still take their money again by providing proof on-chain, though with a delay.

So yes, Lightning does indeed result in transactions "not happening on chain". But it's not like they're moved elsewhere - they're just replaced with privately settling between the participants, but still using the chain to go back to whenever a party cheats.


What happens if there are no transactions in a block?

The mining reward must be collected with a transaction, so technically there is at least one transaction in each block.

The mining reward was designed to enable the initial distribution of bitcoins and to encourage the creation of a powerful bitcoin network with a lot of computers to support it, therefore it makes perfect sense that a miner gets the block mining reward regardless of how many transactions were included.


How do Bitcoin mining pools send their miner's their share of the block reward

They do so just like anyone else sending Bitcoin to someone; they create a Bitcoin transaction and broadcasts it to the network. It works in exactly the same way as you sending Bitcoin to someone else. The mining pool operator goes into the pool's wallet, chooses the "send" option in that wallet, and enters the addresses and amounts to be paid for each miner. Of course this is all automated so the mining pool operator doesn't actually do that. Instead a script does it and interacts with the wallet using RPC calls.

Sometimes the mining pool may choose to pay a low transaction fee or not broadcast the transaction and instead include it in the next block the mining pool is working on.


I have Bitcoin Core 0.13.1 (64-bit) and I can't get prune to work

If you put startup commands on the command line, you need to add a dash in the beginning (e.g. bitcoind -prune=2000).

However, when you put them in the bitcoin.conf, I think they have to be put without a dash (e.g. prune=2000). Yet, in the screenshot you show it has a dash. Have you tried putting it in the bitcoin.conf without the dash?


How to keep track on new cryptocurrencies

I recently found a resource that seems to be very comprehensive. At the moment indexes 156 different cryptocurrencies and it seems to be updated quite often.

The main page has a sidebar titled "Latest Coins" that might be useful for what you need.

Each currency has a page with info and relevant links like a block explorer, homepage, etc... (See for example the page for Protoshares)


API or framework for handling transactions

for example you can subscribe to unconfirmed transaction on the blockchain websocket and monitor when your addresses appear in the flow.


Why aren't public-private keys sufficient to build a block chain? Why do we need proof of work/stake?

the code could have a way to order transactions and if an attacker decides to do the opposite intentionally and decides to spam the network

This is the crux of the issue: how do you achieve this? It isn't a trivial problem to solve in a decentralized network. The more generalized version of this non-trivial problem is called the Byzantine General's Problem, it describes the ability of participants to come to an agreement in an untrusted network. The invention of bitcoin provides an economically-incentivized game-theoretic framework that could be considered a probabilist solution to this problem.  As @PieterWuille mentioned in the comments, there is no absolute guarantee of eventual consistency: there is only a (continually increasing, thus far) economic incentive for participants to consider.
The solution that proof of work provides is to rate-limit spamming via the requirement for expenditure of a scarce resource: energy. It is hard to create a new block (it takes some amount of energy, on average), but it is easy to verify if a block is valid. And remember that the method for choosing the next valid block must be perfectly consistent across all nodes in the network, or else you risk a network split/fork, which is very undesirable.

but how does the attacker benefit from that?

There are many ways an attacker could benefit. As a simple example: the attacker takes a 'short' financial position, betting against the price of bitcoin. They then attack the network, assumedly causing the network's value to drop, and thus they would profit from their short position.


can one verify with certainity that pool is not cheating?

I believe that in the simplest, "spherical cow" setup that you could indeed know if you're being defrauded.
In my answer, I'm assuming no variance, no blockchain reorgs, really I'm not considering any variables which might skew calculation.

I'm also assuming you do know your own true hashrate -- that is, you count your valid shares yourself and can figure out what percentage your own mining is relative to the rest of the network.

Suppose you know that you should constitute for 10% of the network's total hashrate (you can learn an approximation of the network's hashrate by looking at the rate which blocks are discovered, and the current difficulty), but then the pool pays you less than 10% of the total bitcoins minted during a timespan (minus pool fees), then it's likely that you're not getting paid for all your work done on the pool.

Again, when the percentages are very small, or when other factors come into play like reorgs, selfish mining and natural variance, it will be increasingly harder to determine.


Is it possible to calculate a public key from the message hash and signature?

It is possible to create a public key from the signature. It will be equivalent to the key used to generate the signature but not necessarily identical.

You can find an example implementation here.


For a start multibit is no longer being developed , so i highly advice you move your bitcoins out of it into another wallet. It is not possible to access bitcoin cash using multibit. Which version of the software do you have and how many (ONLY the number) seeds do you have to restore your wallet?

Blog post suggests how you can import it to electrum. And further post on electrum suggest how you can claim BCC. You will need to fiddle a bit here , but this certainly is possible and be very careful where you get the files from as this will potentially put your coins at risk.

Once you have both the balances available , I highly suggest you move to a hardware wallet like ledger nano s or trezor they are dead simple to use and setup.

Disclaimer : I have not used electrum or multibit and the answer above is after a quick research.


what is the best mining intenisty to use for certain grahpichs cards?

I would not bother using a nvidia graphic card but the choice is yours from experience they run way to hot and don't produce enough power especially at current difficulty. Anyway take a look at this list https://en.bitcoin.it/wiki/Mining_hardware_comparison it lists a lot of best settings as well as gives you an idea if your card is hitting the hashing rate that it should be.


Papers/Books on how bitcoin works from a mathematical perspective?

www.springer.com catalog is worth checking out - technical and well respected.

Andreas Antonopolous has a book out from O'Reilly (it is also available on github).

https://bitcoin.org/en/resources - check out the Developer Guide here, it's great.

Your school library will probably have loads of journals or access to them online (eg IEEE or local equiv).

Satoshi's original whitepaper is very readable: https://bitcoin.org/bitcoin.pdf

The bitcoin wiki.


What can be done with old (unprofitable) ASICs?

If your electricity costs are high, unprofitable for you may mean profitable for someone else.

Some miners may still use unprofitable ASICs either to support the network (at a smaller loss than with GPUs) or in hopes that BTC price will rise in the future (although just buying BTC in this case may be more profitable).

Try to sell them. If you have no success, then recycle them or use them as weights, benches, etc.


Does a transaction in Bitcoin Mempool reach many miners during mining or only a single miner?

How it actually works:

You send your transaction to one or more nodes (your wallet does this job for you). Each of the nodes (some of them are miners) sends it immediately to all the nodes it knows (and again and again).

All the miners store the transaction (if it's valid) in their own mempool.

When a new block was created, all miners look in their mempool and try to find the best not-mined transactions, pick those with the highest fee per byte and include it in their block-mining-attemp.

If one of the miner's mempool-transactions is mined, they simply delete it out of your mempool.


Choosing Rights Host For Dependency Make

The following triplets are currently supported by Bitcoin Core's "depends" build system, assuming that's what you're talking about (and even if not, these are fairly standard). From https://github.com/bitcoin/bitcoin/blob/master/depends/README.md:

i686-pc-linux-gnu for Linux 32 bit
x86_64-pc-linux-gnu for x86 Linux
x86_64-w64-mingw32 for Win64
x86_64-apple-darwin18 for macOS
arm-linux-gnueabihf for Linux ARM 32 bit
aarch64-linux-gnu for Linux ARM 64 bit
powerpc64-linux-gnu for Linux POWER 64-bit (big endian)
powerpc64le-linux-gnu for Linux POWER 64-bit (little endian)
riscv32-linux-gnu for Linux RISC-V 32 bit
riscv64-linux-gnu for Linux RISC-V 64 bit
s390x-linux-gnu for Linux S390X

Added in master (which will become release version 22.0):

armv7a-linux-android for Android ARM 32 bit
aarch64-linux-android for Android ARM 64 bit
i686-linux-android for Android x86 32 bit
x86_64-linux-android for Android x86 64 bit

x86_64-pc-linux-gnu would be the most common one (targetting 64-bit x86 systems).


Could there be an exploit by creating millions of meaningless transactions?

You need to provide fees on bitcoin transactions, in which case, you are producing economically valid transactions and will run out of money eventually.

Currently the min fee is 0.0001 (BTC).

Listed here - https://en.bitcoin.it/wiki/Transaction_fees


rpi3 bitcoin full node missing wallet commands

The instructions you're linking to include the line

./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib" --disable-wallet

The --disable-wallet in that line (surprise!) disables the wallet functionality, making the node purely act as a P2P participant.

If you want a wallet, you need to configure enabling the wallet support.


Can you mine bitcoins with an intermittent Internet connection?

Assuming you are mining on a pool, your miner needs to receive and send work (shares) every few seconds, with the exact frequency depending on your hashing speed and the difficulty of the shares.

For example, my ASIC sends and receives shares at least once every 20 seconds or so.

So you need a reliable network connection if you don't want your miner to sit idle. This is the same reason why you normally configure the miner to have fall-back pool servers in case the main pool server goes down.


Building Bitcoin from Source on MAC OSX 10.9

As explained in the file doc/build-osx.md, before running make, you first need to run ./autogen.sh and ./configure.


MultiBit HD developer here.

There is a lot of information about restoring wallets in the Help within the wallet and on the website:

https://multibit.org/en/help/hd0.1/restore-wallet.html

https://multibit.org/en/help/hd0.1/files.html

The cloud backup folders are there to allow full restoration of a wallet if you know the wallet words. They will restore contacts, notes, exchange rates - all of it.

If you are confident in copying files around on your machine (many users have trouble with this so we guide them away from it) then it is safe to perform a blanket copy of the Roaming files to the other machine. Make sure to re-create the cloud backup directory and populate it as well.

As is always the case, make sure you keep your wallet words safe so that if it goes wrong (lightning strike right in the middle of the copy?) you can always recover your private keys.


Where can I get the source code of Bircoin or ANY other cryptocurrency compilable in Visual Studio?

The source to bitcoinqt is windows compatible, if it wasnt then there wouldn't be a Windows port of it. I would assume you need to install Cygwin to get the appropriate development tools such as gcc. Since you dont know about Cygwin, I can only assume you dont know how to compile software on *NIX. Change the current directory to that of bitcoinqt, and then type "./configure" and then "make". That usually works, you might need to specify options to configure, which you can find out with "./configure --help".

If you can't get a project to compile then you really should be asking Stack Overflow about the compilation errors instead of posting here. And just saying it doesn't compile doesnt provide anyone with enough information to tell you why it isnt compiling.


Listen for transaction on specific address

Lightning implementations already have implemented the functionality to watch the blockchain to see if the funding TX was spend (and the channel closed) Often this is outsourced to the Bitcoin fullnode. I suggest to look at their code base for this functionality and modify the relevant code snippet to include a watchtower solution you want to create.


Example of data that is hashed in the merkle tree for a transaction

1) Transactions don't contain merkle hashes. Pre-SegWit transactions' hashes are calculated by serializing the transaction (you can search for "the hex format"), and then hashing the byte array. After SegWit, signatures are excluded from transaction hashes.

2) (I can't understand what you're asking for)

3) 1900 transactions is not so deep. The height can be calculated by ceil(log_2(number_of_tx))+1. Plug in 1900, and the height is 12. If you want to learn how merkle trees could be used for ISA, I'd suggest searching for MAST. It allows hiding the unexecuted parts of Script.


Can I view price graphs for alternative currencies, longer than 12 hours?

There is LTC Charts with some long term chart data for LTC/BTC from BTC-E and Vircurex.


Can one send bitcoind transactions that will only be valid after a certain amount of time?

The bitcoin.org client will allow you to spend coins after just one confirmation has been received.

The Bitcoin protocol has no restriction that would prohibit you from spending immediately (o/unconfirmed) so it simply would be up to the client supporting it.

The My Wallet from http://www.blockchain.info/wallet  supports spending immediately after receipt.


I don't know how to export a private key from blockchain.info

The exact steps can be found quite easily via Google. This GitHub page was the first result when I searched for it. Quote:

  Login to your wallet on Blockchain.info
  Goto the 'Settings' Menu on the left
  Goto the 'Addresses' Submenu under 'Settings' Menu
  On the right side find the section named 'Imported Addresses'
  Click on 'Manage Addresses'
  On the new screen find the address you want to export the private key from
  Click on the 'More Options' on far right side of that address
  Select 'Private Key' and then 'Continue'


What would happen if a private fork several hundred blocks ahead tried to merge back?

One possibility, as hinted by Murch, would be to pre-build a long chain, then using an attack on the hash take a few hours to construct a block with exactly a given hash. This may require waiting until an exceptionally vulnerable block appears but that doesn't really matter.

I don't see where I hinted that, but that would definitely not work.

  few hours to construct a block with exactly a given hash.

Block hashes are SHA-256d hashes. The space of 2^256 is too large to brute force for the foreseeable future. Definitely its impossible to do in "a few hours".

  exceptionally vulnerable block

What's that supposed to be? Blocks are not more or less vulnerable.

  pre-build a long chain

The whole chain would become invalid if you changed the first element. Each block builds on the block hash of its predecessor. Therefore, two blockchains cannot be arbitrarily appended to each other.

And as already described in the comments above:

  high number of lower difficulty blocks

It's not the count of blocks that counts but the total "weight" measured in summed difficulty.


The script is executed during the validation of a transaction by any full node which validates it. The script denotes the spending condition, so during the verification of a transaction the node will execute the script to ensure it passes successfully and does not violate any other rules (e.g. cleanstack)


You actually did get the same hash. It's just that every Bitcoin software displays hashes byte swapped. If you look closely, you'll see that the first byte of your result (66) matches the last byte of the displayed merkleroot. The second byte matches the second to last byte, and so on.

Internally, the merkleroot (and other hashes) are in the same order as the output of the hash function. But for display to users, they are always byte swapped.


Could bitcoind support SPV mode by setting different args

No. bitcoind does not have a SPV mode at all.

Pruning is not the same thing as SPV because a pruned node still downloads and verifies the blockchain. Just instead of storing all of the blocks in the blockchain, it discards  blocks when they become deep enough in the blockchain. This reduces disk usage but does not effect security, bandwidth usage, or initial sync time. Pruned still receive all blocks and transactions, validate them, and relay them.

Conversely, SPV wallets do not even download or verify the blockchain at all. They only do simple verification, not full verification. SPV wallets only download block headers and check the proof of work. They do not and cannot check entire block validity like full nodes can. This allows SPV wallets to have a much much faster initial sync time at the cost of security. SPV wallets do not receive all blocks and transactions and thus cannot validate or relay them.


I downloaded Electron for Linux which I then executed.  It picked up my keys from the original Electrum that was on my desktop.  It automatically showed the correct number of Bitcoin cash tokens, presumably having taken this data from the Bitcoins that I had originally downloaded from Coinbase into Electrum before the fork.  I then uploaded this Bitcoin cash into a Kraken online wallet so that it would be available for trading.


Two question about bitcoin transaction signing

Signing requires the private key, and commits the signature hash of the transaction to the signature. Altering the transaction will change the sighash, and thereby render the signature void.

The public key is required for signature validation. Only the public key hash is shared with the public in form of the address, from which the private key cannot be derived.

P2PKH and P2SH are both standard output scripts in Bitcoin.

A P2PKH(address) output is spendable by the private key associated with the address.
A P2SH(embedded_script) output is spendable by the embedded script and the unlocking script thereof. The P2SH output script acts as a "wrapper" for other output scripts.


Why doesn't the number of shares in my miner match the number of shares reported by my pool?

It's possible that your pool is doing something similar to P2Pool:

  Q: Why does my miner say it has found a lot of shares but p2pool say I
  have only found a few?!
  A: The real P2Pool difficulty is hundreds of
  times higher than on normal pools, but p2pool essentially lies to your
  miner and tells it to work on relatively easy shares so that it
  submits shares every few seconds instead of every few hours. P2Pool
  then ignores any submitted shares that don't match the real share
  difficulty. By doing this, P2Pool can more accurately report your
  local hash rate and you can see if you are having problems with too
  many stale shares quickly


How to recover from a double spending attack?

I had to diagram this out as the transactions and block chain might actually appear:

    Inputs/Prev Outpoints    Outpoints
TX1 A:0                      TX1:0, TX1:1
TX2 B:0                      TX2:0
TX3 TX1:0, TX2:0             ?
TX4 TX1:1                    ?
TX5 A:0                      TX5:0

                (TX5)
Block A ------> Block C ----> Block D
         \
          ----> Block B
                (TX1, TX2)

To answer your questions:

TX3 and TX4 are not valid in any block chain which does not previously include TX1.  TX1 can't be included if TX5 is already a part of that chain because TX1 and TX5 both spend outpoint A:0.
TX2 is never invalid, so it If the wallet sending TX2 downloaded the now-stale block, it would've shown 1 confirmation. After the wallet switched to the new best block chain, it would show 0 confirmations again because neither block C nor block D includes it. After another block on the best block chain does include it, it'll return to 1 confirmation and increase from there.
If the service still wants to make the same payments, it has to create new transactions (TX6, TX7) using inputs that are still valid (e.g. TX2:0). If it attempts to resend TX3 or TX4, other nodes may ban it for attempting to relay invalid transactions.
To prevent future fork-based double spend attacks, the service either has to wait for more confirmations or find some non-Bitcoin way to collect money from double spenders, such as requiring registration with state-issued identification.  I know requiring more confirmations requires waiting more time, which is inconvenient, but it's the only decentralized method we have for reducing fraud risk.


How is block-solution-withholding a threat to mining pools?

Every pool is vulnerable to the threat. And there's pretty much nothing they can do about it other than perhaps to try to force their miners to use a closed source mining program that they try to make tamper-proof.

Your analysis is precisely correct. Miners know when they only found a share versus when they solved a block. A malicious miner could submit shares but withhold solved blocks.

The consequences of this depend on the payout model the mining pool uses. If, for example, the pool uses a fixed pay per share, such a miner is robbing the pool operator. But he does no harm to the other miners. If it uses most of the other distribution schemes, such a miner is robbing the other miners since he is being paid out of solved blocks and never contributes to the number of solved blocks. The amount of harm he does is typically proportional to the amount of hashing power he has.

This attack is typically undetectable because it just appears to be ordinary bad luck. An attacker can use a large number of distinct user names so it wouldn't appear suspicious that no blocks had been solved.

There are generally two motives for such an attack, depending on the payout plan the pool uses. One would simply be to make the pool operator lose money. In a PPS plan, you would get paid normally for your mining, all of which would be a straight loss to the pool operator. With other payout plans, making the pool seem unlucky (and thus driving away miners from that pool) could be a part of the motive. You still get paid for your shares, so the cost to launch such an attack (assuming you were already going to mine) is not that much.

The consensus is that such attacks are likely to remain rare and generally insignificant. The payout for the attack is simply too small and it's not an effective way to bankrupt a pool or get miners to desert a pool unless it's a particularly small pool, in which case there's generally no point.

Note that it is not possible for an attacker to submit any blocks he finds himself and keep the profits. To earn shares, he must attempt to solve the blocks the pool asks him to solve, and those will include a coinbase entry that pays the block reward to the pool's operator.


Is it possible to do a 3-of-5 OR 1 multi-sig for backup purposes?

Yes, this is possible. You can construct a script such as:

OP_IF
    <key1>
    OP_CHECKSIG
OP_ELSE
    OP_3
    <key2>
    <key3>
    <key4>
    <key5>
    <key6>
    OP_5
    OP_CHECKMULTISIG
OP_ENDIF

This will allow key1 to freely spend the coins, but if a signature from key1 is not present it also allows any 3 of the keys2-6 to spend the coins.


Where is blockchain located on Mac for Bitcoin-Qt?

Quoting https://en.bitcoin.it/wiki/Data_directory#Mac :

  Mac

  By default Bitcoin will put its data here:

    ~/Library/Application Support/Bitcoin/

You can access that folder by opening a new Finder window --> then by going to "Go" --> "Go to Folder..." (or pressing command + shift + G), and then pasting the above path into the window that appeared.


Bitcoin Transactions Detailed distinction between TxHeader TxInput TxOuput

When I look at the following Transaction Description Transactions I see the following distinction so I conclude:
TxHeader:

Field
Size (in bytes)

Version no
4

Flag
2 (optional only for segwit v0 right now)

In-counter
1 - 9 bytes (varint)

Out-counter
1 - 9 bytes (varint)

lock_time
4 bytes

TxInput:

Field
Size (in bytes)

list of inputs
(in-counter)-many inputs

TxOutput:

Field
Size (in bytes)

list of inputs
(out-counter)-many inputs


I'm the author of this question and it worked when I tried again next day.


Is there a way to estimate the number of unfound nonces?

Nonces are not 'found' or 'unfound'. A nonce is simply a little bit of data in the block header which can be changed by the miner to change the resulting hash of the block header (this is how mining works, they try lots of nonce values for their block to find one which has a hash less than some target). But because the difficulty of mining bitcoin is now so high, because there are so many powerful miners, the small nonce field can not be changed enough to find blocks any more, so miners have to change other data in the block too such as data in the coinbase transaction, or the timestamp. I believe that's what you heard.


Is the dust output limit the same for p2wpkh and p2wsh?

I just realized that there are in fact these two lines which takes into account the size of CTxOut:

size_t nSize = GetSerializeSize(txout);
...
...
nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);

so based on this, a p2wsh output (43 bytes) would have a dust limit of:

= 43 + (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4)
= 110 bytes

then using the current dust_relay_tx_fee of 3000 sat/kilobyte (or 3 sat/byte),

110 bytes * 3 sat/byte = 330 satoshis

Therefore, p2wsh outputs with less than 330 satoshis will be considered non-standard and will be rejected.


I've done some testing with pybitcointools and one of the BitcoinCore test vectors with a SIGHASH of zero.

For SIGHASH =0, the Tx which is signed

It's just a matter of appending 4 nullbytes, instead of 01000000, to the signing transaction.

The Core software checks for this non-standard hashtype now, however we can see there's no problem in validating these rare transactions since the code only checks for SIGHASH ACP, SINGLE & NONE. See Python-Bitcoinlib's code for a Python interpretation

See this test vector, where the hash being validated is 11743b220e9e24e89abd4ff124a2740531fe7d7f9b4e26de14710a532fd543e2.

FWIW, Pybitcointools needs to have the txhash function edited so that instead of if hashcode:, it reads if hashcode is not None:. The else clause in that function was confusing me, but it appears to be for hashing signed transactions (ie to return the TxID)


Timed Out Payment Still Unconfirmed After 2 Days?

Can anyone help me out?

nobody can help you. bitcoin is decentralized and no one is responsible for anything.

live with it and try to spend the rest of your life with a principle that first is learning and the second is using something.


That depends also on your BTC balance AFTER the sale. It seems that there is indeed 1000 DOGE subtracted from your balance, so that is correct. If there has been 0.00061 added to your BTC balance, then no fees have been deducted. If 0.00061*(1-0.0018) = 0.000608902 have been added to your BTC balance, then the fees have been deducted from your received currency.

This is general behavior on exchanges. It is more user friendly to specify the exact amount of sold (and deducted from balance) and deduct the fee from the receiving currency.


The best way to do it is in person, with cash. Most other methods are traceable. Provided you don't live in the middle of nowhere, it's pretty easy to find at least someone nearby who's willing to buy, and if you're serious about anonymity that extra travel distance is probably a minor issue.


Where can I find the miniscript policy language specification?

There is no specification, or really documentation, for Miniscript other than sipa's website. There is no "correct" or singular way to compile a miniscript policy into miniscript. The two existing implementations actually go about compiling in different ways, although both arrive at the same result (occasionally they differ, but the two results are semantically the same but are equally optimal). The only thing to be concerned about are whether the miniscript is optimal, and whether it is semantically the same as the policy.

Checking whether it is semantically the same is trivial. A miniscript can be "lifted" into policy by dropping tags and types so it is easy to check that a compiled miniscript is semantically the same as the policy.

Checking whether a given miniscript is optimal generally boils down to its size and expected satisfaction size. Smaller is better, so a miniscript whose end scriptWitness size is the smallest is considered to be optimal. When considering policies that include probabilities, the expected value should be taken into account.

As for compiling from policy into miniscript itself, there are different strategies. One strategy (which I believe is actually done in one of the libraries) is to construct every possible miniscript for a given policy and just select the optimal one.


What external systems is Bitcoin commerce dependent on?

Whereas Block Explorer might be a useful tool, Bitcoin could survive without it.

Most important parts of the Bitcoin ecosystem, asides the main client that is, are the exchanges. They give the currency its value and without them, Bitcoin would become a fringe technology (no merchants would deal in it, as they couldn't pay their taxes with it.

Then we have the mining software and to a lesser degree the hardware (FPGA boards and the like). Should those be gone or less available it would be easier to launch a 51% attack on the network.

After that there are the mining pools. If they would disappear the miners would have a harder time earning a predictable wage. This dependancy has been mitigated with P2Pool though, so the impact is smaller than it was earlier.

After that the services are less essential. Losing the Bitcoin Forum, Wiki, SE, WeUseCoins or the like might make it harder for new people to get into Bitcoin, but wouldn't make it less functional.


Is there an oveview of organizations support of segwit/segwit2X?

First of all, Segwit and Segwit2x are two different things. Segwit has already activated, Segwit2x has not. Please do not conflate the two.

https://coin.dance/poli and http://segwit.party/nya/ list the positions of various companies and project's on Segwit2x although they are not always accurate or clear.


Difference between block hash and transaction hash in bitcoin-core

This is not possible, both are sha256 hashes, and contain no markers as to their origin.


Is it possible to generate an invoice for my lnd without having a connection to my lnd?

Yes this is theoretically possible as described in this video https://youtu.be/bihYeAeNi0g The idea is to have a deterministic way of generating preimages and entangling the lightning node with the point of sale device.

This idea originated from stepan snigirev who went down further and refined it to this idea: https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-June/002009.html

His main idea is that the offline node creates an invoice with a routing hint through the online node and the online node catches the onion and gets preimage information from it with some form of a ECDH key exchange.

I think both ideas are not implemented in lnd yet but the latter is supposed to be included.


Most if not all constants like that are not described, documented or otherwise discussed. For the most part the Bitcoin Core code is the reference which everything else follows, rather than the code trying to conform to any sort of standard. If it were hinged on a particular piece of documentation the network would need to be hard forked every time there was a new behavior found that didn't meet the specification.

201 operations is indeed the limit, and there is also a hard limit on the number of signature verifications that can occur in a block as well. Of all things in Bitcoin the script engine is probably the least well documented of all and has a number of oddities, partly due to its late inclusion.

  It is when the client tries to verify the data for the next transaction when there is a problem.

You can make all sorts of completely invalid output scripts, because as you have found, there's no validity checks on them until they are spent. It is up to the author of non standard scripts to understand the system and not render their coins un-spendable. If you don't understand it, try these things out on testnet3 before you lose real money to them.


Explain the math behind mining profitability calculators

Suppose your hashrate is H hashes per second.

There are 86400 seconds in a day, so every day you will generate 86400H hashes.

Every hash has roughly 1 in 2^32 chance to be a share, so you'll find 86400 H / 2^32 shares.

Every share has a chance of 1/D to be a block, so you'll find on average 86400 H / (2^32 D) blocks per day (currently D = 267731249).

Every block gives a reward of B, so you'll get on average (86400 H B) / (2^32 D) per day. (Currently B = 25 bitcoins).

Then you can take into account additional factors such as the exchange rate, power costs, difficulty going up over time (requires computing an integral), and so on.


What precautions to take when working with only one or two confirmations?

At the moment there's very little orphaning of blocks, and next to no occurrence of two-block side chains. Unless you're dealing with large amounts (larger than two block rewards worth, probably), your chances of attack are incredibly incredibly low. If you're dealing with amounts less than a few BTC, I'd personally be happy accepting one-confirmation transactions.

There's no specific flags for bitcoind that you can use to control confirmations, it's all in your software's side. Generally if you're a merchant, you should avoid having a listening node (set listen=0) just to be on the safe side. Be sure to be using cold storage if your server accumulates a target-worthy amount of currency, by sending off to an address that the server does not know the private key of.

If you're not using walletnotify to control your internal accounting system, you probably should.


I bought bitcoin years ago and now the website that I bought from is unavailable!

You can try to import the wallet using the key you have (assuming it is a private key) through wallet software such as bluewallet.io, which supports importing of wallets via private keys.
Otherwise, if that key is not your private key, you are a little screwed, sorry.


Is it possible to connect to BTCPay server remote c-lightning node?

Port 9735 is the lightning port. What BTCPay wants is the API.
C-Lightning does not support TCP natively, but one can use socat as I did in the docker entrypoint to bridge unix to TCP.


How to open lightning network channel to a selected node in Electrum?

Go into Tools -> Preferences -> Lightning and disable the setting "Use Trampoline Routing (disable gossip)". If you now try to open a new channel you will see that you can put the full node id there in a generic text field, and the drop down is gone.


SPV wallets typically keep track of what the best known block for each of their peers is as well, to make sure they are up to date and can assess the security of their transactions (# of confirmations). The way they do this is to start a counter initialized at the height given in the version message. And then when the node broadcasts a new inv (inventory) message for a block, get that block header, and if it builds on their previous best header, then increment the counter. With this method, you can keep a mapping of nodes to their main chain tips.

Essentially, this is just keeping track of the inv broadcasts form a peer, which is how peers publicly report new blocks.


Nodes communicate to each other using the peer-to-peer protocol, typically using TCP port 8333. They rumor blocks and transactions to each other, request data, tell each other about other IP addresses in the network, ...

Each node implements the level of validation they desire; some download all blocks and validate everything (full nodes), some do that but don't keep the blocks on disk after validation (pruned full nodes), and some download only the transactions they're interested in along with proofs they wee including in the chain without verifying validity.

Independently, some node software also exposes an interface to communicate with users or other software using an RPC protocol. This interface however is not public for good reasons:

It's usually not designed to work in adverserial settings (for example: the RPC interface may expose a command to shut down a node, or dump its private keys, ...).
It's not hardened against denial-of-service (DoS) attacks.
It's not others than the node's operator should be using anyway, as the information provided by RPC is an interpretation of what is going on in the network; it's not verifiable. So if exposed to untrusted party, node software could just lie, possibly defrauding the party using it.


C secp256k1: What do prefixes 0x06 and 0x07 in an uncompressed public key signify?

These are used in the "hybrid" public key format, which is an uncompressed format (it has both X and Y coordinates, like 0x04) that still stores the odd/evenness of the Y coordinate (like 0x02/0x03).

It is defined in ANSI X9.62-1998 Sections 4.3.6 and 4.3.7, and seems totally useless to me. However, OpenSSL supported it, thus when switching to libsecp256k1 for validation, it had to support it too, or we'd risk consensus failures in the network if such a pubkey would ever be used. Now we're pretty much stuck with it.


Why does the standard Bitcoin message signature include a "magic prefix?"

RFC4880 apparently standardises the way signatures work, so it could be referring to:

  0x18: Subkey Binding Signature
         This signature is a statement by the top-level signing key that
         indicates that it owns the subkey.  This signature is calculated
         directly on the primary key and subkey, and not on any User ID or
         other packets.  A signature that binds a signing subkey MUST have
         an Embedded Signature subpacket in this binding signature that
         contains a 0x19 signature made by the signing subkey on the
         primary key and subkey.

But it seems much more likely BIP70 extension proposal is the reason for standardising signatures, as outlined by their BitID wallet implementation requirements:

  To be compatible with the BitID protocol, a wallet must implement the following:

  register the bitid scheme
  throw a bitid intent when scanning a BitID QR code (if applicable)
  decode the URI and verify its format
  display a request for authentication showing the domain name callback and > - ask for validation
  ask the user to pick up or create a Bitcoin address for the authentication (show the last Bitcoin address used if this is a known callback address)
  sign the BitID URI with the private key (using the \x18Bitcoin Signed Message:\n#{message.size.chr}#{message} convention)
  POST the signature and the public key to the callback URL
  completion dialog : success/retry/cancel


Device not found. NO GPU output 3 Computers same issue?

Cgminer stopped supporting GPU mining after version 3.7.2  The packages are still available for download in the repository.  You will also want to tweak your settings for optimal mining consider the following resources:

Bitcoin hardware mining comparison
Litecoin hardware mining comparison

You will likely find litecoin mining to me most profitable with your setup, however it is up to you to determine your own results.  You will also need to launch cgminer with the --scrypt flag to mine Litecoins.

Per your request

BTC address:
16N1P6fDDbV2cLNFe5ZthMeMMZvrEHU2Ug

LTC address:
LN2T5Stvk6HNUpNCcV6dNzv9k7BoHFA9th


Creating transaction with using blockcypher

It's simply the address(es) that you want to send Bitcoins from.


How are offers matched up on Ripple trades?

Offers are always filled best first. Among tying offers, the one placed first is taken first.

Once they're placed, offers are always taken at the rate they were placed. Offers are always placed at their original rate, regardless of what crossing offers they take.

When an offer is placed, any crossing offers (existing offers in the other direction that can satisfy all or part of the new offer) are taken. It is up to the person who placed the offer whether counter-offers that tie their rate are taken.

The difference between a "buy" offer and a "sell" offer is only how the offer is placed after crossing offers are taken. For example:

If there are no crossing offers, there is no difference between an offer to buy 1 XYZ for 1 XRP and an offer to sell 1 XRP for 1 XYZ. But ...

If you place an offer to buy 1 XYZ for 1 XRP and crossing offers allow you to buy .5 XYZ for .1 XRP, the remaining offer will be to buy .5 XYZ for .5 XRP. (So, when/if your offer is fully consumed, you will buy 1 XYZ for .6 XRP.)

If you place an offer to sell 1 XRP for 1 XYZ and crossing offers allow you to sell .1 XRP for .5 XYZ, the remaining offer will be to sell .9 XRP for .9 XYZ. (So when/if your offer is fully consumed, you will sell 1 XRP for 1.4 XYZ.)


How do I start -testnet in -deprecatedrpc to test a script?

I was able to start -testnet in deprecated mode to test my script like this:
bitcoind -testnet -deprecatedrpc=signrawtransaction


Can I use run Bitcoin Core in regtest mode in v0.8.1?

Regtest mode was introduced in version 0.9.0, via pull request #2632. That is why it doesn't work in 0.8.1, as you noticed. There is no other option to run regtest in that version, although testnet3 is supported by that version so you should still be able to use that if it suits your needs. Otherwise just upgrade to a newer version which will contain performance improvements, bugfixes and newer feature support :)


Is it possible to exploit the use of the same private keys on different crypto coins?

It depends on how many times that private key has been used and whether the attacker has access to a side channel. Practically speaking if the attacker does not have access to a side channel and does not know a vulnerability in the secp256k1 curve (there are no known ones), then no, it's not practically possible to figure out the private key.


Bitcoin in RegTest throw (bad-cb-height) at block No. 500

the problem is an incorrect implementation of BIP-0034 in my code, I thought the length of height should be at least 3 bytes which I was wrong,
"Coding Enthusiast" says :
"The block height has to be pushed with the minimal number of bytes:
Since BIP-34 activates at block 500 on RegTest, this is ignored on all blocks from height 1 to 499 and from block height 500 it starts being enforced and the invalid push is rejected."
the description of the answer is here: bitcointalk.org/index.php?topic=5293244.0


why 'increasing the block size above 1 MB requires a hard fork.” actually not require fork?

The definitions here are a bit confusing. It is important to understand the distinction between the "soft/hard fork" and the "blockchain fork".

Blockchain fork is an actual split in a chain of blocks. If two groups of people run incompatible software - two different chains will emerge. For example, Bitcoin and Bitcoin Cash follow two different chains that used to be one chain.
Soft or hard fork is a mechanism of performing consensus rule changes. Hard fork upgrade has a risk of causing a blockchain fork, but it does not have to cause it. If everyone will upgrade in time, there would be no chain split. For example, Ethereum has performed multiple "upgrades" through hard forks (such as Byzantium), and the chain did not split. Bitcoin prefers to stay on the safe side and introduces most of the changes to the protocol as soft forks.

To add to the confusion there are also user-activated forks and miner-activated fork, but these are not relevant to the question.


Does Bitcoin mining benefit at all from having more video memory?

It seems unlikely. SHA-256 uses very little memory, so while I don't know a lot about GPU mining code, I would doubt that additional GPU memory would be used at all - I can't think what it would be used for.

But if you want to know for sure - since this is a simple BIOS option, why not just try it both ways and see?


Use same Electrum wallet file for new purchases of Bitcoin?

Install Electron-Cash (note the slightly different name , electron, that distinguishes it from the original electrum).

The first release of Electron-Cash had an annoying bug whereby it looked for wallets in the same folder as Electrum: this may have been fixed by now (I haven't checked), but avoid making any transactions until you're sure. You do have the option of specifying a wallet folder of your own choosing.

Once you've ascertained that you're using separate wallet folders for Electron-Cash versus Electrum, you should copy  (not move!) your old wallet file from your Electrum wallets folder into your Electron-Cash wallets folder. Make life easier for yourself by giving it a recognizable name (if the old wallet file is called default_wallet, then use some other name, perhaps BCHdefault_wallet, for your new copy).

In Electron-Cash, open your newly copied wallet (if you took the precaution of giving it a distinct name, then you'll have to specify that name in order to open it). You are now viewing your balance of BCH at an identical address/addresses to your BTC balance. BCH has built-in replay protection, so you can safely move them to some other address without accidentally moving your BTC. Obviously, the safest place to send this is an address (controlled by you) that doesn't have any BTC in it.

There's nothing to stop you from sending them to an unused address in the same wallet, but if you do that, you would then want to go to your BTC wallet (Electrum) and mark that address as "frozen" (and in the new BCH wallet you would want to "freeze" any addresses, including change addresses, that you know, from looking in your old wallet, to have BTC in them).

For any future forks, don't blindly assume that replay protection is built-in. It was for the August 2017 fork, but you'll have to do your own research next time!


Using segwit and creating Pay-To-Witness (P2WPKH) addresses

I might be understanding this incorrectly, but it sounds like the users and/or wallet custodian (coinbase, blockchain.info, etc) must create a P2SH-P2WPKH addresses in order for the witness data to be segregated and save on block space.

Correct, you first have to receive money to a SegWit address. Witness space can only be used when spending outputs received on a SegWit address. The bitcoins can be sent to any type of address from a SegWit input, though.

  Does the new release 0.13.1 default to creating P2WPKH addresses or will the users and online wallet providers have to do this manually? Will there be a built-in RPC function for creating these addresses similar to createmultisig ?

SegWit transactions created before the activation of SegWit could lead to permanent loss of funds, therefore, 0.13.1 will not create SegWit addresses or transactions by default.

→ Please consider the section Upgrade Safety in Bitcoin Core's SegWit Wallet Developer Guide carefully.


The nonce value is indeed "guessed" by the miner.

The miner can also choose a part of the coinbase transaction (what the stratum protocol calls the ExtraNonce2). Another part of the coinbase transaction is imposed by the pool: this is the ExtraNonce1, in terms of the stratum protocol.

Pools are supposed to assign distinct ExtraNonce1 to all miners, to prevent duplication of work.


are all nodes validate each transaction added in a new block?

Yes, each full node checks each transaction and block to make sure they are valid according to the network rules.


With the upcoming hard fork will there be a fixed exchange rate between Bitcoin Unlimited and Bitcoin?

If the two projects both persist, they would be freely traded one for the other. A fixed price could only be established if someone with unlimited funds guaranteed an exchange rate, which naturally can't happen because there is a limited number of tokens.

If the hardfork occurs you will have whatever Bitcoin you had on both these chain-tips.

Note, that to Bitcoin Unlimited nodes as it's currently implemented the Bitcoin chain would still appear valid, and if the latter ever grows longer after the chain split, BU nodes would reorganize back to the Bitcoin chain. This could of course be prohibited by setting BU nodes to require one of the blocks created after the chain split to be part of their longest chain.


Why I cannot get transaction from genesis block

I found answer to my question there: Why can’t the genesis block coinbase be spent?

  For some reason, Satoshi decided not to add the coinbase transaction
  from the genesis block to the global transaction database. Thus all
  the nodes in the network would reject the block.


Unexpected result after calling RPC 'listaccounts', 'getaccountaddress', 'getreceivedbyaddress' sequentially

An account can have multiple associated addresses. Presumably you had another address associated with "" beforehand, and received money using that address.

The getaccountaddress RPC call gives a fresh address. If money had been received already on the previous account address, a new one is created and associated with the account.


Is there a special name for the block currently at the head of the chain?

The Bitcoin source code refers to it as the 'tip,' e.g., UpdateTip, SetTip, ConnectTip. It's sometimes referred to as the latest block; that's not totally accurate, since the latest block is not always the tip.


I sent a bitcoin to a non coinbase email address

If you used the bitcoin network to send coins there is nothing you can do, once you send them you you no longer own them.
If you send bitcoin with coinbase with their service then you should contact their support service.


Have I lost all my Bitcoin, having sent them to a Bitcoin Cash wallet?

Keys are interchangeable on both chains. If you export the private key of the address you sent it to on the bitcoin cash wallet , and import it back into another wallet (Exodus for Bitcoin?) , you should see your bitcoins.


The inv_vect object is 36 bytes long (a uint32_t for the type of object and a char[32] for the hash). 50000 * 36 / 1000000 = 1.8 MB. I think it's a simple as that or I didn't understand you properly.


Mining Pool code changes for supporting Bitcoin Cash

This could potentially work out of the box I believe.

You don't need to worry about replay prevention, or any of that when dealing with outputs generated by mining a block. These are new outputs and they aren't (under normal circumstances) available in the Bitcoin blockchain.
The BCC client might even provide this protection by default, I don't know. But once you do a payout to a miner, they will certainly add replay prevention if they spend their BCC by default.

https://github.com/coinfoundry/mining-core/blob/master/src/MiningCore/config.json#L218

I suggest you modify the existing BTC tag (instead of adding a new coin BCC),
https://github.com/coinfoundry/mining-core/blob/master/src/MiningCore/config.json#L218

Change those lines to work with the Bitcoin Cash daemon, instead of connecting to the Bitcoin Core client. Also make sure to modify the pool address to yours.

But I want to run both bitcoin and bitcoin cash - how do I do that?
I'm not going to do the work for you, there are multiple changes required and nobody here will be able to answer you to the full extent. I suggest you edit the BTC tag just because it great simplifies the amount of explanation I have to do and allows you to test if that works before even thinking about an engineered approach. People here generally don't answer software engineering questions, let alone those that involve BCC.


Inner working of conditionals in Bitcoin Script
The conditionals in Bitcoin Script are conceptually implemented using a stack of booleans, each boolean indicating whether to execute the current opcode when iterating through the Script for each depth of the conditional (nested IF / ELSE).
To grasp the functioning, let's first consider a single-boolean conditioned execution of opcodes. The interpreter will iterate through the Script by setting the boolean to true (do execute ops) at the beginning. When encountering an IF it will set the boolean to the value of the pushed data preceding the IF, casted to a boolean (CastToBool in the reference implementation).
If this was true it will continue the execution of the following opcodes, effectively executing "the if {} branch".
If it was false, it will suspend execution until .... It encounters an ELSE! Encountering an ELSE will toggle the global boolean suspending execution. If it was previously false, it will become true and effectively execute "the else {} branch".  To the contrary if it was true, it will become false and suspend execution of "the else {} branch".
With a bit of ASCII art (fExec is the global boolean telling whether to actually execute the OPs):
Value of fExec:  true    true      true         true  true    true         false      false            ???

Script        : |start| OP_BLABLA OP_DOSOMETHING <1> OP_IF OP_DOSOMESTUFF OP_ELSE OP_DOANOTHERSTUFF OP_ENDIF

Value of fExec:  true    true      true         true  false    false       true      true             ???

Script        : |start| OP_BLABLA OP_DOSOMETHING <0> OP_IF OP_DOSOMESTUFF OP_ELSE OP_DOANOTHERSTUFF OP_ENDIF

Note how i marked the value of fExec as ??? when encountering OP_ENDIF. That's because the real implementation is slightly more complicated: in order to support nested conditionals, this is not a single boolean but a vector of booleans that are used to determine execution. That is:

OP_IF will push a new boolean to the vector
OP_ELSE will toggle the last boolean of the vector
OP_ENDIF will pop the last element of the vector

Going further
Multiple ELSE for a single IF
Note that the implementation of the ELSE being a single toggle it means that nothing prevents to toggle two times in a row. That is, you can have many following ELSE opcodes before the ENDIF. Two following ELSEs would effectively toggle the last boolean twice, hence executing the following opcodes as it would for "the if {} branch".
Therefore in the example from your question:
OP_IF <foo> OP_ELSE <bar> OP_ELSE <baz> OP_ENDIF

That's indeed <foo> and <baz> that will be executed.
Quadratic behaviour when computing fExec from the vector of booleans
The implementation of the conditional logic was modified in 2020 by Pieter Wuille to fix a quadratic behaviour found by Segio Demian Lerner.
Therefore the actual implementation does not actually use a stack for the booleans anymore, rather it stores the "top boolean" in a dedicated data structure imitating the previous implementation.
Slightly related Tapscript rule
The proposed new addition to the Script rules as part of the proposed Taproot soft fork (Tapscript) lifts the limit of 201 OP codes. This was made possible by the elimination of the aforementioned quadratic behaviour.


CGMiner does not support GPU mining anymore because it is too inefficient to mine Bitcoin with. It does not make sense for the authors to continue GPU mining support so they stopped doing so and it is no longer possible to GPU mine with CGMiner.


What is the variable in a block that holds hash of found PoW?

It is not stored. The proof of work is in the fact that the hash of your generated block should be of a certain form. It does not make sense to store it either, because you cannot trust it to be the real hash of the block and thus should be calculated anyway.


Is there a chart of all combined orderbooks?

All of the exchanges have APIs http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=155
you can create a script to keep the numbers updated with wget and a cron job
Cryptsy has a pusher API for live updates.
https://www.cryptsy.com/pages/pushapi


The "suffix" is not a fixed suffix. The number of 00 bytes needs to match the number of inputs and outputs of the transaction. Those bytes are the terminators for the key-value maps for each input and output. The automatic converter does not fill in those maps, but an empty map will still have its null terminator. So the number of empty maps (and thus the number of null terminators) will change depending on the number of inputs and outputs in your transaction.

Also, those bytes will change as the PSBT gets filled with information. It is not a fixed suffix. So as the extra data for signing for each input and output gets filled, the "suffix" of your PSBT will change.


Unfortunately Mining is a zero-sum game for the average individual at this point. If you sit and honestly think about it, who would sell a machine which literally generates profitable revenue after expenses? If you are planning to invest in the Bitcoin domain than I would highly recommend just obtaining Bitcoin and storing it in an offline wallet. This has proven to be the most profitable strategy thus far. Take for instance all the disgruntled miners who were delayed for over a year on receiving their hardware. Once they finally received their hardware it was obsolete and wouldn't even generate a profit versus electricity if being ran. Every single one of those miners wish they would've just saved their money and purchased or held Bitcoin.

If you are still curious or just interested in mining, then I suggest checking out CEX. They seem to be a longstanding and reputable company as far as the Bitcoin world goes. There has been an increase in scams lately which portray "profitable" virtual mining contracts, so please be aware of any "too good to be true" deals.


Is there a maximum factor by which difficulty can change?

The difficulty never changes by more than a factor of 4 (except for in a special case that only applies on testnet).

The code that enforces this is here.


Xemian Xchange Api for Java, returning a default of 100 market orders

The Cryptsy driver does not support this, or any kind of argument, actually.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-cryptsy/src/main/java/com/xeiam/xchange/cryptsy/service/polling/CryptsyPublicMarketDataService.java#L39

Neither does BTCE.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-btce/src/main/java/com/xeiam/xchange/btce/v2/service/polling/BTCEMarketDataService.java#L55

However, the BTCE getTrades method does support a limit argument.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-btce/src/main/java/com/xeiam/xchange/btce/v2/service/polling/BTCEMarketDataService.java#L78


RPi3 Mining Node Wallet Address Configuration

Support for the built-in CPU miner was removed in Bitcoin Core v0.13 (see https://bitcoin.org/en/release/v0.13.0#removal-of-internal-miner), so this issue is moot.

Historically speaking, the built in miner asked the built-in wallet for an address. So it was not configurable - you just had to use the internal wallet RPC to manage the funds you got out of mining.


You could check the temperature on the devices, the one active should be running much hotter than the others.

If they're all running hot the bottleneck is elsewhere (CPU or memory/bandwidth). If none of them are running hot you've bought one hell of a CPU to get 200Mhash.

Else it's advisable to check whether or not you can use the non-default videocard at all.

I'm afraid I lack the videocards to test this myself :)


Hardened address generation with BIP44 watch-only wallet with xpub

You are not deriving hardened child keys. You cannot derive hardened keys from an xpub. Just because the xpub itself is hardened does not mean that its children are.


What is the request limit number in the blockchain.info API?

Should be 1 request every 10 seconds:
https://www.blockchain.com/api/q


Generated coins can't be spent until the generation transaction has 101 confirmations. Transactions that try to spend generated coins before this will be rejected.

The reason for this is that sometimes the block chain forks, blocks that were valid become invalid, and the mining reward in those blocks is lost. That's just an unavoidable part of how Bitcoin works, and it can sometimes happen even when there is no one attacking the network. If there was no maturation time, then whenever a fork happened, everyone who received coins that were generated on an unlucky fork (possibly through many intermediaries) would have their coins disappear, even without any sort of double-spend or other attack. On long forks, thousands of people could find coins disappearing from their wallets, even though there is no one actually attacking them and they had no reason to be suspicious of the money they were receiving. For example, without a maturation time, a miner might deposit 25 BTC into an EWallet, and if I withdraw money from a completely unrelated account on the same EWallet, my withdrawn money might just disappear if there is a fork and I'm unlucky enough to withdraw coins that have been "tainted" by the miner's now-invalid coins. Due to the way this sort of taint tends to "infect" transactions, far more than 25 BTC per block would be affected. Each invalidated block could cause transactions collectively worth hundreds of bitcoins to be reversed. The maturation time makes it impossible for anyone to lose coins by accident like this as long as a fork doesn't last longer than 100 blocks. If a fork does last longer than 100 blocks, then the damage caused by invalidated transactions would likely be a huge disaster. (However, something else would have to be seriously wrong with Bitcoin or the Internet for a fork to last this long.)


What is the maximum allowed password complexity in Multibit

Internally the password is a byte array (made from the unicode representation of the characters).

The only hard limit is the amount of memory the bytes take up in the MultiBit process. If you had a password of a million characters I think it would work but a billion characters would probably break it.


Create alternative blockchain with proof-of-work

What you're asking to do here is actually the definition of forking bitcoin.
Short of doing this yourself in code, there are services such as http://coincreator.net/ that will accomplish your goal. CoinCreator allows for you to pick your proof-of-work function from a set of predefined functions.

Good Luck!


What going to happend with transactions that is in both rejectend AND accepted chains?

Tx message Rule# 8: https://en.bitcoin.it/wiki/Protocol_rules
Reject if we already have matching tx in the pool, or in a block in the main branch.


If the bitcoin address changes every time, why there is more than one transaction for an address in the ledger?

You need to differentiate between the website's wallet (Blockchain.info-wallet) and the blockchain itself.

You are allowed (by the bitcoin protocol) to make as many transactions per adress as you want.

But wallets try to make it as comfortable as possible for you and use one adress only one time so that you are acting as pseudonymously as possible.

You have probably seen an adress that has not been handled within such a "only one time"-wallet.


Lightning Network: asymmetry in the information tracked by each participant?

When two channel participants open a channel or update it, they exchange commitment transactions. These commitment transactions allow each party to unilaterally close the channel.
The commitment transactions are asymmetric in that they lock the closing party's funds when broadcast, i.e. Alice's commitment transaction locks Alice's funds, Bob's commitment transaction locks Bob's funds. The counterparty's funds are immediately available for spending. The lock on the closing party's funds (the "breach remedy") gives the counterparty time to impound the closing party's funds via a "punishment transaction" if an outdated state was broadcast.

Commitment Transaction (via Elle Mouton): Alice's output to herself (to_local) in her commitment transaction is encumbered with a Revocable Sequence Maturity Contract (RSMC) which allows her to revoke the commitment transaction later, while the output to Bob (to_remote) is a simple send, vice versa for Bob's transaction.
When a payment is made in the channel and the channel is updated with new commitment transactions, the outdated channel state is revoked by revealing the secrets to spend the old commitment transactions (dB1 and dA1 in the graphic). This makes the old state "toxic" in the sense that (accidentally) using the outdated commitment transaction to close the channel will cost the closer all their funds in the channel.
Updating a channel to make a payment in the punishment-based channel setup requires a procedure with multiple roundtrips in a specific order to ensure that there is no disadvantageous intermittent state for either party. If it were possible to map this onto a multiparty setup, it would be extremely complex.
In Eltoo, commitment transactions are shared across the participants. Broadcasting an outdated state is corrected by overwriting it with the latest state. Since the channel state is symmetric, it is trivial to have channels with more than two parties. This could take e.g. the form of four parties creating a four-of-four multisig output to anchor a channel. Each party would have a balance in the channel which they could use to send funds to another channel participant, or other network participants. With Schnorr signatures and key aggregation, such channels would be extremely efficient as they could still fit in the size of a singlesig output. Practically, the number of participants would still be limited as any channel update would have to be agreed upon by every participant, and any one participant wanting to close the channel would close it for all. Possibly, this could be used as a liquidity pool or for channel factories among large players that can guarantee continuous availability.


Where can one download Bitcoin Days Destroyed data? Alternately where to get data to calculate BDD?

For Bitcoin Days Destroyed data you can for example go there https://blockchair.com/bitcoin/charts/coindays-destroyed?interval=3m you can download the data they used in .csv

https://blockchair.com/bitcoin/ does a pretty good job at providing useful data, charts about the bitcoin blockchain

If you want to compute and made your own calculation yourself the best way would be to download the full blockchain 250giga+ with bitcoin core https://github.com/bitcoin/bitcoin and use a tool like Abe https://github.com/bitcoin-abe/bitcoin-abe to configure how the data are treated


Why can’t lightning tx’s be signed with sighash single to allow for fee updates?

Let's distinguish a couple cases:

Cooperative close

In the case of a cooperative close, the two channel partner can agree on any transaction they want. Thus, they can pick the fee rate on the spot. As the two outputs would likely not have any timelocks, either party could use child-pays-for-parent (CPFP) to bump the initial closing transaction. They could even issue an RBF transaction initially and update it later if it doesn't confirm quickly enough.

Unilateral close

The party that initiates the closing transaction has their funds locked to allow the counterparty to apply their breach-remedy if an old state was published. This means that traditionally only the counterparty can make use of CPFP to accelerate the closing transaction. This is inconvenient, because there wouldn't be a need for a unilateral close unless the counterparty were currently uncooperative.

The recent lnd 0.7.0 release notes mention that improvements were made to their transaction closing procedures to support both RBF and CPFP.


Fastest way to transfer funds from Ethereum address to Bitcoin address

Use an exchange that trades both BTC & ETH.
Bittrex, ShapeShift, Coinbase, Poloniex, etc.


Where is the code that receives blocks that miners have just solved

Look in main.cpp at the ProcessBlock function. The meat is in the AcceptBlock function in the same file.


Bitcoin Core, as of 0.10, has a fee estimation RPC call, which you can read more about here: http://jonathanpatrick.me/blog/floating-fees .

If you don't want to run Bitcoin Core, there are other third party services that provide simple API calls to estimate fees as well, like the Chain Endpoint on BlockCypher's API: http://dev.blockcypher.com/#chain-endpoint (Full disclosure, I work there/am biased)


Is there a bot or service that buys a diversified portfolio of altcoins on a schedule?

You should be able to modify zenbot to do this. I have not used it , please use it at your own risk. It will essentially hook you up to one of the exchanges. You will need to figure out the top 10 ,perhaps using an external service or one of the API's for volume. All in all , i feel it is a risky proposition in a highly volatile market.


How does BIP 0070 work for me, the user?

Right now with bip-0021 it is possible to define bitcoin URIs to make payments like this:

bitcoin:1JfzSVJV44AALQrNrLCehznQLvbhUcr5mB?label=tip-erasmospunk

so if you put this URI in an HTML anchor:

tip me!!!

and click it the bitcoin wallet opens and it is preloaded with my bitcoin address together with the label "tip-erasmospunk".

One of the problems with this approach is that when I pay, it will take many seconds until the transaction propagates properly in the bitcoin network and the merchant receives it (we are talking only about the merchant seeing the transaction, not about conformation that can take many minutes). So if you want to pay the metro ticket, you need to do it as fast as possible.

So with bip0072 the above URI scheme is extended with the r parameter that points to the merchant's server. The wallet ignores the other parameters (address, label, etc) and speaks with the server by using the bip-0070 Payment Protocol. This protocol allows the merchant to receive your signed transaction directly from you and confirm the transaction faster.

The faster transaction times are one of the benefits, here is the full list:

Human-readable, secure payment destinations-- customers will be asked to authorize payment to "website.com" instead of an inscrutable, 34-character bitcoin address.
Secure proof of payment, which the customer can use in case of a dispute with the merchant.
Resistance from man-in-the-middle attacks that replace a merchant's bitcoin address with an attacker's address before a transaction is authorized with a hardware wallet.
Payment received messages, so the customer knows immediately that the merchant has received, and has processed (or is processing) their payment.
Refund addresses, automatically given to the merchant by the customer's wallet software, so merchants do not have to contact customers before refunding overpayments or orders that cannot be fulfilled for some reason.


Bitcoin nodes advertise their services with the nServices bitmap. The first bit is NODE_NETWORK which indicates whether a node will be able to serve all blocks to other network participants.

Pruning nodes do not signal NODE_NETWORK, because they do not have a complete copy of the blockchain. They will however return any requested blocks they have in storage. As the minimum pruning size is 550 MB, they will be able to serve at least the last three days worth of blocks.


How multi-signature wallets comunicate with each other?

The final transaction that gets broadcast to the network, just like every other Bitcoin transaction, is public.  This is safe because signatures do not reveal any secret information.  In the case of multisig wallets, when one wallet adds its signature and then sends it to another wallet, it doesn't matter if anyone is eavesdropping.  It would be perfectly safe to send the partially-signed transaction in the clear.  After all, when subsequent signatures are added, it will all be made public anyways.

That said, there can be privacy implications about whether you wish to let the world know who you are doing multisig with.  In that case, establishing secure channels for communication becomes important, as well as making sure the addresses/public keys used are not somehow associated with your identities.


How do I prevent lnd from participating in new channels?

You can set the option --maxpendingchannels=0 to disallow peers to open channels to your node.


This is a misconception and applies to everything based off Bitcoin's UI for the functions.

The bar at the bottom of the User Interface is not the "time to sync".  It's stating the last day/date (and how far in the past) the last synced block had on it.  Your client hasn't yet imported the rest of the blocks, so in a while it'll say 1 year or such.

That should decrease and reduce in the "how far in the past is the last synced block" value rapidly, as your computer churns through the blocks and imports and processes them.


Access my wallet using a 16 digit passphrase

Unfortunately, that 16-digit passphrase is likely the password to decrypt your bitcoin core wallet.dat file. So you'll need to have that file in order to access your wallet.

It could also be a BIP-38 protected paper wallet, but it doesn't sound like you have one of those.

Your best bet may be to search every email inbox, dropbox account, backup hard drive, or whatever else you may have, for either a backup of your wallet.dat file, or evidence of an account with an online wallet service.


FPGA/ASIC with general SHA-1 and SHA-2 capabilities

You could possibly buy some FPGA miners.  The ASICs can only do Bitcoin's specific hash function, and won't be of any use for your research.


Looking at this diagram of OP_CHECKSIG steps and the Bitcoin Script wiki, OP_CODESEPARATOR is used to make OP_CHECKSIG check only part of the scriptPubKey. Essentially, only the script that goes after the last OP_CODESEPARATOR is used to sign the transaction and hence evaluated by OP_CHECKSIG.

In theory, a spending transaction could change the part of the scriptPubKey before the last OP_CODESEPARATOR  of the input transaction.

However, there's a problem. Since scriptPubKey comes from the input transaction, you can't actually modify any part of the scriptPubKey (even the part before the last OP_CODESEPARATOR) without changing the input transaction hash. Changing the input transaction hash breaks the link for any transaction trying to spend outputs from the unspent input transaction, making it impossible to use OP_CODESEPARATOR in practice.

I wasn't able to find any cases in practice where people have successfully used OP_CODESEPARATOR for a useful purpose, although it does show up in the blockchain. See this, this and this (and the thread you referenced) for core developers commenting on or discussing possible uses for OP_CODESEPARATOR.


Would an increased blocksize lower the stress of the stress tests?

There's a few things going on here:

Saying that there are 9000 unconfirmed transactions is not a particularly good fit for how node memory pools work. Not all pools contain the same transactions, not all nodes have the same rules for what an acceptable transaction is. Operators are free to modify parameters that alter this on a case by case basis, and memory pool contents will not be retained across a restart.
Increasing the block size is not a solution to spam transactions on the network. If you keep making the limit higher there is no reason in the world people won't produce transactions to fill the space. Fee prioritization forces spam to have larger fees than other users which limits how much they can create for a particular budget, the price for a user to get above the spam is in the order of a couple of US cents.
Miners don't have to include any transactions at all if they don't want to. Some are paid out of band to include specific transactions in favor of others, some choose to only include fees above a threshold, some refuse to include free transactions at all, some choose to ignore transactions with specific properties. Not including intentionally spammy transactions that bloat the UTXO database is a desirable property, where it would be harmful to all network participants if miners mindlessly included all that have been broadcast.

"Stress test" is a bit of a cover term, the event you are referring to is a denial of service attack. If there was knowledge to be gained it would be happening in a testing environment, not being announced with the intention to disrupt use of the network.


Transfer Bitcoin from between two different wallets

thank you for that question and all legitimate wallets work in transfer of bitcoins just by sharing your wallet address,it doesnt matter what kind of wallet your using,what matters is having bitcoins.


The second option proposed by Willtech above would work well. Simply sign a message using that private key and that will prove that you are in possession of the private key corresponding to that public key. As mentioned in the answer it doesn't ensure uniqueness of the actual key, but it does prove that at the time of signing the message that you are in control of the key.


Why does each block store a Merkle root?

Merkle roots do not verify transactions, they verify a set of transactions.  Transaction ID's are hashes of the transaction, and the Merkle tree is constructed from these hashes.  It means that if a single detail in any of the transactions changes, so does the Merkle root.  It also means that if the exact same transactions are listed in a different order, the Merkle root will also change.

So the Merkle root is cryptographic proof of which transactions are in the block, and which order they are in.  It provides a convenient piece of information to be included in the block header which is then hashed and included in the next block header.  Without the Merkle root in the block header, we would have no cryptographic proof of which transactions are included in a block, nor proof that their contents haven't been tampered with.

Using a Merkle tree is preferable over a hash chain or a hash of concatenated transactions because it allows for a much quicker and simpler test of whether a particular transaction is included in the set.  For more details, see the section on Merkle trees in the Developer's Guide.


How to find a block containing a transaction using transaction hash only?

The transaction does not know the block in which it was integrated.

https://en.bitcoin.it/wiki/Protocol_specification#tx

There are many services around like blockchain.info or blockexplorer.com which stores the blockchain and have indexed all transactions, which you can search.


Get a JavaScript notification when Bitcoin transaction arrives to a certain address

Usually you do this on the wallet service you are using. They provide server-to-server notification callbacks when the address receives transactions. Then you parse this transaction  and let your on server to notify JavaScript clients.

EDIT: SoChain offers no-authentication, WebSockets, API to monitor Bitcoin addresses in real-time. You can use this on cliet-side JavaScript directly:

https://chain.so/api#realtime-balance-updates

I don't know if any pure client-side JavaScript APIs exist with notification feature - you always need to set up webhooks to some server, or be directly connected to bitcoind.

Also there is the issue of confirmation level - when you consider the transaction to be received, how many confirmations you demand for it. You'll usually end up getting several notifications per each new confirmation.

I have done this in my open source project Liberty Music Store using blockchain.info.

For inspiration, see the relevant blockchain.info webhook code which then forwards this information to JavaScript through Redis pub-sub listener pattern (though in this case it does using HTTP long poll instead of WebSockets for Android 2.3 compatibility):

https://github.com/miohtama/LibertyMusicStore/blob/master/tatianastore/blockchain.py#L110

https://github.com/miohtama/LibertyMusicStore/blob/master/tatianastore/static/main.js#L102

https://github.com/miohtama/LibertyMusicStore/blob/master/tatianastore/signals.py#L28

https://github.com/miohtama/LibertyMusicStore/blob/master/tatianastore/storefront.py#L253


transaction malleability "attack" vectors

Point (6) does not eliminate this source of malleability. Rather, point (2) of BIP62 disallows all three modifications you suggested. BIP62 describes the problem:

  Non-push operations in scriptSig Any sequence of script operations in scriptSig that results in the intended data pushes, but is not just a push of that data, results in an alternative transaction with the same validity.

And the proposed solution:

  Non-push operations in scriptSig Only data pushes are allowed in scriptSig. Evaluating any other operation makes the script evaluate to false. See reference: Push operators.


I have received 0.00000001 BTC random payment and the status symbol is a pentagram?

These were received from addresses starting with "1Enjoy" and "1Sochi", right? A lot of people got these today (including me). It is a part of some ongoing spamming effort of sorts - I wouldn't be too concerned with it.


I have two answers:

quick answer on how to airdrop 1,000,000 alt-coins:
put it onto accounts in exchanges or cold wallets or whatsoever, and wait for the costly infrastructure to establish, so coins can be used. If it shall be decentralized, wait even a bit longer, cause it seems highly unlikely, that these countries themselves are willing to provide the required infrastructure.

longer answer might be:
to airdrop 1mio alt-coins to Africa or South-America, one would have to distribute the coins to people who register themselves to be a citizen of the corresponding country. Or how can one control correct distribution? As Bitcoin and many alt-coins have a problem with registration, this is the first hurdle, and seems to make the question redundant. Secondly the benefits of this 1mio alt coins only come into play, if people can use it. To use it, you need the infrastructure, which is mostly inexistant today. Whereas many people have telephones in these countries, the infrastructure seems to be too expensive to support the massive potential user base. And as many people in these countries don’t want to pay taxes or even transaction fees for the required infrastructure, it might most certainly not happen. Disclaimer: I am in West-Africa, and have derived my conclusion from local observations … So it is also highly questionable, if this is a general statement for all mentioned countries :-)

I come to see, that Bitcoin and crypto is a technology, which in a first step can provide financial freedom (yes, if you are wealthy enough). It was not designed to save countries, which are deeply broken/corrupt in their minds. Crypto technology can not help to reduce limitations or incompetences of men or women - in any country. Only people within the country have the power to save a nation, not technologies (on the other hand, men with technologies like guns and bombs can easily destroy a country). Crypto is not a technology to give money to the poor, or even to save the poor world from its poverty. At least I don't find such a statement in the original docs. However I find links to the 2007/2008  problems of the first world's financial system, why it came to birth.

In general this question has a bigger potential to run into a discussion, which cannot be discussed here in stack exchange. It might be better raised on bitcointalk.org - just my two comments ...

Oh, and the last sentence:

  Too much thought goes into building out services for people like you
  and I who don't really need it...

this sounds like an accusation. The people which are referenced by you change or create "their" world, how they would like it to be. If they need it or not - they have mostly the liberty to decide themselves, and if they develop something, then they usually do it for a profit. And I haven't seen, that someone in poorer countries is willing/able to pay for their labour/work... But from time to time they spend their money to poor countries in a form of investment aid, or even free code, so that people in poor countries can develop something on their own, that would help the poor countries. So as such I would like to turn this around and say: use this invitation of free code, develop something which fits the needs of poorer countries, cause people in the first world don't see, what is required in Africa and South-America. It is up to the people in the mentioned countries, to drive the necessary change! I would like to close with a famous sentence from Immanuel Kant on (im-)maturity:

  Enlightenment is man's emergence from his self-incurred immaturity.


Are transactions in a block decided by mining pool operator?

technically each individual miner can choose the list of transactions
  except for coinbase transaction. Is this correct?

Technically it is possible. In fact no one do it. Pool operator assembles a list of transactions and miners only calculate sha-hashes. They do not know block contents.

  or do pool operators dictate the full block contents?

Yes


Can I use an old Pentium 4 desktop for mining if I upgrade it with a good GPU?

With a decent enough GPU (or GPUs), your machine will be a fine miner. The only spec that ACTUALLY matters for mining is the GPU. RAM, CPU, etc don't have much of an impact.


How does the Bitcoin network maintain the chains created when two nodes generate different versions of the same block?

Both blocks are indexed and stored. The extending block which was received first is represented as an array element with links/pointers to the headers of the strong chain: Chains are represented as arrays with links pointing to headers in the store.

The second block is now considered part of a “candidate chain”, of which there can be many with different heights. The tip of each branch emanating from the strong chain is the tip of a candidate chain. A candidate chain can be potentially extended to form the strong chain if it accumulates the most POW. At this point, the strong chain array elements are popped to the forking height, and the new candidate chain headers/blocks are pushed on the strong chain array/stack. The popped elements of the strong chain are pushed to a candidate chain array in respective order.

Since the number of candidate chains is unbounded, it may not make sense to organize them individually to store, but keep a them as a separate data structure (tree). Furthermore, given the cost of auch branches at current chain heights, they tend to be short. The risk of reorg is most likely with the “2nd” highest chain, so keeping this in persistent store can optimize for faster reorgs if the node is restarted (other indexed candidate chains in memory are lost and need to be rebuilt, but less likely to overtake strong chain). Of course, an implementation can persistently index an arbitrary bounded number of candidate chains depending on design objective.


How to fork Bitcoin and build own cryptocurrency

To start a new chain, use a genesis generator, apply the new genesis to the source, and remove the checkpoints.

If you want to apply new/different rules, be prepared for a difficult task.  Changing even the slightest protocol rule will most likely affect all other rules because of the complexity of PoW.

If the only thing you want to alter is the maximum coins, this should be relatively easy to alter in the source.


What percentage of Bitcoins are held by exchanges?

was wondering how much is held by exchanges vs. hard wallets

It's not possible to know for certain how much bitcoin is currently held by exchanges as it is trivial to create pseudo-anonymous addresses and it is generally good practice for an exchange to not disclose their addresses.

  how does someone with a hard wallet sell their Bitcoin?

By "hard wallet", I assume you meant hardware wallet instead.

A hardware wallet is usually used to interface with software installed on an online machine to sign transactions. The key advantage with using a hardware wallet is that the private key (if properly implemented) never has to leave the device. Once the transaction is signed, then software on the machine connected to the internet may broadcast the transaction to the bitcoin network.


Do you have to keep broadcasting transactions until mined?

But this doesn't make sense to me... I assumed that transactions must
be mined in the next block, since your transaction also includes the
hash of the previous block in order to prevent double-spending. Is
this assumption correct?

This is not correct, the transaction does not reference blocks, it references outputs. A block references the previous block.
To answer your question, no, you only have to broadcast your transaction once. In some cases that the mempool is too large, nodes might start deleting transactions from their mempool starting with the ones with the lower fees. In that case if your set fee is too low you might want to rebroadcast it.
Miners of course cannot mine the same transaction twice because as you said a transaction spends the input coins and therefore you cannot spend them again.


The BTC arrived within an hour or so.  A little scary, but it worked. The above link never shows that Crypto-bridge send the funds, so I guess they convert it and generate a new transaction.


How do I configure the Bitcoin client for SSL on Windows?

You can not connect with PuTTY as bitcoind only listens to RPC-JSON commands.

Anything that can send over the HTTP(S) protocol is fine. See the JSON-RPC class for PHP.

Assuming that you want bitcoind to accept remote RPC-JSON calls, you would need to setup your bitcoin.conf file like so:

rpcuser     = randomUsername
rpcpassword = strongRandomPassword
rpcallowip  = ipOfAllowedHost
rpcssl      = 1

Then, navigate to your data directory .bitcoin and generate a self-signed certificate. Do not enter a password when it prompts you for one.

openssl genrsa -out server.pem 2048
openssl req -new -x509 -nodes -sha1 -days 3650 -key server.pem > server.cert

Restart bitcoind and test the SSL functionality. You should see the certificate details, pressing enter twice will return a HTTP/1.0 401 Authorization Required.

openssl s_client -connect localhost:8332

That's it, bitcoind will now accept RPC-JSON commands through through HTTPS.


What happens if everyone disconnected from the blockchain

Computers are not connected to the blockchain.
Computers running Bitcoin software connect to a few other computers that are running Bitcoin software.
Each of these computers keeps its own copy of the blockchain if they are what is known as a full-node. For example any computer running the "Bitcoin core" wallet software is a full node. So even if they don't communicate, this blockchain data is not lost. The old transaction data is still stored on many thousands of computers.

No node ever needs to trust any other. Each node that has a copy of the blockchain can use it to check that new blocks are correct.


How to reduce the amount of transactions with handling wallets?

Since your service will control the wallet it is not necessary to do the actual transfer out of the wallet to the service, just show the user a lower balance and do not let them spend or withdraw more than this. This means that your service will have to maintain strict control of the private keys. Also, if you maintain a backend float BTC balance, you can show the user an increased balance immediately without waiting for a return transaction to process. To do this, effectively you will need to control all addresses used by your service. This amounts to virtual wallets.

A note on security, there have been previously several high profile services which hold a balance for users, which have been hacked so you will need to ensure your entire security regime is "A" Grade across your entire organisation.


NoClassDefFoundError when using Java Coinbase API

Well the problem is that the Coinbase Java Api depends on the Jackson JSON processor, along with several other dependencies that can be found here, and I'm assuming that the jar that you download didn't come with all of these dependencies packaged inside it which means that they won't be on your classpath just because you've added the coinbase jar. You could either try to resolve these dependencies manually, which would be incredibly tedious and unnecessary, or you could use a build automation tool. Considering that the Coinbase Java API was built with it in mind I would recommend setting your project up to use Maven.


How would a P2P "Collective Transaction" be implemented (to increase privacy)

Dark Wallet is probably the closest to actively implementing something along these lines in a client.

See:

https://wiki.unsystem.net/index.php/DarkWallet/Alpha#Mixing

  When sending, the transaction is sent to an internal mixer, that
  starts announcing on the coinjoin channel, if another peer answers,
  both will negotiate a shared transaction that includes both peers
  inputs and outputs. If successful the final transaction will be sent
  into the network.

  You can see how a transaction from the mixer looks
  https://blockchain.info/tx/c38aac9910f327700e0f199972eed8ea7c6b1920e965f9cb48a92973e7325046

And also the multisig section that follows:

  Multisig funds are special bitcoin addresses that can be spent from
  only by a number of participants signing the transactions. This means
  accounts can be held among several people or devices, and several
  signatures (above some threshold) will be needed to spend.


You cannot generate public key from a bitcoin address. From bitcoin address, all you can get is the hash160. Following reference, this can be done through base58 decoding, going from Step 9 -> Step 8. So you get same output as from Step 4 along with checksum at the end.

Basically you have two alternatives:

If you have the private key, generate the public key and use importpubkey
Use importaddress