How do pool server's handle multiple workers sharing one connection with Stratum protocol

The client needs to handle dividing up the extranonce2 across all workers. Proxies can do this by moving part of the extranonce2 into the extranonce1.

Generally, the entire pool uses the same job_id for any given template, though it's only guaranteed to be valid across a single connection.

There is no reason for a server to send a new mining.notify when additional workers authenticate, though there is no reason they couldn't choose to either. You'll notice that most servers send the first mining.notify before any workers authenticate.

The practical problem with multiple workers on a single connection is that share difficulty is also set per-connection, and it is common that servers would want to give different workers their own difficulty levels.

While multiple workers is not especially common, it is helpful to reduce bandwidth on a large network where you may want to track pool statistics per-worker - or even conceivably per-chip (though no software supports that as of this time).


Nodes will relay all transactions to each other, true. But, how do you know all miners have the same block if only one is actually published? In any case, miners are incentivized monetarily to include the transactions with the highest fee rate (fee/kB) because the miner gets all of the transaction fees. So, it would not be surprising if miners had similar blocks since they all would presumable try to maximize the transaction fees.


How to get addresses from scriptPubKey in segwit transactions?

There currently exists no native address format for witness outputs, so the answer for P2WPKH and P2WSH is simply: you can't, and shouldn't. If you convert the 20-byte hash inside a P2WPKH output to a 1xxxxxx, and show the result, people may think that is an address more money can be sent to. However, that would result in a P2PKH output, which a pure segwit wallet may not understand.

However, most segwit outputs initially will use the P2SH wrapper (resulting in P2SH-P2WPKH or P2SH-P2WSH programs), which just look like (and behave like) P2SH addresses.

A new native segwit address format is proposed in https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki. That can only be used when both the receiver and sender software support it however.


What is the difference between "native segwit" and "bech32"?

TL;DR: Native segwit refers to segwit outputs without P2SH-wrapper. Bech32 is the address format used to represent native segwit-v0 locking scripts.
Wrapped segwit vs native segwit
When segwit activated, it introduced the zeroth generation of segwit, segwit-v0. The corresponding locking scripts came in two flavors:

The forward-compatible "wrapped segwit" or "nested segwit" output types wrap the witness program in a Pay to Script Hash (P2SH) output. There are two variants, P2SH-P2WPKH for single-sig, and  P2SH-P2WSH for arbitrary scripts including multisig.
As all P2SH addresses, wrapped segwit outputs get encoded using Base58Check. The wrapping allows any P2SH-enabled wallets to send to wrapped segwit addresses.
The compatibility-breaking "native segwit" output types which can only be paid to by segwit-enabled wallets. Native segwit outputs are more blockspace efficient because they avoid the additional data necessary for the P2SH-wrapper by resolving the witness program directly. Native segwit locking scripts get encoded using the newly introduced bech32 address format (BIP-173) (for v0 native segwit outputs).

Other uses of Bech32
Bech32 is also used for other purposes such as e.g. encoding Lightning invoices. Originally, it was planned to use Bech32 for later native segwit output versions as well. However, after a mutability weakness was discovered, and surveys found that many wallets did not properly handle sending to higher segwit versions, an amended version of Bech32 is in discussion. This amended version of Bech32 would use a different checksum constant to explicitly break forward-compatibility, i.e. require wallets to upgrade to create segwit-v1 outputs. Breaking forward-compatibility protects wallets from burning funds by incorrectly downgrading segwit-v1 addresses to segwit-v0 addresses, and allows the mutability weakness to be fixed.
Native segwit-v1 to use Bech32m
The proposed Taproot soft fork introduces the native segwit-v1 output type, Pay to Taproot (P2TR), which would be the first native segwit output type to use this amended Bech32 address format, called "Bech32m" proposed by BIP-350.


In my opinion trading BTC has a higher potential of profit when compared to mining because of the sheer difficulty.

If you do decide to go for an ASIC.
I would recommend Coin Terra GoldStrike1 2TH/s ASIC miners.They are expensive at 6,000 USD.But their Break Even time on January Batch is 4 Days.If they deliver through this is the only miner I feel could have the potential of profit.
I would not recommend BFL as they seem to be taking an insanely long time to ship their products and there are other severe allegations made against them by their users.

Alternatively, You could go for Litecoin Mining and convert to Bitcoin later


Consistency when multiple blocks are added

All nodes will delete the shortest block-tip before they even hear about the other broadcast.

This assumption is incorrect.

For Bitcoin Core (and since all full nodes are either Bitcoin Core, modeled off of Bitcoin Core, or forked from it, this applies to basically all nodes), all blocks which have a valid Proof of Work and a few other things are written to disk and added to the block index and chainstate. At the very least the headers are recorded as headers are received before the blocks are. So if I am using Chain+A and I receive block B, I will store block B and mark it as not in my main chain but still fully valid. When block C, I will update my main chain with block C (advance the current tip to block C). When I receive block D, I store block D to disk and mark it as not in my main chain but still fully valid.

If I had received block D (or its header) without having received block B (or its block header), then I will discard it as invalid. However this is unlikely to happen because I will almost always know the best headers chain of all of my peers because I asked for it when they connected and I will receive headers from each of them for every valid block they receive.

Such a fork will resolve when one chain has more work than the other chain. This will typically happen when one becomes longer than the other. When that happens, because all nodes know of the other chain having either its block headers or the blocks themselves, all nodes following the shorter chain will automatically switch over to using the longer chain.

If the split should persist indefinitely, then this will not happen, but that is extremely unlikely given that it becomes more and more improbable for every single block on each chain to be found, broadcast, and received by all nodes simultaneously.


Is there any argument to be passed to CGMiner\AntMiner S2 to reserve amounts of hashing power for specific workloads?

It seems like the easiest way to achieve this would just be, e.g., to mine BTC at full speed for 12 hours hours, then stop it and mine NMC for 12 hours. A simple cron job or something similar could accomplish this.


Can stolen or otherwise tainted coins be laundered through mining fees?

I cannot look into the chainalysis code but if someone cooperates with a miner by paying unusual fees with tainted coins then the high fees are suspicious and I'm pretty sure analytics will monitor this.
Usually it's not a question whether or not the funds on a bitcoin address are from a criminal source, it's a question of what % is polluted. If you go inbound in the transaction trees of an address back to the miner rewards then you might have 1000 addresses and a little percentage will be polluted. So e.g 1.5% of the starting addresses funds are from a criminal source. It's the same with the bills in your wallet or with your ancestors. Going 10 generations back we have upto 1024 great...grandparents and if 10 of them were criminal then we could say that 1% of our ancestors were criminal.
So the criteria aren't the same at all exchanges but I assume that only addresses with a relatively high percentage of pulluted 'ancestors' will be rejected otherwise the exchange would have to stop it's business.


What exactly happens when I import private keys to my wallet?

Yes
Both. Each of the two keys is used to prove control over the corresponding UTXO of  the two UTXOs used as an input to the transaction


Where do transaction fees go in block #163368

As you mentioned this Block and also some other ones in the blockchain as well failed to claim the fees. Some miners missed all fees other only  a few, this can happen for a variety of reasons, almost all of them are bugs in the mining software.

  So who owned these fees?

These coins are lost, the miner failed to claim them and so they are gone.


How is it that concurrent miners do not subvert each other's work?

The number of hashes a miner has tried in the past does not affect the probability that a miner will get the correct hash in the next immediate calculation. Thus, it does not matter for the miner from an efficiency viewpoint if he starts work on a new block since the probability of getting the correct hash is exactly the same as if he kept working on the old block.

Think of this coin flip example: The first goal is to try to get heads. You failed the first several flips and than the goal changes to getting tails. The probability of you meeting your goal is still exactly the same.


How bitcoin application in production retrive UTXO's

Most services operating large scale wallets only use Bitcoin Core for networking information, and maintain a separate utxo set for wallet purposes.

There are many existing options to build a full utxo set that can be queried for arbitrary addresses, such as the insight project.

Moreover, recent versions of Bitcoin Core come with the scantxoutset RPC call, which allows you to locate unspent outputs for a given address or locking script.


What kind of API do you want? Do you mean API with your local Bitcoin Core or do you need web-API?

Have a look to http://webbtc.com/block/000000000000000001f942eb4bfa0aeccb6a14c268f4c72d5fff17270da771b9 (this is an example)

It is possible to download block as [json] / [hex] / [binary] there if you know the hash of the block

