Why aren't public-private keys sufficient to build a block chain? Why do we need proof of work/stake? Taking the simple case of Bitcoin here:
If all nodes can validate published transactions by checking the signature (created using the private key of the sender) of the transaction against the public key of the sender, why isn't that sufficient to validate a block?
I understand that we also solve the puzzle of finding a nonce that when combined with a block's contents, gives us a hash that has N number of leading zeroes. Why do we need this at all? Isn't it enough to check the validity of each transaction in the block?
As for double spending, if a miner decides erroneously to include both transactions, nodes can see there isn't enough balance and reject such blocks. As for which transaction of the two to take, the code could have a way to order transactions and if an attacker decides to do the opposite intentionally and decides to spam the network (since there's no proof of work cost) but how does the attacker benefit from that?

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

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

but how does the attacker benefit from that?

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


Can I send Bitcoins without a wallet How can I send bitcoins to someone, without having to purchase them first or set up a wallet?

I'm looking for a service that will send N bitcoins to a given address. I pay them with my credit card or paypal. I don't wish to purchase any bitcoins myself, have a wallet, set up any kind of account, or give anyone my email address. I don't want to know anything about bitcoins beyond my initial instruction to send N bitcoins to a given address. Does such a service exist?

Buying bitcoins with credit card or Paypal is possible, but usually very expensive because the seller has to cover for the risk of chargeback. Bitcoin transactions are not reversible, so if you dispute the charge the seller is in a very weak position.

Cex.io is an exchange that offers credit card purchases to its clients, but you have to go through several id verification process that will probably make you uncomfortable. After buying you would just need to make a withdrawal to the desired Bitcoin address.

If you are open to using your bank account instead of a credit card, you have more options, but which are available to you will depend on where you are. A couple well known ones are:

Litebit.eu. They accept SEPA bank transfers and a few other lesser known payment methods (iDeal, GiroPay and a few others). You just make the payment and give them the address.
Coinbase.com. They are one the biggest exchanges out there and many people use them as a wallet (they are not wallet because they keep custody, not you, but that is another discussion). You can link their account to your back account and make Bitcoin purchases. You then can send your bitcoins to whoever you want. However, they have closed customer accounts in the past if they detect that you send funds to services they don't consider legal, like gambling sites, so if that is your intention I would not use them.

There are many more if you make a couple Google searches, but I have mentioned only services that I know have worked well for people I trust.


How can I get the input addresses of a transaction in Java? I am trying to obtain the addresses of entry of a transaction when I receive money, but I have not found the way. I have tried to create an address with the bytes obtained by calling TransactionInput.getScriptSig().getPubKey(), but I've only obtained a ScriptException. If I call TransactionInput.getFromAddress() (deprecated) the code is frozen. I don't want to have to make a call to the API of block explorer, it is too cumbersome. Is there any way of doing this? As it parses the transaction blockhain.info to get that kind of information?

You should get the list of inputs, this is a snippet code using BitcoinJ to get input and outputs addresses:

List<TransactionInput> inputs = tx.getInputs();
List<TransactionOutput> outputs = tx.getOutputs();

for (TransactionOutput out : outputs) {
   System.out.println("addresses in output " + out.getAddressFromP2PKHScript(params));
}
for (TransactionInput in : inputs) {
    System.out.println("addresses in input " + in.getFromAddress());
}


Does changing mining algorithm(SHA256) of bitcoin cause any side effect? One example is bitcoin gold change SHA256 to Equihash, does it cause any side effect?

Edit:
To be more specific.
What should participants of bitcoin blockchain, especially coin owner and miners, need to worry about when they take part in(e.g. trading, mining) a forked bitcoin blockchain with different mining algorithm?

Apart from GPUs being more viable for mining, no, there isn't. (And asics being less viable, or more or less useless..)

Apart from maybe a difference in difficulty etc, but blocktimes and blocksizes should be the same.

(Unless ofcourse they changed it in the hardfork itself, but that has nothing to do with the mining algorithm.)

EDIT:

Note: I've answered this question in technical terms, not economic/emotional terms.


Recovery of a corrupted wallet I have a very old wallet.dat that I've put into my .bitcoin folder. When trying to run bitcoind, the service stops giving the following error

2019-06-11T18:14:02Z Using wallet directory /home/nom/.bitcoin
2019-06-11T18:14:02Z init message: Verifying wallet(s)...
2019-06-11T18:14:02Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2019-06-11T18:14:02Z Using wallet wallet.dat
2019-06-11T18:14:02Z BerkeleyEnvironment::Open: LogDir=/home/nom/.bitcoin/database ErrorFile=/home/nom/.bitcoin/db.log
2019-06-11T18:14:02Z Renamed wallet.dat to wallet.dat.1560276842.bak
2019-06-11T18:14:02Z BerkeleyEnvironment::Salvage: Database salvage found errors, all data may not be recoverable.
2019-06-11T18:14:02Z BerkeleyEnvironment::Salvage: WARNING: Unexpected end of file while reading salvage output.
2019-06-11T18:14:02Z Salvage(aggressive) found no records in wallet.dat.1560276842.bak.
2019-06-11T18:14:02Z Error: wallet.dat corrupt, salvage failed
Error: wallet.dat corrupt, salvage failed
2019-06-11T18:14:02Z Shutdown: In progress...

Edit. Here is the content of the DB log

file unknown has LSN 1/151495, past end of log at 1/28 Commonly caused by moving a database from one database environment to another without clearing the database LSNs, or by removing all of the log files from a database environment Page 0: metadata page corrupted Page 0: could not check metadata page wallet.dat: DB_VERIFY_BAD: Database verification failed file unknown has LSN 1/151495, past end of log at 1/1080 Commonly caused by moving a database from one database environment to another without clearing the database LSNs, or by removing all of the log files from a database environment wallet.dat.1560341204.bak: DB_VERIFY_BAD: Database verification failed file unknown has LSN 1/151495, past end of log at 1/2500 Commonly caused by moving a database from one database environment to another without clearing the database LSNs, or by removing all of the log files from a database environment wallet.dat.1560341352.bak: DB_VERIFY_BAD: Database verification failed

Edit. Using db_dump I am able to see the content of the wallet file ( addresses, keys etc)

Is there any way I could debug this, perhaps recovering just part of the keys or any useful data from the DB itself? Any useful hints how to approach such recovery?

It sounds like your wallet.dat file is still intact, but some of the environment data has gotten corrupted (possibly due to moving wallet files).

Try doing

db_load -r lsn wallet.dat

This will reset the LSNs in the wallet.dat file which should cause the errors in the db.log to go away. Once you do that, delete the database/ folder and start Bitcoin Core.


Does this method really work as replay protection? This blog post describes a method for protecting against replay attacks after any hard fork on the Bitcoin blockchain. It asumes you have BTC in a wallet and want to transfer it without risking the forked coin.

In summary it says:

Buy BTC in an exchange
Transfer BTC from exchange to your wallet
Transfer full amount including newly received BTC from wallet to another wallet

According to the author, the last transaction can't be replayed on the new chain since it is for a larger amount than what that address would have in the new chain.

Can someone confirm whether this does in fact protect from replay attacks? Would this be a valid method for any hard fork?

My concern is that somebody could replicate the first transfer (step 2) in the new chain, therefore making the second transaction (step 3) replay-able.

this does in fact protect from replay attacks?

no

  Would this be a valid method for any hard fork?

no

  My concern is that somebody could replicate the first transfer

you are right


Different redeemScript for the same scriptPubKey? Most transaction outputs to P2SH addresses have the following scriptPubKey:

HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL

As I understand it, this transaction do not need to be signed. Is it true?

The user just needs to provide a redeemScript whose HASH160 is equal to f45d94733d430261962932e0c847075195916a04.

So, if we know that:

HASH160(data1) = hash1
HASH160(data2) = hash2

and the user creates two transaction outputs to P2SH addresses with the scriptPubKeys:

HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL

then the scriptPubKey is the same for both transaction outputs, but why is the redeemScript is always different?

HASH160(data1) = hash1
HASH160(data2) = hash1
....
????

A P2SH transaction will execute whatever redeemScript you provide, which must be a standard transaction:

  Transactions that redeem these pay-to-script outpoints are only
  considered standard if the serialized script - also referred to as the
  redeemScript - is, itself, one of the other standard transaction
  types. See BIP16

Those standard transactions, like a P2PKH does require a signature, so even though you provide the right redeemScript, if it doesn't execute successfully, the entire tx will become invalid.


is it okay to disconnect Antminer like S7 > I have a kind of unstable internet connection
sometimes it gets disconnected for over an hour
the question here is , does that hour of mining without internet count ?

thanks

While you aren't connected to the internet you can't submit shares to your pool, so you won't earn anything during that time period. That's why it's recommended for miners to have fast, low latency connections.


How can I determine my cryptocurrency exchange rate according to demand and supply by programmatically? I know exchange rate depends on so many factors theoretically, but how can I determine my cryptocurrency exchange rate according to demand and supply by programmatically?

Is there any standard algorithm to increase and decrease the value of cryptocurrency(ex. in USD) based on demand and supply?

How Bitcoin exchange rate increase and decrease automatically, Please let me know, is there any algorithm which can estimate the value of Bitcoin in USD and increase/decrease it's value(in USD) automatically.

Price of bitcoin is determined by the traders
Suppose there are 2 Traders Person X and Person Y
Then consider the following use case.

  1.If person X has N amount of bitcoins and then he can choose to sell them at P amount of price.

  2.Person Y wants to purchase the Bitcoin then he can choose to bye N amount of bitcoins for price P1.

  3.If P=P1 then N amount of bitcoins are transferred to account of Y.

  4.In the same way if the Buyers are decreasing the price and continuously finding the sellers for descried price then the price
  goes on decrising

  Vise-versa if the sellers are incising the sell price and continuously finding the buyers for increased price then the price of
  bitcoin goes up.
  The third condition which rarely occurs is If sellers trade and buyer trade is not matching then the price of bitcoin is determined to
  the midpoint of lowest sell order and highest buy order.

  ie. If highest bye order is for 10L/BTC and lowest sell order is for
  15L/BTC then the price will be set to 12.5L/BTC and users will trade
  according to that.


