Naming in segwit script I have some doubts about naming in witness script/transaction.

P2SH-P2WSH (multisig)

WITNESS_SCRIPT = OP_3 <public key1> <public key2> <public key3> <OP_2>

(is it witness script or redeem script? For now I will call Witness script)

SCRIPTHASH= SHA256 (WITNESS_SCRIPT)

is it Witness script Hash or redeem script Hash?

REDEEM_SCRIPT=0020+SCRIPTHASH

is it redeem script? Maybe it's the redeem script because it is in Scriptsig. (Witness version + Witness program)

In scriptPubKey
hash160 of (0020+SCRIPTHASH).

What is its name? Hash160 of ?

And We have OP_HASH160 <Redeem script hash?> OP_EQUAL

P2SH-P2WPKH

KEYHASH = hash160(<public key>)

REDEEM_SCRIPT=0014+KEYHASH

is it redeem script or witness script? For now I Will call redeem script.

In scriptPubKey
hash160 of (0020+SCRIPTHASH).

What is its name? Hash160 of ?

And We have OP_HASH160 <Redeem script hash?> OP_EQUAL

P2WPKH NATIVE

WITNESS SCRIPT = hash160(<public key>)

In scriptpubkey
0014+WITNESS_SCRIPT

OP_0 <20 bytes witness script hash>

P2WSH NATIVE

WITNESS SCRIPT = <OP_2> <pubkey1><pubkey2><pubkey3><OP_3> <OP_CHECKMULTISIG>

WITNESS_SCRIPT_HASH = HASH160 (WITNESS SCRIPT)

In scriptpubkey

0020+WITNESS_SCRIPT_HASH

OP_0 <32 bytes witness script hash>

P2WPKH NATIVE and P2WSH NATIVE should be ok

P2SH-P2WSH:

Witness script: OP_3 <public key1> <public key2> <public key3> OP_2 OP_CHECKMULTSIG
Witness program: SHA256(witness script)
redeemScript: OP_0 <witness program>
Script hash: Hash160(redeemScript)
scriptPubKey: OP_HASH160 <script hash> OP_EQUAL

