text:
how do you sign and verify a message that you own a bitcoin address using javascript?
Is there a bitcoin library or even just pure javascript way of signing and verifying you own a btc address?

bitcoinjs-lib and bitcore-lib are both javascript libraries that allow for key signing.
For example with bitcore-lib:
var Message = require('bitcore-message');

var privateKey = new bitcore.PrivateKey('L23PpjkBQqpAF4vbMHNfTZAb3KFPBSawQ7KinFTzz7dxq6TZX8UA');
var message = new Message('This is an example of a signed message.');

var signature = message.sign(privateKey);

EDIT: To also include the verification example from bitcore's github.
var Message = require('bitcore-message');

var address = '13Js7D3q4KvfSqgKN8LpNq57gcahrVc5JZ';
var signature = 'IBOvIfsAs/da1e36W8kw1cQOPqPVXCW5zJgNQ5kI8m57FycZXdeFmeyoIqJSREzE4W7vfDmdmPk0HokuJPvgPPE=';

var verified = new Message('This is an example of a signed message.').verify(address, signature);

how do you verify it?

https://github.com/bitpay/bitcore-lib/blob/master/docs/examples.md#verify-a-bitcoin-message

Here's an example with BitcoinJS in the Blockchain.info wallet:
Sign: https://github.com/blockchain/My-Wallet-V3/blob/master/src/address.js#L260-L273 (ignore the code that refers to secondPassword)
Verify: https://github.com/blockchain/My-Wallet-V3/blob/v3.28.6/src/helpers.js#L441-L443

https://github.com/bitcoinjs/bitcoinjs-message


text:
Can someone explain what is a mining RPC?
I just read about this update.
What does a mining RPC mean and stand for?

RPC stands for Remote Procedure Call and it is a technology that allows you to perform actions on a machine being on another machine (or on the same machine but in a different process).
The new RPC calls from the update are calls related to Bitcoin mining. Most mining software will use these calls to get information from the bitcoind client running on the same machine.
So, nothing to do with crypto, just an extension of the API you don't have to worry about.

source: Stack Exchange

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

sort: votes


text:
how to calculate the inputs to raw transactions?
I'm wanting to send a raw TX, but i don't know how to come up with some of the parameters to the commands. What goes into the commands, what commands get used, and how to calculate anything that needs calculating. I know this needs to be done in the bitcoin command-line/console.

I don't understand.  Are you trying to make a raw transaction yourself or are you trying to use a command-line tool written by someone else to do it?  Which tool?

Bitcoin-Qt or BitcoinD, the official programs. A raw TX is a transaction made by hand.

What have you tried so far?  Did you find the name of the command to run?   Did you find the documentation?

The structure of a transaction is documented in the tx section of the Bitcoin protocol specification.  To make the inputs, you need to find outputs from previous transactions that have not been spent yet, and you need to write a little script to unlock each output.
The script that you write will run first, and it will put some data on the stack in the script's execution environment.  Then the script that was embedded into the transaction's output will run, and it will evaluate whether your script supplied the right data.  The scripts of the outputs generally are pretty simple and only follow a couple of standard forms, so if you can recognize which form it is then you should be able to come up with an input script that satisfies it.  You might look at the isStandard function in Bitcoin Core to understand what scripts are standard.  The Solver class used there is problably the class that generates an input script for an output script; essentially it solves the puzzle of producing data that will be accepted by the output script.
I think if you follow the links above and look into it you should be able to figure out what is going on.

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


text:
BAMT Lan - Qualcomm Atheros AR8171
I got the the new MB http://www.asrock.com/mb/Intel/H87M/?cat=Specifications which comes with Qualcomm Atheros AR8171 Lan, and unfortunately BAMT 1.2 does not have a driver for it included.
Does exists the way to install the missing driver, does the driver exists at all? I'm totally new to Linux and don't know even how to open command line in BAMT.
I use USB boot image from: https://litecointalk.org/index.php?topic=2924.0
If there no option to install the driver, can I use USB to LAN adapter without additional headaches, or I will need to install the driver to?

Having same problem, internet is empty from solutions

sorry i meant to comment.. now how do i erase it

At the end I ended up, by buying the USB to Ethernet adapter that has Linux support in specifications, and it just works :)  http://www.alibaba.com/lan-adapter-jp208b-manufacturers.html

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question.

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.

Found the answer here:
http://forums.debian.net/viewtopic.php?t=105858#p506223
worked beautifully for me..


text:
bitcoind 400 bad request - what's wrong with this code?
As per this code sample, I'm attempting to make a .net httpwebrequest from my local machine to a local bitcoind -daemon server. However, I'm only receiving a 400 bad request at webRequest.GetResponse().
I am completely stumped as to how to proceed - is there anything obviously wrong with this code? I have the bitcoin.conf file set up with the below username and pass, and it is set to port 8332. These are the ONLY settings I've set in the bitcoin.conf. I'm a noobie in both web requests and the Bitcoin api, so I suspect it's something stupidly obvious.
For a little more information, when I manually navigate to localhost:8332 in the browser, the credentials I use in my program work, and the web page returns:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

Here is the code that makes the request:
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://127.0.0.1:8332");
webRequest.Credentials = new NetworkCredential("blah", "blahblah");
/// important, otherwise the service can't desirialse your request properly
webRequest.ContentType = "application/json-rpc";
webRequest.Method = "POST";

JObject joe = new JObject();
joe.Add(new JProperty("jsonrpc", "1.0"));

// serialize json for the request
string s = JsonConvert.SerializeObject(joe);
byte[] byteArray = Encoding.UTF8.GetBytes(s);
webRequest.ContentLength = byteArray.Length;
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();

WebResponse webResponse = webRequest.GetResponse();

I'm reading the bitcoin source, and there are a few things that can cause the rpc service to come back with error 400. Could you post the full response text that your program gets?

As far as I can see, you aren't actually calling a method. Duplicating your request as best I can with curl (curl --user user --data-binary '{"jsonrpc": "1.0"}' http://127.0.0.1:8332/) gets me a "Missing method" error, which could be your problem, though I'm not remotely familiar with the Json.Net library.


text:
How do I show my wallet from the command line?
How can I show/open my wallet in gui-less linux version? I tried to show the contents with cat but it's only binary data (which makes sense). The --help option of bitcoin/bin/64/bitcoind also doesn't give me a hint.

Direct command-line access via bitcoind is not available any more. You can get access from the command line via the RPC (Remote Procedure Call) API, e.g. with python. The API calls list is found here.
To give a specific example, you can access wallet information via the Python RPC API. Given that the client was booted with rpcuser=user and rpcpassword=pass, the sample python script illustrates how you can call the getbalance command:
  from jsonrpc import ServiceProxy

  access = ServiceProxy("http://user:pass:8332")
  access.getinfo()
  access.listreceivedbyaddress(6)
  print access.getbalance()

This needs updating, it doesn't work anymore.

@erikvoid Updated to reflect the current state of things.


text:
Can a closed source wallet ever be completely trust-less?
Open source Bitcoin wallets are clearly in demand for obvious reasons. Users want to know what the code is intended to do and what may be possible.
Is it even possible for closed source wallets to be completely trustless (meaning I do not need to trust anyone other than myself to keep my Bitcoin secure)? How can this be verified without seeing the source code of the hardware or software wallet?

The term trustless is often misunderstood. I suspect you mean not needing to trust anyone, but if a program being open source helps for that, aren't you implicitly relying on the people who are capable of reviewing the source code to have actually done so? Isn't that also a form of trust? Of course it is. Every production system needs to trust various aspects of the infrastructure: the hardware it's running on, the compiler that was used, the operating system, and last but not least the human operating it.
The trust we're talking about in "trustless" is an abstract technical term. A distributed system is called trustless when it does not require any trusted parties to function correctly. In that sense, a "trustless wallet" does not make sense: wallets are an implementation aspect of a cryptocurrency, the design of which may or may not rely on trusted parties. The wallet software being open or closed source doesn't change this.
Does that mean you should use a closed-source wallet? Hell no. Not because it's "trustless" or not, but because there is no chance it'll have been sufficiently reviewed (unless, perhaps, you have access to the source code under NDA and paid for thorough review yourself).

Thank you. You understood the meaning of my question and improper use of the "trustless" term. Your answer is what I was looking for.

No because bitcoin wallets always have access to private keys and have the ability to communicate across the Internet.  With this combination of capabilities,  closed source wallets could become attacked (either by an insider or an outsider) in a manner that would be unknown to the user.  The biggest concern would be a key stealing/ exfiltrating module that would relay private keys to a malicious party.


text:
How to get the Public Keys of a bitcoin User
Is there some way in which I could get the public key of a Bitcoin user ?
Lets say I have transaction with another Bitcoin user. Is there some means by which I can retrieve the public key of the Bitcoin address they used in our transaction?
How does https://slock.it/ guys does it ? From where do they get the public key from ?
https://www.youtube.com/watch?v=-Ht23KXic1k

What direction did the transaction go? There's a difference whether the address' balance was spent, or it only received bitcoins.

You cannot compute the public key of an address (that is not yours), because the address is computed from the hash of the public key.
You can find the public key of your own address with the Bitcoin-QT debug window or with a validateaddress RPC call.

Sounds like OP is asking about getting the public key AFTER a transaction has happened. Then it IS possible to get the public key from the transaction, or multiple public keys depending on how many inputs were used.


text:
What are some compelling reasons to use Electrum?
I currently use Bitcoin-qt on OSX and I'm considering switching to Electrum.
What are the advantages and disadvantages to using Electrum over another Bitcoin client?
My two major concerns are security and ease of use. Is Electrum safe / trustworthy as a client?

Why Electrum?

Instant on: Your client does not download the blockchain, it uses a remote server.
Forgiving: Your wallet can be recovered from a secret seed.
Safe: Private keys are never sent to the server. Information sent by the server is verified using SPV
No downtimes: Several public servers are available, you can switch instantly.
Ubiquitous: You can use the same wallet on different computers, it will auto-synchronize.
Open: You can export your private keys into other Bitcoin clients.
Tested and audited: Electrum is open source and was first released in November 2011.