UPDATE (december'17):
block in raw hex example : https://blockchain.info/block/000000000000000000a7b4999c723ed9f308425708577c76827ade51062e135a?format=hex


Where can I find an overview of Bitcoin exchange APIs?

Since you originally stated that you wanted to write a trading bot, perhaps you will find the following library useful:

"XChange is a Java library providing a simple and consistent API for interacting with over a dozen Bitcoin exchanges providing a consistent interface for trading and accessing market data" (according to their GitHub page)

Unfortunately, I cannot tell you more about it, as I just stumbled upon it by accident.


If I was developing a Bitcoin wallet, should I support both legacy and compatibility addresses?

Displaying two would be justified if you were asking about a BC1 p2wpkh vs a 3xxx p2sh(p2wpkh) because not everything supports BC1 but its pretty good to use when supported.

Displaying two isn't useful between p2pkh/p2sh as you've asked about because p2sh is supported everywhere and many wallets and services have used p2sh exclusively for a long time.

Supporting plain p2pkh is not something I'd recommend a new wallet bother doing. That development and testing effort would better be spent on newer functionality.


Which bitcoin client distribution to use on a secure pen drive?

You can run MultiBit on a pen drive in a portable manner if you include Java runtime environments (JREs) for the operating systems you are interested in.  By including a JRE on the pen drive you can be sure it will run on the target computer.  MultiBit runs on Windows, Mac and Linux.

There is some help on how to set up MultiBit on a pen drive here : http://multibit.org/help_runFromUSBDrive.html

You can create a shell script / bat file with the single line: 'local-path-to-jre/java -jar multibit-exe.jar' to start it up using your included JRE.  (Note that Macs are guaranteed to have Java installed so you do not need to supply a JRE for that platform.)

There is a detailed tutorial on how to install a JRE here: http://www.dreamincode.net/forums/topic/42544-putting-java-on-your-flash-drive/

You can store your MultiBit wallets on your pen drive.   By default the path to the wallets is stored in the MultiBit config file multibit.properties as an absolute path (i.e. with a drive letter/ name).   I think you can tweak this to put in a relative path which would then open automatically on any computer.   Alternatively you can just go to the 'Your Wallets' screen and press the 'Open Wallet' button to open it manually.

Strictly speaking MultiBit does keep a local copy of the blockchain but it is the bitcoinj block chain so is less than 20 megabytes.


Usage of Markov chains to improve bitcoin mining

A Markov chain is a mathematical model for a random process that has only short-term dependence on its history: if you know the current state of the system (or perhaps its recent history), any further historical information will not improve any predictions about its future.

This could be a useful model for analyzing a (flawed) lottery in which there is some dependence between today's number and tomorrow's; it could help you determine the nature of that dependence, and let you use today's number to make a prediction about tomorrow's number that would improve your chances of winning.

However, in a truly fair and random lottery, no such dependence should exist.  Each number should be chosen in a manner that is not biased or affected in any way by past numbers.  In such a case, a prediction based on a Markov chain would be no better than a random guess; and indeed, given enough data, Markov chain techniques would tend to confirm that there is no dependence.  (In the short term, such techniques might appear to detect some dependence, but this would be erroneous.)  So if the lottery is in fact fair, you can't improve your odds using a Markov chain analysis or any other method.

My understanding is that the cryptographic community believes, based on all current evidence, that the Bitcoin mining algorithm behaves like a fair lottery.  Of course, the output of the SHA256 hash function does in fact depend on its input data, but it is believed that there is no computationally feasible way  to describe or gain information about this dependence short of actually computing the function.  If so, then SHA256 outputs are effectively independent of their inputs, and past history of Bitcoin hashing gives you no useful information about the future; it does not help you improve your odds compared to trying nonces in sequence or at random.

If you, or anyone else, is able to "improve Bitcoin mining" via Markov chain techniques, or any other method, it would mean that SHA256 is seriously flawed and should be abandoned.  Fortunately, as far as I know, there is no evidence to suggest that this is the case.


Can a closed source wallet ever be completely trust-less?

The term trustless is often misunderstood. I suspect you mean not needing to trust anyone, but if a program being open source helps for that, aren't you implicitly relying on the people who are capable of reviewing the source code to have actually done so? Isn't that also a form of trust? Of course it is. Every production system needs to trust various aspects of the infrastructure: the hardware it's running on, the compiler that was used, the operating system, and last but not least the human operating it.

The trust we're talking about in "trustless" is an abstract technical term. A distributed system is called trustless when it does not require any trusted parties to function correctly. In that sense, a "trustless wallet" does not make sense: wallets are an implementation aspect of a cryptocurrency, the design of which may or may not rely on trusted parties. The wallet software being open or closed source doesn't change this.

Does that mean you should use a closed-source wallet? Hell no. Not because it's "trustless" or not, but because there is no chance it'll have been sufficiently reviewed (unless, perhaps, you have access to the source code under NDA and paid for thorough review yourself).


How can I generate a large number of Bitcoin addresses?

Vanitygen is a command-line tool that can be used to generate random bitcoin addresses. It also has OpenCL-compatible GPU version called oclvanitygen. Both can be built from source, GitHub, and both are included in the Windows binary package. PGP signature here.


Keep in mind that funds held in a Bitcoin wallet carry considerable financial risk (compared to a savings account). The value of bitcoin can increase rapidly, but it can also drop rapidly.

If you believe that long-term, the value of bitcoin will continue to increase, then bitcoin might be a good investment for you. However, the future is unknowable, and something could happen that causes the bottom to drop out of the bitcoin market and its value to plummet. Your choice.

Note also that in the US, you may be liable for taxes on realized capital gains through investment (this is not tax advice).


Is it possible to adjust transaction fee amount in MultiBit Classic?

It's been a little while and I have not gotten an answer here, but I figured it out myself and would like to post the answer to my own question here so it can help someone in the future.

The answer is NO, you can not adjust transaction fee amount in MultiBit Classic. It is only possible to send bitcoin with 0.0001btc transaction fee. This is outdated software and was hard coded to that amount.

What I did to deal with that is I imported my private keys from MultiBit Classic into Electrum, which not only is able to adjust the transaction fee, but also makes pretty good suggestions as to what the fee should be at the moment based on the data it collects from the network.

To export the keys you need to make them visible and that is not secure unless you are in a safe environment of your home, etc. After importing the keys to Electrum I was able to access that wallet and spend the coin to other places, which was my plan to begin with. You can always destroy the files with plain text keys by electronically shredding them (deleting does not destroy files beyond recovery). This is what I did.

Hope that helps someone in this situation in the future.


-D 0:0 -D 0:1 -D 0:2  (etc for as many GPUs as you have)

Edit:  Sorry I'll clarify for future users..

 ./oclvanitygen -i 1address

gets me..

 Available OpenCL platforms:
 0: [Advanced Micro Devices, Inc.] AMD Accelerated Parallel Processing
 0: [Advanced Micro Devices, Inc.] Tahiti
 1: [Advanced Micro Devices, Inc.] Tahiti
 2: [AuthenticAMD] AMD FX(tm)-4130 Quad-Core Processor

So if I want to use the 2x GPU but not the CPU then I'll run..

 ./oclvanitygen -i 1address -D 0:0 -D 0:1

or if I want to only use the CPU then I'll do..

 ./oclvanitygen -i 1address -D 0:2

(yes you can use multiple processes so I could mine one address with one GPU and another with the other GPU)


What prevents miners from inserting fake transactions given SegWit?

If I'm understanding segwit correctly, miners have to verify signatures in order to include a transaction into a block that they are mining. However, miners are not required to verify signatures in order to decide that a block a different miner mined is valid. Is this correct?

Miners can do what they want to construct blocks, including creating blocks with invalid signatures. They can even try construct blocks by just creating random data, and hoping it's valid.
However, blocks without valid signatures (or other validity problems) will not be accepted by the network. All full nodes verify all signatures in all blocks, so if a miner constructs a block with an invalid signature, they've just wasted a enormous amount of effort to produce something everyone will just ignore, and forgone the ability to be paid for that block. The same is true for building on top of an invalid block; thus miners are incentivized to validate the blocks they build on top of too - but they don't have if they like losing money.
None of this has anything to do with segwit. Segwit moved signatures to a different place, where they don't affect txids, and can be stripped cleanly so pre-segwit nodes can ignore them, but doesn't mean nodes don't validate anything less (except old nodes, which don't care about the segregated area).

It sounds to me like most do still verify though?

Definitely.

Are signatures discarded eventually?

Not in any current full node implementation that I know of.
Bitcoin Core supports pruning old block data, which deletes both witness and non-witness data equally. That also means other nodes can't synchronize off a pruned node anymore.
In theory it's possible to implement a pruning mode that deletes just the witnesses. That would also prevent other (post-segwit) nodes from synchronizing off them, but they could still serve some light clients. This is not implemented.

Should a mining pool temporarily gain 51% control of the blockchain, can they insert transactions, and not include the segwit for a block or two because, by the time other miners are allowed to mine, those signatures will have expired?

I don't understand what you mean here, but signatures don't "expire".


However, if a majority of miners agrees on the activation of soft forks, could they activate it? If so, does it mean that only 15 mining pools could control Bitcoin?

No. Soft forks requires full nodes and users to validate the new consensus rules. Miners can "force" soft forks, but that actually wouldn't do anything if no one uses or follows the soft fork rules. Since soft forks must remain backwards compatible, there is nothing that can really be done in a soft fork that would result in miners being able to steal coins or control what anyone else on the network does. Such forks would be hard forks.

Full nodes are what enforce the consensus rules, and users are the ones who run full nodes and create transactions. If no one is running a full node that enforces the soft forked rules and no one uses the soft forked rules, then it's like the soft forked never happened. Miners can't force people to follow the soft forked rules.


Why one would need *extended* public keys for auditing a bip32 wallet?

Why one would need extended public keys for the auditing a bip32 wallet?

You don't need them. You could also just make a list of all of the addresses that have a balance, and send that to your auditor.

Auditing a Bitcoin wallet is not a very good example of what this is capable of. Here are some other uses of BIP32:

You could have a script on a server with an extended public key generate addresses for people to donate to, without having that same server be able to spend money sent to those addresses. Without BIP32, you'd have to make a long list of addresses, put them on your server, and replenish them whenever they ran out.
You could have an e-commerce app generate addresses like the above, and detect payments to those addresses without, again, having the ability to spend them.

  Wouldn't the (non-extended) elliptic curve encryption's public keys work too?

No. You also need the chain code to calculate the subkeys. Collectively, these two things make up an extended public key.

  Furthermore, if I understand the spec properly, sharing an extended public key isn't really safe since knowing a descending non-hardened private key would then expose all the keys descending from this first extended public key.

It's... debatably safe. I don't think there's a real-word situation where someone would compromise one of your non-hardened private keys without having access to all of them.


What is cross-input signature aggregation and how would it work?

Schnorr Signatures and public keys can be aggregated (added together) such that
S1 + S2 = S3 and P1 + P2 = P3 where (S3, P3) is a valid signature-pubkey pair IFF (S1, P1) and (S2,P2) were valid signature-pubkey pairs.
Because of this, if a transaction has n inputs, the signatures of those inputs can be aggregated, so the transaction only needs one signature and public key even with any number of inputs, whereas a regular transaction would need n signatures and public keys.
The main benefit being block space (fee) savings.


Regtest: One node nullifying other node's balance

You only see the balance of blocks that have at least another 100 on top. This is because coinbase outputs only become spendable after 101 confirmations (the maturity period).

After the nodes reconnect, and one block is mined by node0, node1's previous chain is reorganized away, and from that point on, both nodes work on the same chain.