P2SH-P2WPKH (I believe that's what you meant instead of "P2WSH-P2PKH"):

Witness program: Hash160(public key)
redeemScript: OP_0 <witness program>
Script hash: Hash160(redeemScript)
scriptPubKey: OP_HASH160 <script hash> OP_EQUAL

P2WSH-P2PKH (native P2WSH, but with a P2PKH script inside):

Witness script: OP_DUP OP_HASH160 <Hash160(pubkey)> OP_EQUALVERIFY OP_CHECKSIG
Witness program: SHA256(witness script)
scriptPubKey: OP_0 <witness program>

Note that you should use P2WPKH instead of this.

Native P2WPKH

Witness program: Hash160(public key)
scriptPubKey: OP_0 <witness program>

Native P2WSH

Witness script: OP_3 <public key1> <public key2> <public key3> OP_2 OP_CHECKMULTISIG
Witness program: SHA256(witness script)
scriptPubKey: OP_0 <witness program>


Do Bitcoin calculators give a realistic figure on pool mining Bitcoin calculators give an approximate correct range reward for solo mining, do they include pools, accounting your Hash rate reward share. I have not seen any pool calculators around, nevertheless their incomprehensible reward systems.

Regardless of whether you're solo mining or pool mining, as long as it's the same coin, your expected number of coins per day should be the same (minus a pool fee). However, the benefit of mining in a pool is that you reduce variance greatly. For example, let's say you have enough hashrate to mine 1 LTC per day on average. If you solo mine, the expected time to find a block is 50 days, but that doesn't mean you will find a block in 50 days. In fact, you might not even find a block in 500 days. It's all random. However, if you're using a pool that finds a block every 50 minutes, the probability that it goes for 500 minutes without a block is the same as the probability that you, as a solo miner, go for 500 days without a block. So you can expect more regular payouts with less risk, making the pool fee well worth it in my opinion unless you alone have 1% of the total network hashrate or something.

As for how the estimated number of coins per day is actually computed from your hashrate, see my answer here.


How to access peer's tip of chain? In case I'm a selfish miner and have successfully forked the blockchain, I'd like to know the state of progress of my honest nodes at any given time - how can I achieve this?

Do peers on separate blockchains exchange information about their progress through data messages?

Let's look at this scenario for a better understanding:
selfish node=s;    honest node=h

s: mine a block#1 (child of genesis block), don't report
h: mine block#2, block#3 publicly
s: mine block#4, block#5 secretly (don't report)
h: mine block#4 publicly
s: get information what block height the honest network is at!?

NOTE:

pindexLastCommonBlock doesn't seem to be helpful since calling its
height would say that last common block is 3, but does not say what
height honest nodes are at.
setInventoryKnown in case of a fork stores all blocks ever mined.

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

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


Why can't Bitcoin use a very large blocksize such as 1GB? In the current blocksize limit debate multiple proposals have been made. Bitcoin XT implements an increase to 8MB right away plus a doubling every two years. A competing approach used 20MB.

What specifically would make it a bad idea to go with a very high limit such as 1GB as opposed to increasing to a smaller limit such as 8MB?

If you made the block size that large, the rate of network divergence would increase drastically as more and more miners would find blocks while still transferring a block that someone else found. (You have to consider the network latency of propagating 1GB to peers every 10 minutes).

There are other problems. Large blocks make it harder to do full verification of transactions, meaning that it would be done less. That would mean more and more miners who trust others to verify transactions on their behalf. This could threaten Bitcoin's decentralization.

There are lots of other problems, these are just the most severe and obvious.


Is there dedicated mining hardware available to mine cryptonote coins? I'm talking about hardware such as USB miners, etc. I'm asking, because I see people mine with 86kH/s on my pool…

From here

  CryptoNight is a proof-of-work algorithm that mixes graphics processing unit (GPU) and central processing unit (CPU) mining to create a system resistant to both application-specific integrated circuits (ASICs) and fast memory-on-chip devices.

So, there is no dedicated ASIC hardware (yet). You can currently only use CPU plus GPU (which of course counts as hardware but I assumed you meant dedicated to mining hardware like ASICs).


Calculation of Bitcoin private key using it's generation time Is it possible to calculate the private key if you know the time (in the suitable format) when the key was generated on a single PC (Windows, Linux or others)?
P.S. Using it's custom libraries for this magic.

No, the time when the key was generated is entirely irrelevant. A private key is essentially a random number and with a robust source of randomness the time it takes to generate this random number is completely independent of the random number generated. For example, if we both run the same random number generator for exactly 5 minutes we should each generate completely different random numbers. With a flawed source of randomness we may both generate the same random number after exactly 5 minutes but this source of randomness should not be used for generating private keys.


What percent of nodes are miners? Miners run full nodes but full nodes may not necessarily be miners. Is there a way to figure out the proportion?

The two are entirely uncorrelated.
There's no requirement for a miner to run a fully validating node at all.


Where in the world are blocks mined? Is there any source of data about where in the world are blocks being mined? Is that data stored for each block?

It is impossible to know how the hashrate is distributed geographically from just blocks alone. Geographic information is completely irrelevant to the blockchain, as are IP addresses. Thus these are not stored in blocks.

Furthermore, in general it is difficult to know how the hashrate is distributed geographically. Without miners actually announcing where they are located, we cannot know how the hashrate is distributed.

As far as I know, a large portion of miners are located in China. There are many miners also located in Canada and Iceland. There are some miners also in the United States. Generally miners will be located in colder places (as it is easier to cool machines there) with cheap electricity.


Testing the blockchain for ECDSA signature random collision The wikipedia page on ECDSA signature explains how the signer's private key can be recovered if two signatures are produced with the same random (private key looking) element k. In fact, it is claimed on the DSA page that a fault in the implementation of java's SecureRandom class have led to such collision. I would like to confirm that in principle, it is possible to write code checking for such collisions in the blockchain in order to steal bitcoin private keys in the hope that some faulty wallet implementation has prevailed somewhere. Does the following algorithm outline make sense?

Check every signature of every transaction input in the blockchain
If two signatures correspond to the same public key, check if same r
If same r assume there is a collision and derive private key
Check if corresponding address is part of utxo set

Assuming this can be implemented, has it been done already?

It can easily be done, and has been done. See https://bitcointalk.org/index.php?topic=581411.0 for example.


How to get pending balance in with bitcoinj? I'm try get pending balance from wallet, but results do not match with pending transactions? Thanks for advice!

Edit: I don't think there's a method to do that, but this should do the same thing:

// calculate balance, only include transactions that are not in a block
List<TransactionOutput> candidates = wallet.calculateAllSpendCandidates(false, false);
Coin value = Coin.ZERO;
for (TransactionOutput out : candidates) {
    if(out.getParentTransaction().getAppearsInHashes() == null) {
        // Not seen in any block that we know of
        value = value.add(out.getValue());
    }
}


Formula for calculating bitcoin transaction size doesn't always work out but why Please refer to this question:

Calculator for estimated TX-Fees

I have a question for clarity, in response to James' answer as in his example of 2 inputs/1 output, I recently calculated using the formula provided in that question (and found all over the web) and confirming my inputs are both compressed:

size := X * 148 + Y * 34 + 10 +- X

I'm using a standard Electrum wallet with 2FA.  I had 2 inputs each it's own address and a single output and wanted to spend them to a single address w/ no change address. 2-in/1-out

I calculated: (2 x 148) + (1 x 34) + 10 +- 2 = 338-342 bytes and James came up with 404 bytes (he used uncompressed inputs @ 180 bytes and the formula works out), yet the real transaction would up being 638 bytes (stuck in the pool now) which makes using formulas like the one above a little less trustworthy.

What am I missing? Why when using the formula above, some transactions are spot on and others are way off with no way for me to make sense of it, math doesn't lie so I must be using the formula wrong and I just can't see the forest through through the trees?

Short Answer (derived from the help of all 3 fine gents below): I am using a 2FA wallet and that inherently is a multi-signature wallet of which the formula (in my case, 2 signers) changes the formula to:

size := X * 295 + Y * 34 + 10 +- X

What am I missing?

Public keys can be compressed or uncompressed
Signature can has slightly different size

And yes, Murch is right in his comment. The formula works only for p2pkh inputs and p2pkh outputs. No p2sh, no segwit, no anything except p2pkh


Strategies against Bitcoin With the recent increase in articles about the threat of Bitcoin vs central banks, government and other authorities over the money supply, I am wondering how well authorities are prepared and actively dealing with the situation.

Yes, most are probably aware of it by now. There have been some official statements by several agencies. Most notable I could find are the ECB: Virtual Currency Schemes (PDF, European Central Bank - October 2012), U.S. Senators seek crackdown on "Bitcoin" currency (Reuters, June 2011) and FBI Fears Bitcoin’s Popularity with Criminals (Wired, May 2012)

Is there any proof that serious plans are in the works to 'crackdown on Bitcoin' - either directly by creating laws or indirectly by influence on the market?

just some ideas:

Strategies could be attacking the trust structure of bitcoin:

Buying large quantities of bitcoins and dropping them on the market causes it value to fluctuate and make it appear weak
hacking peer sites (like mtgox), or bitcoin users directly (via trojans, etc.) leaves insecurities on where to use it
influencing media to emphasize about the dangers of bitcoin (selling drugs, weapons, etc.) will make it less accepted in society by creating fear
creating various alternative currencies, flooding a lot of misleading information, to weaken the marketing of bitcoin by confusion and information overflow

Could be attacking the technical side:

Creating big amounts of powerful ASICS and use them for false verifications
stuffing the blockchain with spam information and useless transaction, making it to big to handle
Blocking and filtering traffic from bitcoin clients, will make it necessary to use TOR (which could be also blocked in certain ways) and will render bitcoin unusable for the average person
Switching of the internet
Brute Force attacks on the network to render it slow and unusable

Could be attacking it by legal means:

Making it illegal to use bitcoin, and tracking users via ISPs, a few show trials and people won't want to use bitcoin again (so TOR could be again an option to circumvent)
shutting down and making peer sites illegal (if they are not already, e.g. mtgox, silkroad)

Great leverage for Bitcoin will eventually come by using it via smartphones and alike, bringing the currency to the street markets. If they find a way to block these trades, they will also hurt bitcoin a lot.


What would the effect of a very long bear market be on the Bitcoin economy? I don't mean to be a doomsday prophet or spread FUD, but I need to know if Bitcoin (or any PoW coin) investors should be concerned about the following scenario:

Assume Bitcoin goes in a very long bearish market which makes mining unprofitable and cause many mining companies/individuals to go bankrupt. From my understanding, the difficulty of the network will still keep increasing when the "target" block is mined, regardless of the number of miners (yes?)

Bitcoin price drops too low for too long
Mining becomes even more unprofitable
More miners goes bankrupt and are forced to shutdown and sell their coins at whatever price than can get.
The massive sell off causes the price to drop even further due to the sudden over-supply (back to #1). This could cause a deadly spiral (or "depression" if you wish).

And on top of that:

New miners cannot join the network, because the difficulty is already too high and you need a substantial investment to setup a profitable mining rig.  Which less investors would be willing to risk because of the price movement.
Because more and more miners shuts down, the network will become more and more congested, expensive, less distributed (small investors will be washed out first, leaving the wealth in fewer hands), riskier (50% attack become easier) and ultimately investors might loose faith in the system.

Also from what I understand if there are eventually too few miners left, the system becomes worthless as transaction fees will be too high and too congested to make any transaction practical.

Is this scenario possible and does such a threat exist or am I missing something?

If "yes", is there a way to recover?
If "no", what would protect the system?

From my understanding, the difficulty of the network will still keep increasing when the "target" block is mined, regardless of the number of miners (yes?)

No.

The difficulty readjusts every 2016 blocks, based on the average time taken to mine the previous 2016 blocks.  If the average is less than 10 minutes, the difficulty goes up.  If greater than 10 minutes, the difficulty goes down.

The rate at which blocks are mined is, on average, proportional to the total hash rate of the entire network.  So if mining power leaves the network, then blocks will be found more slowly, and at the next readjustment, the difficulty will decrease.


How can I buy Bitcoin via a Credit Card or Paypal? I want to buy some bitcoins. Ideally, I would like to buy them on the MtGox exchange (because the consensus seems to be that this is the most reputable exchange), however I have found the system for transferring USD to MtGox to be very disappointing. I would have liked to be able to add funds with PayPal or directly with a credit card, however both of these are not possible.

My question has two parts:

Is there an easy way to use a credit card to add USD funds to my MtGox account. Liberty Reserve, Dwolla, and Paxum seem to be the financial institutions of choice for MtGox and the rest of the exchanges. Is any of these simple to fund using a credit card, or are they all basically PayPal analogues (which Paxum seems to be) that require a large amount of setup?
If it is not possible for MtGox, is there another, hopefully reputable, exchange that I can use PayPal or a Credit Card to buy bitcoins with?

I noticed this question was posted a long time ago and perhaps things have changed so I took the liberty to dig in again and also aggregate most of the answers given here and here’s what I found:

It’s indeed impossible to buy Bitcoins with Paypal DIRECTLY even today and it's mainly because of Paypal’s TOS (Section 3.7 here) and the issues of chargeback.
Having said that there are still a few ways you can buy Bitcoin with Paypal

a. Use VirWox to buy SLL with Paypal and then transfer that SLL to BTC (has high comission, transaction can take between 1 hour to 2 days). The full process is explained here.

b. You can use Local Bitcoins and perhaps find someone in your area to sell you Bitcoins with cash or even someone not in your area to sell you Bitcoins with Paypal or a credit card.

c. If you’re only into trading Bitcoins for their volitility and not actaully keep them you can use platforms such as AvaTrade or Plus500 to trade CFDs. However CFDs are for more experience traders and your capital is at risk so take that into account.

d. If you have a Paypal Debit card you can actually connect it to your Circle account and use the funds on your card to get BTC. This is relevant to US residents only.
Same thing goes for credit cards. Because of chargeback issues there’s no direct way to buy Bitcoins with them. Currently some options for credit cards are CoinMama, Circle or Cubits.


bitcoin core test config error I tried configuring the bitcoin core test by editing the bitcoin.conf file with the required credentials.

Earlier, before the writing the test credentials it was a running full node.
now the error is

config settings for rpcport only applied on the test network when in [test] section.

(picture uploaded for reference)

Since you are choosing to use network specific sections in your config file, Core requires you to have certain arguments in those sections, such as rpcport. So you need to move rpcport into a network specific section.


Change IBD Location Prior to Download I'd like to run Bitcoin Core but my laptop can't handle the load. I have an external drive with enough space, but I'm unsure if/how to change the file destination upon opening the program. Is this possible?

You can change the data directory

https://bitcoin.org/en/full-node#linux-instructions


How many channels can I create from a Lightning Node? I am new to the Lightning Network / Bitcoin and am trying to get an understanding as to how it functions.

Basically, suppose I have a Lightning Node (created with "lightningd"). It is my understanding that this is a daemon that starts at a certain port: 9735. On my picture, it is the box with "My Node".

Question 1: is there only one wallet inside of this node? If so, is there a way to have additional wallets inside of the same node? Does one use the wallet address when one receives/sends funds (kind of like the way the Bitcoin address to receive/send funds)?

Question 2: Is there a limit to the number of Channels I can create from "My Node"?

Suppose I have some relatives that do not use Smartphones but want to send/receive money over the network. They are represented in my picture with "Grandma", "Grandpa", "Mom", "Dad", and "Aunt Wilma".

Since they are older, they do not know much about computers, I am running their LN Nodes for them on my own computer.

Question 3: In this case, would I need 6 extra Lightning Network daemons ("lightningd") on my computer?  If so, then would each daemon have to assign a different port address? Is there be a better way to do this?

TIA

Question 1: is there only one wallet inside of this node? If so, is there a way to have additional wallets inside of the same node? Does one use the wallet address when one receives/sends funds (kind of like the way the Bitcoin address to receive/send funds)?

A wallet is not the same thing as an address. A wallet is a collection of addresses and their private keys or scripts. A Lightning Node is also a wallet; there is only one wallet, but there are still multiple addresses and private keys.

  Question 2: Is there a limit to the number of Channels I can create from "My Node"?

In theory, no. In practice, your computer could run out of resources to maintain open connections. Regardless, you can have multiple channels open and it should not be a problem unless you are trying to have hundreds or thousands of channels.

  Question 3: In this case, would I need 6 extra Lightning Network daemons ("lightningd") on my computer?  If so, then would each daemon have to assign a different port address? Is there be a better way to do this?

No, one daemon can have multiple channels.


testnet server won't get any btc from TP's TestNet Faucet. what is the reason? I have generate bitcoin address from testnet server.

but I can't get any btc in those address.
i tried many times and I failed.

can anyone explain me that is the reason? whay i can't get btc on those address.

note: i used regtest server for same purpose and my rpcport is 18332(regtest and testnet)

I've just tested TP's faucet and it worked (green success text).

Are you sending to a testnet address (begins with m, n, or 2)? I'm thinking you may be inadvertently using Mainnet or Regtest mode (beginning with 1 or 3).

Ensure your Bitcoin.conf file has testnet=1 in it, or use the -testnet flag on the command line. Also be certain your blockchain is fully synched (this will take many hours, unlike regtest mode)

Go into BitcoinCore's client, and try getnewaddress in the console (help > console). Then copy/paste that address into the faucet, complete the CAPTCHA, and the coins will have been sent. You will need to have a completely synched blockchain before the coins will "appear".


What is the point of a soft fork when it's backwards compatible? I understand a soft fork occurs when changes in the Bitcoin protocol are backwards compatible, but why is that a fork? Is there really a branch or is that just a formality? Or does this give me a chance to run an older version of Bitcoin (older than the soft fork), and still be part of the system? But, again, why would I do such a thing. For example, is there any active "soft" branches in the network that I can transfer on?
Thank you guys!

Seems you answer the first question yourself :-).  Yes, it's a fork as it enforces new rules. But it does allow you to run an older version of bitcoind (not recommended though, but supported) and still be part of the Bitcoin network.

is there any active "soft" branches in the network that I can transfer on ?

This would mean there was a network split, what a soft fork is trying to avoid.
There are still old clients running that for example do not enforce the last soft fork that occured (Segwit), but they are part of the Bitcoin network and not an alternate one because the change was backward-compatible.


Does the miner first validate transaction before doing POW or he does not validate at all ? Does the miner validate the transaction before putting it on the block for proof of work?
my understanding is if the miner does not validate the transaction and published the block and the block gets rejected of the invalid transaction then miner will lose the reward?
One more question does the nodes relay the transaction after validation or they just relay it?

Miner first validates all transactions he wants to include in the block he will mine.

Then from these transactions he calculates their Merkle root, that becomes the field of this block's header.

Then he mines (repeatedly hashes this header modifying its nonce field with each try).

When he finds the correct hash he broadcasts this block (including block's header and transactions) to the network.

Reasoning: It would be stupid from miner to do the expensive work of mining before making validation, risking the block to be rejected. This would mean he spent a lot of resources to mine the block in vain.

Nodes validate the transaction before relaying it.

Reasoning: It is beneficial for network if the nodes filter invalid (erroneous, malicious) traffic. It reduces the load.


How was South Korean Bitcoin exchange Bithumb hacked? I've read a news article saying that a South Korean Bitcoin exchange had been hacked by someone. My question is: how does this happen? Isn't the Bitcoin network's cryptography safe enough to prevent these events?

The security of Bitcoin is unrelated to someone's Bitcoin wallet being hacked. The network provides the guarantee that given just the data on the blockchain, no one can get your private keys (assuming you haven't exposed them in some way on the blockchain). It does not secure anything related to the environment on which your private keys are stored on. If you were to store your private keys unencrypted on your computer, so long as no one can access your private keys, you would be fine. However your Bitcoin is not safe as if you were to get malware which finds your unencrypted wallet file and sends it to the malware authors, then your coins will be stolen. Your coins being stolen there is related to poor security practices on your computer, not with the Bitcoin network's security.

The same can happen to an exchange. If hackers were to get a backdoor onto the exchange's systems, they could steal the private keys and anything else necessary to access them (e.g. passwords or encryption keys). That the private keys were stolen has nothing to do with the Bitcoin network and everything to do with the exchange poorly securing their private keys.


Output Descriptor for an Arbitrary Script Can output descriptors be used to describe an arbitrary script?
Say I had a script something like the following:
OP_IF
  1737417600 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubKeyHashD> OP_EQUALVERIFY OP_CHECKSIG
OP_ELSE
  2 <PubKeyA> <PubKeyB> <PubKeyC> 3 OP_CHECKMULTISIG
OP_ENDIF

That's a two-branch script that either allows a 2-of-3 multisig or a single-address retrieval after a set amount of time. Is there a way to convert that into descriptor that I could then use to derive addresses?
wsh seems focused on set types of scripts, while trying raw on a 32-bit hash of a script gives me Descriptor does not have a corresponding address.

Output script descriptors do not currently support any arbitrary script. However once extended by Miniscript, descriptors will be able to support any script logically. Minscript is an extension of descriptors which allows for arbitrary scripts, within certain parameters. While you cannot specify any arbitrary script, you can use Minscript to create an arbitrary script that does what you want. This will not necessarily be the same as an arbitrary script that you come up with, but it will be logically identical.


Is holding funds in a Bitcoin paper wallet safe? If you received lots of bitcoins, like 100, and you are not comfortable holding them in your personal blockchain wallet, is it preferable to move them and hold them in a paper wallet for safety reasons?

Yes. A paper wallet is basically nothing more than your private key on a piece of paper.

For usability it is often represented as a QR code though. You can make copies of it, and store several of them in different places, or even store half of the key in one location and another half in another. Bitcoins are never in your wallet, paper or otherwise; they are just entries on the blockchain. Your wallet contains only the private key to allow you to spend your entry on the blockchain.


What's the advantage to requesting a higher difficulty when mining? I've seen pools recommend higher difficulties for higher-speed hardware - what's the benefit (for either the pool or the miner) in doing so?

The higher difficulty means you will be reporting results less frequently to the pool.  This reduces network load on both your system and the pool.  It also reduces the restart delay for your mining hardware as it prepares for the next work unit.  Most pools base the rewards on the number of difficulty 2 shares accepted.  So they increase the reward based on the mining difficulty.  If you had four shares accepted at difficulty 4, you would be credited with the reward for 8 shares.  Similarly, four shares at difficulty 8 would yield a reward for 16 shares.

So it is to your benefit to set the difficulty high enough to reduce the network and mining delays but not so high that you get a lot of stale shares.  Some pools (such as BTC Guild) will automatically adjust the difficulty based on your hash rate.


Constantly getting connection interrupted Recenly I started to mine BTC. I'm doing it just out of curiosity rather then for any profit. I compiled cpuminer on my Debian 9 server. I'm trying to connect to the btc.com pool by execuing:

./minerd -a sha256d --url=stratum+tcp://eu.ss.btc.com:1800 --user=myusername --pass=password

I let it run for few hours and didn't get any accepted or rejected shares (not sure about names). Is it normal (I've got some old dual core cpu) or it's because of connection interupts. I'm constantly getting work resets and those connection interupts. Example:

[2017-11-06 14:04:15] thread 1: 197074856 hashes, 3289 khash/s
[2017-11-06 14:05:15] thread 0: 197233364 hashes, 3285 khash/s
[2017-11-06 14:05:15] thread 1: 197331608 hashes, 3288 khash/s
[2017-11-06 14:06:15] thread 1: 197283568 hashes, 3310 khash/s
[2017-11-06 14:06:15] thread 0: 197093004 hashes, 3264 khash/s
[2017-11-06 14:06:18] Stratum requested work restart
[2017-11-06 14:06:18] thread 0: 8115524 hashes, 3267 khash/s
[2017-11-06 14:06:18] thread 1: 8896012 hashes, 3298 khash/s
[2017-11-06 14:07:17] thread 0: 196031964 hashes, 3278 khash/s
[2017-11-06 14:07:18] thread 1: 197856604 hashes, 3296 khash/s
[2017-11-06 14:08:17] thread 0: 196691096 hashes, 3288 khash/s
[2017-11-06 14:08:18] thread 1: 197740892 hashes, 3286 khash/s
[2017-11-06 14:09:17] thread 0: 197276844 hashes, 3276 khash/s
[2017-11-06 14:09:18] thread 1: 197162844 hashes, 3291 khash/s
[2017-11-06 14:09:37] stratum_recv_line failed
[2017-11-06 14:09:37] Stratum connection interrupted
[2017-11-06 14:09:37] thread 0: 65115504 hashes, 3270 khash/s
[2017-11-06 14:09:37] thread 1: 64935828 hashes, 3307 khash/s
[2017-11-06 14:10:38] thread 1: 198394912 hashes, 3310 khash/s
[2017-11-06 14:10:38] thread 0: 196204988 hashes, 3264 khash/s

I'm doing:

minerd -a scrypt --threads=1 -o stratum+tcp://us.litecoinpool.org:3333 -O ab1jx.4:4

From a script and it works fine.  ab1jx is my username on litecoinpool, worker is 4, password is 4.  Only 1 thread to make it sort of a background process, leave that out to run at full throttle.

I don't get accepted lines often either with cpuminer, I assume because it's so slow.  I do with my ASIC miners.  I see the restarts a lot more often.  Sometimes I get accepted (and a yay) but this is a few orders of magnitude slower than everybody else, so it comes later than everybody else and may get tossed.  Not sure if you still get credited for it.  Check your stats on the pool after an hour or so, that's what counts.

No CPU miner is going to be profitable because it burns more electricity than the coins are worth.  Unless you have free electricity like solar or geothermal.  I do it as a test load on the computer and network.  If it's winter and you heat with electricity anyway it might work out.


Is there a hardware wallet project that plans to add multisig capabilities? What I want: A hardware wallet that I don't need to trust.

That wallet will hold one out of three keys in a 2-of-3 multisig scheme. The other two parties will be a paper wallet I create, and a password that I choose.

Now, I can store the paper wallet in a safe, and use the hardware wallet + password in my day to day life. If I forget the password, I can recover using hardware + paper. If I lose the wallet, I can recover using paper + password (paper is stored in multiple bank vaults).

At any point in this process, an evil hardware wallet maker cannot steal my bitcoins.

Do any of the hardware wallet projects plan to support such a scheme?

This isn't exactly what you want, but it's close:

The Case hardware wallet uses 2-of-3 multisig, where one key is on the device, one is on Case servers, and the third recovery key has two options: Self-storage or Vault storage through Third Key Solutions (invisible to the customer). If you choose the self-storage option, you provide an xpub key during initial setup, and the multisig wallet will use that as the third key.

In that scheme you would have signing control of 2 of the 3 keys. There is still the human trust element where Case servers are necessary to perform the transactions, but they cannot sign any transactions not initiated by the user.

Full disclosure: I work at Case.


How much would it cost to execute a 51% attack? I know that it's commonly said that they're not really in the realm of possibility right now, but how much would it really cost to execute a 51% attack on the network?  And are there any organizations out there who might have a goal in mind for which such an attack would be worth it?

Adding to David's quote of $65,415 per hour here's a quick analysis of non-EC2 attacks (i.e. buy and run ALL the hardware to sustain a 51% attack)

Since power efficiency will be HUGE for this scale of an operation, let's use the most power efficient card we can find. This lovely pastebin doc tells us that is the Radeon 5850 at 1.595 MH/W.

