Does difficulty ever stop increasing? I know we don't have to worry about this for a very long time, but...

One argument against Bitcoin, and really, digital currencies as a whole, is that, in order to time blocks with reasonable predictability every 10 minutes throughout the life of the system, the resource cost of blocks (e.g. processing power and electricity) increases over time. This system thus assumes that the available processing power will always be increasing and that the cost of electricity necessary to operate that processor will be less than the revenue from block reward plus transaction fees, that mining will be profitable.

If the difficulty never stops increasing, what happens if increased resource costs cause mining to be unprofitable?

The difficulty actually does not continually increase. It has continued to increase recently because hashing power has continued to increase, causing blocks to be found quicker. Difficulty is calculated by taking into account how long it has taken for the network to create 2016ª blocks and adjusting the difficulty accordingly.

Here's some messing around in a Ruby interpreter to show it:

#two weeks, expressed in seconds
twoweeks = 60 * 60 * 24 * 7 * 2
# => 1209600
#the current difficulty as of the time of this posting
diff = 7988698.97
# => 7988698.97
#the difficulty if it took only a week to generate the past 2016 blocks
(diff * twoweeks) / (twoweeks / 2)
# => 15977397.94
#the difficulty if it took four weeks to generate the past 2016 blocks
(diff * twoweeks) / (twoweeks * 2)
# => 3994349.485

A pair of maximums keep the difficulty change from being too abrupt. It can never more than quadruple (four times, 400% of the previous difficulty) or more than quarter (one quarter, 25% of the previous difficulty).

ª A bug makes it be actually 2015 in the reference client, but that may be fixed at some point in the future.


I would not rely on vol or vol_cur as they are computing data in a way you do not want from data which is available to you.

My recommendation would be to save the data of individual trades using btc-e API function TradeHistory. You can run a loop which would take the first result returned and using the timestamp as the parameter "end" for the next API call. Be aware that you will receive this and other transactions with the same timestamp in duplicate (so be sure to check the record doesn't exist in your db before adding it).

This way, you can write your own scripts to get your own averages and volumes over any time period you want :)


Can I emulate a graphics card using software, and use it for mining? My name is Ben and I'm working with a server technician called Fab.
We are using Team-viewer to work together on this question to make it as concise and to the point as possible.

We have set up a Ubuntu 13.10 VPS server

Next we downloaded http://www.forked.net/~apex/cgmon/cgmon.tcl (a .Tcl script found on this forum page: https://bitcointalk.org/index.php?topic=353436.0

(Fab:)We managed to install X Server and Lite KDE Desktop environment, and we can successfully connect via VNC to the VPS desktop.

(Fab:) So now: what we would like to understand is whether the host machine where the VPS container is sitting must have a graphics card or if mining using a VPS server could be achieved even without the host server having a physical card, perhaps in a different/emulated way?
The Theory
Now we also want to hook this all up to Cairo grahics lib http://cairographics.org/ (this is a pure c++ graphic processing library for pre-generating images on the server side so there should be no need for a graphics card).
My personal line of thought (Ben's) is that a hash has binary data.
UFUYFYF*^R&^R*IYG*R*FUYFUYFUDKYTDLUFU...

but much longer...
now go and get any image from your desktop and open it with a text editor and you will see some thing like this:
ÿØÿà JFIF  H H  ÿÛ C ...

The difference is not much (in my opinion) because graphics cards are made to process images such as .jpg / .png/ .gif/ .bmp, etc. They do this very fast because the start of the file or maybe even the extension is telling the graphics card how to decrypt; where as a hash is the same, only the description method is a secret that must be tried with many variations of description (hence the term hashing refers to multiple attempts).
Now If you read the wiki link above it explains that Tcl was originally "born out of frustration" and If you scroll down the Wiki to Features one listed is: Extensibility, via C, C++, Java, and Tcl.
So, seen as libcairo is pure c++ and Tcl can run C++ commands, what I would like to know is how can we link the two...

Chances are there is no GPU in the physical host server, servers don't need them.

You could CPU mine, but it would be pointless for Bitcoin, Litecoin and most of the Alt-coins because you just wouldn't have enough processing power to generate anything but dust.

Sorry it's not a helpful answer, but it's better than no answer!


In creating a scriptSig, how do I sign the hash of a raw transaction? I have created a raw transaction, added the hash code, and Double-sha256 this result.  Now I should sign this hash with the private key, which would give me the DER encoded signature, but I'm not clear on what exactly I should be doing.  How do I SIGN this hash with the private key?  What exactly would I be doing?  I am not using any crypto library, except for SHA256, and I have implemented secp256k1 my self, so I guess in relation to that, what should I be doing with the private key and the hash?  I am specifically aimed at step 15.  If I were to guess, this and this are essentially my answer, unless I am mistaken, and if I am, I would like to know why.  Otherwise, the caveat with those answers is the introduction of a random nonce.  Why could I not just have the private key = "k" (since you shouldn't reuse addresses anyway, right?), calculate "s", and concatenate "r" and "s"?  Or is this how it IS done?

It is not the sha256(sha256(tx_bytes)) that needs to be signed. You need to follow the specific algorithm defined inside of Bitcoin core to produce a proper digital signature. Here is where the signature encoding algorithm is defined. Notice, that this algorithm changes slightly based on the hash type you provide. This allows us functionality to include (or prevent inclusion) of extra inputs/outputs on a transaction.


Is there a way to a get a list of all address tags from Blockchain.com? (either by scrapping or API) I am looking to get the most complete list of address association with entity names.
I am thinking blockchain.com must have a good one but here https://www.blockchain.com/btc/tags?filter=8&offset=500 you can only search by address or name and not get a complete list.
Is there a way to get it?
Does another website give access to a good list?
Thank you

You can try walletexplorer.
Or start compiling this list yourself, there is a ton of false data there. So if you are looking for quantity, I'd suggest walletexplorer, for quality you have to do attribute these services on your own.


How is a USD-chained currency like Tether economically possible? (I'll try my best to keep it relevant to Bitcoin, but feel free to close it if it seems inapplicable to Bitcoin trading. It's more about economics)

Say there's a currency whose supply is controlled (e.g GBP in 1990, or USDT) to keep the exchange rate fixed (GBP/EUR or USDT/USD)

But sometimes the exchange rate is slightly higher or lower than intended. If it's higher, one can borrow more of the valuable currency, sell it, and then pay back with interest, and profit from the difference, because there's no doubt that the currency's value will be lowered to reach the exchange rate target.

In the end, George Soros and his $15 billion budget made at least 20% profit, according to the source, and GBP was forced to become free instead of 1.2 GBP/EUR .

My question is, what protects USDT from this kind of economical strategy which is guaranteed to make Bitfinex, the minter of USDT, a loss? Is that because they hold the majority of USDT?

Bitfinex, the issuer of Tether, claims that all of the USDT is backed by USD and USD equivalents. As such, the intrinsic value will be close to [$1 * asset impairment], and so no market manipulation/pegging is required to maintain parity, so long as their assets actually match the tether outstanding.

Although no action is required, there is an opportunity for Bitfinex to buy USDT with USD when the price dips below 100 cents and sell when its over 100 cents if they actually are fully backed. This would tighten the trading range, and make Bitfinex a profit in the process.


Which wallet can I use to store all my cryptocurrencies ? I'm new to cryptocurrencies and I would like to store all my currencies (I read here and there that it is not safe to store everything on Coinbase).

So I tried Coinomi which seems quite good but is it safe ? Since I can send everything with only a password (not even with fingerprint or a pin), did anyone had an issue with it ?

I was also wondering, since I have Zcash, Bitcoin, LiteCoin et Ethereum, how is that possible that I can backup all these currencies with only 1 passphrase ? I mean, if I download the Zcash app for Mac OS, how will I recover my coins ?

Thank you !

Jaxx is a multi-currency wallet. Hardware wallets like Trezor and Ledger support multiple currencies as well.


Can Bitcoin Help with a devalued currency? I worked in Canada, in the Oil industry, CAD took a big hit in the exchange versus USD, can anybody advice me if transferring my money to Bitcoin can help me increase the value of my savings again?

Since I do not live in Canada anymore and I need USD.

See the comments above, but the answer to your question is that the exchange will happen at the "instant" exchange rate.

So, whatever value CAD is at when you do any kind of exchange, that is the value you will get.

In terms of increasing savings, all you can do it make sure you exchange it for one that is rising.


I can't receive a sent bitcoin yet Some body sent me 0.55 bitcoins on the 29/12/2016 and i have not recieved it uptil now and the coins have been deducted from the sender's wallet. Is it normal to experience this kind of issues?

Don't worry about it first thing check the bitcoin address from your sender and check your bitcoin address too if they are both the same and correct. If correct and until now you haven't receive it means the bitcoin network is still processing your bitcoin to your address. Every transaction goes to block chain. If you have copy of block chain process you can check it out to monitor the activity to your bitcoin.

You will receive it after the chain is complete. Thanks!

For more info go here: https://en.bitcoin.it/wiki/Block_chain


Has UTXO selection methods changed since activation of Segwit? Before Segwit, transactions were penalized higher fees for having more inputs than outputs due to the input size being larger despite those transactions actually decreasing the global UTXO set. Segwit corrects this incentive mismatch. Have wallets taken advantage of this by changing their coin selection algorithms?

Bitcoin Core's client has recently applied changes to their coin selection algorithms based on Murch's Master's thesis.


What are the transactions included in the merkle root I am trying to understand the block hashing algorithm used to generate block.

One of the points mentioned here is

  it is (nearly) impossible for two people to have the same Merkle root because the first transaction in your block is a generation "sent" to one of your unique Bitcoin addresses.

How do I specify my unique address? Does it depend on what kind of miner I use and whether I mine in a pool?

Also what is "generation" and how is it different from other transactions that include transfers of bitcoins? What other transactions are included in the Merkle root?