However, whenever a new block is mined, the balance of the node who mined the block 100 before that is increased.

It has nothing to do with the nBits bug. This is an actual bug in the software which is being fixed now, but it does not affect you.


Importprivkey's "label" - is it the same as an account?

Though the terminiology is unclear, in code "label" and "account" are the same thing:

importprivkey function (src/rpcdump.cpp):

pwalletMain->SetAddressBookName(vchAddress, strLabel);

from getnewaddress function (src/rpcwallet.cpp):

pwalletMain->SetAddressBookName(keyID, strAccount);


Why do testnet blocks have future timestamp?

Testnet is frequently attacked, abused, due to the complete lack of value and proof of work. A piece of code which is intended to allow a difficulty 1 block is none has been found in 20 minutes also enables a person to "warp" forward and mine multiple in a row. If this is exploited over the difficulty adjustment, the entire chain difficulty is reset to difficulty 1.

The result is that it is trivial to make forks hundreds of thousands of blocks long, with insane timestamps that only vaguely match reality within the consensus rules. They're never going to make a lot of sense as a result. This doesn't happen on mainnet because the difficulty reset code doesn't exist there.


How are transaction fees calculated in raw-transactions?

Here is a great answer on how to calculate the transaction size before sending. (Make sure to read the final edit.)

As for the fee, you've got it right: whatever amount from the inputs is NOT sent to other addresses, becomes the transaction fee for the miners.


Cannot compile bitcoind with zmq enabled

This will happen when you try to build with ZMQ support even though the required libraries are not on your system. In this case, configure will silently turn off ZMQ support, and you should see a line like

configure: WARNING: libzmq version 4.x or greater not found, disabling

in the output. When you install the required version of the ZMQ library on your distribution (make sure to pick the DEV version to get the header files as well), it should work.


What do I do with all my old block erupters?

I use mine in "lottery mode" as I call it.

They don't really consume too much energy, so I just let them solo mine. Big chance will turn out to be nothing, but with some luck they will ever find a block and cash in 25 BTC.

How low the chance may be, it's still a lot higher than winning the ordinary lottery and way cooler :)

EDIT: A quick calculation of your odds.

The current (2014/01/24 23:07) chance of a hash to be a winning hash is 0.0000000000000000001061272725905534506860017351925762341. Then the odds of winning each day are for one block erupter USB of 330MH/s

0.0000000000000000001061272725905534506860017351925762341 * 330*10^6 * 60*60*24 = 1 / 330480.1

So one chance in 330,480 each day or one chance in 905 a year (of course, changing difficulty has to be taken into account).

Let's take the Powerball lottery as a reference as Earlz mentions, it has odds of one in 648,975.96 to win $10,000 one in 5,153,632.65 to win $1,000,000.

So, every day you have double the chance to win 25 BTC than you have to win $10k, which is less and costs you probably a dollar or two to enter.


How do I get to the value in the 'scriptPubKey' part of the transaction ?

Addresses are kept in Base58Check format. Here's how you decode it.

Decode the base58 encoding (similar to Base64). You should have 25 bytes.
Check that the 1st byte is 0x00 (the version byte of Bitcoin)
Check that the last 4 bytes are a correct checksum of the rest. This is done (in Python) by:

sha256(sha256(data[0:21]))[:4] == data[-4:]

(Or, "take the first 4 bytes of a double-SHA256 of the first 21 bytes of the decoded data, then compare to the last 4 bytes of the decoded data.")
Take the middle 20 bytes (data[1:21]) and insert it into the following scriptPubKey.

OP_DUP OP_HASH160 <x> OP_EQUALVERIFY OP_CHECKSIG

Here are some libraries that will do steps 1-3:

libbasse58 (C)
base58perl (Perl)
python-bitcoinlib (Python)
bitcoinj (Java)

byte[] hash160 = new Address(NetworkParameters.prodNet(),
    <addr>).getHash160();

coinstring.js (node.js)

require('coinstring').decode(<addr>)

Various examples on rosetta code


Bitcoin resistance against forged slow chain

Of course, as a result of this approach, timestamps in the forged chain would increase much faster than in the real chain. This would cause the forged chain to be discarded by nodes, as legal blocks must have timestamps less than or equal to current timestamp (plus/minus some tolerance).

Not always. For example, in a time warp attack, it's possible to go as many blocks as you want without advancing the clock at all. See How could a time warp attack be prevented? (You should probably avoid making the same off-by-one error in your code.)
For that reason, Bitcoin nodes do not compare chains by their height. (Although they used to do this.) They calculate the total work in each chain (nChainWork), and compare by that. This is calculated by looking at the number of attempts it would take, on average, to find each block, and summing it. This answer touches on how that's done: How is a blockchain split resolved?

Alice controls a bitcoin node, and has 500,000 blocks in storage. Bob advertises that he has 600,000 blocks, but the last common ancestor has number 1000. Bob's chain is a forged slow chain, but Alice does not know it. Alice wants to download Bob's blocks and check if these are correct.

Bitcoin nodes do tell each other how many blocks they each have, but they don't trust this automatically. Rather, they download all of the blocks and check how much work each block has. This can be done faster if you only download the headers; you can tell how much work a block has without downloading the entire block.


Why can't I spend my reserve XRP and delete my address from the network?

The issue is that for safety reasons Ripple currently has no way to remove the account root ledger node to completely remove a Ripple account. Since the reserves exist to help limit the size of the current ledger, any un-deletable ledger node requires a non-refundable XRP reserve (although if the XRP reserves are lowered, as they have been in the past, the difference becomes spendable again). Note that a Ripple account can use all of their XRP in transaction fees, just not in payments or trades.

There is a good discussion on why Ripple doesn't allow for account deletion on the Ripple forums. Basically, doing so would make it possible for a user (or client) to in error re-create the same Ripple account/address (e.g. if someone uses an old Ripple secret to "recover" their account). That would make old transactions signed by that account now be potentially valid against this "new" account (since Ripple uses a simple sequence number per account to prevent replays).


Since Litecoin is a fork of bitcoin you can use JavaBitcoindRpcClient to connect with litecoin client and execute API calls.

link:https://github.com/Polve/JavaBitcoindRpcClient

To connect with client, you can use below code :

String user = "RPC_USER_NAME";
String password = "RPC_PASSWORD";
String host = "127.0.0.1";
String port = "PORT";

try {
    URL url = new URL("http://" + user + ':' + password + "@" + host + ":" + port + "/");

    BitcoinJSONRPCClient bitcoinClient = new BitcoinJSONRPCClient(url);
    System.out.println(bitcoinClient.getInfo());
} catch (MalformedURLException e) {
    e.printStackTrace();
}


Electrum seed words safety dumb question

For the vast majority of possible 12-word combinations, the corresponding wallets were empty and never generated. The total number of the combinations is pretty huge so trying to brute-force them will not work out. In fact, words are just another (mnemonic) way to encode the entropy contained in the private key.


Is it a good idea to deposit directly into a service when withdrawing from another?

Many services explicitly warn users against this practice, including in their withdrawal terms clauses like "you may only withdraw to an address which is controlled by you." This is likely to be due to the details of procedures used in the case of dispute resolution, but I've never seen any explicit justification for it.
The advantages of withdrawing directly are (1) saving the network fee associated with the transaction from your intermediate wallet to the receiving service; (2) overall the transaction would be faster.
The disadvantage is potentially violating the terms of services and the associated risk.
I admit to having taken this shortcut occasionally, but I would tend to avoid it for large transactions.


Difference between bitcoin-cli getnetworkinfo version and bitcoind --version

bitcoind --version is asking the bitcoind binary what its version is
bitcoin-cli getnetworkinfo asks the currently running bitcoind what its version is

So this means that you at some point had a 0.18.0 bitcoind, started it, then installed a 0.20.0 one, but the 0.18.0 one is still running.


Android Bitcoin Wallet freshly installed, two addresses. Why two?

You are asking multiple questions, which is not how this website works. Also: all of them have been answered several times already if you search a little. I'll try to answer some anyway, to take away some of your misconceptions, which should help you back on the right track.

Misconception: Bitcoin is not based on the BitTorrent protocol. It has nothing to do with it. Bitcoin uses a peer 2 peer network, BitTorrent does too. But neither were the first or are all that similar.

Misconception: An address is NOT like an SSH private key. An address is "like" a public key (not exactly, but that distinction is not important right now). An address is what you give to someone else to have them pay you.

Hidden inside the wallet is the private key or more precisely in current wallets: the Master key from which multiple private keys are generated. If you make a backup of your wallet (which you should do!) you will get to see that master key: it's simply a list of 12 or 24 English words.

The address is used to receive bitcoins. The private key is what you need to be able to spend them. But the private is pretty much invisible to you, you don't need to care as long as you have the Master key backed up (and protected!) properly.

Address re-use is very much discouraged, for privacy reasons. Once you "use" an address, the wallet will automatically prepare a new address for the next use.

The specific wallet app you are using generates two addresses in advance to get you started.

I don't think you can delete an address in this app.

It is possible to have multiple devices use the same Master key, but it will mean that if one of those devices gets compromised and someone steals your Master key, you will lose ALL your money. It's probably better to keep things seperate until you're ready for more advanced setups. (multi-signature for example)


Chained Payments with bitcoin like Paypal Adaptive Payments?

There's nothing out there that does this but it would not be a hard thing to create.  It's a relatively simple process:

set up payment for xBTC with a specific address to which to send the payment
when the payment arrives create a new transaction that sends some of the coin to an address owned by you and some on to the store owner's address

All of the complexity will be in the business rules: what's the percentage split, how long 'til you pass the coin along (in the case of shipping physical items you need to worry about a purchaser claiming against you for non-delivery), what happens if items are sourced in USD or other currency and translation is required, etc.


When miners are trying to find a block, they are doing so for a specific set of transactions. This set of transactions includes a special transaction, the coinbase transaction. It's the first transaction in a block and collects the transaction fees and the block subsidy. The coinbase transaction's output sends the mining reward to an address specified by the miner.