Why does blockchain.info API response with wrong balance value? Let's the following address. Now the current total received balance is: 5,697.09329301 BTC:

But API response is 569709329301:

As you can see API response does't contain floating point therefore the total balance is very big.

Is it bug?

The two quantities are equal but expressed in different units. 1 Satoshi = 10^(-8) BTC.


Can PUSHDATA/OP_RETURN be used to break a trail of transactions permanently? I was reading the Bitcoin wiki on how the Bitcoin protocol has no "From" address and the closest thing to a from address is a "previously receiving address".

The article then proceeds to show a transaction that breaks Bitcoin chain explorers: 54fabd73f1d20c980a0686bf0035078e07f69c58437e4d586fb29aa0bee9814f

This is indeed true. Web-based explorers such as blockchain.com and BlockCypher cannot resolve the Input address.

I see in the transaction's details that the tx creator has placed a PUSHDATA(72)[somedata] operation at the Input.

Can this effectively be used to break/hide a Bitcoin transaction chain? If yes, what is the point for alternative Privacy-oriented coins such as Monero, when absolute privacy in transactions (hidden-input transactions) can be created in Bitcoin?

I'm probably misunderstanding something, and If you can point me in the right direction, I'd be more than grateful.

Can this effectively be used to break/hide a Bitcoin transaction chain?

No, the block explorers you've mentioned simply do not include code that is capable of decyphering the nonstandard transaction you've linked to.

Importantly: Bitcoin transactions do not include a 'from address', instead they reference a valid unspent transaction output (UTXO) that they are spending. That said, the majority of transactions throughout history can be decoded to present the user with a 'from address', so this is simply a user-friendly abstraction that block explorers make. The 'from address' is not inherent to the Bitcoin protocol.

So in a simplified sense, rather than trace the transaction history via "this address, and then this address, etc", you would say "this UTXO, and then this UTXO, etc".

Thus, using bitcoin-cli you can easily trace the transaction history. Here is the output when using the getrawtransaction RPC for the transaction you mentioned, with verbosity=1:

user$ bitcoin-cli getrawtransaction 54fabd73f1d20c980a0686bf0035078e07f69c58437e4d586fb29aa0bee9814f 1
{
 "txid": "54fabd73f1d20c980a0686bf0035078e07f69c58437e4d586fb29aa0bee9814f",
  "hash": "54fabd73f1d20c980a0686bf0035078e07f69c58437e4d586fb29aa0bee9814f",
  "version": 1,
  "size": 159,
  "vsize": 159,
  "weight": 636,
  "locktime": 0,
  "vin": [
    {
      "txid":
"a60143eb3f8d3cd1f42cca874f35736186d67c488efd3c1b7214bbd74b310e0c",
      "vout": 0,
      "scriptSig": {
        "asm":"3045022100d92e4b61452d91a473a43cde4b469a472467c0ba0cbd5ebba0834e4f4762810402204802b76b7783db57ac1f61d2992799810e173e91055938750815b6d8a675902e[ALL] -1",
        "hex":"483045022100d92e4b61452d91a473a43cde4b469a472467c0ba0cbd5ebba0834e4f4762810402204802b76b7783db57ac1f61d2992799810e173e91055938750815b6d8a675902e014f"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.09000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a86e8ee2a05a44613904e18132e49b2448adc4e6 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1GMaxweLLbo8mdXvnnC19Wt2wigiYUKgEB"
        ]
      }
    }
  ],
  "hex":"01000000010c0e314bd7bb14721b3cfd8e487cd6866173354f87ca2cf4d13c8d3feb4301a6000000004a483045022100d92e4b61452d91a473a43cde4b469a472467c0ba0cbd5ebba0834e4f4762810402204802b76b7783db57ac1f61d2992799810e173e91055938750815b6d8a675902e014fffffffff0140548900000000001976a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac00000000",
  "blockhash":
"000000000000000c15dfb68cc1abead192f718cf8b772977d79938f3a4259afa",
  "confirmations": 299789,
  "time": 1378742541,
  "blocktime": 1378742541
}

So we can see that the input is the first output created by the transaction with id:a60143eb3f8d3cd1f42cca874f35736186d67c488efd3c1b7214bbd74b310e0c. Using the same method as above, we can look up that transaction:

user$ bitcoin-cli getrawtransaction a60143eb3f8d3cd1f42cca874f35736186d67c488efd3c1b7214bbd74b310e0c 1
{
  "txid": "a60143eb3f8d3cd1f42cca874f35736186d67c488efd3c1b7214bbd74b310e0c",
  "hash": "a60143eb3f8d3cd1f42cca874f35736186d67c488efd3c1b7214bbd74b310e0c",
  "version": 1,
  "size": 212,
  "vsize": 212,
  "weight": 848,
  "locktime": 0,
  "vin": [
    {
      "txid":
"c079314b17b7a2c3fbe879e6fc610291c685f6f7819d70bef785295c774b1e04",
      "vout": 1,
      "scriptSig": {
        "asm":"3045022100d4f73a357e323a3f0666264bd018f25296682bd7db12979890b3952b159337d7022039ebfd0d3deeb6236545e6d05d65e9fa395544f69e5275fab2e4f73cc7c20286[ALL] 0223a6fbf80fe06efa9a8707620a1215cf6a5834e6f81ca6592b0e7195fe92eae7",
        "hex":"483045022100d4f73a357e323a3f0666264bd018f25296682bd7db12979890b3952b159337d7022039ebfd0d3deeb6236545e6d05d65e9fa395544f69e5275fab2e4f73cc7c2028601210223a6fbf80fe06efa9a8707620a1215cf6a5834e6f81ca6592b0e7195fe92eae7"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.09000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP 0 OP_LESSTHAN OP_VERIFY OP_ABS 1 16 OP_WITHIN OP_TOALTSTACK 0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 OP_CHECKSIGVERIFY OP_FROMALTSTACK",
        "hex":"76009f69905160a56b210378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71ad6c",
        "type": "nonstandard"
      }
    }
  ],
  "hex":"0100000001041e4b775c2985f7be709d81f7f685c6910261fce679e8fbc3a2b7174b3179c0010000006b483045022100d4f73a357e323a3f0666264bd018f25296682bd7db12979890b3952b159337d7022039ebfd0d3deeb6236545e6d05d65e9fa395544f69e5275fab2e4f73cc7c2028601210223a6fbf80fe06efa9a8707620a1215cf6a5834e6f81ca6592b0e7195fe92eae7ffffffff0140548900000000002d76009f69905160a56b210378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71ad6c00000000",
  "blockhash":
"0000000000000026c3b45ad70e4622dcdaffc8cad2b202d1d5a4254625166ec9",
  "confirmations": 306793,
  "time": 1375519263,
  "blocktime": 1375519263
}

And we could continue following the transaction history in this way, so you can see that this type of nonstandard transaction does not break the transaction history. Keep in mind that a bitcoin is fungible, so while we can trace a general transaction history, we cannot trace an 'exact coin' through time, as such a thing does not exist. This allows for privacy and fungibility enhancing techniques such as 'CoinJoins' to function.


How do websites sell cryptocurrency with fiat payments? I'm trying to create a platform to sell cryptocurrencies in my country. the way it works is, the user enters my website, select a coin he wants to buy then the amount he/she wants to buy, he pays in our common currency (say USD) and we should send him/her the cryptocurrency he has bought. the procedure is like most of the crypto shops, but the question is how should I get cryptos to sell? say a user wants to buy 5 Bitcoins, how should I have 5 Bitcoins to give him? how do other websites do this?
Any help would be appreciated.

Thanks in advance.

Essentially you want to start a cryptocurrency exchange? If that is true, you need liquidity for people to be able to buy these coins. There are two ways of going about it:

Use a broker/third party exchange, such as Kraken.com or any other in your region and have your orderbook go through their's. You would have to price it so you are profitable however.
Prefund your own exchange. For example, you could buy 5BTC and keep it in a wallet designated for your website. So when a customer comes there you have that "cash" flow to sustain orders up to 5BTC. Obviously you would have to scale this up if needed.

I don't know which country you are in but normally this requires a money transmitter license (at least in the USA) for fiat to crypto gateways among others. If your question is referring to the technical/programmatic aspect of the exchange, that's a different answer.


Maximum number of op_codes in script Is there any part of the Bitcoin protocol that established a limit on the maximum number of op_codes in a script.

Recently I have hit the limit for the bitcoin core client. In:
https://github.com/bitcoin/bitcoin/blob/ce56f5621a94dcc2159ebe57e43da727eab18e6c/src/script/interpreter.cpp
in line 276 you find:

   if (opcode > OP_16 && ++nOpCount > 201)
        return set_error(serror, SCRIPT_ERR_OP_COUNT);*

I interpret this line as saying that, outside standard type of transactions, there is a limit to 201 operations beside pushing a number from 0 to 16 to the stack.

Is this defined in any part of the protocol or discussed in any BIP?

I know there are limits for multiscript transactions:
https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#520byte_limitation_on_serialized_script_size
and that the number of signatures should be limited to avoid certain attacks, but for lightweight operations (OP_ADD and the like) I cannot find any explanation on the limit and the exact 201 value.

P.S: I found the error when trying to spend the offending script. Curiously, I was allowed to send the transaction. It is when the client tries to verify the data for the next transaction when there is a problem.

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

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

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

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


I sent bitcoin to someone and did not get paid I sent Bitcoin to someone who promised to pay me in cash personally once he received the Bitcoin in his BitPay wallet. But once he got the Bitcoin, I  never got paid by him. Is there anyway I can do something about this matter?

