Improvements that could be made to how bitcoin propagates its transactions and blocks? As of 2018 what are the known improvements that could be made to how bitcoin propagates its transactions and blocks?

The answer partially depends on on what you mean by "how bitcoin propagates" and "improvements"-- Fibre transmits blocks vanishingly close to the lowest latency possible, but at the expense of using extra bandwidth. It doesn't seems likely that significantly greater protocol wise improvement to latency is possible, beyond more widespread usage of it.

BIP 152, avoids the bandwidth waste, but doesn't achieve quite as as low a latency by default.  The bandwidth usage of BIP152-like transmission could be improved further, but improvements seem kinda pointless: Right now with BIP-152 blocks are transferred with an average of 11802 bytes each... I have code that reduces it to about 550 bytes/block on average, at considerable CPU expense. But who really cares about saving 1.54 MB/day against a >>288MB background (transaction data) except perhaps for specialized applications like satellite transmission that use their own protocols?

On the other hand, transaction relay clearly has room for improvement. The existing approach is not very efficient especially for nodes with many peers. The issue there is that to be robust against malicious peers nodes announce all transactions to all peers. Transactions are announced by sending short hashes rather than whole transactions, but this still results in a ton of duplication. Effectively Bitcoin nodes use O(peers*transactions) bandwidth for tx relay, the use of short inv hashes only shrinks the bandwidth a constant factor (of 10-ish). A long time back I proposed using set reconciliation (also described on the forum post above in less detail) to make the relay of lose transactions more efficient without compromising robustness. Gleb Naumenko, Pieter Wuille, and I have spent much of the last year designing and implementing practical protocol based on this idea and should have something out somewhat soon.

Relay can also be improved in ways other than bandwidth efficiency. E.g. There have been several recent efforts to improve the privacy of TX relay, including the outbound peer grouping in 0.17 and the ongoing work on low fanout relay in dandelion.


bip-schnorr and HD Key Derivation Is it safe to use HD Key Derivation with bip-schnorr? The bip mentions that you should not throw away the first byte of a generated key.

  It is important to not mix up the 32-byte bip-schnorr public key format and other existing public key formats (e.g. encodings used in Bitcoin's ECDSA). Concretely, a verifier should only accept 32-byte public keys and not, for example, convert a 33-byte public key by throwing away the first byte.

Later in the bip, it mentions that you should do this when doing HD key derivation.

Link: https://github.com/sipa/bips/blob/bip-schnorr/bip-schnorr.mediawiki#public-key-generation

  Alternatively, the public key can be created according to BIP32 which describes the derivation of 33-byte compressed public keys. In order to translate such public keys into bip-schnorr compatible keys, the first byte must be dropped.

It sounds like its safe for the prover to drop the extra byte but not the verifier. Is this correct?

Is it safe to use HD Key Derivation with bip-schnorr?

Yes, it is designed to be.

  The bip mentions that you should not throw away the first byte of a generated key.

Perhaps this is worded confusingly.

It means that you can't use a variant of the signature scheme, which uses full public keys, but then throws away one byte of the public key at verification time. Doing so would just result in 50% of the signatures being rejected (because the public key wouldn't match what was used at signing time).

  It sounds like its safe for the prover to drop the extra byte but not the verifier.

This has nothing to do with safety, but about correctness.


Could the creation of bitcoin change create irreversible bitcoin "dust"? Bitcoin wallets send some change back to you if you have only large chunks of bitcoins in your wallet and try to send a small amount to someone else.Over time, could larger chunks of bitcoins gradually be broken down into dust as a side effect of this?  Like, when bitcoins are transferred through the network, could they gradually be split into 2 or more smaller amounts, and the smaller pieces broken down more, and so on?

The theory is this:

There is a notion of unspendable coins, whereby a minimum fee would be greater than the amount available to spend from a single address in a single payment. I believe as it is still possible to send zero fee transactions these can always be spent.

However if the network decided that there should be a minimum fee you would see unspendable amounts in wallets.

It is much more complex than this however - most wallets try to group together unspent coins in order to spend them, and in this way you could have multiple dust inputs to a larger transaction, which may result in a large amount of change going to one change address. You could consider this to be a theoretical consolidation of small payments received into a larger address.

There are privacy issues with this, and as always there is a trade-off somewhere.


Library for generating HD keys/addresses (ideally for python) I require a library that I can create (and later import) a HD master key, which I will use to generate hundreds of addresses for both testnet and mainnet!

Ideally, I need a python library (but had trouble of finding a good library for both testnet and mainnet addresses.

An example of how to create testnet addresses would be greatly appreciated (default functionality seems to be for mainnet, e.g. pybitcointools)

Good libraries for other languages are also very welcome!

Actually python library pycoin seems to be sufficient for both testnet and mainnet address. I had just missed it the first time I checked the library.

It also provides a powerful command line tool.


How to Get Bits 0x1c0168fd? How can I get this value, as I understand this complexity

https://github.com/bitcoin/bitcoin/blob/master/src/test/pow_tests.cpp#L55

0x1c0168fd

Here's the function that implements this. Each annotation refers to the line below.

unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
{

If we're on a network without retargeting, don't retarget.

    if (params.fPowNoRetargeting)
        return pindexLast->nBits;

Don't adjust up or down by more than 4x.

    // Limit adjustment step
    int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
    if (nActualTimespan < params.nPowTargetTimespan/4)
        nActualTimespan = params.nPowTargetTimespan/4;
    if (nActualTimespan > params.nPowTargetTimespan*4)
        nActualTimespan = params.nPowTargetTimespan*4;

    // Retarget
    const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);
    arith_uint256 bnNew;

Take the old nBits in compact form, and turn it into 256-bit form. I explain that in more detail here: Difficulty target representation in bitcoin wiki

    bnNew.SetCompact(pindexLast->nBits);

Multiply by the timespan (the time between the first block in the retargeting period, and the last block in the retargeting period.) Then, divide by the targeted timespan.

    bnNew *= nActualTimespan;
    bnNew /= params.nPowTargetTimespan;

If the result would be less than difficulty 1, change to difficulty 1 instead.

    if (bnNew > bnPowLimit)
        bnNew = bnPowLimit;

Re-encode as compact form for bignums. This is the reverse of SetCompact(int32_t).

    return bnNew.GetCompact();
}

Let's also work through the example you give. 0x1c05a3f4 should change to 0x1c0168fd.

0x1c05a3f4
1c          05a3f4
^ exponent  ^ mantissa

To decimal:

369652 * 256^28

Let's work out the timespans, actual and targeted

Actual: 1279297671 - 1279008237 = 289434
Target: 2016*600 = 1209600
Actual/Target ~= 0.239

Note that Target is more than 4x larger than Actual. We need to cap this, so we don't raise the difficulty too fast.

Capped timespan: Target/4 = 302400

Final calculation:

369652 * 256^28 * (302400/1209600) = 92413 * 256^28

Back to hex:

1c          0168fd
^ exponent  ^ mantissa

Re-encode:

0x1c0168fd

...and that is in fact correct.


Compute TxID of Bitcoin Transaction Originally posted to StackOverflow but with no response. Thought I might have better luck here.

I've successfully created a Bitcoin transaction in C# according to the protocol specifications. Here's the transaction in binary:

010000000162EF5D87E91090453009860C6F135EA2A490133B2633F8F7BA014889F5FF7E4A000000008A4730440220497E2D3F9BBBC0C122D839968FF880514440CED08A71D28E614FF4C871964024022049687008E4AF72682992325F17E95DA382D63E3FB14605A81B4498DFF9210E310141040BCF1BECF4EF6A5C24FD790CA86E8DCDFA3538CB97E99C254F84D209CFE47BFC6BF3B11ACA05DB7C7638301711070F176E848B650A406EB7AFC30AA9EA242489FFFFFFFF02404B4C00000000001976A9140A24F0387F05A6EECD1F8B327BB442EAB767CBC888ACCA165E00000000001976A914F8FB3B4E5D75652795DD13B209E0BE7BBD66B5D488AC00000000

I know the transaction is solid because the BTCs were transmitted properly. Furthermore, pasting my transaction above into this validator indicates the correct values.

What's stumping me is how the official transaction ID is generated. Everything on the Bitcoin and StackOverflow StackExchange sites indicate that it's generated by hashing the transaction bytes twice. I tried to do so as follows:

const String txHex="010000000162EF5D87E91090453009860C6F135EA2A490133B2633F8F7BA014889F5FF7E4A000000008A4730440220497E2D3F9BBBC0C122D839968FF880514440CED08A71D28E614FF4C871964024022049687008E4AF72682992325F17E95DA382D63E3FB14605A81B4498DFF9210E310141040BCF1BECF4EF6A5C24FD790CA86E8DCDFA3538CB97E99C254F84D209CFE47BFC6BF3B11ACA05DB7C7638301711070F176E848B650A406EB7AFC30AA9EA242489FFFFFFFF02404B4C00000000001976A9140A24F0387F05A6EECD1F8B327BB442EAB767CBC888ACCA165E00000000001976A914F8FB3B4E5D75652795DD13B209E0BE7BBD66B5D488AC00000000";

SHA256Managed sha256Hasher=new SHA256Managed();
Func<byte[],byte[]> doubleHash=(bytes)=>{
    return sha256Hasher.ComputeHash((sha256Hasher.ComputeHash(bytes)));
};
String txidHex=Utils.ToHex(doubleHash(Utils.FromHex(txHex)));

Utils.ToHex() and Utils.FromHex() are helper functions copied from StackOverflow which convert between byte[] and a hex string.

The code above yields a txidHex value of 27E6C3EF18D14FB49CBAC182BBDB47FC9D6F79DA65C101873207B60A957852A7 but searching BlockExplorer.com for that particular txid yields no results.

I mentioned earlier that my transaction did execute properly. It turns out that it did so using a txid of 11172aed3a61fe64ae82cb02e886757d352a4452f956a0703d0809880538ba58. If you paste that txid into BlockExplorer you'll see my transaction.

Which leads me to my question: Given a valid transaction byte stream (byte[]), how does one correctly compute a transaction ID?

Thanks.