This way, finding a valid block also ensures payment of the successful miner: the payout is part of that block. Once the block has matured by 100 other blocks being built on top of it, the block reward becomes spendable. What the miner then does with the block reward is their own choice.


The answer was
The bitcoind client/executable was owned by user rshn.
I started the bitcoind client from a terminal as root user.
bitcoind treated the process as a new install because the owner was different.
bitcoind started downloading the full blockchain,
hence I ran out of disk space quite quickly!
TIL  start the bitcoind client logged in as the owner of the executable.


Electrum is easier. Armory is harder. Electrum lean towards minimalism. Armory is aimed at power users.

Even though you asked about offline wallets you will likely want to maintain a watch only version of your wallet on your online system to be able to see the current balance, create unsigned transactions and give out addresses to people who want to send you money. So let's compare the online wallet experiences as well.

Armory's online wallet requires a copy of bitcoin-qt running and that means you need to download the whole blockchain. Armory's online wallet is also known for being a memory hog. The advantage is that you have a local copy of the blockchain and don't have to trust anybody else with that.

Electrum relies on third party servers so it runs pretty lean. The downside is that you loose out on privacy to those servers and if they are compromised they could send you fake transaction data and not broadcast your send transactions. They can't steal your coins though - your private key is never shared with them.

BTW if your netbook has wifi then make sure you turn that off in the BIOS.


How to merged mine with getmemorypool RPC command?

Most of what you need is explained at https://en.bitcoin.it/wiki/Merged_mining_specification

When you construct the block for the primary chain (e.g. bitcoin) you need to include a merged mining header in the generation transaction (coinbase). The format of this data is explained at the URL above under "Merged mining coinbase".

If, while hashing the primary chain, you get a hash that is below the target for the auxiliary chain (e.g. namecoin) you can create a block on that chain using getmemorypool (assuming the daemon for that chain supports getmemorypool).

To submit a merged mining block, for namecoin you need to do two things that you wouldn't do when mining non-merged.

The first is to set the auxpow bit in the version field of the block header.

BLOCK_VERSION_AUXPOW = (1 << 8)

The second difference is that you insert an auxpow between the header and the transactions. The binary layout of the auxpow is explained at the URL above under "Aux proof-of-work".

The auxpow bit in the version field tells namecoin that after the block header there will be an auxpow before the transactions.

In theory other alt coins may need to have their merged blocks formatted differently and/or submitted differently to their daemon.


`createpsbt` RPC call doesn't provide PSBT inputs & outputs

It's not supposed to. createpsbt does not have access to the wallet so it cannot fill in any input or output information. If you want those to be filled in, you can use walletcreatefundedpsbt.


Does Ripple ever charge proportional transaction fees?

The network itself doesn't really ever charge proportional transaction fees. However, when you make a payment, that payment can take a path that can invoke any number of fees. These fees are charged by the individuals or companies who provide links in that path.

The four possible fees are:

Transfer fees: A transfer fee is a fee an IOU issuer can charge when their IOUs change hands. It is imposed by the issuer of the IOUs you hold. (This is one of the services your gateway can charge for.)
Quality fees: A quality fee is a fee someone who holds multiple IOUs can charge when you give them IOUs they consider less trustworthy in exchange for IOUs they consider more trustworthy. It is imposed by the entity that holds both IOUs. (This is a fee someone can charge if you use their liquidity to swap IOU issuers.)
Service fees: A service fee is a fee imposed on an IOU exchange in either direction as payment for the convenience of changing issuers. It is imposed by the entity that holds both IOUs. (This works the same as a quality fee except it can be charged in both directions and so doesn't necessarily reflect a change in quality.)
Exchange fees: An exchange fee is essentially the same as a service fee, but it can also occur when the currency is changed as well as the issuer.

When you form a transaction, the Ripple system finds the cheapest path taking these fees into account. Generally, the cost should be very close to the amount of money you are trying to deliver to the destination -- most of these fees are typically zero. If you hold IOUs from a gateway and are paying someone who trusts a gateway, these fees should total way under 1%.

These fees provide the incentive for people to provide liquidity and connectivity in the Ripple system. Competition should drive these fees to near zero for typical cases.

So, for example, if you hold IOUs for USD at two different gateways, you could offer to exchange between the two gateways at an exchange rate that makes you a modest profit. If you provide the best path between those gateways, then someone who holds IOUs from one gateway but needs to pay someone who only trusts the other gateway can take you up on your offer and you'll wind up imposing a fee on their transaction.

Ripple transactions can include multiple paths and a maximum amount to pay. At the instant the transaction is processed, the system will incrementally take from whichever path has the lowest cost. If the transaction cannot be completed at or below the specified maximum cost, it will return an error.

You might think it would be expensive to pay all these fees, but in practice, they'll be small or zero. Say you are at one exchange and you need to pay someone at another and the fee is high, say 1%. Someone with IOUs from both exchanges will see a profit opportunity -- just offer the IOUs at .9% instead. They can make money as the IOUs move back and forth and they won't have to do much. But then someone else will see an opportunity at .8% and so on. The price will get driven down to near zero unless there's some reason for the fee.

Some of these fees can apply in reverse and actually result in you paying less than the specified amount. If you're paying with IOUs that someone else needs, you may be able to give them the IOUs they want at a profit. So it could cost you $98 to pay me $100 if you hold IOUs that are needed and I'll accept IOUs you can get below face value.

The fees serve to cause transactions to do what people need done. If I have the "wrong" IOUs, I can just offer them in exchange for the IOUs I need at a good price and someone looking for the lowest fees will wind up fixing my problem for me. If I'm holding IOUs from someone I no longer trust, I just offer them at a discount and wait until they become someone else's cheapest path.

The 1% figure comes from the way WeExchange currently processes withdrawals from your exchange account to a Ripple account. If that Ripple account trusts WeExchange, they just issue that account IOUs. If not, some of the fees I mentioned above may be incurred. WeExchange currently will allow the withdrawal if it costs up to 1% more than the amount withdrawn. So if you order WeExchange to pay $100 to a Ripple account that won't take their IOUs, it may cost you more than $100 (up to $101) to do it. If it would cost more than that, WeExchange will report an error. (At least, this is my understanding. The details were relayed to me second hand and this is still subject to change.)


How to Connect bitcoind to one of your workers in a pool?

If you're mining in a pool, bitcoind doesn't even have anything to do with the system. It doesn't need to be running, it doesn't even need to exist on your hard drive. The remote pool does that for you.


Both a full Bitcoin and pruned node can be run from Bitcoin Core with the same level of security.
Pruned nodes have the following differences:

Does not keep the full blockchain on disk
Size limit is defined by the user
Will discard unnecessary block data as it synchronizes

As a user on the Bitcoin Talk forum explains, most "dedicated hardware" Bitcoin Nodes are software wrappers around Bitcoin Core which may be less secure than running Bitcoin Core directly.
See Multisig Setup - Pruned Bitcoin Core on Computer vs. Dedicated Hardware - bitcointalk.org


Real-time price data for cryptocurrencies

the price on an exchange will be determined by the user. the user (=trader) decide for how much {money, other coins, whatever} they buy or sell a coin/token.

if you want to have the prices of many exchanges/many coins/many token you can use the coinmarketcap api for example. coinmarketcap calculates the average price of several well known exchanges. but in practice every exchange has an api which provides the data of the current orders/price. see for example api-docs: gdax, poloniex, binance, bitfinex, bittrex, kraken.


Bitcoin QR codes: raw address or Bitcoin URI scheme

I'm working on a Bitcoin project, and what I've seen are:

Just the Bitcoin address
A url parameter-like scheme with the format "bitcoin:{plus the bitcoin address}" (no brackets used)
A more elaborate url parameter that includes the amount, like "bitcoin:{bitcoin addr}?amount={the amount}

Coinbase uses the last scheme and it is fully recognized by the BlockChain iPhone app, enabling you to request a certain amount of Bitcoin directed to a specific address.

Coinbase uses the (deprecated) Google chart apis and the full querystring they use to build a QR code looks like this:

<img width="300" height="300" alt="Chart?cht=qr&amp;chl=bitcoin%3a1k1yfezde2c37pwdevjnin1yc2qbtly6bk%3famount%3d0" src="https://chart.googleapis.com/chart?cht=qr&amp;chl=bitcoin%3A1K1yfEZde2C37pWDevjnin1yc2qBtLy6bk%3Famount%3D0.01&amp;choe=UTF-8&amp;chs=300x300">

If you run that src url through a url decoder, you'll find that it requests 0.01 BTC to the address 1K1yfEZde2C37pWDevjnin1yc2qBtLy6bk.

When you're building a QR code, you don't need to url-encode the data.  Coinbase is only doing so because they have to request the QR code from Google through a url addressing scheme.

I build my QR codes on my own server and display them as images on a web page, and I just use non-encoded data.


I have to go to somewhere and change the digital money to physical money.

Although that is the current reality, with a few exceptions, it is not the vision of how cryptocurrencies would work.

The intent is that everyone globally would accept your cryptocurrency directly without any need to convert to or from other currencies.

We can see that the Euro has replaced lots of national fiat currencies in the Eurozone. The dream of cryptocurrency promoters is that at least one cryptocurrency will become globally pervasive to the extent that you never need any fiat currency.


Can bitcoins be exchanged by mailed check?

Yes, this is theoretically possible, but in practice you will not do this, because an internet connection is necessary for preparing the payment on sender side and for verifying it on receiver side. Thus, if both parties have an internet connection anyways, it is likely that there is no reason for mailed information printed on paper.

However, if one would still want to do so, he can.

You can print the private key of a bitcoin address, which holds bitcoins, onto paper. For example you can print the data in hexadecimal representation or as a QR tag.
You can then later recover this bitcoin address from the printed information and use the bitcoins stored on it.

If someone wants to send bitcoins by mail, he would use this technique. He would first prepare a new bitcoin address, put the amount of bitcoin that he wants to pay onto this address, and print the private key.
Next, he would send the printed private key to the receiver.
The receiver would then take the information, import it into his bitcoin software, and finally, to make sure the sender does not anymore control the bitcoins, transfer all the bitcoins stored on this address to a new address, of which the sender does not have the private key.

The last step might seem unnecessary, because the receiver already controls the received bitcoins. However, the sender might also still have the private key and use it for transferring the sent bitcoins, thus emptying the address of which the receiver has the private key. To make sure, this can not happen anymore, the receiver moves the coins away from the possible access of the sender.

Another possibility is to put a physical coin into an envelope and send it. This is basically the same thing as above, becuase the physical coins are just another way of storing a private key of a bitcoin address, which holds some money. See https://www.casascius.com/ as an example for physical coins.


What happens if Gavin and the other developers get hit by a truck?

If the entire core development team would be gone, a new team would need to take their place. I assume that the process might get political (some people wanting to push their agenda onto the project), and before the new devs would fully understand the system the innovation in the client might get stifled. It might also be likely that the Bitcoin Foundation would need to hire a few people to work on the project (just as they pay Gavin now). However, as there are already a lot of people that have contributed to the project, I don't think we couldn't handle the change in the long run.


Could bitcoin "survive" a definitive hard fork, spawning a new currency?

You've described it very accurately. When there's a protocol change that not everyone adopts, you'll have essentially two different currencies, with any coin in the original currency turning into a coin in each of the new block chains. The total value of the coins in both chains will be roughly equal to the total value of the coins in the original currency. The division of value between the two currencies will depend on the respective demand.

However, if both currencies use the name "Bitcoin" to describe themselves, it will be very confusing, and will make both less usable because it's hard to know what someone means when he says "Bitcoin".


The TIMEOUTOP, which is one of OP_CHECKSEQUENCEVERIFY or OP_CHECKLOCKTIMEVERIFY, will either:

Terminate the script with an error if the TIMEOUT conditions are not met
Act as a NOP and leave the stack unchanged if the TIMEOUT conditions are met

2 occurs if the timeout has been met, and leaves the top of the stack with the timeout delay value. OP_DROP removes this value from the top of the stack, allowing the regular p2pkh script to continue execution by consuming the rest of the stack.


What were the main technological reasons that Bitcoin Cash did not want to adopt SegWit?

There's no technical reason to not to support segwit.

The main emotional arguments were that this was better done as a hard fork rather than a soft fork, but this ultimately would have resulted in a handful of bytes being different in the resulting block. SegWit was originally designed as a hard fork before the realization that it could be implemented using traditional upgrade paths, to exemplify that. As a hard fork, SegWit would have resulted in substantially more disruption of the network for an almost immeasurable efficiency gain.

Claims at the time that miners could steal outputs from SegWit addresses is demonstrably false. P2SH worked in a similar way, and has the same threat model, even at the time storing billions of USD worth of Bitcoin in its scripts. As the rules are enforced by nodes, rather than miners, this claim is largely based on a misunderstanding of the security model of Bitcoin.


Tracking outgoing transactions & malleability attack

I personally would look for newly spent outputs as opposed to TXIDs.  The outputs get spent the exact same way in a malleability attack.

So create a hash based off of the inputs into the transaction, and when a TX comes in calculate that internal hash and check off of that.


How would you recommend parsing a private bitcoin core node with nodeJS?

This question is pretty broad as parsing a node involves decoding every transaction within a block(which would require txindex to be enabled), and recording each output and input until you end up with a list of all outputs that have not been used as an input aka an unspent output.

With a fully synced node and txindex=1 you can begin iterating through each block of the last 200 blocks with loops using the rpc calls getblockhash getblock getrawtransaction and decoderawtransaction, storing the outputs in a database. On each new block you should check every input to see if there is a transaction id matching an output in your existing output database, if there is that output has been spent. The node-bitcoin JSON-RPC wrapper should work fine for implementing these calls to your node. As you can imagine this would take some time.


Discovering which wallet this was generated from may be important. Over the years different words and derived paths have been used by different software.
A good place to start is to look through https://walletsrecovery.org/ which may help jog your memory and a start on the recovery process.


Yes the address in QR code is your address. so no worries your bitcoins has to go to your wallet.


What if someone owns 51% of all bitcoins?

Well, everyone can manipulate the exchange value of a currency by trading large volumes.

Having 51% in particular does not really change that.

Besides, for lowering the price, he will have to sell a lot, probably losing his 51% position.

So basically, you can't manipulate the price just by having > 51% of the bitcoins, but by trading very large volumes. Someone with very much fiat currency can also manipulate the price by buying large volumes.

To see howmuch you will have to sell (buy) to make the price go down (up) a certain amount can be seen in the "market depth" of the exchange. For Bitstamp f.e. the market depth can be found here.
The steeper the market depth curve, the harder it is to move the price in that direction, so currently (see picture below) it is easier to make the price drop by selling bitcoins than it is to raise the price by buying.


Even though Blockchain is tagged as " Decentralized", wouldn't the organization actually implementing the Blockchain like Ethereum control it?

"Decentralized" is really a hybrid of distributed and centralized:


Yes, that is true.

However, to go from an address to any corresponding private key still requires an unfeasibly large amount of computing.


Basically, Dwolla promised that they would never honor chargebacks. They in fact did and stole dollars back from their bank account after TH gave Bitcoins to the scammers. They lost a lot of money by this. I believe Dwolla is being sued for 2 million dollars as a result of this.


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

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

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


Fee too high because of a bug in Bitkey application for Apple?

I am also new and did my fair work of research. However looking at your scenario if the miner doesnt want to return the fee because of your accident its your problem. Generally good miners will return the fee but that isnt always the case, Its a risk of transactions with cryptocurrency. txid

https://bitcointalk.org/index.php?topic=360099


Help running cgminer on Ubuntu 14.04 - waiting for USB hotplug devices, and other errors

Your system reports: Intel's new Iris Pro graphics.

As far as ubuntu 13.10 was concerned the package cgminer was compiled for nvidia graphics cards and installed the module for ubuntu.

Consider running a system with dedicated GPU w/ PCIe: e. g. nvidia and ATI and possibly compile cgminer by yourself.

I tried bfgminer for ubuntu now, see here: http://jarco.be/install-bfgminer-ubuntu-mint/

...but cannot get it to work for litecoin scrypt right now...

NOW up and running bfgminer compiled for ubuntu 14.04 with howto from here:
https://debianhelp.wordpress.com/2012/01/02/bitcoin-mining-in-ubuntu-with-bfgminer/

with some minor changes:

installed "bitcoin-qt" instead of "bitcoin"
sudo apt-get install uthash-dev
./autogen.sh && ./configure --enable-scrypt --enable-opencl && make
modified ".bfgminer/bfgminer.conf" can be pasted here, if you want
-> 880kh/s @ ATI Radeon R9 290X


How Often Is "Contributors" Section Updated on Bitcoin.Org

It seems that the list of contributors is automatically generated by this script:
https://github.com/bitcoin-dot-org/Bitcoin.org/blob/master/_plugins/contributors.rb
and is refreshed every 24h (as stated in a comment in the script itself).
I suppose that the difference in the counts depends on the fact that anonymous contributions are excluded in the github API request (you should add anon=1 to have all contributors).


Bitcoin-Qt client: Easy way to using a wallet.dat not in its default location/when it asks for my password at all?

Bitcoin-qt only asks for your password when you do an operation that requires it, such as sending coins.

Currently, wallet.dat must be called that and reside in the Bitcoin data directory. It might be possible to use symlinks to work around that.


Can you send a transaction from non-native segwit to native(bech32) segwit address?

The wallet needs to be able to decode a bech32 address and construct the appropriate native witness output when sending funds.

Given that your (hypothetical) wallet can spend P2SH(witness) outputs already, it is likely it can or will soon support native bech32 addresses, but there is no guarantee that the latter must be supported given the first.


In Blue Wallet 6.0.2 for iOS, pressing on Bump Fee causes an infinite wait. Any idea why?

It is a bug. I concluded that when it worked correctly on a different transaction.


Why doesn't each node store only a portion of the blockchain?

Your question is vague, but I assume your real question is why every node must store the full blockchain.

The answer to that is that they don't. In fact, nodes can choose to not store any part of the blockchain at all. The blocks are only needed when validating history, to build up the state of the global ledger (the "UTXO set").

Nodes that do store the full chain advertize so on the network, so that new nodes that join can fetch history from them. However, they themselves do not need the chain at all after validating it, and since Bitcoin Core 0.11, it is in fact possible to configure your node to throw away older parts of the chain to reduce disk space.

To summarize: the only data that every fully validating network node needs is its own validated copy of the UTXO set.

Given that information, maybe your question becomes: why isn't the UTXO set stored in a distributed fashion?

The answer to that is more complicated:

Trust model we cannot trust other nodes to store the UTXO set for us. The reason we went through the entire blockchain to build up the UTXO set is because the blockchain is auditable while the UTXO set is not. It allows us to check whether the entirety of history is valid. If we go outsource the UTXO set, and rely on other nodes to keep part of it, they could modify it to their advantage (for example, to make us believe they have more money than they do).
Performance Access to the UTXO set must be very fast. Faster nodes often are configured to keep large portions of it in RAM rather than on disk. The reason for that is that it directly influences the time we need to verify new blocks that are being broadcast. Delays in verification cause blocks to propagate slower across the network, which results in more stale blocks, and indirectly an advantage for a 51% attacker.


Is history reversal a concern if the absence of attackers is assumed?

Yes, there is still a need to wait for confirmations.
Even in the absence of active attackers, there are many reasons the Bitcoin network could diverge, such as:

Large scale internet routing issues - we've already seen these with BGP routes being incorrectly broadcast, leaving large chunks of the internet temporarily inaccessible from other large chunks. In such a scenario, if miners are isolated into one of the two groups, each isolated group will advance the network without any visibility into the blocks being produced by the other side until the two networks are merged
Implementation bugs - although Bitcoin nodes generally just run Bitcoin Core, different implementations of the same Bitcoin Protocol can occasionally result in consensus bugs that result in everyone on one implementation rejecting blocks from the others. This has resulted in a few forks on other chains with multiple common implementations, such as ethereum.
Just normal mining - the very nature of mining means that sooner or later, two miners will produce block N simultaneously. This results in a split chain until the next block is mined, at which point only the block that is included in the prevBlock for the new block is retained.


Transaction created, but txid not found on blockchain explorers

After opening the RPC debug menu, you can do getrawtransaction e9c858f852a1de7c70e6f8377f2147f3def1d4b1d85a5947d028bb9c13450318, and then paste the raw hex transaction to https://www.blockchain.com/btc/pushtx.


Do parties in a Lightning Network channel need to be online?

The lightning network is comprised of bi-directional payment channels between two nodes.  This means that either one of those nodes should be able to initialize a transaction at any time.  These transactions require both parties to be actively participating in updating the smart contracts that keep the channel alive.  If one party fails to respond, they are essentially in violation of the smart contract, and are forfeiting their claim to any of the funds in the channel.

Non-responsive clients are a liability to anyone opening up a channel.  It means that their bitcoin may be tied up in the channel until the timeout period.  That bitcoin was typically put there either to make a payment (which now is delayed), or to earn network fees for being a hub of other people's transactions.  An unresponsive node means the channel is wasted.  It's similar to a denial of service attack, except it's tying up bitcoin rather than bandwidth.

To illustrate how this works, consider that Alice and Bob have each contributed 1BTC to a shared channel.  The entire channel now has a total of 2BTC in it, but it has a cap in each direction.  Because Alice only put in 1BTC, the most that will ever flow from Alice to Bob is 1BTC.  This is the same for total transactions from Bob to Alice.

Let's say that more money has flowed from Alice to Bob during the lifetime of the channel, so that if it were closed right now, Alice would get 0.5BTC, and Bob would get 1.5BTC (excluding fees for simplicity).  Now let's say Bob all of a sudden went offline, leaving the channel useless.

Due to how the smart contracts work, Alice will have a valid bitcoin transaction from earlier, that was signed by Bob, and could close the channel leaving Alice with more than the 0.5BTC she is owed.  Alice can broadcast this transaction to the Bitcoin network, and after a timeout period, will get Bob's rightful money.  The only thing that prevents this, is that Bob will see the transaction propagate on the network, and can submit the final transaction that he has (already signed by Alice) to get his full payment before Alice's transaction is valid.  If Bob isn't paying attention, then Alice can steal what is rightfully his.

Penalizing unresponsive nodes is a feature of the lightning network, intended to keep it functional.  By leaving the channel unattended, Bob is doing Alice a disservice.  Making that behavior financially disastrous is what makes the system work in the first place.


Passing incomplete information to an SPV node

This is a a known shortcoming. The SPV protocol does not protect against omission attacks.

An SPV wallet can request a proof that a given tx is present in a given block, and that a given block is part of a given chain. However, it is not possible to prove that the node isn't omitting a transaction the wallet would like to know about without providing the entire block data for each block, at which point you are essentially a full node.

Wallets avoid this by connecting to multiple nodes - as long as there is one honest node in that connection pool, the wallet will receive up to date information.


Overview of solo mining with no GUI's and with GUI's, short explanation.

There are a few approaches you can take as of 3/18/13

You can either be interested in the low-cost learning of the protocol and related technologies
You can invest in equipment related to mining
You can invest in BTC directly, exchanging cash for the few Bitcoins that are available.

Just be sure to expect that up front, any of the latter two choices are a gamble.  The knowledge you gain is something you can keep with you as the technology matures.

I'll touch on a few of your points:

I want to be a miner

"Mining" for coins is not always a profitable situation.  It depends on the hardware you use, and often time who you team up with in a pool.

ABOUT THE HARDWARE:  CPU's and GPUs have been replaced by FPGAs by normal miners.  If you want to achieve more than 0.000x BTC then you need to invest in an FPGA, and soon, an ASIC chip for mining.  Your new video card doesn't have to go to waste, you can partipate in the vanitygen pool, or the litcoin generation pool.  Note that litecoin is a way of diversifying your risk in cryptocurrency and doesn't mean it will achieve the greatness of Bitcoin production coins.

ABOUT THE POOL: Each pool will allow you to even out your earnings over time.  @Meni has written a very nice whitepaper on the subject.  If you're new to Bitcoin, read all his posts.

I want to make my own pool

This is an interesting subject since I also wanted to do the same thing.  It turns out that the math and "hackability" of a pool isn't straightforward and that it's entirely possible you can go bankrupt running one (or whatever you invest).  Make sure you protect yourself from PPS pools of you run one.  I think as of now the safest is "double geometric" for both the operator and the client.  Look up @Meni's whitepaper for more info

I want to just learn the technology

The very uninitiated can run "bitcoind" from their computer with the parameter gen=1 set so it uses CPU to hash.  This is only viable on the "test network" where coins have no value.  To learn this way, simply run Bitcoind with -gen=1 and -testnet set at the command line.

On the other hand if you want to programmatically do the steps you listed, I suggest you read the source code of some of the python or C++ clients available.  It may be a good idea to have your question list the languages that you're familiar with since the code your looking for may have already be written, or even optimized with low level optimizations in mind.

I want to invest

There are a few ways to purchase BTC. Namely MtGox and Coinlab are the top two leading trading sites.  I suggest looking at the purchase requirements there to buy coins at the best price.


produce a public key from private key with ecc, with clear description about k=k*g

When talking about math using a curve, when we use terms like addition and multiplication, we don't mean normal additional and multiplication. We are referring to operations on the curve that have properties similar to addition and multiplication. To get the correct results, you have to use the actual operations on the curve, not normal addition and multiplication.


How is a Transaction Output Marked as Spent?

Every full Bitcoin node maintains a database of which unspent outputs are left.

When verifying a transaction, all its inputs are fetched from the database. If one is missing, validation fails. Among the data retrieved is the value of those unspent outputs, and their script (od address), which define the conditions under which the output can be spent. This information is necessary to validate whether the spending transaction has the correct signatures and does not create more bitcoin than it consumes.

If all validation of all transactions in a block succeed, the consumed inputs are removed from the database, and all outputs of those transactions added as fresh unspent outputs in the database, allowing them to be spent by future blocks.

As this database only contains outputs (so no signatures, for example), and even only the unspent ones, it is much smaller than the entire blockchain (some 450 MB as of juli 2014). So, no, we don't go scan through the entire blockchain to know whether outputs are not double-spent - we keep a separate database with just the data we need from it for validation.


How do I use the XPub to generate the Public addresses

Given the XPub and an address, can I write an algorithm to say whether or not that public key was derived from that XPub and consequently belongs to the same user?

[Edit: my terminology was off, answer edited substantially to be correct]

Given the xpub and an address, you would indeed be able to discern whether the two are related.

BIP32 is the specification that describes hierarchical deterministic (HD) wallets. To extend a parent public key, it is combined with the chain code and the index, then hashed through HMAC-SHA512. The hash output is split in two, and the 'left half of the hash' is added to the parent public key, to produce the child public key.

So by knowing the xpub (parent public key + chaincode), you can write an algorithm to determine if the two addresses have a parent/child relationship, and you would be able to find additional child addresses.

Without the xpub, remember that BIP32 derived keys are otherwise indistinguishable from any other keys. So you can not just look at an arbitrary address and know with certainty how it was derived.


Is mnemonic words -> mnemonic sentence standardized?

From bip39:

  To create a binary seed from the mnemonic, we use the PBKDF2 function
  with a mnemonic sentence (in UTF-8 NFKD) used as the password and the
  string "mnemonic" + passphrase (again in UTF-8 NFKD) used as the salt.
  The iteration count is set to 2048 and HMAC-SHA512 is used as the
  pseudo-random function. The length of the derived key is 512 bits (=
  64 bytes).

When normalizing unicode in NFKD form, characters that look the same become the same, so U+3000 becomes U+20. This may also cause length to change as composite characters are broken down into their constituent parts.


ripple-lib is not returning transactions with the getTransactions method

You can use chain of promises like this:

const RippleAPI = require('ripple-lib').RippleAPI;
var test_server = 'wss://s2.ripple.com';
const api = new RippleAPI({
    server: test_server // Public rippled server
});
api.connect().then(() => {
    /* begin custom code ------------------------------------ */
    const myAddress = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn';
    console.log('getting account info for', myAddress);
    return api.getTransactions(myAddress);
}).then(info => {
    console.log(info);
    /* end custom code -------------------------------------- */
}).then(() => {
    return api.disconnect();
}).then(() => {
    console.log('done and disconnected.');
}).catch(console.error);

Good luck)