Does Bitcoin have a function that would allow the BTC you sent to be returned, No.

The only way to get the BTC back is if the recipient makes a new transaction sending the Bitcoin to your receiving address. If the recipient will not do this, you may think about contacting a lawyer.


Transaction fee required by bitcoin-cli keeps increasing as I increase the fee I am using bitcoin-0.13.0 and trying to send 0.035 btc to someone.

./bitcoin-cli [auth] sendtoaddress XXX 0.035

Error: This transaction requires a transaction fee of at least 0.00150835 because of its amount, complexity, or use of recently received funds!

Then I try to set the fee:

./bitcoin-cli [auth] settxfee 0.00150835

=> true

... and try to send again:

./bitcoin-cli [auth] sendtoaddress XXX 0.035

Error: This transaction requires a transaction fee of at least 0.00187149 because of its amount, complexity, or use of recently received funds!

.. and this keeps going on and on and on with various random values being output as required transaction fees regardless how many times I set the tx fee.

There have been no transactions in my wallet for some 4+ days.

I thought the transaction fees were optional? now this is becoming more and more like my bank charging a fee on each wire?

What am I doing wrong?

The problem with sendtoaddress is that the transaction size isn't known in advance.  It may be that by adding a fee, you are needing to include a new input in the transaction, but inputs are the largest and therefore the most expensive part of the transaction, so that makes it still more expensive.  That would be most likely if you have a lot of addresses with small amounts in them.

Also, settxfee sets the fee per KB, but from a quick review of the code, that message seems to be printing an absolute amount rather than a rate per KB.

You may want to adjust the settings described here:

https://bitcoin.org/en/release/v0.12.0#wallet-transaction-fees

For complete control, you can use createrawtransaction/fundrawtransaction, or use an external system (e.g., coinb.in) to create the transaction and just sign it using your core wallet.


P2Pool - I get only rejects I started mining with P2Pool / cgminer.

bitcoin-qt.exe is running. run_p2pool.exe is running. cgminer is running.

But all I get are rejects.

What might be the problem?

This might mean your internet connection is too slow. With p2pool, you are basically competing against all the other miners for internet latency. If you have bandwidth-intensive software running (downloads, uploads) try stopping it.


Is it possible to get the full list of synced nodes ɪᴘ on the network? There are many website like https://bitnodes.earn.com/ but I’m failing to understand if they collect nodes from compulsory submission on the web interface for statistics purposes only or they use a way to scan the whole network ?

A second part of the question regarding the type of the node is whether it’s required to run a full node to create blocks as a miner.

Sites like bitnodes use a crawler to discover many nodes on the Bitcoin network. They start a node which connects to some nodes initially, and then requests for more nodes to connect to from those nodes. They connect to the nodes they received and repeat the process until they have queried every listening node that they can.

Note that this does not get every node. It can only scan listening nodes and only the nodes which have been up long enough for another node to return its IP address in a query for nodes to connect to.


Is there a BIPs roadmap somewhere? Which BIPs are already implemented by bitcoin-core and which are scheduled to be supported by the client in the scheduled releases?

I found these questions to be relevant:

Where can I find out which BIP (bitcoin improvement proposal) are going to be implemented or not?
What BIPs are supported by the standard client Bitcoin Core?

but still didn't manage to get an answer to that question.

All the BIPs that have been written up are listed on the BIPs Github project along with their status:

https://github.com/bitcoin/bips/blob/master/README.mediawiki

There's rarely a clear plan as to when they're going to incorporated into bitcoin-core and the corresponding schedule. In open source projects, features get incorporated when someone gets around implementing them and the review process is done.