How do I specify my unique address?

You don't need to. Bitcoin will add the coinbase transaction automatically.

  Does it depend on what kind of miner I use

No.

  and whether I mine in a pool?

Yes, because then the pool gives you a block header to mine, which includes their coinbase transaction. If you put in your own coinbase header, then the pool will reject your shares.

  Also what is "generation" and how is it different from other transactions that include transfers of bitcoins?

Just like a normal transaction, it specifies how the money can be spent, but unlike normal transactions, it doesn't need to provide any inputs. However, the amount transferred must be equal to the total transaction fees plus the block subsidy.

  What other transactions are included in the Merkle root?

Every valid transaction that your bitcoin client knows about is included.

  I suppose that the pool gives different headers which include different transactions to pool members. Right?

I'm not sure what you mean by that - the coinbase transaction is different, because the pool doesn't want multiple miners to duplicate work. But in all cases, the coinbase transaction gives the bitcoins to the pool. Actually solving a block is worth just as much to the individual miner as solving a share.

  What happens to the transactions that are not included. Are they included in future blocks?

Sometimes. Maybe those transactions are forgotten. It's called the "memory pool" for a reason - it's forgotten on shutdown.


Blockchain.info - How to reply to a sender in a callback? I just started using the Blockchain.info API, I've set it up to notify me when a payment is made, however all addresses in the callback are the destination address. Shouldn't I have the senders address as well?

Is there any way of getting the senders address, otherwise how am I supposed to reply?

I know transaction has the address, do I just pull the first address from inputs of the transaction?

You would need to fetch the transaction using the /rawtx call and use one of those inputs.

However you should not send a refund back to the the sending address unless the user has specifically told this is what will happen as shared wallets cannot receive coins back to the sending address.


How do network nodes "connect" - amateur level I have little background in computing, have been studying bitcoin for intellectual stimulation. I have learned a lot and I understand quite a bit regarding the function of nodes, the validations they perform, and their importance to bitcoin functionality - but I want to understand more about how nodes in the network "connect". I read this question and it didn't help.
I have no idea what a "network" really is. I googled and read about LAN/WAN. Are these the types of network we're talking about?
For example - if I owned bitcoin before the bitcoin cash fork, it is my understanding that I could choose to send my coin as bitcoin, or send it as bitcoin cash, it just depends which network I send the transaction to (kind of, over simplyfing here). So if I send it from a bitcoin wallet it will get broadcasted to the bitcoin network and stay on the bitcoin blockchain, or if I send it from a bcash wallet it will get formatted however bcash formats tx messages and get broadcast to the bcash network. How do these "networks" work, how are they distinct? Where could I look to read more about this.
Certainly if I download bitcoin core and start running a full node it will start connecting me to other nodes in the bitcoin network. How does that process actually go down? How do distinct networks stay separate? I have read about things "dishonest nodes" can do, so without downloading something like bitcoin core (which I assume automatically implements standard protocol for node behavior) how would nodes connect to the network without running bitcoin core?
Hopefully someone can make sense of my question, I understand it may not be very clear but that is because I don't even know enough to form a good question. I don't have any terminology here.
Edit: maybe this will help understand. Supposed I wanted to write some code to develop my own bitcoin client. What was that code look like?

I have no idea what a "network" really is. I googled and read about LAN/WAN. Are these the types of network we're talking about?

No. A network is really just "a group of connected things". One example is indeed a LAN network through which multiple computers that are physically close to each other (a home, an office, ...) are connected to each other. The Internet is also an example of a network - one built up of smaller and very distinct networks like LANs.
But networks can be many more things than that. The group of people you know and hang out with is considered a network too. An electrical circuit inside a machine is sometimes called a network. I bring up these examples, because the word "network" in a computer setting often evokes the mental image of physical interconnections between computers - and while that is one example, the Bitcoin network is something fundamentally different.
The Bitcoin peer-to-peer network consists of Bitcoin nodes - pieces of software, not hardware. I could be running two nodes on my own computer, and they could be connected to each other - or not; they could also both just be connected to far away nodes elsewhere in the world. In fact, these connections don't even need to be established over the Internet. There have been projects to connect Bitcoin nodes over mesh networks, and you could arguably also consider the Blockstream satellite service to be part of this network.
So bottom line, the Bitcoin network consists of pieces of software talking to each other. How they talk to each other can differ, though most commonly, it is TCP/IP connections over the public Internet or over Tor. These connections are somewhat similar to the connection your browser makes to stackexchange.com to show you this answer, but instead of it just being many clients (browsers) talking to one server (stackexchange), it is all nodes that are equal - they are peers. No servers and clients; there are just nodes, and they each connect to one or multiple other nodes. Certainly some are more powerful or better connected than others, but none have a privileged position w.r.t. other nodes.

How do these "networks" work, how are they distinct?

This is where it gets interesting. Bitcoin, and similar things, follow a trust-minimized design. At least if you run a fully-validating node (like Bitcoin Core), your node will generally not trust anything other nodes tell it. They will exchange blocks, and transactions, and other things, but whatever your node receives it will validate independently to the extent possible. This includes very strict validity rules for blocks. Your node will only accept blocks that follow the exact rules implemented in the software.
The simple answer to your question is that Bitcoin and altcoin nodes have different rules, and simply won't accept each others blocks. If a node were to be only connected to nodes with different rules, it would be isolated, and not be able to learn about new Bitcoin blocks; it needs at least one connection to an honest like-minded node. To make sure that doesn't happen, nodes will detect the situation where their peers give them blocks they consider invalid, and when that happens, more aggressively look for more nodes to connect to, and possibly disconnect existing ones if they really seem to have a different idea. In practice, this quickly teaches nodes on both sides after a fork to shun the other side.

Certainly if I download bitcoin core and start running a full node it will start connecting me to other nodes in the bitcoin network. How does that process actually go down?

Bitcoin Core specifically has a number of mechanisms that control connections:

It maintains a database (called "addrman") with IP addresses (and Tor addresses, if that's in use) of known other Bitcoin nodes, together with some statistics and whether or not it has made a connection to it. New peers to connect to are drawn from this database. At most 10 connections are made, in order not to overload the network. This database is fed new information through:

Nodes gossip IP addresses of other nodes (the  addr P2P message) to each other.
A few DNS seeds are hardcoded that can be asked for more IP addresses if needed. This is only when not enough connections can be established after some time, and typically only needed the first time the client runs. After that, nodes autonomously find more peers to connect to.
As a very last resort, if DNS querying doesn't result in decent network connections, Bitcoin Core also has a list of hardcoded IP addresses to connect to.

The user can manually specify peers to connect to, using the connect= or addnode= configuration file options, or the addnode RPC command.
Nodes can accept incoming connections from other nodes too (there is a limit on this too; by default 125 connections, and when it's full some rules will prioritize peers from others).

how would nodes connect to the network without running bitcoin core?

Other implementations have their own mechanisms, but there is a wide spectrum - all the way from just connecting to the wallet provider's server, to learning about peers and connecting to them like Bitcoin Core does.

Supposed I wanted to write some code to develop my own bitcoin client. What was that code look like?

That really depends on what you want to do. There are libraries in many languages that implement the P2P protocol that lets you talk to other nodes, or you could start from scratch just following existing protocol documentation and Bitcoin Improvement Proposals (BIPs) that affect the P2P protocol. Remember, there is no authority in Bitcoin that can tell you exactly what "the" protocol is; proposals are made, and software dedvelopers implement them or don't. You'll want to test things, by not immediately dealing with the Bitcoin mainnet, but first try on the Bitcoin testnet or the newer "signet" test network.


How can I set a fixed fee sufficient for transaction success in bitcoind? I used to use sendtoaddress with bitcoind and a fixed 0.0001 btc transaction fee in the wallet UI to do the job and every transaction was sent without any problems.

Since version v0.12.0 I can see that the fee is not fixed, plus some transactions don't transmit to the network.

How can I send transaction with bitcoind that will be 100% relayed ?

You can try:

txconfirmtarget=1

If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: 6).

So putting it equal to 1 will automatically set the fee to be included in the next block.

Note that this isn't a "fixed amount solution".


How to track UASF support? It's easy to see that currently 50% of the hashrate supports Segwit.

It's also simple to find that about 1000 nodes are supporting it. But I can't seem to figure out how significant that amount is, since all the total node counts are very rough estimates, and not all nodes are public.

So what is the best way to find out how solid the support under non-mining nodes is right now?

The total node count is not relevant. It's easy to spin up  nodes, or even fake nodes that just report a certain user agent string. That doesn't mean that they care about the rules, plan to keep following them if the hashrate majority goes another way, whether they'd even notice if they're forked off, or even whether they actually implement the rules.

What does matter is how much economic activity is following the fork's rules, and whether they're planning to keep doing so regardless of what happens.

Measuring that is something you cannot do inside the protocol. You need to look at company statements, press, ...


Can we predict about bitcoin network? What will happen to the bitcoin network once all 21M of bitcoins have been mined? The bitcoin network will cease to exist? or the bitcoin network will continue to function the same way with miners being compensated with transaction fees when users spent their bitcoins?

I don't think anyone can predict anything, especially that it's estimated to happen somewhere in 2140 ;)

But I'll share my take on it.

Please note that the number of BTC rewarded will he halved few times until then: https://docs.google.com/spreadsheets/u/1/d/12tR_9WrY0Hj4AQLoJYj9EDBzfA38XIVLQSOOOVePNm0/pubhtml?gid=0&single=true

So the proportion of BTC reward to transaction fees will be less and less - and the network will adjust.

Also - what is important - that this is self-regulating. If the reward was to disappear, some miners would leave the network (because of the cost bigger than transaction fees earnings). But then the difficulty would decrease, and mining cost to profit should more or less equalize.

So, unless bitcoin network is abandoned for some other reason*, the disappearing of block reward should not have a significant effect on the network itself.