I am wonder why this works.

Because all options have the default value.

  The question is what txindex=1 do.

I can't find this option in the documentation

From the documentation

  -txindex Maintain a full transaction index, used by the getrawtransaction rpc
  call (default: 0)

If you're using Bitcoin Core just for your own personal use, you probably don't need the -txindex=1 option. But, if you're using Bitcoin core for development or blockchain analysis of some sort, you will need to set -txindex=1 to be able to get transactions data for any transaction in the blockchain.


How to integration Blockchain Payment API in Asp.Net?

I'm assuming you're new to API.

The link you gave,
    https://blockchain.info/merchant/$guid/payment?password=$password&second_password=$second_password&to=$to&amount=$amount

Is only a template for an API request. You need to swap out the $guid with your merchant wallet id, e.g.

4b8cd8e9-9480-44cc-b7f2-527e98ee3287

You also need to substitute every other variable starting with a $ with the respective information.

e.g. password=<insert password here>


When the last bitcoin is mined will everyone know it?

Some time in around year 2100, blocks will only be worth 0.00000001 BTC or less. But a long time before this, miners will earn their bitcoins by the transaction fee. And when blocks no longer can generate bitcoins, then the miners will earn their bitcoins only from the transaction fee (versus earning 99.99% from the fee). Miners can still generate blocks, even though blocks no longer generate new bitcoins.

The bitcoin-qt client does not have any "popup window" when this happen, if that's what your asking?


