Why is my transaction not getting confirmed and what can I do about it? I sent a transaction

without (or with an exceptionally small) transaction fee
using extremely small or unconfirmed inputs
while the stars were not standing right.

For whatever reason, I have been waiting forever for my transaction to confirm.

Why is it taking so long for my transaction to confirm? What can I do to speed-up the transaction’s confirmation?

This is a canonical question serving as a lightning rod for the flood of "unconfirmed transaction" questions we are experiencing lately. Please provide a detailed and broad answer to serve a wide range of these questions.

How Bitcoin Mining Works

Bitcoin transactions are mined (processed) by Miners, and Miners want to benefit from their work. By mining transactions with higher fees, they make more money. Some miners can decide to mine all transactions no matter the fee but they still must compete with every other financially motivated miner.

Why is it taking so long for my transaction to confirm?

If you have sent a transaction

  without (or with an exceptionally small) transaction fee

expect it to be ignored for an unknown amount of time until a miner decides to process it and solves the block; this could be several days to several weeks, possibly never. Your wallet and any Bitcoin node will show it as unconfirmed, your transaction is stuck in limbo.

Block sizes are limited, which means that only a limited number of transactions can be processed in a certain timeframe. In the beginning of bitcoin, there was lots of free space in each block because there were not many transactions. However, now that Bitcoin is quite popular there are more transactions than can be processed into the current block. This is why transaction fees have increased, and as long as someone is still willing to pay more they will keep increasing.

What can I do to speed-up the transaction’s confirmation?

Nothing. The next best thing is to cancel and resend the transaction.