At present you need 12.42 TH/s to pull off a 51% attack, which would require 51,585 of these cards. Assuming we put four cards to a rig it also requires 12,897 computers to run them all. Assuming the PCs take a scant 200 watts, each rig requires 804 watts of power, 10,365,735 watts in all. Assuming a fairly high efficiency cooling system, we can bump that up to about 14,619,916 watts. Before anyone claims that this alone is impossible, keep in mind it's about 0.7% of the peak output of Hoover Dam. Speaking of Hoover Dam, I'm going to use my local energy rate of 11.28 cents per kW/h (I live in Vegas) to find that it would cost $39,579.04 to run and cool these rigs for a single day.

Since these cards cost $192 at the cheapest outlet I could locate, we'd spend $9,904,320 on cards and at if we spent a scant $500 on each rig's other hardware they'd cost us $6,448,120 as well for a total hardware cost of $16,352,440. If we amortize that cost over a year of operation before the parts die or become too obsolete to pull off our attacks any more, we can estimate $44,770.54 per day in hardware costs.

Total cost in amortized hardware and electricity to run a 51% attack for one day on the bitcoin network: $84,349.58 - but also recall that our total startup costs were 16.35 million dollars, and all that would buy you is the ability to double-spend for a time, so no it wouldn't really be worth it.


How long for wire transfer from MtGox to Australian Bank? Similar to this post but I am interested to know how long it has taken people to get paid from a withdrawal to an Australian Bank.  I had a withdrawal on 30/oct/2013, and have not received the funds yet.

mtgox support desk: "Situation as of 24-Nov-2013: We are currently processing withdrawals requested 5 weeks ago." so it seems that you may get your money at the middle of december.


How do I get a Wallet address? New to this (obvious)
Using armory.
To send/receive BC's I need and address for the wallet.
How do I get this address?
Simple question and have searched but no direct answer??

Thanks

You can also try Electrum a very user friendly wallet, alternatively to get you started off you could simply set up a web wallet somewhere like blockchain.info.

I suggest having a look over the bitcoin.org page here:

Choosing Your First Wallet


developing an app that integrates with bitcoin is there something like the paypal sandbox test accounts for coinbase that I could use to test the app that I'm developing?

If you are integrating with bitcoin directly, then you can use the bitcoin testnet (https://en.bitcoin.it/wiki/Testnet).

If you are using a payment processor, Coinbase does not have sandbox feature like PayPal, although they have expressed interest in creating one based on bitcoin's testnet.  Coinbase does allow sending test payment notifications (IPN) from their merchant settings page (https://coinbase.com/merchant_settings).

Bitpay's FAQ (https://bitpay.com/faq) states that they too do not have a sandbox, and advises testing with small amounts of BTC.


Cannot get BITCOIND RPC connection working on Ubuntu 12.04 or Windows 7 OK, I recently posted trying to get help connecting to BITCOIND using Ubuntu or Windows 7.

In Ubuntu (Virtual Machine under Win7 64bit) 12.04 Desktop LTS I have the following written in my BITCOIN.CONF file located in $HOME/.bitcoin :

server=1
rpcuser=hello1
rpcpassword=12345
rpcallowip=*

I run BITCOIND with following command:

./bitcoind --server --rpcuser=hello1 --rpcpassword=12345

But when I try and connect with the Ruby script (see https://bitcointalk.org/index.php?topic=85495.msg3773215#msg3773215 ) it gives an error saying it can't connect.

Likewise, under Windows 7 I attempt the same procedure and using NIRSOFT cports app I see Bitcoin daemon is only opened under port 8333, not 833*2* as one would expect if RPC connection was active.

I've opened TCP/UDP port 8332-8333 in port forwarding of router.

What on Earth am I doing wrong here?
Why can't I connect to Bitcoin daemon via RPC?

==> BONUS QUESTION: I'm quite new to Ubuntu; how do you check open TCP ports at terminal in Ubuntu? (equivalent of netstat in windows)

Netstat(1) will give you open ports (in this case listening TCP ports): netstat -lnt.

To make sure you know which port your bitcoind daemon is using, start it with paramter -rpcport. In your example, use exactly -rpcport=8332, then use the same port when connecting to it.


"Inspect the TREZORs memory with an electron microscope" documentation bug? TREZORs documentation about the device being stolen and then examined by an election microscope says:

  In the end, the bitcoins will be gone already because the original
  owner will have changed their recovery seed upon discovering that
  their TREZOR was stolen.

Isn't the effective private key saved on the device?
If that's true, then how would changing the recovery seed render "bitcoins gone"?

If you follow the change recovery seed link in that quote, you will see that the instructions include sending the bitcoins from the old account to a new account.

The authors are saying that upon discovering a device is stolen, the user should transfer the coins away from the compromised addresses to a new, uncompromised account.

  Isn't the effective private key saved on the device?

No, the seed is stored on the device, and the keys are derived from that. But the effect is the same, if you have the seed, you can derive the keys. The document doesn't mean that the seed on the stolen device was changed. It means that the user made a new seed on a separate device, and transferred their coins to that.


How can I recognize a bitcoin transaction from a given person? If I ask two different people to pay me a given amount of bitcoin, how can I tell which one has paid and which one has not?

If the amount is different then it's easy. For the same amount? Public key of the sender? If so, shall I trust my local copy of the blockchain? (I know the "balance" can be faked albeit nobody can steal or send bitcoins in your behalf)

What about big merchants which process large amount of transactions?

Of course I'm not asking how to find out the identity of the senders

It would be possible if you can generate multiple receiving address for each transaction. That can be done using your public and private keys.

Give each user a separate address of yours. Then you should be able to track.


how to use bitcoin blockchain be useful to authenticate documents? have read a little about blockchains and found there is lot of blockchain npm libraries available.

How can I take benefit of the bitcoin blockchain to authenticate documents : to obtain a proof a document has not been alterated ot changed.

Any clues, suggestions, ideas and remarks are welcome.

You can make a transaction with the hash (of the document) as a comment.
That would proof that the file existed at that time.

It doesn't however magically proof that a document hasn't been changed.
Once you get the document, you can store the hash on the blockchain, then to check if it hasn't been changed, you can retrieve the hash and check if the current version of the file still hashes to the same value.

There will most likely be a library for this, I wouldn't know the name of a specific one however.


Not sure where some of my transaction went I just made a transaction of 61.80 Euros, but it charged me 88.01, And I'm not sure why.
Some background: I'm using a service called HodlHodl to turn my mined bitcoin into money. I use Electrum as my wallet.
This is the transaction, if it helps:
https://www.blockchain.com/btc/tx/0cf8e157f7783bd3a8ea92f17fe4c4d5193b69241b950c13d3e9b5a7fbaed68b
The part I'm unsure about are the other 2 outputs, besides the 61.80 Euro one. Would be very thankful for the 24.72 Euro output to be explained.

Nevermind. I found out that it is a 2 factor authentication fee. At first I just didn't expect it to be this much.


Why choose the longest chain before checking for double-spending? Can we make the following changes to the current POW protocol to better avoid double-spending:

a) For full/mining nodes that receive two chains, check if there are identical addresses that occur on both chains that perform double-spending. If there are any, ignore the chain that would result in the node doing a reorganization (reorg), choose the other chain;

b) If there is none, choose the longer chain;

c) For nodes that receive only one chain, accept it if it does not require a reorganization.

Wouldn't this be better in avoiding double-spending than the current protocol, i.e. accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?

If there is a double spend attempt, there is no way for a node to know "which chain (transaction) actually came first and is legitimate". Some nodes may hear about the 'legit' chain first, some may hear about the double-spend chain first.

So, if the rule states that nodes work to avoid reorgs in case of a double spend, then we would expect the network to split at the occurrence of a double spend. Consider: what happens if there is a double-spend attempt, and the first chain your node hears about is the one that is soon-to-be the shorter chain? You would be stuck on an orphan chain, while the rest of the network marches onward. This is obviously not good, as network consensus and reliability is important.

  c) For nodes that receive only one chain, accept it if it does not require a reorganization.

If the node only receives one chain, then it will never require a reorg. Only a node that receives an alternative, longer chain will reorg.

  ..accepting the longest chain blindly? Shouldn't we check the block contents from both chains before deciding which one to accept?

I would not say chains are accepted blindly, acceptance requires the chain to be valid according to all of the network's rules. Your node will check the contents of new blocks, but as I mentioned above, there is no way to reliably distinguish a 'legit' transaction from a 'double spend' transaction, at a network-consensus level.


verified transaction in a block is verfied by one node? i want to know whether block is a combination of transaction verified by one node so all the transaction in that block is verified and once node is full node will broadcast it or any node can add transaction in that block?

In the world of blockchain, no one trusts anyone. Transactions in each and every block are verified by each and every node.

Just the node that solves the cryptographic puzzle (In PoW), gets a chance to append a new and valid block to the blockchain. Which in turn will be verified by every node.


possible to generate qr code using only bitcoin core? Bitcoin core qt generates a qr code. Can I do it with the json rpc or by some other means without using 3rd party libs? Right now, I'm using a 3rd party lib and it's working; just trying to tighten things up if possible (with licenses, dependencies and maintainability).

I'm not looking to reverse engineer C code to do it; that would be overkill for the benefit probably.

QR Code creation is a GUI only thing. You cannot create a QR code without using the GUI. The JSON-RPC interface only works for text based things and cannot trigger GUI actions.


How to efficiently find if in-address in transaction is valid and has required amount of data? A transaction has in-bitcoin address. Transaction tells to transfer that address (in fraction or whole) to another address. Since the source of truth is block-chain, how does miner know that in-bitcoin address has said amount of data ? And how does miner check it efficiently ?

I have read about Merkel trees. My understanding is that they help to find whether a transaction is present in specific order in a block. But a block chain will have many blocks. So, how is it done efficiently by miners ?

Will not creating a hashmap from bitcoin-address to amount will be easier ?

There are no such things as "in-addresses" or "from addresses", and this has nothing to do with merkle trees, or even blocks.