If I were to generate an address and it happens to collide, legally speaking, would a transfer constitute theft? Let's say that somehow I generate a new address which happens to already be "taken". I realize the chances of address collision are extraordinarily low as per Is it possible to brute force bitcoin address creation in order to steal money?, but let's just say that it happens.

For argument's sake, let's say I land on 1FeexV6bAHb8ybZjqQMjJrcCrHGW9sb6uF (currently carrying a balance of about 80,000 BTC).

If I were to then sign a transfer to another address, would I be doing anything wrong or illegal? I think it'd be immoral, but does it constitute any legal wrongdoing?

I don't think this is quite like finding an ATM card and guessing the PIN, but more like walking into a Swiss bank, guessing a random account number and PIN, and walking out with whatever is in the safety deposit box, right? Is that "stealing" ?

IANAL.

What you describe is the act of taking something that isn't yours in full knowledge that somebody else invested effort and money to accumulate it.

Just as with your Swiss bank example: The rightful owner would be losing the funds that you misappropriated. Taking someone's property without their consent is theft.

I feel that this is independent of the way by which you gained access to the property, but rather derived from the intent of your action.

Perhaps more ambiguous would be scenarios where somebody receives a transaction to a key that you also control, or when you stumble on a key that has a Bitcoin balance that hasn't been moved for decades and could reasonably assumed to have been lost by the rightful owner.


Can I limit the back-up data in wallet.dat? I want to know is it possible to back-up manually from wallet.dat. I am running Dogecoin daemon locally.

Scenario:

say user (user1) have some dogecoin balance in addr1
another user (user2) have dogecoin balance in addr2
I want to back-up only user2 not user1

Is there any way to limit the back-up data in wallet.dat file?

No, this is not possible without custom software or a lot of extra work. The wallet.dat file contains all the private keys, and the reference client doesn't have a way to split it up.


How to handle a ridiculous amount of receiving addresses? By ridiculous I mean something absolutely absurd. 1 million+ addresses. Like say if Amazon had started to accept payments, how could they possibly keep up? Bitcoind probably can't keep up? How would I go about solving this? How does SatoshiDice or Blockchain deal with this?

There's absolutely nothing you need to do per address, so the number of addresses has no effect. You only need to process each transaction.


looking for faucet API so i could use it for tests - Automated faucet i would like to make some tests on test net, the issue is every time i have insufficient fund in my wallet i need to find a faucet and manually add funds.
i would like to create an automatic faucet that will fill the balance in my wallet, I've found an Ether faucet API in GitHub, and i'll really appreciate if anyone could help me with finding bitcoin API.
thanks

Use regtest, the regression testing network, not testnet. Results using it are reliable and repeatable,  most importantly don’t rely on the will of others.


Can't decrypt bitcoin core wallet, did I made a backup at the wrong time? I am confused on why my bitcoin core wallet password would not work. I am 90% sure I tried the right password(s).

wallet has many receiving addresses (10 000), I generated them with Linux from command line in 2017
I encrypted the wallet (probably after generating the addresses).
started receiving payments, made copies of wallet.dat after some of them, I see the different wallet.dat backups have same size (probably normal).
now in 2019 I downloaded Bitcoin Core 0.18.0 on Windows 10
put my wallet.dat in the bitcoin data folder
I can see the received coins
wallet shows as encrypted in the lower right corner
if I try to send and enter password, it says it is the wrong one

1) Can this be because my wallet.dat is since before I encrypted it ? If so, it would not show as encrypted when I start the program, right ?

2) Can errors like this happen because wallet is too large (10 000 addresses, 5.7 MB) and maybe it got corrupted while generating that many addresses ?

3) Any known issues of incompatibility between wallets created on linux ubuntu vs windows, that can cause such problems ?

4) Can password stop working because the Bitcoin Core version changed ? I can see the wallet was first created in Oct 2017 so I used whatever Bitcoin Core version it was then.

// It is kind of hard to make experiments with different wallet configs because of the large address list, it takes forever to load the program/blockchain.

Bitcoin Core 0.18.0 is compatible with any wallet version from 2017, if you want to check you can download any Bitcoin Core release. Bust most probably you are misspelling your password.

You could try also from the console. Use this command to decrypt it for 60 seconds:
In Bitcoin-Qt click Window -> Console.
walletpassphrase your-wallet-passphrase 60


Are usual raw BTC and BCH transactions differ? Can I make BCH transaction with bx? Is it possible to create raw BCH transaction with bx tool, just like I do it with usual bitcoin transactions?

If they are, I suppose it only takes to broadcast it in BCH network?

Yes, they are different, because of replay protection.  BCH computes the transaction digest for signing in a different way.  A transaction signed with this method will appear to a BTC node to have an invalid signature, and vice versa.

The bx tool does not appear to have been updated to support this modification, so you currently won't be able to use it to validly sign BCH transactions.


How do premined coins work? How does the concept of premining coins work?

For example, bitcoin gold is said to have 16,000 blocks premined. Well, at the current block reward of 12.5 bitcoins, 16000*12.5= 200,000 coins will premined for the developers which sounds sort of like a scam to me.

Anyways, how is this possible? Miners get rewarded for transactions they process. How do coins get premined on future blocks before being released?

Those are called "pump and dump" schemes. First you own a large amount of coins, then you make your coins public and try to convince everyone to use your coin, so its value will rise and you'll be rich.

  ... sort of like a scam to me

Well, a rumor that says Satoshi owns 1M Bitcoins (Source)

  ... how is this possible?

Bitcoin Gold will change the PoW to a GPU algorithm. Thus, the difficulty will start at "one" or so. Hence generating coins will be easy until the difficulty adjustment happens.

  How do coins get premined on future blocks before being released

Again, first they'll mine, then they'll make it public.


Testing Bitcoin Core source code? What's the recommended way to start testing the Bitcoin Core source code.

Thanks in advance,
Jim

What's the recommended way to start testing the Bitcoin Core source code?
testing for verification of bug fixes

See https://github.com/bitcoin/bitcoin/blob/master/src/test/README.md which says:

To run the bitcoind tests manually, launch src/test/test_bitcoin. To recompile after a test file was modified, run make and then run the test again. If you modify a non-test file, use make -C src/test to recompile only what's needed to run the bitcoind tests.
To add more bitcoind tests, add BOOST_AUTO_TEST_CASE functions to the existing .cpp files in the test/ directory or add new .cpp files that implement new BOOST_AUTO_TEST_SUITE sections.
To run the bitcoin-qt tests manually, launch src/qt/test/test_bitcoin-qt
To add more bitcoin-qt tests, add them to the src/qt/test/ directory and the src/qt/test/test_main.cpp file.

There is more.


Without IP address, are there any other identities considered for banning nodes Does a node only ban the IP address of a malicious node? or, there are other identities included. I mean, if a malicious user can generate multiple IP addresses to send fake tx, what will be the countermeasure then? Suppose, the other node, which will verify this tx, also a malicious attacker.

First of all, IP addresses are not stored in transactions nor can a node just "generate IP addresses".

How banning works is that nodes connect to each other via TCP sockets which are stream sockets so both nodes know the IP address of the other node. So when a node is banned, the banning node refuses to open a connection to the banned node. Nothing else is involved in banning, so if a node connects through another IP address (not by "generating IP addresses", that's not a thing, but rather by using proxies or VPNs), it would not be banned.


Why are the majority of miners not voting on on P2SH? Link (via reddit)

Currently the vast majority of miners just don't vote. Was there a mistake made in organizing the voting process (maybe most miners haven't heard about this vote?), or perhaps most miners really don't like either proposals?

Here is my personal opinion as to why:

1) There are no release binaries available for the new client, so it must be compiled from source. Some of the smaller pools and P2Pool users may not have the technical knowledge how to do this.

2) If you are running a modified client merging the changes from the latest P2SH code is not straight forward. Nobody wants to spend time upgrading when the changes might have to be reverted if the vote doesn't get past.

3) Downtime during the upgrade process is bad for business, particularly for large pools.

4) No votes ultimately count as votes against, as you say perhaps they don't like either proposals enough to care.

5) Voting hasn't officially started yet - It is based on the last 1000 blocks so should begin sometime on the 24th Jan.


Why are change addresses not associated with an account in your wallet? From what I understand change addresses are automatically generated when you use sendtoaddress but what I don't understand is why these change addresses don't become automatically associated with the sending account. What is the reason for this?

Bitcoin Core's wallet interprets Bitcoin transactions as payments. A payment is sending money from one entity to another, and is independent from what exact coins were sent and how much change was given back.

When you have a transaction which spends a coin of yours A, and sends it to addresses X and Y, with X being an address of yours, the payment is assumed to have amount A - (value of coin sent to X), and to be going to Y.

X is not associated with an account because the software does not expect payments to it, only a single transaction output which is a low-level detail of how one particular payment occurred.

That said, because of this, and various other confusing parts of the accounts system and their inability to be used in a best practices way, they are deprecated and will be reduced to just address labels in a future version.


getnewaddress and watch-only addresses (importaddress) I am aware it is possible to use "importaddress" to import bitcoin addresses without their associated private keys.

For an online shop that uses "getnewaddress" in order to present a customer with an address, is it possible for "getnewaddress" to only ever serve up "watch-only" addresses?

Ie - I do not want the Bitcoin core wallet to create new addresses. I want to use "importaddress" to import 10k watch-only addresses.

Is the above possible? And, if so, what is the expected behaviour of "getnewaddress" in the event of all 10k watch-only addresses being used up?

I don't thing your approach makes sense. Why would you importaddress as watch only and give them out over getnewaddress? Do you try to missuse bitcoind as a address database (importaddress = store  |   getnewaddress = retrieve)?