Can't spend Watch-Only coins, have I been scammed?

A watch-only address means an address your wallet is tracking the balance of, and not more than that. To own an address, which means to be able to spend from it, one is required to know its private key. All addresses generated by a wallet software have their private keys stored by and known to the wallet.

A common scam using watch-only addresses is as below:

A user is told "invest today, earn 100 times soon"
The victim pays the malicious actor.
Later the malicious actor says "We have your profits, now you need to import them to your wallet"
The victim is instructed to import the address as "watch-only" to their wallet and not the private key required to spend the coins.
It takes time for the victim to notice that they can't spend their balance. However, the malicious actor has already vanished.

Remember that Bitcoin is a cryptocurrency, which means it's possible to make transactions!!! If the malicious actor was honest, he'd ask for the user's address so that they could make a transaction and send their earnings, but importing to wallet should always be considered fishy.


Is the UTXO set computed from scratch by new full nodes?

The UTXO set cannot be validated, except by going through all blocks in history.

The P2P protocol does not even have a way to stream the UTXO set from one node to another, so yes, full nodes will always download and verify full blocks, and rebuild the UTXO set from it.

There are various ideas (some of which are very old) to make blocks commit (= contain a hash) to the UTXO set, or a related data structure. That way one could synchronize the UTXO set for a state in the past (which  means a trust in miners), and fully verify going forward from there.


Do receiving addresses expire on Multibit?

But to answer the question: addresses do NOT expire. Not in Multibit, not in cold storage, not online (unless the site retired and you do not have an offline private key or wallet), nor any other wallet software. They can be used unlimited amount of times, so that's not the problem either. The problem your face is probably in Multibit. You can try to backup the .wallet or .key, and import it in another wallet software, or delete/reinstall Multibit.


How to verify the compressed signature in Bitcoin? It is 138 long in hex

If you have the bitcoin core software, you should be able to use the CLI to verify signatures using the verifymessage command. Some wallet software also has this functionality.


HOw to convert BItcoin to cash or bank transfer

Yes, you can easily receive a payment in BTC following these steps:

1) Download a Bitcoin wallet. A Bitcoin wallet is a software which you can use to store, send and receive bitcoins. There are many different types of Bitcoin wallets but I recommend using one of these:

https://electrum.org/#home
https://greenaddress.it
https://bitcoin.org/en/choose-your-wallet

Install procedure is quite easy. You can find plenty of information on the internet about this or you can email me at cluster2k@protonmail.com, I'm happy to give you some hints to get started with Bitcoin

2) When you have installed a wallet you will see that the wallet has a "receive" tab where many Bitcoin Addresses (in this form: 1Ht7brsfdt8qG1QkBnku1MWwoPRWNwQfgL) are shown. You can choose one of those addesses and that becomes "your account" where you can receive Bitcoin transactions (as in example the payment you want to receive from your client). Just copy paste one of those receiving BTC address from your wallet to your client and he will know that he has to send BTC to that "account" you just gave him to execute the payment towards you.

3) You can exchange BTC to FIAT currencies, including INR, on so called cryptocurrencies exchanges. I have made a list here, and there are many India Based exchanges which can turn to be useful to what you are looking for. Check the list here : https://bitcointalk.org/index.php?topic=3140406.0

I hope this helped.
Enjoy the revolution of Bitcoin tech ;)


Bitstamp: What type of order to place to buy BTC when the price drops to a certain value?

I figured this out. A "Limit" order is what I wanted to do.

A limit buy order will trigger if the price hits the target or lower. A caveat for anyone unfamiliar like I was: the order won't necessarily be fulfilled at the price your specify, rather it will become a market order which will execute at the next best available price.


does bcoin support simplified payment verification (SPV)?

Yes, it supports SPV out of the box. Bcoin actually started out as an SPV project according to Buck Perley.

Here is an example on how to start up a bcoin node in spv

https://github.com/bcoin-org/bcoin/blob/master/docs/Examples/spv-sync-wallet.js


How to make sure Electrum connects to my private Electrs server and to no other server?

I don't know why this happened several times. But in the end the config worked with true and now my nodes show only one connection and this is the private server.


What happens to cash used to buy bitcoins?

Bitcoin exchanges, like stock exchanges, act as a middleman for people that want to trade bitcoins. They do not sell/buy their own bitcoins or US Dollars.

Suppose that I have 10 bitcoins and I want to sell them at $5 each. In order to do that, I can use a bitcoin exchange and put a sell order at $5 for 10 coins. This is a way of "announcing to the world" that I will sell 10 coins to anyone who is willing to pay me $50. If you want to buy them, just login to the exchange and put a buy order at $5. The exchange will match our orders and I will receive your $50 and you will receive my 10 bitcoins.
When a buy order matches a sell order, a trade is made. This is how the bitcoin price is defined.

Now suppose that you want to buy bitcoins, but you are only willing to pay $4.9 for each bitcoin. You will put your buy order at $4.9, but it will not match mine because I only sell if you pay me $5 per coin. The amount of pending orders defines market depth.

For example, you can see here the market depth for MtGox. The bids table show the price people are willing to buy at and the asks table show price people are selling at. MtGox Live is also a nice way to visualize these concepts.

Note that bitcoin exchanges charge a small fee (currently around 0.5%) each time they match an order. So in the previous example I would receive $49.75 and you would receive 9.95 bitcoins. The rest is kept by the exchange for their services.


Each ~10 minutes, a "block" containing transaction gets crafted and broadcast. Miners choose which transactions to include in their block -highest fee/Kb transactions, to maximize their earnings- and they collect the transaction fees of the transactions they've chosen when they find and publish a block.

Consider this transaction:

You can see the:

Included in Blocks: 499089

If you browse to that block in the block explorer...

So, the transaction fees of that transaction are collected by the mining pool ViaBTC.


It depends on the mining pool and the software they are using. There is no one specific way for mining pools for a specific coins to relay information to their miners. For Bitcoin, most use stratum or getblocktemplate. For stratum, I don't think either of the libraries will work as stratum is not served over HTTP.


Address Verification Failed / View on Tresor Address don't Match

Addresses on LTC transitioned to a new format right about this time.  You are probably looking at the same address on both the website and the LCD, but they are just in different formats.


How specific are ASIC's design? Can they single hash SHA256?

A Bitcoin mining ASIC:

does not attempt to complete a single hash, rather fragments of two SHA256 compression rounds which is then compared to a target, the result is never returned
can not accept arbitrary information that is not in the form of a partial SHA256 compression round

So in terms of competitiveness, a CPU can actually complete a SHA256 hash, a mining ASIC can not, which I suppose puts it ahead in this arbitrary race.


How can I use Bitcoind on Ubuntu if I installed from PPA?

You probably installed bitcoin-qt only.
You should install it first.

sudo apt-get install bitcoind


Pros and Cons of using HDD or USB Flash drive (script mining)?

It's best to choose the HDD because it's easier (all computers should have one), and faster than the USB drive in most cases. But it shouldn't really matter.

Why it doesn't matter

Mining is not storage intensive, you aren't storing massive amounts of data when mining. You aren't even storing data when mining. It's all stored in computer memory, think RAM. A faster storage could only help with downloading the block chain in faster time, which won't improve your mining as it is only done once and finally.

But don't go buying up RAM as well. You mainly mine Scrypt coins with a graphics card and those have plenty of on-board memory. And if you are CPU mining you shouldn't be.


How many addresses can be handled reliable in one wallet?

There isn't a problem with storage but there is a problem with the computation time necessary when constructing spend transactions which involve a large number of inputs from your wallet.

This is a problem that is evidenced by those who run Martingale betting bots against SatoshiDICE for instance.  After they get several thousand bitcoin addresses with transactions, their subsequent bet transactions that draw from those coins start to crawl.

A future release of the Bitcoin.org client will address this by switching from BDB to LevelDB.  Additionally targeted for future release is "ultraprune" which will lessen the storage requirements as well.

In the meantime, InstaWallet is one service that was able to come up with a solution that mitigated the problem.  They might be able to offer some suggestions.


Does having the Bitcoin Client running always use up a lot of the CPU?

The normal bitcoin client should not use more than a few percentages, if not even zero, from your CPU.

What client are you running? The Bitcoin-Qt client? Did you ever enabled the "generate bitcoins" option? I'm not sure if it's in the Bitcoin-Qt client's settings, but you could've enabled it in your bitcoin.conf file.

Maybe you should post your bitcoin.conf file. Or just make sure it doesn't have generate=true in it.


"No more backup pools left. Using primary and starting over."

Presumably, you have no backup pool configured. So if your server doesn't respond quickly enough, poclbm just fails over back to the primary pool. If these are only happening occasionally, I wouldn't worry about it. Anything that momentarily prevents the RPC call from getting a response can do this.


Maysspayout, SendMany, Bulk Payouts with Bitcoin Core

Electrum is an SPV wallet which means you don't need to download the entire blockchain. It will be up and running in a few minutes

It has a handy sendtomany feature where you can even upload a csv file


How do I enable segwit in Bitcoin Core 13.1?

SegWit has to be activated on the network first. Signaling will start on the 15th of November. When there is a difficulty period where 95% of the blocks signal readiness for SegWit, it will be activated after another two weeks of fallow.

Creating SegWit transactions before it is activated on the network can lead to complete loss of funds.

After it has been activated, you can use SegWit by providing the sender a SegWit address (similar to a P2SH address). Likewise, to send a SegWit transaction, the recipient has to generate a SegWit address for your use.

This means that only wallets that already support SegWit will be recipients of SegWit transactions.


What does the IRS tax in terms of bitcoin practices

They tax the exact same things as if you'd done those things in Thai Baht, or Nigerian Dollars, or British Pounds. If you view ads, that's income. If you buy gold, and it appreciates, that's capital gains. If you buy a mining contract, the income minus depreciation is capital gains.


Why is the signature hash different for each input in a multi-input transaction?

Varying the signature per input helps prevents some attacks during multi-party transaction construction.