The best way to follow implementation is to follow the development mailing list and Github pull requests (https://github.com/bitcoin/bitcoin/pulls).


What is the difference between your address and your public keys I'm beginning to learn about cryptocurrencies, and I'm having a lot of trouble because some terms are used in different contexts. I know that public keys are generated through a private key. So, are those public keys the addresses? And is it possible to generate more than one address per each private key in wallet? Why?

cited:

  A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair.

a picture may make it easier to understand how an address is generated from a public key;

Image provided under Creative Commons CC0 1.0 Universal Public Domain Dedication


When does signaling for SegWit start exactly? I thought that signaling for SegWit (and other softforks deployed by means of BIP0009) would start with the first block after the Starttime defined in the BIP is reached.

Someone claimed that it only starts with the first difficulty retarget after the starttime. Is that true?

Signaling will commence with the first difficulty retarget after November 15th 12am UTC (i.e. midnight between 2016-11-14 and 2016-11-15).

See BIP0009 State Transitions:

  All blocks within a retarget period have the same state. This means that if floor(block1.height / 2016) = floor(block2.height / 2016), they are guaranteed to have the same state for every deployment.

Which means that blocks will only switch state when a new difficulty period begins after the starttime.

This means that signaling for SegWit will begin sometime on the 19th in the afternoon (UTC). The earliest that SegWit could activate therefore is the 17th of December (two difficulty periods later).


What actually caps Bitcoin's supply at 21 million? I have seen everywhere that the total BTC supply is permanently capped at 21 million. I understand blockchain, cryptography, SHA256, etc... generally, but where/what is actually capping the supply at 21 million? Looking this up online usually leads to generic 'its written in the code' and this stack question seems to point to the code, but I do not understand it. Is the supply cap really just some hard code in the original protocol? Is this modifiable?

What actually caps Bitcoin's supply at 21 million?

Consensus rules
The supply is capped by the so-called consensus rules that every Bitcoin node enforces.
New coins are minted as block rewards by miners. Every node that receives the new blocks checks that the block reward is not greater than the current limit per block. Any block that exceeds this limit is deemed invalid by every node that receives it and is discarded and not passed on. Any node that passes on a block with an excessive mining reward is in danger of being ostracized by other nodes.
Nodes are made to distrust any other nodes that seem to be acting contrary to the established rules.
One of those consensus rules is the halving of mining rewards every four years approximately and it is this halving that causes the total supply to converge toward 21 million.

Note that many Bitcoin terms are arguably poorly chosen and misleading. This is one of them. These rules are Bitcoin rules or hard rules. Don't get hung up on the word consensus or dictionary definitions of that word.

Is this modifiable?

Rule changes can result in a fork. This can result in the creation of an altcoin. An altcoin is a cryptocurrency that is distinct from Bitcoin and seen by some as an alternative to it (hence the alt in altcoin). One example would be the altcoin "Bitcoin Cash" (BCH) which is the result of rule changes made by a small faction of Bitcoin (BTC) users. The proponents of this change had originally hoped that almost the whole Bitcoin community would adopt their rule changes. If they had succeeded, Bitcoin would now be using the rules of Bitcoin Cash and Bitcoin Cash would not exist. They failed in that original goal.
It is possible to make some rule changes in a way that doesn't trigger the distrust of other nodes that are still using the older rules.
This is a bigger topic than I can cover here but there will be good answers to existing questions on this subject:

What is a soft fork?
Would it be possible to create a soft-fork for reducing miner reward?
How do we know which soft-forks were implemented using User-Activated Soft Fork or Miner-Activated Soft Fork?

Tangentially related questions

Why was the upper limit of 21 million bitcoins put in place?


Validation methods beside POW etc Are there other concepts for the validation of the next added block to the blockchain beside POW, POS etc.?

Of cource there are, but is there a methode that is shining out of the mass?
A methode that can be a future mechanismen better than the current ones? That needs alot less electricity etc. to validate blocks?

None that is secure in a decentralized environment. Only PoW is secure.


bizarre transactions involving one address Why would anyone spend $65 in fees to send 500+ outputs for .001BTC to the same address?https://blockchain.info/tx/0270a4af1269b52bf242390076faa460cfcffe2db74bc748163d8de94e9ce875
then clicking through to the input address, it has some really bizarre transactions. Tons of transactions that have undecodeable outputs, and also, blockchain.info shows that only .003 btc was transacted for many of them, when clearly more was transacted. Indeed, clicking through to the transaction itself shows the correct amount. What is going on here??
https://blockchain.info/address/1F89hmmrtonJfAQNAqDmeDadcw7AsZcvXG

https://blockchain.info/address/1F89hmmrtonJfAQNAqDmeDadcw7AsZcvXG

The "Unable to decode output address" are as Nate commented OP_RETURN scripts whose purpose is to insert a short message or data snippet into the block chain. They are not so bizarre

Looking at some of the timestamps on the smaller transactions they are not all sent at the same time and fairly spaced out like someone might be manually making the transactions as opposed to a script running.  Each transaction is approx 30 USD so maybe not so unusual?


What does "proof of reserves" and "proof of liabilities" mean? What is a brief way of describing what proof of reserves and proof of liabilities mean?
What is their difference?

I have searched and read but I haven't got it yet.
Is it done by an auditor? Is it an audit?

Proof of reserves: This is proof that you actually control at least a particular amount of particular assets.

Proof of liabilities: The is proof that you do not owe more than a particular amount of particular assets.

So, for example, if an exchange can prove that it has reserves of 15,000 Bitcoins and that its owes its customers no more than 14,500 Bitcoins, then it has proven that its Bitcoin holdings are solvent.


my transaction is still uncormed after 48+ hours I was sent money to my coinbase account and it is still unconfirmed, this is the longest transaction yet for me. can anyone help?

hash id: 9cca279484347e0e17a2a40f3e38fc62e91db0e4c4bd2834f5a504e1ed628733

You only attached ~$2 in fees. The average transaction fee right now is ~$40source. It will take a while, if ever, to confirm.


How to get more chain tips from getchaintips? I've just restarted my node. When I run getchaintips, it only gives me 48 tips (the lowest being at a height of 402,609).

Does getchaintips only return a limited number of branch tips? If so, is it possible to get more branches?

It returns all branches your node knows about.

Note that your node cannot know anything about branches that occurred while your node was still syncing, as you only get the active best chain from your peers.

Also, if you are connected to a single node only for a while, then you will during that time not hear about any branches, as you only get to see the best chain as it is determined by your peer.


How to become bitcoin developer? I am a PHP developer and want to learn about bitcoin development.

I've searched on Google many times, however I can't get any perfect links that explain what is the requirement to become a bitcoin developer.

I don't currently understand bitcoin terminology, so all the articles are above my comprehension level.

So my questions are:

To become a bitcoin developer, how much knowledge do I need to have and from where I can get?
I'm a PHP and JavaScript developer; what type of development on that I can try?
Where can I get knowledge about bitcoin, wallet and BlockChain terminology?
I've also checked bitcore, bitcoin, and bitcoincore websites, however there are no beginner type tutorials.

In short I'm a blank slate with regards to BitCoin and BlockChain technologies.  Can you provide any guidance to start in this new field?

The easiest way is the same as for other topics:
Search for an open source project where you can help. They often have a list of tasks, sometimes a list of jobs to be done in different categories, from translating their website over artwork to C++ programming or whatever they are using.

Another way is to create something that helps you. Maybe you want to check the blockchain size from your smartphone? Write some PHP program which checks the size of the file on your PC. Maybe you start reading about the format of the file and extract more interesting data and finally you created some useful project for others.
I do not know what interests you and what you can do, you need to find for yourself what you want to do.

For the knowledge part: There is documentation about the program, the protocol and BIP-documents for new (and existing) features. The client itself is open source and miners are as well. You will need to read some more technical documents or source code, but as a developer this will probably be not new for you.


Transforming existing private key into new private key? Is it possible to derive a new private key from an existing private key and retain the same bitcoin balance without any transactions?

No. A private key corresponds to one public key (and vice versa), and that corresponds to one address (and vice versa). Having a new private key (regardless of where it comes from, so it could be derived from a different private key) would mean that you have a new public key and a new address. Thus you cannot spend any funds associated with the first address with the new private key because it is not associated with that address.


Why does the daemon require peers in order to start mining? I wanted to start mining Bitcoin from the genesis block, so I cloned Bitcoin and removed the checkpoints. Then I compiled and started up the daemon. I wasn't connected to any other peers, however, so it wouldn't let me mine. I did ./bitcoin-cli setgenerate true but ./bitcoin-cli getmininginfo said I had 0 hashespersecond. When I connected to just one other peer, though, (a peer which also didn't have the checkpoints or the block chain), I could start mining.

Theoretically, though, why wouldn't the peer just let me mine on my own chain and not broadcast my results to anybody? I know it's not really a peer-to-peer network in this case, but I don't see why it would harm anyone to allow mining like this. Where in the v0.9.3 code does it essentially say "if not connected to peers, then don't allow generation"?

I wanted to start mining bitcoin from the genesis block

I'm pretty sure regtest will let you do that.

  why wouldn't the peer just let me mine on my own chain and not broadcast my results to anybody?

Because that would be pointless. You're not confirming transactions, and you won't get rewarded for your mining. Your chain will probably be overwritten the very next time you connect to the network.

  Where in the v0.9.3 code does it essentially say "if not connected to peers, then don't allow generation"?

Here:

if (Params().NetworkID() != CChainParams::REGTEST) {
    // Busy-wait for the network to come online so we don't waste time mining
    // on an obsolete chain. In regtest mode we expect to fly solo.
    while (vNodes.empty())
        MilliSleep(1000);
}

It's here on versions after 0.9.3:

fMiningRequiresPeers = true;

This commit  changed it.


Privacy approach for a light-weight wallet I am looking for an approach to build a privacy centric lighter weight wallet.
By privacy centric I only mean: network observers should be unable to guess the addresses belongs to the same wallet.
So querying information about addresses should be private.
By light-weight I mean:
1. Do not store hundreds of GB of data (a few is fine).
2. Do not sync for ages. Should be finished within an hour maybe.
The lightest privacy preserving approach I was able to find is pruning, what solves my first criteria, but not the second.
BIP37 is not a good. (See: https://jonasnick.github.io/blog/2015/02/12/privacy-in-bitcoinj/)
Do you guys have suggestions? (Or direct me to a better room to ask this question?)

I conducted an extensive research on the topic and to date the lightest weight wallet, that is resistant against network analisys is a full-SPV wallet.
The structure of it is evident and some are already working on it, including me. This wallet would basically sync the headers and only download blocks from the creation of the wallet, and would store them in a pruned manner.


Mistakenly sent BCH to BTC bitfinex wallet - can I get my BCH back? I just made the huge mistake to sent BCH from Exodus to my BTC wallet in bitfinex. Can I by any chance get my BCH back?

They will be recoverable, but only by the exchange the money was sent to.


Would mining future bitcoins break the bitcoin? assuming an bitcoin miner with very much hashrate like bitmain would decide to mine "future" bitcoin blocks and provide them within very short time to the network, would this break the bitcoin?

As i understand the bitcoin hash is generated from the version, previous block hash, the merkle root hash, current time, difficulty / target bits and the nonce. The bitcoin network does only accept blocks for timestamp with max. 2 hours in the future.

But what if an miner with that much power would start mining for a future timestamp at which he assumes it would be possible for him to mine up to 2016 blocks (every block with a little increased timestamp) before the timestamp is reached. If this would be possible, the miner would only need to mine one more block when the timestamp is finally reached to bind the chain (the missing block for the previous block header hash) and could provide all his mined blocks a nearly one timestamp to the network. The target / difficulty the miner mines at would be a little be greater than estimated by him.

Wouldn’t the network increase the difficulty after this action by such an huge factor, that mining the next 2016 blocks would be nearly impossible?

As I understand the bitcoin hash is generated from the ... previous block hash, ...

So, the new block cannot be mined until the block it is building on exists. If a miner can mine so fast it does not have to wait to release blocks, it can just do so. The difficulty will then adjust.


How can I get back my bitcoin from a backup folder I want to restore my bitcoin wallet which backup in 2013, I have the backup folder and a password(not secure words).

Anyone know how to do?

Do you want to loose part of your bitcoins?

In every transaction you do new "wallets" are created and stored within your wallet and part of the bitcoins is moved from the original to those addresses to avoid tracking of addresses from outside observers. Those transactions will be lost forever.

If you haven't done any transaction since you made your backup just restore the wallet (make a backup of the new one just in case) and resync transactions, that should do it.

Import wallet.dat into a new Bitcoin-Qt client


Desktop Client Recomendation can you recommend me any desktop clients ? So far I have tried bitcoin-core, Electrum and MultiBit. I liked Bitcoin Core, but as the blocks increase, it becomes extremely heavy. In my computer, it takes more than 10 minutes just to start, and while it is syncing I can't do anything else without freezing my computer, MultiBit uses the file from a server, so it syncs very fast, but the wallet seems to be incompatible with the wallet.dat and it doesn't seem to allow importing the private key, it only allows importing wallets generated by itself. Electrum is fast, doesn't freeze anything, it allows to import private keys, but it is taking way too long to sync, so i think it is downloading the blockchain...

So, I would like a wallet with these characteristics:

Allows to import/export wallet.dat file (or private key) (like Electrum and Bitcoin Core)
Don't need to download the whole block (Like MultiBit)
Runs on Linux

thank you all :)

Electrum does not download the whole blockchain. I would recommend giving it another try as it should be pretty much as fast as any other app. One thing you could try is switching the validation server. This would possibly increase the speed at which you are able to sync up.

About electrum validation:
"This wallet uses SPV and random servers from a list. This means little trust in third parties is required when verifying payments. However, it is not as secure as a full node like Bitcoin Core."

Information above taken from: https://bitcoin.org/en/choose-your-wallet

The above resource should help you pick another wallet besides electrum if you choose to do so.


How do exchanges manage their bitcoin/crypto? It only takes 1 employee with private keys to steal it all So hear me out. I understand exchanges have hot/cold wallets and mostly use their hot wallets. But at some point they need to send crypto from their cold wallet to their hot wallet.
Who does this? The CEO & only the CEO? Technically whoever holds the password to these keys could send it to any address and it not be retrievable. The person would be in a lot of trouble but the crypto would probably be unobtainable.
Even if that crypto is "insured" the insurance company would probably only be able to payout in fiat.
Basically, how do exchanges keep your crypto secure?

Nice question. I assume the following:

Most of the funds are stored in "Cold wallets".
All the transactions are made from "Hot Wallets"
There is an automatic system that detects that the hot wallets need to be recharged.

I don't think such operations are made by a human. Maybe there is a human who checks such transactions. But everything is done automatically.
We can also assume that the CEO has access to the keys and funds. But we will never be 100% sure. It's crypto. That's why different decentralized platforms like UniSwap are popular right now.


Do unsynced Bitcoin ABC nodes send Bitcoin transactions instead of Bitcoin Cash transactions? Bitcoin ABC is fully compatible to Bitcoin up to the fork. Does that mean that an unsynchronized Bitcoin ABC node sends Bitcoin transactions instead of Bitcoin Cash?

The latest version of Bitcoin ABC that is released before UAHF happened, sends Bitcoin-style transactions if it is not synced.

Proof: https://github.com/Bitcoin-ABC/bitcoin-abc/commit/fda9dab6a9fba4a95aa2d9620f28b787efccf748

The current latest version always sends Bitcoin Cash transactions.

Proof: https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/src/wallet/wallet.cpp#L2966


Can I use same WIF/privkey to make myself a segwit address? I think I know the answer, but want to make sure asking here.
I have my old privkey/WIF and some funds on associated legacy bitcoin address. Reading this code https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L50 I think I can make a segwit address out of my private key, transfer all funds to this segwit address, and I will still be able to use old private key to control those funds?
Thanks!

Yes.
If the P2SH-P2WPKH is implied (which is segwit reflection of plain old P2PKH like in your case), you still use one private key to derive a segwit address, and you still can reuse this private key to create a redeem script.

In fact, segwit address is derived from a redeem script.

But, there is a restriction, that unlike P2PKH, where you can use uncompressed and compressed public keys to create two separate addresses, in P2SH-P2WPKH, only compressed one must be used.

So, it is technically possible, given that you fully control address and transaction generation. Otherwise, it is on your wallet to give you such functionality.


Which is the official site to download the NXT (nxtcoin) wallet app? Where is the official site to download the NXT wallet app?

There is no the official site.

You can download NRS (Nxt Reference Software) by following links from https://nxtforum.org/nrs-releases/. If you trust Jean-Luc then just check the file checksum. If you don't then analyze the source code and compile it yourself.


How can I import a private key? I'm trying to get my coins out of an old MultiBit classic wallet. I fired up Multibit classic and tried to send the funds to a new wallet. Unfortunately, my password wouldn't work. Damn.

But! I found this script on multibit's support forums. https://multibit.org/help/v0.5/help_lostOrForgottenPassword.html

#!/bin/bash
echo Usage: apply-guesses.sh [password CSV] [key file]
echo Password file: $1
echo Key file: $2
for password in $( awk -F , -v OFS=' ' '{print $3}' $1 ); do
   echo ------
   echo Attempting: $password...
   openssl enc -d -p -aes-256-cbc -a -in $2 -out recovered.key -pass pass:$password
   if [ $? -eq 0 ];
     then
       echo "Success!";
       break;
     else
       echo "Failed";
   fi
   echo ------
done

I ran the script using a csv of all my old bitcoin passwords and I got a success!

It returned this: (I changed all the numbers)

Attempting: password123
salt = 9823498243829374
key = 98237890238420938429830394850394
iv = 98743259384793847593844
Success!

But when I tried that password it still said it was incorrect. :(

But! it also created a file called recovered.key. I opened up the file and it was a bunch of badly encoded gibberish symbols like this: '¦ÀÌÁïûê¿^½”ß/øZÄÑQÛ,i¹´$'

I read somewhere that multibit keys are base 58 encoded so I encoded the recovered.key base 58 style and it became much more legible. Now I have a string of letters and numbers that's 611 characters long and starts with a '3'. Is this my private key?

I've been trying to import it into a new wallet in MultiBit classic, but no luck so far. I exported a private key from a new empty wallet and it looks like this: (I changed the key for this post)

# KEEP YOUR PRIVATE KEYS SAFE !
# Anyone who can read this file can spend your bitcoin.
#
# Format:
#   <Base58 encoded private key>[<whitespace>[<key createdAt>]]
#
#   The Base58 encoded private keys are the same format as
#   produced by the Satoshi client/ sipa dumpprivkey utility.
#
#   Key createdAt is in UTC format as specified by ISO 8601
#   e.g: 2011-12-31T16:42:00Z . The century, 'T' and 'Z' are mandatory
#
L1paCgWAYm2wzRfznmcoy5pbskdhShRVneAzBeuwaj244s7fr9nE 2017-09-04T21:54:32Z
# End of private keys

I swapped out the key in that wallet with my base58 recovered key, but it was a lot longer than this, and when I tried to import it it told me "Could not understand address in import file"

So... I have a really long string that I think is my private key, but I don't think it's in the right format. Also I might just be an idiot. Can anyone help me out?

This is a failed decryption

Unfortunately, openssl can sometimes respond with a zero even when the result is a failed decrypt due to padding and it appears that this is what has happened here.

I have more passwords to try...

I'd suggest modifying the script to avoid the break; after success. This will ensure that every one is tried. You can then go over the output and try the alternatives manually until you see an output that matches the # KEEP YOUR PRIVATE KEYS SAFE ! line which is the true representation of a successful decryption.

None of them worked...

If you are unable to unlock the wallet with the password then there are two possibilities:

You have the wrong password - more common that you'd think even when people swear blind that they're typing it correctly
The wallet/key file has become corrupted - very rare but exposes the fragility of encrypted files containing random private keys

Data does not exist unless it is in two places - ideally a local backup and a remote one. Even then files get corrupted just through hardware issues.

It was for the above reasons, and others, that the MultiBit development team strongly urged people for years to upgrade to MultiBit HD and the associated seed phrase which mitigates this situation entirely. Further, when creating keys and writing them out, MultiBit Classic checks that the data can be successfully read back in using the offered password.

What has happened?

In general when a file is AES encrypted there is a header section containing encryption specific data (key, salt, initialisation vector etc) then comes the main body of data. A corruption in the header section is a very serious problem as it renders decryption of the entire body almost impossible. A corruption in the body section allows for the wallet to be decrypted successfully but it could contain erroneous data.

What can I do?

Your first response should be to use reputable file recovery software. This will hopefully uncover early versions of wallet/key file backups and may undo the corruption through repair operations.

The quickest way to check the recovered files is to use OpenSSL as follows:

openssl enc -d -p -aes-256-cbc -a -in <ciphertext file> -out <plaintext file> -pass pass:<password>

The plaintext file should contain the text # KEEP YOUR PRIVATE KEYS SAFE ! if it has decrypted correctly (as shown in the question).

Next, find a wallet/exchange that accepts private keys and sweep the recovered bitcoins into a hardware wallet protected by a seed phrase - such as Trezor.

That didn't work

If all you have is a damaged file your last hope is to try to work out how the file has been corrupted. If it is in the header section where the key, initialisation vector, salt etc are stored then that's bad news. It's going to take a lot of work to rebuild those.

If it is later then you could get a partial decrypt but have incomplete private keys. Bitcoin does have reasonable checksums so you could use a key recovery script to try various combinations until one gives a working checksum. You can then look up the associated address of the public key and check for your funds.

In either of the above cases of corruption you will need to be a very accomplished coder to successfully rebuild the files. You might want to consider sending it to a specialist service.


How to find your private key with your 12 Word Password Phrase and the depositing Address? I use MyCelium v14 for iOS. In the past 72 hours, the address could not synchronize because the servers are "down, unpaid for".

I have used my 12 Word to access MyCelium via Android App and Jaxx, and now Exodus. Here is my issue, I have both transaction Hashes and addresses of where my coin are and I have my 12 Words, the issue is you're able to Add more Accounts on MyCelium, for example I can have my Main Account, Account 1, Account 2, Account 3 etc and they have have their own generated addresses and all of that sort.

I've been speaking with the Android developer and he's been discussing that I will need to keep creating new accounts and depositing coin to each new account so I can create a new account until I find the account with my bitcoins. This has been very frustrating since I been using MyCelium for 5 years now and they have stopped updating the iOS version for 2 years, yes I should've moved to a different address but unfortunatley I've placed all my eggs in one basket.

Am I able to find my private key/account with my 12 Word Passphrase and my depositing addresses/transaction hashes that the coin is currently stuck in?

The 12 words encode a seed that can be used to derive bitcoin addresses. There are an infinite number of derivation paths you can take using any one seed, so knowing the right derivation path will be necessary to recover your funds.

A quick google search tells me Mycellium uses the BIP44 derivation path: m/44'/0'/0'/0

So you just need to find some software that allows you to specify the path being created, and point it to the correct one.

  I've been speaking with the Android developer and he's been discussing that I will need to keep creating new accounts and depositing coin to each new account so I can create a new account until I find the account with my bitcoins.

You most definitely do not need to send any bitcoin to any wallet you generate, in order to determine if it is the derivation path you are looking for. Upon being supplied the correct path, the wallet should show you your transaction history as per normal, as long as it is correctly synced with the network.


Why was the Oct 2015 Transaction Malleability event possible in spite of BIP62/66? The recent re-emergence of transaction malleability has been responsible for a large number of Txs which are being double spent (October 2015).

/r/Bitcoin has posted some C++ code which @amaclin has taken responsibility for.

I understand that, based on this source code, the transaction malleability "exploit" is simply tweaking the DER signatures for certain Txs (ie non P2SH Txs) and rebroadcasting the Tx (disclaimer: I don't know C++ so these are educated guesses).

BIP62 deals with numerous issues, amongst these is the requirement for canonical DER signatures: I was under the impression canonical DER signatures was implemented in BIP66.

Can someone clarify what @amaclin's code is doing?
Why is this exploit possible if BIP66 was implemented several weeks ago?

Canonical DER signature implemented in BIP 66 fixes issue #1 of BIP 62 ( Non-DER encoded ECDSA signatures )

Amacilin's code exploits issue #5 in BIP 62 ( Inherent ECSDA signature malleability ),  and is explained here : https://github.com/bitcoin/bitcoin/commit/a81cd96805ce6b65cca3a40ebbd3b2eb428abb7b

This issue was fixed by requiring signatures to have low-S encoding in pull request 6769 : https://github.com/bitcoin/bitcoin/pull/6769 . Note that this fix only prevents mutated transactions from being relayed (transactions without low-S encoding can still be mined into blocks).


How was the magic network ID value chosen? Messages on the Bitcoin network are identified by the magic value 0xD9B4BEF9, and on the testnet by 0xDAB5BFFA. Why were these values chosen?

main.cpp carries this comment:

// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };


Cost of single vs multiple outputs to the same address A transaction can have multiple outputs pointing to the same address however it's not clear to me if and how this affects the transaction's priority and cost?

As an example, let's consider these two simple cases:

Case A: Two outputs pointing to the same address use the same input in a 50/50 split.
Case B: Two outputs pointing to the same address use two different inputs of equal amounts.

A transaction that has multiple output scripts that point to the same address would be no different from a transaction in which every output script pointed to a different address. So when you have two outputs to the same transaction, all that matters is that you have 2 outputs and the size of those outputs (byte-wise).

Transaction priority is calculated as follows:

priority = sum(input_value_in_base_units * input_age)/size_in_bytes

As you can see, only the tx size matters and the input value and age. None of these are influenced by the address to which coins are sent.


Does spy mining negate the harm caused by big blocks on decentralization? In the question Do larger blocks make it harder for smaller miners to compete? Why? there are some reasons given for why larger blocks hurt smaller pools. Is this still the case with spy mining?

Spy mining is when a mining pool connects a dummy miner to another pool to subscribe to the latest block hash, without waiting for new blocks to propagate.

Another description of spy-mining is here.
Is the only impact of larger blocks is an increased frequency of empty blocks or am I wrong?

No, it temporarily attenuates the issue, but doesn't resolve the problem. A spy miner gains less reward for an empty block than the large miner building on its own block. Currently, transaction fees make up about 11.7% of the block rewards (average over last week). As the subsidy decreases in the longer term, the transaction fees are expected to make up an even greater relative portion.
Larger blocks would exacerbate the issue as the spy miners would spend more time in the state of reduced revenue, which translates directly to reduced revenue for whomever didn't find the previous block.


Hashgraph public ledger (51% attack) I have some basic doubts about consensus algorithm like hashgraph. For instance, let's take Raft the simplest leader based consensus algorithm, we cannot use it in a decentralised setting because it's very easy for a single attacker to take control of the cluster by spinning thousands of nodes to support him.

"In summary, the voting based algorithm makes it very easy for the attacker whether its leader based or leaderless. So we cannot use it in a decentralised setting."

Algos like PoW make its difficult for a single attacker to take over the network through the computational puzzle.

Taking about hashgraph it's again a voting based algorithm, so wondering how it prevents a single attacker from getting control of the network in a decentralised setting (where you cannot trust your peers)???

I do understand how hashgraph works but wasn't able to visualise it in a decentralised setting. Any insights? Thanks

Seeing this a year late, but if this is still a question then -

Hashgraph isn't exactly a voting based algorithm. It does "virtual voting" through "gossip about gossip" i.e. nodes not just gossip that there is a new transaction, but also gossip about when they heard it, who told them/how they heard it (literally gossiping about the gossip!)
This way every node has the COMPLETE knowledge of the network. If node A knows everything that node B knows, A can also find out what B will vote (WITHOUT B actually voting!)

Also, hashgraph never says that 51% attack can't occur. Through Byzantine Fault Tolerance even a  34% attack can occur (if more than 1/3rd of the nodes are malicious).
Hashgraph just says that DDoS or DoS (Denial of Service) attacks can't occur because there are no leaders.

Refer to the Hashgraph whitepaper or the scientific paper on its consensus algorithm: https://docs.hedera.com/docs/hashgraph-overview or https://www.hedera.com/whitepaper


The version is wrong:

I have 02000000

But the one that appears on the block is

Version 0x20000000

Doing the formatting:

00000020

Calculating the hash of the block:

from hashlib import sha256
import hashlib
header = "0000002066720b99e07d284bd4fe67ff8c49a5db1dd8514fcdab610000000000000000007829844f4c3a41a537b3131ca992643eaa9d093b2383e4cdc060ad7dc548118751eb505ac1910018de19b302".decode('hex')
print sha256(sha256(header).digest()).digest()[::-1].encode('hex')

And the answer is:

00000000000000000020cf2bdc6563fb25c424af588d5fb7223461e72715e4a9

That is the original hash in the block:

00000000000000000020cf2bdc6563fb25c424af588d5fb7223461e72715e4a9


How does a full node decide which outbound peers to have? I understand that a full node can have up to 10 outbound connections (8 full relay peers and 2 block-relay-only peers). I wonder how my full node decides which nodes to connect to for outbound. What are the selection criteria does a node use to evaluate if a peer is good?
If I want to connect to a new specific peer (let's say I know the node's owner IRL or something) but I have already reached my outbound capacity, what specific criteria does my node use to decide which outbound peer to drop in order to make room for the new peer?

Addresses for outbound connections are largely chosen at random. The filtering of addresses comes at the time the addresses are first received by the node before they are added to the address database. This filter checks what services the nodes offer, what network they are on (e.g. IPv4, IPv6, TOR), and the time that they were reported to last be seen. Your node will choose to store addresses that are recent, use a network that your node is connected to, and offers full node services (NODE_NETWORK and NODE_NETWORK_LIMITED). We also avoid nodes that have been recently disconnected or banned.
These addresses are stored in buckets. These buckets are based on /16 for IPv4 and /32 for IPv6. In the future, these buckets will be determined by Autonomous System.
When making outbound connections, nodes are basically chosen at random. Your node will ensure that each outbound node belong to different buckets. If a node is chosen that belongs to a bucket that already has an outbound connection, it is skipped. We also try to choose nodes that we didn't already try to connect to recently unless we have built up a lot of failed connection attempts. Lastly, your node will try connect to nodes using the default port unless there have been a lot of failed connection attempts.
For nodes that you are specifically adding with addnode, these nodes do not take up the standard outbound connection slots. There are an additional 8 addnode connection slots. If these are full, then the node that you are adding will simply wait until one of those nodes disconnects before a connection to it is attempted. So there is no kicking of outbound peers at all.


What positive effects can Quantum Computers have on the Blockchain technology and hence Bitcoin Quantum Computers
We always fear what we do not know. This statement has been proven right throughout the history of mankind and has resulted in significant evolution, even though there was always speculation of singularity (existential crisis).
Not hopping the "Quantum Computers will destroy Bitcoin" wagon; I'd like to explore the positive outcomes or the use cases that Quantum computers could be used for, in blockchain technology.
Edit 1:
Just to clarify, this is not a duplicate question as it discovers only positive impacts that quantum computing can bring to the technology.

A couple very hypothetical examples:

Quantum channels: These channels allow wiretap resistant transmission of data. Bitcoin users can share secret information such as keys over quantum channels in such a way that any wiretapping would be detectable.
Database queries: Quantum computers can search through a database in time O(N^(1/3)). This could potentially speed up lookups in a blockchain. Say I want to transactions that correspond to my public key. For one billion transactions this can be done in only a thousand steps (ignoring gigantic constants probably).
Quantum simulation could perhaps lead to better hardware so that's always nice.

However, the biggest real impact that quantum computers have right now on cryptography and thus cryptocurrencies is something different: They encourage cryptographers to explore new and interesting schemes and cryptographic assumptions. The study of these new assumptions and schemes could lead to more useful cryptographic tools which we couldn't build from other assumptions. The prime example for this is fully homomorphic encryption which can be built from ideal lattices. These lattices were first used in cryptography to build quantum resistant cryptography.


How to create a SPV client? What are the steps a SPV client takes in order to sync?

Connect to a peer
Set bloom filter for wallet addresses
Download all block-headers since latest checkpoint
Request every block again with filters set
Update wallet balance based on returned blocks

Obviously the above steps are wrong since it makes no sense to first download all blockheaders to determine the correct chain, and then re-request all blocks to calculate the wallet balance.

But what is the correct procedure?

This is what I do:

Connect to peer
Set bloom filter
Send 'getblocks' message
Send 'getdata' message with MSG_FILTERED_BLOCK set for any new blocks

Note that 'getblocks' returns a list of block chain hashes from the specified starting point, not the blocks themselves.  Then 'getdata' returns 'merkleblock' messages instead of full blocks.  The peer follows the 'merkleblock' message with any transactions that match the bloom filter as separate 'tx' messages.

More details are in BIP0037

If you want an example, my Java wallet can be found on GitHub


API for downloading block chain data I was looking for an API to download block chain data in real-time so I use the transaction data for analytics.

Is anyone aware of a good API for this?

If you are using the bitcoin-qt client https://en.bitcoin.it/wiki/Bitcoin-Qt, you already have the blockchain in your hard drive (in the /bitcoin folder). The files blk000x.dat (blk0001.dat is the first part, blk0002.dat the second ...) contain all the data. blkindex.dat has the index to the blocks.

With the command line version, bitcoind, you can check blocks, transactions. The files can also be studied with bitcointools:
https://github.com/gavinandresen/bitcointools

If you are using some other client, the files will be somewhere else, but most likely they will still be there.


Why can I only see the balance of my wallet and not the one of each of my receiving addresses? (Multibit) I have some troubles to understand the logic behing addresses and wallets. I use Multibit to manage my BTC. I have one wallet with 5 receiving addresses. I have transfered from an exchange website 0.1BTC to each of my receiving address. So Multibit indicates that my wallet balance is 0.5BTC (to simplify, I don't include the transaction fees).
So far so good.

What I don't get is why I can't see  in multibit the balance of each of my receiving addresses seperatly, like:

A1 = 0.1
A2 = 0.1
A3 = 0.1
A4 = 0.1
A5 = 0.1

If I got it right, it's because now the 0.5BTC aren't anylonger tied up to the receiving address I sent them to but only to my wallet. This would mean that it is useless for me to send money from my wallet to a A1 for example to get this new balance...

A1 = 0.3
A2 = 0.1
A3 = 0.1
A4 = 0
A5 = 0

...because it would be exactly the same as the total balance of my wallet would still be 0.5BTC. But this doesn't seems right because blockchain track the amount of transaction per addresses.

But then why can't I choose from which "receiving" address out of the 5 I have, I want to take the money of when I sent BTC? Multibit only ask me the receiving address where I want to send the money to not the address where it takes the money of. Who get to choose which  sender address will be kept in the blockchain?

This is really confusing! Thanks for your help!

There are multiple reasons why you do not see individual address balances or get to choose the sender address:

For privacy reasons your client will generate a new address for every change output in your transactions. Soon, you'd have many more addresses; and choosing from a long list of addresses is not user-friendly.
"Addresses are not wallets nor accounts, and do not carry balances. They only receive funds, and you do not send "from" an address at any time." (see Address Misconceptions)
There is no "from" address (see From address)


My friend's address was spent right after I paid him. What happened? Last time I sent some bitcoin to my friend and the fee that I used was a little low, so I tried to broadcast the tx with online broadcasters. After that the tx was spent from my friend's address (not from mine). It showed that my tx confirmed, but as it confirmed another tx was initiated from my friend's address without the permission of him and was spent to another address what kind of attack is it? I think it's not called double spend since it's not spent from my address, it reached his address first but was then spent from him. Can someone explain??

If I read it correctly, your friend had an address, to which you paid. Then someone took it from their wallet?
It might be because your friend's device is hacked or he doesn't use a trustworthy wallet.
Or it was him who spent the coins. It's also possible that they are lying to you so that you pay them again.
Double spend attacks involve the same person spending to two different addresses. Since your friend is not the voluntary author of both transactions, this is not double spend.
I can't comment further without more info.


Decoded transaction hex without enough signatures? Can someone show me the output of decoderawtransaction when the transaction requires multiple signatures, but it hasn't been signed by enough people, and the transaction was created using createrawtransaction?

Tips: 14y7Zx9V19AJHD8AKDYa46WnKH1Ey7atd5

{
    "txid" : "0a7bc048ce3bebbd77dd16a5113978284a424eae766b680bb4a258322701d227",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "551cc8a4953515b845ed2ea37037877be32118d81259cb8b36d7d42a1ae83b29",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00010000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 b36797fc263fc01d374ace37a0ea30c444fbfa73 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914b36797fc263fc01d374ace37a0ea30c444fbfa7388ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1HMc49uNVcw9yxREZ2NztL8wAb9dg4n8tN"
                ]
            }
        },
        {
            "value" : 0.00010000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 b2e1d360c89521feda58dc194b324a7cd442e48b OP_EQUAL",
                "hex" : "a914b2e1d360c89521feda58dc194b324a7cd442e48b87",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "3HzrjLKjMmH5chsadUWxr7DJzhRf771V2r"
                ]
            }
        }
    ]
}