If you need endless amounts of addresses, you probably like to switch to Bip32 (a.k.a HDWallets). There is a experimental patch for bitcoin-core (https://github.com/bitcoin/bitcoin/pull/6265) which would allow you to call hdgetaddress without having the master seed (private key) in the wallet.


Where can I find documentation about interacting with bitcoind's json-rpc? I have created a coin by forking Bitcoin. Now I want to create web wallet for this, but do not know how to create json-rpc apis to communicate with the daemon server.
Is there any proper documentation for this?

Visit API reference (JSON-RPC)

There are several solutions:

You can build bitcoin-cli (which provides json-rpc communication with deamon through command line), and call bash commands on the server. For example, if You run PHP server, You can asynchronously run bash commands.
Also You can use json-rpc libraries on your server - feel free to google for them. For example, if You run PHP server, You can use a library like php-bitcoin-api.
Also, I recommend You to run own blockchain explorer which will help You to communicate with a blockchain of Your coin. For example, try to run bitcoin-abe explorer or any other.

Hope it will be helpful!


How do you validate a bitcoin address using bitcoinjs library in javascript? How would one validate a bitcoin address using the bitcoinjs library? Or is there another way to do this via javascript?

If you call

bitcoin.address.toOutputScript(address, bitcoin.networks.bitcoin)

It will throw an error if the address cannot be parsed as P2SH or P2PKH, or if the checksum is not valid. Replace the second argument with bitcoin.networks.testnet for testnet.


Is it possible to get all transactions from a single address with bitcoind? Is it possible to get all transactions from a single address with bitcoind?

For an address that is in your wallet, you can use the listreceivedbyaddress command. You would use the command as follows to get the transactions related to an address <address>:

bitcoin-cli listreceivedbyaddress 0 true true <address>

The 0 means list all transactions, including unconfirmed ones. The first true indicates that the address should still appear in the output even if there are no transactions; it just won't have any transactions listed under it. The second true means to include watching only addresses in the output. This only matters if your address is a watch only address.

If the address is not in your wallet, you cannot get all transactions for an address. This is because that would require maintaining an address index which Bitcoin Core does not do. Address indexes require more computing power and are not useful to the functioning of the node.


What's the deal with "legacy" and "segwit" wallets? I'm new to bitcoin, but I've already read about "legacy" and "segwit" wallets. At the beginning, I created a segwit wallet, given that it was described as a new standard. But then I found out that a market that I use can't send me bitcoin to this wallet because they use a legacy wallet. Later I read that it's impossible to transfer bitcoin between those two kinds of wallets. Is it true? If so, what's the idea? Because to me it doesn't make any sense. Especially that a new standard is probably created in order to obsolete the old standard and develop whole network using the new standard. Does it mean that my bitcoin in a legacy wallet in a certain point of time will be useless?
I tried this kind of transfer (legacy -> segwit) using Electrum and it didn't work. Does software matter?
When it comes to paper wallet created on bitaddress.org, which type is it? What kinds of problems with compatibility can it create?
Here it is said: "there is no general issue preventing a wallet from generating addresses of various output formats". But Electrum asks you what kind of wallet you want to use in the beginning, when you create the wallet. So... there must be some issue.

Later I read that it's impossible to transfer bitcoin between those two kinds of wallets. Is it true?

This is not true.
However a wallet needs to know about Segwit addresses in order to be able to send to them. Since it is a new address type (well new when it was introduced 3 years ago), software that hasn't implemented it yet won't know what to do with it.

I tried this kind of transfer (legacy -> segwit) using Electrum and it didn't work. Does software matter?

In what way did it not work? Electrum supports and uses segwit, so it should, unless you are using an older version of Electrum. Both the software and version of that software do matter.


Why does the length of a bitcoin key vary? Why does the length of a bitcoin key vary?  Why aren't they all the same length?

The length of a key doesn't vary. Private keys are always 32 bytes, and public keys are always 65 bytes (or 33 bytes for a compressed public key). Public key hashes are always 20 bytes.

The length of addresses vary because in Bitcoin's base58 encoding, leading zero bytes are expressed as a single "1". Other bytes require more than one character in order to be expressed in base58.


Working of crypto currency swaping (Exchanging) in Crypto exchange I am new in crypto. I know something about cryto currency and its working. I am curiosity about the working of Crypto exchange like binance,coinbase...etc... My doubts is

Some exchanges provide the swapping facilities like one click swapping from one cryto currency to another(That is without use of trading mechanism of buy order and sell order)...How it is possible ?
Actually the exchanges is hold a large amount of crypto asset for the users to provide one click swapping facilities to the users ....???

I expect a detailed explanation as possible from this community. Thanks

Any service or exchange allowing conversion of one asset into another (whether it is decentralized or centralized), is eventually executing the trade on an orderbook with a large exchange or liquidity provider.

Larger exchanges like Coinbase, Binance, Bitstamp etc. operate their own orderbooks, which have liquidity from users and market makers.

Second tier services like Shapeshift, Changelly etc. maintain balances in all the coins they support on larger services, and when a user wishes to convert an asset, they will execute a corresponding trade on these services.


Does bitcoind re-index or reverify downloaded blocks upon startup? If so is there a way to prevent this from happening?

It walks back a small number of blocks and re-verifies them, this ensures there's no obvious corruption and warms the cache. It takes a few tens of seconds at maximum on most hardware. You can adjust or effectively disable this using checklevel=1, but it is generally inadvisable to do so.


Deduct transaction fee always from 1 receiver address if sending some BTC amount to 2 different receiver addresses in single transaction Need help!! anyone there..
How to Deduct transaction fee always from 1 receiver address if sending some BTC amount to 2 different receiver addresses in single transaction

There is no concept of 'which address is paying the fee' in a Bitcoin transaction.

Instead, transactions are constructed as follows:

One or more UTXOs are specified as inputs. These UTXOs are spent in their entirety
New UTXOs are created as outputs. Each one is of a certain value, and pays to a certain address.
The difference (value of inputs - value of outputs) is the implied miner's fee.

So, it is up to whoever crafts the transaction to allocate Bitcoin to each newly created output in a way which satisfies the socially agreed upon transaction conditions (ie, "decide who is paying the fee, and then deduct the fee from the newly created output they will own").


im a beginner and i hve what probably a simple question I would like to know. If I do not buy a whole coin. and say I buy 40 dollars worth, or into a coin. how do I calculate the profit I make as coin rises. As I said I am beginner but i want to figure out how to get in the concurrency market.
any help would be a blessing i just want to buy some coins and maybe send my son to college one day. thanks

The cryptocurrency market isn't special, things work the same as they would in any other market.

It makes no difference how much you buy, nor what you buy (ie, bitcoin, an altcoin, Euros, a house, whatever).  Your profit is how much you sell for minus how much you invested.  So if you buy $40 worth of bitcoin, and sell for $50, you've made $10 profit (minus taxes and fees).


How do "Pay to Script Hash" transactions work? BIP16 gives the following example to explain "Pay to Script Hash":

scriptSig:    [signature] {[pubkey] OP_CHECKSIG}
scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] OP_EQUAL

But I don't get what's happening here. I've tried executing the script on paper (and assumed the parts in squared/curly brackets are treated as constants):

[signature] and {[pubkey] OP_CHECKSIG} are pushed onto the stack
OP_HASH160 hashes {[pubkey] OP_CHECKSIG}
The same hash comes from the scriptPubKey onto the stack
Consequently OP_EQUAL gives True
The [signature] is not checked at all!

If the {[pubkey] OP_CHECKSIG} is executed, the scriptSig would only give True, which makes even less sense.

To frame a clear question: How do "Pay to Script Hash" scripts work, especially this example case?

You're correct so far, you just stopped before you were finished. As BIP16 says, it "defines additional validation rules that apply only to the new transactions" -- specifically, "{serialized script} is popped off the initial stack, and the transaction is validated again using the popped stack and the deserialized script as the scriptPubKey."

So:

1) The script is popped off the stack, leaving only [signature] on the stack.

2) The deserialized script is added, leaving [signature] [pubkey] OP_CHECKSIG.

2) The transaction is validated again, that is, a normal signature verification occurs against the specified public key.


Check wallet address balance programmatically in PHP using Blockchain wallet api I'm tyring to fetch my wallet balance programmatically using the Blockchain wallet api. Currently I was expecting that a simple api call to https:/blockchain.info/merchant/$my_guid/balance?password=$my_blockchain_password would have returned the value but it currently returns this page.

Is there something I'm not doing correctly?

The Blockchain Wallet API provides a simple interface Merchants can use to programmatically interact with their wallet.
  Installation

  To use this API, you will need to run small local service which be responsible for managing your Blockchain Wallet. Your application interacts with this service locally via HTTP API calls. Click here for complete setup instructions on GitHub.

So you need to install the service, then replace the blockchain.info in that link with the IP to your server, or if it's on the same machine localhost:3000


What protection does Bitcoin have against Denial of Service (DoS) attacks? What protection does Bitcoin have against DoS attacks? Could you bring down a node by flooding it with data?

What happens if someone starts flooding the network with legitimate, yet nonsense, transactions? For example, sending bitcoins from A -> B -> C -> A -> B -> C -> A and so on in a rapid pace.

The network has a moderate amount of protection against DoS attacks. If you flooded a single node with data from a single source, it would just drop you. You could reconnect, of course. You would need a lot of resources and effort to knock out a node, but it's possible to knock out a single node by overloading it.

The owner of an attacked node could simply stop accepting incoming connections and he could still operate. He still might, by sheer bad luck, make some outgoing connections to malicious nodes. But he'd quickly close all such connections and be left only with connections to non-malicious nodes.

Transaction flooding is perhaps the DoS attack for which the network is currently best defended. Trying to flood the network with legitimate, but nonsense transactions won't work very well. To form such a transaction, you have to claim some coins. The network will only maintain one transaction that claims a given output. And to claim newer output generally requires a transaction fee.

It's hard to imagine any scenario in which an attacker could maintain a significant number of concurrently valid transactions without paying large transaction fees. And even if he could, as soon as those were accepted, he'd need to be able to claim additional transaction outputs to keep up the flood. The outputs of the transaction from earlier in the flood would be too new to spend without fees.

In any event, the harm would be minimal. If this were working to cause harm, that would mean legitimate transactions wouldn't be going through. This means their coins would be getting older and older while the attack had to consist of newer and newer transaction outputs. Soon, the legitimate transactions would win.


bitcoin's PoW, real time of creating one block i learn that bitcoin is created every 10 minutes and if block is created faster than 10 minutes, Difficulty will increase.

and study deeper, mining process is finding nonce that start 0 to increase 1 until finding hash value same or small rather than  'Target'

now, 2019-02-14, Block #562968 's nonce is 3,534,700,356.

it mean according this answer, it calculate 3GHash to create new block.