BTC is like every other money - if people believe it's money, then it's money. Same with Bitcoin - doesn't matter if mining has any extra bonus or not.

(*) the biggest challenge to bitcoin seems to be the block size, which limits the network throughput. If you wanna read more thoughts on that - check my other answer here https://ethereum.stackexchange.com/questions/39477/why-is-there-a-possibility-to-increase-block-gas-limit/39479#39479


Bitcoin-qt import private key crash Importing a private using the debug console causes a crash, I always have to kill from shell the bitcoin-qt app and restart it.
Is there any way to prevent this?
Is there a way to import the private key into qt client from shell?

To supplement George's answer:

It would help if you would clarify what you mean by "crash" and describe exactly what happens.  (To many people, "crash" means a segfault or similar abnormal termination, but it sounds like that's not what you mean.)

If the issue is that the program appears unresponsive, this is normal: it's a well-known annoyance (perhaps not exactly a bug) in bitcoin-qt.  The program needs to rescan the transaction ledger (block chain) to find any previous transactions involving the newly imported address.  Unfortunately, while doing so it does not accept input from the GUI, report its progress, or redraw its window, which makes it look like the program has hung.  However, it should finish eventually if you don't kill it.

On my computer (laptop circa 2012 with SSD), rescanning takes 5-10 minutes.  Depending on the performance of your computer and especially your hard drive, it could take substantially longer.  I would give it at least an hour or two before assuming it is really hung.  You may also be able to see in your system's status monitor that the bitcoin-qt client is using CPU and/or doing disk I/O, which should indicate it is still working on the rescan.

As George suggests, you can disable the rescan using the rescan=false option.  However, this is usually not a good idea.  If you do so, bitcoin-qt will not know about any previous transactions on this address; in particular, if the address contains coins, bitcoin-qt will not know about this, will not update your balance to include them, and will not let you spend them.  Since the most common reason to import a private key is to claim coins that it contains, this would defeat the purpose.

If you know the address has never been used before (e.g. it is a vanity address you have just generated), then it is fine to use rescan=false, since there are no previous transactions to be found.

If you have several private keys to import, you can use rescan=false for all but the last one, to save time.  When a rescan is done, it searches for transactions for all addresses in the wallet, both old and new.  You can also force a rescan later by quitting bitcoin-qt and restarting it with the -rescan flag; again, it will appear to be hung for a while as it rescans, and the GUI window may not appear until it is done.


Is there a limit on the number of orphan transactions a node can cache? I´m asking this because a possible attack would be to send an flooding number of orphan transactions, which will never be redeemed. Then clients would have to cache them, increasing storage requirements and reducing lookup time. This can lead to a resource-exhaustion attack.

If there is a limit on the size of the cache, then a DoS can be mounted to exhaust the limit.
In both cases, a DoS attack can be mounted.

If there is no protection, adding a proof-of-work to each transaction would help to prevent such attack.

The 0.6 release includes fixes for a couple of denial-of-service vulnerabilities, including this one (see commit 142e6041).

Disconnecting peers that send "too many" orphans might be implemented in a future release.

In the future, if you find a DoS or security vulnerability in a Bitcoin implementation it is best to email the developer or developers so they know about the problem as soon as possible.


How does a miner know if a transaction has already been included in the block chain? Does he traverse through the complete chain to conclude this? I am confused on what incentive a miner has on including a transaction apart from the transaction fee. So, if adding a transaction wastes any time, any miner should ideally not add transactions that give no or very less mining fees since it is only wasting time.

Am I missing some subtle point in how this system works?

A miner checks whether all of the inputs of an incoming transaction exist in the UTXO set. If at least one doesn't, the transaction is necessarily invalid. This doesn't necessarily mean the transaction has already been included in the blockchain, it can also mean that that UTXO never existed or that it has been spend in a transaction which isn't the same as the incoming one.

A miner doesn't even have to traverse the UTXO set because there are smart things like hash maps.

A miner's main incentive to include transactions is the transaction fee. Of course, keeping Bitcoin going would also be nice but if there's money in the game, most people go for the money. This is why miners prefer to include transactions with a higher fee and why there are recommended fees for getting a transaction confirmed within a certain time frame. If you want your transaction to be included right in the next block, you should pay a fee high enough so that there are less than [1 MB - your transaction's size] of other transactions which are more profitable (more fee per storage space) than yours because 1 MB is the block size limit. If you got more time, you can choose a smaller fee because random fluctuations in the time which passes between blocks will cause there to sometimes be more and sometimes to be less competition for transactions to be included in a block and yours can make it into one when there is less competition a few hours in the future for a smaller fee.


Where can I find the miniscript policy language specification? I would like to understand how miniscript works by coding it myself. As I started studying it, I realized that miniscript is more or less a 1-for-1 abstraction of a subset of Script and that the policy language implementation would shed more light on how miniscript is beneficial.

I haven't found any specification on how the policy language to miniscript language compilation works, just what I've found here: http://bitcoin.sipa.be/miniscript/

Besides the raw code, is there a description of how the policy language compiles to miniscript?

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

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

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

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


How can I get the list of all bitcoin transactions? I am currently thinking of doing a research project on Bitcoins. I want to download the list of all transactions of bitcoins. I was wondering what are the ways to do this? I believe I can scrape, but is there a better and faster way to do this?

The list of all transactions is the blockchain. The fastest way to get the blockchain is to run a full node which will download the blockchain for you and provide ways for you to access the data stored within the blockchain.

You can use Bitcoin Core and enable the transaction index so that you can get all transaction information. The transaction index is enabled by adding txindex=1 to your bitcoin.conf file.


What happens to the original bitcoin after a wallet restore? I'm thinking of buying some bitcoins. Before I do I want to be sure that I can backup and restore my wallet - Bitcoin Core. This seemed to go ok, the bitcoin loaded into the new wallet which was on a different computer from the original.
The original bitcoin wallet still shows the old balance.

I'm sure it's unlikely, but what if someone stole my computer and I then restored my bitcoin to a new wallet - would the thief be able to spend from the original wallet after I'd done the restore?

I'm sure it's unlikely, but what if someone stole my computer and I then restored my bitcoin to a new wallet - would the thief be able to spend from the original wallet after I'd done the restore?

Yes. The two wallets 'hold' the same Bitcoin. If the thief steals your original wallet, it becomes a race to see who can spend the Bitcoin first. You have the advantage that only you know your password. (You did set a password, right? :) The thief has the advantage of surprise.

Additionally, if you generate a new address on the backup of the stolen wallet, the thief will have access to that too. This is due to the 'keypool' feature of Bitcoin. To avoid this, after your wallet is stolen, make an entirely new wallet, and transfer your Bitcoins to that. That will be safe, assuming you win the race.


Why is bitcoind removing keys from keypool? I opened my laptop which always has bitcoind running and my log is going ballistic with messages like:
2020-11-05T12:41:57Z [FullyNoded-d703055f46595edcf8163916bd906f9563afc0903fbe74c2882a93c59359ca00] keypool index 38212 removed
Why? What is it doing? Removing keys I imported? I never asked it to do that :(
RPC commands are also unresponsive as it seems to be overwhelmed.
Bitcoin Core 0.20.1

The keypool is ordered, not just a set of keys being watched. This allows for addresses to be given out in derivation order, as well as maintaining the gap limit. When an address is used, all keys that come before it will also be marked as used. This is done to ensure that already used addresses are not accidentally reused.
So when you give out and use a random address in the range, you end up having all of the previous keys in the range be marked as used.
Removing keys from the keypool is purely for giving addresses out to the user and to be able to generate further addresses. It does not effect the watching behavior; keys removed from the keypool will still be watched.
The reason that you see a performance hit is because removing from the keypool deletes a record from the database in addition to writing several scripst to the database. Furthermore, if the keypool size drops below the configured keypool size due to these removals, the keypool will be refilled which will involve additional database writes. These all acquire a lock on the wallet which prevents other threads from accessing the wallet, and writing all of this data (especially tens of thousands of keys) can take a long time.
To avoid this problem, I highly suggest giving out addresses in order, not randomly. Otherwise you may not want to add the keys to the keypool although that means that you will lose the keypool refilling to keep the range full.


Need Help with Gitian-Builder - Missing Signer Error I'm having a hard time finishing this project. I'm very frustrated and I really need your help.

I'm trying to create the QT wallet for Windows & Linux.

I have already cloned a masternode and I'm stuck dealing with this error.

I have already installed the KVM virtual machine and the LXC.

So when I tried running the gitian-build.sh, I get the missing signer error. I have read that I dont need the signer unless is wrong info.

How do I fix this problem.

Thank You.

When you run the gitian-build.sh script, you need to specify additional arguments for it to build and produce gitian signatures. You need to specify the version (or commit or branch) that you want to build. You must also specify an identifier for the GPG key that you want to use to sign the gitian output. That identifier is the signer.

For example, for me, I use the command

./gitian-build.sh -B --kvm 0.16.1 achow101

to build Linux, Windows, and MacOS binaries for 0.16.1 using kvm and signing the gitian output with the key achow101.


Wallet is encrypted and currently locked. How can I get it decrypted (unlocked) - I have my password! I have run into the problem of my wallet being encrypted and currently locked. I am using Bitcoin-Qt. I have my password to unlock it, but I can't find an area in the interface to unlock the wallet.

Where do I enter my password to unlock?

You will be asked for your password when you want to send coins.

Alternatively, you can unlock your wallet for a period of time using the walletpassphrase command in the console.


how do bitcoin nodes know about the full network partitions sometimes occur in a distributed network; when this happens, a node can only communicate to a subset of other nodes in the network and may use a different chain as the main chain; since current spec recommends a confirmation of 6 blocks, and current block generation speed is about 10 min / block, this means it is possible to invalidate a transaction if there is a network partition lasting longer than 1 hour; i was wondering how bitcoin client is implemented so that it know it is communicating with the full network and not suffering such network partition;

There are no network level controls for this, as far as I'm aware, simply because there is no real way to discover every node in the network.

Instead, partitions are likely to not last very long as the mining power will also be distributed between the partitions. This means that for a partition with only 10% of the mining power, it will take rather long to mine six blocks, while the partition with 90% of the power will quickly establish a longer chain.

There are some efforts made to given nodes varied peers. If I'm not mistaken, the BTC DNS seeds will try and return different nodes for each request, so that you don't end up with too many nodes connecting only to each other, and have a more varied peer graph.

Additionally, if there is a minor partition, it is fairly likely the the partition will reconnect soon. At that point, since one partition will almost definitely be longer, it will become the dominant chain again. If both partitions are equal, the next block after the partition will make a dominant chain appear.


How to correctly create and import a SegWit paper wallet I use Bitcoin Core to create SegWit paper wallets for friends and family.
After creating the wallet via the GUI, the steps I take are as follows:

getnewaddress  # Carry this public key back to the paper wallet
dumpprivkey *step-1-key*  # Carry this private key back
to the paper wallet

Then, using qrencode, I also print the two related QR codes.
I tried to verify the correctness of the steps, importing one of the wallets I created into Bitcoin Core, as follows:
(Make Blank Wallet > Yes)

importprivkey *step-2-key*

After waiting a while, it opens it correctly, but I see "HD key generation is disabled" (whereas at the time of creation it was enable).
Why does this happen? What am I doing wrong?

The steps you described is for a single private key, not a BIP32 wallet. If you are looking to back-up your HD seed (master key) in bitcoin-core you should use the dumpwallet command.
https://bitcoincore.org/en/doc/0.18.0/rpc/wallet/dumpwallet/


How to retrive private key from MultiBit HD 0.5.1 Have a MultiBit HD wallet that contained BCH. These were transferred to a more secure environment in 2017. Have now realized that I can sweep the Bitcoin Cash that was issued 1st of August 2017 from the Multibit HD wallet. If I did know the private key. I do have the password so I can easily unlock the wallet, but I can't seem to find how to retrieve the private key. The mnemonic seed is of course long gone so I have to rely on the wallet and the password.
In Bitcoin Core its easy to retrieve the private key, just using the console. But MultiBit HD doesn't have that feature. Any suggestions?

Good day and thanks for replying.
In my first message I made an error. It was BTC and not BCH as I wrote. I needed the private key from my the BTC (December 2016 to October 2017) in the Multibit HD wallet to retrieve the BCH (split 1st of August 2017) and the BSV (from the split 15th November 2018), also in the future to claim my BCHABC (another split on the 15th November 2020)
Multibit HD is unfortunately not so easy to handle. It was the successor of Multibit Classic and in Classic it was easy to retrieve the private key, as it is in Bitcoin Core or other similar softwares. Multibit HD not so. There is not any way you can get your private key from within the software.
I have been in contact with the owners of Multibit, Shapeshift/Keepkey. They will not assist as they claim the software is deprecated. My personal feeling is not something I would like to share, but if a company buys another company and then makes it impossible to use the software and thereby making people lose money... Well I ain't buying anything from Shapeshift/Keepkey. Ever.
However after a lot of work and some great assistance I have been able to retrieve the private key from my Multibit HD wallet and then able to claim my BCH and BSV. Will also be able claim the BCH/ABC.
The main credit is to Joseph Dushesne. His "MultiBit-HD extract private keys modification fork" really worked. It really does. I followed it to the letter and even though his suggested version of java is not available anymore the version available right now did the job. The one thing I do not recommend is the last part about using an Electron Cash wallet. I used Coinomi instead and got excellent help from Brendon Spencer at Coinomi HelpDesk.
I did send something of value of the BCH to Joseph for his work. Maybe I should have sent more.. As my private key would have been gone forever without his help.
Here is Josephs solution:
https://github.com/josephduchesne/multibit-hd/blob/develop/README.md
Follow it. It works!
Also check Coinomis:
https://coinomi.freshdesk.com/support/solutions/articles/29000026274-bch-abc-bsv-fork-information-splitting
That will work perfectly and now I am awaiting the Coinomis solution to claim BCHABC.


Why has this blockchain transaction not confirmed? ea5ee0a3734356a71b2b39deafb656715bad42fb297497f7f694d4a7a0f6335c

Is due to the fee being low 0.0001? or something else?

It depends on a (currently) unconfirmed input: https://blockchain.info/tx-index/106830375/1

There is also a warning on this input (previous output) that it is a double spend, probably due to the ongoing malleability attack.

Warning! this transaction is a double spend. You should be extremely careful when trusting any transactions to/from this sender


Charge backs on bitcoins The bitcoin page here (https://bitcoin.org/en/you-need-to-know) says that bitcoins don’t allow chargebacks.

In the current system, credit cards provide a system of checks and balances and provide arbitration when there are disputes. If I buy a item on the internet and find out that I didn’t receive the correct item, I can complain to the credit card company, and they will look at both sides and make a decision whether my dispute is correct or not. Further, when I buy an item off a eCommerce store (which is going to become more and more prevalent in the next few decades), I cant check that the item I am receiving is correct or according to what the merchant said.

If I were to use bitcoins instead, I have no way to getting my money back, if the merchant turned out to be a fraud. As a result, I will have less trust on buying items off the internet, as a result, eCommerce wont work as a result bitcoins wont work. eCommerce is definitely going to be here, so this leads me to the conclusion that bitcoins maynot work, unless there are other services that provide that arbitration service. Are there companies that are providing that arbitration (insurance against fraud) for bitcoin transactions?

Bitcoin is a currency, one which has a payment method build in. Euro is a currency, too. It has a payment method build in, too: If you give someone a Euro banknote, you're using it. But that's it in regards to built-in payment methods. The one payment method fiat currencies have built in are completely useless, online.

However, as you have noted, there are credit card companies who allow you to use the Euro (or the Dollar or whatever fiat currency) without using its built-in payment method. Similarly, additional payment methods can be developed for Bitcoin, too.

With fiat currencies, you are obligated to use an intermediary (e.g. a credit card company) if you pay someone who's not physically right in front of you. With Bitcoin, you don't have to. You may still choose to use one.

Such intermediaries have in fact been created and banks are really happy about it.

For merchants, using intermediaries is particularly interesting because it means that they can accept payments in Bitcoin easily by delegating the handling of payments to a payment processor. There already are quite a few of these.

Similarly, Bitcoin credit card companies can be created. However, using one of course reduces privacy because no one will give you a credit it you don't identify yourself. This means you lose your pseudonymity when using such a service.

However, using direct debit doesn't have to come at such cost. A payment provider can accept anonymous deposits to an account. This account can then be charged by webstores.

There really is a lot to be improved about direct debit. Banks used it for years without implementing improvements and I really hope we will see some with Bitcoin payment processors.

For example, I think you should be able to activate merchant's access to your account via direct debit. Currently, if you give someone your name, name of your bank, and your account number, they can get money from you. In most countries, you have a short period to notice an unauthorized withdrawal and can get your money back but if you don't notice it fast enough, you lost that money.

If you'd see a notice that some new merchant wants to retrieve 141 mBTC from your account and have 24 hours to accept that merchant only once or add it to your list of permanently trusted merchants or to decline it instantly (which would happen after those 24 hours, anyways), that'd be much better than it currently is with banks where basically everyone is a trusted merchant, no matter whether you ever even bought something from them.

Furthermore, you probably only use one bank account and give every merchant the same bank information to withdraw money from that account via direct debit. Any one of them can give your bank information to someone who withdraws money from it without your consent and you have no way of finding out which merchant you ever bought something from via direct debit is the culprit. You can't create a lot of different account numbers for the same account. However, if an ID different from the account number was used and you only ever use one ID per merchant, it'd be really easy to find the culprit. You would see in your payment processor's web interface that you gave the ID coinbase.com:Rd3pG82U to that weird shop you found 3 month ago and bought something from. Btw.: The ID Rd3pG82U is only 8 characters long, far shorter than account number + name of the account holder + bank code. In fact, it's shorter than any one of them. If IBAN + BIC it's used, it doesn't exactly look better for banks. But those 8 characters are base 58, enough for 128'063'081'718'016 IDs. Or 17'075 ID for every single of the 7.5 billion people currently alive, at a single payment processor alone. With 2 characters being used for redundancy so typing errors are caught, 38'068'692'544 IDs fit into the remaining 6 characters. And if those run out for a single payment processor, a digit can be added and you got 59 times as many IDs as before. Btw.: The 2 check digits are far better than what IBAN has and BIC doesn't have any.


Generating an address from a private key in Java? I'd like to write a function in Java that takes a private key and generates the address to use in a QR code. I'd like to make this , but I'm not very good with the hashing algorithms.

I've checked with https://www.bitaddress.org and what is generated on there is not the same as what I'm getting in my program.

Can anyone help me with this? Google has failed me

Don't reinvent the wheel, use an existing library. bitcoinj for instance provides the method getPubKeyHash of the class ECKey which does what you are looking for.

Edit: getPubKeyHash does not return the human readable address directly, but can be used to create an instance of the class Address. This (as a subclass of VersionedChecksummedBytes) has in turn the method toString which presents the hash as bitcoin address.


Pegged transfer from private blockchain to sidechains - Issue I am trying to do a pegged transfer from one of my private blockchain to a sidechains using sidechain-manipulation.py (https://github.com/ElementsProject/elements/blob/alpha/contrib/sidechain-manipulation.py)

I did a successful address creation and send-to-sidechain after doing necesary modifications on Sidechain chainparams(presently configured only for main and testnet)

While I try to claim in the sidechain I get the following error

Traceback (most recent call last):
  File "./contrib/sidechain-manipulation.py", line 176, in <module>
    txid = sidechain.sendrawtransaction(res_tx)
  File "/usr/local/lib/python2.7/dist-packages/bitcoinrpc/authproxy.py", line 140, in __call__
    raise JSONRPCException(response['error'])
JSONRPCException: -26: 16: mandatory-script-verify-flag-failed (Script failed an OP_CHECKSIGVERIFY operation)

Got the following error from an RPC Call:
{u'message': u'16: mandatory-script-verify-flag-failed (Script failed an OP_CHECKSIGVERIFY operation)', u'code': -26}

I see the following lines in claim-on-sidechains sidechain-manipulation.py,

    # Might need to calculate the scriptSig here
    secondScriptSig = "1"

My question is, what is this secondScriptSig ?!?! How does it relate to withdrawKeys?

The secondScriptSig is a script in each transfer transaction which satisfies the chain-global secondScriptPubKey. The secondScriptPubKey is intended to allow, in a flexible way, each chain to define its own additional terms. For example, a chain may restrict transfers to only be allowed if they are co-signed by a multisig federation (in the full federated peg mode), or restrict the total value which may be pulled out of a sidechain in individual transfers. In alpha, it is effectively unused - hence the secondScriptSig simply being the constant script "OP_TRUE".


Why is reusing bitcoin private keys frowned upon? So far I've understood that reusing a private key to send out from is not good due to exposing your privacy.

I know reusing keys are frowned upon, but I never really understood why. Aside from the privacy aspect, what other issues should I factor in due to key reuse?

Each private key is tied to an address.  A private key is used to generate a corresponding public key, and that public key is used to generate an address.  Due to Bitcoin's support of both compressed and uncompressed public key formats, each private key can actually generate two different addresses (however, you should really view these as the same address, since they are just different encodings of the same keypair).

Private key reuse is the same thing as address reuse, and thus comes with all the privacy implications that go along with address reuse.  Someone watching the blockchain will be able to associate your addresses with other addresses, and then be able to use 3rd party data sources to gain insights into how you obtain and spend your money.

The other issue is the potential for future cryptographic vulnerabilities.  When you spend money from an address, you are publicly revealing the public key part of the keypair.  This public key can easily be converted into either its compressed or uncompressed form (depending on which it is), and the other address it generates can now be associated as well.  It also opens up the possibility that someone can attempt to derive the private key from the public key.  While there are no known attacks on the secp256k1 elliptic curve cipher that Bitcoin uses, addresses still provide a level of protection even if a vulnerability is found.  Addresses are generated from cryptographic hashes of the public key (with some checksumming added to prevent typos when spending), and therefore it's impossible to obtain even the public key of the keypair from an address.  Once you spend from that address, and reveal the public key, you no longer care if someone cracks that key.  You won't be using it again.

There is also the case of simplicity.  Addresses are very easy to generate, and we are in no danger of "running out".  I would argue that a system that reuses addresses may find itself being more complicated than a system that simply generates and stores a new one when needed.  Deterministic wallets have made this even more simple, where a single seed value can be used to restore an entire wallet worth of private keys.


How can I programmatically use several different (isolated) wallets? I want to use several different wallets (as if one wallet = one account), and want to make sure the spending and receiving activities are exclusive to one wallet at a time.

How can I interface with multiple wallets?  (through a program or script)
How can I access multiple wallets at the same time?

Currently bitcoind is designed to only run one wallet at a time.  You would have to run multiple daemons on different ports and connect to each separately.

That said, it looks like multiple wallet support is being actively developed and will be available possibly in 0.9, based on this pull request.


Will Bitcoin remember unperformed transactions? Let's say I transfer 0.05 BTC from 1 input to 1 output and don't pay a fee. If there are 6 blocks per hour, this means that my input has to be 369 hours (about 15 days) old so no fee is required. Let's also assume that the input only is 1 hour old. Does this mean that it will never be confirmed or does it mean that the money will arrive after a little more than 15 days?

First of all: there's no guarantee that it will be free after 15 days. Some miners used to have a policy that made spending old coins potentially free. But miners can change those policies and will likely go for highest fee first, as that earns them the most money. If the network is busy that means there will be hardly any free transactions going in.

Second: most nodes on the network keep transactions in the memory pool for a while. But again, the exactly policies can be different for every node. I think 3 days is a common setting. But when the network is busy, 0 fee transactions are more likely to be dropped from the mempool than paying transactions.

Third: once you've broadcast the transaction, theoretically anyone that ever saw that transaction could re-introduce it to the network at any time. Even weeks or months later. For example the receiver of such transaction might keep trying to get it through. So there's never really a guarantee to you that a transaction has "timed out". The only way to be sure is to make a new transaction spending the same coin to another address (and then include a fee).


Can a Bitcoin (secp256k1) key be converted to a Ed25519 (Tor v3) key? If I have secp256k1 keypair that is widely known, like a Bitcoin address, can I convert that into a Ed25519 key pair such that someone could access a .onion address in a deterministic way?

The bitcoin key could sign a message containing the onion address. There are several other alternatives but there isn't any way to do this without the key holder producing a message of some kind.


Activation of SegWit v1 The segregated witness soft fork of August 2017 included a versioning field which would allow for future incrementation. Anthony Towns has recently posted an early draft of the proposal for the SegWit v1 upgrade to the mailing list.

Although the devil is of course in the details, what activation methods are available for future softforks?
What are the different upgrade mechanism for the major [v1 - v16] and
minor [v1.0 - v1.127] version changes?
How is the soft fork signaled, taking the overt ASIC Boost with version bits into account?
How is the consensus change enforced?
Is the v1 change as "contentious" and time consuming as v0 was?
What are the tasks of node operators and miners?

Thank you in advance for the answer!

Although the devil is of course in the details, how could such an upgrade process look like? and What are the different upgrade mechanism for the major [v1 - v16] and minor [v1.0 - v1.127] version changes?

As Pieter Wuille mentioned in the comments, "There isn't even a proposal. Discussion about activation and all its implications is something to be had after there is a worked-out idea, implementation, and clear buy-in from the community. You could formulate the question generically as "What activation methods are available for future softforks?", but nobody can answer this question for something that doesn't exist"

How is the soft fork signaled?

Initially, soft forks used to be signalled with the block version number, but due to its many limitations BIP-9 (read full documentation here) is used. In BIP-9, the block version number is interpreted as bit field instead of an integer (we currently have 29 bits where we can signal this). BIP-9 also sets a maximum time for signaling and activation. This way miners don’t need to signal forever. If a proposal is not activated within the TIMEOUT period (defined in the proposal), the proposal is considered rejected. The proposal may be resubmitted for signaling with a different bit, renewing the activation period.

How is the consensus change enforced?

BIP-9 counts activation signaling in whole intervals based on the difficulty retarget period of 2016 blocks. For every retarget period, if the sum of blocks signaling for a proposal exceeds 95% (1916 of 2016), the proposal will be activated one retarget period later. Proposals start in the DEFINED state, once their parameters are known (defined) in the bitcoin software. For blocks with Median Time Past (MTP) after the start time, the proposal state transitions to STARTED. If the voting threshold is exceeded within a retarget period and the timeout has not been exceeded, the proposal state transitions to LOCKED_IN. One retarget period later, the proposal becomes ACTIVE. Proposals remain in the ACTIVE state perpetually once they reach that state. If the timeout elapses before the voting threshold has been reached, the proposal state changes to FAILED, indicating a rejected proposal. FAILED proposals remain in that state perpetually. Below is a diagram from Mastering Bitcoin book.

Is the v1 change as "contentious" and time consuming as v0 was?

Again, there isn't even a proper proposal out there.

What are the tasks of node operators and miners?

Miners cast their voting power on the different proposals by mining the block with the particular bit in the block version number. Full nodes, will decide whether they want to treat these blocks as valid or not and whether they should propagate those blocks to the entire network.


bitcoin compile (.undefined reference to **') I'm getting error after make command like,

undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'

and in last

Makefile:774: recipe for target 'all-recursive' failed

make: **[all-recursive] Error 1

I have followed all steps given here:-

https://www.toshblocks.com/bitcoin/compile-bitcoin-source-code-ubuntu-16-04-lts/

Output :-

 Making all in src
    make[1]: Entering directory '/home/khushbu/bitcoin/src'
    make[2]: Entering directory '/home/khushbu/bitcoin/src'
    make[3]: Entering directory '/home/khushbu/bitcoin'
    make[3]: Leaving directory '/home/khushbu/bitcoin'
      CXXLD    bitcoind
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `generateBlocks(std::shared_ptr<CReserveScript>, int, unsigned long, bool)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:122: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:128: undefined reference to `IncrementExtraNonce(CBlock*, CBlockIndex const*, unsigned int&)'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getmininginfo(JSONRPCRequest const&)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:216: undefined reference to `nLastBlockWeight'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:217: undefined reference to `nLastBlockTx'
    libbitcoin_server.a(libbitcoin_server_a-mining.o): In function `getblocktemplate(JSONRPCRequest const&)':
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:521: undefined reference to `BlockAssembler::CreateNewBlock(CScript const&, bool)'
    /home/khushbu/bitcoin/src/rpc/mining.cpp:533: undefined reference to `UpdateTime(CBlockHeader*, Consensus::Params const&, CBlockIndex const*)'
    collect2: error: ld returned 1 exit status
    Makefile:3888: recipe for target 'bitcoind' failed
    make[2]: *** [bitcoind] Error 1
    make[2]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:10190: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/khushbu/bitcoin/src'
    Makefile:774: recipe for target 'all-recursive' failed
    make: *** [all-recursive] Error 1

How to solve this error and compile bitcoin source code successfully?

It looks like you're having linker errors, possibly due to the way you're installing and configuring the BerkeleyDB. It would help to post the output of the ./configure command. Bitcoin-core recommends installing it using the Bitcoin PPA:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev

Then you don't have to run ./configure with the LDFLAGS andCPPFLAGS for BerkeleyDB.

I would recommend following the UNIX build instructions in the repository. First download the source code for the release you want from the repository releases.

$ tar xvzf v0.17.0.tar.gz && cd v0.17.0

Then follow the instructions in the link above.


How does bitcoind store blocks? I want to parse blockchain manually and extract the UTXO set (for various reasons). Is there any way to understand how the blocks are stored without going through the C++ code?

Some specs will be great.

There is a lot of information available, just not consolidated. After searching for sometime, I found the best answer from this link.

The format of each file is:

4 bytes: Magic bytes
4 bytes: Encodes size N of next upcoming block.
N bytes: Block encoded in standard format (with header)
--
above repeats

Quotes from the original link:

4 | 4 | 80 | TxData | 4 | 4 | 80 | TxData | 4 | 4 | 80 | TxData | ...

First 4 bytes: magic bytes (identifying which network you are on)
Second 4 bytes: the number of bytes of the remaining block
Next 80 bytes: block header itself
Next NumBlockBytes - 80 bytes: Transaction data in this block [ numTx | Tx1 | Tx2 | Tx3 | ... ]

What I don't understand is why are the magic bytes repeated? We could very well have used:

4 | 4 | 80 | TxData | 4 | 80 | TxData | 4 | 80 | TxData | ...


Which server(s) determine the difficulty and issue coins I understand that the blockchain is a decentralized database, however what I don't understand is who runs the bitcoin software. Is this also decentralized? There has to be some form of "backend" to run the checks and balances?

Being a decentralised consensus, with all nodes aware of all the rules and all acting in lock step, there needs to be no centralised controller for anything. Every participant using Bitcoin is responsible for coming to their own conclusion about the state of the network, making sure every piece of data is correctly formed and executed according to the consensus rules they are aware of. Should everything be working correctly, the state they come to will match that of their peers without ever having to consult an authority.


How do Bitcoin balances work when an address is controlled by multiple parties together? user1, pubkey1, 1.1 BTC
user2, pubkey2, 1.2 BTC
user3, pubkey3, 1.3 BTC
user4, pubkey4, 1.4 BTC

user4 sends 0.4 BTC to a 2-of-3 multi-sig account controlled by user1, user2 and user3 using P2SH.
The transaction is successful.
What is the account balance for user1, user2 and user3?

Bitcoin balances conceptually are not like bank account balances, but more akin to banknotes: uniquely identifiable, good for a specific amount, and can only be spent in full. The "account balance" shown by your wallet is simply the sum of funds that the wallet knows how to spend. In the case of your multisig example, if user1, user2, and user3 each have their own wallet but each wallet keeps tracks of the multisig unspent transaction output (utxo) as its own, they would each see it as part of their balance.
Basically, it's up to the users to decide how to interpret the spendability of their shared funds. The network would enforce that they would only be able to spend the UTXO once in total, though. Alternatively, it's possible that they share one "watch-only" wallet to track the balance, but each hold their own separate key. In that case this shared watch-only wallet would track the balance only once, but they'd each hold their own key independently.
So, concretely, the users' balances after the transaction from user4 would be:
user1, pubkey1, 1.1 BTC
user2, pubkey2, 1.2 BTC
user3, pubkey3, 1.3 BTC
user4, pubkey4, 1.0 BTC
{user1,user2,user3}, 2-of-{pk1,pk2,pk3}, 0.4 BTC

Where the last UTXO is controlled by the multi-party address as described and has different spending properties than the individual balances of the the users.


How to calculate bitcoins in fees spent dailly? (Avg) From https://bitcoinfees.earn.com/ I can see a list of bitcoin satoshi fees/byte

From https://thenextweb.com/hardfork/2018/07/12/bitcoin-block-size/ I can see that we can have block sizes of up to 2mb with segwit.

If I assume that segwit adoption increases in the next year, then I will base all calculations on the block size being ~2mb.

How do I back-of-envelope calculate total fees in bitcoin spent daily?

Assuming 6 blocks / hour, & with 24 hours in a day, is it:

~satoshiFee * 2m * 6 * 24

Which, assuming an average satoshi fee of 10 (using https://bitcoinfees.info/)

Gives:

10 * 2m * 6 * 24

And in BTC that's divided by 10^8, so we'd get:

20m * 144 / 10^8 = 28.8

Is that correct?

Yes that look correct.

From https://bitcoinfees.info/, the current average fee rate listed at the bottom of the chart is 24 satoshis/byte. To calculate the total fees in a day you want fee rate * total bytes = total satoshis.

Assuming 2MB block size,

fee rate = 24 satoshis/byte
total bytes = 2MB * 6 * 24 = 288MB

total btc = total satoshis / 1e8
total btc = (24 * 288M) / 1e8 = 69.12 BTC


Bitcoin block headers download i need all block headers hash (about 500k records), i tried to get from electrum wallet files, but when i convert the file to Ascii, it doesn't have full list. please help.

It seems that since v3.1.0, Electrum does not download any more the complete blockchain_headers, but only the pieces it needs to track transactions. And installing a previous version doesn't seem to work either.

So the more direct approach is probably to download the hashes from a web like https://blockchair.com/bitcoin/blocks.

It is limited to 1 million cells for free, but as you only need "Hash" column, just:

deselect all checkboxes but "Hash", and click on "Export" selecting then "csv". Open this file with your spreadsheet app.
If you need another column, repeat the step but just with it, and Export again to a (2) file.
Open the file from (2), copy the column, and paste it next to the first column in file from (1).
as the results are both ordered by time, rows coincide and you already have the desired data!

PS: As for Electrum, it is need to install a previous version below v3. With a version 2.6.4 it seems to work and produce a complete blockchain_headers file. There's a Python script to convert it to a .csv file.


Exporting private key from expired bitcoin address (now showing as watch-only) Is there a way, in theory, to export private key from the bitcoin address (watch-only) that is now expired, but used once before? (even to get a different format of that key, numeric one instead of QR code used in the first place?). If everything is traceable, out of curiosity - has anyone ever managed to actually do this?

It is not possible to compute the private key for an address, ever, unless there are severe bugs in the wallet that holds the key.

Also addresses don't expire. For privacy reasons it is bad to reuse them, but their security does not depend on this.

In addition the "now showing as watch-only" in your question seems confused. Addresses don't become watch-only by being used; if it's watch-only it's because it has always been watch-only.


How do SPV get their transactions after being offline? SPV nodes rely on their peers to send them transaction data that is relevant to them. When an SPV node sets up a bloom filter with one of their full node peers, doesn't that only tell the full node which transactions to send the SPV node from now on?

How do SPV nodes catch up after being offline? Which p2p calls can they use to get their transaction info from their peers?

Block fetching requests are also filtered, so the client requests every single block they missed out on seeing since the last time they were last online, sequentially. The client downloads all block headers from genesis up to the current head using getheaders, sets a filter on their peer with filterload, and then downloads filtered blocks with getdata until they are in sync with the network. filteradd may be used in deterministic wallets to extend the filter to include more keys as used ones are discovered in their scan. When they are in sync, they will only receive new inventory that matches the filter.


Purpose of token standard interfaces when implement smart contract I am studying to write smart contract and see that there are some token standards such as ERC20. My question is: what is the purpose of those standards ? Why do we need to add those interface to our code rather than just implement "some" functions that we need.

Thanks

It's a standard.

ALL those ERC20 based tokens have (at least) the same attribute names, the same method names.

So I do automaticly know that I need to call the method "transfer" when I want to transfer my tokens. No one would name it "transfer_tokens_hello_world". Irrelevant which of the thousands of token I want to transfer: It's always the same method.

The advantage for exchanges and/or user interfaces is that it's really easy to implement. If an exchange list token A and B, then token C has the same structure and it's easy to implement it, too.


Transaction fails to validate (Error running script) I've created a transaction on the TESTNET and am trying to push it via BlockCyphers facility at:

https://live.blockcypher.com/btc-testnet/pushtx/

when I make the attempt, I get the following error:

  Error validating transaction: Error running script for input 0
  referencing
  261190892daa2c9aaaf25c20624f7f2941d2ad58dec883b0c929d1fa9306fd57 at 0:
  Script was NOT verified successfully..

here's the transaction.  I don't see what the matter with it is and not sure I understand the error.  can anyone help?

{
    "addresses": [
        "mjGtZWXgPdbLUZYWtDqVTfbFieVzXFfSEj",
        "2N7nSZjfqikj4oVkCqaLB3CNMY3TA72PbNY",
        "msp7depXvcjLqykZxYVrWNG9QgKqLWWKEN"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "double_spend": false,
    "fees": 12375,
    "hash": "463372d7a8f456c882179635aabbeca4146396b1f81c05699a2e885e3f84d6e6",
    "inputs": [
        {
            "addresses": [
                "mjGtZWXgPdbLUZYWtDqVTfbFieVzXFfSEj"
            ],
            "age": 1657999,
            "output_index": 0,
            "output_value": 5000000,
            "prev_hash": "261190892daa2c9aaaf25c20624f7f2941d2ad58dec883b0c929d1fa9306fd57",
            "script": "48304502210093b8ff9180a8a31a5ee7b0fb6c560aef888a3d53576e530cb4601dce2d3c51da02204fd8a28743f1d1100a2f56428e743501091e833550df6cf540bad4f5248a6d3c012102d794c7e1a8068782ef6ee68acf9f6ad9c84c78349671c1a7bf60418a8e1ed108",
            "script_type": "pay-to-pubkey-hash",
            "sequence": 4294967295
        }
    ],
    "outputs": [
        {
            "addresses": [
                "2N7nSZjfqikj4oVkCqaLB3CNMY3TA72PbNY"
            ],
            "script": "a9149f792783320ffb5a4f3ee4c69525d4932ac0497087",
            "script_type": "pay-to-script-hash",
            "value": 500
        },
        {
            "addresses": [
                "msp7depXvcjLqykZxYVrWNG9QgKqLWWKEN"
            ],
            "script": "76a91486e0602ab38efd1811ff4db76f7d58c717c8598888ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 4987125
        }
    ],
    "preference": "high",
    "received": "2020-01-10T05:09:49.945289619Z",
    "relayed_by": "54.197.194.161",
    "size": 224,
    "total": 4987625,
    "ver": 2,
    "vin_sz": 1,
    "vout_sz": 2
}

- Addendum I -

to help narrow down the solution, here's the code I'm using to produce the transaction:
I first produce an address where to receive some coin:

const btc = require('bitcoinjs-lib');
const bip39 = require('bip39');
const bip32 = require('bip32');

var mnem = 'my-12-word-bip39-seed-phrase'
var root = = bip32.fromSeed(
  bip39.mnemonicToSeedSync(mnem), bitcoin.networks.testnet
);
var p = "m/44'/1'/0'/0/0"
var pubkey = root.derivePath(p).publicKey;
var {address} = btc.payments.p2pkh({pubkey, network: btc.networks.testnet});
console.log(address);

which yields mjGtZWXgPdbLUZYWtDqVTfbFieVzXFfSEj.  I then send some coin to that address and attempt to create my transaction:

const CS = require('coinselect');
var feeRate = 55;
var env = 'test3'
var src = 'mjGtZWXgPdbLUZYWtDqVTfbFieVzXFfSEj'
var url = `https://api.blockcypher.com/v1/btc/${env}/addrs/${src}?unspendOnly=true`;
var o = await fetch(url).then(res => res.json());
var utxos = o.txrefs.map(o => ({
    txId: o.tx_hash,
    vout: parseInt(o.tx_output_n),
    value: parseInt(o.value)
}));
var targets = [{address: '2N7nSZjfqikj4oVkCqaLB3CNMY3TA72PbNY', value: 500}];
var {inputs, outputs, fee} = CS(utxos, targets, feeRate);
if (ret.outputs) ret.outputs.forEach(o => {
    if (!o.address) o.address = 'msp7depXvcjLqykZxYVrWNG9QgKqLWWKEN';
})

// builds the transaction
var tx = new btc.TransactionBuilder(btc.networks.testnet);
inputs.forEach(o => tx.addInput(o.txId, o.vout));
outputs.forEach(o => tx.addOutput(o.address, o.value));
tx.sign(0, root);
console.log(tx.build().toHex());

from which I get a numerical string that converts to the above transaction.  as can be seen, I'm using the same root to sign the transaction that was used to create the source address

You have the wrong public key inside your SignatureScript:

Sig: 48-304502210093b8ff9180a8a31a5ee7b0fb6c560aef888a3d53576e530cb4601dce2d3c51da02204fd8a28743f1d1100a2f56428e743501091e833550df6cf540bad4f5248a6d3c-01
pubkey: 21-02d794c7e1a8068782ef6ee68acf9f6ad9c84c78349671c1a7bf60418a8e1ed108

The outpoint you are spending (2611[...]fd57:0) has the following PubkeyScript:

76-a9-14-2937902660c169b9381a5b3eb35cc889a4686a85-88-ac

When the script runs it fails on 0x88 (or OP_EqualVerify) because HASH160 of the given public key (02d7[...]d108) is e652ed9163ac72629584ec92f47602cca45aa969


Do miners validate each other's blocks? I understand that to mine a block, miners solve a cryptographic problem and the solution can be easily verified by other nodes on the network, appending the new block to their blockchain.

But why do miners consent that some other miner managed to mine a valid block before them?
Why don't they claim that some other miner's block is invalid even if it actually isn't, and buy time to mine one themselves?
Is it because all non-miners will validate anyway and miners don't want to risk having a discarded chain?

Mining is a random, progress-free process. Miners are essentially attempting to find a partial pre-image of a hash. Each new (valid) block candidate has exactly the same minuscule chance of yielding a new block. This means that finding a block for the next height is just as likely as finding a block that competes with the current chain-tip.
However, finding the next block is a lot more profitable: the current chain-tip has already been relayed to a large part of the network and all other miners are trying to find it's successor. Mining has a real cost, and only blocks that end up being a part of the best chain get paid out. To successfully compete with the current chain-tip, the miner would have to first find that competing block and then another to make it part of the best chain. It doesn't make sense for a single miner to try to find two blocks while all remaining miners together only need to find one more block to thwart him. Rather, the miner will spend a fraction of a second to validate the current chain-tip and try to find the next block.
There are two exception to the above behavior: Firstly, when a miner controls a significant portion of the total hashrate, they can theoretically attempt to increase their revenue disproportionately by starting to mine on new found blocks before publishing them, gambling on finding two blocks before the remaining network does. This attack is referred to asselfish-mining. Secondly, when a miner controls at least half of all mining power, they can maintain a monopoly on creating blocks by ignoring all foreign blocks and outhashing all other mining power in a so-called majority-attack. This is a popularly discussed failure scenario for Bitcoin and would likely undermine trust in Bitcoin altogether.


What mining parameters are not modifiable with ASIC miners? When ASIC mining devices ship, what parameters of mining become hardcoded? How would these ASIC mining devices respond to any changes to mining procedure / algorithms?

Very little of transaction validation logic is done in the ASIC. All that they do is take a block header, rapidly increment the nonce, and see if the hash that pops out is anywhere close to the target. So, as long as the block header doesn't change, none of the ASICs need to change.
Nonce
The 4-byte nonce field might need to change in the near future, because you can only have 4 billion distinct hashes every second. That might seem like a lot, but with ASICs getting 100Ghash/s, it gets a bit awkward. One way around it is to make 25 different coinbase transactions, thus getting you 25 different block headers. You then give each twenty-fifth of the ASIC a different block header. Despite all this, lengthening the nonce field is probably more trouble than it's worth, given that it would require a hard fork.


How can I mine a specific block? How can I set my miner to mine a specific block?
like:   Block: 496705

I have tried looking in ccminer options for that it looks like there is no option like that.

Mining software generally do not work like that. They don't have any idea of what is in the Bitcoin blockchain nor know how to construct a block (i.e. selecting transactions). Rather these mining software must connect to a server that will give it the pieces for the next block that the server wants the mining hardware to solve. So in order to mine at a specific block height, you must connect to and configure a server which provides the block data for the block that you want.

The easiest way to do this would be to use Bitcoin Core and reset its blockchain at a certain block height. To do so, you would use the invalidateblock command so that the blockchain's tip is the block prior to the height that you want to mine at. Then just point your mining software at Bitcoin Core and it will work on mining that next block which you want.


Testing blockchain forks I want to test if a service can manage a blockchain fork. However there is no way to get bitcoind to create test forks under the regtest mode. I've tried modifying it to generate blocks with arbitrary prevblock hashes but it is not easy due to the high code complexity. I've managed to get it to create forks on-top of earlier blocks, however, I can't get it to generate blocks for conflicting transactions (double-spends and malleability changes), largely due to all of the "pruning" code. Surely someone has already come up with a solution, as this is a vital thing to test? I can't find anything on-line to help with testing fork scenarios.

I'm thinking that perhaps I should have used another technique? That I should have run 3 bitcoind regtest nodes and isolate them so that I can create multiple blockchains. 2 of them generate competing chains, and the other interfaces with the application. I can generate a fork scenario with the first two nodes, sync one of the nodes to the 3rd node and then sync the other node to generate the fork? I'd need to use a combination of addnode and tcpkill (?) to sync and then re-isolate the nodes.

This seems a ridiculous thing to do to test something so simple, so is there a better way?

You can use the invalidateblock RPC commands to create blockchain forks.

invalidateblock hash tells a node to consider hash invalid, so just generate a bunch of blocks, invalidate one somewhere down the chain on one of the regtest nodes, and have that node generate a bunch more to create a fork.

See qa/rpc-tests/mempool_resurrect_test.py in the Bitcoin Core tree for a python example.


turn OFF coin generation I just recently upgraded from Bitcoin client 0.3.? to 0.6.1-beta for Mac.

In the old version I had the option of generating coins; I don't see that option here.  Activity Monitor shows Bitcoin-Qt consistently using >95% CPU.  As I understand it, CPU mining is essentially useless, so I'd like to turn it off, but still have the option to receive coins if I'm paid by someone.

Is this possible?

As far as I know the option is off by default in the new versions. To make sure you can add a line

gen=0

to your bitcoin.conf file.


What happens when a node goes offline for a while? Let's imaging a full node goes offline for a month, so they're missing ~4300 blocks (just using 10min/blk).

Are there any message exchanges that receive transactions to help sync the 'booting' node with the other peer node's mempools? (I.e. compensate for having a empty tx mempool)
Approx. how long it take (presume the 4300 missing block ex.) to receive the missing blocks?
What is happening during this time if the node is receiving propagated transactions? Or even a newly solved block?

Thanks!

Full nodes are always in a perpetual state of "catching up to the network".  This is true if they are just booting up for the first time, have been down for a month, or have been running since the network began.  Nothing is fundamentally different about their operation.

The amount of time a node will take to catch up is determined mostly by a) how many blocks/transactions it still needs to verify, and b) how fast the node is at verifying blocks/transactions.  To a lesser extent, it is also determined by network speed (how fast it can receive blocks/transactions), but the bottleneck is usually the computational power of the node.


Is there a lightningd equivalent to bitcoind's -walletnotify or -blocknotify? I'm looking at the docs, and I see they have lightning-notifications, but it looks like you can't configure where they go, and you can't trigger a shell script with them. Does this mean I have to have all notifications sent to a shell script and filter them, or is there a method/configuration I'm overlooking?

You can trigger a shell script with them, and more.
This is related to the plugin functionalities provided by lightningd and not bitcoind.
lightningd allows you to run plugins to deeply modify its behaviour, or extend its possibilities. It idiomatically (small and robust core, customizable functionalities) relies a lot on them and therefore directed the event mechanisms toward them as well.
This is the reason why you don't see [*]notify= startup options for lightningd.
To use lightningd's notifications you have to write a plugin, but it can be a pretty simple script. For example, here is the handler of the invoice_payment notification in the HelloWorld showcase plugin:
@plugin.subscribe("invoice_payment")
def on_payment(plugin, invoice_payment, **kwargs):
    plugin.log("Received invoice_payment event for label {label}, preimage {preimage},"
               " and amount of {msat}".format(**invoice_payment))

The previous example used the Python library, but the communication is pretty straightforward (JSONRPC 2.0) so you can technically use a shell script :-).
For reference, there is an available and curated list of community plugins.


The fee is calculated from the difference between vin and vout. Here you are sending a very small amount to an addresses but you have not specified an output to receive the change. The client sees this change as the fee which is probably very large.

You need to create a separate vout to send the change from the transaction, leaving a small amount for the fee.


mac bitcoin wallet question. Private keys? I don't understand the bitcoin-qt program (mac). Why doesn't it show the private keys for the addresses I've created? Also, why doesn't it let me delete the new addresses?

Say I want to send money from account X on my mac from my windows computer. How would one do that?

Your wallet program doesn't show the private keys because you usually don't need to see them.  In the same way that you almost never see your password to any website you use.  If it did show them then someone could take a photograph of them and later spend the content of your wallet.

It probably doesn't let you delete addresses because of the potential for harm.  If you ever gave that address to somebody and they some day transfer coins to the address, you'll wish you hadn't deleted it.  If you send someone an address and they use it to pay you, and then you think "that transaction's completed, I'll delete the address now", you'll lose the coins that were sent to you because they're still sitting in that address.  There's too much risk of people not understanding the system and losing coins as a result.

To send money from one computer to another:

first go to the computer that's going to receive the money, run the wallet program, go to the 'receive coins' tab, pick any of the addresses that are shown, optionally edit the 'label' field to make a note of who you're going to give it to.  In this case "My Mac" might be a good label.  Then copy the address to the clipboard and email it to yourself at the Mac.  Or write it down if you like.
then go to the Mac, run the wallet program, go to the 'send coins' tab, put the address from the previous step in the 'pay to' field, and the amount in the 'amount' field.  Optionally put a label in the 'label' field.  "My PC" might be a good label for this.  Click "Send".

I just noticed you want to send from a specific account on the Mac.  Do you mean you want to send from a specific address?  That's not yet supported in the standard client.  A patch has been submitted that adds this feature.  There's a description and video going into more detail.

Edit: it occurs to me that you really to mean "account" in your question.  Don't confuse accounts with addresses.  You don't need to send from a specific address to send from a particular account.  There's no support for accounts in the bitcoin-qt client though I don't think.

The upcoming 0.6.0 version of the Satoshi client adds a command to export an address' private key, so if you want to print it out and keep it somewhere safe you could use that.  But typically people just make sure they have a copy of their whole wallet.dat file instead.


Search xPub address on a full node I am running a full node & using bitcoinABE to run a block explorer.
I have couple of wallets on 3rd party wallet providers where I can do xPub

Similar to blockchain.info xPub search how do I do it on my block explorer, or could anyone explain how xPub search works ?

After understanding what extended/extensible public addresses(xPub) are I found out that I need to generate addresses of an xpub then search the individual addresses tx


How do I join a NXT mining forging pool? And how do I register for payouts from the pool? I found the following pool: http://pool.nxtcrypto.org/howto.html

But I'm a bit unclear on these instructions:

  To claim your earnings, simply send an AM (can be empty or put
  whatever you want in there) to the pool account 1460178482 and after
  this AM has 1440 comfirmations, your confirmed earnings will be sent
  to you, minus NXT transfer fee.

What do they mean by "simply send an AM"? What is AM?

On the lease nxt page, it says I can attach a message. Do I just attach it during the lease transaction? Or do I have to send a separate empty message to the pool account after sending the leased funds?

I was confused by this as well, but I figured it out through trial and error. AM means arbitrary message (they should have explained this), which is a regular message you send to the forging pool through your wallet.

First you must join the forging pool (Account Balance -> More Info -> Account Leasing). No additional message is necessary at this point.

After leasing your balance to this pool for some length of time (I waited a few weeks), you will have earned NXT from the pool's forging. When you want to collect your NXT, this is when you send the "AM" (I have found that until you send this message, you will not receive a payment).

In your NXT wallet:

Click on Messages (left navigation bar)
Click Send Message (top right tool bar)
Enter the forging pool address for Recipient (e.g. NXT-K5KL-23DJ-3XLK-22222)
Write anything for the message
Uncheck the Encrypt Message box (I did this, not sure if this is necessary)
Click Send

After your message receives 1440 confirmations (this takes a while), you will receive your share of pool earnings in your wallet from the forging pool. You need to send a new message each time you want to collect your earnings.


How to Build Block Header in stratum? When I studied the stratum on here,I found that there were little difference between the stratum and solo mining for building block header.

The stratum tell us that we needed to pad the header to uint512.

'000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000'

The bits is different to the algorithm of sha256's padding.

But when I practiced the example which solved testnet3 block,I couldn't use the information to calculate the hash until I discarded the padding.

In real-work,whether I need to pad or not?

By the way,the previous hash provided from  notification is not correct,you need to find it on there.

You do not need append padding, this step already implemented under the hood in the cryptographic library function sha256. As I remember, when I solve the same task and read this doc from stratum pool a few inconsistencies in the documentation that had to be solved empirically.

One of the nuances on which note that miners software do not know anything about the segwit and coinbase transaction for the miner job should be represented in the old format.


Issue transaction without being online Is there some way in which User A who could load a transaction onto the block chain and if some other User B who is willing to pay User A, without User A being online could release the loaded transaction. Something like  a smart contract ?

Lets say if A and B wants to exchange some bitcoin transactions between each other. But they
both dont know each other before. A list his address some where and when B sees it, B will
issue a bitcoin transaction to A.

A might not be online when B has issued this transaction. But B should receive back a
transaction from A, if B has payed to A's address.  How's it possible ?

The blockchain does not contain yet-to-be-published transactions to publish them based on conditions.  The blockchain is the structure that transactions are published to.  There is no such thing as a "pre-loaded transaction" that can be "released".  Either A (Alice) or B (Bob) has to publish it.

What Alice can do is give Bob a pre-signed transaction that spends an output from a transaction from Bob that has not been published yet.  This way, when Bob publishes his transaction, he can now publish the pre-signed transaction from Alice, but can't publish it beforehand.  This requires more coordination that I believe you are looking for, but it's possible.  It would go like this:

Bob creates a transaction, B1, with an output to Alice, but does not sign nor publish it.
Bob sends Alice B1, still unsigned.
Alice uses the output on B1 as an input on her own transaction, A1.  This transaction has an output that pays to Bob.
Alice signs A1, but can't publish it because it spends the still unpublished B1.  Instead, she sends the signed A1 to Bob.
Alice can now go offline, as her part is complete.
Bob, now in possession of a signed A1, signs and publishes B1 to the network.
With B1 now published, A1 is now a valid transaction, and Bob publishes it as well.

Again, I don't think this is exactly what you are looking for, but I don't think what you are looking for is possible.  Smart contracts generally require sending transactions back and forth before publishing to the blockchain.  You really can't have a smart contract with someone with whom you've never communicated.  The up-front communication is the contract part, and publishing to the blockchain is more like resolving the contract.


Is it possible to reindex specific blocks? I came across a block on my Fullnode that throws an error when attempting the gettrawrtransaction RPC.

No such mempool or blockchain transaction. Use gettransaction for wallet transactions.

It's only one block so far that seems like it got corrupted or improperly indexed. If I change the block/transaction, the JSON-RPC call works. I have txindex=1 set in bitcoin.conf

My question is, can I tell bitcoind to reindex only that particular block 282455, or do I need to reindex the entire blockchain? If so, what's the fastest method? Setting a higher dbcache?

No, to the best of my knowledge there is no user-level command to reindex specific blocks.  It's all or nothing.

If you want such a feature you'll have to write the code.

It seems to me kind of unlikely that the index would be wrong only for one specific block, so I would suggest looking for other explanations for the behavior you're seeing.


Order of transactions within a block Does the Bitcoin protocol guarantee that within a valid block, if transaction B spends the outputs of transaction A, A will always precede B?

Or is it possible to have B before A?

The Bitcoin protocol requires transactions to appear in topological order in the blockchain. Given two transactions A and B where B spends an output of A:

Both A and B may be included in the same block.
A must precede B in the transaction list.

Colloquially, a miner will never include a transaction in a block template until the transaction's requirements are met. Since B spends an output of A, B is not valid until A has created said output. To satisfy this dependency, B can only be included after A was included.

Also see: Can multiple transactions transferring the same bitcoin be done in one block?


Can I use bitcoin USB block erupters to mine litecoin? Let's say I buy a USB block erupter, can I use the same to mine Litecoins?

Does it require special software and setup to mine Litecoins?

No, you can't. USB block erupters are ASIC miners. They cannot have their algorithm modified in any way because the algorithm is designed into the silicon. They can only mine coins that use the same mining algorithm as Bitcoin (SHA256d) such as Namecoin and Devcoin.


Create raw transaction what txid I want to check for every transaction if there is enough balance to pay it(including fee). I found this question:
Is there a way to know the Bitcoin Network transaction fee BEFORE actually submitting the transaction?

But what do I have to use as the TXID by createrawtransaction?

In the console do listunspent
that will show you all the UTXO in your wallet including the txids.
You can type help to get a list of commands,
then help <command> to get details about each command