http://electrum.org/tutorials.html#why-electrum


text:
Load a transaction with bitcoinj
I am developing simple Bitcoin application using the bitcoinj library: The user enters the hash of a transaction and my application should return detailed information about that transaction.
How can I load that transaction? Is there a function like peer.getBlock() for transactions?

BitCoinJ is a Simplified Payment Verification (SPV) client library
This means that it only downloads the headers for transactions, and only those that are relevant to the private keys contained in its wallet only. This greatly reduces the blockchain download (very quick to get started), but at the cost of not seeing all the other transactions (reduced overall network security).
So, in short, you can't download an arbitrary transaction through BitCoinJ.
However, to answer your requirement have you considered just using the Blockchain.info API?

Well how does then bitcoinj downloads relevant transaction from it's peers ?  Isn't it possible to ask peers to get particular transaction ?

@PavelNiedoba Here's a link to more details on how SPV works: https://multibit.org/en/help/hd0.2/how-spv-works.html


text:
Why is DiabloMiner using so much CPU now?
DiabloMiner uses about one 50% of CPU on my system (distributed among 2 cores). I could have sworn that it used almost no CPU (1-2% max) in older versions, but I'm not really sure if I should report this as a bug or not. So, is it normal, or am I correct in remembering that GPU miner should not use more than 1-2% of CPU while mining?
Link: Possibly related question.

I'm surprised you just didn't ask me directly.
It sounds a lot like you're suffering from one of two CPU use bugs in the driver. Catalyst 11.7 through 11.11 (using any SDK) use 100% CPU time on one or more cores because of a faulty sleep, and SDK 2.2 and 2.3 (using any Catalyst) also have the same exact issue.
However, Windows has a third variation of the bug, if you set -f too low (ie, kernel work size or kernel execution time exceeds a predefined amount), it can also trigger Windows into stating the CPU is being used 100%, however this does not seem to be a driver bug and is a bug in Windows itself.
Edit: My answer was strictly for AMD hardware. If you're on Nvidia, Nvidia is aware of the bug (it happens on any OpenCL app), but they have not yet fixed it.

One of your CPUs is spin-waiting for the GPU to finish work units. Generally, GPU drivers have two options to wait for the hardware: either suspend the process until an interrupt is generated, or poll the GPU whether it is finished in a tight loop. It seems your driver is using the second approach and thus takes 100% CPU of one core.
The advantage of polling is that there is less latency than with interrupts, for example when doing real-time work on the GPU; but in case of a background process like mining which hardly requires CPU intervention, sleeping would be a better option.
It might be that ATI changed this in recent drivers. In CUDA this is an option when creating the compute context (SCHED_AUTO/SCHED_SPIN/SCHED_YIELD) to choose the waiting method, but alas, I know of no such option for OpenCL.

This makes sense. Is is possible to change this setting in either NVIDIA or ATI driver, or is this only the privilege of driver makers?

It almost certainly is related to the question you linked and it almost certainly has the same answer I'm sad to say. There is a lot of this going around and no one is really certain what exactly is causing it.
There have been reports that ATI's 11-7_vista64_win7_64_dd_ccc_ocl drivers often bring the problem about, and reverting back to an 11-6 version seems to fix it. Not sure if it will work for you or if it even applies to your situation but it's worth a shot.

Curiously, I'm experiencing the same on NVIDIA card (yeah, not seriously into mining), so I guess the problem is in OpenCL instead of in manufacturer's drivers themselves.