according to newest Mining Hardware ASICs, it says ASIC miner is calculating 14~16 TH/s. that does not make sense. PoW hash value is calculated 0.001s with this ASIC.

what i missed?

It is likely that a given block template will not produce a valid block for any nonce value, and so if that happens the miner will adjust some other values in the block template (such as the extranonce, the timestamp, the transaction ordering, etc), and then run through the entire nonce range again, to see if their newly adjusted block template will produce a valid block.

So just looking at the nonce value for a particular block does not tell you how many hashes were performed, it only tells you which nonce produced a valid block for that particular template. Before mining that block, chances are the miner ran through the entire nonce range many, many times, but with slightly different block templates.


Is there a way to use the block chain as entropy in random number generator? I want to create a transparent gambling/lotto site and use the block chain as entropy for lotto numbers, dice rolls, that kind of thing.  Would the transaction hash of the latest transaction be the best way to do this?  How often are transaction hashes created?  How would you, programmatically, access them?

The Bitcoin Lottery used an SHA256 hash of the two most recent blocks to generate random data and to my recollection there were not too many complaints about that method they chose. In any case it's only good for 256 bits of questionably random data every 10 minutes (20 if you don't reuse blocks) so there are probably better entropy sources, such as the setup they've built over at random.org


How to 'buy the dip' without constantly incurring network fees? I'm a newby to the crypto world and one thing that I have seen a lot of is people saying to 'buy the dip!'.
Fair enough, I like that idea. However, I have limited funds, and so thought that the best way to go about this is to wait until Bitcoin is up, sell a bit, wait until the next dip and then buy some more...
The problem is that I do not want to keep all my coins on an exchange like Binance (there are a lot of horror stories floating around there), so I want to move everything to e.g. Exodus. That's fine, but then I will need to constantly transfer between Exodus and an Exchange when I want to sell or buy. This will undoubtedly incur high network fees.
What is the best way to go about this, without spending huge amounts on network fees? Can I convert some of my coins to a stable coin (if so, which one?) when selling and then convert back to my coin of choice when buying?

"Buy the dip" is used by traders even for legacy markets and nothing specific for Bitcoin.

This will undoubtedly incur high network fees

For paying less in fees while moving bitcoin from/to exchange do the following:

Use P2P exchanges: Bisq and HodlHodl

Use open source bitcoin wallets with active development and support for segwit

Use RBF for all transactions. Try with low fee rate and increase later if it doesn't confirm in time.

Use websites like https://mempool.space that are helpful in managing bitcoin transactions with lots of information including CPFP details.

Use layer 2 if possible especially for small amounts: LN, Liquid. Exchanges that support LN: Bitfinex, Okex, LNMarkets etc.


Restarting mining on new transaction I understood that when a new transaction comes in, the miners have to start over, or at least change their merkle-tree to include the new transaction, essentially starting from scratch again.

If I look a the real-time transactions on https://blockchain.info/, how could miners ever make a block when there is never a break?

Unless you define a break as a few microseconds, and since every second you can calculate I believe billions of possible hashes, I still find it hard to grasp how a new block gets "chosen" or verified in human understandable terms.

Mining is computation based, but it's not constant, it's random. Essentially, every hash calculated generates a random number. If the random number is below the target, it's valid to create a block. The probability of any single hash being low enough is minuscule (you have a better chance of winning the lottery several times in a row), but that's why you need to calculate a lot of hashes. The actual merkle tree makes no difference as long as the tree itself is valid. Miners don't have any obligation to include all transactions in the mempool, so they typically will submit blocks whenever they find a valid hash.

So really, the updates to the merkle tree don't actually matter. In fact, it can be helpful since there are more nonces to try.


Get input addresses of a transaction using electrum I am using the latest (3.2.3) command line version of Electrum. I want to find the inputs of a transaction by looking at the history. The previous version of Electrum (that I was using 8 months ago) had a field (array) called input_addresses in its history output.

The current version does not have it.

A sample output from history is something like this:

$ electrum --testnet history --show_addresses | tail -40
...
        {
            "balance": "xxx BTC",
            "confirmations": 1,
            "date": "2018-09-21 12:27",
            "height": 1413976,
            "inputs": [
                {
                    "prevout_hash": "c96274d67e095...74c1af",
                    "prevout_n": 1
                },
                {
                    "prevout_hash": "f7e443ade3f0e...fe1eb8",
                    "prevout_n": 0
                }
            ],
            "label": "",
            "outputs": [
                {
                    "address": "myAB...",
                    "value": "0.49794855 BTC"
                },
                {
                    "address": "2N25...",
                    "value": "5.000258 BTC"
                }
            ],
            "timestamp": 1537522037,
            "txid": "3404f9fb96...0d253c",
            "value": "-5.00233525 BTC"
        }
    ]
}

So I am left with something called inputs containing some hashes. I need to convert these hashes to input addresses from command line.

The GUI version of Electrum will show the input address on the right of the hashes, like this:

c96274d67e095...74c1af:1    mhAhgR...
f7e443ade3f0e...fe1eb8:0    mhAhgR...

The hashed refer to the previous tx the input is consuming, and its vout position in that tx.

You will need to use the electrum API to fetch that transaction's details, and look at the outputs[vin] value for the locking script, and then convert that to an address by encoding it for base58check/bech32.


What happens to non-standard transactions in the case of a blockchain reorg? Blockchain

[m1]-> [m2] -> [m3] -> [m4]

         |  -> [f1] -> [f2] -> [new]

m - mainchain blocks
f - fork blocks
new - tip of the fork that is at greater height than the previous mainchain

In this case we must switch from the mainchain to the fork, due to the height of forkchain being greater than the mainchain.

My question is about transactions in blocks [m3], [m4]. In the case a transaction was in [m3] but not included in either the blocks [f1],[f2]. Since that transaction is not confirmed in the new mainchain (the forkchain) after the switch, would this tx be available for miners again to include for next block? Would this transactions be returned to the rawmempool?

And what if this transaction was added without isStandard check (in case adding in block), should we process isStandard check for this transaction?

Each of the blockchain forks assumes itself to be the only valid blockchain. They do not change their behavior due to a competing chain. They will require checks and confirm transactions completely independently from each other. It is likely that the same transactions are confirmed in both competing chains, just in different order and perhaps also at different heights. If a chain reorganization happens, and some transactions were not confirmed in the new best chain yet, they are still in the pool of unconfirmed transactions for that chain.

So, if you actually switch from [m4] to [new], and a transaction was not confirmed in the [new] chain that had been confirmed in the chain containing [m4], yes of course it would be in pool of unconfirmed transactions for that chain.

isStandard() is performed by every node when it learns about a transaction. Each miner decides whether to confirm transactions that don't pass isStandard() by themselves. It is irrelevant whether a competitor would include it or not for this process. If the forkchain is extended by a miner that doesn't confirm non-standard transactions, it will only be confirmed later when someone else chooses to do so.


Is there any way to make a transaction invalid if it is not confirmed before a certain block? It seems like it would be useful to avoid replay attacks if your wallet could specify that a transaction must be confirmed before say the (current+100)th block before broadcasting it

I guess there could be a problem with this scheme if the tx was no longer able to be included into a block after a reorg (esp for dependent txs)

No, there isn't a way to make a transaction that has to be included before a certain block number.

And there's a good reason for this: such a transaction would not be what is known as reorg-safe. Generally, transactions should be able to be included in either side of a block chain fork. If you make a transaction that can only be included before a certain block number, and then a fork occurs that makes a chain that doesn't include it before the designated block number, then that transaction gets reversed and so do all transactions that depend on the base transaction.


Bitcoin testnet: "Bitcoin is downloading blocks..." and other problem I'm trying to setup a local testnet with multiple nodes. Currently I have three nodes, and their mining powers are almost the same.

Things have been quite ok so far, except some problems that I need to ask from you.

When I run the getblocktemplate rpc call (because I later want to run a pool), it returns the message as in the title. For example:

./src/bitcoin-cli -datadir=./localnet getblocktemplate
error: {"code":-10,"message":"Bitcoin is downloading blocks..."}

although there are already 10 blocks in the blockchain maintained by the node. Its the same for other nodes as well. So why does that happen?

The nodes do not sync up very often although they are all connected together (each node has 2 inbound connections and 2 outbound connections). It is so often that one node is 2 block ahead of other and remains so for a long time. Thus, again, why does that happen? I thought after finding a valid block, the node will broadcast that to every connected node and the network will work on top of that block?

Please let me know if you can help answer either one or all the questions.

For your first question, the message "Bitcoin is downloading blocks" is produced if the client hasn't yet downloaded all the checkpoint blocks.  For testnet, there is exactly one checkpoint block, at height 546.  So until your client has mined 546 blocks, you will continue to get this message.

Unfortunately, when you do mine block number 546, it will be rejected since its hash won't match the hardcoded checkpoint, and you will still get this message anyway.  So you will have to remove the checkpoint from the code and replace it with a zero-height checkpoint matching your genesis block.


SegWit address to Non-SegWit addresses If I send from a segwit wallet to a non segwit wallet, does the tx not show up in the other wallet until there is a confirmation?

It's not about the type of address but wallet. Some will show unconfirmed balances/transactions, others won't.


Can private keys remain offline for their entire life? I am new to Bitcoin and this question is based on 3 assumptions that may be incorrect.

Assumption 1:
If I understand correctly, the Bitcoin address is generated algorithmically independent of the network, so I should be able to create a public address and private key offline correct?

Assumption 2:
I can receive funds through the network using my public address without ever having to make my private key known to anyone correct?

Assumption 3:
Now when it's time to spend my funds, offline I can create a Bitcoin transaction authorizing the transfer from my address to another location and sign it with my private key entirely offline. I can then transfer that transaction to a separate computer with internet access and then publish that transaction to the Bitcoin network to be mined/verified in the blockchain?

Conclusion:
If all 3 points are true then I should be able to keep my private key from the internet for it's entire life correct?

Yes, all three assumptions are correct. You can with some effort keep your private keys offline for their entire life.

A description of how to sign transactions offline is found here: How to sign a transaction using only an offline computer?