Consider a coinjoin involving Alice and Bob.  Alice selects one of her UTXOs for the coinjoin.  Bob chooses a UTXO for his input, but he actually selects ones of Alice's other UTXOs that reuse the same address as the one she selected.  Alice does not notice that Bob selected one of her UTXOs and continues with the coinjoin protocol, signing her input.  Now Bob copies her signature, which would be valid for the UTXO of Alice's that he selected if SIGHASH_ALL were constant for all inputs.  Now Bob has procured Alice's funds for himself.

Technically this can be prevented if Alice checks all other inputs to the coinjoin to make sure that they are not controlled by herself, but that is a huge pain, error prone, surprising, and likely means a secure signing module needs to be aware of all UTXOs that use the same public key.


Bitcoin sent, confirmed on my end - never received on the other end

They sent me a link which took me to a coinbase processor. I got the wallet address and sent the money from my Electrum Wallet. I have 157 confirmations, Electrum shows it's there and complete, but the receiver says they never got it.

One of three things has happened:

The receiver's wallet is not properly synced wit the network and hasn't seen your transaction
The receiver is lying about not receiving the transaction
You somehow sent Bitcoin to the wrong address (eg malware injected a malicious address into your copy/paste clipboard)

  Someone told me that if btc isn't claimed within 30 days it automatically goes back to where it came from.

This is incorrect. Perhaps there are custodial services that work this way, but if you send an actual Bitcoin transaction and it is confirmed in the blockchain, then the chance of it being reversed are basically zero.

  So where could the money be if they say they no longer use bitcoin? isn't it still in that wallet? They just have to get it right?

If you can link an address you sent to, or a transaction ID, someone could take a look at the blockchain to see where the Bitcoin ended up, but generally:

If you sent to a coinbase payment page, then the payment was sent to a Bitcoin address that Coinbase controls. Coinbase may have forwarded this payment on to the person you were paying, or it may still be sitting in that person's coinbase account. You would have to contact Coinbase and/or your counterparty to resolve the issue. There is nothing further anyone here can do to help you remedy the situation.


How does electrum interact with the underlying bitcoind service?

Electrum Server is a fancy abstraction on top of bitcoind and a custom index of UTXO data. Client wallets connect to it and send queries for details about their wallet, using its own index Electrum Server requests the correct information from bitcoind and returns it to the client. The Electrum Server keeps its index up to date by continuously querying bitcoind for changes such as mempool updates or new blocks.

All communication with the wider Bitcoin network happens through bitcoind, including block updates and transaction broadcasts. For the purpose of this discussion, Electrum servers are standalone and completely unaware of one another, there is no cross communication between them.


Just in case someone struggles with the same issue, the code was actually incorrect. Pull request #163 fixes the issue.

Here you can also see an equivalent solution properly commented and cited.


how to set the transactions fee using the RPC call?

Yes there is ‘estimatesmartfee’ which computes fee with high confirmation probability within n blocks.


ECDSA - why not using the cyclic additive group

(Disclaimer: this is not my field.)

Let g be the chosen generator and n its (prime) order.  In the ECDSA algorithm, these are publicly known.  It is true that g generates a cyclic (abelian) group isomorphic to Z/nZ.

Now a private key consists of an integer k, and the corresponding public key is the group element h = kg. (I use additive notation since we are in an abelian group, so kg = g+g+...+g (k times)).  If we were actually working in Z/nZ, it would be trivial to recover k from h: just divide h by g (mod n) using the Euclidean algorithm.  Then we would have no security at all.

The point, as I understand it, is that in the elliptic curve group, there is no known efficient way to "divide".  And while there certainly exist isomorphisms from <g> to Z/nZ (map g to any element of Z/nZ you like), the inverse of such an isomorphism is not trivial to compute.


signrawtransaction of a P2SH-P2WPKH spend seems to be broken?

The wallet does not know how to sign for segwit stuff until you use addwitnessaddress. This is because it is only tracking the P2PKH outputs for that key. You have to explicitly tell it to track the witness outputs for the key by using addwitnessaddress.


How do I get my spent bitcoin back into my wallet after a mistaken transaction

how do I get my bitcoin back into my wallet?

Once you send them to someone else, they are no longer your Bitcoin so far as the Bitcoin blockchain is concerned.

Bitcoin transactions cannot be reversed

Since Bitcoin transactions are irreversible, the only way to get your Bitcoins back is to contact the exchange, business or person you paid them to and ask them to create a new transaction to reimburse you.

It may be worthwhile first checking their terms of use to see how they handle this situation. They may have a policy of not getting involved in sorting out this kind of mistake involving small amounts - or they may charge you for their staff costs in sorting out your mistake.

Excash

If by "Excash" you mean some kind of in-game currency used in a multiplayer online game, you may need to contact the business that runs the game and ask for their help.

If by "Excash" you mean www.ex.cash run by "Zebiex". They don't seem at all trustworthy to me. Minimal website, recently set up in the last few months.
I can't imagine why anyone would send money to such an apparently sketchy business.

There are a lot of websites using similar names (e.g. exkash) but I doubt I'd find any of them to be trustworthy.


Is there any protection against receiver's address masquerading attack?

Bitcoin provides no protection against such attacks.  It is up to each user to verify that an address belongs to the person they really want to send money to.


This should be possible by having several checks happen in one script.

So, a normal pay-to-address script looks like:

OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

And a normal multisig, say for 2-of-3, looks like this (format is a little different from above):

format: [byte value] [meaning]
52 OP_2, meaning you need two signatures
41 push 65 bytes
[pubkey 1]
41 push 65 bytes
[pubkey 2]
41 push 65 bytes
[pubkey 3]
53 OP_3, meaning there are three public keys
ae OP_CHECKMULTISIG described at https://en.bitcoin.it/wiki/Script

And we want to have three checks: A must have signed, 1-of-(B and C) must have signed, and 2-of-(D, E, F, G) must have signed. So we chain it like so:

OP_DUP OP_HASH160 <pubKeyHash A> OP_EQUALVERIFY OP_CHECKSIGVERIFY
OP_1 <pubkey B> <pubkey C> OP_2 OP_CHECKMULTISIGVERIFY
OP_2 <pubkey D> <pubkey E> <pubkey F> <pubkey G> OP_4 OP_CHECKMULTISIG

And hash that script to have something easy to send to (pay-to-script-hash). Note the use of the VERIFY variants in the first two checks and the ordinary one in the last. If you look at the meaning of these OP codes and the fact that a valid transaction needs to end with a non-zero value, the correctness of this should be clear.

It'd be a good idea to try this out on the testnet before using it in a real transaction, so that you don't wind up with unspendable (or spendable-by-anyone) bitcoins.


I bought 1BTC and the transaction was instantaneously, how?

New transactions propagate across the Bitcoin peer-to-peer network very quickly.  This is how they get to miners to be included in the block chain (confirmed), but everyone else sees them right away also.  Your web wallet software alerted you that it saw a transaction sending 1BTC to your wallet, and updated your balance accordingly, on the assumption that the transaction will eventually be confirmed.  But it should also have indicated that the transaction was not yet confirmed, with a message like "unconfirmed" or "0 confirmations".  Seeing this, you could decide whether you're willing to let the other guy leave, or if you want him to stick around until the transaction has one or more confirmations.

Of course, it's also possible that you were lucky and a miner found a block very quickly after receiving your transaction.  In that case it might actually have been confirmed by the time you saw it.


How do you configure windows to store the bitcoin blockchain data into another directory?

Add '-datadir=path-to-directory' to the command used to start the client.  For example,

bitcoin-qt -datadir=D:\Bitcoin

to store the bitcoin files in the D:\Bitcoin directory.  Remember to enclose the directory path in double quotes if it contains spaces.  Also move the subdirectories as well as the main application directory to the new location.


You need to delete the data directories entirely with the node software shut down when you do that. If both nodes' data directories have been removed and starting one of them still results in the blockchain being downloaded, that means that there is a node that you are connecting to which did not have its data directory cleared. You can find out what node that is by looking in the debug.log file and seeing the IP address of the node that you are connecting to (or is connecting to you).

Alternatively if you generate a new genesis block, you will not have this problem as whatever blockchain you use with the new genesis block will be different from the original blockchain.


Why a specific bitcoin value of a tx message appears in source IP address and then comes to same IP address as the destination address?

Since you using wallets on the cell phone, I presume you are running a SPV node. SPV nodes verify transactions using a slightly different method that relies on peers to provide partial views of relevant parts of the blockchain on demand. In order to ensure that the transaction that you have sent has been confirmed in a block, your SPV nodes will use bloom filters and send that to the full nodes connected to it. Those full nodes will then test each transaction’s outputs against the bloom filter. Only transactions that match the filter are sent to the node.

In response to a getdata message from the node, peers will send a merkleblock message that contains only block headers for blocks matching the filter, a merkle path for each matching transaction and then also send tx messages containing the transactions matched by the filter.

It is this transaction that is sent again to the node is what you are seeing in the packet traffic.


Convert Electrum p2pkh wallet to p2wpkh one?

You could theoretically export the wallet to a new type by seed (p2pkh to p2wpkh) but it would not recognize any utxo that came into it as the derivation for p2pkh and p2wpkh are different. It's not like with some altcoins who created new "address standards" that are just different way of hashing public keys, in bitcoin p2pkh and p2wpkh are different scripts.
There are wallets out there that allow for multiple types of scripts to be used, but I believe in electrum (desktop) the only way is to create a new wallet with a p2wpkh script type and transfer your funds there. I would still advise to do it (being security-conscious) as of now it will allow you to save on transaction fees as p2wpkh transactions are cheaper.
Also in the comment of One seed phrase created two wallets with two script types
@prayank has mentioned there is possibly a workaround to electrum having only one type of script available in the single wallet, but he hasn't gone into the details.


I need help on how to change the disk to run my bitcoin core wallet

Close core, find your bitcoin.conf file, and change the datadir setting. e.g.

# [core]
# Specify a non-default location to store blockchain and other data.
datadir=/opt/yourdisk

Then re-open core. It should pick up where your wallet last synced to on the external drive.