text:
Can the Bitcoin network be used for cracking?
I'm assuming that the Bitcoin economy is rapidly building a computing cluster capable of unprecedented amount of hash searching.
Would it be possible for an attacker to leverage this to crack other systems?
E.g. could an attacker input password hashes into transactions and then deduce useful information from the output of miners with regards to hose hashes?
(I'm not asking about the security of Bitcoin as such, so I don't think it's a duplicate of [1] or [2])
[1] Could mining calculations be used to crack private key?
[2] How long would it take a large computer to crack a private key?

related: Bitcoin Mining ASICs used for cryptographic application? Rainbow tables?

Uhm....so someone says definitely not and the other explains a how to method ! is it a yes or a no simply?

@Bannaz: It's a "no" for all practical purposes. The example that dionyziz provides is rather academic, and has no practical application.

Also remember that the security industry has been trying to eradicate the use of SHA256 for password hashing in favor of "memory hard", adjustable algorithms like bcrypt, scrypt, and pbkdf2.  This shift is primarily because of the existence of special purpose SHA256 hardware (aka, asic miners), so it actually is a side effect of the Bitcoin network.  Still, that's not using the network directly.

Short answer: no.
Long answer:

Blocks are exactly 80 bytes long. When have you ever seen an 80 character password?
Blocks start with a bunch of null bytes in the version field. Again, when have you seen that in a password?
Each miner is mining a different block. You don't know the merkle root of what they're mining because that contains a hash of a secret address.
Bitcoin uses SHA256(SHA256(x)) as a hash function, which is not very common in password hashing.
Miners won't publish their results unless they solve a block. They only solve a block if it starts with 12 zeros (at time of writing). The odds of your hash starting with 12 zeros is 0.000000000000003034%.

While you cannot use the bitcoin mining power itself to crack selected passwords, bitcoin makes it for the first time possible to encode and ensure monetary rewards for password cracking through self-enforcing contracts.
For example, you could lock up funds in a transaction that are redeemable only provided that a specific puzzle has been cracked. This can be written as a bitcoin script (scriptPubKey) which takes as input a candidate solution to the puzzle (as scriptSig) and checks that it is a solution. In formal languages lingo, given a language L = { x: R(x, w) = 1 } such that R is polynomially computable (and so R being in P and L being in NP), you can solve the search problem of finding a w given an x in L by encoding R as a scriptPubKey and expecting a w as a scriptSig.
As an example, imagine you wish to find the pre-image of a given SHA256 hash. Your bitcoin redeem script could then look like this:
def spend(witness):
    if SHA256(witness) == 6fe28c0...00000:
        return True
    return False

Indeed, the only way to spend this script is by providing a witness that cracks this problem. In formal languages lingo, in this case x = 6fe28c0...00000 and w is the witness.
Coding it in the bitcoin script language, we get:
OP_HASH256
6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000
OP_EQUAL

In fact, this very transaction was published on the bitcoin network four years ago and paid 1 BTC to have this puzzle solved.
Interestingly, notice that if the puzzle remains unsolved, the money is forever lost – that money is solely dedicated to the puzzle solver, and if there is no one, then no one can get the money. As a sidenode, notice that this kind of transaction is not secure, as the puzzle solver will have to disclose the scriptSig in order to spend the tx – meaning that anyone can double-spend the same amount immediately before the original tx gets confirmed. There are ways to guard against such attacks by performing more complicated schemata, such as revealing the secret in a two-block process possible in Ethereum.

So this means you can pay any amount you want to get each password cracked (or does it have to be 1 BTC)? Can this be used to solve bcrypt hashes too? Should we watch for these "evil transactions" and stop them somehow?

Any amount is possible. In generalized scripting languages (such as Ethereum's), you can encode any puzzle, including bcrypt. It's impossible to "stop these evil transactions", because that would require lack of censorship-resistance and therefore some sort of centralized control.

The processing done by miners is a very highly specific, yet random operation. It could not be reused for a general purpose operation looking for a specific answer.


text:
What exchanges offer trail orders?
Trail orders are extremely useful, much more so than simple stop loss orders. Are there any exchanges that offer trail orders?
Using a trail order, the stop price would track the market price as long as it goes in the same direction, but not if the market price moves in the opposite direction. For example, say BTC is bid 250 USD and I place a trail stop (sell) order for 10 USD below the bid price. Here's what happens if BTC moves:

start => my trail order will have a stop of 240
BTC bid 260 => my trail order will have a stop of 250 now
BTC bid 265 => stop 255
BTC bid back to 262 => stop 255 stays in place
BTC bid 268 => stop 258
BTC bid 263 => stop stays 258
BTC bid tunnels down to 255 => market SELL order triggered as soon as the bid went <=258

As of June 2013, Tradehill does not offer stop orders.

possible duplicate of Which exchanges offer stop-loss functionality?

@StephenGornick nope, he clearly said it's not the same thing.

This answer needs an update. As of 2017, the following exchanges support trailing stop orders:

Kraken - fees up to 0.16% - 0.26%
Bitfinex - fess up to 0.10% - 0.20%
Bitstamp - fees up to 0.25%

However, there's an important warning to be heeded: by placing trailing stop orders with any exchange, you expose yourself to very short-lived price spikes that are not reflected anywhere else. Here is a screenshot from Kraken where the three red dots represent trades triggered by the price falling by 25% for a minute, only to shoot back up immediately afterwards. The trailing stop didn't offer any protection here; on the contrary, it caused a loss.

This is simple to achieve with an API (offered by most exchanges) and a bot. It is not foolproof as rapid price movements may escape it, but it is probably good enough. However, I do not know of such bot.

Bitstamp now do offer trailing stop orders and okcoin offer trailing orders on BTC futures, they don't seem to offer trailing on spot orders.
14th January 2015

Currently none for virtual currencies.  You may want to contact each exchange you are comfortable with and ask them if/when they intend to install that.  I have done similar with some FOREX programs ( using the pretend cash ) with success and have yet to see more than just straight buy/sell at this point.  The virtual currency exchanges are still in their infancy and could use some prodding to get up to speed with the tools that FOREX traders currently have available.


text:
What determines SHA256 performance on different types of hardware?
I know the answers to many questions on here briefly touch on this point, but I'd like to get a consolidated answer that really touches on the key differences between different types of hardware which allows SHA256 to perform better, instead of the less-related tangents other questions discuss. While my immediate concern is with Bitcoin, I know that some other crypto-currencies use different algorithms, so feel free to reference them if it helps make your point.

Why does the Bitcoin hash algorithm, SHA256, perform better on different types of hardware? What makes an ASIC/FPGA capable of computing more H/s than a GPU, a GPU than a CPU, etc?
What is "the complexity of the cores?" Is this a reference to the number of cores, or to the actual die complexity? In both cases, why is this not a factor in SHA256 performance? Referencing David Perry's answer here:

It's important to note, by the way, that the one thing that won't buy you more hashes per second is the complexity of the cores. This is why Nvidia may make great cards for gaming purposes, but they suck for mining - games make better use of exotic new instructions than SHA256 does.

Can SHA256 be optimized at all to perform better on a per-architecture basis? Can any optimizations be made to the double-hashing process?

Mining performance can be viewed as consisting of two factors. One is the total resources available. The other is what fraction of those resources you can usefully apply to mining.
ASICs and FPGAs excel at mining because you can effectively use a very high fraction of their available resources for mining. CPUs are terrible at mining because a huge fraction of their resources are useless for mining -- they're optimized for memory access, decision making, floating point math, and many other things that don't help with mining at all.
The "complexity of the cores" refers to how sophisticated the operations that the cores can do are. This doesn't help with mining, which only requires very simple operations, and thus just increases the fraction of the resources available that you can't use for mining.
SHA256 can be heavily optimized for every architecture. In the early days of mining, there was a huge "arms race" to micro-optimize mining for various architectures.

If I may, and this might be a little off but its around the right idea.
Continuing with Mr. Scwartz's answer.
Another major important role in H/s is OpenCL and CUDA. Each provide a means of communication/a protocol between manufacturers so different hardware can interact more readily. So as Schwartz said you need to utilize the computing power (resources) of the chip for it to be useful. OpenCL and CUDA allow software to utilize many different hardware pieces at once. So some of the steps to do mining might be performed on the CPU while others are performed on the GPU. Thanks to OpenCL, you can easily call one function and it will utilize the resources it has avalible. (I am not saying OpenCL has a function doHash() but more of something along the lines of if(elegantWork) useCPU; else if(bruteWork) useGPU;)
Also the computers machine language architecture would play a big role. The ISC (Instruction Set Computer) is a computer with a defined set of instructions its processor can perform. So there are many kinds. RISC, ARM, etc (Idk many of them or much about there differences) But certain ones have instructions that are useful to mining and some have ones that are not. There circuits in some chips that try to guess the future, so if it sees you are gonig to execute a branching statement, it might try to work ahead on each branch and then once it knows it will drop all others and continue on the right branch. Well there might not be a need for that in hashing, so the part of the chip is useless to us if we want to hash.
ASIC's and FPGA's are chips (Integrated Circuits) than are designed specifically for mining. They have circuits only that they need to hash, and a lot of them, and throw out the rest of the regular stuff. Thats why an ASIC is only good for hashing if that's its application (it only "knows" how to hash). FPGA is a Field Programmable Gate Array, it is a bunch of multi purpose gates (circuits) on a chip that can be programmed to do a specific task (like hashing), but it still has some other stuff there that is not useful; the other stuff is there so that it can be general purpose. (People write software so it utilizes resources good, HardwareDescriptionLanguage HDL describes physical circuits and it used to write code that will program FPGA's; So if you get a FPGA and want to mine, you have to find a HDL program that you can use to burn/write the chip with to do the hashing algorithm, then you run software that makes use of the circuits you just wrote to the chip)
So any given chips performance can be determined by, the instructions it can process, how well it can process those instructions, and how efficient it is (if you care). Since there is a myriad of unique problems in the world, that means we try to create a myriad of unique IC's with a myriad of abilities.


text:
Bitcoin API - How can I identify new incoming payments?
Good afternoon,
I am struggling a bit to receive Bitcoin payments at my online store. So far, I have installed bitcoind in my system and created a set of receiving addresses, and now I face the problem of checking for new payments.
I am using the following resources:

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
http://code.gogulski.com/bitcoin-php/class_bitcoin_client.html

I would like to make a cron job that searches for new payments and stores each one of them into a relational database, each transaction identified by:

Transaction ID
Sender's address
Amount as a 64-bit integer

Everything is pretty easy but I can't find an efficient way of extracting the new incoming transactions from my bitcoin daemon. For instance, I am able to extract the balance of each address, but I don't find a feasible way to obtain a collection of incoming transactions with all required data. This creates a further problem because I don't want to process transactions twice.
Which is the best way to do it using the API?
Thank you very much.

If you want to identify incoming payments, the recommended way is creating a new receive address for every request. When the confirmations of a transaction to a given address get high enough, you can consider the payment confirmed.
Using the 'sender address' does not give you reliable information - it can only identify (one of the) addresses that were previously in control of the coins. There is no guarantee that these correspond to the sender of the payment (it may be a webwallet with shared coins, for example).
Not reusing addresses also has other benefits, like making bitcoins as a whole less easily traceable.

Hi Pieter! For what I've seen, the first input is always the sender address. Am I right? My app needs to send back a certain amount of bitcoins as well -as a confirmation-.

Bitcoin does not have sender addresses. A transaction consumes coins, and creates new coins from them - possibly assigned to new addresses. You can see the incoming transaction, check which previous outputs it consumes, check which addresses those were previously assigned to, and use the first of those as a 'sender', but that only tells you an address that controlled the coins, not who sent them (which is a problem when the sender uses a shared webwallet, for example). This is bad practice as it also encourages address reuse. If you need to send coins back, ask for a refund address.

Hi Pieter, thanks a lot for your answer. I might just do that. As a technical sidenote, how does the website "Satoshi Dice" do that? It sends back the coins to the right address by checking the first input, right?

Yes, unfortunately. This results in a lot of unnecessary traffic, address reuse (which decreases privacy in the system for everyone), and doesn't work for people using shared wallets.

Hi Pieter! I understand. I am concerned about creating a new address for each payment, because I haven't found a way to "delete" receiving addresses, which would create junk in my bitcoin wallet. I prefer having just one receiving address, checked constantly. I should then check the wallet for new transactions using listunspent function. Right?

hi flaab, what method did you end up using?

Raw transactions provides the information about the Inputs ("sender addresses", as you refer to them).

http://en.bitcoin.it/wiki/Raw_Transactions

In that is ListUnspent which will give you all the Transaction Ids, output addresses ("receiving address") and amounts.  From that you can compare against your list to tell which are new.

Hi Stephen, thanks for answering. Sorry but I don't quite understand the concept of unspent transactions. What is an unspent transaction? ;-)


text:
Can the outputs of a transaction change over time?
I would like to know if the outputs of any given transaction can change over time. For example, suppose I send a payment to three different addresses creating an unconfirmed transaction with several outputs:
Output 0: Address1
Output 1: Address2
Output 2: Address3
Output 3: Address4
Output N: AddressN

If I examine that same transaction two or three months later, can the outputs index association have changed in any way? For example, could Address1 have becomed the Output3? Or is that information deterministic in itself?
Thank you.

No. A transaction is composed of a sequence of inputs and outputs in a specific order. This data structure is hashed and makes its way to the Merkle root and block header, and thus if the transaction were to change, all the blocks that follow would be invalidated.
It's possible that a fork with a different transaction double-spending the same inputs would usurp the chain you originally observed (less likely the more confirmations it has); and the status of these outputs can of course change from unspent to spent.


text:
When will a block not be forwarded?
I'm currently trying to detect blockchain forks and I noticed that even when dumping all blocks I get to a separate file I seem to miss a few.
Specifically I'm looking for the blocks marked as orphans in blockchain.info/orphaned-blocks in my dump and I'm missing quite a few.
Now I'm wondering whether nodes stop forwarding blocks that they believe to be orphans (because they currently have the concurring block as their blockchain head)? Shouldn't all concurring blocks be distributed?

Blockchain.info stores information in a database, it does not show only the information that is currently in it's Bitcoin. It is connected to many nodes, so it may see information your Bitcoin doesn't, and will store data after a normal Bitcoin client would discard it.
Bitcoin uses a basic rule "I'm going to use the first block I receive as the current best block". The duplicate numbered orphaned block was usually broadcast too late to everybody. If the "unpopular" later block is somehow the one that is next built upon, there will be many requests between clients for the correct blockchain up to the new block.

A block is only relayed when it is part of the (new) best chain. If a second block at the same height as current best tip is received, it is not considered the new best, and thus not relayed. The reason for this is simple: it doesn't help for achieving consensus (=getting the world to agree on which block at a given height is the one considered correct). Any peer receiving the second block at a given height would already have the first one as well (since that got relayed too), and wouldn't consider it valid either.


text:
Lock BTC amount for a while
I am working with the blockchain wallet API and my workflow is something like this: whenever the user wants to buy BTC from me, at that time, whatever the amount is added by the buyer, at that time that particular amount will be locked from his account, and after a while that amount will be released and transferred to another user.
Is there any way to implement this?

Hi and welcome to Bitcoin.SE :) I've voted to close this question as too broad, because you seem to be asking about how to implement an entire payment system of some sort rather than a specific question.

No, @MeshCollider i already implemented the transactions systems but i want to add some security concerns so to do that i am bit stucked

In that case you'll have to clarify your question to make it more specific, because as it stands I don't understand what exactly you are asking. Sounds more like a programming question than a bitcoin question.

@MeshCollider... i asked specifically like there will be buyer and seller are there in my site so when seller user go for sell BTC that time from that BTC amount will be locked for a while then his BTC will released and credited to buyer's account.

It sounds like this is a programming issue dealing with credit in accounts in your software's database. It wouldn't need to touch the blockchain until you want to make a transaction on that. Perhaps stackoverflow is a better site to ask about the programming side of things? Or are you trying to put the time lock into the Bitcoin transaction?

I like to  put lock into the Bitcoin transactions.

You're users are not in control of the private keys, so you do not need to lock them via the Bitcoin protocol. This is just a simple permission feature you should build into your system using a database. If a user "buys from you" then update a field in your database for that user, for example the database field could be called locked and then you would have it changed to true.  Then make sure that you build your system to check this field is false every time prior to withdrawal.


text:
Bitcoin core closes inbound connections every 10 minutes
I noticed that Bitcoin core will close incoming connections every 10 minutes. Wireshark captures [FIN, ACK] are received from the node. It looks like Bitcoin core is monitoring the connection time. Nodes are disconnected when their individual connection time is 10 minutes. The maximum number of connections is 256.
Bitcoin core source code is too difficult for me to understand. I can't find a reason and conditions when and why Bitcoin core behaves like this.
Can someone explain this "10 minutes behaviour"?