Adding a bit of detail on Assumption 3 along the lines of Tim S.'s comment: A computer that is offline would obviously not get updates from the network, so it would also not know which transaction outputs are available for spending. This could be mitigated by importing the blockchain data to the offline computer (for example with the bootstrap.dat).

However, it would be much easier to create a two wallet setup, where one online wallet knows only the addresses, and the offline wallet has the private keys. You then create the transaction on the online wallet, which has the transactional information and sign it on the offline wallet. That's what is described in the above linked question as well.

Update in 2017: The creation of a transaction on the online device and signing on the offline device is essentially what hardware wallets such as Trezor do.


bitcoind jsonrpc bumpfee not returning hash of newly created transaction I'm trying to implement replace by fee functionality with bictoind (v18) and bumpfee rpc call described here

It works by mean that new transaction is created with higher fee, but result should be:

{
  "txid":    "value",   (string)  The id of the new transaction
  "origfee":  n,         (numeric) Fee of the replaced transaction
  "fee":      n,         (numeric) Fee of the new transaction
  "errors":  [ str... ] (json array of strings) Errors encountered during processing (may be empty)
}

but I'm getting basically all null response

{
  "id": "BumpFeeRequest 1561247020661",
  "error": null,
  "txid": null,
  "origfee": null,
  "fee": null,
  "errors": null
}

Which makes it hard to identify the new transaction in down-steam system.

How can I get the txid, except querying for last tx

the issue is now tracked on https://github.com/bitcoin/bitcoin/issues/16275...


Port 8333 closed, fwd on Router OK, firewall port open, full-node not reachable I have set up my bitcoin/lnd full node and found out that port 8333 is closed.

When checking using https://bitnodes.io it tells me it's down

I've checked the router config and port 8333 is forwarded to the IP of the node.

If I scan or use telnet to connect locally to my node, it seems to be blocked.

Also ufw has been checked and sudo ufw allow 8333/tcp has been added.

As well sudo netstat -tunlp tells me that the port is in listen state.

Now, I'm kind of stuck and looking for help.

Many thanks in advance for a reply and stay healthy.

First, check your router opens that port too and redirects that port to you computer.

Then check CGNAT. If the external IP address your router shows isn't the same as you find when you search for "what is my ip", your ISP is giving the same IP to multiple customers. So you won't be able to open a port.


C# How to determine if a bitcoin address was generated by a BIP32 pub key? I want to create a boolean result method WasGeneratedBy that takes two params, a bitcoin address, and a BIP32 pub key.  Is there an efficient algorithm (and library, NBitcoin?) to accomplish this?

EDIT:

I'm showing my BIP32 newbieness..  Based upon the first response I received, I would like to modify my desired method such that all required parameters are present (including path).  This method gets its information from public web service so obviously that precludes any private keys or other that the user would be unlikely to submit.

I believe this should be possible given this blockchain.info example

https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

There is no such algorithm.

You need to know the path.


BFT VS Bitcoin PoW VS PBFT I've been studying consensus algorithms and kind of got stuck.

if you check out Neo's explanations on its consensus algorithm, it says
"Numerous protocols have been developed to solve the Byzantine Generals’ Problem.  Hyperledger, for instance, uses Practical Byzantine Fault Tolerance in its Proof of Work algorithm.  Neo, on the other hand, implements Delegated Byzantine Fault Tolerance to solve the Byzantine Generals’ Problem"

I clearly understood what Byzantine Generals' Problem, but I still don't understand what BFT means and what its relationship btw Bitcoin PoW.

It says "Hyperledger uses Practical Byzantine Fault Tolerance in its Proof of Work algorithm". Bitcoin also adopted PoW Algo, but I've never heard that Bitcoin is PBFT!

anyone can make a clear distinction btw BFT, PoW, PBFT?
Thank you in advance. God bless.

source : https://steemit.com/neo/@basiccrypto/neo-s-consensus-protocol-how-delegated-byzantine-fault-tolerance-works

BFT is short for Byzantine Fault Tolerance. Any algorithm that can tolerate Byzantine faults is called Byzantine fault tolerant.
Byzantine faults are faults that are malicious (lying, deliberatly delaying honest nodes, etc). So if you have an algorithm that can tolerate these faults, it is called a BFT (byzantine fault tolerant). But not just that, any BFT algorithm (PoW, PoS , PBFT) solves the byzantine general's problem with some assumptions.
PBFT was the first practical BFT algorithm that can be used.
BFT relates to PoW in that PoW is also a BFT algorithm, because the Bitcoin network can contain malicious nodes that cannot be trusted, nonetheless, we can solve the byzantine generals' problem by PoW.


Security: Blockchain.info vs bitcoind I want to set up a website that needs an online bitcoin wallet (able to deposit and withdraw at any time). Would it be better to use the blockchain.info's infrastructure through API commands or should I set up bitcoind on my own server?

The problem with using blockchain.info's API is that I can't use commands (such as withdrawing) while having 2FA enabled or other security measures (please correct me if Im wrong).

How can I make the website as safe as possible with blockchain.info's api?

In short: I prefer not to store the private keys myself. On the other hand I also dont want to provide all credentials to blockchain.info in a file on the server that can't be encrypted.

Both options, bitcoind and blockchain.info API are equally vulnerable.

When the attacker gains to access to your server, they can empty the hot wallet through an API call, regardless if they or your server has access to the private keys. This API call can be blockchain.info API call or bitcoind JSON-RPC API call.

The best practices to strengthen a bitcoin service against server compromising attacks

Use separate hot and cold wallets, only manually top up hot wallet from the cold wallet. You will lose the ability to withdraw everything at any time, without manual interaction from the team, but this is the only way to prevent losing everything at once.
Encrypt your server and use bare metal servers, so that your server is protected against physical attacks and malicious hosting provider attacks. You can only put relevant config files containing the API tokens to the encrypted partition and symlink the config file to the right location after manually decrypting the server on boot. This way anybody gaining the physical or service port access to the server  is less likely to gain withdraw ability.

Here are some other best practices for operations security.


wallet notification not working for multisig address I am new in bitcoin. I started research about bitcoin(Couple of days ago) for my project.I setup bitcoin node on my linux server and it is fully synchronized. here is my bitcoin.conf

prune=600
maxconnections=10
maxuploadtarget=20
rpcuser=XXXXX
rpcpassword=XXXXX
keypool=100
server=1
rescan=1
alertnotify=php \var\www\html\alert.php %s
blocknotify=php \var\www\html\block.php %s
walletnotify=php \var\www\html\wallet.php %s

Case 1: I created address using getnewaddress [account_name] then I sent some BTC from other wallet and I can get wallet notification.

Case 2: I created address using addmultisigaddress command then I sent some BTC from other wallet and I can get wallet notification.

Case 3 : I have created multisig address using createmultisig command. And I sent some BTC from other wallet (Check transaction status ). That transaction have enough confirmation But I can not get wallet notification.

Why i can not getting wallet notification of multisig address (Case 3)?

addmultisigaddress command will save redeemScript and attache it to that address. this is work for me and I can get notification.

So here i also want to know how secure is my multisig address if i create it using addmultisigaddress command? Suppose my server hacked, Attacker easily get redeemscript(using validateaddress command) and also can get sign address associate with it and privet key of that addresses. My BTC can be easly Theft.

Please suggest me the best way to create multisig address or answer me why I am not getting wallet notification of multisig address and what is alternative solution?

Info: I want to develop BTC wallet website where my user can create BTC address and can send and receive BTC. I want to create multisig address for every user. What is best way to create multisig address for them? any security advice welcome.

I searched lots of about this multsig address but I can't get any idea how to implement it (Multisig address using createmultisig command) in my project and wonder how other how other website support multisig address and handle it? Are they using addmultisigaddress command ? If yes then how secure is that account ?

if I can't get wallet notification then how can I credit or debit BTC from my user account (In my project).

Thank you in advance.

First of all, the createmultisig will not add the generated address to your wallet, it will only generate the address and the redeemScript.

The addmultisigaddress was probably working for you because you generated both addresses on the same core-client and then added them with the addmultisigaddress command. However, the addmultisigaddress call will not add the multisig address to the wallet if not at least m of the public keys belong to this wallet (Where m is the minimum number of signatures required to spend from this address). This is because you can't add an address to the wallet if you can't spend from it. However, if you are only interested in adding the address for the purpose of watching it, you can do the following:

Generate n public keys for the m-of-n multisig address. Theses can be generated within or outside of the core client
Receive all the public keys on the core client and create the multisig address with createmultisig n '''[<LISTS_OF_M_KEYS>]'''
after you execute the step above you will recive the multisig address and the redeem script. You may store these to a DB if you would like
In order for walletNotify to work you need to import the address with importaddress command (you may want to set the rescan parameter to false since you just created the address anyway)
Optionally, you can add the address to a particular account with the setaccount command

Note: The account feature in bitcoind is planned to be deprecated and  replaced by a labels feature (see: [1] [2] [3]) and this should be taken into account if you want to plan ahead for forward compatability


My transaction in Multibit HD has seen by 124 peers but yet after 11 hours, not confirmed? my transaction size is 1850 (bytes) with fee of 0.00051 BTC and it is seen by 124 peers in multibit HD .
but now after 11 hours, it is not confirmed!
in blockchain.info it said "Estimated Confirmation Time: Very Soon (High Priority)"
why it is not confirmed?
here's the hash:
4fba9205ed407f941a35ebb4f8e56ee565625d3a55da903bfae4c95dbe1548b1
thanks

Looks like it was included in block #441,666 and currently has 29 confirmations.


Does using deterministic wallets reduce our anonymity? Is it possible to figure out that certain addresses belong to the same wallet? Say I have 2 or 3 addresses that I know were created by a deterministic wallet like Armory. Is there a way to find all the other addresses that have been used by that wallet? I mean by that instance of a wallet, not all the addresses created by the Armory software.

It is hard, if not impossible, to do so when you only have the addresses. Most clients that support multiple deterministic addresses for a wallet, make sure it is impossible to know that two or more addresses are linked together. They usually use a random value as the starting seed and another random value to chain consequent new addresses.

Also keep in mind that they chain the addresses by generating new private keys. These private keys are generated through their algorithm (and are already hard to link together), but normally no one will come to know the private keys of the addresses you use. So it is already hard to link private keys together, but it is even harder to link addresses resulting from the public keys together. So it's good to assume it's impossible.

