How can I safely store and trade Bitcoin and other crypto currencies?

There are several ways to store cryptocurrencies, so let's break them down by use-case and safety-level.

Exchanges

There are, broadly speaking, two types of exchanges. Centralized exchanges, such as Bitfinex, Bittrex, Kucoin, etc., and decentralized exchanges such as Etherdelta and Switcheo.

Trading on a centralized exchange requires you to deposit cryptocurrencies before you can trade them.  In this regard, they function as custodial services, and thus come with a very high level of risk.  If the exchange operators steal your coins, or if the exchange gets hacked, your funds may disappear, and there may be very little you can do to get them back.

In general, one should only store coins that they are actively trading on an exchange.  To reduce the risk of loss via theft or fraud, balances that are not being actively traded should be withdrawn to one of the wallets described below.

Decentralized exchanges are less risky, as they allow you to deposit coins as part of your trade, and the proceeds from a trade will typically go directly to your wallet.  However, certain risks still exist, such as:

The site acting as the front of the decentralized exchanges could be compromised, and work to steal your keys
perhaps the contract is a scam and will take your incoming coins, and not pay out the proceeds of the trade.

These risks can be reduced by:

Using a temporary wallet for trades
Only storing coins you are trading in that wallet
Ensuring that you are using the correct decentralized exchange (check the domain, check the contract address).

Personal Wallets

Personal wallets also come in a number of flavours.  We will break them down into three broad categories:

Hosted Wallets
Local Hot wallets
Cold storage, or offline wallets

Hosted Wallets

Hosted wallets, such as exchange wallets, do not give you direct access to your keys.  If the service is down, compromised, or shuts down permanently, you can no longer access your coins.  Do not use a hosted wallet unless you are using another service offered by that company, such as trading.  Ensure you withdraw your funds to a more secure wallet when you complete your exchange business.

Local hot wallets

Hot wallets, in general, refer to wallets where the keys are stored on an Internet-connected computer.  They are designed to quickly process outgoing transactions.   Many services offer a hybrid hosted-hot-wallet, such as btc.com and blockchain.info.  The provider of a hosted-hot-wallet will provide you seed words or private keys which can be used to recover your coins if the service goes down.  Hosted-hot-wallet services also offer ways to easily access your wallet, such as a regular email/username/password account system, mobile apps, 2FA, etc.

Hosted Hot wallets come with several risks.   You must trust that:

the initial key generation is not backdoored.
they are not storing unencrypted copies of your keys.
they will not steal your funds when you are using their web interface/mobile apps, which would naturally need access to your keys to make any transactions.

You are also vulnerable to phishing attacks for the account credentials, domain takeovers, and hacks of their systems, which may be compromised and made to serve malicious versions of their apps that would steal your keys or otherwise drain your accounts.

Many people use these services for their ease-of-use, and a number of (so far) reliable ones exist.  Always be careful when using such a service, and follow basic security measures such as ensuring you use strong passwords, enable 2FA, confirm the website address is correct, use a trusted computer to access the service, etc.

Some hot wallets, such as Bitcoin-qt, Electrum, etc., allow you to run them locally on your own computer. These wallets generate and store keys on your computer, and will typically only require a password to unlock the wallet. They do not rely on centralized servers, and instead may either connect directly to the bitcoin P2P network (or the network of your altcoin), or to second layer P2P networks such as Electrum servers.   While generally more secure than a host hot wallet, these have risks such as :

your computer being compromised and the keys stolen
downloading a malicious version of the wallet client that gives you non-random keys, or steals keys after generating or importing them.

To avoid such attacks, you should only use a trusted computer, and verify the signature and hashes of the wallet client software after downloading it.

Cold storage

Cold storage refers to the most secure type of wallet where the keys are not stored on an Internet-connected computer.  There are essentially two types of cost storage wallet; paper, and hardware.

Paper wallets usually just consist of a private key and public address printed out or otherwise stored on a physical medium that is not connected to a computer or the internet. Creating the private key and public address, in an ideal scenario, would use a peer-reviewed, vetted bitcoin address generator on an air-gapped, recently formatted, trusted computer with a cryptographic-quality random number generator. These requirements are occasionally difficult to meet, but are doable by most people given enough effort. Once generated, coins can be transferred to the address, and the private key can be stored on a piece of paper or a flash drive, or inscribed in a metal sheet, and then stored somewhere physically safe, such as a bank vault, home safe, or even split up into pieces and stored in multiple locations.

These wallets are typically extremely safe, since if generated correctly, they are impossible to compromise without physically compromising the location where the private key is stored. However, they are cumbersome to use, as the key must be physically retrieved and imported into a software wallet before a transaction can be signed.  The signing itself can be done on an offline computer to minimize risk, with the signed transaction verified and broadcast by a separate, online computer.

Offline wallets are typically used to store coins for a long time, without the intention of regularly spending them.  Coins can be sent to the paper wallet at any time without retrieving or using the private key.

Hardware wallets, such as the Ledger and Trezor, are newer takes on cold storage. These are essentially tiny computers than generate and store the private keys, and sign transactions on the device itself. You use them by connecting them to a computer, which then passes an unsigned transaction to the device. The device will then display the amount and destination, and attach the signature after you confirm the details are correct. The signed transaction is then sent back to the computer, and the private keys never leave the device.

The attack vectors here are limited to:

a device flaw
stealing the device + pin
stealing the seed words for the device (make sure you keep these very safe)
tricking someone into signing a transaction without verifying the outputs.

The wallet devices themselves are currently considered quite safe (although an attack was recently demonstrated and patched by Ledger).  Provided you choose a strong PIN and store the seed words safely, hardware wallets are the safest, most user-friendly way to store cryptocurrencies, offering a large advantage over hot wallets and exchanges, and even paper wallets in terms of ease of use.  However, hardware wallets currently do not support all cryptocurrencies, and one may have to resort to paperwallets + hardware wallets to cover their entire portfolio.

General Advice

This advice applies no matter what wallet you opt for, and extends to general computer security as well

Use a trusted computer - Make sure you don't install any untrusted programs that may contain keyloggers or other malware.  If paranoid, get a separate computer for crypto use, and format it regularly.
Verify the hashes and signatures of any clients you download.  All trustworthy crypto software comes with known-good hashes published on the website along with the download links, and often with signatures from trusted developers/community members.  Verifying these hashes and signatures helps ensure the program you downloaded was not been tampered with.
Check where you are downloading a program from - Make sure it is the official site, as many phishing clones exist. Check the domain for character swaps (l instead of i, etc.), check the extension, make sure it uses https, and use a computer you trust.
Use strong, random passwords/PINs for wallets and accounts - Get a password manager, no other way to say it really.
Enable 2FA everywhere you can.  Ideally, use time-based 2FA where available, instead of SMS-based ones, and use a device you trust for saving the 2FA codes.
Always verify the transaction address and amount before sending.  Malware exists that will silently change a crypto address after you copy it, and before you paste it into the wallet.  Verify the address before sending.  Many wallets, such as hardware wallets, Bitcoin-qt, Electrum etc. offer a preview function before signing or broadcasting the transaction. Use this feature to ensure the address and amount matches what you entered.
99.999999% of the time, anything that offers you free BTC, offers to mine BTC for you, offers to double your coins, etc. is a scam - Don't fall for it.
Make backups of your seed words/wallet files and verify them.  Computers or hardware wallets can break, and having a backup is essential.  Hierarchical Deterministic wallets, aka HD Wallets, allow you create a long-lived backup that can restore addresses and keys generated after the backup was taken.  Non-HD Wallets, such as bitcoin-qt in non-HD mode, must be backed up every time you generate a new address.  If you restore an old backup from a non-hd wallet, you will lose the value of cryptocurrencies received after the backup was created.


Does P2SH validation create a second stack using a copy of the redeem script, and then validate that stack before moving on to deserializing the redeem script (and then validating that script as normal)?

Kind of. It really isn't a second stack but rather a copy of the original stack. Once the scriptPubKey execution is completed, the original stack before scriptPubKey execution is restored and then the redeemScript is executed.

The flow is something like this:

Execute scriptSig which creates stack
Copy stack to stackCopy
Execute scriptPubKey using stack
If P2SH, replace stack with stackCopy
If P2SH, Pop top item off of stack and execute as redeemScript using stack


Try changing it to rpcallowip=192.168.0.0/24. Wildcard support was removed from bitcoind, more on reasoning here:

https://github.com/bitcoin/bitcoin/pull/4102

rpcallowip=192.168.0.0/24is CIDR notation that is functionally the same as 192.168.1.*.


Bitcoin - differences between address, account and wallet

"Accounts" are a concept limited to bitcoin-qt, and it's probably better to forget about them entirely.

Each address has a corresponding private key, that you use to move bitcoin out of that address. A wallet is simply a collection of (address, address_key) pairs.

Some people also use the term "wallet" to refer to the software that implements the wallet functionality.

Obviously, this is a grossly simplified answer, and not strictly true, but useful if you just want to understand bitcoin superficially.


How is all this bitcoin theft happening?

There are many ways theft can occur.

Even though the cases where hackers have stolen from exchanges or from individuals, in terms of the number of bitcoins lost that amount is chump change compared to the amount of coins lost to scammers such as PirateAt40 and other scams, including loans not being repaid or currency trades that go bad.

But as far as bitcoins lost to hackings, yes -- the thefts have been due to poor security practices being implemented by exchange operators and other businesses where an attacker takes advantage of that to steal funds.

The list of the top thefts in which these hackings includes some of the details for various incidents.

Security is difficult and expensive, and Bitcoin startups generally don't have the revenue and profits sufficient to attract the capital that would allow top-notch security to be implemented.  As a result, they become juicy targets for the attackers.

Even following the recommendations for securing online services does not ensure that there is no risk of theft, but most losses from theft thus far were because those recommendations weren't followed.