I did not give a scriptsig when I created the transaction.
If I had given a scriptsig, then it would appear in this decoded transaction.

The only time you should give a scriptsig (I think) is when you are creating multiple transactions that depend on eachother, and you are not broadcasting them.


Get blockchain info for exchange transaction I'm sorry in advanced if this questions are dumb but here goes ...

Does all buy/sell bitcoin related transactions made in exchanges get logged in the blockchain? if so can they be found and/or tracked somehow using API?

Example

Given the following data recieved from BTER API describing some transaction in the BTC-CNY market

{
    date: "1442039516",
    price: 1544,
    amount: 0.01,
    tid: "11958597",
    type: "buy"
}

Is it possible to find the from/to addresses of this transaction? if so how?

Orders on exchanges are completely internal, there is no corresponding transaction made in the Bitcoin network. The volume of transactions happening on Bitcoin exchanges far exceeds the total number of Bitcoin network transactions, it's not feasible on many levels for it to work this way, even just from a latency and confirmation perspective.


What exactly is checked at various -checklevel's? The standard bitcoin-qt/bitcoind client has an option -checklevel which purports to perform various checks on the block data stored on disk.  Is there current documentation (other than the source) describing specifically what is checked at the different levels?

The function VerifyDB in the source has brief comments describing the levels:

// check level 0: read from disk
// check level 1: verify block validity
// check level 2: verify undo validity
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks

It would be nice to see these explained in terms of the Bitcoin protocol.  For example, are block hashes verified?  Do we check that all the blocks in the chain correctly link back to one another?  Are transaction signatures verified?  Et cetera.

The other answer seems to be out of date, even at the time it was answered. The following seems to be a more up to date explanation:
From https://bitcointalk.org/index.php?topic=141200.msg1504768#msg1504768

0: Validate all block headers + compare (by hash) to blocks on disk for the last -checkblocks blocks
1: In addition, verify (standalong) validity of those -checkblocks blocks
2: In addition, verify that undo data matches checksums
3: In addition, check that the current chainstate matches can reasonably be the result of the last N blocks, where N is limited by both -checkblocks and the amount of in-memory cache (-dbcache); typically it's around 150.
4: In addition, for the last N blocks (see above), do full validation (including signature checks).

Note that the new default (3) is in fact a stronger check than the previous highest level (6).


Hashflare: cannot go back to Not Reinvest Does anybody know why I can't go back to "Not reinvest" with hashflare ? Thanks.

You can click on 'Reinvest' and when you see the list for which one you want to reinvest with (SHA-256/ Scrypt) there should be an option at the top that says Do not reinvest. It should be updated within 24 hours!