Bitcoin works by transactions creating outputs and other transactions spending from previous transaction outputs. Each output has an associated value. When you spend Bitcoin, you are spending from previous transaction outputs. Your transaction will include a reference to the output that it is spending: the txid and the index of the output. Since all transactions (except coinbase transactions - the coin generation transaction, not the company) spend from a previous transaction output, the transactions are all chained together. You can walk backwards through this chain of transactions to check that the values of all the transactions are correct.

So when a node receives your transaction, it looks up the outputs that your transaction is spending from and makes sure that no other transaction has spent those outputs already. Then it sums the values of the outputs being spent and makes sure that that sum is greater than or equal to the sum of the values of the outputs being created.


Can I generate payment adresses while offline? So I'm using the original bitcoin client.
What if on a computer without internet (A) I generate a bitcoin address and
then use this address to receive a payment (by using an other computer with internet (B))

Once I transfer my wallet.dat to computer B and let it sync, will I still get the payment ?

I'm asking because I'm doing stuff from work and the bitcoin-qt can't synchronize from over there.

Do I need to be online in order to generate a ready to use payment address?

No, you don't need to be online when generating a new receiving address, as this is done locally by your bitcoin-core. You also don't need to be online to receive funds to these addresses, as long as you protect your wallet and keep your system free from malicious software you are the owner of these addresses and you will be able to check their balance as soon as you get online and let your wallet synchronize with the network.


Random 'The operation has timed out' errors in JSON-RPC I run Bitcoin Core QT and ASP.NET website on the same webserver. My website communicates with Bitcoin Core QT via JSON-RPC. There are hundreds of requests behind the scenes. Sometimes a request finishes with The operation has timed out exception. What is wrong with it? This unstable behavior is really annoys me.

My bitcoin.conf is:

rpcuser = XXXXXXXX
rpcpassword = XXXXXXXX
server=1
rpcallowip=xx.xx.xx.xx
rpcallowip=127.0.0.1
rpcport=xxxx
rpcthreads=1200

UPDATE: I use heavily edited https://github.com/GeorgeKimionis/BitcoinLib, which in its turn internally is based on HttpWebRequest. RpcRequestTimeoutInSeconds is set to 60 seconds. Is it not enough to get balance and account list?