As far as the term "cracking" ... that generally refers to discovering passwords.  In June 2011 when an attacker obtained the list of accounts and password hashes from Mt. Gox, cracking was able to discover passwords for many accounts due to there having been poor security on the password hashing method implemented by Mt. Gox at the time.  Most Bitcoin-related service operators are smarter than that but that incident has helped any that weren't to become a little more aware of proper password security methods (e.g., BCrypt).

Password cracking might also be used by an attacker to gain access to a system which which may hold coins in an unecrypted wallet, or that breach may lead to credential that provide access to additional systems which hold coins in an unencrypted wallet.

The reason hackers are successful when compromising these server systems used by exchanges and other bitcoin businesses is because if software needs the ability to send outgoing payments then the attacker who has compromised the system then gains that same capability.  Even if the wallet is encrypted, the software would use the passphrase to unencrypt it so either the Bitcoin client is responding to requests after the passphrase has already been provided or the passphrase is avaialble to the software to make such requests.  And thus if that system is compromised there is no protection possible for those coins in the wallet on that system.

For this reason, any exchange or bitcoin business using hosting for their systems where the hosting service has any access to the hosted service whatsoever, those coins are at risk.  But most Bitcoin businesses are not at the scale necessary to justify proper security at data centers (e.g., using their own hardware colocated in locked cages in highly secure facilities).

Even with that, that is just the security for the hot wallet containing a fraction of the service's bitcoins needed for daily operations.  Security for the offline wallet might involve using paper wallets stored in bank vaults, or access protected with Shamir's Secret Sharing method even.

Much more common than breaches of security at Bitcoin exchanges and services are compromises of individual EWallet accounts at these online services.   This often happens when an individual shares a username and password for their exchange account with another service.  For instance, after the Mt. Gox passwords were leaked, other exchanges went on lockdown because so many accountholders had common login credentials on both services.  A protection against that is for the exchange to offer multi-factor authentication.

Individual users of the Bitcoin.org client can protect their wallets with passphrase encryption.  This still leaves them vulnerable to a replay attack should their system be compromised with a keylogger or similar malware.  For this reason, offline/cold wallet and "air gap" systems are recommended when the amount of bitcoins held are significant.  A similar recommendation exists for online banking, so compromised systems aren't specific to Bitcoin users.


Let's start from looking at electrum's wordlist (same as BIP39 english). From your example words:
weary
unseen
dude
muse
sent