bitcoind is not downloading blockchain I have installed bitcoind on Ubuntu Server. It didn't download a single block

bitcoind getblockcount

This returns 0 everytime I run.
Here is bitcoind getinfo

{
    "version" : 80500,
    "protocolversion" : 70001,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 0,
    "timeoffset" : 0,
    "connections" : 0,
    "proxy" : "127.0.0.1:9050",
    "difficulty" : 1.00000000,
    "testnet" : false,
    "keypoololdest" : 1385148166,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "errors" : ""
}


Is it possible for an individual to start their own blockchain working with Bitcoin Core? Is it possible for an individual to create their own blockchain from
Bitcoin Core?

I think the value of BTC is currently controlled by miners in China and I want to create a blockchain with either a filter on who can mine or a limitation on the amount each individual can mine.

It is indeed possible, with some tweaks in the code to differentiate from the original. Effectively, you'd be starting an altcoin with all the same parameters as bitcoin.

However, if it had everything exactly the same as the original, it would be very vulnerable as some big bitcoin miner could one day wake up and decide to point his hashpower to this new coin and perform a 51% attack.

Note that this new x-coin would be worthless unless you could bring enough people to actually use it and enough miners to secure it. But if it's a copy-cat of bitcoin, why would anybody come?


Editing the utxo database? Is it possible to manually add utxos to the utxo database?

Could this be done by editing the chainstate file?

Note that, like "the mempool", there is no "the UTXO database". You can change the UTXO database for one node and only that node. Such changes will not effect other nodes and does not change the state of the network. By modifying a node's UTXO database, that node has the possibility of forking off of the actual Bitcoin blockchain.

Is it possible to manually add utxos to the utxo database?
Could this be done by editing the chainstate file?

Yes it is possible to modify a node's UTXO database. It is just several files which you can modify directly. Bitcoin Core uses LevelDB so you will need to use something that can read and write to LevelDB databases.


Why Bitcoin address are 25-34 bytes long when RIPEMD 160 & SHA-256 are only 20 bytes and 32 bytes long respectively? (I'm new to Bitcoin & it's technology so correct me wherever u can) .Recently I was reading about Bitcoin and it's underlying technologies. I came to know that for generating addresses Bitcoin uses RIPEMD-160(SHA-256). But most of the Bitcoin Addresses are 25 to 34 Bytes(characters) long & starts with 1 or 3. How is this possible? Is there any underlying Encryption algorithm is there along with Hashing functions like RIPEMD & SHA?

Bitcoin address is generated as follows :

First 256 bits of Private key(k) is generated using underlying operating system's pseudo random number generating function (in wallet).

Then Public key (K) = G * k. , where G is constant on the elliptic curve. i.e. equivalent to k times addition of G and the resulting point K is on the curve which is 65 Bytes.

The address is calculated by performing SHA256 followed by RIPEMD160 on public key (K). so that would be of 160 bits = 20 Bytes of address.

Now, Add version prefix 00(in hex). Perform SHA256 twice on it. Take first 4 Bytes of result and append it to (prefix || address).

Resultant would be final address.


Offline wallet for blockchain.info With the removal of the feature to import ages.json files to MultiBit in 5.18, are there any other ways to take my backup and access my bitcoins in the event BlockChain.info ever dies?

Edit: Just saw this question which partly answers my question, but I would still like to know if MultiBit is the only client that can read these files.

Thanks in advance for the help

Blockchain.info's wallet is based on the code at https://github.com/blockchain/My-Wallet. (no license is specified that I can see, but it seems apparent that they wish you to have the right to use it to own your keys) But let's take the worst-case view we can regarding this: Blockchain.info is suddenly offline, and their My-Wallet code with all of its forks on github are removed. You have a backup (encrypted or double-encrypted) and you wish to restore it.

pinheadmz has created an open source blockchain.info wallet decryption tool, based on a tool that blockchain.info has temporarily removed.

I have downloaded the existing Import Wallet page and tweaked it to dump the private keys in an alert window. This works with all of the encryption schemes that blockchain.info currently supports. It's quite unpolished, but does the job. It outputs each private key in the format in the backup (usually base58, which is somewhat unusual) and hex. You can download it at this link.

To ensure that you can easily make use of the above output, you might also want to have an offline copy of the (open source, public domain) Brainwallet site, which I've made a copy of here.

You and I are hardly the only ones to think of such things. This thread offers some good tips on using your Blockchain private keys offline (e.g. enable the option for automatic backups to be emailed to you when your wallet changes). I think it's quite safe to say that (as long as you have a good backup and know the password(s)), with a little help from the Bitcoin community, you will always be able to recover your Blockchain.info private keys for use elsewhere.


Understand how transaction size and fees calculation works in caravan Looks like there is no activity in caravan github repository so maybe someone here can help me with this issue. Already mentioned everything in the below link however my three basic questions are:
https://github.com/unchained-capital/caravan/issues/173

How does tx size and fees calculation work in caravan?
How does it work in other projects if there is any better implementation?
Will there be a standard and easy approach to solve this problem in future which can be easily used by every bitcoin project?