Some operation might take longer then your RPC clients timeout is set to. This could be either due to system workload or due to loading bigger sets of data over RPC (example: a wallet with 100'000 wallet transactions).

Try to debug which commands take long/longer and consider checking your RPC clients http timeout.


Transaction do not shows up in my android wallet I have an incoming transaction that didn't show up in my android wallet
[here is the txid[1

I tried to re-sync the wallet and the transaction is still missing!
I noticed you use blockexplorer.com as block explorer, is this a BITCOIN wallet or a B CASH one?

Please help me to recover my funds it's more than 0.05 btc

Try changing the wallet and make sure that you use a bitcoin wallet since this is a Bitcoin transaction

If you have the private key of the destination wallet, then your funds should be okey


how much is the initial capital needed to start a bitcoin exchange? For anyone who has done the math on opening their own bitcoin exchange, how much capital do you need to start an exchange, of course excluding the obvious variables like marketing budget, setup and legal fees? and where the money would go? for example, buy reserve bitcoins (if needed), infrastructure..etc
Thanks.

I thought about this a while ago.

What you need is:

A website with

Good security
A Order matching engine backend
A BitCoin send and receive engine
A way of processing normal money funds

A merchent or escroe account @ a bank
Batch file processing code

A scalable infrastructure (hosting)

Customers (people have to know your exist)
Some form of support (moderated forum, someone to answer where is my money emails)
Legal advice
Legal liability limited company

You don't actually need any money in reserve to operate the exchange.
In fact you trading account (the one holding your customers money) should only every hold your customers money. You should have a separate account which you move fees into (and pay you bills from) Same goes for your BTC (LTC etc) wallets*.

To do other wise it would look like you are gaming the system (not a good look).
If you wanted you could create a separate entity to act as a Market Maker to increase the liquidity of your exchange. But that should be run by a different person/board.

So basically the money you need is the amount to setup and run the site  (including legal fees insurance, office space etc etc.) But you should not need any money/coins to run the site (over that which you are not holding on behalf of your customers)

*Once you have a reasonable amount of funds under management, you should have several operating accounts/ wallets. One for putting fees into/paying bills, one for day to day churn (the amount coming in will balance the money/coins going out most of the time) and one for cold storage, i.e, an off line wallet that can be accesses if need be, but a hacker can't drain from the live site.

**This is just my thoughts not legal advice, etc, etc, blar, blar.


How is the ExtraNonce calculated in Bitcoin Core The Extra nonce for the genesis block in bitcoin core is 0x010445, how was this value calculated?

The extra nonce is just like the normal nonce in a block header. It is "calculated" by using a counter which increments every time all of the possible nonces for the block header nonce field are exhausted. This process of incrementing the nonce and then the extra nonce is repeated until a valid block hash is found.


Is there a difference between OP_PUSHBYTES and OP_PUSHDATA In some documentation about Script we sometimes have to use OP_PUSHBYTESx or OP_PUSHDATAx to indicate that some number of bytes will be an element to read.
They seem to do the same thing so is there a reason they have different names ?

In what documentation ? I believe you are talking about how rust-bitcoin refers to the OPs > OP_FALSE and < OP_PUSHDATA1 and will answer as such.
There are multiple OP codes pushing bytes to the stack, defined as integers.
Special case: pushing small integers
There are dedicating OP codes for pushing integers from -1 to 16 (named OP_1NEGATE, OP_0 and OP_1 to OP_16 and valued 0x4f, Ox00 and 0x51 to 0x60).
They are used for instance for (small-ish) multisigs as it saves you 1 byte per number pushed compared to using a "real" push opcode.
"PUSHBYTES": pushing small byte arrays
The (not named in the reference implementation) OP codes valued from 0x01 to 0x4b allow to push from 1 (0x01) to 75 (0x4b) bytes to the stack.
They are commonly used to push pubkeys and signatures.
PUSHADATA: pushing byte arrays
The PUSHDATA1, PUSHDATA2 and PUSHDATA4 (0x4c, 0x4d and 0x4e) operands are used to push a byte array to the stack which size is defined as a variable-length integer .
Further: too many encodings!
This flexibility of encoding introduced malleability in the scriptSig, which was not protected by the signature (which it carries).
BIP62 proposed to restrict this encoding to avoid possible malleation.


What are the obstacles to pegging the value of bitcoin to an established stable currency? Many people will not touch bitcoin due to it's historically extreme volatility. Many new currencies have pegged their value against an established currency until such time as it is sufficiently established to be decoupled.

For example the Irish punt was linked to the Sterling pound until they joined the European Monetary Union in 1979.

Would it be possible perhaps by way of a financial service organisation that guarantees a value against a stable currency such as the swiss franc for example, this using bitcoin as a form of promisory note?

Is the agreement of a fixed rate against an established currency like type of future or option in the stock market?

I think this could help speed adoption.

The only way to fix an exchange rate is to constantly trade at this rate. This requires unlimited funds.

So assume you want to peg BTC against CHF as in your example. For simplicity, we aim at 1 BTC == 1 CHF. Here's a simple recipe.

Have unlimited Bitcoin and unlimited CHF.
Find a Bitcoin exchange.
Offer to buy an unlimited amount of Bitcoin for 1 CHF/BTC.
Offer to sell an unlimited amount of Bitcoin for 1 CHF/BTC.
Observe how everyone will accept 1 BTC/CHF as the official rate.
If you run out of Bitcoin or CHFs, give up.


How to integrate Blockchain Wallet API V2 to php I have been using Bitcoin (JSON-RPC) for Blockchain.info

this plugin for bitcoin transaction in magento. one day suddenly it stopped working due to update in block chain wallet version. so i switched to spectrocoin. Later i found that spectrocoin is not working the way i have expected .So i decided to get a fix for appmerce.Then i found this Blockchain Wallet API V2

I went through it's documentation but i couldn't find a way to integrate this to magento. I can see lot of js files. So i'm open to suggestions.I would like to know how can i integrate  Blockchain Wallet API V2` to magento or PHP.

You need to run a local nodejs service. From there you can then integrate with php.

As of January 2016 Blockchain.info made changes to the wallet API service that now require you to run a local nodeJS service to handle the calls. This will require you to have root access to your webserver so you will need to use a VPS instead of a basic shared web host.

Create an account with blockchain.info, and register an email
address.
Request an API key here https://blockchain.info/api/api_create_code
Login to your blockchain wallet, goto account settings, IP Restrictions and check the box to allow API access
Goto DigitalOcean, register, create a new droplet, goto one-click-install and choose the MEAN stack Other options are up to you, I chose $5/month and IPv6
Open your console or SSH through putty
type root, enter your password, create a new password
Now you're in!
type sudo apt-get update
now install nodejs
type sudo apt-get install nodejs
press y to accept
install NPM
sudo apt-get install npm
y to accept
install blockchain-wallet
type npm install -g blockchain-wallet-service
if you see some warnings or errors, don't worry
once complete verify it installed
navigate to usr/local/bin
type node blockchain-wallet-service -V
if installed it should return with the version number
you can now launch the service, but first we will want to install apache and PHP so we can interact with it outside of nodejs
Navigate back to root
Install Apache
type sudo apt-get update
type sudo apt-get install apache2
Install PHP
type sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Install curl
type sudo apt-get install php5-curl
Restart your VPS reboot
Launch the blockchain-wallet-service
navigate to usr/local/bin
type node blockchain-wallet-service start --port 3030
Login to your wallet using the below code

$url = "http://127.0.0.1:3030/merchant/YOUR-GUID/login?password=YOUR-PASSWORD&api_code=YOUR-API-CODE";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$ccc = curl_exec($ch);
$json = json_decode($ccc, true);
var_dump($json);

Save the above and run it on your server. The file should keep spinning and loading since blockchain doesn't recognize the IP address. Wait for it to timeout about 60 seconds, and then check your email. Blockchain should have sent you an API access attempt showing what IP tried to connect. Follow the link and authorize the attempt, also the IP address from the email and whitelist it in your wallet account settings.

Now try running the file again.
If you did everything correctly you should see a response that lists your GUID followed by Success TRUE

Now you're connected and you can start sending requests with your wallet.

The calls work the same as version one, except you will send your requests through this service instead of get requests to blockchain.info.


What do I support with Bitcoin Core Version 0.14.2 At the moment I'm following the discussion about BIP-141, BIP-148, SegWit and SegWit2x (NYA). But I'm confused.

I'm running Bitcoin Core Version v0.14.2 as a full-node. It's currently downloading the blockchain (should finish in 40 hours). So I count as a user (in regard to the term user activated soft fork) what means that I have a vote.

Now I'm wondering what I'm supporting by using version 0.14.2?

You can look at the version field of blocks generated by that software, there are websites that show both the client and version.
To my knowledge, core supports bip141, which is SegWit (bit 1 of version)
Core does not support bip91, nor bip148, nor Segwit2x (2mb hardfork)


Can I see which bitcoin node sent cli command If I am running a bitcoin node, and for example I run a sendtoaddress cli command, is it easy for anybody to see what IP that command came from initially

Yes, it is. If the node is running with -debug=rpc, then all RPC events will be logged, including RPC commands and where they came from.

Note that Bitcoin nodes do not communicate over RPC nor is the RPC interface typically exposed to the internet. Furthermore, the RPC interface is authenticated; connecting to it and being able to send a command requires knowing the username and password configured for that node.


Error message still returned after transaction was indeed broadcast I use bitcoinj to create the following method to broadcast a raw transacion in testnet, and I did see on bitcoin explorer that it has been broadcast. But even the transaction has been already broadcast, it always return false message, please help me to solve this issue, I don't know if there is a problem when sync with the peer or if my broadcast method is wrong.

//sync with the peer
static WalletAppKit kit = new WalletAppKit(params, new File("."), "sendrequest-example");
kit.startAsync();
kit.awaitRunning();

//transaction broadcast method
public static boolean broadcastTransaction (Transaction tx) {
        System.out.println("Broadcast transaction: ");
        System.out.println(tx);
        try {
            TransactionBroadcast broadcast = kit.peerGroup().broadcastTransaction(tx);
            broadcast.future().get(20,TimeUnit.SECONDS);
            System.out.println(tx.getHash() + "broadcasted successfully!");
            return true;
        } catch (Exception e) {
            System.out.println("e.getMessage() = " + e.getMessage());
        }
        return false;
    }

The false message is always as following, although the transaction has been indeed broadcast.

e.getMessage() = Waited 20 seconds (plus 1985971 nanoseconds delay) for com.google.common.util.concurrent.SettableFuture@20d525[status=PENDING]

e.getMessage() = Waited 20 seconds (plus 4214583 nanoseconds delay) for com.google.common.util.concurrent.SettableFuture@38afe297[status=PENDING]

This looks like an implementation choice of the PeerGroup.broadcastTransaction method of bitcoinj.

If you send a transaction out to one or more peers, there is no guarantee that any of those peers will forward them on to others, and no way to verify it without having another node somewhere else on the bitcoin network listening for it (or listening to it from the same node but from different peers). You can only attempt to have some level of confidence that the transaction has been broadcast by sending it to multiple peers.

The broadcastTransaction method appears to have some confidence calculation in it, and probably does not complete the promise unless the confidence is met. I've not explored the details of it, but I'd suspect you're perhaps not connected to enough peers for it to have the confidence. Are you only connected to one peer perhaps? Maybe you need a longer timeout? Check the details of how the broadcast is implemented and you might figure it out.


Why bitcoin cash supply is currently 100k more than bitcoin on coinmarketcap (as of Oct 17) Is it a mistake or is there a significant difference in coins generated?

EDA (Emergency Difficulty Adjustment):

  Median Time Past of the current block and the Median Time Past of 6 blocks before has to be greater than 12 hours.
  If so, it gets 20% easier to create proof of work. In other words, miners can find blocks 20% easier.

Source: Jimmy Song

As EDA is one way (difficulty down), miners abuse it. They stop mining, and after the EDA comes, they start mining with a big hash power. This is the cause of Bitcoin Cash's hyperinflation: ~7500 blocks ahead of BTC and 7500*10/60=1250 hours of blocks ahead.

The developers are aware of this issue, and it'll be replaced on 13th of November, by a newer difficulty algorithm.

They haven't decided which algorithm to switch, but probably it'll be Dgenr8's. [1][2]

1: https://www.yours.org/content/dgenr8-s-difficulty-adjustment-algorithm-explained-01a2de286460/

2: https://reviews.bitcoinabc.org/D622


What are pros and cons of Tendermint? The writer describes it as a "solution to the blockchain consensus problem that does not require mining."

The white paper is viewable here:
http://tendermint.com/docs/tendermint_v04.pdf

I don't mean what are the pros and cons in relation to Bitcoin specifically, since I don't believe Bitcoin is likely to take it up. I am thinking more of the possibility of a popular altcoin like Dogecoin adopting it, or perhaps an smaller altcoin e.g. Reddcoin.

I'm the author of the paper.

PoW mining may be wasteful, but it's a great distribution mechanism.  Coins and other applications that use Tendermint might want to tack on a distribution mechanism that tapers off over time.  I'm also exploring alternative distribution algorithms that don't require PoW, but for now I'm busy implementing core Tendermint.

Dogecoin could adopt it with a hardfork.  Alternatively, one could take Dogecoin's transaction data and create a new coin using Tendermint's consensus protocol.  The biggest problem with this is that exchanges and wallet services may benefit unfairly.


Limit order versus Market order What is the difference between the two definitions that is not the following explanation: "Sell BTC 2.3 at $593.18" is an example of a limit order asking for $593.18 per 1 BTC. "Buy BTC 0.32 at $592.03" would be a limit order bidding for $592.03 per 1 BTC.

In a limit order, you specify how much of the asset (in this case BTC) you want to buy or sell, and the price you want.  If there are matching orders on the book (e.g. someone who wants to sell at the same price, or lower, as the price at which you want to buy), your order will be filled immediately.  If not, your order will stay on the book until matching orders arrive (which could be never).

(It is also possible for a limit order to be only partially filled, if the counterparty wants to trade a smaller amount than you did.  In that case the rest of the order remains on the book.)

In a market order, you only specify how much of the asset you want to trade.  Your order is then filled immediately at the best price currently available on the market.  For instance, if you place a market buy order, you will be matched with the current lowest-priced sell order on the book.  If that order is not large enough to completely fill yours, the next-lowest sell order will be used to fill some more of yours, and so on.


Will running a pruned node make my store less secure? We run our own nodes to verify transactions for our store and I was wondering what will be the downsides to me running a pruned node? I read they can fully verify a transaction so I'm not too sure why I need a full copy of the blockchain.

Will running a pruned node make my store less secure?

No, not at all.

  I was wondering what will be the downsides to me running a pruned node?

With a pruned node you cannot:

Handle (extremely) deep reorganizations (which are in theory possible but in practice would indicate a very serious problem with Bitcoin's security assumptions).
Serve old blocks to other nodes.
Rescan for old transactions that may affect your wallet after importing an old address/key.

  I'm not too sure why I need a full copy of the blockchain.

You generally don't, apart from the cases listed above.


What are the safety guidelines for using the Sign Message feature? bitcoin-qt's dialog box states, "Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to."

What would this kind of attack look like?  What are some examples of statements that would be safe to sign agreement to?

The signing mechanism is a way of proving that a particular message was signed by the holder of an address' private key.  A merchant could ask that you sign a message stating where you want your order shipped to, using one of the addresses your payment originated from.

You should sign a statement saying "I, Jane Doe (jane.doe@email.com) sent 1.23 BTC to Acme Corp at 12:34pm, 1st Jan 2012 in payment for product XYZ for delivery to 456 High Street, Anytown, USA".

You shouldn't sign a vague statement saying "yes, I sent that money; send the product to the address I emailed you", because anyone seeing a copy of that signed message can then pass that on to the merchant with his own postal address and get the product you paid for, in the same way as you wouldn't put your signature to a piece of paper saying "I agree to the above" where the above was left blank.  The postal address part won't be signed, but perhaps the merchant won't care.


I set my transaction fee too low 2 months ago and blockchain says "transaction invalid", will I get my coins back? About 2 months ago I sent BTC from my Mycelium wallet to an XMR exchange, however I set the transaction fee too low so it never got any confirmations. I found the transaction on blockchain.info and it would start off saying unconfirmed, then after some time it would say "Transaction invalid: some outputs that it attempts to spend have been already spent or are no longer valid" (although I have done nothing else with the bitcoin), then sometimes when I checked the transaction on Mycelium every few days it would rebroadcast and the same cycle would happen.
After 3-4 weeks I let the transaction rebroadcast once more and then deleted the transaction from Mycelium, so it would not rebroadcast anymore - I was hoping that after couple weeks the transaction would drop from the mempool and I would be refunded the coins. However this was now over 4 weeks ago and there is still no sign of the coins coming back. What should I do? Should I just wait it out and they will be guaranteed to come back eventually, or is there some action I should take?
Here is the transaction on blockchain: https://www.blockchain.com/btc/tx/4367ed782f5347ec5184b597d38267ccd117c0705b419bda5911d3a199df3483

Contact the person you sent it to sometimes they can speed up a transaction. Like when i sent a small amount of btc to localbitcoins in 2017, the can see the transaction and somehow point their miners specifically at that transaction. Maybe i don't recall correctly.but it took like two weeks and that was a long time then. Sounds like it's getting far worse. Probably will continue to get worse and worse. Bitcoin could be completely obsolete in another 3 to 6 years because it will be so slow.
I think the only thing you can do is wait. There's no centralized regulations that you can complain to. Very to hear that. Next time increase the transaction fee. The fees are godawful and are ruining crypto.


Does the entire blockchain have to be recomputed to validate a transaction? Are transactions validated by recomputing the entire blockchain? If not, how else can it be confirmed that a bitcoin I'm attempting to transact is one that I actually had come into acquisition of previously and still have?

If yes on the other hand, how long does that recomputation typically take in practice, and does that pose a scalability risk in the potential for Bitcoin usage (and hence the length of the blockchain) to outpace Moore's law?

No.  The blockchain must be queried, but not recomputed.  If you see a transaction that has two inputs, you will need to query to check if those outputs have been spent.  You will also need their encumbrance scripts in order to check the spending transaction meets the required criteria.  In essence, this is just a database lookup.


Can a client leave its mark on the blockchain? Would it be possible for a client (eg the core client) to leave its mark in the form of META data on the blockchain or even in the mempool so that we know that this client was used to create or send that transaction?

This is very similar to what web browsers do (for example this website tells you all about your browser by reading some META info: https://www.whatismybrowser.com/)?

The OP_RETURN feature can be used to accompany a transaction with arbitrary data.  A standard transaction can contain an OP_RETURN output with up to 80 bytes of data (40 bytes prior to Bitcoin Core 0.11).

You could have a client that includes an OP_RETURN output with every transaction, containing whatever meta data is desired (client software version, info about client settings, friendly greetings, Bible verses, etc).

However, since this would make each transaction larger, the users of this client software would on average pay higher transaction fees (depending on how often the extra data pushes your transaction past a 1 KB boundary, since the fee is per KB).  Also, since every full node has to store the extra data forever, some people might consider this feature to be "unfriendly" to the block chain, even though it is legal in the protocol.

Given these tradeoffs, one would probably not implement such a feature without a pretty compelling reason to do so, beyond simple curiosity.


Security bridge on bitcoin-qt walletpassphrase Is it safe to use walletpassphrase with bitcoin-qt rpc call ?
I can think of a security problem, suppose hacker was able to insert some kind of program that call each second to the wallet with sendToAddress and the hacker bitcoin address, now he will get a lock response each time until the call will execute on the timespan the wallet is unlocked. is it possible ?

The wallet passphrase protects against an attacker who has access to your disk but not the rest of your system.

If someone has access to your bitcoind through RPC, you need to protect by setting an RPC password, not a wallet encryption password.


how to add a buy transaction using bitcoin @ cryptocompare.com I'm using cryptocompare.com to track my bitcoins and altcoins.

I've purchased some altcoins, and added these altcoins to my cryptocompare.com portfolio, and ensuring I entered the amount per unit in bitcoin, but I am unsure if this debits my total portfolio by the amount of bitcoin required to pay for the transaction.

It seems I have too much bitcoin in my portfolio @ cryptocompare.com, which doesn't reflect my purchase of altcoins using some of my bitcoin.

I'm also using cryptocompare.com to track my crypto investments. However, it turns out that they do not have a functionality where the currency you entered to buy another currency gets auto-debited from your portfolio. You'll have to manually select that currency and enter the sale. I know that's not ideal. Hope the developers correct this soon.


What is my private key? No computer at the moment, so I have Wallets at two independent websites.  I sent millibits from one wallet to the other.  I hear that you have to use your private key to do that.  So, I guess that site created the private key for me, and they control it?  I certainly don’t know what it is.

Yes, when you use an online wallet service, you are trusting the website operator to generate and maintain your private key(s) for your account.

There is a saying that goes something like, "Unless you hold your own private keys, your bitcoins aren't really yours."


Are competing blocks a problem to weak participant of the network? Let's say Alice has two CPUs, and Bob has only one. Let's assume Alice and Bob are the only miners in the Bitcoin network.

What will happen if Alice did the following:

Calculate the nonce for the next block and send it occasionally.
Whenever Bob solves and transmits a block, DON'T accept his block, but instead try to solve another block at the same height, and a successive block.
When done calculating, send both blocks to the network. They should be accepted instead of Bob's transaction, and since you're 2 times speedier than Bob, in average you'll be able to prevent Bob from mining coins.

While this is a somewhat artificial example, I think that it might represent a real problem. A group of strong participants can prevent weaker players from mining, even if this group does not control the majority of CPU resources in the network.

That is essentially a 51% attack. It is a very real, but unlikely threat to the Bitcoin network. Historically as it turns out, it is more lucrative to simply add more processing power to the network than fight it.


Does Proof of Existence lose bitcoins? http://www.proofofexistence.com/about -- "Use our service to anonymously and securely store an online distributed proof of existence for any document."

  The document is certified via embedding its SHA256 digest in the bitcoin blockchain. This is done by generating a special bitcoin transaction that encodes/contains the hash via an OP_RETURN script. This is a bitcoin scripting opcode that marks the transaction output as provably unspendable and allows a small amount of data to be inserted, which in our case is the document's hash, plus a marker to identify all of our transactions.

Naïve question perhaps, but if the bitcoins are lost forever, this seems like an unfriendly use of the bitcoin protocol and the blockchain, and future versions of the protocol may prevent this type of transaction from being accepted into the blockchain?

Well, it's probably not an intended function of the block chain, but I wouldn't call it "unfriendly" because you're not really harming anybody (by reducing the total amount of bitcoins available you're in fact increasing the value of all other bitcoins a little).

  [...] future versions of the protocol may prevent this type of transaction
  from being accepted into the blockchain?

No, because it's not possible. The transaction encoding the document hash looks exactly like any other normal pay-to-address transaction. The only difference is the address which is a representation of the document hash instead of a hashed public key, and therefore there is no private key associated with it (that's why it is unspendable). You can't go back from a hash to it's origin though, so you will never know whether it's spendable or not.


Receive at Watching Only Wallet I am a little foggy about the Watching Wallet copy in Armory. I have received BTC in my Watching only wallet. Is there anything that I need to do now to get those to the Cold Storage Wallet or is the Cold storage Wallet only needed to sign Spending transactions.  If so then in that Case I assume that the accurate balance in the Cold Wallet does not need to be reflected as it is only used for spending?

Thanks

No, you don't need to do anything.

  If so then in that Case I assume that the accurate balance in the Cold Wallet does not need to be reflected as it is only used for spending?

Correct. Without a means to gain knowledge about received money, the cold storage wallet can't update its balance. But it holds the private keys required to spend the money it received. The watch-only wallet can be used to check the balance without it having the ability to spend any money.


What are the realistic system requirements to run bitcoin core for generating wallets, signing and verifying messages on a laptop? I need to be able to verify messages and check that funds in wallets are valid and that the claimed owner possesses the private keys (hence checking messages signed).

I know that I need to be able to download and sync the whole blockchain so I will be getting at least a 1TB HDD.

Are there any other things that would be really needed to run it smoothly? I was thinking of a laptop with an i7-6700HQ processor and 16GB of ram.

Will this cut it?

You can just use the pruning, which lowers the required storage size to 550 MB. Other than that, you don't need a strong computer. It can run on a Raspberry Pi 3 B+ without any problems (but it won't be able to keep a full mempool).


download the bitcoin chain begining from a certain date I am building a bitcoin lightning network using lnd on a separate computer

this computer has less than 200G avaible and the actual blockchain is more than 220G, so I am gonna need to use prude mod and began the download of the chain starting from march 2018 as recquired by lnd,

my question is which bitcoin client is able to do that and how to configure it for this procedure ?

I am gonna need to use prude mod and began the download of the chain starting from march 2018 as recquired by lnd,
my question is which bitcoin client is able to do that and how to configure it for this procedure ?

I don’t believe any client can do this: how will your node know if a UTXO from before March 2018 was valid if it hast verified the full history of the chain?
When a node is bootstrapped, it will work through the blockchain’s history to build a UTXO set. Without being able to build and verify this UTXO set from scratch, there is no way to know that a UTXO is valid (without trusting someone else). For example, if someone opened a channel with your node, by consuming a UTXO from 2017, how would your node be able to determine the validity of that UTXO?
Even for a neutrino-serving node like btcd, the node still needs to have verified the entire history, in order to serve the LN node valid data.


How to calculate txid for segwit transactions? I'm having difficulty calculating txid for recent transactions. I followed bip-141 at https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki

For the first transaction in the first block found in blk00165.dat (testnet), I get the following when I aggregate the required data to be hashed:

  010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2303cdb21400fe56ca615bfe8b8804000963676d696e6572343208020000000000000000ffffffff0220f68e11000000001976a91446868f669409e6e744c6a270767cc27e81220ead88ac0000000000000000266a24aa21a9ed5d06bb0f22a0ffa6d7c63f2769b13f917787554e1235f7eed140fe675ee29c050120000000000000000000000000000000000000000000000000000000000000000000000000

I also printed out the byte stream of the file and it matches. But when I double hash it, I get an invalid txid. Am I missing something for segwit transactions?

My code works for non-segwit transactions, tested with the first few transactions in the very first block.

The txid of a segwit transaction is computed by first dropping all the witnesses, and encoding it in legacy notation, and then computing the double-SHA256 hash of it.

This is the only possible way, as anything else wouldn't be compatible with old clients (which is required by it being a softfork).


What is the motivation for miners to include all recent transactions in a block? I think I understand the basic operation of the Bitcoin protocol.

Blocks are the "long-term memory" of the network used to prevent double spending (and the way the network agrees in first place). Proof of work is sort of brute-forcing the nonce so that the hash has at least the desired number of zeros. When a dishonest node generates a new block other nodes will refuse it should it contain transactions that were not seen by them, so the network will "converge".

I guess the transactions need to be included in that PoW (or else it would be simple to alter them afterwards). So every time a new transaction is seen it will require the miner to start brute-forcing "from scratch"? I read some sort of tree is formed, so it actually doesn't mean the input to the hash function gets longer, but still every transaction will change the "root value", won't it?

Why would a miner even bother to include all transactions that occurred on the network (given that transaction fees are minimal)? There is no lower limit on the tx number per block (perhaps in that time there were really no transactions). It would be simpler for them to just include perhaps one and then use their (CPU) time to solve the puzzle and earn the reward.

There must be some sort of thing in the Bitcoin design which I don't get yet...

Miners have a long-term investment in the health of the Bitcoin network. If Bitcoin collapses, then their expensive ASICs are worthless. Miners particularly need Bitcoins to remain valuable over the long term because their hardware produces Bitcoins over time.

If nobody includes transactions in blocks, then Bitcoins would be useless and therefore worthless. That would hurt the miners' long-term investment.

If this ever became a problem, transactions would just wind up with higher fees to encourage miners to include them. Right now, enough miners will include a transaction with a miniscule fee that there's no point in paying more.


What is "consensus"? I’m really struggling to get my head around a particular piece of lingo in the bitcoin/blockchain space, and would really appreciate if someone was able to give a bit of clarity. I have been doing a lot of reading trying to figure this out, but the more I read, the more confusing it seems to become.

Basically, it concerns consensus and governance.

With blockchain tech, as far as I understand, we have the following:

‘consensus’ needed amongst miners as to what the ‘next block of transactions’ is that is added to the chain (and the longest chain, becomes the valid chain in the network).
‘consensus’ needed about which version of the protocol is used (disagreement leading to a hard fork)

My main question about the above, are they both referred to as ‘consensus’ or is there terminology which separates the two? (Whenever I open a new article about governance and consensus, I have to read half of it to figure out as to which type of ‘consensus’ the writer is referring to.

Would governance therefore be the developers who have permission to merge changes into the main bitcoin code base?

For a given network, consensus means achieving a consistent view of the global state between all participants. For Bitcoin, this means that all nodes/wallets should be considering the same utxo set. For Ethereum, it involves all participants having the same state trie. Minor other variations exist for other networks.

Mining and protocol versions are simply means to achieve this consensus - miners are motivated to only select valid transactions (transactions that spend unspent utxos, and meet other validity requirements) as their block will be dropped by other participants in the network if they produce an invalid block.

Protocol versions are a little more forgiving. On one hand, you have the literal Bitcoin Wire protocol which nodes use to exchange block, transaction, and peer data. Changes to this are usually backwards compatible, so you can safely run a slightly older version of bitcoind on the mainnet without facing any issues.

Protocol could also refer to the concept of Bitcoin itself, and encompass things such as what is a valid transaction, whether segwit is enabled or not, etc. These can be backwards incompatible changes which require a hardfork, and thus require all users to update their software, or backwards compatible, which allows certain older versions to continue working.

Thus, in short, I would say that consensus is achieving a consistent world view, and mining and protocol versions are implementation details that help us all agree on that view.

Governance comes down more to social behaviour than literal control of the project - if the Bitcoin Core developers went rogue tomorrow and added code that allocated 50% of all block rewards to them, it would likely result in a quick revolt, and others in the community would fork Bitcoin from a point before that change. Thus, even though a small subset of people currently control what code goes into Bitcoin, they are not an absolute authority, and the community may choose to follow a different idea of Bitcoin.


Bcoin initial blockchain sync progress isn't saved I'm using bcoin and it's class FullNode to run a full Bitcoin Node.
Here's the configuration:

const node = new bcoin.FullNode({
        prefix: '/mnt/d/bcoin',
        network: 'testnet',
        indexTX: true,
        indexAddress: true
});

And then I start the node with this code, identical to the one they use in their official example.

(async () => {
        await node.open()
        await node.connect();

        node.on('connect', (entry, block) => {
                console.log('%s (%d) added to chain.', entry.rhash(), entry.height);
        });

        node.on('tx', (tx) => {
                 console.log('%s added to mempool.', tx.txid());
         });

        node.startSync();
})().catch((err) => {
        console.error(err.stack);
        process.exit(1);
});

It seems to be working fine, I get notifications of the blocks added in the console. the program crashes once in a while to the lack of memory, however, I found a fix to that. The progress of sync seems to never be saved, however. If I were to restart the app when it's on 1,000,000 blocks in (testnet) - the sync will start over. The files are created in the /mnt/d/bcoin folder and it's already 10 GB in size. In comparison to the official bitcoin node - it always carries on the sync that's already in progress. I have never been able to finish the inital blockchain download with bcoin because I run it in my PC and it always fails for various reasons. So is it expected behavior for bcoin to reset its IBD progress every time? Would it read the existing block files after IBD?

I think the configuration you are missing is

memory: false

See the default full node application script here: https://github.com/bcoin-org/bcoin/blob/cec3c3e788834d3e9fc3c0b21bc3e340d573dcfd/bin/node#L31

By default, bcoin objects (like chain and walletDB) run in memory.

So actually I'm curious what is taking up the 10GB in that directory? Could it be data from a previous run with a different configuration? There could be a bug, but just looking at the script you have posted here, I would expect the Full Node to run entirely in memory and therefore start over on each execution.


How is mining associated to blockchain transactions? I know how mining works and how transactions are added to the blockchain. What I don't understand is the association between the two...if any.

I've read a few times about how a cryptocurrency transaction is added to the blockchain through consensus. This often means PoW. Then there is mentioned that miners perform PoW and the transactions are cleared. How?

Miners mine for coins right? What does mining have to do with verifying unrelated transactions?

At least for bitcoin, is it even possible for miners to keep up with all of the transactions occurring?

How users / nodes see it:

When transactions are made, they stay in nodes' memory pools ("mempool") until a block that contains them, becomes mined and relayed. When this happens, that transactions become a permanent member of the blockchain (unless that block is orphaned).

How miners see it:

Miners' major incentives are block rewards. However, to maximize their profit, they can also include transactions in their block (According to BlockChair, 124k of 510k blocks include no transaction.) If they include transactions in their block, they'll be able to collect their transaction fees. That's why most of the blocks include transactions (and the miners who don't include transactions are mostly illogical).

tl;dr When miners include your transactions, your transactions become a permanent element of the blockchain. They do this to collect your transactions' fees, to maximize their profit.


Is there any python library could be used to decodescript in output For example decode the ScriptPubKey like

4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

to some data like this

{
"result": {
    "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
    "reqSigs": 1,
    "type": "pubkey",
    "addresses": [
        "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
    ],
    "p2sh": "3DjjKyU38gSfuVxajV43MUy4vHkg1JVL7T"
},
"error": null,
"id": null
}

In general, something like the function in decodescript rpc.
http://chainquery.com/bitcoin-api/decodescript

I just added that to my toy library.

>>> from btctools import decode_scriptpubkey
>>> decode_scriptpubkey('76a914b3c2dc3a7f68a024a5d2ee9d4012dca1134dea8588ac')
{'address': '1HPVPU3xHMPcxmgdP9puPbnDcHDV5JhURh',
 'asm': 'OP_DUP OP_HASH160 b3c2dc3a7f68a024a5d2ee9d4012dca1134dea85 OP_EQUALVERIFY OP_CHECKSIG',
 'hex': '76a914b3c2dc3a7f68a024a5d2ee9d4012dca1134dea8588ac',
 'type': 'P2PKH'}


What database engine does Bitcoin and other top altcoins use? I'm curious to what database engine does Bitcoin and other altcoins use to store their blockchain data. Do they all support sql queries or is it something else?

The main ones I'd like to know are:

Bitcoin, Litecoin, Monero, Ethereum, Dash, Ripple, Factom, NXT, and other ones.

It depends on the implementation. The network itself does not have a database engine. Bitcoin Core and software derived from it (most altcoin software is derived from Core) uses LevelDB to index the blockchain and store the chainstate data (UTXO set, current best block, etc.). It uses BerkeleyDB for the wallet.

However different implementations can use whatever database engine they want. For example, Armory uses LMDB for storing block indexes and other chainstate data.


Why are there so many fake cryptocurrency airdrops? I started learning about cryptocurrency three months ago and I have come across many airdrops spread by scammers who disappear after many persons have signed up on their platform. Are there ways one can identify the scammers in the crypto space?

There are so many airdrops, scams and fake projects, because it is an easy way to make money quickly.
Over the past years I've identified the following heuristics:

If it sounds too good to be true, it definitely is
If it's not clear how a service/project is making money, you're not a customer, but a victim
Whenever someone requests actions from you out of the blue, it's a phishing attack or scam
Nobody gives money away for free, there's either a catch, it's a scam, or you're the product
Extraordinary claims require extraordinary proof, anything unproven is just marketing
Altcoin software is malware trying to steal your bitcoins until proven otherwise
Everyone is a scammer until proven otherwise
The "next Bitcoin" is Bitcoin


I need to know about wallets in cryptocurrency, how do exchanges generate deposite address per user? In exchanges like Binance when a user wants to deposit coins in bitcoin or in other coins, per user receives a unique public key? Do they have to generate pair key private/public key for each user in each coin? Or there is a way that we can have many public key for a special private key and Binance had one private key and unlimited public key related to that?

If anybody have a good reference please let me know or give me description about this subject. thanks.

In exchanges like Binance when a user wants to deposit coins in bitcoin or in other coins, per user receives a unique public key?Do they have to generate pair key private/public key for each user in each coin?

I suppose they must be using a HD wallet for each users, but since one you send them your coins, everything happen in their back end they can do everything they want with them, especially for coins that dont support HD wallet, they could just generate private key then link them together in one of their database.

  Or there is a way that we can have many public key for a special private key and Binance had one private key and unlimited public key related to that?

Yes, this kind of "special private key" is called a Hierarchical Deterministic Wallets and will allow you to generate an infinite amount of private key and so public keys, addresses derivated from a master seed, and so if you know this seed you can link those private keys together

This technology is used in personal wallet software like mobile wallet, but as I said since we dont have access to the back end of exchanges like binance they could use other tactics to organize their users funds.


How to purchase and send bitcoins I tried Blockchain in 2015 through an account with Laissez Faire, but could not get help signing up, so I just let the account go. Now I decided to try it again and I am still lost.  How can one send bitcoins to others if you haven't purchased any? Please, I cannot learn without asking questions whether the questions sound dumb or not.  Please help educate me.

There is no credit in Bitcoin. Therefore, you cannot send any bitcoins until you have either purchased or earned some.