This sounds like a bug, or platform incompatibility. You may want to report this on https://github.com/bitcoin/bitcoin/issues.

It might be worth checking if maxuploadtarget is enabled. There is a hard "600 second" period in computing whether nodes should receive any historical data: https://github.com/bitcoin/bitcoin/blob/070eaf7fe5920f1fd1dc68e5afa352411d958bb4/src/net.cpp#L2735. This leads to a reverse phenomenon from what you describe (nodes can get no data for exactly 10 minutes and then some data), but it might be worth looking into. bitcoin-cli getnettottals will show you the current status.

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


text:
How does Proof of Burn work?
I have been trying to make a comparison between PoW, PoS and Proof of Burn. While I understood the other two, I want to know how exactly Proof of Burn helps in attaining the consensus.
One burns coins by sending it to an address where it cannot be spent, is what I understood.

But why would one "burn" the coins? Isn't it a loss for the person burning or getting rid of some coins?
How is the consensus achieved for the next block in the chain?
How is it beneficial in comparison to PoW and PoS?

My apologies, I have read a lot about Proof Of Burn but I am still not able to comprehend.

Do you recieve any different transaction fee for the transaction heading to be burned?

Attention: Ambiguity!
Note that the term (or abbreviation) "PoB" can be used differently. For example, some cryptocurrencies allow users to get some of their coins for provably burning money in Bitcoin, essentially deriving their values from Bitcoin's value by deriving their scarcities from Bitcoin's scarcity.

Yeah, but what about my question?
The idea behind these consensus strategies should be pretty obvious: Find something that:

is hard to do.
is easy to verify.
enforces a linear history.

PoW is trivial, you know it of course: Find a hash that's smaller than a given value.
PoB can be done in such a way that you send out a transaction which burns some of your money. If you burn the most (possibly combined with other criteria, a lot of proposals factor age of the coins in; not necessarily much of your money), you win. Others will mine (I use the word "mine" because "burn" could lead to confusion.) on top of your block. You, yourself, can take transactions of other miners burning their coins and add them to your block, meaning that you burn their coins if you win. Of course, you need a way of others telling you your transactions. Sounds hard at first, I mean why would they give you transactions to put into your block, burning their money. However, it's pretty obvious why they would to this: It's necessary to tell others about the transactions burning their money in order to propagate their block. So you receive blocks burning other miner's money, try to burn your own money on top of that block's parent, burning that other miner's money, too. If your block burns the most money, you win and get the block reward.
PoS, on the other hand, tries a lottery approach. There is a certain amount of money at stake and the bigger your share of that money is, the higher your chances of winning. It's like lining the coins of everyone up, say, there are n coins in total, all numbered from 1 to n. Then, a random number r ∈ [1, n] is drawn. The owner of coin r wins and gets the block reward and possibly the money the others risked (or it's burned, or something else).
PoS can use PoW to draw that random number. For example, whoever gets the lowest hash h of the previous block + a nonce until a certain point in time gets a minor reward. Then, r := (h mod n) + 1.
Of course, these are just the basic concepts + examples. There are a lot of variations and everyone has an idea which according to them is better than the previous ones. The above should, however, make the differences clear. If it didn't work out to do this in so little text, feel free to ask or read it up in the Bitcoin wiki:

https://en.bitcoin.it/wiki/Proof_of_work
https://en.bitcoin.it/wiki/Proof_of_burn
https://en.bitcoin.it/wiki/Proof_of_Stake

With proof of burn, instead of pouring money into expensive computer equipment, you 'burn' coins by sending them to an address where they are irretrievable. By committing your coins to never-never land, you earn a lifetime privilege to mine on the system based on a random selection process.
the more coin you burn more chance to mine the block.this is being served as the alternative for proof of work but it also using unnecessary resources and mining will be more favoured to those who burn more coin.
proof of burn is being followed in slimcoin which is based on peercoin.

Think of the burning Bitcoin to create XCP in such a way: You take $1,000 of 20 dollar bill to the US Treasury Department, and US Treasury Department burns it, and mints 250 notes of 4 dollar bills for you.

And then you realize that 4 dollar notes don't exist so they must be counterfeit?


text:
Adding libraries to Makefile.am
I am trying to add already existing library below to dash source code :
Jerasure
I have included all the source and header files in a directory 'jerasure' inside 'src'.
In the Makefile.am , I have added the below lines:
libbitcoin_server_a_SOURCES = \
  jerasure/cauchy.c \
  jerasure/galois.c \
  jerasure/liberation.c \
  jerasure/reed_sol.c \
  jerasure/timing.c \
  jerasure/encoder.c \
  jerasure/decoder.c \
  jerasure/jerasure.c \
 $(BITCOIN_CORE_H)

Headers are added as below:
BITCOIN_CORE_H = \
 jerasure/cauchy.h \
 jerasure/galois.h \
 jerasure/liberation.h \
 jerasure/reed_sol.h \
 jerasure/timing.h \
 jerasure/jerasure.h

I am getting the error :

src/Makefile.am:324: warning: variable
  'jerasure_libbitcoin_jerasure_a_SOURCES' is defined but no program or
  src/Makefile.am:324: library has 'jerasure_libbitcoin_jerasure_a' as
  canonical name (possible typo)

I have used Makefiles before, and I have been trying from sometime to get accustomed to Makefile.am idea, but not able to figure out how to get this to work.
I am able to compile this on my macOS, but not on Ubuntu 16.04 LTS.
Please help me understand what should I do in order to get this library to be used.
If there is a way to compile this as a library, that would help too.
But right now

I want to import the Source or Header files in to already existing CPP
  files and be able to use the functionality.

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


text:
How to setup stratum with pushpool and VARDIFF? (litecoin)
I'm trying to setup a pool for litecoin mining with support of the stratum protocol and VARDIFF (variable difficulty).
I read the answer of cdecker on the following question How to setup pushpool. This was quite helpful. I managed to setup pushpool and everthing is running quite well (at least I can see CGminer connected and doing something).
I'm just stuck in setting up startum and VARDIFF. I was searching through boards, but I can not find anything that is related to my problem. The only approach I read on bitcointalk was to use "rpc.target.bits" : 18 instead of "rpc.target.rewrite" : true in server.json to adjust the difficulty, but no success :(
For VARDIFF I can not find anything at all.
Any help would be very much appreciated!

It is not in the pushpool package, that's true, but it can be added custom. I'm asking for any ideas how to do this.

Update? Any luck on this @Aley? I'm looking for a solution that can match stratum's difficulty and pushpools.

i have come back to post up all the information i can for you.
through the last few months of working with Stratum-mining i have come to some conclusions: you need to know python well to get this working on anything but bitcoin... That being said, its possible to install stratum over a current custom pushpool installation through a project I released and am working on. (Currently it is for freicoin but there are two trivial changes you can make to get my implementation to work on litecoin). There is also another implementation of stratum-mining that you can use that was last updated on Jun 6 2013 (i would suggest using this versus my code if you are installing from scratch or using MMCFE currently. my version of the code is designed to be more friendly to version 2 getblocktemplate, where as litecoin only supports getblocktemplate version 1 at this time).
In the future it may be extremely useful to diff these two implementations as they have different database schemas...
In the mean time,
Here's how to install stratum-mining-litecoion a NEW system OR a system with MMCFE
step 1) back up your database
step 2) back up your database
step 3) back up your database
From https://github.com/Neozonz/stratum-mining-litecoin/blob/master/INSTALL
"
> Installation Instructions
> =========================
>
> Step 0. Install litecoind     NOTE: Litecoind currently only supports
> getblocktemplate version 1. This code was changed to support version
> 1.    Set it up and start it!     Downloading the blockchain can take a few hours to a couple days!
>
> Step 1. Install the stratum core  git pull
> https://github.com/slush0/stratum.git     sudo easy_install stratum
> (or if using alternate python: sudo /usr/local/bin/easy_install
> stratum)
>
> Step 2. Pull a copy of the miner  git pull
> https://github.com/moopless/stratum-mining-litecoin.git
>
> Step 3. Configure the Miner   cp conf/config_sample.py conf/config.py
>   make your changes to conf/config.py     Make sure you set the values in
> BASIC SETTINGS! These are how to connect to litecoind       and where
> your money goes!
>
> Step 4. Run the pool  twistd -ny launcher.tac -l -    OR - using
> alternate python  /usr/local/bin/twistd -ny launcher.tac -l -
>
> You can now set the URL on your stratum proxy (or miner that supports
> stratum) to: http://YOURHOSTNAME:3333
>
> Database Setup
> ========================= Table Creation: Tables are auto-created if they don't exist (I will be adding a schema file later)
>
> None: Well, this doesn't do anything, so there is nothing to set up
>
> Sqlite: THIS IS THE DEFAULT! Just set the file path in the config file
> (or keep the default.) Support for sqlite3 is built into recent python
> versions. A couple notes for Sqlite:
>   - Sqlite and threading/concurancy just doesn't work right for that reason it is disabled.
>   - Since threading is disabled, The server will "pause" when archiving happens, this will affect         your miners. However this will not happen
> often (24 hours after finding a share)
>
> Postgresql:
> 1. Set up your parameters in the config file.
> 2. Install the postgresql libraries in your os:   Redhat and the like:        yum install postgresql-libs postgresql-devel    Ubuntu and the like:
>       apt-get install postgresql postgresql-devel
> 3. Install the python bindings    easy_install psycopg2
>
> Mysql:
> 1. Set up your parameters in the config file.
> 2. Install the mysql libraries in your os:    Redhat and the like:        yum install mysql mysql-devel   Ubuntu and the like:        apt-get install
> mysql mysql-devel
> 3. Install the python bindings    easy_install mysql-python
> 4. Create a database and user.
>
> Problems????
> =========================
>
> Is your firewall off? Is litecoin running?
>
> TODO: are there other problems?

"