don't exist in this wordlist. There are dune, museum, wear and sentence. Unseen isn't close to any of the words. If the author of the post provide mnemonic in the form of number it may be possible to calculate, from seed there is no way of getting the mnemonic (it's a HMAC function) and confirming his claim.


generate HD addresses using publicKey Bip44

Any derivation path with an apostrophe (') signifies that that index should use hardened derivation. Hardened derivation means that you can only use the master private key. So with just an xpub, you cannot derive the full path.

Usually what happens with BIP 44 is that you generate a master private key, derive the keys for the hardened parts of the path, and then use the public key of the last hardened part to derive the addresses using non-hardened derivation.

So you would derive the private key for m/44'/0'/0' using the master private key. Then take the xpub of that derived private key and derive the remaining keys with path m/0/i.


Why is Bitcoin gaining value while so many other cryptocurrencies are not?

There is this classic bootstrapping problem. To make a successful cryptocurrency it needs:

Miners (so that it's secure)
Users (to attract miners, users also want it to be secure)
Value (to attract users and miners)

So new cryptocurrencies need to find a way to jump-start all those things at the same time, which it turns out- is not easy.

Here's a great description of it from Bitcoin and Cryptocurrency Technologies by Arvind Narayanan, Joseph Bonneau, Edward Felten, Andrew Miller & Steven Goldfeder:

Getting a cryptocurrency off the ground

Another subtle concept is that of bootstrapping. There is a
tricky interplay between three different ideas in Bitcoin: the security of the block chain, the health of the mining ecosystem, and the value of the currency. We obviously want the block chain to be secure for Bitcoin to be a viable currency. For the block chain to be secure, an adversary must not be able to overwhelm the consensus process. This in turn means that an adversary cannot create a lot of mining nodes and take over 50 percent or more of the new block creation.

But when will that be true? A prerequisite is having a healthy mining ecosystem made up of largely honest, protocol‐following nodes. But what’s a prerequisite for that — when can we be sure that a lot of miners will put a lot of computing power into participating in this hash puzzle solving competition?

Well, they’re only going to do that if the exchange rate of Bitcoin is pretty high because the rewards that they receive are denominated in Bitcoins whereas their expenditure is in dollars. So the more the
value of the currency goes up, the more incentivized these miners are going to be.

But what ensures a high and stable value of the currency? That can only happen if users in general have trust in the security of the block chain. If they believe that the network could be overwhelmed at any moment by an attacker, then Bitcoin is not going to have a lot of value as a currency. So you have this interlocking interdependence between the security of the block chain, a healthy mining ecosystem and the exchange rate.
Because of the cyclical nature of this three‐way dependence, the existence of each of these is predicated on the existence of the others. When Bitcoin was first created, none of these three existed. There were no miners other than Nakamoto himself running the mining software. Bitcoin didn’t have a lot of value as a currency. And the block chain was, in fact, insecure because there was not a lot of mining going on and anybody could have easily overwhelmed this process.

There’s no simple explanation for how Bitcoin went from not having any of these properties to having all three of them. Media attention was part of the story — the more people hear about Bitcoin, the more they’re going to get interested in mining. And the more they get interested in mining, the more confidence people will have in the security of the block chain because there’s now more mining activity going on, and so forth. Incidentally, every new Altcoin that wants to succeed also has to
somehow solve this problem of pulling itself up by its bootstraps.


How does the U.S. government view Bitcoin? Is it money?

The U.S. government views Bitcoin as a commodity, kind of like gold.

If you buy Bitcoin at one price in dollars, and sell it at a higher price in dollars, you will have a gain (in dollars), that you will have to pay tax on.

If you buy some Bitcoin (using dollars), and then use the Bitcoin to buy a car, you have made a "two stage" purchase of a car. (If you then re-sell the car for dollars, you may have a taxable gain if the dollars you receive are more than the dollars you used to buy the Bitcoin that you used to buy the car.


Is it possible to use bitcoind as a private blockchain?

When run with no arguments, all Bitcoin Core programs default to Bitcoin’s main network (mainnet). However, for development, it’s safer and cheaper to use Bitcoin’s test network (testnet) where the satoshis spent have no real-world value. Testnet also relaxes some restrictions (such as standard transaction checks) so you can test functions which might currently be disabled by default on mainnet.

To use testnet, use the argument -testnet with bitcoin-cli, bitcoind or bitcoin-qt or add testnet=1 to your bitcoin.conf file as described earlier. To get free satoshis for testing, use Piotr Piasecki’s testnet faucet. Testnet is a public resource provided for free by members of the community, so please don’t abuse it.

https://bitcoin.org/en/developer-examples#testing-applications

If you need absolutely private network - just made it. Run a few clean wallets on few computers, generate bitcoins and so on.. It will be incompatible with bitcoin network, but will be completely functional in your private local network.


Can bitcoin be forked in such way that the monetary base increase?

Yes. It's possible to do that in a not backward compatible fork (hardfork).

Assumed that the new currency would be bitcoin50 (B50):

You could copy the whole Bitcoin-blockchain (as in every hardfork) but only modify (increase) the future block rewards so that there are around 50,000,000 B50`s available when the reward is 0 in ~100 years.


If you have the master private key for an HD wallet, then software can easily generate derivative addresses, and check the balance of those addresses against the UTXO set.

  am I supposed to keep generating addresses and check every single one to see if it has any balance?

Wallet software will have a set number of addresses it generates and checks for a balance upon wallet initialization (maybe 50? this will vary and is configurable in some software). The wallet will probably include some logic like "look 50 addresses past the last used address found". You can design this to fit your need, for example if you were a merchant accepting payments on a busy website, you might need a higher bound, in case 50 customers in a row generate a payment address but then don't complete checkout.

  Are you supposed to store both the master key and the addresses that you generate to receive payments?

The wallet software will do this for you, but ultimately you do not need to explicitly keep a list of every private key / public address derived from your master key in order to access your funds later. If you have the master private key saved you will be able to recreate all derived keys from it.


Public Key / Private Key Generation in a bash script (osx / ubuntu)

https://en.bitcoin.it/wiki/Vanitygen is a software which will generate BTC address keypairs at the command-line. Its main purpose is actually to generate "vanity" addresses which contain pretty custom strings, but if you run it as follows then you will get a continuous output of many random public-private pairs: ./vanitygen -k 1 (remove the -k to generate only a single pair rather than continuously generate). I have used these addresses in my testing (sending small amounts), and have always found the private-key to be successfully importable and usable in a wallet. I have personally run vanitygen on ubuntu precise and mac os x mt lion.


Bitcoin Friday is an event coordinated by some of the biggest Bitcoin sites, including MtGox, BitInstant and SatoshiDice to bring big discounts to Bitcoin users on their sites. The event will take place on Friday, 2012 11 09.


Where is the code of chain reorganization in Bitcoin Core

Block tree is stored on-disk. During startup, is read into memory. When read, BlockManager::m_block_index field is filled with data - CBlockIndexes. Every CBlockIndex contains memory-only field arith_uint256 nChainWork, which is a total amount of work in the chain up to (and including) current block.

Best chain is selected as maximum among all nChainWork of all tips and saved to CChainState::m_chain - currently active chain.


Sync bitcoin transaction status to local database

Since you aren't running your own node, the best way would be to simply check each new block for your transaction. Since transactions can only be mined if a new block is generated, you don't need to poll for a status chain between blocks.


Do public bitcoin nodes have a public page to view node data? And if so can one add additional information to it?

No, there is no such thing.
Bitcoin nodes in general only speak the P2P protocol with the public, not HTTP.


Is this an arbitrage opportunity?

You also need to consider the exchange rate between the two currencies to determine if this truely is an arbitrage opportunity.

1 British Pound currently buys 1.39 US Dollars1 whereas the transfer via BTC using the figures you have quoted yeilds 1.724823486 times.

This is indeed an arbitrage opportuniy if you can buy BTC in British Pounds and sell them for more US Dollars, provided you have some British Pounds to buy them with initially (and allowing for any additional cost of buying them, and the transaction fees).

If you can instantly buy and instantly sell this is possibly (the disclaimer) a large opportunity.

rel:
1. According to Big Internet Search Engine.


Can you switch the method of blockchain download?

Yes, it is possible to delete boostrap.dat mid sync.

Next time you start the Bitcoin client it will continue to sync from the network.


What does the Lightning Network UX look like?

However, this will take at least 10 minutes to be confirmed, and you would have to do it with every party you wanted to transact with for the first time.

Not necessarily. The way that some of the LN clients currently work is that they will automatically establish several channels with other nodes for you when you first start the client. So when you want to pay for something at a merchant that you do not have a channel with, you can simply route your payment through one of your open payment channels. There is no need to create a new channel with each individual person you wish to transact with; that's the whole point of being able to route payments.

  So ideally, wouldn't there be some sort of single, intermediary service or protocol that I could enter this multi-sig wallet with instead?

Ideally, no. That would mean that there is centralization. What would actually happen is that both you and Starbucks have open payment channels with other people, and you simply route your payment through another person.


A transaction can have multiple inputs, so any of the scenarios you describe are possible.

Let's call David's transaction to Alice T, and its outputs T0 and T1.  Here are three ways Alice could make a transaction to achieve the desired results.

One input: T0.  Two outputs: 5 BTC to Eve, 5 BTC to Alice.  (In this case T1 remains available for Alice to spend in some future transaction.)
One input: T1.  Two outputs: 5 BTC to Eve, 15 BTC to Alice.  (T0 remains unspent.)
Two inputs: T0 and T1.  Two outputs: 5 BTC to Eve, 25 BTC to Alice.


What is the best way to send money to a friend overseas using a Bitcoin ATM?

Ask your friend to send you their Bitcoin receiving address - they should use their Bitcoin-Wallet to create and show them a new receiving address for this transaction. They can then send you the Bitcoin-address in email etc. It will look something like one of the following examples (don't use these):
bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq or
3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy or
1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2
They can instead send you a QR-barcode that you might be able to scan into the Bitcoin machine. This is probably less prone to mistakes. If you make a mistake the money is lost - bitcoin transactions cannot be undone, cancelled, or reversed.
At the Bitcoin machine, make sure it is not creating a new wallet or a new account with some business but is instead sending the purchased BTC directly to an address of your choice. The details depend on the make and model of Bitcoin machine. You may have to choose some specific options on the machine. Enter or scan your friend's address as the receiving address and double-check it. Make a note of any transaction-ID and/or keep any paper receipt.


Lightning Wallet (lnd) - Export Private/Public Keys?

I think is not possible. They are still working on it.

https://github.com/lightningnetwork/lnd/issues/732


Bitcoin transactions from mining companies

After reading the FAQ's of genesis mining, it is clear that it is a kind of pool mining company, however, you do not buy the mining rigs for yourself but just pay them for the hash rate you wish to by. Now the amount of bitcoins you receive is decided by the ratio of your hash power to the entire hash power of genesis.

As an example, say your hash input is 1 hash/sec and the total hash power is 100 hashes/sec, and genesis mined a single block that day. Todays block mining rewards are 12.5 BTC. So you will be paid 12.5/100 BTCs. However the FAQ's also mentioned that they cut certain operational charges. So you will get a little less than the above figure.


Is GPU mining viable with any Cryptocurrency mining variations?

You'll want to keep your eye on a cryptocurrency mining profitability website such as this:

http://www.coinwarz.com/cryptocurrency

Please note that much of the mining software for a lot of these coins contain malware, so be very, very careful before installing such things.


This looks like a great lib that acts as a OpenCL wrapper, at least based upon the short example given on vector sorting.

All libraries seem to treat the GPU as if it's some foreign CPU, and while this is no exception, it seems to be the most direct and intuitive.

I haven't been able to test, but if it works as advertised, it looks perfect.

Note: I've tried to sort out CUDA and OpenCL by myself, and I'm just not good enough.  This appeals to my laziness.


How can I download a single Bitcoin block?

Yes, it's the whole block. The hex text is 2.5 MB. Hex has 50% efficiency, so the block is 1.25 MB.
Since SegWit, blocks can be larger than 1 MB. There's a 4 MB hard limit which is almost impossible to reach. (With the largest block to date being 2.4 MB, 4.8 MB in hex)


How do new coins come into existence in a blockchain with Proof-Of-Stake where there are no miners

To understand this, you first need to understand the difference between Proof-of-Work and Proof-of-Stake.
The functionality that we want from a consensus protocol is to select a slot leader before a new block has to be generated and added to the blockchain, but we want the slot leader election procedure to be as close to random as we can have to make the system decentralized. If there is just one party, or a group of parties, that keep generating all the new blocks, then the system will no longer be decentralized.
So, what we want is to have a random process which results in a random party getting elected as the slot leader (slot leader is the party who gets to generate the new block, like the winning miner in the PoW) and this is true for both PoW and PoS.
PoW tackles this randomness requirement by presenting a puzzle of which no one knows a deterministic polynomial time solution, and the party who solves the puzzle first gets elected as the slot leader. But, PoS takes a very different approach. In PoW, the chances of you getting elected as the slot leader are quite proportional to your computing power because you will be able to check more random nonces per unit time before other parties, but in PoS the chances of you getting elected as the slot leader are proportional to your money in the system (how many PoS coins do you have). The problem that remains is that how do we enforce the randomness that we could get by putting an NP puzzle in PoW with PoS?
There are many ways this randomness can be enforced. I will talk about an approach called - Follow the Satoshi. In this approach, the online parties take part in a secure coin tossing algorithm and the result is that a random coin gets selected. This coin is completely random and the owner of this coin gets elected as the slot leader. Now, this is very intuitive to see that the person who has more coins will have a greater chance of becoming the slot leader because the odds of a random coin being in his possession are high.
This is when the new coins are generated in PoS and are awarded to the slot leader whose coin got selected.


How old does one need to be in order to mine or use Bitcoins?

Anyone can use Bitcoins there is no age specification. It's good that you start with crypto currencies at early age so that you can make a handful of money while you turn 18 but don't get do indulge into cryptos so that you put all other things aside.


Get blockchain info for exchange transaction

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


In P2PKH Multisig Transactions, what is the address?

There are no "addresses" in protocol. There are only "output scripts". The address is only human-readable representation of script which matches the "output script".

The output script for bare multisig transaction is [m] + [hash1] + [hash2] + ... + [hashN] + [n]

And all of these parts are significant. There is no "classic" representation of such address yet.

bc.i uses the form of (Escrow X of X1 X2 X3) (where Xn is standard p2pkh address) but you may use your own.


Looking for a serious alternative to Nicehash... can you please help?

In the exchange, bittrex has the tool where. that when you receive another currency it sells automatically and you get bitcoin.
Bittrex -> Labs -> Auto-Sales

I think she's the best alternative.
https://bittrex.com/Lab/AutoSell


It's misleading to look at transaction fees as a percentage.  Bitcoin transaction fees are based on the size of the transaction in bytes, regardless of the value being transacted.

According to the site you linked,

  The fastest and cheapest transaction fee is currently 0.0000042 BTC/byte, shown in green at the top.
  For the median transaction size of 226 bytes, this results in a fee of 0.0009492 BTC.

If you are trying to send BTC 0.005, then yes, that is about 20%.  If you are trying to send BTC 0.5, then this will correspond to a fee of about 0.2%.  For comparison, credit cards typically have a fee of around 3%.

  Is anyone still using BTC?

Obviously yes.  Transaction fees are based on supply and demand - the network only allows so many (bytes of) transactions in each block, so fees are effectively bidding for space in a block.  If "nobody" was using Bitcoin, you would see fees become very low.

Note that there are several current proposals for increasing the block size, or otherwise allowing a higher volume of transactions on the network.  If and when any of those take effect, fees should come down.

  Maybe I'm doing something wrong here but after some checks on https://bitcoinfees.21.co/ and blockchain it seems that those are the real fees and people just keep paying them. Why?

Because paying a high fee to spend Bitcoins may still be better than not spending them at all?

See also Is it normal to not "own" your bitcoins? Are 6% transaction fees normal?


How does a miner insert the hash of a merged-mined alt chain's transaction into a Bitcoin transaction?

A 44-byte header cointaining:

magic: 0xfa, 0xbe, 'm', 'm' (only required if over 20 bytes past the start of the script; optional otherwise)
block_hash: Hash of the Namecoin block header
merkle_size: Number of entries in aux work merkle tree.
merkle_nonce: Nonce used to calculate indexes into aux work merkle tree; you may as well leave this at zero

is included in the scriptSig of the coinbase transaction in the Bitcoin block and sent to the Bitcoin network. Note that it is only sent to the Bitcoin network if it meets the network difficulty of Bitcoin. If it only meets the difficulty of Namecoin, it is only sent to the Namecoin network.

Source: https://en.bitcoin.it/wiki/Merged_mining_specification


Why bitcoin cash supply is currently 100k more than bitcoin on coinmarketcap (as of Oct 17)

EDA (Emergency Difficulty Adjustment):

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

Source: Jimmy Song

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

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

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

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

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


0/unconfirmed and cannot find my bitcoin folder (Mac)

The standard command-line client keeps it in ~/Library/Application Support/Bitcoin, at least on 10.6.

I don't know about bitcoin-qt, but some very broken applications keep the data inside the .app itself (right click, "show package contents").

Another typical unix configuration spot is ~/.program_name.


The main issue with choosing a miner "at random" is finding a verifiable public source for randomness. Most public randomness sources run through a centralized party, which is no good for Bitcoin, where everything needs to be cryptographically verifiable.

There have been some attempts at a public, verifiable randomness source in Bitcoin, but given that the system is eventually consistent and subject to collusion, it's been shown to be difficult. See "On Bitcoin as a public randomness source" and "Proofs-of-delay and randomness beacons in Ethereum".

Another possible way to avoid the issue of excessive energy consumption is Proof-of-Stake-based blockchains. Instead of creating a computational marketplace (which in Bitcoin is very competitive) to verify blocks, proof-of-stake uses staking of coins to decide what the next block is. You earn a block reward by committing money to a certain block. There are chain-based approaches (Peercoin and Blackcoin) and BFT-based approaches (Casper and Tendermint). Here's a good intro guide to PoS and Ethereum's Casper.


technical question: receiving wallet.dat error

Your wallet.dat hold the keys.  If the client is intermittently seeing errors you will not want to continue using it.

You essentially want to create a new, empty wallet and then import the keys into the new wallet.

One approach is to use Blockchain.info/wallet which can import the wallet.dat, and then you can export the keys from their web interface.

If that doesn't work, then you can try running the client (with no blockchain data files and no network connectivity) and from the Debug console export (dump) the private keys.

Another approach is to use joric's pywallet tool to export the keys.


A blockchain is the basic data structure used to record the transactions in the network. It already exists, you don't need to create it. This is like asking "I want to send an email, how do I create an internet?".

You need Bitcoin wallet software. See https://bitcoin.org/en/getting-started for more information.


How would an artist be able to sell their own music for Bitcoin?

Regarding this question, its probably worthwhile to check out Bittunes. The company was started in May 2013 with the mission to enable the monetization of file sharing with Bitcoin. The significance of this is that it is not about just using Bitcoin as a way to buy music, but actually incentivising buys (fans) to serve as a new kind of distribution channel for music. ~ In other words, its an 'earning platform' for both artists and fans. It is early days for the system, with many aspects still to roll out. see:  www.bittunes.com and www.bittunes.org for more detail.


If only one Bitcoin miner gets the block reward, is it worth mining only for the transaction fees as a (not-so-competitive) solo miner?

I will only be rewarded with the fees with respect to the calculations I have made.

That's not correct. If you don't mine a complete block, you get nothing at all.
Joining a pool will let you get a proportional share of the income (from both the block subsidy and the fees), changing the game from a lottery to a more predictable payout based on your contributed hashing power.


In my personal experience, CentOS is the absolute worst choice of Server OS for compiling altcoins. I have yet to compile and run a single daemon on this Operating System. Cent OS is dead. Instead, use Ubuntu or any other Debian based OS and enjoy the benefits of painless compiling.

If you're in a situation where your main application resides on a centos server, and you don't want to change up your whole operation my suggestion would be:

buy a small vps and put ubuntu on it(install fail2ban and clamav, in addition to dependencies.

then download and configure yaproxy to safely tunnel into the vps(you can make rpc calls from the subnet without outside exposure). now make a database on the main server to store your wallet credentials.

now you need to setup ufw at this point.

you should allow with UFW the following:

connection to the default port of the wallet from any ip or a list of trusted nodes
connection for yaproxy confined to the ip of your main server.
connection to the rpcport from localhost to the subnet address of the main server

anyway, probably went way into left field on this one, but it should be enough to get your headed in the right direction when you inevitably realize why you can't compile correctly on cent os. it's because no body updates the yum package repositories, because cent os is just waning in popularity for various reasons.


How Does Bitcoin Core Client Keep Track of Longest Chain/Strongest PoW Chains?

You're looking for validation.h and its corresponding .cpp source file.

You should start at CChainState::ActivateBestChain. This subroutine calls CChainState::ActivateBestChainStep which runs the logic you're interested in - stepping one by one of the blocks, cleaning up and reorg'ing from lowest to highest PoW.

First, ActivateBestChainStep walks the chain in a while loop: while (m_chain.Tip() && m_chain.Tip() != pindexFork) cleaning up blocks which are not in the best chain using DisconnectTip(state, chainparams, &disconnectpool). This partly answers your question - all the blocks which aren't in the best chain are weeded out here.

It then walks through the current CBlockIndex organizing blocks using the next while loop: while (fContinue && nHeight != pindexMostWork->nHeight). pindexMostWork is a CBlockIndex that contains the blocks with most work. Inside there is a loop which selects the blocks it should connect to the best chain: while (pindexIter && pindexIter->nHeight != nHeight). It pushes the candidate blocks onto a locally allocated vector std::vector<CBlockIndex*> vpindexToConnect;.

Next it iterates this new vector in reverse, pushing the blocks with lowest work first: for (CBlockIndex *pindexConnect : reverse_iterate(vpindexToConnect)) connecting each to the tip. The last connected block will be the block with the highest work index. This builds a chain sorted from lowest to highest work.

Several places in the code call ActivateBestChain, among them:

invalidateblock and reconsiderblock in rpc/blockchain.cpp
ThreadImport in init.cpp
ProcessGetBlockData and Processmessage in net_processing.cpp
Several subroutines in validation.cpp itself

You can use any of the above to trace how and when a new best chain is activated. I think the most interesting ones are in net_processing.cpp as those are the ones triggered by messages received from the network.


Looks like ABC win this rally. ABC have more hash power and more supporters.

I like this approach to explain:

  BTC = real Bitcoin

  BTCC = real fake

  Bitcoin BCH = fake fake Bitcoin

  BCHSV = real (?) fake fake Bitcoin

  BCHABC = fake (?) fake fake Bitcoin

https://twitter.com/FedericoTenga/status/1063430370308354048


Importing bitcoinj mnemonic into electrum or deriving private keys from mnemonic

Just restore as normal using electrum and on the screen where you have to enter the derivation path you set it to m/0' and choose legacy as the script type. Then create another wallet via file > new/restore for the p2wpkh addresses. This time choose native segwit as the wallet type and enter m/1' as the derivation path.


These are Ripple's largest known weaknesses (not including weaknesses common to Ripple and Bitcoin):

Because the Ripple network can't move actual fiat currencies, balances in Ripple act like bank balances. If the bank somehow defaults on its obligation, people won't actually have the money they thought they had. This is not a big problem if you're just using Ripple to make payments, but it's a weakness if you're using Ripple as a store of value for fiat currencies. Your money is only as safe as the "bank" that holds it for you.
If some unified group were able to get control over a significant number of validators that other validators trusted, they could temporarily disable the Ripple network (by refusing to reach a consensus) until manual intervention by other validators removed them.
Ripple's internal mechanics are still largely untested. As happened with Bitcoin, problems may be discovered as people begin to heavily use the system. Ripple's scalability has only been tested in simulation.
While the hope is that gateways will be all close enough to equal that people will be able to just sum their balances to get a sensible total, it's possible that different redemption policies or perceived trustworthiness will result in some balances being "devalued". So you might deposit $10 at a gateway, get a "$10" balance in Ripple, but find that because your gateway is not considered reliable, nobody actually values that balance at $10.
People might get tricked into extending trust to entities that are untrustworthy. We are already seeing "you trust me and I'll trust you" type offers. People may not realize that the system will give them what they ask for, giving them balances they have no way to collect on. Essentially, Ripple simply records balances. The system can't force people to settle them outside the system.
The stability and possible future changes in the value of XRP is unknown. If XRP is usable as a bridging currency, that should make cross-currency payments cheaper. But there's no assurance that it will be.
Until the network is decentralized, OpenCoin is a single point of control and possible failure.

In exchange, Ripple provides a way to perform fast (ten seconds), cheap (less than a penny) cross-currency payments with no way to lose money unless someone you chose to trust defaults. Ripple provides decentralized exchanges between any number of currency pairs. Ripple provides a way to seamlessly federate payment systems so people who use one payment system can pay people who use another, even across currencies. Ripple's design requires no central authorities and OpenCoin is committed to making it an open source, decentralized payment network.


Practical tips for validating raw transactions

A very useful RPC is the testmempoolaccept RPC. This will tell you whether the transaction would be accepted by the node. You can use this to determine whether the transaction is correctly signed. It will also tell you what the transaction fee is so you can determine whether the fee is what you expect it to be. If the transaction would not be accepted, it will also tell you what went wrong.
To ensure that the transaction is logically correct (i.e. money is being sent to the right place), you can use decoderawtransaction and examine the contents of the vout array. Each output is in that array and the value for the output and the address, if any, will be listed. So you can scan that array and make sure that the intended recipients are there with the correct values.
It is harder to determine change, but if you know what the change address is and what the change value should be, then you can check it as if it were another recipient as described earlier.

One caveat about testmempoolaccept: it only works if the parent transactions are confirmed or in the mempool. The test it runs is on the mempool state at the time of the call, so it behaves as if you had done sendrawtransaction at that moment, except the part where the transaction is actually sent and added to the mempool.


How does one find places that accept Bitcoin in the US?

The Bitcoin payment service provider BitPay claims to have 20,000 merchants, both online and physical (brick and mortar), that accept Bitcoin on their system. They have a directory of companies here: https://bitpay.com/directory#/ but they are certainly not the only payment services provider.

http://coinmap.org/ has a list of almost 5000 brick and mortar locations that accept Bitcoin (not tied to any particular payment service provider).

Interestingly enough, just yesterday Yelp.com officially announced a new feature that allows businesses to specify whether or not they accept Bitcoin! This means that soon the Yelp API will also become a very valuable source of Bitcoin acceptance information.

Major retailers like Overstock.com and TigerDirect have also began accepting Bitcoin!


How to sign a transaction using multi signature using bitcoind?

Generally you would need to show,us a bit more information, so we can see, how far you got, which steps were taken, etc... this would allow to follow the possible issue. (See also help files here, how to create good questions).

I have two references for you, with solutions for multisig signing:
Here it was discussed on bitcoin.SE.

And Gavin explained it here step by step on the testet.
If you have followed the links, let us know how it goes, or where you got stuck, then we can probably help better :-)


bitcoind has a decodescript method.

$ bitcoin-cli decodescript "512102974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf392103ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f152ae"
{
  "asm": "1 02974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf39 03ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f1 2 OP_CHECKMULTISIG",
  "reqSigs": 1,
  "type": "multisig",
  "addresses": [
    "1CmMoanE9uahYETLahBTGZSFZSQGV8ADrR",
    "12z2brRNYFkqJe3zP58uoiGcLqDxfk6J7r"
  ],
  "p2sh": "34EJTjAmEPbPGXAPQWU7sn4beoZyGTTxBw",
  "segwit": {
    "asm": "0 a45407120f912ef91ecd7e66a27cb4dc106f962172470b1b39c1bb5008898277",
    "hex": "0020a45407120f912ef91ecd7e66a27cb4dc106f962172470b1b39c1bb5008898277",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1q532qwys0jyh0j8kd0en2yl95msgxl93pwfrskxeecxa4qzyfsfmsfgd3m5"
    ],
    "p2sh-segwit": "32KAK2XxwcYPc5iu3tNoXv3ksu4Gf3NsH3"
  }
}


Electrum iOS alternative that can create multisig wallet with other Electrum wallets?

Copay has multi sig options. First, it will generate you a regular wallet. After initial process is done, you can create new shared (multi sig) wallet or join the existing one.


Bitcoin Core 0.13.1 shutdown with I/O device error

You may want to check the state of your disk to make sure there are no issues, also, that your data directory has the correct permissions set.

I hope this helps! :)


Bitcoin scriptSig with two transactions to unlock the scriptPubKey

You cannot put your plain script in scriptPubKey hence it's considered non-standard and will not be relayed/mined. You need to hash your custom script, put script hash in P2SH output, and reveal the script later when you spend it (in scriptSig).
Here's a step-by-step demonstration:
OP_SUB < 100 > OP_EQUAL

Convert your script to hexadecimal representation:

a. OP_SUB is encoded as 0x94 (in hex)

0x94

b. 100(dec) is encoded as 0x6400 (in little endian) plus one-byte length prefix

0x94026400

c. OP_EQUAL is encoded as 0x87 (in hex)

0x9402640087

Hash your script in order to get script hash:

RIPEMD160(SHA256(0x9402640087)) =
0xa038dd58be8e9c3bd9f26fe585dcdfe85d70ac4d

Your P2SH scriptPubKey is:

OP_HASH160 a038dd58be8e9c3bd9f26fe585dcdfe85d70ac4d OP_EQUAL

In order to spend/unlock this output your scriptSig should be:

< 200 > < 100 > < OP SUB < 100 > OP EQUAL >

In Hex:

0x02C800026400059402640087

Please note that arithmetic operations like OP_ADD and OP_SUB can only accept 32-bit integers, so if any input encountered longer than 4 bytes, the script must abort and fail.
Feel free to learn more about P2SH here


Will all 21 million units be completely mined one day?

Theoretically yes, but that moment is so far in the future it is likely that some other events such as new currency technology will surpass bitcoins.

However, mining will not stop.  Mining is the security backbone of bitcoin, and it will continue because it will still be profitable to mine.  Miners will be paid fees from existing bitcoins with every transaction instead of a reward of newly created bitcoins.


What is Bitcoin's locktime feature exactly? How can it be used?

Like a cheque with a date in future, a Bitcoin transaction with locktime cannot be unlocked (read cashed) before that date. The definition in bitcoin.org is pretty clear

  Part of a transaction which indicates the earliest time or earliest
  block when that transaction may be added to the block chain.

Sample use case is a cautionary deposit. For a great example see micropayment channel protocol implemented by bitcoinj and described here:

https://bitcoinj.github.io/working-with-micropayments


Most miners now use Stratum, but the old getwork protocol isn't completely gone yet.

The URL is the root path (/) of the server usually at port 8332, for instance http://mint.bitminter.com:8332. You can see what the data looks like here: How can I code a Bitcoin JSON-RPC "getwork" request in Java?
No, this is JSON-RPC. It's an RPC-style interface, which is more or less the opposite philosophy to REST. It's not even a good RPC design as the same procedure "getwork" is used both for getting work and for returning work results.
HTTP Basic Auth is used for authentication. If you are talking to bitcoind you put the user name and password in the config file. If you are talking to a pool you register at the pool.

There is some info about getwork and its various extensions at https://en.bitcoin.it/wiki/Getwork


Need help! Initial sync not progressing, BTC sent already, + warning message

If you want to switch to Multibit, you can get the private key from the Bitcoin-Qt wallet using the debug console:  Help -> Debug Window -> Console.  Enter the command:

dumpprivkey public-address

This will list the private key associated with the public address you used to send the coins to your wallet.  You can then import this private key into a Multibit wallet by following this guide to import a private key into Multibit.

If you want to keep using Bitcoin-Qt, you can download the initial blockchain and then start Bitcoin-Qt to synchronize with the network.  Go here to download the initial blockchain.  Delete the 'blocks' and 'chainstate' folders in the bitcoin data directory and then unpack the downloaded file in the bitcoin data directory.  Start Bitcoin-Qt and it will rebuild the blockchain and then synchronize with the network.

The bitcoin data directory can be found here,


What currency do the antminer pools generate?

Antminer is good a a certain type of cryptographic hash: SHA256. So while you can technically hash any cryptocurrency that uses SHA256 (ie. http://www.coinwarz.com/miningprofitability/sha-256) most pools will be focused around Bitcoin and even those that don't mine Bitcoin directly, will give you the option to trade whatever they're mining, directly to Bitcoin.

Some pools can hash several similar cryptocurrencies at the same time but considering their relative values they are hardly worth the bother and admin taken to trade them and you can probably find a pool that does all of this automatically. Go ahead and visit the pools' websites and read their FAQ pages and ask for help on their forums!

Beware though - many, if not most, pools and Bitcoin services are run by Crooks out to steal your money or use your hashing power for their own gain. Look for pools that have been around for several years, and with lots of users and a friendly community!

Also beware! If you are paying for electricity, you are probably going to mine less Bitcoin than the cost of the electricity - so you might as well not mine at all and just spend the money that you would have spent on electricity, directly on buying Bitcoin at an exchange. For older hardware this holds true, even if Bitcoin should reach $3000 each.


Locating transactions by the relayed by IP in blockchain.info

It is possible, but it is also quite easy to hide your activity from such inquiries. For example, lets check Address 15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC:

http://blockchain.info/address-relayed-ips/15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC

We can see that most often it appears in the USA, with a dominant IP being 69.164.218.197 . If we check that IP with another tool, we can see that it was owned by Linode. And indeed, this is the address of the Bitcoin Faucet, that used to be hosted on Linode.

However, if you were to say, start your Bitcoin with -connect flag and specify an IP that you know will be running Bitcoin most of the time and not be malicious (such as a trusted pool, the Faucet, or the like), your transactions will appear to come from that IP. Switch the IPs every now and then, and you have a total control of what other people can see the origins as.

So yes, it is possible to infer some information about what IP owns which Bitcoin Address, but it is also possible to hide such data if there are any trusted nodes on the Bitcoin network.


Getting Bitcoins into my wallet from MtGox

I don't have a MtGox account myself, but you should be able to find a function on MtGox that is called "withdrawal" or similar. There it will ask you to provide your Bitcoin address and set the amount that you want to withdraw.

Be sure to use one of your own addresses from the wallet (depending on what wallet you use look for "receive payment" or "your address"), it has happened before that people used an address of one of their business contacts instead of their own.


Risks in joining websites that offers bitcoins for trade

It is likely that the address you were given upon joining is a deposit address, that you would send bitcoins to when you want to sell them. When buying bitcoins, the site will hold them for you until you withdraw them to an address you provide. Usually that would be a separate wallet, e.g. a program on your computer, hardware wallet like TREZOR, or a wallet website like the one offered on blockchain.info. Until you withdraw the bitcoins from the website, they hold them for you, which means there is more risk of losing the coins if the site gets hacked, goes rogue or goes bankrupt. There is a saying in the bitcoin community, that if you do not have the private keys then you do not own the coins. So the safest route for you is to get your own wallet and withdraw the coins there, and then make a backup of your private keys for that wallet.

And yes sites like that can set their own fee, some might be ridiculously high unfortunately, but there is not a lot you can do if that is what they ask


Connecting a Hardware wallet to a full node

How to connect your hardware wallet to a full node depends heavily on what wallet software you're using. But assuming your software connects to a full node via the bitcoind RPC interface:
By default, the RPC listener only listens on localhost. If you want to connect to the RPC service from another computer, you'll have to allow other connections by including these lines in your bitcoin.conf (replace:
server=1
rpcallowip=<add the IP you are connecting from here, or rpcallowip=* to allow all IPs>
rpcport=8332

If you want to simply test whether your bitcoind RPC is accessible, you can simply make an HTTP request to the RPC host at port 8332 from the computer you're trying to connect from.


If you want, you can pay $100 for the standard, ANSI X9.62. Or, you can cheat and look at RFC3278, section 8.2. It is in DER format consisting of a SEQUENCE of two INTEGERs. The first INTEGER is r, the second s.

If you look at this transaction you can see that one of the signatures is:

  3045 0220
  316eb3cad8b66fcf1494a6e6f9542c3555addbf337f04b62bf4758483fdc881d
  022100
  bf46d26cef45d998a2cb5d2d0b8342d70973fa7c3c37ae72234696524b2bc812
  01

If we parse that as DER, we get:

 0:d=0  hl=2 l= 69 cons: SEQUENCE
 2:d=1  hl=2 l= 32 prim: INTEGER :316EB3CAD8B66FCF1494A6E6F9542C3555ADDBF337F04B62BF4758483FDC881D
36:d=1  hl=2 l= 33 prim: INTEGER :BF46D26CEF45D998A2CB5D2D0B8342D70973FA7C3C37AE72234696524B2BC812

You can also peek at the OpenSSL source code, file ecdsa/ecs_asn1.c:

ASN1_SEQUENCE(ECDSA_SIG) = {
        ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
        ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM)
} ASN1_SEQUENCE_END(ECDSA_SIG)


Fetch UTXO Bitcoin to address created by rpc importprivkey without rescan like other api

Because these api are very fast response, I think they're not using rescan.

No, they maintain massive databases that index every transaction and transaction output and their associated addresses. Bitcoin Core does not need this for normal function, and the vast majority of users do not need access to such information. Bitcoin Core does not and cannot build such databases.

  I'm using version 0.16

Then there is nothing you can do.

If you were using 0.18, then you could use the scantxoutset command to just scan the UTXO set for UTXOs. This is very quick, and you can specify multiple addresses to do it as single batch scan. scantxoutset will give you all of the UTXOs for the specified addresses but will not add them to any wallets loaded in Bitcoin Core. However, it does not sound like you are using the wallet so that should be fine.


Technically, you are not double spending, since the transaction was never confirmed on the blockchain. Double spending is possible by 51% attack; what you are trying is to replace the transaction with one with desired fees, before it is confirmed on chain.

You can use https://github.com/petertodd/replace-by-fee-tools


Calculation of transaction fee for transaction

There's 2 parameters that affect the value of a transaction fee: the transaction's size and how long you're willing to wait for it to confirm.

Smaller transactions pay a smaller fee than larger transactions since miners can include more of them. At a higher level, you pay for each byte of data you want to include in a block.

The price per byte (denominated in satoshis per byte) that will confirm you in n blocks is estimated by looking at the past data (and maybe at the current transactions waiting to be confirmed).

Once you have that price, you can multiply the size of your transaction by it to get the fee you have to pay.

As for formulas, if you use standard addresses (not P2SH), the formula is:

fee = (n_inputs * 148 + n_outputs * 34 + 10) * price_per_byte

SegWit slightly changes this, where instead of paying per byte, you pay per unit of weight: 1 byte of non witness data = 4 weight, 1 byte of witness data = 1 weight.


Given N addresses, Is there any way to know how many address are linked to a single entity?

There is no clear way to do this.

Chain analysis techniques exist that can attempt to identify relations between addresses based on transaction patterns. However, these are not guaranteed to work and often miss relationships or result in false positives.

This "feature" is why it is recommended to use addresses only once, since it is hard to link multiple addresses to a single owner.


There really isn't one yet. Currently there is only one access point into the Ripple system open to the public and there's no system monitoring on it that has public access.


You can use an offline copy of bit address.org to check private keys against addresses if you want. It's the wallet tab.


Which Bitcoin miners allow one to use paths in URLs?

DiabloMiner allows both URLs and non-URLs. -l http://user:pass@host:port/ is the same as -u user -p password -o host -r port. URLs may contain paths.


When a node discovers a new block, it will send an (unsolicited) inv (inventory message) to announce the new block to its peers. The peers should then respond by sending a getdata message requesting either the header, or the complete block.
The Developer Reference describes the exchanged messages in more detail.

The nodes will then check the header, and each included transaction for adherence to the consensus rules. Most likely they will immediately start mining new empty blocks on basis of the header (as they don't know which transactions are still unconfirmed), then switch to mining a non-empty block once the received block was validated.

Each block includes a transaction that sends the mining reward to its miner. Other nodes cannot change this transaction as the block wouldn't be valid anymore. See What is the coinbase?

When two blocks 1A and 1B are found at the same time, each chain-tip will be considered valid by a portion of the network. Once a new block 2 is found, it can only extend one of the two chain-tips (here 1A→2A), thus distinguishing one of the two chain-tips as part of the chain with the most work. As nodes hear about this new block 2A, they will discard their stale chain-tip 1B and reorganize to "longest chain" 1A→2A.
As it is unlikely that any chain building on 1B will ever be able to overtake the 1A→2A chain, miners would be wasting their power to continue to work on the obsoleted chain. Thus, the network is strongly incentivized to converge on the one chain with the most work.


I have a txt file labelled private key, inside is what i assume to be base64 string ending with =

Presuming you are in possession of an actual private key and not a random Base64 string, consider this answer to convert it manually yourself or use an external program like this or this to convert it to the Wallet Import Format (WIF).
It would be preferred if you do this in a virtual machine disconnected from the internet for security reasons.


If the nonce is 32 bits why the proof of it is difficult?

The vast majority of the time, none of the 2^32 possible nonces in a particular block header template will result in the header having a hash that meets the proof-of-work target.  In fact, the probability that this doesn't happen equals exactly 1 over the network difficulty.  Right now, that is 1/6,379,265,451,411.

When no nonce succeeds, one must change something else in the block header and start again.  The typical solution is to change the extranonce field in the coinbase transaction and recompute the Merkle root.  See What is the extraNonce?


That will success when bitcoind download all blockchain.

Wait till bitcoind complete synchronization then try again.


How can you tell how many users Bitcoin has?

Due to the nature of Bitcoin there is no precise answer to this question. However, this site displays some statistics on the number of nodes in the network over time: http://bitcoinstatus.rowit.co.uk/


I have over 130addresses and I have never sent nor received any bitcoin. How is that

Bitcoin clients generate a number of addresses in advance for backups to remain complete for some amount of future use. E.g. Bitcoin Core creates 100 addresses in advance, I'd expect bitcoinj to do something similar.


Is this man-in-the-middle double-spending attack against Bitcoin viable?
To complete a double spending attack on Bitcoin as described, you need to be able to present an alternate block that is otherwise valid and with valid proof of work.
To create such a block in a 10-minute average requires as much mining power as exists in all the rest of the network (a 51% attack).
Yes, Mallory can delay Alice from receiving a new block but, Mallory must also successfully present Alice with a valid alternate block. There is one significant failing:

The proposed attack suggests insertion of a malicious fake transaction (temporary may be a better word) into a maliciously crafted block, a temporary transaction we suppose is Mallory paying to Alice while on the real blockchain Mallory is paying to herself.
Mallory puts Alice on drip-feed only giving new blocks slowly so that the real blockchain is ahead.
After Mallory lets the real blockchain get far enough ahead Mallory wants to build a fake block on top of a real block {blockheight-6}
Mallory requires as much mining power as exists in all of the rest of the mining network in order to solve the malicious block in a 10-minute average. Note that even in that case since it is an average it could take as long as 20-minutes. So, with approximately 25,681,575,019 GH/s[1] of mining power the attack can probably be carried out unnoticed. With half as much mining power as exists in all of the rest of the network Mallory would be able to solve a new block in a 20-minute average or, about 40-minutes max.

The problem in completing a 51% attack is revealed when it is understood that one modest Bitcoin miner is probably capable of just 13,500 GH/s.
Setting aside plausibility, the transaction would need to be of exceptionally large value to be financially viable.
EDIT: On the point that with 1% of the mining power a block can be generated in an average of 16 hours (max 32 hours) this is in theory not totally implausible, however, it should be noted that would still require currently ~19023 Antminer S9's. Also, if you test drip feeding the node in a laboratory environment to get 16~32 hours behind to see how the node behaves I doubt that Alice would not notice, even more so if also waiting for 6 confirmations. If Mallory also had access to Alice's computer to replace the software with a modified version then the attack becomes more realistic. Note that Mallory will still need to make private arrangements to distribute work amongst her miners i.e. a private mining pool.
rel:
[1] https://blockchain.info/stats


Can I import wallet words more than once?

If you are sure the old wallet has not been compromised, you can use the old BIP39 seed again. The seed represents the private key that stores your coins so using it once does not make it invalid since the point is to be able to recover your coins with just the seed.

On the other hand, it shouldn't be too hard to generate a new BIP39 seed that you can use and be sure isn't compromised.


Any API to estimate the miner fee for a Bitcoin raw transaction?

Fees in Bitcoin are actually a bit simpler than ethereum, you don't have to deal with gas costs, just a fee per byte.

Bitcoin Core includes an estimatesmartfee function. You can call it (estimatesmartfee 2, for example) and it will give you an idea of the fee rate you need to be confirmed in n blocks (2 in my example).

You can then check your tx size, which varies by number of inputs and outputs, and just multiply it by the fee rate to get your recommended fee, and subtract that from your change output.


Bitcoinj wallet can't receive coins in Testnet3

Use WalletAppKit this class is Utility class that wraps the boilerplate needed to set up a new SPV bitcoinj app. Instantiate it with a directory and file prefix, optionally configure a few things, then use startAsync and optionally awaitRunning.

i created the wallet and send the coins using your the faucet you have mentioned and its works fine and receiving coin, here is my code...

public class Main {
    static NetworkParameters params = NetworkParameters.testNet3();
    static String path = System.getProperty("user.home") + "/Desktop";
    private static File walletFile = new File(path);
    private final static String APP_NAME = "MyWallet";
    private static WalletAppKit kit;

    public static void main(String...args)
    {
        kit = new WalletAppKit(params, walletFile, APP_NAME)
        {
            @Override
            protected Wallet createWallet() {
                Wallet wallet = new Wallet(params);
                return wallet;
            }
            @Override
            protected void onSetupCompleted() {
                super.onSetupCompleted();
                System.out.println(kit.wallet().currentReceiveAddress());
                System.out.println(kit.wallet().getTotalReceived().toFriendlyString());
                txHistory();
            }
        };
        System.out.println("start syncing...");
        kit.startAsync();
        kit.awaitRunning();
    }

    private static void txHistory()
    {
        List<Transaction> txx = kit.wallet().getTransactionsByTime();
        if (!txx.isEmpty())
        {
            int i = 1;
            for (Transaction tx : txx)
            {
                System.out.println(i + "  ________________________");
                System.out.println("Date and Time: " + tx.getUpdateTime().toString());
                System.out.println("From Address: " + tx.getOutput(1).getAddressFromP2PKHScript(params));
                System.out.println("To Address: " + tx.getOutput(0).getAddressFromP2PKHScript(params));
                System.out.println("Amount Sent to me: " + tx.getValueSentToMe(kit.wallet()).toFriendlyString());
                System.out.println("Amount Sent from me: " + tx.getValueSentFromMe(kit.wallet()).toFriendlyString());
                long fee = (tx.getInputSum().getValue() > 0 ? tx.getInputSum().getValue() - tx.getOutputSum().getValue() : 0);
                System.out.println("Fee: " + Coin.valueOf(fee).toFriendlyString());
                System.out.println("Transaction Depth: " + tx.getConfidence().getDepthInBlocks());
                System.out.println("Transaction Blocks: " + tx.getConfidence().toString());
                System.out.println("Tx Hex: " + tx.getHashAsString());
                i++;
            }
        }
        else
        {

            System.err.println("No Transaction Found");
        }
    }
}


How would a bitcoin transaction fits into a double entry accounting

As a third party with only the public blockchain data, there is likely no way to accurately fit a random Bitcoin transaction into the double-entry accounting method. This is because a single Bitcoin transaction could represent the economic activity and payments of many different people, or of many different transactions. To say this differently: transaction inputs/outputs do not necessarily map 1:1 onto users/transactions. There are ways to create Bitcoin transactions such that any one transaction can represent a larger amount of economic activity (more people and/or payments involved), especially in consideration of higher level protocols such as the Lightning Network, federated sidechains, etc.

As an example, a coinjoin transaction is intentionally designed to make it nearly impossible to determine who the owner of the newly created UTXOs is. Even those that are party to the transaction itself would only have knowledge of their own involvement, the nature of the other inputs/outputs would be unknown to them. Here is an example of a coinjoin transaction.

Another example is a lightning network channel: in this case a couple of on-chain Bitcoin transactions could represent a potentially unlimited set of payments, but all of those payments will be happening off-chain, and so they cannot possibly be known just by looking at the Bitcoin blockchain. Here is an example of a lightning network transaction, there is no knowing how many payments were sent over this payment channel (unless you were party to the channel, of course). Here is a look at that channel, but from a lightning network explorer.

  SO how is that possible that we take bitcoin transaction from blockchain directly

You cannot, unless you have additional information about the transactions you are attempting to catalogue. Generally, this sort of info is only known to those that are party to the transaction, so you should be able to accurately account for your portion of involvement in any transactions you are involved in, but to do so for every transaction in the blockchain is ultimately impossible. Too much potential nuance and detail is not explicitly stored in the blockchain record (and for good reason, privacy and fungibility is important).

  Also, we might not be able to identify from which address the transaction fees original from.

There is no concept of 'which address fees originate from' inherent to the blockchain record, for more info see my answer here.


Sent BTC from Coinbase, blockchain explorer says Confirmed. Is recipient lying or could something else be the issue?

Is recipient lying they have not received or could something else be the issue such as his wallet?

Seems likely in this case.

  Recipient says it could be because his 'hard' wallet is set up in a way so it activates/acknowledges/receives with $1000 transaction minimum?

This is not a thing, you're almost certainly being scammed. Wallets don't require activation or acknowledgement to receive coins. If you sent coins, and the tx is confirmed, the wallet has received it.

  He is meant to send back a larger payment to my wallet ( from which i sent the payment) as part of some investment returns.

This is 100% a scam - Do not send this person any more money and cut your losses now.


Where can I find proof of work in the Bitcoin Core source code?

The mining functionality that does background mining in the Bitcoin core was removed in August of 2016. See the following change log:

https://bitcoin.org/en/release/v0.13.0

The mining code itself is still available for testing and experimentation and is located in the files called "miner.cpp" and "miner.h" which are in the main src directory.


how to configure bitcoin-core (bitcoin-qt) to not use change addresses?

It's unclear what you want.

Do you want no change addresses, but still have change that goes back to one of the addresses from which coins were taken? That does not have any size/fee benefit. This is possible by using the coin control feature (in the Bitcoin-Core GUI) or the createrawtransaction RPC interface.

Do you want no change at all? That means the amount you are sending must exactly match the sum of the sizes of some of the unspent outputs you have in your wallet. It does result is slightly smaller transactions and thus lower fees, but it is highly constraining. You'll have to construct transactions manually if you need this.


Is the word "coin" a proper bitcoin term?

Right.  The statement "Alice has 5 coins" could be more precisely phrased "Alice controls the private keys for some set of addresses, to which are directed some set of transaction outputs with a total value of 5".  But that's a lot more cumbersome.


How do you import an xprv using descriptors and importmulti?

getdescriptorinfo always returns the non-private key from of the descriptor (security precaution).

From the commands help text:

"descriptor" :  (string) The descriptor in canonical form, without private keys


When you spend Bitcoin in a transaction, the transaction must reference at least one existing unspent transaction output (UTXO) and provide a valid signature proving that you are authorized to spend it. The transaction then consumes the UTXOs in the inputs, and assigns value to newly created UTXOs in the outputs.
Other network participants running a type of Bitcoin software called "fully validating nodes" have followed along the full history of all Bitcoin transactions (the "blockchain") to maintain a complete set of all UTXOs in existence (the "UTXO set"). You can think of the blockchain as the journal of all transactions, and the UTXO set as the ledger of all Bitcoin balances.
UTXOs are uniquely identifiable by their "outpoint" which is composed of the transaction id that created the output and their position in the transaction's output list: txid:vout.
This means that each full node can look up whether the UTXOs the transaction spends in the inputs exist in their UTXO set. They also check that the transaction is correctly constructed, including whether the transaction fulfills the locking conditions of the UTXOs, whether the signatures are valid, and that the transaction does not create new money by assigning more to the outputs than the inputs brought in.


I would recommend to call coinbase support. They will point you in the right direction, usually its dramatic time saver :) Happened with me before that they would clear/release funds right away for some cases (unfortunately had a bunch within the last year). Their support staff is very responsive, doing its best since the platform has problems with scaling and code quality.


Wallet balance zero after restoring wallet.dat

The balance will return as soon as the client catches up with the network.


If the difficulty were unchanged from its original target of 1, today there would be 16 trillion blocks mined every 10 minutes.

This would break the network instantly, it would not be able to maintain consensus, and would be creating something in the order of 33,000,000 gigabytes of blocks per hour, which would exceed all storage available in the world and consume all of the available internet bandwidth.

Suffice to say, this wouldn’t be ideal.


How to install Electrum wallet in an offline Linux computer?

I needed a special command to use local storage, which at last worked:

sudo pip install Electrum-2.7.12.tar.gz --no-index --find-links `pwd`

UPDATE: Whenever I've had to do this for the second time, even the first instructions (posted in my question), to get the apt-get dependencies recursively, didn't work. So finally I decided to create a script that does everything for you: https://github.com/knocte/offlineElectrum/blob/master/downloadElectrumAndDeps.fsx


Why blocks are validated instead of transactions?

Some transactions cannot be fully validated outside of blocks.

If you use OP_CLTV, a transaction can be valid only after a certain block height, and not before ; if you don't know which block it's in, there's no way to know if it is valid or not.


Why maturity rule on coinbase tx requires too many confirmations w.r.t an arbitrary tx?

If a normal tx is honest, has 6 confirmations, and there happens to be a reorg 6 blocks deep, the tx will just go back to the floating pool, and join one of the next blocks, with no harm done to any party.

If a coinbase tx has only 6 confirmations and there is a reorg, the original coins vanish from existence, invalidating the transaction, and any subsequent transactions that depend on it. These transactions can no longer be accepted into a block, and even if all parties involved are honest and willing to go through the effort of resending, this cannot be done because the original miner no longer has coins to send, and neither do the other parties.

Since a reorg invalidating a coinbase tx is catastrophic, a safety net of 100 blocks is required to make the chance of this happening vanishingly small.


Is it possible to alter the source code and still have a valid Bitcoin transaction?

It depends what you change. If you don't agree with other clients on what is a valid transaction and what is a valid block, then you won't agree on who holds what bitcoins.

  How do miners know what transactions are valid if there are two different implementations of the BTC protocol?

All the people who wish to interoperate with each other have to use the same rules for what constitutes a valid transaction and what constitutes a valid block. Groups that can't agree fork the network into two networks as happened when bitcoin split into bitcoin and bitcoin cash.


Do I need to open the client(I use multiBit) while transaction is being confirmed?

No need to keep the client open. Whatever client that is.
The confirmations take place in the bitcoin network, not locally.


Best tutorial and info on setting up ASIC Mining USB Block Erupters to join a mining pool?

Here's a decent bitcointalk thread: https://bitcointalk.org/index.php?topic=28402.0

Here's a more direct walkthrough of the installation (for windows 7 at least): http://rdmsnippets.com/tag/install-block-erupter-on-windows-7/ which will likely be helpful.


Random 'The operation has timed out' errors in JSON-RPC

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

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


Why isn't the right chain chosen according to the number of nodes who are broadcasting it?

Because the cost of pretending to be many nodes is trivial. IP addresses are cheap, and anyone who controls your internet connection can pretend to be everyone.

However, mining is inherently expensive. You cannot fake hashpower.


what to do if I found a fraudulent wallet?

is there anything to do?

No

I went to the police but can I report the wallet [somewhere] ?

You can

Write to anyone ?

Whatever you want

Find out in what exchange does the wallet sit?

Impossible with your skills
Transaction: 115906bc83bebc7511a2c497961e87e7fc3783b2ae5645e4605f9adad4571847
Address: 36Nq2uXqCaXu5kTN3mZtRubqHiVsYbQsMN


How does Bitcoin have an intrinsic value?

Talking about intrinsic value is always a difficult discussion. What gives Gold or really anything intrinsic value?

It is of limited quantity. Bitcoin also has a limit to the total
amount in circulation, and so has an element of digital scarcity
built into its design to mimic physical scarcity.

You can't counterfeit it. (Actually you can create gold, it just costs way more than just buying it) Bitcoin can't be copied through
any known process. You can't transmute lead to gold, nor simply
convert a random collection of bits into Bitcoin.
People accept it for Barter You can use Bitcoin with merchants all over the world, as well as person to person payments. The number
of people accepting and transacting in Bitcoin is growing every day.
You can build physical products with it While not a direct correlation the Bitcoin network is a highly secure trust network.
Nothing like it has existed before on its scale, and it seems clear
that quite a bit can be built on top of it. That gives the network
real value for companies emerging in various new sectors, and how do
you get access to this network? Bitcoin.

If people believe it has value, trade in it, and it lets you do things that were previously impossible it seems like it has intrinsic value by any definition.


Anomalous 2.7 BTC transaction fee observed

What's also possible is that someone mistakenly swapped the sending amount and the transaction fee amount. I almost did that with the bockchain.info wallet but luckily noticed it in the confirmation screen.

In this case, he could have intended a fee of 0.02314796 BTC and tried to send 2.7 BTC to the address. The other 65+ BTC could be just change.


If the output of SHA256 is hex, you must convert hex to bytes before passing that to RIPEMD160.

See http://procbits.com/2013/08/27/generating-a-bitcoin-address-with-javascript

 var hash160 = Crypto.RIPEMD160(Crypto.util.hexToBytes(Crypto.SHA256(publicKeyBytes)))


What do pruning nodes contribute to the network?

From release notes https://bitcoin.org/en/release/v0.11.0 :

  For now, block pruning disables block relay. In the future, nodes with block pruning will at a minimum relay “new” blocks, meaning blocks that extend their active chain.

In the current version pruning nodes don't advertise themselves as having any blocks, so they don't upload blocks. So that explains your big reduction in upstream data. A future update will re-enable block relay in such a way that your nodes can efficiently let its peers know which blocks it owns and which it doesn't.

Yes your pruning node will do full validation and it will service lightweight nodes.


I have been given " Watch only Address" by one of my friend

This is a scam often used by online con-men posing as your friend.

A watch only address lets you watch a bitcoin wallet owned by someone else. They can move their bitcoins away at any time. You cannot spend their bitcoins.

  Do we need to pay anything for the blockchain.info for releasing

No. If your "friend" claims to have earlier set up an online wallet for you and that the online service now need paying to release the private-key - your "friend" is lying to you in order to cheat you out of your money.

The Blockchain.info website has a link "Get a Free wallet". If your "friend" used that, they got a private-key for free. Note that this wallet belongs to them, not to you. That applies even if it appears to contain money that you gave to your "friend" or which they claimed to earned on your behalf by mining or trading.

blockchain.info's terms of services paragraph 10.2 says

  When you create a Wallet, the Services generate and store a cryptographic private and public key pair that you may use to send and receive any supported Virtual Currency

So there is no cost to obtaining the private key when you create a free wallet.

See these similar questions from other victims of scams:

How can I get a private key for this address
Unlocking a Private Key from watch status
Recovering the private key from a blockchain wallet address


How to connect two bitcoin nodes running globally

It seems like you answered your own question? You can use addnode=IP if you want to connect to a specific node as well as others, or connect=IP if you only want to connect to that one node and no others. Just add it to your configuration file.


If we know transaction ID can we check more info about it on the web?

Any blockexplorer on the web allows you to enter a transaction ID.

Caveats:

Some are notoriously bad and unreliable. Don't depend on the info they show.
The transaction ID of an unconfirmed transaction may change once it gets confirmed (same transaction, different ID). This is due to malleability.


Can we leverage a popular website for mining?

That was possible a few years ago, when GPU's were what high end miners used. You could have a Javascript that harnessed the CPU's of your visitors for the duration of time that they were on your site.

Of course, Google noticed this theft of resources and (rightfully) marked those sites as being ridden with malware.

And to try to do it now? Even if you had Stackoverflows pageviews, I'm betting you'd end up with negligible income, and a lot of upset users.


I believe the blk*.dat files are just the raw block data, so they should be the same on all platforms.  You'll probably have to regenerate the databases (-reindex) which may take quite a while.

Note that Bitcoin Core needs a couple gigabytes of RAM to run well, which is more than most cheap VPSes come with.  And of course the 120+ GB of disk space for the blockchain data itself.


Bitcoin built with a newer Berkeley Database incompatible with a older wallet?

You can always open a wallet.dat file created with an older BDB using software using a newer BDB. However, when doing so, the file will be upgraded and not be compatible anymore with the older BDB version that created it. This is even the case for minor version upgrades (4.7 vs 4.8 for example).

Bitcoin Core release binaries have used BDB 4.8 since release 0.4 (September 2011), but self-compiled versions or versions shipped with Linux distributions may use other BDB versions.


Bitcoin public key pre-0.6 length before hashing

is the buffer pre-hashing always 65 bytes long,

yes

  since compressed keys were not supported?

they were not used by anybody. but there were no changes in client to "implement/support" them

  Or was it 64 bytes long (just <256bit x><256bit y>) and there was no byte for the version prepended before hashing?

no. the client was written with openSSL library. This library always appends prefix to public key bytes (this is standard encoding defined somewhere)


Plot of distribution of all bitcoin transaction fees paid?

So this gives very useful info, but if I want to see the distribution of all historical transaction fees on the blockchain, how could I do that?

The information doesn't look useful. Distribution of fee rates used by unconfirmed transactions can be checked on many websites like https://mempool.space/ https://mempool.observer/ https://btc.bitaps.com/

Fees per transaction (BTC) in last few years:

https://bitcoinvisuals.com/chain-fees-tx-btc
There is one open PR to add mempool stats chart in Bitcoin Core GUI as well:
https://github.com/bitcoin-core/gui/pull/108
If you want to get fee rate and fee used in all the bitcoin transactions until now, API for any block explorer can be used. There are also few open source explorers like Esplora, NBXplorer, mempool etc.

Also, because the value of bitcoin has changed a great deal over the past several years, it would be sensible to measure the transaction fees in USD equivalent (like the article does)

Depends on the usecase. Bitcoin protocol is not aware of exchange rate for BTC. I would prefer to use sat/vByte for fee rate and BTC for fees.


The electrum public key xpub661MyMwAqRbcG8Zah6TcX3QpP5yJApaXcyLK8CJcZkuYjczivsHxVL5qm9cw8BYLYehgFeddK5WrxhntpcvqJKTVg96dUVL9P7hZ7Kcvqvd is a BIP32 extended public key. This can be used to derive child addresses.

The Bitcoin-Core public key 037acd3408dfb612a69204c5f5bafe2a326646398cdd16c85fedd65a4e96a28278 is a hex representation of the compressed form of a public key.

In order to convert to from the extended to compressed format, all you need to do is decode from Base58Check and grab the last 33 bytes (32 for private keys). I'm sure there's an implementation in PHP for Base58Check decoding. See BIP32 - Extended Key Serialization:

$ printf "xpub661MyMwAqRbcG8Zah6TcX3QpP5yJApaXcyLK8CJcZkuYjczivsHxVL5qm9cw8BYLYehgFeddK5WrxhntpcvqJKTVg96dUVL9P7hZ7Kcvqvd" | base58 -dc | xxd -p 0488b21e0000000000000000009f8b20f34eceef6ea60d35db00446763f7 dc76bd60ec8cf6fd63dc912499cbd4039edccce0e93f436a283947412378 8b33a28ed7ad7cffc3a130889f232344ad1c

The last 33 bytes represent the hex version of the compressed public key (last 32 bytes for private keys).

039edccce0e93f436a2839474123788b33a28ed7ad7cffc3a130889f232344ad1c


Running LND on testnet and mainnet at the same time on the same pc

It's perfectly possible to run several LND nodes on the same computer.
This is how I did it:

create separate folders for each LND node
In each folder create a lnd.conf file
make sure you set the datadir and the logdir to point to the folders you just created
make sure that each configuration uses different ports for rpclisten, listen and restlisten
adjust all other configuration to your liking. You can have multiple clients point to the the same btcd client (that's the one I used, but I'm sure it also would work with bitcoind) and the same chain or different chains
run lnd --configfile=path/to/your/lnd.conf for each lnd client you want to run

"pro"-tip
I've made aliases in .bashrc for the lnd and lncli commands for each different node.
So:
alias lnd-alice="lnd --configfile=path/to/alice/lnd.conf"
alias lnd-bob="lnd --configfile=path/to/bob/lnd.conf"
alias lncli-alice="lncli --rpcserver=localhost:10001 --macaroonpath=path/to/alice/data/chain/bitcoin/mainnet/admin.macaroon"
alias lncli-bob="lncli --rpcserver=localhost:10002 --macaroonpath=path/to/bob/data/chain/bitcoin/testnet/admin.macaroon"

To run the lnd node for alice I just type lnd-alice and then lncli-alice create if it's the first time or lncli-alice unlock if the wallet is already initialized. (The macaroon path isn't needed for create and unlock but it doesn't hurt either.)
Same thing for Bob.
This guide was very helpful in finding the right info: https://dev.lightning.community/tutorial/01-lncli/index.html


Is Bitcoin-lightning still not scalable?

Yes.
But with the coming  taproot upgrade and schnorr signatures we can create a single Bitcoin tx that is n - of - n multisig which enables us to do multiparty channels with n participants in 1 transaction. So if you take n=40 we can onboard 8bn people in 1 year. If you choose n=480 we can do it in 1 month. So let's keep fingers crossed for that Bitcoin upgrade.


What's the purpose of CSHA256::Write and CSHA256::Finalize

CSHA256 itself mimics OpenSSL's SHA256_CTX, and its constructor mimics the Init function. The Write method corresponds to the Update function. The Finalize method matches the Final function.

In short: you construct a CSHA256 object, call Write any number of times to feed it bytes to hash, and then call Finalize to compute the resulting hash.


One of the most common reasons for which miners go offline is when their profitability drops below the cost of electricity - this could either be the result of the BTC price dropping, or their local operating costs (costs including air conditioning, power, networking, hardware depreciation, etc.) rising, or the total network hashrate rising faster than they are able to acquire a new set of machines to proportionally increase their hashrate.
Remember that most miners aren't usually operating a single machine - they usually operate a mining farm, where a single machine's hardware failure or thermal shut off won't actually take the miner's entire operation offline, just reduce their effective hashrate. For a noticeable removal of hashpower from the network, such as when an entire farm is shut off, the cause is usually economical.