But, there is more than the addresses alone. There also are transactions. Most wallets generate a new address from a sequence whenever change is generated. This way, people could f.e. track all the transactions coming from one of your addresses and be able to follow the chain of addresses from your wallet.

To do so, they must be able to distinguish between transaction output and change, which is not trivial. This is not easy, especially when you have multiple transaction outputs. Also, once they make one mistake, they lose their track.

But this method is not as hard to exploit as using the addresses. However, the vulnerability of this method has nothing to do with the fact that you use a deterministic wallet. People will also be able to do this if you would generate completely random addresses for every change output.


Incorrect bitcoin address funded is there a way to recover bitcoins sent to a wrong bitcoin address?
Does bitcoin address change automatically within the bitcoin wallets?

No you cannot recover Bitcoin sent to the wrong address.

Many people and businesses use HD wallets that generate a new address each time. If the recipient has provided you with a new address but you send Bitcoin to their old one, it is very likely they will be able to recover your payment.

https://bitcoin.org/en/glossary/hd-protocol

Privacy is the primary reason to generate a new address for each new payment received.


How does Bitcoin Core's Coin Selection prevent change to be a dust output? Bitcoin Core's Coin Selection optimizes for minimal change outputs. How does Bitcoin Core prevent Change outputs of sizes below dust threshold from occurring?

See these lines:

// We do not move dust-change to fees, because the sender would end up paying more than requested.
// This would be against the purpose of the all-inclusive feature.
// So instead we raise the change and deduct from the recipient.
if (nSubtractFeeFromAmount > 0 && newTxOut.IsDust(::minRelayTxFee))
{
    CAmount nDust = newTxOut.GetDustThreshold(::minRelayTxFee) - newTxOut.nValue;
    newTxOut.nValue += nDust; // raise change until no more dust
    for (unsigned int i = 0; i < vecSend.size(); i++) // subtract from first recipient
    {
        if (vecSend[i].fSubtractFeeFromAmount)
        {
            txNew.vout[i].nValue -= nDust;
            if (txNew.vout[i].IsDust(::minRelayTxFee))
            {
                strFailReason = _("The transaction amount is too small to send after the fee has been deducted");
                return false;
            }
            break;
        }
    }
}

So Bitcoin core will give slightly less to the recipient rather than spend more than the payer originally requested, in the case of a dust-change output.


Different address prefixes for different address types / network combinations I'm working on a bitcoin project, and understand the differences between the wallet address which start with 1, 3, or bc1. I am looking to generate a wallet address that starts with 1.
I have seen the answers posted here, this is more or less the same info I have read elsewhere. However, when I create a legacy address via this method, it starts with an 'm'. When I create a wallet address that is not legacy, it starts with a 2.

Am I missing, or not understanding something? Why are my addresses starting with an 'm' or 2, instead of 1, 3, or 'bc1'?
How do I create a wallet address with a '1' prefix it Bitcoin Core

Thanks in advance!

Different networks use different address prefixes.
In Bitcoin mainnet:

P2PKH addresses: 1...
P2SH addresses 3...
P2WSH and P2WPKH addresses: bc1q...
P2TR addresses: bc1p... (see BIP 341)

In Bitcoin testnet and signet (see BIP 325):

P2PKH addresses: m... or n...
P2SH addresses: 2...
P2WSH and P2WPKH addresses: tb1q...
P2TR addresses: tb1p...

Bitcoin Core's regtest network:

P2PKH addresses: m... or n...
P2SH addresses: 2...
P2WSH and P2WPKH addresses: bcrt1q...
P2TR addresses: bcrt1p...

See also https://en.bitcoin.it/wiki/List_of_address_prefixes


What to do when you bought in BTC and the product hasn't been delivered I bought a supplement not available in my country (not drugs mind you) in bitcoin.

The company has given me all the proof that they had received my money but failed to send me my product and no longer answer my mails.

Is there any way I can get my bitcoins back ?

I tried to fill a claim but, for my country, bitcoins are not money - so the police told me that for them there is no transaction.

If not how can I help the bitcoin community by informing them to beware of this seller so they will not be stolen either (and for the FUD they are doing to the coin) ?

Thanks

Bitcoin is non refundable. What you can do is use sites such as Trustpilot to register your complaint. Also leave a review on Google.


Set bitcoin fee lower than minimum estimatesmartfee value Currently when I broadcast transactions, I seem to be unable to do so with a fee below ~10^-4 bitcoin (~$2 at current exchange rate). Any 'conftarget' value between approximately 100 - 1000 yields the same ~10^-4 estimate. I would prefer to send some less urgent transactions with lower fees but it's not clear how to do so if when I set conftarget=1008 (which I believe is the bitcoin core max) for the transaction, I cannot access fees lower than described. Is this expected behaviour for Bitcoin Core?
On a related note, it is not completely clear to me how the estimatesmartfee 'estimate_mode' parameter functions. From the help, I can see that the options are 'ECONOMICAL' and 'CONSERVATIVE', which seem quite self-explanatory on a high level (former estimates lower fees than latter for same conftarget), but in practice - how does the estimation differ? So far I have used the default 'UNSET', which I understand defaults to 'CONSERVATIVE' - would this affect the value of the apparent minimum possible network fee described above?

Regarding your first question, a new fee_rate argument has been added to the sendtoaddress command in the upcoming release (v0.21.0, currently at the third release candidate) of Bitcoin-Core.
In addition, a new send RPC was integrated which allows you to set a specific feerate too.
Regarding your second question (meaning of CONSERVATIVE and ECONOMICAL), see How does Bitcoin Core estimate the transaction fee? .


transaction broadcasts, declining node count, mining basics and costs. I read a lot about bitcoins and mining and nodes but there are a few questions that are still not answered, which are the following:

As I read when a transaction is broadcasted, at first it gets confirmed by active nodes and later goes to mempool and miners pick the ones with higher fees. So the question is, when I make a transaction on a website how can I make sure that the website is broadcasting my transaction? Maybe the site is holding it because it has high fee so that he can include it in his own block?
I noticed that nodes are becoming fewer every day , does this mean
when they become less the security of bitcoin or its value will
decrease ?
In order to become a miner, do you have to be a node too?
Btc.com has a crazy fast hash rate. Is it even worth to get into mining?
Say I want to become a miner with a chance of solving at least one block in a month, approximately how much should I invest? And should I buy cloud space or mine on my own?

When making a transaction, it is always broadcast on the entire p2p network. Either from the node your wallet is running on, or from the connected node, in case of a light wallet (SPV).
Value is not connected to node count. Security only to a minimal degree. The decrease must  be a short term effect. In the long run, node count will increase with adoption.
In theory yes. In reality, you would point your miners to a pool, which will be running a node.
Unless you have to access to electricity at industrial rates, mining is not profitable any more. The profits you might make will be from BTC price appreciation, which you can also achieve by just buying and holding BTC.
You can calculate your rewards by the ratio of your equipmemts hashrate to the overall network hashrate. E.g. you have 1/100000 of the network's hashrate under your control, you can expect to mine 1/100000 of the block rewards, which will yield you 0.000125 BTC every 10 minutes.
Avoid cloud mining, as it is more profitable for the service provider than you. Often, those operations are even outright scams.


Network Propagation over 100% When looking at transaction details (under summary of recent transactions) on blockchain.info what is Network Propagation, and what does the value greater than 100% mean exactly?

For example Network Propagation 120% - 2168 Nodes - (Excellent)

This appears to be a problem with the way Blockchain.info measures the network propagation. Blockchain.info is not connected to all nodes in the network, it just connects to a random sample of the nodes.

So if during the propagation new connections to more nodes are opened then they may also inform Blockchain.info of the existence of the transaction, so they will be counted as well. The same goes for clients that disconnect after the announcement, they will be counted towards the announcements but no longer to the sample size.

A practical example would be that Blockchain.info has 100 connections open. Now a new transaction shows up, the nodes will start informing Blockchain.info about this transaction. While this happens 20 new nodes connect and also inform it about the transaction. So in total it gets 120 announcements, and if BC.info uses the number of connections when it first saw the transaction we get 120% nodes that saw it.

The same is also possible for disconnections. If BC.info starts out with 120 connections and while it measures the propagation of the transaction 20 nodes disconnect after they informed BC.info about the transaction it has 120 announcements, for only 100 open connections at the time it calculates the propagation.

My guess is that the second method is used. Also BC.info had some connection issues lately so a 20% fluctuation in the number of connected peers is not surprising.


Is there a short-form for addresses with seven characters length? So, I am confused about address/key length. I am aware that the length is 16-36 characters, but it seems that many people online when giving their public key use a short-form of 7 characters (being only a part of the full address) to receive coins. Also when I was first looking into Bitcoin I read something in a tutorial that mentioned this 7 character short form but I can no longer find said tutorial (was a page similar to bitcoin.com and coindesk). Does this even exist?

I think what you are mentionning is firstbits. But this practice is now obsolete as it encourages address reuse, which reduces privacy.


What are the privacy implications of filtered blockchain downloads? There is now "Bloom filter" support in the network protocol for sending only relevant transactions to lightweight clients.

What are the privacy implications of the bloom filter? Does it leak any information about which keys I am interested in to the network?

It inevitably leaks information, but Bloom filters have a (controllable) false-positive rate. So a wallet client that is very concerned with privacy could make the false positive rate high enough so it becomes hard to distinguish which transactions the client was interested in.


Electrum transaction, 1 confirmation but i want to cancel it I sent some bitcoin from my electrum wallet, however i left the mining fee very small so its stuck. But the transaction only has 1 confirmation, i dont want the transaction to go through so is there a way i can cancel it even though it has 1 confirmation. And I also read that after a few days if it isnt confirmed the right amount of times the transaction will jsut cancel so i was wondering how many days would it take to cancel if no miners confirm it.

Thanks.

If a transaction has 1 confirmation then it is in a block. Every ten minutes (on average) it will get another confirmation. It should have 6 confirmations after about an hour.

There is no way to cancel it.


Is there a limit on number of transactions included in a block? As per my understanding, every transaction is included in a block and the difficulty to find a block gets adjusted such that one block is found for every 10 minutes. Is it the case that all transactions occurred in those 10 minutes included in that block? Is there a limit on number of transactions that can be included in a block?