The fee rate is pulled here:
export function fetchFeeEstimate(network, client) {
  if (client.type === BLOCK_EXPLORER) {
    return blockExplorerGetFeeEstimate(network);
  }
  return bitcoindEstimateSmartFee({
    ...bitcoindParams(client),
    ...{ numBlocks: 1 },
  });
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/blockchain.js#L97-L105)
It depends on if you are using a block explorer or a local bitcoind node.
If using bitcoind, it uses the estimatesmartfee rpi cal:
export async function bitcoindEstimateSmartFee({ url, auth, numBlocks = 2 }) {
  const resp = await callBitcoind(url, auth, "estimatesmartfee", [numBlocks]);
  const feeRate = resp.result.feerate;
  return Math.ceil(feeRate * 100000);
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/bitcoind.js#L111-L115)
As for the transaction size/ total fee calculation, caravan uses estimateMultisigTransactionFee from unchained-bitcoin
(https://github.com/unchained-capital/caravan/blob/fd214eb573c7185c01dfa2040aa914e87a0de359/src/actions/walletActions.js#L129)
Which depending on the transaction type (P2SH, P2WSH, P2SH-P2WSH) calls a transaction size estimator. The P2SH one is:
export function estimateMultisigP2SHTransactionVSize(config) {
  const baseSize = 41 * config.numInputs + 34 * config.numOutputs + 30;
  const signatureLength = 72 + 1; // approx including push byte
  const scriptOverhead = 4;
  const keylength = 33 + 1;  // push byte
  const sigSize = signatureLength*config.m*config.numInputs + keylength*config.n*config.numInputs + scriptOverhead*config.numInputs;
  const vsize = baseSize + sigSize;
  return vsize;
}

(https://github.com/unchained-capital/unchained-bitcoin/blob/e9177e7171c3bf11ad5c245c7d633dac484f409c/src/p2sh.js#L27-L35)
Regarding your other questions, I look forward to hearing more about this. When we wrote this, I wasn't aware of unspents. It would be nice if there was a standard, well-tested package for calculating transaction fees.
Regarding other projects: Lily uses unchained-bitcoin: (https://github.com/KayBeSee/lily-wallet/blob/5945175f9e25cc7a8ff29159de39c228b79ef205/src/pages/Send/utils.js#L48) so it's the same as Caravan. I don't know what Casa does. I would assume BitGo uses unspents that Murch linked to. I'm pretty sure Electrum has it's own thing, but I haven't looked, I'd assume the same for Specter.
Hope this helps, sorry we didn't get back to you on the caravan issue, infomational tickets like that are low-priority for us right now.


Do mining pools centralize the Bitcoin network and make it less secure? A mining pool with a significant percentage of the hash rate could allow double spend attacks by the pool manager. There are a number of pools that approach this level. However, most people say that a compromised pool would be easily detected, and the attack would be insignificant.

However, isn't this issue not about a single pool but the combined centralizing effect of pools? A moderate-sized attacker could easily compromise more than a few pool managers with a rubber hose attack, or pose as legit pools for a while until they obtain nearly complete control of the block chain.

The attacker would be able to double spend a lot of bitcoins (that it generated for itself with its pools in the first place), and regardless of any monetary advantage it could destabilize and destroy confidence in bitcoin. Easily within the capabilities and motivations of a government. A well-planned attack could happen far quicker than anyone could notice and pull their miners from the pools.

The short answer to your question is "yes".

Efforts are underway to develop schemes that allow pooled mining without the pool manager being able to control what transactions go into the pool's blocks, leaving that decision (as well as which chain to extend, so long as it is reasonable) to the individual miners. All the pool really needs is proof that the miner is mining for the pool.


Can "Confidential Addresses" preserve user privacy? Can using "Confidential Addresses" be an alternative to zk-SNARKs to provide an acceptable privacy for a user?

And when we talk about "Confidential Transactions", does it mean we are using "Confidential Addresses"?

And if "Confidential Addresses" are enough for user privacy, why do we need to use zk-SNARKS? Are their missions different?

A lot of these terms end up being confusing and a little non descriptive. In the "elements project" nomenclature a confidential address is an encoding of a P2PKH key which includes the necessary information to make a confidential transaction, one which uses range proofs to blind the monetary units. There's nothing confidential about the address itself, it's functionally just a public key as normal.

Objectively range proofs used in this way aren't enough to provide significant privacy in an overall system, and come at a very large size and computational cost to verify. They can potentially increase privacy, and increase the utility of other technologies such as CoinJoin, but they are not a solution in of themselves.

By hiding the values in transactions they can obscure some of the uses of privacy-violating technology such as exchange front running where transactions on the network reveal potentially market moving behavior. They can also improve the usability of transactions which mix unlike outputs together such as CoinJoin, where you no longer need to be as careful about making sure sizes are the same to obscure information leakage.

It has been demonstrated in the ZCash network that any situation where a user is able to choose between cheap, and private, they will opt for the cheapest possible option no matter what. For systems like zk-SNARKS and range proofs this dramatically reduces the effectiveness of the system overall, as there's less obscurity in which to hide. Range proofs also have this properly, regrettably, unless the choice to use them is removed.

In short, it's very difficult to determine if these technologies have a use in the real world.


How many addresses can be in input and output of a transaction I have read through this question and i understand that there can be many sender and receiver addresses within 1 transaction(i'm new to bitcoin transaction, previous i was working with ethereum where 1 transaction can only have 1 sender and 1 receiver).
I'm working with blockcypher api endpoint to monitor incoming bitcoin to an address. I need to get all the possible number of address that can happen in input or output.
Here the logic of my monitor system, user can input their addresses to send(save in database), and my system also has an address to receive that amount. The monitor system only detect the incoming transactions to my address from the user addresses in the input addresses (exists in database)
I have categorized it into these to know the correct value that was send to an address:
input | output  | incoming amount to address
1     | 1 or 2  | amount show on receiver(output) of my address
1     | >2      | amount show on receiver(output) of my address
>1    | 1       | amount show on sender(of the system)(input)

Now i need to know can there be more then 2 on the input and more than 2 on the output? i haven't found any example of it yet
Also please tell me if my monitor logic is correct, are there different logic to monitor incoming bitcoin transaction to an address?
Thank in advance
Sorry if i mess up somewhere in my question, i'm pretty new to bitcoin system.

Every transaction output locks funds to one specific output script. These scripts can have various spending conditions such as for example requiring a signature of one specific private key (P2KH, P2KH, P2TR key path spend) or fulfillment of an arbitrary script defined by the recipient (P2SH, P2WSH, P2TR script path spend).
A common script used in the latter category is 2-of-3 multisig, but it would be incorrect to describe this as "2 addresses being funded in one output". Either way, that would be not the limit.
So, tbh, I'm a bit confused when you describe that one output can fund two addresses.
If I was misconstruing that and you're asking how many inputs and outputs a transaction can have, the answer is that standard transactions must have at least one input and one output, and otherwise are limited to 400,000 weight units. So, a transaction could have thousands of inputs or outputs.


Does bitcoind (as of 0.15) support BIP39 mnemonic phrase for wallets? Can bitcoind print out a BIP39 seed phrase to backup the wallet?

Can I import a BIP39 seed phrase (from, for example, Breadwallet on iOS)into bitcoind?

I know bitcoind wallets have been BIP32 format since 0.13, what is used as the seed? What is backed up when I make a copy of wallet.dat? If the wallet is encrypted, does the seed change (the way BIP32 uses a passphrase as "the 13th word"?)

No, bitcoind does not support BIP39 seed phrase backup. It supports deterministic key derivation (BIP32), and the seed is just random number generated on wallet creation. Moreover, the generated keys do not follow BIP44 key paths, so even if you imported successfully in some way your seed to bitcoind wallet, there is no chance to see your money from wallets which follow BIP44 key paths.

As far I know wallet encryption in bitcoind has more to do with symmetric encryption of private key data. It has nothing to do with seed converted to seed phrases.


Importaddress and conf I'm wondering if its possible to add imported addresses into the bitcoin conf file.
So, rather than calling the cli with importaddress, I would add the address to the conf file, with say, importaddress=1123345678A
Is this supported in the conf file?

I don't think importaddress is supported in config file. I use https://jlopp.github.io/bitcoin-core-config-generator/ for making changes in config file
I don't see any options to solve this problem here: https://github.com/jlopp/bitcoin-core-config-generator/blob/0febd7537a89846e0b40badca12d3b7dd2074dfc/src/data.json
There are only two options related to "import" mentioned in the above file:
loadblock - Imports blocks from external blk000??.dat file on startup. This option can be set multiple times with different file values.
stopafterblockimport - Stop running after importing blocks from disk.
importaddress adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend as mentioned here: https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/importaddress/


Do all Cryptocurrencies uses same Public key Cryptography algorithm? I have been trying to read about how Public key cryptography works and I have just understand what public key cryptography is and how it differs from symmetric key cryptography.

I have also just read that the bitcoin uses "Elliptic Curve Digital Signature Algorithm (ECDSA)" to generate Public/Private key pairs, and then

  the public key is hashed several times until it looks like the
  familiar Bitcoin address.

I then read here, https://ethereum.stackexchange.com/questions/3542/how-are-ethereum-addresses-generated that Ethereum also uses ECDSA to generate key pair and then the Keccak-256 hash of the public key is taken.

My question is, do all the cryptocurrencies in existence uses the same algorithm to generate key pairs ?, if that is true, can a single Public/Private key pair be used to store multiple currencies given that the public key is hashed according to each cryptocurrency standard ?

Not necessarily.

A cryptocoin can use whatever asymmetric algorithm they choose, and I'm sure some have tried different things, but ECDSA has a big advantage: public keys are generated from private keys.

With asymmetric algorithms like RSA, public and private keys are both generated together.  With ECDSA, you choose a random number (within certain limits), and that is your private key.  Now all you have to do is calculate the corresponding public key from your private key.  This makes new address generation quick, and computationally inexpensive.  It also allows for schemes such as BIP32 HD Wallets.

Also be aware that ECDSA can use the same algorithm using different elliptic curves.  Bitcoin uses secp256k1, but other curves exist as well.

In the end, it depends on the currency.  There is so much diversity nowadays, I doubt very much that they all use the same algorithm and curve.