If you are already using pushpool and a custom frontend and don't want to write over your system, i have a working (but a bit buggy with MBPM due to the nature of my project) "install over" version of stratum mining for freicoin available here https://bitbucket.org/joeswhite/joes-stratum-mining-freicoin/src/8eec8a0b11c6?at=master
this is how to install my version (DO NOT INSTALL THIS VERSION UNLESS YOU HAVE EXPERIENCE CODING!), there is an added step for the litecoin implementation but it is not yet tested by me.
"

> stratum-mining Basic implementation of bitcoin mining pool using
> Stratum mining protocol. This fork includes a database implementation
> for: None Sqlite Mysql Postgresql Basic worker stats are provided (and
> updated) See the INSTALL file for install instructions. For more info
> on Stratum: http://mining.bitcoin.cz/stratum-mining. Original version
> by Slush Updated version by GeneralFault (Tips Welcome:
> 15Zk7DoFYJ7hESpZzmix1WLkomTMGW81c2 ) This version by Joe White
> http://pool.cr.rs (freicoin mining pool) Joe's Stratum Mining Freicoin
> Implementation of generalfault's
> https://github.com/generalfault/stratum-mining that works with Mark
> Friedenbach's https://github.com/freicoin/stratum-mining This
> installation can be put directly over top of your current pushpoold
> Known bugs: Does not handle subscriptions properly upon connection,
> but properly pushes block template and everything submits without
> issue To do: add Joe's Pool front end in to implementation
> (simplebtc's implementation heavily modified) add firewalls, security
> services, add google authenticator, add other things like tripwire.
> how to: Easy: download vmware image go to town make sure to set up any
> and all firewalls, security measures, and other information. manual:
> first download freicoin from freico.in/downloads install freicoin edit
> your freicoin.conf file change the rpc port for security (i like to
> mix it up on each server i use) nano .freicoin/freicoin.conf something
> like this works (freicoin.conf file): server=1
> rpcuser=changethisusername rpcpassword=changethispassword rpcport=4252
> rpcallowip=127.0.0.1 test to make sure freicoind works once you are
> sure of that, then get the git package git clone make the stratum log
> directories mkdir /stratum mkdir /stratum/log/ touch
> /stratum/log/stratum.log recurse in to the directory and edit
> conf/config.py MAKE SURE TO READ AND CONFIGURE ALL SETTINGS!!!! I HAVE
> DISABLED PLUG AND PLAY FOR YOUR SAFETY/SECURITY nano conf/config.py
> ALWAYS BACK UP BEFORE STARTING ANYTHING!!! YOUR DATABASE COULD GET
> SCREWED! I CAN NOT BE HELD LIABLE FOR ANYTHING, ESP THAT! import the
> database if you are starting from scratch (it is not standard and is
> not optimized, you could opt to make your own database and edit
> DB_Mysql.py (or corresponding database) and edit anything that is a
> sql execution (anything that has "select * from, or any other sql
> statements can be easily updated without changing most or anythign on
> the server side schema.sql <- THIS IS THE SCHEMA FOR THIS
> IMPLEMENTATION OF joe's THIS SCHEMA IS NOT OPTIMIZED AT ALL! ALWAYS
> BACK UP BEFORE STARTING ANYTHING!!! YOUR DATABASE COULD GET SCREWED! I
> CAN NOT BE HELD LIABLE FOR ANYTHING, ESP THAT! start a new screen so
> you don't log out and stratum crashes (this is helpful for logging
> too) screen

"

*litecoin specific step
At this point you need to go back and write over (at very least) the halfnode.py block_template.py and coinbasetx.py files with the files provided in stratum-mining-litecoion. most likely you will need to write over all of them. (This is the untested part i was talking about).

"

> ./startjoes.sh it should load up and work, you will see one error on
> submission at this time it is okay this error does not affect any pool
> performance, it is tested working. please update this as there are
> many probable errors. I have included the sql architecture for this
> implementation as it is not standard and can plug-and-play over an
> existing pushpool implementation ALWAYS BACK UP BEFORE STARTING
> ANYTHING!!! YOUR DATABASE COULD GET SCREWED! I CAN NOT BE HELD LIABLE
> FOR ANYTHING, ESP THAT!

"

I am trying to get an implementation up today or tomorrow and can report back any changes i need to make then.
Please let me know if this was a satisfactory answer, if not. I will update this until it is. Thanks for not bashing me ;)

You may want to try this version of stratum:
https://github.com/ahmedbodi/stratum-mining
https://github.com/ahmedbodi/stratum
Which come with litecoin parts built in.  Also you may wish to consider a currently maintained pool as pushpool is not maintained according to the bitcoin wiki:
https://en.bitcoin.it/wiki/Software
I would recommend either P2Pool if your a beginner, and if you have a bit more experience then try Eloipool.

authors: коля галахов


text:
In what sense does the security model of proof-of-stake require users to "log on to the internet every few months"
This is primarily a question about something I heard Vitalik Buterin say in an interview the other day. (Unchained podcast's January 9, 2018 episode, at 34 minutes, 15 seconds) I quote:

As far as the cons [of proof-of-stake], I would say the main one is that it is a different security model. It’s a different security model that basically says that, in order to securely authenticate the blockchain, you have to log on to the internet at least once every few months. And if you don’t do that, then in order to bootstrap yourself to the chain again you basically have to trust some group of people who have. And I think that in reality this is a totally fine security model because people basically already trust this security model for software updates.

I don't understand this quote. The way I understand it is that, regardless of proof-of-work (PoW) or proof-of-stake (PoS), a person has two choices: Run a full node, or run a "lite" node where you trust a third party node.
If you run a full node, you have to download all of the chain before you can create new transactions. If you run a lite node then your balance and transactions are dependent on the third party, but you don't have to wait to download the chain. It seems to be that way both for clients of both PoW and PoS blockchains. So I don't see how the consensus algorithm is relevant. The only explanation is that I'm completely misunderstanding the quote, so I'm hoping that someone can shed some light on my misunderstanding.
Note: This question is not asking if PoW is better or worse than PoS. I just want to understand the quote. Thank you.

What Vitalik is talking about is the Slasher algorithm that he designed which punishes the block signer if he attempts to create a fork in the blockchain. However the way that slasher works is that there will be basically a timeout; if a fork is detected during that timeout, the signer that created the fork loses his money. But after the timeout, he does not. This is so that he can actually spend the money at some point.
The problem with this is that once the timeout has passed, the signer can then create a fork without being punished. This is known as a long range fork. This fork, if it survives, can grow and, at some point, could be longer than what you have synced up to. In that case, because of how PoS works, you could end up switching to using the forked chain instead of the real chain. So to avoid that, you need to go online routinely to keep your blockchain up to date so that in the event of a long range fork, you are still using the correct blockchain.

Putting this recent tweet storm here for reference: https://twitter.com/VitalikButerin/status/1029900695925706753
"We realized that we could deal with long range attacks by introducing an additional security assumption: that clients log on at least once every four months (and deposits take four months to withdraw), and clients simply refuse to revert further than that...It feels like a trust assumption: you need to get the blockchain from some trusted source when you sync for the first time..."


text:
Is the mtgoxlive depth chart information accurate?
Mt. Gox publishes live data which is available at mtgoxlive.com.  The chart includes the current market price as well as a depth chart of existing bid and ask prices, which I assume is compiled from the order book of each account with the exchange.  However, orders are allowed to be placed on Mt. Gox without having available funds in ones account to actually make a trade.  If the depth chart reflects these unfunded orders, they would make the chart steeper than it should be.  Of course, the depth chart may also not reflect trades which people have the funds and intention to make but haven't yet placed in the order book.  In sum, does the mtgoxlive depth chart reflect unfunded orders, and in any event, how useful, accurate, or predictive is it?

And then there are Dark Pools. I suppose they don't show up in the charts at all.

Thilo, what do you mean Dark Pools? Do you mean bots that only play market price when the prices hit the price they want?

Unfunded orders obviously don't show up in the orderbook. I assume that mtgoxlive is based on the same data provided by the API so it is probably accurate.
If you really want to know, just compare the market depth from mtgoxlive with the ones shown at bitcoincharts and clarkmoody.


text:
What values are hashed in the SHA-256 algorithm, and what would be the next iteration until a possible header is found?
I've been doing a lot of reading on mining and software related to mining but I can't quite get my head wrapped around the specific nature of what is being hashed together. So far I feel like the current block header, and a nonce are hashed together in hopes of finding a hash that is less than the current target, if it is, you get 25BTC. Here's where I am confused, according to the psuedocode https://bitcoin.stackexchange.com/a/3047 . The only value that changes is the nonce, and that is a fixed possible hex/integer ex: from 0 to 0xFFFFFFFF.
How is it that the difficulty can increase if there are a finite number of attempts to change the nonce?
Am I right about hashing together the block header with the nonce?
I referenced this https://en.bitcoin.it/wiki/Proof_of_work and it makes perfect sense.. except for the fact that I still feel like the nonce is the only value that changes.
Maybe the 32-bit nonce yields way more possibilities that I can fathom and hashing together every possible nonce value is actually what is done.
Thanks!

When the nonce range is exhausted, miners change the extraNonce field of the generation transaction. This changes the Merkle root in the header and allows a new range of nonces to be attempted.
Since the Merkle root is 256 bits, this can be repeated indefinitely.

Don't the transactions in the block also change the hash? So, whenever you add another transaction couldn't you just start over at 0 with the nonce?

@Murch: Of course. But getting a new transaction is generally rarer than exhausting a nonce range.


text:
How can I calculate the breakeven price for buying and reselling on cryptocurrency exchange?
Assume that one side of the position will be charged the TAKER fee (0.25%), and the other will be charged the MAKER fee (0.10%).
I have tried using this formula, but when selling at the break even price, the result does not sum to zero.
Marking up the MAKER & TAKER fees:
Break Even Price = Buy Price * 1.0035.

Sell Rate = (Fee + 1) / ((1 / Buy Rate) - (1 / Buy Rate) * Fee)

Key:

Sell rate = Minimum sell rate required to break even
Buy Rate = The rate that your initial trade is made at
Fee = The fee that binance charges (generally 0.1 if your starting out and don't pay fees in BNB)

By ´Buy Rate´ do you mean the Bitcoin price, or the amount purchased, or the amount divided by the price?

Let's say the price of one ₿ is $1235. If you bought it for $1000 you'd have (1000-(1000*0.005))/1235 = 0.805668016 units of ₿. But when you put it through the equation, you're left with $1005, which is $5 higher than break even. Am I missing something here?

There are two issues with your calculation:

You are assuming that you are both a Maker and Taker (either maker when buying and Taker when selling, or taker on the buy and maker on the sell) which could be true, but might not always be the case
You are calculating both fees based on the Buy Price (which is not accurate because the corresponding maker/taker fee is a percentage of the selling price too).

Your calculation only makes sense if you are being charged both maker- and  taker-fees and your buyPrice == sellPrice. Which will never be 0 because if you are buying and selling at the same price then you lose out on the fees.
If both orders were maker orders your calculation would be:
Break Even would be when: (sellPrice * (1 + maker)) - (buyPrice * (1 + maker)) = 0
If the buy was a maker order and the sell a taker order:
Break Even would be when: (sellPrice * (1 + taker)) - (buyPrice * (1 + maker)) = 0
You would need to extend these scenarios for all 4 possible permutations of the maker/taker fees.

But how do you know the sellPrice in advance?

You don't need to know sellPrice necessarily but you can use the equation to calculate the sellPrice. Using algebra you transform the equations to be in the form "sellPrice = ..."

How do you do that?


text:
Is the bitdigger chrome extension fraud?
Today, while I was watching a video on YouTube, I found the video on the bitdigger extension that mine bitcoins with chrome browser. I just want to know if it is fraud or legit? Is it possible to mine via JavaScript?
Edit: My computer is always turn on, let's say at least 20h in a day. Is it bad if I leave bitdigger run in a part?

I just want to know is it fraud or legit?

I have never used it. But: It's not profitable. Big mining pools use ASICs to mine bitcoins. In the past, people used GPU. But mining in your browser means mining with CPU which is completly unprofitable as you will probably never be the first one with a hash of 20 zeros but you'll waste energy.

Is it possible mining via Javascript?

Yes. There is Coinhive. They offer a script you can implement in your website. And if a user with activated Javascript visits this site, the mining starts. But it's not bitcoin what is mined. It's Monero because it's much more profitable.

no, this is totally fake.it only generate number not generate satoshi because bitcoin mining process used internet to create pool, but in bitdigger if you disable internet from router then mining process not stop, so i think this totally fake. don't install it...

..This is very imformative and at the same time very disappointing for me, cause im a user of bitdigger for almost three months. that's why i shifted to pool mining. it's really fishy right now for me cause i checked their site and Monero (XMR) is the only one they "include" in their offers and i can't see any Bitcoin either.

I checked bitdigger extension.. and gauss what? they mined Monero. If bitdigger is not fraud then I think after you have mined 0.005xmr (as mentioned in extension) and they convert XMR into BTC and maybe transfer to your given wallet.


text:
Another Unconfirmed BTC transaction
Sorry guys & gals - yet another "unconfirmed BTC transaction..".
Looks like the fee was too small, but this was sent 72 hours ago now (at the time of writing)
https://blockchain.info/tx/f81760ebe76ad0e64374ee3d243f0549fe809d61285c5631c01def84848dcdb2
Do I just need to be more patient?
Edit:12/06/16 - It has been over 120 hours now, are there any options for me to retract the transfer and re-submit with a higher fee?

First of all tell me which bitcoin wallet you are using to store and make transactions ? It is showing the size of transactions too high than expected. But don't worry, be a patient person, it will be confirmed soon.

Yes be more patient. In the future you can use this app or others like it to determine an appropriate fee for faster confirmation:
https://bitcoinfees.21.co/
"Which fee should I use?
The fastest and cheapest transaction fee is currently 50 satoshis/byte, shown in green at the top.
For the median transaction size of 226 bytes, this results in a fee of 11,300 satoshis (0.04$).
What are the fees shown here?
The fees displayed here are Satoshis (0.00000001 BTC) per byte of transaction data. Miners usually include transactions with the highest fee/byte first.
Wallets should base their fee calculations on this number, depending on how fast the user needs confirmations."


text:
How was the 95% miner adoption threshold determined?
SegWit does not need to utilized by all (or even most) nodes in order to be used safely, but it must be adopted by almost all miners in order to successfully minimize or virtually eliminate the risk of forks or double spends after SegWit activation.
My understanding is that (non mining) nodes that have not activated SegWit, will still consider SegWit transactions valid (because they see no requirement for a signature). However, if some miners includes SegWit transaction(s) in a block that other (non SegWit) mining node(s) reject double spends or forks could theoretically occur. Is that understanding correct?
With this risk in mind, exactly how was the 95% miner adoption level selected? Are there any available statistical simulations that estimate the chances of double spends or forks at a threshold more or less than 95%?

I thought if it was a soft fork it doesn't matter if they reject the block or not, it's just a normal block that they would be rejecting- is that right? since the rules are all basically the same, it's backwards compatible

New softforks are activated using BIP 9 (versionbits), which specifies the threshold requirements. The 95% threshold is inherited from the old BIP 34 (supermajority) softfork activation method.
A softfork with greater than 50% hashing power should always become the dominant chain because the upgraded miners will create a harder difficulty chain, and the non-upgraded nodes will be pulled onto that chain because it's still valid for them (soft-forks are backwards compatible). However, any non-upgraded miners may create blocks which are invalid under the new rules. Those blocks will be orphaned off the new chain. The lower the miner adoption rate, the higher this new orphan rate will be.
In reality, as soon as the threshold has been reached and the softfork is locked in, almost all miners will upgrade to the new rules.
The 95% rate is a very conservative threshold to ensure that there is widespread consensus for the new change.

miners who have not activated SegWit, will still confirm SegWit transactions

This isn't true. If a miner hasn't activated SegWit, then it can't include SegWit transactions in its block (to include a SegWit transaction, it would need to include the witness data and commit to the merkle root of the witnesses in the coinbase transaction). BIP 141 documents all the consensus rule changes for SegWit.

Oh, hey there! Welcome to Bitcoin.SE. :)

@jonnynewbs thank you. It sounds like I confused my use of miner and node. I will edit my question

Non-segwit miners will not include segwit transactions, but for a different reason. The encoding of segwit scriptPubKeys is chosen in a way that makes it non-standard for all Core (and forks thereof) software since 0.10.


text:
Best Python API for sending Bitcoins from a Multi-Sig wallet
I want to create a multi-sig wallet which I can broadcast transactions through an API. I would like a wallet with a permanent public address not one that changes every time I run the code. I was going to use Blocktrail but some of their API features are broken. Does anyone know any other good API`s?
Some context as to what I want to do: automate the sending of coins to certain addresses at a certain time each week.
Thanks,

Maybe pyCoin can be useful for your purpose?
https://github.com/richardkiss/pycoin/blob/master/COMMAND-LINE-TOOLS.md


text:
Why doesn't signet use a unique bech32 prefix?
I noticed that signet and testnet both use tb1 addresses. Why doesn't signet use a unique prefix that distinguishes it from testnet?

It used to, but we switched to using the testnet one to simplify things. It's a testnet so it doesn't really impact anyone if you screw it up (go to the faucet and get more if you lose them), and using the same prefix seemed like it would simplify things.
(In hindsight, though, I feel like this decision was a mistake and actually made things needlessly complicated, because a lot of software (e.g. the rust stack) uses a "prefix to/from network" dictionary setup, which doesn't work well with duplicates.)

It was discussed here. One of the co-authors of BIP325 stated:

People think that the test networks should use the same prefixes so it was changed to match testnet.

Perhaps this could be clarified in the BIP at a later date.


text:
19 out of 24 words of BIP39 passphrase (brute-force last 5?)
I have managed to lose 5 words of my 24 word Ledger Nano S recovery phrase. I have words 1-19 but I am missing words 20-24.
I have significant holdings on the wallet so would very much like to recover it if possible.
The passphrase is a BIP39 mnemonic (see https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
I have the bitcoin and ethereum public addresses for this mnemonic. I am wondering if it's feasible to brute force the passphrase.
Each word is 11 bits (2^11 = 2048 possible words).
The last (24th) word of the passphrase is of the following form [3 random bits][8 bit checksum].
Therefore I only have to check 2^(55 - 8) = 2^47 = 1.4x10^14 combinations.
I would have to compute SHA-512-HMAC with an iteration count of 2048.
As far as I understand, that means I'd have to compute 1.4*10^14 * 2048 = 2.87*10^17 hashes in total.
Is there any hardware out there designed for this? I am aware of ASICs that compute sha-256 hashes but not sha-512 hashes.
Perhaps I could tweak one to work with sha-512 since they are very similar.
Assuming a fairly typical ASIC hashrate of 1TH/s (10^12 hashes per second), I could exhaust the search space in 2.87*10^5 = 287000 seconds = 3.3 days. I'd probably get there sooner, of course (expected 1.65 days). Time is not something I am worried about. Even if I have to wait months, I don't mind - so if I can get 10GH/s at a reasonable price, that would be great.
I would really appreciate any help/information you could provide to help me out and make sure I haven't missed anything.
I could also use GPUs for this (I calculate I can run them at roughly $1/10TH - so it would cost me $28.7k to exhaust the search space, which I will do if there are no cheaper options).
Many thanks,
James

@Thegs I'm not following. By permuting every hash, I can find the one that matches up with my address.

@ChrisW.Rea Thanks I've asked there now

I doubt those ASICs exist (unless there's a coin that does exactly those hashes or maybe someone builds them just to do exactly this kind of key recovery, which i guess may one day become lucrative). You're likely gonna be doing CPU or GPU speeds (if you can make/find the right software to do it). Also I think you'll also need to do further checks every time you happen to land on a valid checksum (1 in 256).

I would not expect it to be possible to "tweak" an SHA256D ASIC.  They are designed in hardware to do only one thing.  If there were gates to spare, the designers would have used them for more SHA256 units instead of adding an SHA512 option.

You can not "tweak" the operation of an ASIC, and truly there's no mining ASIC doing a complete SHA256 hash either. It really depends how much money you have to blow on recovering the seed as to how far you can go, but I think your cost estimates are off by orders of magnitudes. You're forgetting that once every 1:256 attempts you need to do a computationally expensive bip32 dervice and see if any of the addresses match your wallet.

https://www.xkcd.com/936/
Obviously if you can do TH/s it gets quicker, but I still wouldn't think you'd be able to brute force what's essentially a 5 word passphrase (with the added bonus of having to hash 19 other words every time which adds to the time per hash). 4 Word passphrases are considered extremely safe at this point

@xyious if I can do TH/s, wouldn't the calculations I showed apply? In that case, it would be brute-forceable. The issue is that TH/s are not really achievable.

Yes, we're in complete agreement.

@xyious It would be good to note that a "4 Word passphrases" from the set of "all words" is not the same as BIP39's 2048 word list.  2048^5 is "only" 36,028,797,018,963,970 possibilities compared to diceware's 7776^5 which is 789 times larger. Diceware is still a very limited set of words, so the comparison to passphrase strength doesn't seem applicable IMHO.

Just wanted to note regarding @Jannes comment that the checksummed last word will have only 1 of 8 potentially valid checksums (the range of 256 possible checksums includes theoretically invalid ones that we dont' have to search through). In other words, once you reach 253 bits of entropy for the first 23 words, only the next three bits will need to be brute-forced, and each of those 8 options (2^3) will map to a distinct word after the checksum is computed. The last word of a 12-word mnemonic has essentially more security (as you must crack first 7 bits of last group). 2^7 = 128 combinations.

With 4 unknown words there is around 1.76 trillion possible mnemonics and John Cantrell was able to write and setup network of CPU and GPU solvers which successfully checked 1 trillion mnemonics in 30 hours (as part of a challenge to win a bitcoin) by renting bunch of GPUs (it cost him less than $500).
The last 5th word you can just pre-calculate to reduce the number of calculations as it contains a checksum.
So if you are able to reproduce similar setup, you can brute-force and recover your wallet in just few days.
Read more at: How I checked over 1 trillion mnemonics in 30 hours to win a bitcoin.
Project repositories:

https://github.com/johncantrell97/bip39-solver-server
https://github.com/johncantrell97/bip39-solver-gpu
https://github.com/johncantrell97/bip39-solver-cpu

You have three options here:

Using a GPU implementation of the Gurnec´s Seed Recovery script
Use Hashcat / JTR, where PBKDF2-HMAC-SHA512  is already implemented.
Use brainflayer, similar to Gurnecs software, no multithread, no GPU.

Gurnec´s script runs at aproximately 40kh/s under my i7-8700k without OC. So if you only had lost the last 4 words of your seed, it will be 2^36 hashes.
2^36 h / 40.000 h/s = ~ 20 days
So it will take roughtly 3 weeks to test every combination.
But to crack the last 5 words of your seed it would take 2048 * 20 days.
On the other side according to the benchmarks PBKDF2-HMAC-SHA512 hashes at a 4.800 kh/s under a usual 8 x 1080´s rig so it should be possible to recover in several days the 5 missing words.
tldr; Implement GPU in btcrecover or brainflayer or understand how to make it work under Hashcat. Up to 3 words + checksum word doable in CPU, more need GPU.

You can try btcrecover on github, look here: https://github.com/gurnec/btcrecover
it has a special feature to find missing mnemonic.
I also have a GPU version of it, if you need help
/KX

You may be able to find some luck writing an OpenCL wrapper for either john the ripper or OCLHashCat, as I'm fairly certain you can't retool ASICS (unless you get your hands on a good FPGA and gate it for ripping through the SHA512 space).


text:
What happens if an ISP isolates a portion of nodes?
I came to believe that an ISP can easily detect full nodes, BTC connections and isolate them from reaching any other nodes.
When and if an ISP decided to do so, could they easily perform a 51% attack and do everything they want?

Yes, but this would only work if said ISP would host more than 50% of all the full nodes in the network. This is simply not the case, the nodes in the network are too widely distributed for that.

An ISP can isolate all TCP connection with the message signature corresponding to BTC protocol and completely control all the nodes under its host / letting only the nodes inside that ISP talk to eachother, is that right?
I mean, divide and conquer, not trying to attack the whole BTC network

I came to believe that an ISP can easily detect full nodes, BTC connections and isolate them from reaching any other nodes.

This is true. An ISP could easily block all Bitcoin traffic or, just prevent Bitcoin traffic from entering/exiting their network and isolate the nodes.

When and if an ISP decided to do so, they could easily perform a 51% attack and do everything they want?

In the case of isolated nodes, said ISP would still need enough hashing power to present blocks with sufficient PoW to be accepted (a LOT!) and, would have to also block Tor.


text:
In pooled mining, what is pdiff, bdiff and ldiff?
In pooled mining, there seem to be three different terms for difficulty in use. Apparently, the Stratum protocol uses bdiff, BTCGuild uses pdiff, and Ldiff is common for various Scrypt pools as mentioned in this bitcointalk thread.
What are the meanings of pdiff, bdiff, and ldiff? In what way do they differ?

Updated my answer to reflect, and answer, the updated question.

@KJO: Out of curiosity, why did you remove [tag:stratum]? I'm not much of a miner myself.

@Murch I looked at other questions tagged with stratum, and they had more to do with stratum-pool issues. Questions about stratum can pertain to difficulty, but questions about difficulty aren't limited to stratum.

What are the meanings of pdiff, bdiff, and ldiff?
The numbers are the current difficulty of the network(s).

bdiff is the target difficulty of the whole Bitcoin network.
ldiff is the target difficulty of the whole Litecoin network.
pdiff is your pool's target difficulty.

As you may know, the difficulty is a measure of how difficult it is to find a hash below a given target value.

In what way do they differ?
Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?
TL;DR: No. That defeats the purpose of having multiple difficulties.
This is a multi-part answer; I'll try to divide it in a manner that it makes sense.

Bitcoin
Difficulty
The Bitcoin network has a global block difficulty (bdiff). Valid blocks must have a hash less than or equal to this target. Mining pools also have a pool-specific share difficulty setting a lower limit for shares (pdiff, usually 1).
Calculation
How is bdiff calculated?
bdiff is an approximation based off of a known hash where the leading 32 bits are zero and the rest are one.

difficulty = difficulty_1_target / current_target
(target is a 256 bit number)
difficulty_1_target can be different for various ways to measure difficulty.
  Traditionally, it represents a hash where the leading 32 bits are zero and the rest are
  one (this is known as "pool difficulty" or "pdiff"). The Bitcoin protocol represents
  targets as a custom floating point type with limited precision; as a result, Bitcoin
  clients often approximate difficulty based on this (this is known as "bdiff").

How is that value stored?

Each block stores a packed representation [...] for its actual hexadecimal
  target. The target can be derived from it via a predefined formula. For example, if the
  packed target in the block is 0x1b0404cb, the hexadecimal target is
0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000

Note that the 0x0404cb value is a signed value in this format. The largest legal value for this field is 0x7fffff, while the smallest is 0x008000. To make a larger value you must shift it down one full byte positive valid value.
How does one calculate (estimate) bdiff?
Say your value is 1 (0x1d00ffff) 0x00ffff * 2**(8*(0x1d - 3)) = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
That would be 0x00000000FFFF0000000000000000000000000000000000000000000000000000 /
0x00000000000404CB000000000000000000000000000000000000000000000000
= 16307.420938523983
Source

Litecoin
Difficulty
Because Litecoin is based on Bitcoin ldiff is calculated the same as bdiff. It is an approximation relative to a known hash (256-bit number where the leading 32 bits are zero and the rest are one).
Calculation
ldiff is calculated in the same way bdiff is.
They both have a maximum of infinity (basically), and a minimum of 1/4096
Because Litecoin takes its roots in Bitcoin, this also means ldiff is an approximation, not a precise value.
Source

Pools
Difficulty
pdiff is relative to the crypto-currency in question. In the cases of Bitcoin and Litecoin pools, it represents the same thing; but in, for example, a Namecoin pool, the difficulty may not be 1, or it may be calculated differently. This is confusing because the 256-bit number in question is 0x1d00ffff. The number was not called anything initially. But once pooled mining started, it colloquially became known as pdiff. But it was around before pooled mining. Pools just happened to use it as their target difficulty, and because bdiff was already a thing, the name pdiff was transposed to the number 0x1d00ffff.
Note that pools usually use non-truncated-targets, and usually use a difficulty of 1. This means that even within the same crypto-currencies there really is no set definition of what pdiff is; however, I know of no pools/pool software that contradict these rules, because they are desirable. Just remember that anyone can make his pool do whatever he wants it to.
pdiff is relative.
Calculation
Assuming this is a standard pool, calculation follows basically the same as bdiff, but with one exception:
Let's say the target value is still 0x1d00ffff. The Wiki says pools usually use "non-truncated targets" So, instead of 0x00000000FFFF0000000000000000000000000000000000000000000000000000 we get 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Which, when calculated, yields 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF /
0x00000000000404CB000000000000000000000000000000000000000000000000
= 16307.669773817162
Source

Is bdiff 1 == pdiff 1 == ldiff 1, or how do they relate?

@Dr.Haribo added more information.

Someone care to dig up some info on ldiff so we can complete this? :)


text:
What happens to bitcoins if the site shuts down?
My father just asked me:  What happens if the bitcoin people decide to shut down the website, what happens to my bitcoins?  I didn't know.

Could you please specify the website that would be shut down?

There is no single website that bitcoin relies on.

Someone please write a killer answer to this question, it has the potential to be an eye opening response.

There really isn't such a thing as "the bitcoin people" or "the website".

I assume my esteemed fellow commentators are disputing the wording of the question not its validity as a question.

What happens if the government people decide to shut down money? SCNR ;-))

The ledger of Bitcoin balances is stored on a network comprised of thousands of individual computers around the world. Anyone can run the Bitcoin program which contributes to that network and stores the record of every transaction that has ever happened. This is what is called a peer-to-peer network or a decentralized network.
There is no website that controls Bitcoin, but there are websites that pull information from the network and present it to you. You can trust them to store and report to you that data, but using the program itself on your computer is the most secure way to handle your funds, and it has the added benefit of also securing the network a bit more.
There are many websites which do the work of downloading the program and managing your Bitcoins for you - in the same way that paypal manages your money on their website. If you trust paypal to not decide to "freeze" your funds for no apparent reason, which they have MANY TIMES before, you would deposit money into their website. It's exactly the same with a Bitcoin website that stores your funds. However, a very notable benefit of Bitcoin is the ability to securely store your coins on your PC, which is not possible with cash. Additionally, as long as you hold the wallet file or technically the private key that is assigned to the program on your PC, your Bitcoin can never be frozen by anyone. The only requirement for spending those Bitcoin in the future is that you have your wallet file (or your private key) and that the network still exists. Currently the network is only getting bigger as the days pass.
There are questions that follow after understanding this answer, such as how transactions are validated if there is no central authority, and there are considerably sufficient answers to those questions elsewhere on this forum and other places online.
I suggest you check out https://www.weusecoins.com/en/questions -- it has the answer to many of the preliminary questions you may have, and the main page also has a quick video which does a good job of explaining the concepts to newcomers.

As Bitcoin is a peer-to-peer network, shutdown in this context would need to mean the closure or abandonment of the P2P network. If this occurred and insufficient peers attempted to recreate the network - then yes, you could consider the network "shutdown".
In which case your Bitcoin money has no value and essentially disappears in a puff of smoke. This would be similar to if paper notes suddenly super-glued themselves to people's hands, pockets or purses.
This scenario isn't entirely esoteric.
Consider the fact that the energy required to process on-blockchain Bitcoin transactions can only ever increase (see assumption below). If the peer network massively contracted, the velocity of the currency would fall through the floor due to insufficient network processing power. And unlike the initial speculative rush that bootstrapped the crypto-currency when "energy per hash" was cheap, the only people with the incentive to re-establish the network would be those with significant trapped Bitcoin reserves and enough non-Bitcoin money to pay transaction fees for miners to establish ASIC farms.
Paying these transaction fees to re-inflate the network would be an uphill battle; as these fees would start very high (i.e. energy cost per peer) and only decrease if enough people paid those high fees to amortise the mining costs and draw the rest of the populace back into the network to keep the fees cheap and stabilise the ROI for block mining.

Escalating difficulty is the core assumption of this scenario: That energy per hash can't go backwards due to a risk of "unwinding" existing transactions.
Bootstrapping the new network with a lower target might work - but who owning mature Bitcoins wants to re-enter the initial speculative rush due to a low target? You would need to rework the network protocol to not create new Bitcoins on new blocks until the target re-reaches the previous network's difficulty level.

However, the hashing power could just level off, as an equilibrium between cost and profit is found. If the hashing power remained constant the running cost could actually still decrease through better miners replacing legacy hardware.

@Murch Certainly; for an existing network. However, a mature network pays for energy using transaction fees. Sustaining the Bitcoin network in the initial shift to transaction fees will be difficult enough, as the utility of Bitcoin will need to be cost competitive vs other transactional methods. Re-establishing the network if it was out of commission for a while will depend on exactly how likely mining consortimums are willing to be paid in a presently dead/non-circulating currency to bootstrap the network. Or if paid in a non-Bitcoin currency, the cost of peer amortisation mentioned above.

Hope I’m not the only one recognizing the rebirth of GPU and maybe even CPU mining in case or a collapse of global-hashing-power. ;)

Whoever controls the private keys, controls the money
Bitcoin relies on two keys: a public one, and a private one. The public one is used for receiving funds, the private one is used for spending them. There is one public key for every private key. You are encouraged to create fresh keys for every transaction to preserve your anonymity.
Securing your private key is right at the top of your todo list because if someone copies that, then they can spend your bitcoin. The best way to secure your private key is to keep it on trusted hardware, the next best is to use a HD wallet. More about these later.
Bitcoin is peer-to-peer. This means that there is no central site to shut down. If you are in complete control of your private keys then there is nothing to threaten your money. Your funds are safe.
If you trust someone else to look after your private keys for you - such as some online wallets - then you're trusting that they won't spend your money, or get shut down.
To protect themselves from various attacks, most online wallets ensure that the private keys remain encrypted (by you) so they can't spend the money. However, if you don't have backups of those private keys and the online wallet site is shut down then you lose access to the private keys and therefore your money.
So what were these HD wallets then? These are the next generation of Bitcoin private key management. They are essentially brain wallets on steroids and are much more secure than the classic encrypted wallet approach.

Many of the other answers provide some useful information, but the spirit of the question seems to be: "If I have to use [website name] to access my wallet, which I have chosen from a list of competing service options, what happens if that website goes offline?"
What's important to remember is that the wallet is not actually on any of these websites - or even on your computer if you create one locally. Another answer suggested that the solution is to never use a website and only use a computer, but that doesn't properly address the question because it could just be rephrased as "what happens if my computer burns up in a fire along with all my backups"
The answer is that many websites, along with offline programs, allow you to import/export you wallet. These are all the same address so they synchronize together. If it is an encrypted wallet you need to know the pass phrase that was randomly generated when the wallet was created. In the event that you don't know the pass phrase the wallet is gone forever. If you have the pass phrase, but never bothered to create a backup, there are steps you can follow that will allow you to recover the information needed to import to any other wallet service and continue.
So to answer the spirit of your question: As long as to take some personal responsibility to secure your own information the wallet will remain accessible to you even if a given service goes under.
There is an answer over here that goes into detail on how to recover your wallet.
In the event that you neglect to secure your wallet, and the service goes under, the Bitcoins still exist, but they will never be used by anyone ever.
If you are still concerned you could use the paper wallet feature. As explained here, this involves taking your Bitcoins offline and storing on a code on paper just like dollars. Of course, this makes them as secure (or not) as real physical dollar bills.

If  you have a wallet on some sites and this site for some reason goes offline (or went shutdown), your bitcoin will be LOST, or keep by someone else.
So, better to have a wallet in a SECURE PC or in a phone or on paper (paper wallet) keeped in a safe :)

Assuming you are using your own wallet: Nothing happens. Bitcoin is peer-to-peer. It does not rely on a central server or website. You still have your bitcoins and your wallet is still working. The bitcoin peer-to-peer network is still operating and you can still transfer coins.
If you are not using a bitcoin wallet that you control yourself, but storing the bitcoins at a website (in someone elses wallet), then if they shut down the website and run away with your bitcoins, that would mean the coins are lost. This has happened with several scams in the past.
If you mean the bitcoin.org website and other sites with wallet software:
In the extremely unlikely event that all websites hosting bitcoin wallet software could be shut down, then it could make it more difficult for new users to get the necessary software. This might last a few minutes and be a minor inconvenience for new users considering bitcoin.

Apparently your father is mixing up Bitcoin with Facebook. Bitcoin is not a website. For this purpose Bitcoin is not even web based but another internet service (the terms web and internet are not synonymous).
The network, as a distributed entity carried by all participants, is usable for you as long as you can retain a connection to a single remaining peer, though ideally you would prefer to have connections to multiple peers. Your ability to connect to other peers is not controlled by any central authority as it is the case with, i.e. Skype. "The Bitcoin people" for that matter are all participant in the network, including yourself.
Other than with classical web based services there is no single point of failure.
If your connection to the last peer fails or if the last peer goes down beacuse the network went out of fashion, you and others will still keep the contents of your Bitcoin wallets and a copy of the global transaction chain as it was at the latest time of your participation. Once any nodes come up again in the network they can continue running from this point.

Same thing as what happens to gold if the gold people decide to shut down the gold website.

Gold and Bitcoin are not very analogous - it would be much easier to prevent Bitcoins from being spent than it would be to prevent all gold in the world from being spent. This is not a very helpful answer. It's also a little condescending - remember, the asker isn't trying to annoy you.

@NickODell: However, they are analogous in that they are both not dependent on one website.

This is why you hear and are told:
"web wallets are bad"  Lesson, keep your own private keys!  (if possible, generate many many blank paper wallets with a computer not connected to the internet.  Send spendable bitcoin to a 'hot wallet' and send your change over to a new paper wallet and throw away the original [you have no way to 'prove' that the private key scanned or typed in was not compromised upon use])
His question is answered with another question - What happens if paypal servers got shut down,  does the money disappear?
Most likely the DB or wallet software implementation they used stored all the private keys for the balances on the wallet server.  If it was on a type of virtual instance and that instance had no backups and it were to be deleted, then the balances would remain there, on the blockchain, but without those private keys, those balances would remain unspendable and effectively useless.
Your TIL moment should be: keep bitcoin across different balances and mediums (its possible to keep them stored on physical pieces of paper and metal too).  Don't trust an online 3rd party like circle or coinbase with large sums of your money.

authors: Сергей Оненко


text:
Blockchain.info - How to reply to a sender in a callback?
I just started using the Blockchain.info API, I've set it up to notify me when a payment is made, however all addresses in the callback are the destination address. Shouldn't I have the senders address as well?
Is there any way of getting the senders address, otherwise how am I supposed to reply?
I know transaction has the address, do I just pull the first address from inputs of the transaction?

I have not tried anything with the blockchain API, but you are trying to reply to a POST they sent you, then just echo or print whatever you are sending back to blockchain.
If you are trying to retrieve data (provided it is POSTed) you can use this to figure out what all is being sent to you.
foreach($_POST as $key => $value){
    $data = $key.' => '.$value.' : '.$data;
}

file_put_contents('FILENAME.txt', $data);

Sorry you must misunderstand, I'm talking about Bitcoin addresses, nothing to do with GET/POST. If they send me some BTC and for example, I want to do a refund (in code naturally).

If you print all the key value pairs and the address is not there, then they are not sending it.

And that's my point. Where is it? In everything I've seen it doesn't send it as part of the callback. So how do I find it is what I want to know. At present the only place I can see it is in the TX but I don't know how prudent it is to pull it from that as some TX have multiple inputs :/