Short answer: Yes, there's a limit but it depends on transaction size, not count.

Basic summary of blocks

Miners are incentivized to put as many transactions into a block as they can with fees. The more transactions, the more fees the miner collects, and that can mean an extra coin on top of block rewards. A block gets bigger as more transactions are added, this is the problem and the reason why fees need to be a certain amount.

Block size limit explained

But the more transactions a block has the larger it gets in size and larger blocks can fail to propagate, creating an orphan block. Orphan blocks cause a lot of pain to the network, the miner loses 25 BTC (current block reward) and certain confirmed transactions become unconfirmed. To prevent this from happening often, the Bitcoin protocol has a block size limit to enable speedy propagation and reduce anomalies. Each block has a size limit of 1,000,000 bytes. This can change based on community consensus and probably will some time in the future due to technological progress causing the internet to be faster and more robust. A valid block is below 1 million bytes in size, otherwise it just won't be accepted by most miners.

Which transaction make it in

Most miners choose transactions as profitably as possible. They go for largest fees and smallest transaction sizes. Since they can't claim all transactions they go for efficiency. You can have a transaction a little less than the size of a block be included and processed if it had a fee beating the collective fees of the next hundred most profitable small transactions that would normally be included in a block. This system is called priority, it's all about maximizing profit for the miner.

Resulting amount of transactions

The transaction count in a block can range be reasonably anywhere. There have been blocks with no transactions other than the block reward. I say reasonably because the max depends on the smallest possible transaction size (41 bytes + 9 bytes) divided by block size. The average seems to be around 350 transactions per block.


Using Bitcoin ATM's, how does selling work? How do Bitcoin ATM's work? I have a wallet on my computer and wanted to know how would the bitcoins there be transferred to the ATM and exchanged for cash.

Could somebody explain this process to me?

Atm will generate a bitcoin deposit address
Client scan it using smartphone and send bitcoin to that address
Atm will wait for confirmation and emit fiat money from dispenser

Things to consider:
KYC level for bitcoin amounts
Generation of addresses
Confirmation number
ATM connected full node
Rate exchange
And more , but I believe this is the basic.


Increase the fee for hanged transaction So I made the transfer from my wallet’ address to other wallet. I use Bitcoin Core 0.14.2. And I read "Would replace by fee increase the fee on my transaction?"

I apologize, was mistaken and appointed the small commission. Transaction hangs as unconfirmed the fourth day. How many will hang and it will be forgotten for backward God only knows.

Thus, my small mistake can lead to dramatic loss of time. The key of command line "- walletrbf" (for use further "bumpfee") is incompatible with a key "- prune".  In general this key  does many useful keys useless. But I use
 "- prune" for easy obvious reasons.

Can somebody explain, as it is possible to increase the fee of the outed transaction. Or to accelerate time of removal of transaction from network memory, spent it and a refund back to my wallet' address. I did not find any services for these actions in the Internet.

P.S. After all above I closed BTC Core and started it again. I get notification like this "Blockchains integrity failured. Start reindex blockchains?".  I just click "Abort" button to close BTC Core and restart it. I get both tx on the right side in gray. But after 20-30 minutes old (conflicted) tx disappeared forever,  simultaneously the new (confirmed) tx painted in black. Long Life "Rolling Stones"!
That's all.


Correct syntax for Bitcoin URI: bitcoin://1xxx-etc or bitcoin:1xxx-etc? To make clickable Bitcoin links, to let people easily pay from their wallet, I see two formats being used in various situations:

bitcoin:14bTZTm1uX2uVAqHr62oyGFEkwy2mNLbVb?amount=0.25
and
bitcoin://14bTZTm1uX2uVAqHr62oyGFEkwy2mNLbVb?amount=0.25

So that's with and without the two slashes. When testing on Android, they both seem to work. Which is correct?

The correct format is bitcoin:<address> as defined in BIP21 and extended in BIP72.

The format with the slashes is mimicry of the HTTP URL format.  Tim Berners-Lee has apologized for inflicting those extra slashes on the world. :-)


Number of transactions per block I am just starting to understand the internals of bitcoin. I am a CS graduate and familiar with most bitcoin terminologies. I've read Satoshi's paper and researched the question but I couldn't find the answer.

Now that it is much more profitable to mine blocks for the reward (25coins) than the transactions fees. my question is what prevents miners from only including 1 (or 0 if its allowed) transactions in their generated blocks as hashing smaller data will result in greater hashes/s (yes?)

Also, and most importantly is how does a miner decides that enough transactions has been received and start finding the nonce as adding a new transaction to the attempting block will result in all the work done for this block as obsolete.

I'll try to give my guess so correct me if I am wrong. While the miner tries to find the new block it buffers any received new transactions. If he/she finds the new block or a a new valid block is received they start working on the next block by putting all the buffered transactions into a new block and get to work.

Please excuse me if my questions seems primitive. I tried my best to research and any links are greatly appreciated.
Thanks.

Nothing is stopping miners from not including transactions in their blocks, in fact it has happened before.

  hashing smaller data will result in greater hashes/s (yes?)

No, the hashes are always the same size, and adding transactions to the block does not make any difference to the difficulty in finding the nounce that validates the block (the speed of hashing remains the same, and the probablity of finding the bock also remains unchanged), hence it makes financial sense for miners to add as many as they can since they earn more transaction fees.

Edit: for more details on the mining process, this thread provides a good summary:

  Simplified mining process 1) Miners select tx from the memory
  pool for inclusion in a new block (the number, method, and criteria is
  up to the miner) 2) Miners construct a merkle tree from the tx in
  step #1 3) Miners create a block header with the merkle tree,
  prior block hash, version, timestamp, and nonce 4) Miner will
  hash the blockheader.  If it is a solution go to step 5. 4a)
  Miner will increment nonce and go to step 4.  If nonce range is
  exhausted go to step 4b 4b) Miner will modify another element in
  blockheader, reset nonce range back to 0 and go to step 4 5)
  Miner has found a block.  They broadcast it to peers.  So
  once a miner finds a block they are done.  All the work for deciding
  tx comes BEFORE solving a block.

So the number and size of transactions has no real impact on the repetitive step #4.

Having said that, it has been claimed that some miners do choose smaller blocks in order to minimise network propagation delays, and hence reduce the chance of their block becoming an orphan.


How to access my bitcoin gold without compromising my hardware wallet? I have my bitcoins in a hardware wallet(trezor and nano ledger s) and I want to keep it that way, my mnemonic seed is stamped in metal and stored securely, so I won't change it, and I will keep it airgapped. According to bitcoin gold, they have support in three wallets:

Coinomi Guarda Freewallet

As far as i can understand, none of theese wallets have hardware support, and trezor or nano won't support bitcoin gold natively either. What are my options here?

As far as I can see the answer is that you can't access your BTG without one of:

A BTG app from Trezor/Ledger (note it is possible to write custom apps for the Ledger but it would want to be a LOT of BTG for you to countenance that),
Accessing the private key stored in your hardware wallet.

The second option, while not easy or as safe, would probably be the most economical from a time and effort perspective. The approximate steps to take would be:

Find or write an app that will allow you to enter your mnemonic seed. This could be done on an air gapped PC and you could microwave the harddrive afterwards if do desired,
From the master key you would then need to acquire the specific private key(s) for the transactions you want to spend on the BTG chain,
Construct and sign the transactions for that you want to spend on the BTG chain. And VERY importantly make sure whatever the transactions implement whatever BTG's replay protection mechanism is so that they can't be replayed on the BTC chain.
Copy the signed transactions from your air gapped PC onto a USB drive and broadcast with a BTG node.

Essentially that's a lot of hassle and not without a fair degree of risk. I guess it will all come down to how the value of BTG fares.

Personally I had my BTC stored in my full node wallet at the time of the BTG fork. After that I transferred them back to my hardware wallet. Now once BTG goes live I have the option of copying the wallet.dat into the BTG full node.


How old should be my bitcoins to send them again without transaction fee? I'm making some test for a bitcoin merchant webpage. I want to test different actions without paying transaction fees everytime, but I can't since I use the same few bitcoins for everything.

Sooo how long should I wait for my bitcoins to be transfered wihout fee?

As the coins "age" they will have a higher priority.

I don't know the algorithm, but believe it is roughly like a day or so and then the age of the coin no longer is a factor.

So if you are seeing minimum fees for coins more than a day after you've received them, it is because of other reasons, such as having outputs at amounts below 0.01 BTC.


Does a transaction always get verified/processed by ALL full nodes in the network before being added into the block by some mining node(s)? If not, then why is it often claimed that the blockchain scaling issue is due to the fact that all tx has to be verified by all full nodes?

As long as a mining node found the correct nonce, the tx will be added to the block and the blockchain advances. It does not matter if the tx is not yet verified by some full nodes in the network.

(Yes, it will most probably get verified by all full nodes after it got into the block and the block propagates throughout the network. But this is not relevant as the blockchain already advanced (assuming there is no fork).)

Does a transaction always get verified and processed by ALL full nodes in the network before it is added into the block by some mining node(s)?

Technically no, but only because of the way you've phrased the question. In a decentrilized network, there is no way to know what ALL nodes have done.

However, EACH particular full-node (including miners) will verify every transaction in a candidate block before updating their own blockchain state to the new head. Since no one will include the invalid block, it doesn't accomplish anything to produce one.


Bitcoin core for Mac OS X stuck at the 95% mark for hours My Bitcoin Core app (the latest OS X client) is downloading the chain. It has been at the 95% mark for many hours now. It's progressing, but very slowly.

Is this normal?

I would think so, because this is not the first time this happens to me.

As long as blocks continue to download, then all is well.

The Bitcoin client is doing a lot of disk i/o and CPU crunching when verifying each block, so hardware performance will matter.  If you have an encrypted filesystem performance issues are exacerbated.

A slight improvement will come when the Bitcoin.org v0.7 client is released.   And large improvements will come with the version after when the LevelDB database is used, improving access speed to reading and writing the data and "Ultraprune" is implmented which lessens the amount of storage.

Other solutions include using Simplified Payment Verification clients.  Electrum might be a choice for you to consider if your hardware is borderline for operating the full Bitcoin.org client node.