Make a note of the individual bitcoin address(es) that the unconfirmed transaction was sent from.
Run Bitcoin Core with the -zapwallettxes option (or wait a few days until your wallet stops broadcasting the transaction and it falls out of the global transaction mempool). (Issue with mempool.dat resolved by #10330 in 0.15.0).
Send all your bitcoins from the addresses recorded in step 1 to a new address with the recommended or higher than recommended fee.
Make original transaction again using the recommended fee.

What to watch out for

Sites that claim to "speed up your unconfirmed bitcoin transaction". From personal experience, these sites are either scams or just don't work.
DOUBLE PAYMENTS. If the addresses used in the original transaction have sufficient bitcoin in them to cover the transaction, it can always be completed at a later date. To avoid this, follow step 3 to empty the associated addresses and do not reuse them.

What is the recommended fee?

Transaction fees vary by the size of your transaction, and not all transactions are the same size. The fee for same sized transactions also depends on how busy the bitcoin network is at the moment.
An estimate (at the time of original post) was between 11-20 satoshi/byte (0.00011-0.00020BTC/kB) but now can be much higher.
Most wallets have a feature which dynamically calculates the rate based on network congestion.

See https://bitcoinfees.earn.com/ for a live chart of suggested transaction fees


Is it legal to trade bitcoins on coinbase/mtgox in the US? I am just wondering whether it is legal to trade bitcoins in the US just like we do for stocks? I see similar legal questions about selling OTC, but I am more interested in buying and selling in well known exchanges like coinbase/mtgox etc. Can I just trade them like normal stocks, as long as I pay taxes? Or do I need to register with FinCEN to trade?

Commodities exchange, yes.  Stock exchange, no.

Stocks are securities, so it wouldn't be appropriate to trade bitcoin on a stock exchange because they don't have any relation to the assets or liabilities of an underlying company.  Bitcoins are valuable (or not) only intrinsically.  This is closer to a commodities exchange, which is what CEX.io does and previously Mt. Gox did.

This is equivalent to trading gold, wheat, pork bellies, platinum, and so forth.  People on a commodities exchange can buy and sell options and forwards.  Which is economically a perfectly appropriate thing to do for an asset like Bitcoin.

As of right now, the legal situation is still confusing to the government, but this article argues that the CFTC does not regulate bitcoin trading even though it's a commodity.  FinCEN thinks that people who sell BTC for USD will presumptively have to register.  You will have to work out for yourself what rules might apply to BTC traders, if any.  I cannot provide much help on this front.

As a general tax rule, you need to observe Notice 2014-21 treating BTC as non-currency property and will have to report your transactions.  If you are buying and selling as a business, rather than holding BTC for anticipated appreciation, then you will need to file Schedule C and maybe create a business entity.  If your money comes from appreciation and long investment, then you are an investor and can make use of capital gains treatment.  If your money comes from quick trades and the short swings of the market, then you are a trader and if your money comes from charging other people fees to make their trades for them, then you are a dealer - either of which is a business that must be taxed at the less preferential ordinary income rate.  Remember to ignore any tax reporting on "currency gain" or loss from BTC, since the IRS says bitcoins are not currency (but if you trade in other currencies, that's a different issue).

Selling bitcoins is taxed like buying and selling other property.  It will be taxable accordingly as a basic IRC §1001 transaction, where [gain] = [amount realized] - [cost basis].


Creating transaction with using blockcypher https://api.blockcypher.com/v1/btc/main/txs/new?token={{TOKEN}}
To use BlockCypher's two-endpoint transaction creation tool, first you
need to provide the input address(es), output address, and value to
transfer (in satoshis). Provide this in a partially-filled out TX
request object.

From where can I get input addresses to create transaction?

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


Looking for a place to buy bitcoin with a credit card I'm trying to find a fast, reliable and secure place/service I can buy Bitcoins using a credit/debit card.

I googled and saw a few websites but most are a little sketchy and the rest don't seem to accept cards anymore.

Any suggestions?

you can try Cubits, they are Bitcoin payment processor based in UK and Germany.


Two wallets with the same address I understand that one can create a Bitcoin wallet as a pair of numbers (public & private key) with the right specifications and this is done quite easily in places like bitaddress.org
I also understand that the probability of generating two identical public keys is infinitesimally small -- lesser than the probability of being hit by an asteroid, or so I am told.
But it is not zero.
My question is - if a duplication occurs, a hash collision happens, how does the protocol (a) detect it and (b) deal with it. In a simple, everyday hash table application, we do a lookup on the existing hashed values and if we detect a collision we ignore the last created value and generate a new one.
Is there a similar protocol in bitcoin ( or any crypto) address generation?

Creation of an address is an entirely offline operation; there is no communication with the network.
If you'd (with unfathomable luck) create the same address as someone else, then you'll see incoming payments to it appear in your wallet, and be able to spend them.
There is no provision for dealing with this, because there does not need to be any. The probability of this ever occurring is so mind-blowingly small that it is simply not a consideration.
For typical addresses, there exist 1461501637330902918203684832716283019655932542976 valid distinct ones.


Bitcoin 2.0 offline transcation The biggest weakness of bitcoin is also it's biggest strength, ie, relying heavily on the online block-chain to confirm any transactions. The word Online is a very interesting word. For an individual, being online mean the power to access the world, but for your hard-earned money, constantly being online is more a liability than an asset. For starter, you can't spend your money while not being online, even if you are a millionaire. So it's a simple question. Why doesn't the block-chain have an offline functionality? Instead of getting confirmation by strangers around the world and while paying them a fee, Why not have an offline-password-based confirmation schema?

Being able to use your hard earned cash both Online and Offline is a huge deal. Or isn't it?

Why doesn't the block-chain have an offline functionality?

https://en.wikipedia.org/wiki/CAP_theorem

Point.


Power supply for Litecoin mining rig I've been told my power supply needs to be of a good brand and have sufficient power for all the hardware, with some to spare. A 80+ gold PSU is more expensive but could be the best idea.

I'm starting out my rig with three SAPPHIRE VAPOR-X R9 280X 3GB GDDR5 OC for now.I'm looking to go upto 4 or even maybe 5 in the future.

The price difference between Silent Pro M2 1500W & Corsair Professional Series Gold AX1200 is 42 USD from where I am to get it.One being silver rated and the other gold.

In terms of power efficiency and expansion ability of the rig which one would be better and why ?

For mining, it is a 'no brainer' to me to get the most power efficient PSU as even those meager differences of efficiency will pay themselves off in a pretty short time... that is assuming that the price of these 'coins' stays at their unusually high price anyway.


Do you need to be connected to the internet to send someone bitcoin? Say I walk into a store that accepts bitcoin. I decide to buy something and go to the counter. I get my smartphone out to pay the bitcoin. Does my smartphone need to have an internet connection to send the store my bitcoin?

Currently: yes, you pretty much need an Internet connection.

In the future: the relatively-new payment protocol BIP70 can be combined with Bluetooth, near-field communications (NFC), or possibly large QR codes to allow a merchant to send their address to your mobile device and your mobile device to send back a signed payment.  Then the merchant will use their Internet connection to broadcast the payment.

There are a fair number of developers from organizations like BitPay currently working to make this as easy and seamless as possible, so you probably won't have to wait very long for beta-quality no-Internet-required in-store payment solutions.


How to manage externally created addresses? In my application the private keys are created and stored on a HSM. When a new private key is created on the HSM, it returns the corresponding public key. With this public key I create a bitcoin address. Since these externally generated addresses are not part of a wallet, I'm unable to get the UTXOs of this address. Now my big questions is: How can I get the UTXOs of this address without importing it into a wallet?

Bitcoin Core has a scantxoutset command. You give it output script descriptors (which specify scriptPubKeys) and it will scan the UTXO set and return the UTXOs that have scriptPubKeys that match the given descriptors.


Is magicbytes sequence a valid delimiter for blocks in blockchains? For a blockchain parser, is it correct to say that "for X magicbytes sequences, we have X blocks in blockchain" ?

In other words, may blocks in blockchain accidentally contain magicbytes sequences ?

A blockchain is an abstract datastructure that contains a chain of blocks, consisting of hash-linked he headers and transactions.

If you're talking about a parser, I assume you're talking about files on disk... perhaps the blk*.dat files in Bitcoin Core's data directory. Those are just one way to represent the blockchain, and it's an implementation specific one that can change between releases.

Assuming you're indeed asking about the disk representation of blocks in Bitcoin Core (or similar software):

Every valid block starts with the magic sequence plus the size.
The magic sequence is allowed to appear inside the middle of blocks.
There may be gaps between blocks that are filled with garbage, including byte sequences from block data, which may in fact also contain the magic sequence.

Furthermore, the term 'blockchain' is often interchangably used for both the tree of all blocks produced/known, or for the longest path through it. The block files on disk contain all blocks Bitcoin Core has ever seen, including blocks that are not part of the main chain ("orphan blocks") and were stale or reorganized out.


How best can I use Raspberry pi and ASIC? I had an old Raspberry pi with a Bitmain Antminer 2GH USB plugged into it.

I have joined the bitminter pool and so far have 0.00000094 bitcoins.  In other words, I don't expect to get rich.

Researching this question most answers take into account power consumption.

My question is, for this sort of setup that I have with 1 - 4 2GH USB sticks, if I do solo mining, do I have much chance of getting a bitcoin now and then?

Let's do the math. The average time to find a block, which is worth a reward of at least 25 BTCs (+fees) is the following:

avgtime = difficulty * 2^32 / hashrate

The current difficulty is 16,818,461,371. Assuming a hash rate of 2GH/s we get in hours:

avgtime = 16818461371 * 2^32 / (2*10^9) / 60 / 60

That's about 10032602 hours or 418025 days. To mine solo successfully, you need much, much more hashing power.


Where is the extraNonce in this coinbase transaction here? https://blockchain.info/tx/c1669dabe1bcadf50c4b712e42da7b3d3152aef53752731b04a4f585dde6f5f2

The coinbase states this:

035fd807174d696e656420627920416e74506f6f6c311e205aaed698fabe6d6d4b889c7cba7d6b5f78928c66ca81b377e39cf502340287a9e7545b9f234c7a06040000000000000094010000bb5c0100
(decoded) _�Mined by AntPool1 Z�֘��mmK��|�}k_x��fʁ�w��4���T[�#Lz��\

Which part is the actual AntPool address and which part is the extra Nonce, also why does it have decoded?

Parsed it in json and it came out to be:

"vin": [
{
  "coinbase":
 "0362d8070483ddae5a642f4254432e434f4d2ffabe6d6dbd4affe5698eb19c52b5ac94015a2eaecd44f4b274883786f086673ba406c05001000000000000003c0d701e0000cfc79db70100",
  "sequence": 4294967295,
  "n": 0
 }
]

Which part is the actual AntPool address

The miner's address is not part of the coinbase part of a coinbase transaction.

  and which part is the extra Nonce

There is no standard for putting extranonces in the coinbase transaction. It is really just arbitrary data. You cannot determine what is actually the extra nonce and what is just arbitrary data unless you know what the software that generated the coinbase transaction actually does.

  also why does it have decoded?

Typically miners will put some text in the coinbase part of the coinbase transaction. This text is encoded, and thus must be decoded in order to read it.


Is it considered safe to create a wallet on blockchain.info? I created a wallet on blockchain.info.

Why is blockchain.info is not listed on "Choose your Bitcoin wallet"? Is the blockchain.info wallet considered safe?

Web wallets in general don't really make sense by bitcoin principles.

But to not make this into a service review: the wiki is managed in a git repository at guthub. Discussions happen there before changes are made. One such discussion happened here: https://github.com/bitcoin-dot-org/bitcoin.org/pull/663

Note that there may have been newer pull requests in the meantime.

Edit: per request, the gist of above link, the complaints about bc.i are:

  Bugs and losses: BC.i has suffered from concerning issues during the
  past year (e.g. iOS denomination bug, weak key stretching, sizeable
  number of users losing funds, and more issues I haven't verified yet)

  Backup/Password Security: BC.i hasn't adopted security features which
  are slowly becoming standard in other wallets (e.g. BIP32, random
  passphrases, backup on setup, rotating addresses, 2FA by default).

  Transparency: Source code of the app has been reset or not updated
  repeatedly, making bitcoin.org often relay the false claim that the
  app is open-source.


How can I recover private key as coins were sent a random generated address on wallet? There is a new address where the coins reside and asks for a private key.

How can I send coins from this  new random address without knowing the private key?

Software: http://www.sollico.com/bitwallet/

If the address is not part of any of the wallets that you have control over than you cannot recover the private keys. Because in that case, you're basically asking the same as asking to recover the private key to anybody's bitcoin address. I'm sure you know the answer to that question.

If the address is part of one of the addresses of your wallet at bitWallet, you can just spend from your wallet as usual. If you meant to ask how to do that, please update your question to reflect that.


Errors when running bitcoind at startup Hi i've built bitcoin core 0.15 from source and am trying to get it to run at startup.

I've used the bitcoind.conf file found in the bitcoin core repository
https://github.com/bitcoin/bitcoin/blob/master/doc/init.md

I'm also running Ubuntu 16.04 and am trying to test my upstart script i've placed in /etc/init by running service bitcoind start however I get the following error:

Failed to start bitcoind.service: Unit bitcoind.service not found.

The only thing i've changed in the example script is user to my user (sudo privileges) and the group to sudo.

Does anyone have any ideas?

Thanks

The same problem occured on my Ubuntu 16.04 with Bitcoin v0.15.1.

After some investigation, I found the reason is that the file(init.md) is out of date. Ubuntu has used systemd instread of upstart since 15.10, while the section of ubuntu in that file don't update in time.

It's sure that the lastest modification is 2015-08-04, which is before the release date of Ubuntu 16.04.

$ git blame -L94,97 doc/init.md
234bfbf6 (Adam Weiss   2014-07-31 11:56:17 -0400 94) 4c) Upstart (for Debian/Ubuntu based distributions)
234bfbf6 (Adam Weiss   2014-07-31 11:56:17 -0400 95)
fc25a874 (unsystemizer 2015-08-04 14:10:51 +0800 96) Drop bitcoind.conf in /etc/init.  Test by running `service bitcoind start`
234bfbf6 (Adam Weiss   2014-07-31 11:56:17 -0400 97) it will automatically start on reboot.

The section, "4a) systemd", is valid, which works on me.

Reference

What's New in Ubuntu 16.04 : The systemd Init System
How to identify which init system you are currently booting with


What happens when someone sends bitcoin to my wallet? I didn't get it. Should my wallet be online? What if it becomes corrupted before I make a backup? Can I use my backup wallet that was backed up few days ago?

It's actually quite simple. Your wallet is a collection of private keys, each identified by an ID. When someone sends you bitcoins, those are just assigned to one of those private keys.

The information about which key has how many bitcoins is stored in the bitcoin network itself, ie in the database each client has.

Now if you want to use the bitcoins which belong to one specific key, you need this key to sign the transaction.

So no, you don't need to be online to receive a transaction. You can also restore an older backup, as long as you haven't created any new keys in the meantime. If you have created new keys, it all depends on your luck - was the transaction sent to a new or an old key?

And if it gets corrupted before you make a backup you are SOL - nobody has the correct private key then.


Can I buy Litecoin with Paypal or a credit card? I've been looking into Litecoin Lately and couldn't find any easy option to buy it using a credit card or my Paypal account. Am I missing something or is it just not possible ?

Bitocin and Litecoin have the same problems when trying to buy them with funding methods that allow chargeback.This is mainly because of Paypal’s TOS (Section 3.7 here) and the fact that your can't chargeback Liteocin since it is considered as cash.

Having said that there are still a few ways you can buy Litecoin with Paypal or a credit card.

Use VirWox to buy SLL with Paypal and then transfer that SLL to BTC (has high comission, transaction can take between 1 hour to 2 days). After that transfer the BTC to either Vircurex or BTC-E and purchase Litecoins with them. Complete process explained here.
You can use Local Bitcoins and perhaps find someone in your area to sell you Bitcoins with cash or even someone not in your area to sell you Bitcoins with Paypal or a credit card and then use these Bitcoins to buy Litecoins at the same exchanges mentioned before.
If you’re only into trading Litecoins for their volatility and not actually keep them you can use platforms such as Plus500 to trade CFDs. However CFDs are for more experience traders and your capital is at risk so take that into account.
You can also buy Litecoins with Paypal or a credit card on Ebay. As long as they are sold with an actual physical product (meaning they are stored on a USB for example). Be ready to pay a high commission though since sellers have to insure themselves from soaring Litecoin prices.


scriptsig-not-pushonly (code 64) during send transaction in regtest I create a transaction in regtest without send it, I have transaction data signed.
I modified a little bit the scriptSig in order to replicate transaction malleability, I add two operations (2 OP_DROP) and increase the scriptSig length from 6A to 6C.

this is my final result.

0200000001b6a6018077d7e817c13074f4127a641a3225b44e56318ef61d2b746b0271e308000000006c527547304402205fa24c98406b9f18732a586a2d5a5cf8ed5e033afca89dda772963f87bff457d022020c796be2fd4c6c47733214293263e244828211a51f044872090e610d5e1e8820121024f29076388ac6ed18b281a149e88043be7e78f72e138f3498853d8918f7f5448ffffffff01606b042a010000001976a914f1edb261a91e7cb03737708d718b2c47b7aa5c8e88ac00000000

When I try to send rawtransaction I receive this message:

error code: -26
error message:
scriptsig-not-pushonly (code 64).

I'm using bitcoin-core 0.19.0.1

One of the standardness rules (relay rules) in Bitcoin Core is that the scriptSig must contain only operations that push data to the stack. Since you have actual opcodes that do non-push things, this transaction is non-standard so your node is not accepting it.

On regtest, you can disable standardness checks by adding -acceptnonstdtxn to your startup command.


Can it be mathematically proven that a block can be solved? In other words, that there exists a nonce for the block that will result in sha256(sha256(block header + nonce)) hash under the current difficulty barrier number.

The clients make use of the Target to determine if a block hash is valid and will be accepted by the network. The Bitcoin wiki states the following:

The target is a 256-bit number (extremely large) that all Bitcoin
clients share. The SHA-256 hash of a block's header must be lower than
or equal to the current target for the block to be accepted by the
network. The lower the target, the more difficult it is to generate a
block. [...]
Each hash basically gives you a random number between 0 and the
maximum value of a 256-bit number (which is huge). If your hash is
below the target, then you win. If not, you increment the nonce
(completely changing the hash) and try again.

The current target value can be found here: http://blockexplorer.com/q/hextarget


Blockchain.info keeps sending wallet backups Blockchain.info is sending my wallet backups over and over again;
is this someone trying to hack my wallet or something else?

I haven't done anything on my account, no settings changed et cetera.

This is standard if you have backup wallet chosen in your settings. Alternatively, email backups will send a wallet.aes.json file to your specified email address. A few things to keep in mind:

The aes part means your wallet is encrypted using your Blockchain login (and secondary password). If your password is changed then your newer wallet files can only be decrypted using the new passwords
The json part means the decrypted aes is a readable json format which can be read by humans and imported by various programs
Changing your password will change your decryption mnemonic.

The backup wallet.aes.json files are good for recovering old wallets but if your BTC has been moved from those addresses it does not recover your money.


How do you accept bitcoin donations on a steam group? I am running a game giveaway group on Steam.
What is the best way to accept donations?

P.S I am completely and utterly new to Bitcoin.

The easiest way would be to create a wallet and to dedicate a single address from it to receiving donations. For the convenience of the donaters you could present it both as a QR-code and a bitcoin URI. As with Jonas' answer you wouldn't want other people to be able to change the information on the page where you provide the donation address, as someone might replace the donation address with their own.

For improved privacy, you could replace the address with a new one every once in a while.

For a more advanced, private setup check out Jonas' answer.


Deprecation error on mac I'm compiling on mac, and I get this error:

unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;

Why does this happen, and how do I fix it?

In Mac OS X 10.7, Apple wants you to use their own crypto library instead of OpenSSL. This is pretty unlikely to ever be done by the bitcoin devs, so here's how to turn the warning off:

Edit your ./configure file, and add this to CXX_FLAGS

-Wno-deprecated-declarations

I don't actually own a mac; could someone try this and see if I got something wrong?


As of Feb 2015, what's the most technically secure wallet for Android? I want a wallet on my Android phone that is rooted. I'm new to Bitcoin and I'd like to know which one is technically secure.

It's a difficult question to answer because an Android rooted device is never going to be secure 100%.

That being said, the safest options will be 2FA enabled wallets at a bare minimum, and multisig solutions being the best bet.

GreenAddress.it allows for wallet functionality on par withBlockchain.info but with increased security through P2Script using ntimelock. It also allows for 2FA: be sure to use TOTP (eg Google Authenticator); do not use the same device for mobile SMS authentication since intercepting sms on a rooted device is extremely simple.

GreenBits is a new app which integrates with GreenAddress and utilises 2FA and P2Script also.

Options like BCI and Mycelium are not ideal for a rooted phone as the security concerns make either choice quite vulnerable to being emptied by malicious software stealing the pin code.


How to read a block nonce in command line? I need to know how to read a block header in particular its nonce.

How can I read a block nonce? what command line is used?


Is it possible to create a cryptocurrency that has a fixed value? I like Bitcoin for its ease of use and security. It makes "money" transfer fast and easy, however a lot of people are afraid to use it because of its volatility, Would it be possible to create a currency with a system that enforces a stable value?

A fixed value, relative to what? To a fiat currency? In which case, should it be US dollars, euros, yens, yuans...? Relative to a commodity such as oil or gasoline of some quality? Relative to gold, silver, platinum, diamonds? A basket of all the above? All of these have very variable values and both the reasons of their intrinsic volatility and the possible remedies for that are far above your capabilities.

Creating a crypto-coin with a "stable" value relative to whatever you want to track it to (for tracking it absolutely to yield a fixed value is impossible, unless you control the other stuff) depends not on the crypto-coin's algorithms per-se but in the market - you'd be forced to create an exchange of last resort and be willing to spend a lot of money fighting people who'd try to move the price way too up or too down on purpose to cash a quick buck after the distortion, or simply are trying to attack your coin to destroy it or harm you. You'd need very deep pockets, much technical expertise and a lot of luck.


Signing a large file with Ardor Account I want to sign a file (a picture of 1.4 Mb) with my Ardor Account, in order to have a timestamped proof of ownership.
I tried the generateFileToken API, but it seems to work just with smaller files (no more than 40 kb).
How could I do it?

You need to increase the max file upload size of your node using the nxt.maxUploadFileSize property in nxt.properties.

For example, set:

nxt.maxUploadFileSize=10000000

To set the limit to 10MB


Is it feasible to store information in the Bitcoin system? I see that some new services are based on the possibility of storing information in the bitcoin system. For example, you can use it to store an encrypted file with a blueprint of an invention.

Is this use endorsed, accepted, or expected?

Could services build like this be reliable?

Storing data on the blockchain is frowned upon. Since the blockchain is replicated on all non-pruned full nodes and downloaded by all full nodes, thousands of people must spend the extra resources to download and host your data on their machines for essentially eternity. This costs money and disk space while also taking up valuable block space that would otherwise be used to confirm someone's money-transferring transaction.


What makes difficulty more difficult? Miners attempt to hash block data such that it is below a certain target value? By Cantor's diagonal proof aren't there infinitely many successful values below any given target?

Hashes are 256-bit integers, meaning they are whole numbers between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935. There are no infinitely many different hashes. In particular, the number of hashes smaller than the target is exactly equal to the target.

In any case, Cantor's diagonal has nothing to do with it - if hashes were real numbers, there would be infinitely many of them even without any reference to their particular cardinality.

What makes mining difficult is that calculating a hash takes time, and that each hash only has a small probability to be less than the target. For practical purposes, each hash is a uniform random number between 0 and 2^256-1, so if the target is X it has a probability of (X/2^256) to be smaller than the target. This means that, on average, 2^256/X hash calculations will be needed in order to find a valid block. The lower X is, the more calculations will be needed.


Is there a limited number of Bitcoin wallets? Is there a theoretical upper bound on the number of possible wallets, similar to the upper bound of 21 million Bitcoins that can be generated?

I think you are talking about Bitcoin addresses, those are considered disposable, consider this; a simple computer constantly generating Bitcoin addresses will generate all possible combinations in 69 tredecillion years.


Would it be visible that someone moved bitcoins to or from tumblebit? If I want to make a transaction with someone via Tumblebit, would it be visible on the blockchain?

If a have a known public bitcoin address and I will move bitcoins from there to pay someone via Tubmlebit, will it be recognizable?

If I receive payment that went through tumblebit, would that be recognizable from the history of transactions?

How exactly would that look?

All confirmed transactions are publicly visible on the blockchain.

What's probably far more interesting for you is whether anyone can find out whether you put your money through Tumblebit.

What you really need to know is in this sentence of the paper you linked to:

  Specifically, while the blockchain reveals which payers and payees
  participated in an epoch, no one (not even the Tumbler τ) can tell
  which payer paid which payee during that specific epoch.

Tumblers are recognizable on the blockchain. If you pay someone via Tumblebit from an address which is publicly known to be yours, people will know that you paid someone via Tumblebit. They won't know who you paid but just know that you paid someone via Tumblebit might be enough to raise suspicion.

If you receive payment through Tumblebit, people can find out you received it through a tumbler. But they won't know who the "you" in the previous sentence is until you somehow reveal your identity. Until then, it's just that money went to someone. Who that someone is, isn't known to the public. But if your next transactions goes to an online shop with a order to ship a parcel to your home, you can be pretty sure the merchant knows that the address he received the payment from belongs to you.

The fact that people know that money went through tumblers simply emerges from the fact that tumblers want to get money from a lot of people involved. Look at transaction f653dc8cf567b6cf0cf98660a66a1b138677388c16c87b8f4d68f5979cd4627f. I just looked for one to show to you in the newest block and came across it. It moves money from 13 addresses to 13 different addresses. And not exactly little: The equivalent of 2.5 k$. Moving money from 13 addresses to 13 different addresses isn't exactly how a transaction of someone who just bought a computer for 2.5 k$ on tigerdirect.com would look like, is it?

If you look at how the input addresses got their funds, it gets even more suspicious. For example, 1HjfSKDVnKDsJBWWDWcgcmGDDhauc7cR8q got its funds from 19 addresses. It doesn't seem like this just happened by random chance, does it?

You might also want to take a look at this question and at this one.


Pending already for 4 days I did withdrawal my BTC's 4 days ago and it is still pending. Is it normal that it takes so long? How much longer must I wait?

When you say you withdrew it, it sounds like you are withdrawing from an exchange.

In this case, it's completely up to the exchange when they'll broadcast a transaction sending you your money - some exchanges are very very slow at this and it has nothing to do with the bitcoin blockchain.

If they've actually sent the transaction, and you're just waiting for it to confirm on the blockchain it's possible they sent it with a really low fee. In this case, check the link commented by Зелёный for more information about why your transaction isn't confirming.


Butterfly Jalapeño for Dogecoin? Can a Butterfly Jalapeño be used to mine dogecoin? If so, is it cost effective, compared to it's bitcoin mining cost effectiveness?

No, the Jalapeño is a Bitcoin miner, it solves the SHA-256d hash function.

On the other hand, Dogecoin uses the Scrypt hash function. The two are not compatible, and as far as I know there is no Scrypt ASIC being sold, yet.


Blockchain command line tools I was under the assumption that the bitcoind server allowed you to query the blockchain and run commands like bitcoind getbalance on any address. I'm finding out that you may query addresses in your wallet. Is this correct?

What is required to query the blockchain with commands like think locally without the need for external API's?

My intention is to use a Perl script to get account balances.

Bitcoin at the protocol level, the Bitcoin Core implementation and its wallet implementation do not have a concept of "address balance". The protocol only has a notion of unspent transaction outputs ("coins") with a particular value and script to limit who can spend it. You can reasonably define the balance of an address as the sum of the values of all unspent transaction outputs with a script that can be spent using the key corresponding to that address, but the core implementation has no need for this.

The wallet doesn't track address balances either - it considers the pool of coins the entire wallet can spend, and keeps track of their total value. As for privacy of the system (not just yours) the recommendation is to simply use a different address for every incoming transaction, there is little use for per-address tracking either. The next release (0.10) will likely have support for watch-only wallets, which allow adding addresses to the wallet without the corresponding private key, allowing tracking of arbitrary sets of coins, but still not aggregated by address.

There are external tools that can do efficient querying of such aggregated data from the blockchain, like ABE and Insight.


bitcoinTestnet Network returning a mainnet address I'm using this code to get a new address from an extended public key:

    $index = 97;
    $change = false;
    $key = HierarchicalKeyFactory::fromExtended($tpubaddress, NetworkFactory::bitcoinTestnet());
    $path = ($change ? '1' : '0').'/'.$index;
    $child_key = $key->derivePath($path);
    $address = new PayToPubKeyHashAddress($child_key->getPublicKey()->getPubKeyHash()))->getAddress();
    echo $address;

This is resulting an an address like

15fuesDBKKnEMnrZz3mT9fxbm7dkjwDN3z

which is a mainnet P2PKH address.

Is there a way I can get it to give me a testnet P2PKH address (e.g. mjKxMDjShxKS5LymC43EmctDoB5Sg3n6UZ)?

This is breaking my attempt to create a raw transaction with the address b/c it's from the wrong network. If not, should I report this as an issue on their github project?

The following code fixes the issue. The problem was that the class I was using didn't set the network on the bitwasp bitcoin object. The code came from freedom node.

hd.php

<?php

require_once(__DIR__.'/../autoload.php');

use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Address\AddressCreator;
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig;
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig;
use BitWasp\Bitcoin\Network\Slip132\BitcoinRegistry;
use BitWasp\Bitcoin\Network\Slip132\BitcoinTestnetRegistry;
use BitWasp\Bitcoin\Key\Deterministic\Slip132\Slip132;
use BitWasp\Bitcoin\Key\KeyToScript\KeyToScriptHelper;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence;
use BitWasp\Bitcoin\Key\Deterministic\MultisigHD;
use BitWasp\Bitcoin\Network\NetworkFactory;
use BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\Base58ExtendedKeySerializer;
use BitWasp\Bitcoin\Serializer\Key\HierarchicalKey\ExtendedKeySerializer;

class HD {
  private $network_name = NULL;
  private $network = NULL;
  private $xpub = NULL;
  private $ypub = NULL;
  private $zpub = NULL;
  private $multisig_xpubs = NULL;

  public function __construct($network = 'bitcoin') {
    $this->network_name = $network;
    if (version_compare(PHP_VERSION, '5.3') >= 0) {
      $this->network = NetworkFactory::$network();
    } elseif (version_compare(PHP_VERSION, '5.2.3') >= 0) {
      $this->network = call_user_func("NetworkFactory::$network");
    } else {
      $this->network = call_user_func('NetworkFactory', $network);
    }
    Bitcoin::setNetwork($this->network);
  }

  public function set_xpub($xpub) {
    $this->xpub = $xpub;
  }

  public function set_ypub($ypub) {
    $this->ypub = $ypub;
  }

  public function set_zpub($zpub) {
    $this->zpub = $zpub;
  }

  public function set_multisig_xpubs($xpubs) {
    $this->multisig_xpubs = $xpubs;
  }

  public function address_from_master_pub($path = '0/0') {
    if ($this->xpub === NULL && $this->ypub === NULL && $this->zpub === NULL) {
      throw new Exception("XPUB, YPUB or ZPUB key is not present!");
    }

    $adapter = Bitcoin::getEcAdapter();
    $slip132 = new Slip132(new KeyToScriptHelper($adapter));
    $registry_classname = 'BitWasp\\Bitcoin\\Network\\Slip132\\'.$this->network_name.'Registry';
    $bitcoin_prefixes = new $registry_classname();

    if ($this->xpub !== NULL) {
      $pubPrefix = $slip132->p2pkh($bitcoin_prefixes);
      $pub = $this->xpub;
    } else if ($this->ypub !== NULL) {
      $pubPrefix = $slip132->p2shP2wpkh($bitcoin_prefixes);
      $pub = $this->ypub;
    } else if ($this->zpub !== NULL) {
      $pubPrefix = $slip132->p2wpkh($bitcoin_prefixes);
      $pub = $this->zpub;
    }

    $config = new GlobalPrefixConfig([
      new NetworkConfig($this->network, [
        $pubPrefix,
      ])
    ]);

    $serializer = new Base58ExtendedKeySerializer(
      new ExtendedKeySerializer($adapter, $config)
    );

    $key = $serializer->parse($this->network, $pub);
    $child_key = $key->derivePath($path);

    return $child_key->getAddress(new AddressCreator())->getAddress();
  }

  public function multisig_address_from_xpub($m, $path = '0/0') {
    if (count($this->multisig_xpubs) < 2) {
      throw new Exception("XPUB keys are not present!");
    }

    $keys = array();

    foreach ($this->multisig_xpubs as $xpub) {
      $keys[] = HierarchicalKeyFactory::fromExtended($xpub, $this->network);
    }

    $sequences = new HierarchicalKeySequence();
    $hd = new MultisigHD($m, 'm', $keys, $sequences, TRUE);

    $child_key = $hd->derivePath($path);

    return $child_key->getAddress()->getAddress($this->network);
  }
}


Is there a cost to having many different addresses? Whenever I want to receive funds to my bitcoin wallet, it gives me a different address and says that it is "your current bitcoin address".
Suppose I collect money from 100 different people, and then want to spend all this money in a single transaction. Will I have to create a transaction with 100 different sources (the 100 different addresses) and a single destination? Will this transaction cost more than a simple one-source one-destination transaction (e.g. because it is larger)?

Will I have to create a transaction with 100 different sources (the 100 different addresses) and a single destination?

Yes.

  Will this transaction cost more than a simple one-source one-destination transaction (e.g. because it is larger)?

Yes.

However, this has nothing to do with using multiple addressses or not. Whenever you receive money in 100 transactions, it creates 100 unspent transaction outputs (coins). If you want to spend them, you need to redeem all those 100 coins. Whether they're all sent to the same address or not is completely irrelevant.

So:

  Is there a cost to having many different addresses?

No.


Can google steal my Bitcoins if I store the private key in Google Keep note A while ago I put all my addresses with private keys (although they did not have that much money in them) onto a google keep note. I put it on a password protected notepad on my phone now, but could anyone have stolen them from my google keep note?

It'd be a huge violation of user trust if a Google employee looked at customer data and did something like that, so I'd say extremely unlikely.

That said, you shouldn't ever put your private keys on the internet.

Lastly, if this did happen and it involved any substantial amount of money, Google would be able to determine which employee accessed your data, which you could then very likely use in civil court to recover your stolen BTC.

Disclaimer: I work at Google.


How accept trade works on creating order I want to build a rails application to create buy or sell offer for coins. If buy offer is accepted by seller, How the coins exchanged between the buyer and seller. How can it be implemented? What is the sequence of processes to be done in development level. Is there any opensource projects available in Github. I don't want to use other API's such as cryptsy. Can anybody guide me with proper steps as I am a beginner to cryptocoins.

This "rails application" you would like to create, could be called an "exchange platform". A challenge hereby is to create a secure platform, as you will be taking responsibility for and handling other people's money.

One main difference between exchange platforms is how services facilitate the trade: I am aware of three different modi operandi:

Service only sells crypto. (e.g. Coinbase.com)

The service offers crypto currency at a given price.
The user accepts the current offer for a specific amount and provides an address where he wants to receive the crypto currency.
The user sends a fiat deposit to the service.
The service waits for the user's payment to clear, then sends the crypto to the user's address.

Service holds crypto in escrow. (e.g. Bitcoin.de)

User Alice sends a crypto currency deposit to the service.
Alice creates an offer on the service's platform to sell a specific amount of crypto at a certain price.
User Bob accepts Alice's offer.
Bob sends a fiat payment to Alice.
Once Alice receives the payment from Bob, she confirms the payment to the service.
The service sends Alice's crypto currency deposit to Bob, after taking their fees from it.
If something goes wrong, the service mediates the dispute.

Service holds deposits of all currencies. (e.g. Bitstamp.net)

User Alice sends a crypto currency deposit to the service.
Alice can now create a

sell offer at a specific price (limit order)
Which will remain in the order book until somebody is willing to pay the price she set.
sell immediately at the current price (market order)
Which will match the best buy offers until her order is matched completely.

Vice versa user Bob sends a fiat deposit to the service.
User Bob can now create a

buy offer at a specific price (limit order)
Which will remain in the order book until somebody is willing to sell for the price he set.
buy immediately at the current price (market order)
Which will match the best sell offers until his order is matched completely.

At any point, Alice and Bob can withdraw their deposits from the service.
You can find a more detailed example at How do buy and sell orders work?

Any of the above should also work for exchanging crypto for crypto.

In order to make the complete platform work, you will need:

User interface, i.e. a website
User management including fulfillment of local KYC, AML laws
Orderbook
Matching engine
Wallets for any tradable crypto currencies
Cold storage for any tradable crypto currencies
Payment processing for fiat currencies, maybe a banking partner
Customer Service
Legal advice

You might also find What would it take to create my own Bitcoin exchange? helpful, which goes more in-depth on the same topic.

Concerning your question for open source Bitcoin exchange software, this question has been answered here: Is there an open source Bitcoin exchange?


I tried to recover the public key from the signature, but I failed I used data that comes from https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#p2sh-p2wpkh. It is easy to know how to get sigHash. But when I try to recover public key, everything out off my expected.

And my question is

The message to be signed was not 64f3b0f4dd2bb3aa1ce8566d220cc74dda9df97d8490cc81d89d735c92e59fb6?
If the message is 64f3b0f4dd2bb3a...59fb6, is anything wrong to my code?

My code

import ecdsa

from ecdsa.ecdsa import int_to_string, string_to_int
from binascii import hexlify

prik = "eb696a065ef48a2192da5b28b694f87544b30fae8327c4510137a922f32c6dcf"
prik = bytes.fromhex(prik)

pubk = "03ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a26873"

sig = '3044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb'
sig = bytes.fromhex(sig)

raw_msg = "64f3b0f4dd2bb3aa1ce8566d220cc74dda9df97d8490cc81d89d735c92e59fb6"
raw_msg = bytes.fromhex(raw_msg)

try:
    pubkey = ecdsa.VerifyingKey.from_public_key_recovery(
        signature=sig, data=raw_msg, curve=ecdsa.curves.SECP256k1, sigdecode=ecdsa.util.sigdecode_der)
    print([hexlify(pub.to_string()) for pub in pubkey])

except Exception as e:
    raise e

def check_recovery(pub):

    padx = (b'\0'*32 + int_to_string(pub.pubkey.point.x()))[-32:]
    if pub.pubkey.point.y() & 1:
        ck = b'\3'+padx
    else:
        ck = b'\2'+padx

    return hexlify(ck)

lists = [check_recovery(p) for p in pubkey]
print(lists)
print([l == pubk for l in lists])

What I got was:
    [b'519e33c6b146628b4010ae2b56aa9127ae9b795c82df021979436296daf4cceac17eb495101c3c15011e9d5a08163122054ad375730ee2e219504540eb658211', b'd28ba1b718b542f52fe42b51635850b5900f111affbbdcbb63465e9a3dd79ffb80251268ba8d5b5ba4aaec8a682145af51b87bd7c7ab9e956895d31db24c4d4b']
    [b'03519e33c6b146628b4010ae2b56aa9127ae9b795c82df021979436296daf4ccea', b'03d28ba1b718b542f52fe42b51635850b5900f111affbbdcbb63465e9a3dd79ffb']
    [False, False]

What did I miss?

What i missed?

You are hashing sigHash (ie. the already hashed message) with SHA1 and then recover public key using that result which will give you 03519e33c6b146628b4010ae2b56aa9127ae9b795c82df021979436296daf4ccea as the recovered public key (can't re-calculate the second one with my c# code)! I believe that this is the source code of the from_public_key_recovery function you are using. You probably have to use another function like from_public_key_recovery_with_digest


Electrum 2 validation: how is the HMAC always 01...? Electrum version 2 creates a seed from a random number which is then encoded as a mnemonic. The seed is validated by checking that the hmac begins with the bytes 01 or 101 for standard and 2fa types, respectively.

I have looked at the python code on github and indeed it does return the 01 byte but I am still confused as to how one can ensure a hash is going to start with a predicted value (01\101).

How can this be so? Is it that I'm missing the nuance of what the code does or the concept of how hmac works

When creating a new seed, Electrum 2.x does pretty much the same thing as vanity address generators, or for that matter Bitcoin miners... it "grinds".

It generates a seed based on some entropy and a nonce, and checks if the seed's HMAC starts with the required byte sequence (the "checksum"). If it doesn't, it increments the nonce and checks its HMAC again.

If you're interested, the code which does this is here on GitHub.

It should be noted that Electrum seeds have (by default) 128 bits of entropy. As a result of this grinding, Electrum discards (for standard wallets with a checksum of 0x01) 255 out of every 256 potential seeds. This effectively decreases the entropy in a seed by 8 bits (the length of the checksum). In order to compensate for this, Electrum 2.x adds an additional 8 bits to the total seed length, which brings the seed length to 136 bits and the entropy back up to 128 bits.


How to properly use PreviousTxnID in a Ripple Transaction? At the moment I am implementing a transaction overwriting with NOPs in Ripple. I want to store information about a transaction I am overwriting inside of the NOP. Looking at the PreviousTxnID field it appears to be ideal for this purpose. However, when I try to use it I get an error of:

{
  "id": 11,
  "status": "success",
  "type": "response",
  "result": {
    "engine_result": "tefWRONG_PRIOR",
    "engine_result_code": -184,
    "engine_result_message": "This previous transaction does not match.",
    "tx_blob": "1200032200000000240000F69555DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D6763977268400000000000000F7321025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC211077446304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA8114448BD3912AA0E86A18B17784E7177B262FC38D73",
    "tx_json": {
      "Account": "rfESTMcbvbvCBqU1FTvGWiJP8cmUSu4GKg",
      "Fee": "15",
      "Flags": 0,
      "PreviousTxnID": "DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D67639772",
      "Sequence": 63125,
      "SigningPubKey": "025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC21107",
      "TransactionType": "AccountSet",
      "TxnSignature": "304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA",
      "hash": "B1932085BA94FEBE7A360D71359752A1666C48CCBBD97DFF16FFFA8626EDA253"
    }
  }
}

What is the correct way to use PreviousTxnID to overwrite a prior transaction in Ripple? (say, a transaction we submitted that never got into a ledger due to the use of LastLedgerSequence).

The PreviousTxnID field is deprecated, broken, and should never be used. Instead, use AccountTxnID. It works as follows:

You must use fully-canonical signatures and you should set the fully canonical flag (0x80000000) on all your transactions. Otherwise, the transaction ID could (in theory) be maliciously modified.
You must enable transaction ID tracking on your account. You do this by performing an AccountSet transaction with SetFlag set to 5. This causes your account to begin tracking each account that it executes.
Include a PreviousTxnID field in your transactions that contains the ID of the previous transaction. This will ensure that a transaction only applies if it has the expected predecessor transaction.

Now, replacing a transaction with a nop will invalidate any successor transactions that have a PreviousTxnID field.

If you wish to disable PreviousTxnID tracking for your account, perform an AccountSet transaction with ClearFlag set to 5.


how to enable wallet in a confirmed node I installed/compiled my Bitcoin Core RPC client version v0.16.2.0 and i used --disable-wallet flag.

I think this is the reason I am seeing "Method not found" errors when trying to GetNewAddress

how can i install/enable it after having fully confirmed node with up to date blockchain?

os: Ubuntu 16.04.5

solution

accepted the answer below but in my case since i set it up sing apt-install bitcoind the wallet feature was already there, i just needed to flip the disablewallet=1 flag in my bitcoin.config

Yes, that is a wallet feature. You would have to recompile without the --disable-wallet flag, starting back at executing the autotools configure script: ./configure. See https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#disable-wallet-mode.

You also have to make sure you don't set the -disablewallet flag when you run bitcoind or have it in your bitcoin.conf file.

If you need to recompile, you could still back up the data in the .bitcoin folder, which includes the blockchain and UTXO set and copy it back over when the installation is complete. That way you don't have to download the blockchain again.


Exactly how does one calculate how many BTC they will get a certain hashrate? I am curious on how many estimated BTC I will earn at any hash rate since, I don't really think I'm really earning any BTC at 600 Mhash/s.

The answer of D.H. assumes the hashrate of the network never changes between difficulty jumps. But it can in fact evolve quite a bit, so it can be inaccurate sometimes. Your proportion in the network may change but, until the difficulty adjusts, this will not change your rewards.

Your average reward will be :

So, in your case, with 600 MH/s and a time period of 1 day, the result is, in average, 0.3394412542813765 BTC a day (with current difficulty).

Explanations: the first term is the average reward per difficulty-1 share, and a difficulty-1 share is found in average every 2^32 hashes.

Now, if you're going to be pooled mining, adjust the 50 in the formula to take fees into account (use 48.5 for example for a 3% fee). Same goes when blocks start generating 25 BTC only.


Decoding a Block beyond the Coinbase transaction I am attempting to decode a Block and have managed to decode the Coinbase transaction but after the transaction, there is huge gaps in them that I do not understand.

Taking this Block as a sample: 0000000000000000002e5b55bf93c89cc3a41de24d762fa4f68e725da3b089ba

Here is my attempt to decode this block:

  ===== Block Begin =====

  00000020 - Transaction Version

  15F11A82BE84CCCAF4E59CFC0C89EF01CAD854DC15F33D000000000000000000 -
  Block Hash

  CC2DCEAF96439181993C564CBE889F60FDB98E8EFD4E524D9EEA3C54CF400504 -
  Merkle Root

  2BDF8F5A - Timestamp

  DC975D17 - Bits

  3E2A4065 - Nonce

  FD8704 - Total Transaction

  01000000 - Transaction Version

  01 - Coinbase has 1 transaction

  ===== Coinbase Begin =====

  0000000000000000000000000000000000000000000000000000000000000000 -
  coinbase hash

  FFFFFFFF - index

  45 - txin script length (69)

  -> 03 - bytes in height

  -> 43CA07FA - height

  ->
  BE6D6DCAEEFE495F6BCA08E10FF6D24555166C2456D8129213354E32FD73EB1B141AB00100000000000000036507000F312D7B080100275C012F736C7573682F
  - txin

  00000000 - sequence

  03 - 3 output in coinbase

  AA5CB94C00000000 - output satoshis from coinbase

  19 - Coinbase Output Script Length (25)

  76 - OP_DUP

  A9 - OP_HASH160

  14 - 20 bytes

  7C154ED1DC59609E3D26ABB2DF2EA3D587CD8C41 - hash data

  88 - OP_EQUALVERIFY

  AC - OP_CHECKSIG

  00000000 - Lock Time

  ===== Coinbase End =====

  000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1
  - outpoint ?

  B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33
  - ?

  02000000 - Tx Version

  6B - TxIn SigScript Length (107)

  48 - TxIn SigScript Length (72)

  3045022100FAD6F0A91A89A90D17800B55B1B1E424338BFB5D72D3970ED95310AFEB4734A50220120B24AF1444E520EB77ECE73DB6D9775159220B089D28948BC9DBC156C2492F01
  - TxIn SigScript

  21 - TxIn SigScript Length (33)

  02227CEDFAB55D1B7642D47A5AC92638ED8822A23C3DDADF88DEFEA45A37F5935E -
  TxIn SigScript

  FFFFFFFF - TxIn Sequence

  02 - TxOut Count

  F0874B0000000000 - Satoshis (BTC 0.0495)

  17 - Length (23)

  A9 - OP_HASH160

  14 - 20 bytes

  98808E526D3737F044F2DD5445A27DB39BAD821D - hash data

  87 - OP_EQUAL

  92F6E73600000000 - Satoshis (BTC 9.21171602)

  19 - Length (25)

  76 - OP_DUP

  A9 - OP_HASH160

  14 - 20 bytes

  B08F46E4D21CD0547A8A1E2E43E5440284F710A4

  88 - OP_EQUALVERIFY

  AC - OP_CHECKSIG

  00000000 - Lock Time

  =====================

  01000000 - ?

  01 - ?

  DE74875C17CE6730AF727B52913FAB9FF7922BBA806932785A824A8CAA649E8D0100000000FFFFFFFF02D5C267130000000017A91433A9DB4ED408225EFE4B00DC55F962B52E8769B987A7C6D10200000000220020701A8D401C84FB13E6BAF169D59684E1 ... more data ...

It seems like after I have decoded the Coinbase transaction, the first proper transaction after the Coinbase, I hit a problem trying to resolve:

  000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33

Only after that point, does the data look abit more familiar with the 02000000 which I have guessed is the Tx Version followed by what seems to be TxIn Script data and so on.

I would like some help to understand how to decode the Block as this is only that far I can guess after reading the Bitcoin documentations found online which are not documented in a uniformed and easy to ready manner.

Thanks for the help in advance.

The format for blocks is described here: https://bitcoin.org/en/developer-reference#serialized-blocks

The format for transactions is mostly described here: https://bitcoin.org/en/developer-reference#raw-transaction-format

However some transactions are segwit transactions, so they have a few additional fields that are not described in the above documentation. Those fields are described here: https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki

Your decoding is a bit wrong:

  00000020 - Transaction Version

That's the block version, not transaction version.

  01000000 - Transaction Version

  01 - Coinbase has 1 transaction

You've actually missed two fields here. The first 7 bytes of the transaction are 01000000000101. These are as follows:

01000000 - Transaction version
00 - Segwit marker byte
01 - Segwit flag byte
01 - Number of inputs

Note that the segwit marker and flag bytes are only found in segwit transactions and indicate that a given transaction is a segwit transaction.

  ===== Coinbase Begin =====

The transaction version and the count after it all belong as part of the coinbase transaction. The count is not of the number of transactions but rather the number of inputs. A transaction is composed of inputs and outputs, not other transactions.

  -> BE6D6DCAEEFE495F6BCA08E10FF6D24555166C2456D8129213354E32FD73EB1B141AB00100000000000000036507000F312D7B080100275C012F736C7573682F
  - txin

No, that's still part of the scriptSig. It itself is not a transaction input. This is just arbitrary data in the scriptSig of the coinbase transaction that miners put there.

  00000000 - Lock Time

  ===== Coinbase End =====

  000000002C6A4C2952534B424C4F434B3AA5BA6C5D1EFFA2034E994BEEE65C619DE2D2A1
  - outpoint ?

  B91892F193C170CAB74F152EAE0000000000000000266A24AA21A9ED85F7D06CCF8014D990E0242ACC0433EAF134732094E9A083A45AC3799259C9170000000001000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33
  - ?

No, there are three outputs but you have only decoded one of them.

The proper decoding is as follows:

0000000000000000 - Amount in satoshis
2c - scriptPubKey is 44 bytes
6a - OP_RETURN
4c - OP_PUSHDATA1
29 - Push 41 bytes to stack
52534b424c4f434b3aa5ba6c5d1effa2034e994beee65c619de2d2a1b91892f193c170cab74f152eae - 41 bytes of data
0000000000000000 - Amount in satoshis
26 - scriptPubKey is 38 bytes
6a - OP_RETURN
24 - Push 36 bytes to stack
aa21a9ed85f7d06ccf8014d990e0242acc0433eaf134732094e9a083a45ac3799259c917 - 36 bytes of data. This data is the witness commitment as described in [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Commitment_structure)

There is actually a next part of the transaction that you don't have in your breakdowt. It is the witness data and the locktime.

01 - One witness stack item
20 - Stack item is 32 bytes in length
0000000000000000000000000000000000000000000000000000000000000000 - Stack item
00000000 - locktime

Then the next transaction starts with 01000000014FFBE86D2805AF78459BBF5FA3432A5E9C84D408F7921BF2095488B9DDC39D33... and is decoded like the coinbase transaction above.


mining command-key term explanation Could you please explain me the meaning behind the terms and actions of the cmd line like:
bfgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -O YourAddress

and this:
bfgminer -o stratum+tcp://uk1.ghash.io:3333-u username.worker -p YourPasswordHere

Thank you for your time.
Best regards

Bfgminer is the mining application, the line with the stratum output is the pool that the miner is configured to use. Your address would be a bitcoin address that you own. The worker name and password would be credentials to access your account at the mining pool although most often the password is not used or is substituted with x.


Litecoin mining 10 times slower than a couple of days ago I have a 5850, and have been mining with it for about a week.

With GuiMiner I can mine bitcoins at about 275Mhash/s.  This has not changed.

A couple of days ago I setup Litecoin mining and it was working at about 350Khash/s, which at the time was about the same profit as Bitcoin.

But now when I mine litecoins I'm only getting 35 khash/s.

I'm getting the same speed with CGMiner or Reaper.  I just started the exact same setup I had last week and I'm getting the crappy result.  I've been messing with settings and config, but no change.

I have rebooted, no change.  I can change back to Bitcoins anytime and get 275Mhash/s with CGMiner, but when I change CGMiner to Scrypt mining it drops to 10% what it should be getting.

I can't think of anything that would cause this.  Any thoughts?

Scrypt CGMiner mining:
http://puu.sh/2d7Mp

Bitcoin CGMiner mining:
http://puu.sh/2d7NW

Current CGminer command:
cgminer --scrypt -o x -u Liquid5n0w.1 -p x --intensity 12 --worksize 256 -g 1 --lookup-gap 2 --thread-concurrency 7200  --fix-protocol

I have found the cause:

I had GUIMiner to start on startup, and even though I was stopping it before I'd try to use CGMiner or Reaper, it did something to the drivers and would prevent LTC mining from starting correctly.

If you have a similar problem to this, try to disable GUIMiner on startup.


what's the purpose of the chain_id in merge mining? I'm considering adding merge mining support to coin x. Its parent chain will be coin b. In looking at the spec (https://en.bitcoin.it/wiki/Merged_mining_specification) and Dogecoin/Namecoin sources, I see that there is support for multiple merge-mined coins in a single coinbase payload. That's fine. I also see that I'm given a Merkle tree so that I can verify that my coin x's header's hash was in b's block. That's fine. Given that, what I don't understand is why I would care about x's slot in the Merkle tree in the specific case where multiple coins are being merge-mined. Why would I need to specify a chain_id? Why would I care if my data came back in a different slot than what I requested? Why even request a specific slot? In the Dogecoin codebase it verifies via getExpectedIndex (see https://github.com/dogecoin/dogecoin/blob/0b46a40ed125d7bf4b5a485b91350bc8bdc48fc8/src/auxpow.cpp#L153 ). How does that add to the security of this? Why not let the block creator put the merge-mined coins into a Merkle tree however it sees fit?

I discovered the answer in a blog:

it is necessary to make sure that a miner cannot mine on different
branches of the same child blockchain, as this conflicts with the
rules of the underlying Nakamoto consensus mechanism and would make
double spending attacks possible. Hence, each cryptocurrency must
specify a unique ID, which can be used to derive the leaf of the
Merkle tree where the respective block hash must be located.

Source: https://alexeizamyatin.medium.com/a-technical-deep-dive-into-merged-mining-5b67706e1a19


Rewriting the blockchain? The main bitcoin blockchain (the chain that miners choose to work on) is the chain with the most proof of work ("heaviest" chain). Currently, the cumulative proof of work on the bitcoin main blockchain is about 2^94 hashes.

I have a few questions here:

(1) How is the cumulative proof of work on a bitcoin chain calculated? Are they calculated by checking the timestamps (and thus the difficulty)?

(2) Let's say an adversary has an alien supercomputer he stole from Area 51. He uses this alien supercomputer to rewrite the entire bitcoin blockchain from the genesis block - by mining a private chain that is heavier than the current chain. Does the current bitcoin network have any method of defending against this kind of attack? (I know that checkpoints can prevent such an attack, but checkpoints are no longer in the current bitcoin protocol, as far as I know)

(3) What would be the consequences of a bitcoin blockchain rewriting attack? An instant crash in bitcoin price? Would bitcoin be essentially dead forever, or does the bitcoin network have a way to recover and go on?

There's no need to consider the timestamps in order to know the difficulty. The difficulty is stored in the blocks.
This is a bit speculative but in the past such threats have been discussed, more along the lines of the hash function being hacked, and I think in such cases there will be a large consensus to hard fork. If the hypothetical threat you're describing is basically an adversary with infinite free power then most like PoW would have to be abandoned. Let's worry about that we get there. ;)


Creating Mining Competition on regtest As we know ,  Bitcoin core-Regtest is used to set up our own blockchain starting from Genesis Block. I have created Two nodes on my localhost running on different ports (I am using Windows 8.1). They are connected to each other. Now I want to increase the difficulty level and create mining competition between two nodes.

I can manually use generate Number_of_blocks to mine that many Number_of_blocks on any node and It also includes my recent transactions which are not yet included in the blockchain while mining.

But how can have such an arrangement in which I will increase difficulty and start mining on both the nodes, and whoever comes first will broadcast the block and win the race.??

Any reference or step by step explanation would be much appreciated

Previous versions of bitcoin core included a miner, and you could use the RPC call setgenerate to activate it. However, this functionallity was removed on Bitcoin Core v0.13.0. In any case, this does does not seem to work on regtest (I have tried it with v0.11.1 and it returns a message saying to use generate instead).

Whenever I need to "simulate" nodes competing to mine in a regtest network, I define their mining power and randomly select which one of them is going to mine taking into account their defined mining power. Then, I send a generate 1 RPC call to the miner that has been selected.


Why is my /Library/Application Support/Bitcoin directory missing? I can't launch the latest update, now it just 'unexpectedly quits' before loading. I tried uninstalling and reinstalling a couple of the past versions, but the directory folder was never created. Strangely, the 0.7.2 version did actually launch, with the right wallet contents, but still no directory folder. When I tried going back to the most recent and the most recently successful version.. it still doesn't work. I even tried creating the folder myself before an install but it still didn't work. ANy suggestions?

Try going to your Local, User directory of the Library.

i.e. try this: ~/Library/Application Support/Bitcoin/

You'll see a path similar to this:

"/Users/myname/Library/Application Support"


Who gives SPV nodes merkle path to do validation for small subset of transaction? From Mastering bitcoin:
Merkle trees are used extensively by SPV nodes. SPV nodes don’t have all transactions and do not download full blocks, just block headers. In order to verify that a transaction is included in a block, without having to download all the transactions in the block, they use an authentication path, or merkle path.

Who gives SPV nodes merkle path to do validation for small subset of transaction?
Please share detailed flow.

The thin client requests the Merkle branch from any full node that has the complete block available. It is requested by specifying the inventory type MSG_MERKLEBLOCK, usually in response to learning that the bloomfilter served to the same full node had some positive results. The response includes the block header, the corresponding transactions and the hashing partners necessary to connect the transactions to the Merkle root.

You can find more details in the Bitcoin Developer Guide on MerkleBlock.


Can signature be re-used to cash out everything in the address? I Know for the P2PK locking script it was like this

[pubkey] <OP_CHECKSIG>

and then an unlocking script is provided as simple as this:

[sig]

But if it works like this, others can simply grab the [sig] and cash out everything in your address!

Is there some misconceptions I have?

When you sign the transaction with your private key, you include the hash of the entire transaction data as a message. This means the signature which is generated is specific to that transaction itself and any modification to the transaction will render the signature invalid. In this case, the user who has signed the transaction has already specified the address to which the bitcoins have to be sent. Any modification in the address will change the message digest, thus invalidating the signature.

Moreover, Bitcoin operates on an UTXO model rather than an account/address based model. Everytime you send bitcoins you consume previously unspent outputs in its entirety and create new unspent outputs. For example, let us say you have 1BTC UTXO. When you want to spend for a 0.1 BTC coffee, you will consume the entire 1 BTC UTXO, send 0.1 BTC to the coffee shop and 0.9 BTC back to yourself. This 0.9 BTC output is different from the 1 BTC output that you controlled previously.

In a transaction, these unspent outputs are specified in the transaction with the identifiers: txid and vout. After the user's transaction gets confirmed, the txid which was referenced in the previous transaction no longer remains unspent. Thus, it is not possible to re-use the same signature even if you are sending to the same addresses again.


I have a physical Bitcoin, how can I exchange it for dollars I aquired a Bitcoin back in 2013,can I exchange it for dollars at a bank.

There are a handful of people/companies who manufactured physical bitcoins, most notably Casascius.

If you have one of these, a little tamper proof seal should cover a private key. You can then import that private key into a wallet such as electrum, and send the bitcoin to an exchange where you can trade it for fiat, which will vary by your location.

If you do not have a bitcoin which contains a private key, then your physical bitcoin has no bitcoin value.


Manually doing what bitaddress.org does I want to create a paper wallet but want to do it manually.  I understand that bitaddress.org automates the process for you.

Do instructions exist which I can follow to do the same thing which bitaddress does to create a paper wallet?

If your familiar with javascript then I think the easiest way to go would be to check out https://github.com/bitcoinjs/bitcoinjs-lib . They offer a client side solution for generating bitcoin address info.  Theres a few examples in the readme as well.


Checking pending (not yet in the blockchain) transactions Is there a service (like Blockexplorer) that shows pending transactions that have not (yet?) been included in the block chain?

Even transactions with no confirmations will show in the results (unless the transaction has been sitting unconfirmed for some time and then the service stops tracking it):

http://www.BlockChain.info


Is it possible to run electrum without QT on Ubuntu? I want to run an electrum server and don't need the GUI. When I install it, I get:

ubuntu@comp:~$ electrum                                                                                qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

Which is because I don't have an X display, obviously. How can I install with pure command line?

If you want to run a server, you should run ElectrumX. electrum-server is deprecated.


How to sign a SegWit transaction via NBitcoin? Most tutorials out there just show how to sign it in the legacy way. And I know that NBitcoin already supports SegWit, so is there a snippet out there on how to sign it this way?

signing with Segwit is in no way different from signing with P2SH or P2PKH.

If you want interoperability, you need to use Segwit wrapped into P2SH. Please check https://programmingblockchain.gitbooks.io/programmingblockchain/content/other_types_of_ownership/ for more info.

But in a nutshell, if you want to have a P2WPKH-PS2SH (Segwit P2PKH wrapped into P2SH for interoperability), then query the coins based on this address.

[Fact]
[Trait("UnitTest", "UnitTest")]
public void CanGuessRedeemScriptWithInputKeys()
{
    var k = new Key();

    //This gives you a Bech32 address (currently not really interoperable in wallets, so you need to convert it into P2SH)
    var address = k.PubKey.WitHash.GetAddress(Network.Main);
    var p2sh = address.GetScriptAddress();
    //p2sh is now an interoperable P2SH segwit address

    //For spending, it works the same as a a normal P2SH
    //You need to get the ScriptCoin, the RedeemScript of you script coin should be k.PubKey.WitHash.ScriptPubKey.

    var coins =
        //Get coins from any block explorer.
        GetCoins(p2sh)
        //Nobody knows your redeem script, so you add here the information
        //This line is actually optional since 4.0.0.38, as the TransactionBuilder is smart enough to figure out
        //the redeems from the keys added by AddKeys.
        //However, explicitely having the redeem will make code more easy to update to other payment like 2-2
        .Select(c => c.ToScriptCoin(k.PubKey.WitHash.ScriptPubKey))
        .ToArray();

    TransactionBuilder builder = new TransactionBuilder();
    builder.AddCoins(coins);
    builder.AddKeys(k);
    builder.Send(new Key().ScriptPubKey, Money.Coins(1));
    builder.SendFees(Money.Coins(0.001m));
    builder.SetChange(p2sh);
    var signedTx = builder.BuildTransaction(true);
    Assert.True(builder.Verify(signedTx));
}

Nicolas,


Is it possible to create pure lightning lockboxes (without touching the blockchain)? I'm considering a scenario in lightning, where it would be extremely useful to be able to lock the funds in 2/3 lock

Is this possible on lightning network (even in theory)?

I am not sure if I understand your question right. Do you want to have a 2 out of 3 multisig wallet? Theoretically this is very possible. Though practically this will be quite combersome. I guess the best way to achieve this would be to wait for BIP 118 to be activated and then the eltoo upgrade. This would easily enable multiparty channels. This could be used to achieve a scenario as you described.


Does the block reward comes from a bitcoin treasury? If yes, then how is it issued? The miner adds the relevant block reward to himself (i.e. 12.5 bitcoin as of now) in something called the coinbase transaction.

Where do these 12.5 bitcoins come from? Does it comes from bitcoin treasury? If yes, then how is it issued?

Could I get a less-technical and self explanatory answer please?

Note that my question is not sufficiently answered on Where does the money I get from mining bitcoin come from? which was suggested as a potential duplicate.

There is no treasury. The Bitcoin is generated out of nothing. The coinbase transaction has special rules. It is allowed to have only one input which has no previous output and really no value. It is allowed to create outputs which have a total value of the block subsidy (currently 12.5 BTC) plus the transaction fees from that block. Those coins aren't issued by any entity; the miner just creates the output(s) and is allowed to do so. This rule is enforced by all of the full nodes on the network who will reject that miner's block if he pays himself too much money.

Simply put, the miner is allowed to just pay himself money that is produced out of nothing.


How is the Bitcoin transaction fee calculated for small transactions I tried to send 0.001 BTC with Bitcoin-Core, but for some reasons it charged me with a transaction fee of 0.00145271 BTC:

$ bitcoin-cli getinfo|grep balance
"balance": 0.03312022,
$ bitcoin-cli sendtoaddress my_bitcoin_address 0.001
$ bitcoin-cli getinfo|grep balance
"balance": 0.03066751,

Is there any way to know which fee am I going to pay before sending the transaction?

You can use bitcoin-cli estimatefee to estimate the fees required, and settxfee to set it.  It's usually a bit trickier on the command line, a GUI wallet should show this information before you make the transaction though.


Wallet recovery phrase Due to a copying error the last word of my 12 word mnemonic recovery phrase for blockchain is missing.

Just wondering if anyone knows of any software that could generate words and automatically test them out to see if they work?

Cheers!

You can do this with the seedrecover.py script in btcrecover

You will need to have the master public key (xpub), a receiving address generated from the seed, or an addresses database.  seedrecover.py will then check all the seed variations to see if they derive the specified key or address.


Other ways to determine the validity of a public key Public key 3, 4 fits the equation of y^2 = x^2 + 7

Yet this comes up as an "invalid public key".   How is that invalid?  Sure, it deviates extremely from other numbers, but what other equations are being applied to the public key to determine its validity?

You got the formula wrong.

The correct formula is

y2 = x3 + 7 mod N

where N is a very large prime.


What are the requirements for a ScriptPubKey to be valid? Can they have arbitrary scripts, as long as they are under a certain length?

In theory they can have any arbitrary script. In practice, only a handful of scripts are considered standard and will be relayed on the network: pay to pubkey, pay to pubkey hash, null data (op_return), pay to script hash and raw multisig.


How to restore Multibit HD keys using cloud .zip.aes files weird thing happened to me. I kept backup in cloud under Dropbox/bitcoinz. I can see many mbhd-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.zip.aes files, I also have wallet words but when I try to restore old wallet after fresh install on new pc, I enter the words and select coud backup filder, it says that no backup files were found.

But they are there, present.

So I clicked on ok, window disappeared and new wallet opened. I entered my password (the one I used with old backuped wallet), it got accepted and bitcoin started to sync.

But when it finished, it showed 0 BTC. And moreover, I found nowhere again the option, to restore from cloud backup .zip.aes files.

What happened here? How to restore bitcoins using wallet words and online backup?

Thanks

If you have your seed words, I would suggest giving up on Multibit and either using "Simple Bitcoin Wallet" or "Breadwallet", apps for Android/iOS - other users are saying they are able to retrieve their Bitcoin using their previously MultiBit-managed Bitcoin holdings by simply importing their seed words. If you get this to work, please let me know.

MultiBit has been discontinued as a supported product and hundreds of users are having these problems.


Can any current consumer grade computers mine any alt coins? I'm interested in mining and would like to know if there are any consumer grade computers available that can mine any of the alternative coins. If so, what computers and which coins do you think would work fairly well?

As mentioned almost any is able to mine coins - the question just arises about profitability.

There are some mining pools, that offer to switch the coin mined automatically depending on which coin is the most profitable at any point in time.

Examples of those pools are:

Multipool.us
Middlecoin.com


How are UTXOs handled in Ledger Live? Take this Bitcoin transaction:

https://www.blockchain.com/en/btc/tx/bad181b4bf50342e5226982ac5031d8b9ce670053d3b5c7502b0ff349a5f2838

In my Ledger Live, I can see that 0.3881168 BTC left the wallet:

Which is weird, because I actually sent only 0.3878 BTC to 16fPHhrdaBuRNPH1YbEqC4fDE8tCUXNmuM, with the remainder 0.00065121 BTC being one of my newly created UTXO whose value was credited back to my wallet.

Why does Ledger Live not show the actual spent amount but instead the gross amount which is the sum of all used UTXOs? How can I only see the spent amount?

Silly me. I figured it out right after I posted the question.

Ledger Live shows the sum of the following:

Actual spent amount
The transaction fee

In my case, this is:

0.3878 BTC
0.00031680 BTC

Which is indeed equal to 0.3881168 BTC. I first got confused by this value because I subtracted 0.00065121 BTC (my newly created  UTXO) from 0.38876801 BTC (total input), but this is just a natural mathematical equivalence.


What % of the network will mine multi-sig transactions where n > 3? I'm trying to determine how likely it is for multi-sigs with n > 3 are to be mined.  Whether this is a sub-set of miners (say 10%) or if you need to relay them to some specific nodes.

For plain multisigs, as far as I know only Eligius will mine transactions with n>3 as they're non-standard (so not relayed).

That being said, multisig is now usually done using pay-to-script-hash. In this case, the only limit you're facing is the maximum length of the scriptSig which is 1650 bytes. If you do the math, you can go up to n=15 safely in that space.

TL;DR Up to n=15 in a P2SH, stick to 3 otherwise.


What are spent transactions? Satoshi's paper says:

  Once the latest transaction in a coin is buried under enough blocks,
  the spent transactions before it can be discarded to save disk space.

What are spent transactions?

Balances in Bitcoin are stored in Unspent Transaction Outputs utxo. UTXO can be used as inputs when a transaction is created. They can only be spent completely, while the resulting transaction creates new ones in the process, redistributing the balance to the recipients of the transaction. Spent transactions refers to Transaction Outputs that have been expended.


How long does it take to Sync my Litecoin Core Wallet? I transferred litecoin from Coinbase to my LTC Wallet. I downloaded the wallet from Litecoin.org and it says it has to sync first before it can accept the transfer. Currently, it says that it is about 2 days to Sync. Is this the standard tome for the first time I install the Wallet or will this be every time?

As always thanks to the group.

You are downloading the whole LTC Blockchain, hence the reason. I have the same issue taking ages to sync. Once downloaded, it wont take this long.

I guess you can look at other options, such as electrum LTC for your wallet.
Do you have your private key for the LTC to move your wallet around!


Do you have to be a node to use the Lightning Network I am new to the use of the Lightning Network and had a question.

To run a bitcoin node, one would need to start btcd. What would one need to run for a Lightning Node? One can specify the port a Lightning Node runs on as well - right?

Also, when a channel is opened, between 2 entities, must each entity be a Lightning Node?

For example, Bob wants to buy a coffee from Starbucks on 9th Street.

To open a channel, Bob's wallet needs to run a Lightning Node - and - the Starbucks on 9th street must also run a Lightning Node?

TIA

Yes.  In order to be a part of a network, you need to be a part of the network.  This is the same as with Bitcoin...or even the internet in general.

However, it is perfectly possible for someone to run a node on your behalf.  This is the same as how a web wallet operates.  Some service runs one (or multiple) nodes on the Bitcoin network, and then provides you with a web interface and an account such that you can interact with the network without running your own node.  This is similar in concept to printing out your grandmother's email for her to read without requiring her to touch a computer.  Yes, she can still send and receive email, but with someone else operating the network node.


Does the public key associated with an address become part of the public record after it has been used to spend? Since bitcoin addresses are hashes of public keys and not public keys as such, if one wanted to craft a message that could be decrypted by the generator of an address, that can't be done just with an address. But after the generator of an address has spent something that was received there, which requires presenting the public key (or does it?) publicly, is that public key part of the public record so it can be used for direct message encryption?

And is there a standard way to perform such message encryption, analogous to opaque PGP blocks, and supported by UI panels in bitcoin-qt where one can paste blocks of plain (with intended recipient) or ciphertext (directed to one of one's own addresses) and see plaintext or a copyable opaque block?

You're right that public keys are generally unknown until coins are spent from their address, and that until coins are spent only a hash of the public key is published.

While it's technically possible to use bitcoin public keys for the kind of encryption you're imagining, you're the first person I've seen talking about doing so.  The satoshi client has an interface to allow users to sign messages using their private key which others can verify using the associated bitcoin address, but using public keys to encrypt messages which only the holder of the private key can decrypt is something I've never seen.

Notice that signing a message with your private key in the satoshi client includes the corresponding public key in the output signature.  This allows the recipient to verify the message.  It's possible that otherwise they wouldn't know the public key, having only the corresponding bitcoin address.


What is the rationale for the Lightning network's path length limit (20 hops)? A sender in the Lightning network can choose a path with up to 20 intermediaries (BOLT4).

Tor is another network that uses onion routing for anonymity. However, in Tor all paths have 3 intermediaries, and longer paths are explicitly advised against (source 1, source 2). The sources make a point that attacks mostly rely on compromising the first and the last nodes, and increasing the number of nodes in between doesn't improve anonymity, but increases latency.

Do similar arguments apply to Lightning (maybe for path of slightly higher lengths but still under 20 hops)? Where does the number 20 come from? Would it be a good idea to decrease it?

The onion routing in Lightning is based on the Sphinx Mix Format described in this paper. The situation is different from Tor

We don't have entry and exit nodes in Lightning as all nodes are inside the Network.
In Tor a new connection along the path is as easy as creating a TCP socket between the tor routing nodes. In Lightning a payment channel with enough liquidity would have to be available and can't be spawn instantaneously.

The latter argument already calls for longer paths as nodes cannot just ask routing nodes to make certain hops. (That might change though if the trampoline network is coming to Lightning with which your Tor argument might hold.) Let us additionally assume I would always have paths of length 3 in Lightning. A routing node would basically see who paid whom as there are the incoming and outgoing HTLCs.

The main reasons for the Sphinx packet to be 20 hops are - as far as I understand - the following:

The per hop data is 65 Byte and with 20 hops it will always fit into a small TCP/IP package giving no clues for traffic analysis and timing attacks.
We assume that the Lightning Network will still somehow be a small world network with a rather small diameter, so 20 hops should be sufficient.


How would Bitcoin's purchasing power be measured after fiat were gone? Somewhere in the possible near/far future when there might not be any major fiat anywhere. What will Bitcoin's purchasing power be measured in?

It's typical to measure the purchasing power of currencies using something like the Consumer Price Index, so this is probably would be used if Bitcoin were to become a dominant currency.

Basically, you would develop a "market basket" of goods and services that people commonly buy, and perform some sort of survey to determine what these goods and services currently cost  (in Bitcoins).  Then take some weighted average to come up with a single number that, roughly speaking, measures the overall Bitcoin price of goods, or equivalently, the purchasing power of a bitcoin.


How to 'pick' transactions to include when attempting to add a new block? I saw this question about finding new transactions.

But how do you pick which transactions to include in the block you're trying to add? Should it be in a certain order, or random? How many transactions should you include? Looking at the blockchain I've seen anywhere from just a few, to hundreds. Is the number of transactions something you'd vary when pool-mining to combat exhausting all possible nonces if up-to-date with the timestamp header? (Loosely related to my other recent questions).

Basically, you can include whichever transactions you'd like.

Currently most miners simply include all valid transactions they know of. It is cheap to do so.

There is currently a limit of 1 MB per block, so as transaction volume reaches these levels, miners will typically want to include transactions that have the best ratio of fee / data size.

As a more mature transaction fee framework evolves, miners will choose transactions to optimize for it.

Playing with transactions included is not needed to extend your work scope, as you can extend it indefinitely by changing the extraNonce.


How to broadcast a new block When i mine a new block on my pc, how can i broadcast it to other peers, making it included in the blockchain and getting my reward?

Is there any API that provides a function like "sendBlock" or something?

I'm asking it for bitcoin and any other criptocurrency. Ty

What i was looking for is submitblock RPC call.


Will the upcoming block size increase be more profitable for miners, or less so? According to the article US vs. China: The 20 MB Miner War That Could Destroy Bitcoin (Op-Ed) critical decisions are about to be made regarding the size of Bitcoin blocks. Will this cause mining to be more profitable or less?

the linked article is regarding the change of maximum block size from 1MB to 20MB. as you can see in this graph from blockchain.info, blocks have not yet reached the maximum of 1MB:

blocks are yet to go above 0.55MB, so its really not as urgent of an issue as the article makes out.

eventually though, there will be enough transactions on the bitcoin network to fill up more than 1MB and at that point miners will create blocks bigger than 1MB.

in terms of mining effort, the algorithm is identical when hashing (mining) a block with 1 transaction in it or when hashing a block with 1 million transactions in it. this is because the hashing is conducted on the block header which contains a merkle root of all transactions. sure it would take a bit longer to calculate a merkle root for 1 million transactions than it would for a single transaction but both would still take less than 1 second though.

another concern in the article was that the internet bandwidth in china might not be high enough for miners to receive enough transactions to put into a block. firstly i don't think this is a realistic concern - bitcoin blocks are mined on average once every 10 minutes, and i struggle to believe that the internet is so slow in china as to not allow downloading 20MB in 10 minutes. but even if this were a problem, it would just mean that the blocks mined (on full nodes) in china would have fewer transactions than blocks mined elsewhere. the new 20MB blocksize will just be an upper limit - it is not a requirement for all blocks to be 20MB in size! and secondly, transaction fees do not currently make up a huge percentage of the mining reward anyway, so even if bandwidth were a concern the difference in payout would be negligible. for example, the current block reward is 25btc (us$6014) and the contribution due to transaction fees for the latest 3 blocks has been:

361188 - 0.12673848 btc = us$30.49
361187 - 0.23697908 btc = us$57.01
361186 - 0.19895231 btc = us$47.86

(at the time of writing this 1btc = us$240.59)

by 2032 we will reach a block reward of less than 1btc (0.78125btc to be precise) so transaction fees will matter by then. but i would be very surprised if downloading 20MB in 10 minutes will be a problem for any full-node miner at that point in time.

the final thing to note is that miners in china need not be full nodes. they can always keep their full node somewhere with faster bandwidth (eg hong-kong) and then just transmit the 32 byte merkle root to the miners in china every time it gets updated with new transactions. this is virtually nothing, and given that its possible to have a phone conversation with somebody in china from the west then it should definitely be feasible for mining.


How to fix Bitcoin QT loading issue A few years ago my Bitcoin QT wallet stopped working and error messages started popping up

The error reads:

  Assertion Failed!

  Program:... File: src/main.cpp Line: 1127 Expression: pindexFirst

  For information on how your program can cause an assertion failure,
  see the Visual C++ documentation on asserts (Press Retry to debug the
  application - JIT must be enabled)

How can I fix this? Is this wallet now obsolete?

This issue may be related.

The suggested fix is to start bitcoin-qt with the reindex option. To do that you'll need to start it from a command prompt and use:

bitcoin-qt.exe -reindex

Of course make sure you take a copy of your wallet.dat file and put it somewhere safe.

You could also try updating to the latest version of Bitcoin Core and then copy your wallet.dat file into the data directory BUT the wallet format may have changed in the interim which could prevent it from opening.


I have received 0.00000001 BTC random payment and the status symbol is a pentagram? I have received 0.00000001 BTC random payment and the status symbol is a pentagram? Am I being used to tumble someone's stolen coin there are a lot of other wallets in the transaction?

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