How fast could AlphaGo mine bitcoins? This question resulted out of a shower thought. In my naive understanding, both, training neural networks and mining bitcoins require a lot of math crunching that is best offset to ASICS and GPUs. AlphaGo is powered by a lot of horse power, but more importantly by a lot of custom ASICS.

According to Wikipedia, one Tensor processing unit currently clocks in at 180 TFLOPS. The latest AlphaGo version used 1920 CPUs and 280 GPUs to run it's neural network. (The hardware it was trained one is likely a number of times larger than that)

Assuming you would task that cluster to mine bitcoins instead of powering a neural net. At which rate could it mine bitcoins and would it be profitable?

As you said, AlphaGo is "just" a collection of CPU's and GPU's. CPU's can mine at a few dozen megahashes (millions of hashes) per second. GPU's can mine at several dozen gigahashes (billions of hashes) per second. ASIC miners mine at several terahashes (trillions of hashes) per second. So a miner is a 100 to a 1000 times better/faster than a GPU which is a 100 or a 1000 times better/faster than a CPU.

So mining with AlphaGo would be insignificant. You would be better off with even one ASIC miner. If mining with CPU and GPU farms was profitable, people wouldn't bother with ASIC's.


How do I migrate to Bitcoin XT from Bitcoin Core? Some people are saying Bitcoin XT is faster and more secure, but I don't know how to migrate from Bitcoin Core to Bitcoin XT, because I have all my coins on Bitcoin Core.

What are the steps I need to perform to safely migrate from Bitcoin Core to Bitcoin XT?

The two clients are based off of the same code base. To use Bitcoin-XT, you only need to make sure your Bitcoin Core client is shut off when you start the Bitcoin-XT client. The two programs use the same data directory and wallets, so all your coins will still be there.

See "Should I be running Bitcoin Core or Bitcoin-XT?" for more info regarding the differences between the two software packages.

In the README.md of Bitcoin-XT, it even says:

  XT uses the same data directories as Core so you can easily switch back and forth.


How much money would it take to bribe the majority of miners to attack the system? I think this question is just a re-formulation of the 51% attack, but it has me thinking: miners are monetarily incentivized to not perform a 51% attack, but there must be some amount of money will cause their incentives to switch. So how much is it?

It is commonly understood that miners have invested in equipment, and so doing something to harm the value of the cryptocurrency they're mining (ie, engaging in a 51% attack), undermines their investment.

But what if a very wealthy entity bribed the miners, external to the bitcoin system, with an amount that exceeds any returns the miners could possibly hope for? For example: a govt pays a majority group of miners $X billion + electricity costs to just 51% attack the network with empty blocks indefinitely.

I think an attack like this could be effective in hurting the public confidence and price, but there are ways it could be thwarted too (switching the POW algorithm, for example). So I don't think it is dangerous in a fatal way.

So my question is: can we estimate how much money it would take to successfully attack the network in this way?

Cost of attack = [(51% of block reward + fees per year)-(cost of 51% of equipment purchased for the next year)-(51% of the network's electricity costs for the next year)] * (number of years worth of income it takes to bribe the miners?)

Am I missing anything here? Or making false assumptions? Interested to hear what others think

In a parallel thread on "https://bitcointalk.org/index.php?topic=2512771.0" I didn't do the exact math, but a rough calculation shows this:

Currently there is a hashing power of the equivalent to roughly 800.000 mining boxes type "AntMiner S9". For a 51% attack you'd need to buy 400.000 + 1, and bring them on the network (their power cosumption is 1200W, so you'd need a coal or gas power plant, industrial grade level). If you want to "buy" the miners (bribe), then it requires a lot of communication to them, and a financial incentive. Would the miners follow the fork (bribe), if they can see, that they will loose the value of the bitcoins to be mined? I mean, after such an attack would have worked out, the value of bitcoin would run against zero (quickly). What is the remaining incentive for a miner?
Your one-time bribe would maybe need to be equivalent to maybe a 1 year income of a miner, and this for 51% of the miners. Currently a 12,5BTC reward is ~10.000 EURO/CHF/USD, 6 per hour, 21 per day is 18mio a day. And you need 51% of miners. Big gee ...


OP_LSHIFT & OP_RSHIFT purpose & functionality What is the purpose & functionalities of the LSHIFT & RSHIFT Script OP codes ?

For all intents and purposes, Bitcoin has no such opcodes.
Very early versions of Bitcoin's reference implementation did, until version 0.3.10 (August 2010) when they were disabled together with a number of other opcodes. New opcodes with identical functionality could be re-introduced now with a softfork, but the fact that similar opcodes existed historically wouldn't make that any easier (or harder) - they'd just be new opcodes.
As for what they did: they implemented an operation similar to the >>= and <<= C/C++ style operators, multiplying and dividing by a specified power of two.


What happens to off chain transactions when the blockchain is reorganised? Many companies seem to use off chain transactions to transfer bitcoins between their own customers. What happens when a side chain gains dominance and no longer contains a block with the underlying transaction?

Let me explain my question with an example:

Customers A and B have Coinbase wallets.
Customer A receives 10 bitcoins from Block 1 into his wallet.
He instantly transfers 5 bitcoins to B's wallet using an off chain transaction.
B spends 1 bitcoin using and on chain transaction and that is included in Block 2.

This is displayed again below:

Block 1 -> A -> Off Chain -> B -> Block 2
10 BTC          5 BTC             1 BTC

Now suppose Block 1 and 2 now become invalidated due to a reorg of the blockchain and the initial 10 BTC transaction in Block 1 never makes it into a block again. However, the 1 BTC transaction from Block 2 does make it back into another block.

This could potentially corrupt an off chain system like Coinbase because it would end up not having the initial 10 BTC from Block 1 but customer A has still managed to give 5 BTC to customer B who has managed to send 1 BTC back to the blockchain.

In this example the off chain wallet company eg Coinbase, BitPay, Circle etc will potentially lose 10 BTC because it has already been allocated within their systems.

How do these companies resolve this issue and unravel their systems?

Do they detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet? Or do they use other means? Maybe they just take the hit and lose the 10 BTC from their profits?

You answered your own question.  Rephrasing as a statement:

  [Some companies] detect that Block 1 no longer exists and then reverse the transaction to A and B's wallet.  [Other companies] take the hit and lose the 10 BTC from their profits.

Which solution to implement is a choice that's up to the company---neither solution is inherently better or worse.  (Reversing the transaction is better for short-term profits, but taking the hit (if you can prevent most fraud) may make your customers happy and increase long-term profits.)

Bitcoin payments are push-based: Alice pays Bob.  An alternative solution to this problem is requiring depositors to provide a backup payment method that is pull-based. In the event of a double-spend, this will allow Bob to charge Alice's debit card.  Although expensive, time-consuming, and not guaranteed to work, the ultimate pull-based payment method is going to court and suing the double-spender.


Where can I find the rpc api endpoints for electrum? Somehow I cannot find a list of the possible rpc commands. Basically they are just the bitcoin rpc commands I guess but I cannot find a list for that either...

There are some examples here:
http://docs.electrum.org/en/latest/merchant.html#jsonrpc-interface

Also there is a list here but e.g. addrequest from the link above is not in there:
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Electrum RPC methods a little different from full bitcoin node RPC. You can run help command in order to get all methods. Here is an example:

"addrequest",
"addtransaction",
"broadcast",
"clearrequests",
"commands",
"create",
"createmultisig",
"createnewaddress",
"decrypt",
"deserialize",
"dumpprivkeys",
"encrypt",
"freeze",
"getaddressbalance",
"getaddresshistory",
"getaddressunspent",
"getalias",
"getbalance",
"getconfig",
"getfeerate",
"getmasterprivate",
"getmerkle",
"getmpk",
"getprivatekeys",
"getpubkeys",
"getrequest",
"getseed",
"getservers",
"gettransaction",
"getunusedaddress",
"help",
"history",
"importprivkey",
"is_synchronized",
"ismine",
"listaddresses",
"listcontacts",
"listrequests",
"listunspent",
"make_seed",
"notify",
"password",
"payto",
"paytomany",
"restore",
"rmrequest",
"searchcontacts",
"serialize",
"setconfig",
"setlabel",
"signmessage",
"signrequest",
"signtransaction",
"sweep",
"unfreeze",
"validateaddress",
"verifymessage",
"version"


What all the addresses are in my Electrum wallet? What are addresses mean in Electrum? Are they some default/predefined/popular addresses? Are they all my BTC addresses?

Can I delete them entirely? I couldn't find delete option, only freeze.

Why are some green receiving and some yellow change?

They are indeed all your addresses. The addresses labeled receiving in green are meant to be given to people from whom you wish to accept a payment and the yellow change addresses are there for Electrum to use when you make a transaction with an unspent output.

About receiving addresses

Using a separate address for every incoming transaction is better than using the same address all the time for a couple of reasons:

It increases your privacy. If you used only one address, all your transactions and your balance would be easily known to everyone who knows your address, so for everyone who has ever paid you or received a payment from you. If you use different addresses, it's much more difficult to relate the different transactions to the same person.
It allows you to discern between different sources of funding. Because in Bitcoin there is no "transaction title" or any other description, if you simultaneously await two payments, let's say for the same amount, you would have no way to know who paid you if not for having given different addresses to different payers.

If you want to use an address multiple times, as for example if you publish a donation address on your website, you can do it of course, Electrum won't stop you. In some cases it's not a problem at all, but you have to understand that you sacrifice a little bit of your privacy, e.g. other people can find out what's your balance on this donation address. just It's useful to label any address you use (publish or give to anyone) so that you know where from each transaction comes.

About change addresses

The change addresses work like this: let's say you have an address 1Abc with 0.5 BTC and another address 1Xyz with 0.5 BTC. Now you need to pay someone with an address 1Pay 0.7 BTC. Electrum would handle this by creating a transaction with inputs from addresses 1Abc and 1Xyz (which sum up to 1.0 BTC) and the outputs would be 0.7 BTC to the address 1Pay and 0.3 BTC to the address 1ChA, which is one of your change addresses. Each change address is used only once. The reason for the existence of change address is the same as reason 1. above: it increases your privacy.