How do I find out what getwork would have returned for an already mined block?

Since we have quite a few questions about mining I took the liberty of creating a tool that demonstrates how to get from the getwork to the actual hashes and testing them against the target.

Your question is simply the reverse direction of mining, so let's get started.

All parameters are taken from the actual block.
This is a version 1 block so we start with the 01000000 (1 little
endian). This is followed with the 32 byte prev_hash, again in little
endian:

00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81

becomes

81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000

same goes for the merkle root:

2b12fcf1b09288fcaff797d71e950e71ae42b91e8bdb2304758dfcffc2b620e3

becomes

e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b

Next comes the timestamp. 1305998791 (4dd7f5c7 in big endian) is
c7f5d74d in little endian. Then the bits (encoded difficulty)
440711666 is 1a44b9f2 in big endian and f2b9441a in little endian. And
finally the nonce. Since you are asking for the getwork this is the
part that your miner will have to find, hence we just mark it out with
0 (00000000).

Putting it all together we have a data field of the getwork request
that is

0100000081cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122bc7f5d74df2b9441a00000000

Then getwork does a strange thing: it chunks the header up into groups
of 4 byte and switches the endianness. So that this string becomes

00000001ab02cd818b9e567ee21793cddef299feb29ad444a41b85b8000008a300000000c2b620e3758dfcff8bdb2304ae42b91e1e950e71aff797d7b09288fc2b12fcf14dd7f5c71a44b9f200000000

This is exactly 80 bytes in length and corresponds to the data field
(without padding). The getwork however includes some padding to become
two SHA-256 blocks of length 64 bytes.

The padding is discarded by the miner, but for completeness:

000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000

Next in the getwork we have the midstate. This is simply first 64
bytes of the header with a partially applied first round of hashing,
hence we can recover it from the block header (or data):

93c524951367c505ba69e616a010282d376ee807daa9562f69ce5bcd2dda787a

The getwork also includes an additional field that keeps some internal
state from the SHA-256 algorithm, the hash1 field:

 00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000

It is always constant, and is pretty useless.

The final field in our reconstruction of the getwork request is the
target. This is the one field we cannot actually reconstruct as it
depends on the pool setting that provided the work. It is likely to be
difficulty 1, hence the field itself is:

00000000FFFF0000000000000000000000000000000000000000000000000000

which is a long, below which the found hash has to be. Due to this
being Bitcoin it is again little endian and becomes

0000000000000000000000000000000000000000000000000000ffff00000000

The entire reconstructed getwork should look something like this

{
  "midstate" : "bfc1dbf82dd6335830eb42a5258fb7ceb4c566ed2ae7ec4ed1d23bd9dbbff68f",
  "data" : "00000001ab02cd818b9e567ee21793cddef299feb29ad444a41b85b8000008a300000000c2b620e3758dfcff8bdb2304ae42b91e1e950e71aff797d7b09288fc2b12fcf14dd7f5c71a44b9f200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000",
  "hash1" : "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
  "target" : "0000000000000000000000000000000000000000000000000000ffff00000000"
}

To see how a miner finds a block from these parameters just enter them in the manual miner I created. Notice that if we fill in the nonce that is in the block (2504433986 or 9546a142 in its hex representation), we indeed get a block of the required difficulty.

Edit: Frank Buss contacted me for a correction: the midstate I posted above was wrong.


Merkle trees in general can have more child nodes, but the Merkle tree for transactional data in Bitcoin is a binary tree.

"Merkle trees are binary trees of hashes." –Bitcoin-Wiki Protocol Documentation
"From these txids, the merkle tree is constructed by pairing each txid with one other txid and then hashing them together." –Developer Guide: Transaction Data

This has the advantage that only a list of root, log2(n) hash partners and the index of the transaction are sufficient to reconstruct a Merkle branch, allowing Simplified Payment Verification with much less data than the complete block.
If I am not mistaken, the binary format minimizes the amount of hashes that need to be transferred for full reconstruction of the Merkle branch, e.g. for 16 transactions

binary tree: root + 4*1 hashpartners + txid + position
three children tree: root + 3*2 hashpartners + txid + position
four children tree: root + 2*3 hashpartners + txid + position

Lookup is likely less of an issue than the wish to minimize bandwidth usage.
Yes, I'm committing the fallacy of "proof by example" here. ;)


Do I have to pay tax if I buy bitcoins with my USD?

According to the guidelines currently provided by the IRS, you are only required to pay taxes if you sell those bitcoin and have made a profit on them. If you are holding, or made nothing, or lost money, you are not required to pay taxes on them. If you lost money, you may claim those losses when you file your taxes, if you wish. It is not practical for the IRS to track the bitcoin of every US citizen who owns some, and becoming increasingly difficult to do so, given the continuing advancement in bitcoin privacy enhancements. It is one of those categories where the IRS relies mostly on self-reporting. However, if you have been moving a ton of bitcoin and not paying taxes on it, then you get audited, this is something that could come up in a detailed investigation into your finances.


How does the electrum wallet 'payto' command work

There is one more step to actually process the transaction, you have to broadcast it. What you have got is a signed transaction which you can save (& even send to someone else to broadcast).

The signed transaction can be broadcasted like this:

electrum payto <bitcoin_address> <amount> | electrum broadcast -

This will write the transaction to the chain. You can read more in the official documentation.


How does the bech32 length-extension mutation weakness work?

I'm going to provide a more algebraic explanation of the issue.
Every valid (and invalid) Bech32 string can be seen as a polynomial in the variable x, where the coefficients are elements of GF(32). I'm going to ignore the GF(32) part in what follows, so it suffices to say that they're simply numbers from 0 to 31 inclusive, with weird addition and multiplication rules that guarantee every operation always stays within the range 0-31.
The data part (which means the string excluding the human-readable part (HRP) and the "1" that follows it, but including the 6 checksum characters at the end) uses the character set that's included in BIP173 in table form. For example, a "q" means 0, "p" means 1, "3" means 17, and "l" means 31. Each of these characters forms the coefficient of the term of our polynomial. I'm going to ignore the human-readable part as well in what follows as it doesn't matter for the issue, but for completeness the HRP also encodes coefficients of the polynomial, but using a different (and slightly more complicated) translation.
For example, the string "3qlp" corresponds to the polynomial 17x3 + 31x + 1. As "q" represents 0, there is no x2 term.
Now, every valid Bech32 string corresponds to a polynomial p(x) that can be written as p(x) = f(x)⋅g(x) + 1 for some f(x), where g(x) = x6 + 29x5 + 22x4 + 20x3 + 21x2 + 29x + 18.
Why is that + 1 there? If it wasn't, then for every valid p(x) = f(x)⋅g(x), x⋅f(x)⋅g(x) = x⋅p(x) would also be a valid polynomial. As multiplying by x is simply adding a 0 (or "q") at the end, this would let anyone accidentally mutate valid Bech32 strings into distinct valid Bech32 strings by simply appending a "q".
However, it turns out that adding the + 1 does not fully solve this sort of issue. It isn't possible anymore to simply multiply by x, but it's still the case that for every valid p(x), xi⋅(p(x) - 1) + 1 for any i > 0 is also valid. If p(x) happens to end in a "p", it can be written as x⋅e(x) + 1 for some e(x). In this case, xi⋅e(x) + 1 is also a valid string, for every value of i. In string form, this corresponds to inserting "q" characters in the penultimate position (just before the final "p").
Similarly, if p(x) happens to end in a "qp", it can be written as xi⋅e(x) + 1 for some e(x) and i > 1. In this case, xj⋅e(x) + 1 where j < i is also a valid string. In string form, this corresponds to removing "q" character in the penultimate position (just before the final "p").


Yes that would work. In fact, depending on the wallet, you can even import the address (the public part) and see the transactions. Only when you want to send bitcoins would you need to import the private key.


Is there a limit on the number of orphan transactions a node can cache?

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

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

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


Balance zero after recovering wallet from seed-phrase

I ... downloaded BRD wallet ... then proceeded to recover wallet ... but [it] brought up my account with zero funds in it.

Choose Sync Blockchain (Menu > Settings > Sync Blockchain).
Wait five hours
Check balance

If not try

Uninstall Bread Bitcoin Wallet.
Reinstall Bread Bitcoin Wallet.
Bread will ask you to type in your 12-word key in order to re-instate your Bread Wallet.
Now your balance should show as $0.00. This is normal.
Sync Blockchain (Menu > Settings > Sync Blockchain). Note: takes several hours.
Bitcoin balance should now be displayed properly.

From https://www.reidwalley.com/fix-bread-bitcoin-wallet-not-importing-paper-wallet/


Cheapest way to move money from MultiBit to Coinbase

You should reconsider your wallet switch. Mind that Coinbase can fully control your funds and it could lead to a similar fiasco we have seen in the past (Mt.Gox, etc.). Check out the web wallet section of bitcoin.org.

Export and import (if even possible) would expose your private keys or mnemonic seed and should therefore be avoided.

A better option would be to send your coins from Multibit HD to Coinbase. It would be one transaction and the required fee would be not very hight (~0.0003 BTC).


Every exchanges have that in place.
This is to prevent abuse. If they don't reserve the funds when people place orders, anyone could have placed infinite amount of orders, especially stop-loss orders.
Perhaps in Kraken the "balance" doesn't reflect that, but you can try to place double orders and see for yourself.


Control over money in Bitcoin is defacto[1] binary: either a transaction has been confirmed in a block and the money has been signed over, or the sender remains in control of the money. Hence, when you export the keys from MultiBit and import them to another wallet, you will be able to overwrite your previous transaction by issuing another transaction transferring the money somewhere else (unless the new platform is aware of your previous transaction and forbids doublespends).

[1]The only exception to this is the option of the recipient to create a child-pays-for-parent transaction which provides a sufficient aditional transaction fees to compensate the low fee of its parent. Still the money is only signed over once the transaction is in confirmed in a block though.


Do the various Ripple clients leak any data about account names?

The answer is no. Notations are stored only in your wallet which is always encrypted using your username and password.


Why do multihop LN payments start settling from the recipient's end?

I think you have answered your question yourself. If all nodes would behave honestly and in good faith your process would work. But in that case we would not need to go through the hustle of setting up htlcs to begin with but we could just forward money by changing the balances in each channel. The whole point of using htlcs is to make the payment process atomic and prevent nodes along the path from stealing funds.
Other than that I do not see any additional flaws.
Offtopic:
Looking at your recent post on the mailing list (c.f: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-May/002718.html ) I wonder if this idea of "forwarding a second preimage" in addition to the current process of "releasing a preimage" could be constructed to prevent griefing attacks because the sender could enforce settling the htlc in case someone stalls the process. But the way how I  imagine such a solution right now, it would basically run into the same problems as you already described in your initial question. It might be interesting to investigate if PTLCs (with adoptor signatures and payment decorellation) could be used to identify the griefing node and use such a process.


what would happen to an assigned block if the solo miner stops mining it?

The "work" of mining consists of finding a "solution" to a list of transactions. The miners throw in a 'bonus' transaction paying themselves as a reward for solving the problem. But only if they solve their problem "fast enough" do they actually get paid. (Other people are solving their own problem, and there is only one global winner per block. Once a winner is found, everyone starts over on the next block)

In a pool, the master creates a block to work on (giving a bonus to the master) and gives it to the slaves. All the slave workers try to solve that one problem at the same time (adding their power together). If the solution is found in time, the master gets the bonus, and distributes it to the workers in the pool.

So if there are no workers in a pool, obviously no solution can be found, so the master won't get paid.

On the other hand, a "solo miner" doesn't have "assigned blocks". He creates his own problem (giving payout to himself). If he stops working on that problem, he doesn't get paid. Only people who solve the problem (fast enough) can get paid.


If you have sent BTC to a BCH address your coins are lost.

BCH is not bitcoin it is an altcoin with it's own blockchain, it has been deliberately created by its creators to deceive people into thinking it is bitcoin.

This is not true, and is only the case if you do not own the private keys for the wallet you sent your BTC to.

BTC / BCH adresses are exactly the same.

Unless you've sent them to an exchange which is not willing to co-operate to get your funds back, you should be fine. Simply open up a support ticket, and ask them to get your BTC back you sent to their BCC adress.


Green means the price increased during the relevant period, so the lower value is the opening price and the higher value is the closing price. Red is the other way around.

I think the 0% you see is a visual glitch. If you close the charts you'll see that right behind where you see this is the "Volume Discount Display" meter, which shows you how far along you are on the way to move up to the next discount tier. For some reason it is still displayed when the charts are open. (For me the value is different from 0%.)

For charts older than a month you can use for example http://bitcoincharts.com/charts/.


What is the most cost effective way to exchange USD for Litecoin?

You could try looking for someone to trade you USD for litecoins in your local area in person, through Bitcoin OTC Exchange, or perhaps BTC-E or some other online exchanges.

In the first case the risk should be fairly small, although it might take a long time to find someone, get in contact with them and so forth. Not to mention the exchange rate might not be in your favour.

The second option should give you better results, but you'd have to make sure you are dealing with someone reputable enough for your trade. However, finding an exchange rate in your favour might not be too easy.

Third option is probably the safest and the exchange rate should be reasonable. The main problem you might face with established exchanges is possibly having to register on them with your documents to avoid your account and funds being suspended due to Anti-Money Laundering laws and regulations.


Two weeks have past, still nothing on my transactions

Since you already tried "-zapwallettxes", your client is now no longer broadcasting this transaction.
You have four choices(I listed them after difficulty):

1. Wait until it gets dropped from mempool or picked up by a miner.

2. Ask miners for help.
Since you are in urgent need: bitcointalk.org have plenty of members providing free transaction accelerator services. You can also go for the paid services, but be aware don't fall for the scammy ones.

3. Attempting a Replace-By-Fee (RBF) double spend transaction.

4. Attempt a Child-Pays-For-Parent transaction if you are also the recipient of this transaction.


My transaction hasn't confirmed and it's been 9 days

Your fee is extremely low. Blockchain is currently completely jammed up. Could you post transaction details so that any miners here can help?


Without knowing private public key any one can withdraw btc from address. Is it possible?'

Regarding your title, without knowing the private key, no one can withdraw your BTC, that's for sure.

First of all, I would argue it's a bad idea to use a third-party online service to generate and manage your keys. I went to check the blockcypher site, it seemed legit. Did you spend your coins? If so, the money may be moved to a new address because the change address is different. They've said in the docs,

  BlockCypher will set the change address to the first transaction input/address listed in the transaction. To redirect this default behavior, you can set an optional change_address field within the TX request object.


How do you run one daemon for multiple users?

bitcoin-cli attempts to read the credentials from $HOME/.bitcoin. Since user2 will have a different home directory, bitcoin-cli will not able to find the credentials.

You can either symlink .bitcoin from user1's home directory to user2's, or alias bitcoin-cli for user2 to use -datadir=user1home/.bitcoin.

You may need to play around with the read permissions in either case.


How to move bitcoins to own wallet from other wallet

For transferring bitcoin between wallets, you can import the private keys for the relevant addresses into the wallet in which you desire to have the bitcoin.

If you mean between addresses, then you will have create and broadcast a transaction with an appropriate fee.


Is the difficulty in mining a function of how much total mining power there are in the ecosystem?

Difficulty is a function of the number of blocks and the time it took to produce them. In Bitcoin, the difficulty is calculated every 2016 blocks. At each recalculation, it calculates how long it took to mine the 2016 blocks using the block timestamps and then compares that to how long it should have taken to mine 2016 blocks (the target is 2016 blocks in 2 weeks). Then using simple proportions, it scales the difficulty accordingly.

Because the difficulty is based on the time it took to mine blocks, the difficulty is directly related to the amount of hash rate there is in the entire system. More hash rate means that blocks will be found more quickly, so the difficulty will increase. Less hash rate means blocks will be found more slowly, so the difficulty decreases.


How to fix kernel paging request error on raspberry pi miner?

Ok, I found the solution here and here:

You have to enable SLUB debugging for your linux kernel. Therefore you have to edit your linux kernel command line:

sudo nano /boot/cmdline.txt

Add the following code at the end of the first line (on the same line as the other text, don't add new line!).

slub_debug=FP

Save the file then reboot your Raspberry Pi.

What the above does is basically enable some kernel debug mode on the Raspberry Pi. The mentioned kernel paging request error seems to be a kernel bug and gets caught by the debugging settings.

The downside is that the overall performance of the raspi is lower. But that does not affect the mining performance at all.


bcoin chainldb Resource Temporarily unavailable

You must be running testnet in another shell or some other script that has opened the chain database.

Whenever you open chain database it gets locked so only one process is in charge of it.

lsof -d txt | grep filename You could try this one to locate process holding FD for it.


Why does importmulti not support zpub and ypub?

The "xpub" format was defined by BIP32. It's a standard that specifies how to derive public keys from master public keys and seeds. Parts of it are widely adopted, some parts aren't. However, it does not say anything about how the keys it generate should be turned into addresses, only the keys themselves.

Now, at the time, there was only really one obvious way of turning a key into an addresses: by using its hash in a P2PKH (1...) address. This was implemented by numerous pieces of software, which more often than not treated "importing an xpub" as "importing an xpub and watching all P2PKH addresses for the resulting keys". This made sense, because it was how everyone wanted to use them anyway.

Then came along Segwit, which introduced two new common ways of paying to single-key outputs. Wallet software needed a way to "mark" an xpub as being intended to be used for P2WPKH (bc1...) or P2SH-P2WPKH (3...), instead of the traditional P2PKH. As the xpub standard had become interpreted as P2PKH only (rather than an address-agnostic way of describing public keys), something other than xpubs were needed. This is why some people adopted ypub/zpub for this purpose.

I believe this is confusing, as it is unclear now what an xpub means, and it is not scalable: we can't keep inventing new xpub-like formats for all types of addresses that may be invented. Especially with the introduction of multisig and more complex constructions, which simply don't fit into a single xpub-like thing (because you'll need to combine multiple of them).

For this reason, Bitcoin Core is using (and further developing) an approach called Output Descriptors. These are strings that specify exactly and unambiguously what scripts/addresses are desired, based on the involved public keys. These expressions support xpubs, but only in the original address-neutral meaning - the rest is conveyed using functions on top of them. For example:

pkh(xpub.../44'/0'/0'/0/*) would describe the BIP44 addresses derived from a particular xpub (P2PKH).
sh(wpkh(xpub.../49'/0'/0/*)) would describe the BIP49 addresses derived from a particular xpub (P2SH-P2WPKH).
wsh(multi(2,xpub1.../*,xpub2.../*,xpub3.../*)) represents a 2-of-3 P2WSH-embedded multisig.

There are many more features in descriptors, and there is ongoing development.

Disclaimer: I'm the author of BIP32.


How many addresses can be in input and output of a transaction

Every transaction output locks funds to one specific output script. These scripts can have various spending conditions such as for example requiring a signature of one specific private key (P2KH, P2KH, P2TR key path spend) or fulfillment of an arbitrary script defined by the recipient (P2SH, P2WSH, P2TR script path spend).
A common script used in the latter category is 2-of-3 multisig, but it would be incorrect to describe this as "2 addresses being funded in one output". Either way, that would be not the limit.
So, tbh, I'm a bit confused when you describe that one output can fund two addresses.
If I was misconstruing that and you're asking how many inputs and outputs a transaction can have, the answer is that standard transactions must have at least one input and one output, and otherwise are limited to 400,000 weight units. So, a transaction could have thousands of inputs or outputs.


Why should retailers prefer bitcoin over other cryptocurrencies that have shorter confirmation time?

Bitcoin is the incumbent in the space with a strong lead. It is not feasible to create faster blocks than about 60 seconds (as short block intervals create a host of other problems). 60 seconds however, is still way too long to wait at a cash register for a payment to confirm, and would be incompatible with current checkout processes.

This means:

Confirmation times cannot be short enough in another crypto currency to make waiting for confirmations feasible.
There are payment processors in Bitcoin that assume the risk of accepting zero confirmation transactions, while this is much less common in other cryptocurrencies. The risk is somewhat calculable, by assessing priority and other features of the transaction.
Retail payments is not where Bitcoin will break into mainstream, as it is the area where it has the least advantages.

So:
Right now, zero confirmation payments are possible through payment processors. Later, when "Bitcoin's popularity is high enough and people come up with services that try to do massive double spending", other services will be made use of to curb it. If and when this becomes a huge problem, e.g. multi-signature payments could be used more to change incentives.


How can I troubleshoot whether an unconfirmed transaction that seems stuck is a problem on my end or just from high volume on mempool?

How can I check whether I'm really in the queue being ignored because people are paying higher fees or if there's something wrong I'm doing on my end?

What was the fee rate used for the transaction?
https://mempool.observer
Example: I will have to use fee rate more than 100 sat/vbyte for a quick confirmation right now


Network of 3rd-parties to monitor for Lightning Network theft transactions

I've asked the Lightning developers on Slack and this was their response:

Please note that things might change in the future.


How might I reduce the percentage of rejected shares using an Avalon 741 with NiceHash?

If you live in the U.S. you need to connect to the US server.

stratum+tcp://sha256.usa.nicehash.com:3334

NOT

stratum+tcp://sha256.eu.nicehash.com:3334


It was the masternodes syncing.
Once I created a masternode and synced it, the getblocktemplate started returning normally.


3 transactions sent all with a high fee and all still pending

there is a huge backlog of unconfirmed transactions, the biggest there has been. people are paying huge fees and still having to wait, just wait it out, you don't have a choice


Q : What is difference between coinbase.com,blockchain.info and thousand other sites who give me a unique bitcoin address upon registration ?

These websites are competing web wallet providers. You can also use a mobile wallet or a desktop wallet. bitcoin.org has a list of good options.

  Also are those bitcoin address unique globally or per site ?

Each generates their own addresses, but you can send money to someone who uses a different wallet provider by sending it to one of their addresses.


Where to get difficulty data for all crypto coins?

I suggest you take a look at CoinWarz's API, you can collect your own set of data for a period of time out of it (say 10 latest days, format it your own way and save it on a spreadsheet). You'll need to generate an API key on their site, and then you could either use your own scripts, or visit the API endpoint manually to collect the data, if you so desire (remember that you need your own API KEY to get the data).

Once you have the data you could generate your own graph within a spreadsheet or your  software of preference.

Recomendations: OpenOffice (info on graphs, download page), LibreOffice (info on making graphs, download page).

Here's the reference for that specific API call (quoted from coinWarz's documentation)

  Mining Profitability API

  The Mining Profitability API provides profitability data listed on CoinWarz.com. This >data can be for all coins or for specific hashing algorithms: SHA-256, Scrypt, Scrypt-N, >X11, X13, Keccak, Quark, Groestl, JHA, Blake-256, NeoScrypt, Lyra2RE

  API Endpoint

  http://www.coinwarz.com/v1/api/profitability/?apikey=YOUR_API_KEY&algo=all

  API Call Usage
  This value will be deducted from your API usage limit each time you successfully call this API.

  Required Input Parameters
  All input parameters are required and not case sensitive.

  Parameter - Data Type - Description

  ApiKey - String - Provide your approved API key for this parameter.

  Algo - String    - Provide one of the the following values for this parameter:
  all, sha-256, scrypt, scrypt-n, x11, x13, keccak, quark, groestl, jha, blake-256, >neoscrypt, lyra2re

Remember that each time you either visit the API Endpoint or call it to fetch the info with a script, it'll count as 1 call out of your limit, as noted on their documentation.

Now the easiest way for you to collect the data if you're not into programming your own stuff, would be to use some REST client extension for your browser such as Postman REST client (If you use a different browser look into their respective stores)

It's fairly easy to get used to and you do not need to code your own scripts.

Here's an example of how the info would be rendered for to you:

(remember you need to place your own API key in lieu of the placeholder "YOUR_API_KEY")

I recommend you use the JSON and PRETTY options so the data is more human readable.

You can then export this to a CSV file using this awesome tool (JSON to CSV)

This site allows you to pase the JSON data and transfer each value pair to a CSV file

Here an example of how it looks:

Now you have a (set of, since you need multiple days) CSV file that you can use for graph creation using the aforementioned Office Suite Tools.

Hope you'll find this helpful, and good luck!


convert private key to bitcoin address using python or php

I think this video will explain it in details (python):
https://youtu.be/tX-XokHf_nI

Using the code from video, pip packages ecdsa , hashlib and base58:

import ecdsa
import hashlib
import base58

# WIF to private key by https://en.bitcoin.it/wiki/Wallet_import_format
Private_key = base58.b58decode_check("5JYJWrRd7sbqEzL9KR9dYTGrxyLqZEhPtnCtcvhC5t8ZvWgS9iC")
Private_key = Private_key[1:]

# Private key to public key (ecdsa transformation)
signing_key = ecdsa.SigningKey.from_string(Private_key, curve = ecdsa.SECP256k1)
verifying_key = signing_key.get_verifying_key()
public_key = bytes.fromhex("04") + verifying_key.to_string()

# hash sha 256 of pubkey
sha256_1 = hashlib.sha256(public_key)

# hash ripemd of sha of pubkey
ripemd160 = hashlib.new("ripemd160")
ripemd160.update(sha256_1.digest())

# checksum
hashed_public_key = bytes.fromhex("00") + ripemd160.digest()
checksum_full = hashlib.sha256(hashlib.sha256(hashed_public_key).digest()).digest()
checksum = checksum_full[:4]
bin_addr = hashed_public_key + checksum

# encode address to base58 and print
result_address = base58.b58encode(bin_addr)
print ("Bitcoin address {}".format(result_address))


Any idea why Bitcoin Core signature is untrusted?

When you import a key, you can mark it as trusted. Usually, you would do this after meeting the owner of a key and verifying that they actually control the key, e.g. at a CryptoParty. Since it is infeasible for each user to verify every other user in person, PGP/GPG leverages a "web-of-trust" to establish connections between keys. E.g. Alice has met Bob and trusts Bob's key. Bob has signed Carol's key, so Alice transitively trusts that Carol's key to some degree. There are some issues with the reliability and assumptions of this approach, but that's how it works.
Anyway, what GPG is telling you here is that the package you have downloaded was indeed signed by the key you checked against, but it warns you that you have not verified the authenticity of the signing key.


What is the wallet "word seed" that is commonly used in popular wallets clients and what does it do?

With HD wallets, a single key can be used to generate an entire tree of key pairs.  This single key serves as the "root" of the tree.  The word seed is simply a more human-readable way of expressing the key used as the root, as it can be algorithmically converted into the root private key.  Those words, in that order, will always generate the exact same key.

That single key is not replacing all other private keys, but rather is being used to generate them.  All your addresses still have different private keys...but they can all be restored by a single key.

Compare this to non-deterministic wallets.  In a non-deterministic wallet, each key is randomly generated on its own accord, and they are not seeded from a common key.  Therefore, any backups of the wallet must store each and every single private key used as an address...as well as a buffer of 100 or so future keys that may have already been given out as addresses but not recieved payments yet.

A hierarchical deterministic wallet doesn't need to back up so much data.  The private keys to every address it has ever given out can be recalculated given the root key.  That root key, in turn, can be recalculated by feeding in the word seed.

Relevant BIPS:

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki


What unusal behavior would alert school's system administrator from mining bitcoin?

I know it doesn't answer your question, but: don't do that.

Time to mine on regular computers, even with strong GPUs, is long gone. If you don't have powerful ASICs, forget mining at school computers.


In simplified terms...
Libraries work more like a calculator that simply process the data you feed it.
The JSON-RPC API can not only process the data you feed it, but also gives you access to the data you need.


Why does Bitcoin Core keep saying "X days left" every single day?

As Pieter pointed out, it sounds like your Bitcoin Core is not shutting down cleanly when you turn off your computer. This could happen for example if the shutdown process does not wait for Bitcoin Core to shut down cleanly before killing it, or if the computer is just powered off immediately.
Bitcoin Core caches progress to the chainstate¹. The chainstate is only written to disk on (clean) shutdown or after running for 24 hours. If Bitcoin Core is shut down forcefully before that, it falls back to the chainstate it had at startup, losing all synchronization progress since starting.
Since block data gets written to disk as received, it will not have to retrieve the blocks again. Bitcoin Core will recreate the chainstate from the blocks on disk on next startup, and continue synchronization from that point.
Whether this is a case of unclean shutdowns could be verified by inspecting the debug.log in your Bitcoin directory. If it is, you could manually close Bitcoin Core before shutting down your computer, or configure your computer to give programs more time to shut down to ensure that your synchronization progress is saved.

¹ A lot of the data that Bitcoin Core creates during synchronization is only written and read once before being discarding. While Bitcoin Core is running, caching this data and never writing the discarded data to disk translates to quicker validation.


Are there actually merchant services for "outgoing" processing?

I was the OP of that last question that you referenced.

Tracking the 'receives' is actually very easy. There are plenty of free APIs (e.g.  BlockExplorer, BitPay/Insight) that'll let you check the status of your inbound BTC transactions with a single API call. It's really a no-brainer.

Sends, on the other hand, are harder to deal with. As opposed to a receive, whose status can be polled with a couple lines of code, a send requires signing using private keys and for obvious reasons, you don't want to broadcast your private keys through a public API. This is what led me down the path of building my own transactions programmatically.

Since the time I wrote that code, quite a few APIs have been made available. BlockCypher, for example, can assist you in building a binary transaction without requiring you to expose your private keys. Building binary transactions isn't exactly straight-forward though, even with an API. Could a person use one of these APIs to build a transaction without having some knowledge of crypto and the native transaction format? Yeah, perhaps, but still not a particularly pleasant process.

Remember, if all you're trying to do is accept Bitcoins for an online store or as payment for services rendered, there's absolutely no need to mess around with any of that low-level stuff that I referenced in my question. Just use a third party service like BitPay. They'll handle all the grunt work including invoicing, transaction building for customer refunds, etc. When I pay for my servers, domains, certs, etc. with BTC I don't think I've ever seen a vendor roll their own Bitcoin billing interface. It always goes through BitPay or a similar service.

My needs and business model are so unusual and specific that a standard package like Bitpay wouldn't work for me. For most use cases though, standard merchant services are the way to go.


When mining with 2 computers, do I need to use 2 separate wallets addresses?

Regarding pools: when working for a pool, the computer who solves the block doesn't credit its owner directly - it rather credits the pool's bitcoin address. The pool manager then tallies how much work each of the pooled miners delivered for the block, and proceeds to pay them proportionally to it - minus the fee the pool takes, of course.

The only exception is a P2Pool, which work with no centralized pool manager. In these type of pools, each of the peers in the pool ensure they're appropriately credited for their work when a candidate block solution arises.

As far as I know, you can configure your 2 solo-mining computers to either use each their own address or one for both. And no: even if both were using their own addresses and working independently, the processing power of the slower one is not completely wasted. Solving a block is highly random, there's not much chance both would be trying the exact same nonces in sequence. Rather, they'd each try a different set of nonces to solve the block. Obviously, in the long run the faster one will find answers more frequently than the slower one.


Who recomputes and announces the difficulty in Bitcoin?

All nodes and all clients have this logic hardcoded into them. So in that sense, everybody is responsible for understanding that every 2016 blocks the difficulty changes.

The calculation that is hardcoded into each client is described here: https://en.bitcoin.it/wiki/Difficulty#What_is_the_formula_for_difficulty.3F

So it's not a piece of information that is announced or broadcast. Since each node knows about every block that appears in the network, it can calculate on its own the difficulty, without the need of a third-party.


Why are the BTC exchange rates different from website to website

Because MtGox is delaying USD withdrawals for several weeks so whoever wants to withdraw funds quickly has to do it buying Bitcoin and withdrawing in Bitcoin.
This creates a difference in prices.
The question is why people still keep depositing to MtGox? May be because MtGox still has the biggest trade volume in the world, or may be they are old deposits


Segwit has been locked in, but not activated yet. Approximate activation date is August 24th, 2017 around 00:36 UTC.

Edit: according to https://xbt.eu "Activation expected at ≈Tue, 22 Aug 2017 21:49:21 GMT"


You can certainly request it incrementally from bitcoind/Bitcoin-Qt using the getblock and getblockhash RPCs, but there is no file maintained with the actual full list.


Understand double spending through an example

First, a quick overview of what happens when you submit a transaction to the network:

Each node that hears about your transaction will check to see if it is valid according to their view of the network. If it is valid, the node may broadcast the transaction to its peers, and may add the transaction to its local mempool. If it is invalid, the transaction will be discarded (not broadcast further, not stored in the mempool).
At some point, a miner's node will hear about your transaction. If it is valid and the fee-rate is sufficient, then the miner will add it to the block template that they are mining on.
If the miner finds a block that includes your transaction, then we say the transaction is 'confirmed'. As this block propogates across the network, individual nodes will check to ensure it is valid, and then update their local copy of the blockchain (and their mempool) appropriately.

With that in mind, lets look at your questions:

  1) Will every mining node that read from the pool both these 2 transactions discard the second one ? So as to put in a block only the first transaction (the correct one)

No, because the mining node will have no way to determine which transaction was truly 'first'. Many nodes follow a 'first seen' policy to determine which transaction they will broadcast and store, but given the choice between the two transactions, a miner could include either one.

  2) Suppose that for some reasons a mining node A mines the first transaction in a block and propagate its blockchain to the network. At the same time a mining node B mines the second transaction in another block and propagates its blockchain to the network. This creates a fork in the blockchain. Will the other nodes of the network simply reject the B's blockchain because they know that transaction T1 is the correct one ?

This situation leads to what is referred to as a stale block (or sometimes, and orphan block). Nodes will store both blocks, and it will not be clear which block will be the 'winner' until a miner finds another block, that builds off one of the two blocks in question.

The other block will be discarded, and so if there are conflicting transactions (that spend the same input) in each block, it is only when one chain is extended that it will become clear which transaction will be included in the blockchain history.

Blockchain reorganizations like this are the reason for the often-cited '6 block confirmation' recommendation when receiving a transaction.

  3) To me it seems impossible that double spending can happen, every node will almost immediately read transactions T1 and T2 from the pool and discard T2, or discard a block if it contains T2. So i don't understand the need for waiting for 6 confirmations to be sure a transaction is correct.

A certain output can only be spent once in the blockchain record, this is guaranteed by the network's consensus rules. So a 'double-spend' usually involves some trickery to defraud a transaction's recipient, by convincing them to accept a transaction that will not ultimately end up in the blockchain record. For example:

Attacker sends txA to victim, while also creating txB that spends the same coins back to the attacker. Victim accepts the unconfirmed transaction, and releases payment/goods to the attacker. Later, txB is confirmed in a block, so the victim doesn't receive payment (txA is now invalid).
Attacker sends txA to an exchange, while mining a block with txB (spending coins back to attacker, as above). txA confirms in a block, so the exchange credits the attackers account balance, and the attacker quickly withdraws coins (receiving a new UTXO on chain). At the same time, the attacker hopes to mine more blocks than the rest of the network, so that they can publish their longer chain (that includes txB instead of txA), and thus have txA erased from the blockchain history. This would leave the exchange without their deposit, but the attacker would still receive the withdrawal (since it would likely come from an unrelated UTXO that the exchange owned).

Thus, the 6 confirmation recommendation (see the link above for more info). Also worth noting: the 6 block confirmation rule is important even in cases where someone is not actively trying to defraud you: stale blocks happen naturally, so by waiting for multiple confirmations you help ensure you don't accept a transaction that is included in a block that doesn't end up in the eventual longest chain.


How Can I import Multibit Private Key into Electrum or Blockchain.com

I am having trouble importing a multibit private key into electrum and blockchain.com.

The presence of '/' and '+' indicate that your key is encoded in Base64
It is likely that the wallets you mention need the key to be presented in Wallet Import Format (WIF)
For example, Importing your private keys into Electrum says

Electrum supports mini private keys and full sized keys in Wallet Import Format (WIF).

also How to import keys to Blockchain.info? says

You can enter WIF (Wallet Import/Export Format) or compressed private key.

I would decode the Base64 into Hexadecimal and then follow the procedure described for WIF.

Related question

Correct way to convert a 256-bit private key to WIF?

Ian Coleman's "Bitcoin Key Compression Tool" can be downloaded and run offline and might be useful. Obviously you need to be very careful choosing and using software that will be given your private key.

Is this the entire key? Or Do I extract segments from the key above? What segment?

I think that looks too long to be a 256-bit number. However, since I am not familiar with Multibit I wouldn't know what to expect and can't identify it. After running it through Base64 decoding, things might be clearer to you?


How long does it take to find a UTXO in UTXOs set?

It is impossible to answer this accurately without knowing details such as the hardware the miner is using, their utxo storage method, and their validation process.

However, in general, the utxo set can be stored as a list keyed by the utxo identifier (txid:vout). This provides O(1), or constant, look up complexity for a single utxo.

However, the utxo set may not fit entirely in memory on many systems, and the actual retrieval time may be longer than you'd expect in an ideal scenario after accounting for disk access time, and other implementation specific details.

In a miner's case, they validate incoming transactions and prepare a block template by feerate asynchronously from the actual mining operation - this allows them to have a reasonably good chance of maximising their earnings per block without having the mining process blocked by tx and block validation systems.


How do I restore a Multibit HD wallet from a backup using only a password?

MultiBit HD dev here.

The mbhd-*.zip.aes backup files are encrypted using an AES key derived from the wallet words. Hence you need your wallet words to do a restore from one of these.

The wallet that is opened normally in MultiBit HD is encrypted with your password. This is the *.wallet.aes file.

You can also restore just the transactions using only your wallet words.

You cannot do an 'Open wallet' specifying a location because the wallets are stored in specific directories created with no user input. We found in MultiBit Classic that users would lose wallets simply because they put them 'somewhere' and then forgot where they had stored it.


How do I open an Armory .wallet file in the MultiBit Client?

It is normal. Each Bitcoin client makes its own choices on how it stores its private keys and balance information. The main (Satoshi) client uses a BerkeleyDB database, BitcoinJ serializes its wallet object directly to file, and other clients do other things. While I'm not 100% certain how Armory or MultiBit store their wallets, chances are they've chosen different techniques which are not compatible. If you want to switch clients, I'd suggest generating a new wallet in your new client and using the old client to send all your coins there. If you have addresses that you'd like to keep from the old client, you'll need to find some way to export the private keys from the old and import them into the new via some standard they both support, like WIF (Wallet Import Format) private keys. Sadly, not every client will give you easy access to the private keys so it may not actually be possible - I'd refer to both clients' documentation for that answer.


How to sign a transaction using BitcoinJ

Good day. You shoud have list of unspent outputs, for adding them into inputs of your tx. Also you should generate private keys and use special privKey for every input you have.

Try it out:

TransactionOutPoint outPoint = new TransactionOutPoint(params, utxo.getIndex(), utxo.getHash());
byte[] privKeyBytes = HEX.decode(privKeyAsHex);
ECKey ecKey = ECKey.fromPrivate(privKeyBytes);

transaction.addSignedInput(outPoint, utxo.getScript(), ecKey, Transaction.SigHash.ALL, true);


SPV Bloom filter construction, are false positives taken from the blockchain or just due to matching with other addresses

Bloom filters are probabilistic, each attempted match you make with it has a specific chance of being a false positive. The rate of false positives is determined by the construction of the filter (how wide it is and how many elements have been added to it). A transaction either probably matches, or certainly doesn't match a given bloom filter.

BIP37 does not include Bitcoin addresses in the filter matching system, instead for every transaction in the block a given filter is matched with the TXID, every output script, every input script, and every data element in the input script. If any element matches the transaction is sent to the client, false positive or not is up to the client to decide.

  It is my understanding that the false positive addresses generated by an SPV bloom filter do not need to necessarily be on the blockchain (ie. be addresses that have been used already).

BIP37 SPV filtering will only ever return either transactions from a block (including the merkle tree path to the block header), or transactions from their memory pool which match the given filter. False positives aren't created out of nowhere, they just happen to be other transactions which fit a criteria given by the client.

The intent was originally that clients would tune the level of false positive transactions to obscure their real intention from the peer they are talking to, but in practice this appears to be completely ineffective.


How to get Bitcoin historical data from Bitcoin-Core?

It sounds like you are asking how to build a block explorer. Basically you would activate the full transaction index by adding txindex=1 to your bitcoin.conf. Parse all the history data and dump it into a database. Then keep track of all the new transaction data on your own database as blocks come in with blocknotify or real-time with ZMQ notifications.

https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md#usage

There's also options like bitpay's bitcore that pretty much does the work for you. It does require a lot more HD space though.


ElectrumX server as a Tor hidden service

I found the answer. It was not too hard. You should make a separate Tor hidden service for the ElectrumX server. The following two links helped me:

https://www.reddit.com/r/Electrum/comments/ggmduo/electrumx_over_tor_configuration_help/
https://en.bitcoin.it/wiki/Setting_up_a_Tor_hidden_service

To create a hidden service, you should take the following steps:

You must have tor (at least version 0.2.7.1) installed on your host. You don't need to install it on the docker container.
To establish a hidden service, open torcc file (probably you can find it at /etc/tor/torrc). Add these lines to the file:

HiddenServiceDir /var/lib/tor/electrumX_service/
HiddenServiceVersion 2
HiddenServicePort 50001 127.0.0.1:50001
HiddenServicePort 50002 127.0.0.1:50002

Restart tor by running this command: sudo service tor restart
To see the hostname of the new hidden service (electrumX_service), run sudo cat /var/lib/tor/electrumX_service/hostname. you will see the hostname. For example, my hostname is dpojvtzgm5dcg5ds.onion.
Now, you should set the REPORT_SERVICES environment variable in the ElectrumX container. To do this, you can set it at the beginning, when you want to run the container. I use the following command to run the container: (use the recently created hostname address for the REPORT_SERVICES environment variable.)

docker run --name=electrumx --rm --network=host -v /home/taghi/Taghi/docker-electrumx/electrumx:/data \
-e DAEMON_URL=http://MY_BITCOIN_CORE_USERNAME:MY_BITCOIN_CORE_PASSWORD@127.0.0.1:8332 \
-e COIN=BitcoinSegwit \
-e REPORT_SERVICES=tcp://dpojvtzgm5dcg5ds.onion:50001,ssl://dpojvtzgm5dcg5ds.onion:50002 \
lukechilds/electrumx

you can connect to the ElectrumX server by an Electrum client to check if it is working correctly. Furthermore, you can add it to this Server list .

Remember: I have exposed 50001, 50002, 50004, and 8000 ports in the above Dockerfile.


you have to make sure you are using AMD64 version of debian jesse


Can a bitcoin transaction hold an arbitrary string or strings for reference?

No such support exists in the bitcoin protocol. Use a different receiving address for every transaction to uniquely identify them, if you do this correctly then no external labels are necessary.


Is it possible to have proof of stake and proof of work transactions in the same block ?

Proof of Stake and Proof of Work are two strategies of arriving at consensus. I'm not aware that the transaction format would need to be impacted whatsoever by having one or the other in play.


How often do double spends happen successfully?

The wiki explains it better than I can:

But the short answer is that's the reason most participants wait for at least 6 confirmations before accepting a transaction as valid.  The likelihood of hash collisions or other potential attacks having any success going undetected drops with each confirmation, and 6 confirmations is usually chosen as an "overkill" number.

To answer your question from the post title, though, refer to this question's answers:

Has there ever been a successful double spend attack on the Bitcoin network? If not, is it really necessary to wait for confirmations?

If what they say is correct, it seems we really don't know if and when (or how often) any double-spends have actually been successful.


Lessons from the Mt. Gox Hack - 850,000 Bitcoins Stolen

Is there a consensus (or at least a plausible theory) as to what went wrong on the technical side that allowed such a large exchange to be hacked?

Independent Investigation related to Mt. Gox by Kim Nilsson: https://youtu.be/l70iRcSxqzo (Breaking Bitcoin Conference 2017)
Summary of the presentation:

There were multiple thefts since 2011

Mt. Gox was insolvent for most of it's existence

Traded it's own liabilities on Mt. Gox exchange

Connected to other bitcoin thefts

Alexander Vinnik arrested in 2017, received over half a million bitcoin from Mt. Gox and other bitcoin thefts, deposted bitcoin to BTC-e, TradeHill, Mt. Gox and alleged by US to be a BTC-e administrator

He didn't use any bitcoin mixers, did UTXO consolidation few times, deposited bitcoin back to Mt. Gox and Used his real name online to complain about his stolen funds being confiscated

All evidence pointing to Vinnik are for the wallets that receive and move the stolen bitcoin. The thief had possession of Mt Gox's private keys, could have sent bitcoin anywhere. Unlikely a single person carried out these many thefts.

Private keys were most likely stolen. Running a second bitcoin wallet on top of a copied wallet.dat file leaves blockchain fingerprint. 100 private keys are pre generated in Bitcoin Core wallet using keypool.

First 100 theft transactions have change addresses perfectly matching Mt Gox's keypool as of September 11, 2011

Some of those addresses were allocated as deposit address on Mt Gox

Thief steals bitcoin and Mt. Gox identifies change as deposit.

Things hacked in 2011: Hot wallet with upto 100,000 keys

Theft pattern: Each transaction steals similar amounts, longer and longer time between transactions and restarts with same stolen wallet.dat file.

Incidents: Liberty Reserve Withdrawal Exploit 2011 (XML injection), Liberty Reserve Withdrawal Exploit #2 2011 (negative amount used for withdrawal resulted in deposit), Hot wallet stolen in 2011 (80,000 BTC), Public hack via compromised accounts in June 2011 (2000 BTC), Compromised database in September 2011 (77,500 BTC), Hot wallet stolen again (Sep-Oct 2011) involving 630,000 BTC, Incorrectly detected deposits (30,000 BTC), Accidentally destroyed bitcoin due to bug in new bitcoin wallet(2609 BTC), Willy (28,000 BTC)

What practical lessons can one learn from this story in terms of securing their users funds?

Exchanges should hire competent developers to manage funds and use multisig which many already do right now

Use latest bitcoin technologies and follow best practices

Keep most of the funds in cold storage, some amount in hot wallets to manage deposit and withdrawals.

Do not trade with users funds and be transparent about everything

Users should avoid centralized KYC exchanges and use DEX or trust minimized exchanges like Bisq, HodlHodl, Localcryptos, Sovryn, OpenDEX, TDEX etc.

Developers should focus on better key management, trust minimized exchanges and layer 2

Developers should improve privacy in Bitcoin and Users should follow the best practices like : No KYC, No address reuse, Coinjoin, Payjoin, Full node, Do not share information about transactions on social media etc.


How to recover Bitcoin mistakenly sent to a bch address

bch and btc use the same type addresses. try importing the private key into the wallet


You can enable the txindex by either adding it to your bitcoin.conf file:

txindex=1

or

You can run bitcoind with the -txindex flag:

$ bitcoind -txindex

See:

$ bitcoind --help

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


Are there wallets that provide access to different HD wallets from the same masterseed using different passphrases?

Yes! You can absolutely do this.

Trezor has this exact ability, on top of that you can actually use the device with your phone in Mycelium.

https://shop.trezor.io/

The setting must be activated, last firmware did not have it activated by default. This may have changed though.


The primary limiting factor is memory. As N increases, memory starts to become the most expensive component, whether's it's in a GPU or an ASIC. For example, let's say the memory needed to achieve a certain level of parallelization costs $800. Now a GPU chip costs $400, while an ASIC chip costs $100. So the GPU costs $1,200 overall while the ASIC costs $900. This represents only 25% cost savings, making people hesitant to buy a device which is useful for only one task and thus may be worthless in a few years (if GPU mining becomes unprofitable, they could always offload the GPU at half price or more to gamers).

  To me, adaptive-N-factor is just like one of BTC difficulty things. No one is mining BTC with miners whose hashrate is MHs or 10GHs or below, although all BTC miners are using the same proof-of-work algorithm SHA.

Not true. Difficulty is a very simple parameter that does not affect the computations done; it merely is a threshold for determining which hashes are in and which are out. The N-factor actually affects the running of the Scrypt-N algorithm.


Sender address from DecodeRawTransaction (C#)

The quote below is taken from my answer to How to implement a game like SatoshiDice?  What you are looking for is addressed in this portion of my answer below.

  Get the customer amount and payment address

  Call bitcoind getrawtransaction [The incoming transaction ID] 1.  The 1 at the end will return the data in "verbose mode", which
  essentially the raw data in JSON format.
  From the raw transaction details, take the txid and vout from the vin object.  With this transaction, again call bitcoind
  getrawtransaction on the txid.
  From these raw transaction details find the vout object, referenced by the vout index from step #2.  Within this vout
  object, there should be a list of payment recipient addresses.  Take
  and store the first address.

It is worth mentioning that a received payment can be a summation of numerous, former transactions to multiple recipient addresses.  Getting an originators address isn't always straight-forward because the original payment could consist of multiple payments, from multiple sending addresses.

This is why that in my response to the SatoshiDice question I mention taking the first address from the second vout result.

You can safely assume that if someone sends you a payment originating from multiple accounts, they control all accounts. Ergo, picking the first in the list will give you correct address.


Is Bitcoin inherently dependent on electricity?

The network is distributed, so it won't go down everywhere at once.

Locally, on one hand it is similar to debit transactions - they need to get online to be processed. One can use cellphones though, which have their own batteries to run for awhile, so it's not too bad.

Lastly, one can accept transactions offline (using QR codes for example) and later transmit them through the network, but that carries the risk of double spending.

And if you want truly offline transactions with little risk, use things like Casascius physical Bitcoins.


How does Bitcoin verify each transaction?

1) Nodes need not to know its your message, nodes are ok as long as your message is in correct format and satisfying the conditions.

2) When you broadcast transaction, your wallet will provide previous unspent transaction reference in the input section. Nodes will verify if those are really unspent and if the amount in output section is less than the total amount in the referenced input transactions.


Where in the source code are transaction validation checks implemented?

Your general understanding is correct.

Mining doesn't perform any additional checks then any other full node.  Mining serves the function of giving transactions an ordering which is difficult to undo, but validation is just a function performed by every node.

Some tests are in miner.cpp because creating a block that matches some set of rules needs different code than checking if a block matches those rules. For example, some space needs to be set aside for the coinbase transaction (which is produced externally in normal use).


The length in a TLV uses the same variable integer representation used in Bitcoin (CompactSize). It effectively supports up to 64bit lengths, so there is no meaningful limitation there.

The limitation comes down to LN's message size limit, which is 64kb, as defined in BOLT#8. Any TLV will need to discount bytes already used in the message from this upper limit. Additionally, any TLV used in the onion layer will be limited by the maximum 1300 byte onion payload size, and bytes available to use for TLV fields will vary depending on the number of hops involved in the route.

Hard to say when it will be available. At this stage, the BOLTs are still a work in progress specification, and the plans for the 1.1 version could change.


How is the proof of work actually proved in the mining pool?

When a pool issues work to a miner, it is typically for a lower difficulty than the network difficulty. This allows the miner to solve a block header for the lower difficulty and submit it to the pool. These submitted headers are known as shares.
Even though most shares will not be valid for the network, having miners submit shares allows the pool to track how the individual miners are performing. Pools will pay their miners proportionally to the number of shares submitted, with some caveats (usually it isn't exactly proportional, there are various caps and other things calculations done, but in the end, the proportion of shares submitted is the major factor in the payout calculation).


How to make bitcoind connect to more nodes?

Bitcoind will never make more than 8 outgoing connections. By default, it will allow up to 128 connections (see -maxconnections), but that includes incoming ones.

Available connection slots of fully synchronized nodes are a limited resource on the network, so they shouldn't be wasted. As long as you have enough connections to be sure that at least one is not trying to attack you, you should have enough.


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

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

How is the soft fork signaled?

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

How is the consensus change enforced?

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

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

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

What are the tasks of node operators and miners?

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


$40 of peercoin mined per day: possible?

It would take around 1.6 TH/s to mine that as BTC and then exchange it, or 2 TH/s to mine that much PPC (not counting minting the PPC that you're mining, which is supposed to work out to 1% per year).

Cointerra sells a 1.6 TH/s miner for $3,500. With this $17,500 investment (plus any computers, electricity, maintenance, time, etc. associated with that), yes, she is mining $200/day on average currently (but ever-decreasing as the difficulty goes up), subject to market volatility. If only one is part of a pool and the rest are solo mining, that means she's taking the chance that she might never get anything of value from those 4 servers. That is a pretty high stakes gamble, if you ask me.


Is simplified payment validation (SPV) decentralized?

If you assume you are not being attacked, in the sense that your internet connection is not being restricted in a way that it allows you to only connect to an attacker's nodes without you noticing (Sybil attack). And note that that's actually an assumption that doesn't always hold and you can't really prove you're NOT being attacked, so it is certainly a security concern.

If that assumption holds then you are really connecting to a random node of your chosing that is not run by a centralized organisation or even group of people. Centralized would imply that there is some center that is the authority to decide what is truth. That is not the case here, even using SPV. So yes, I'd say it's decentralized.

Note also that instead of connecting to just one random peer you can connect to multiple so you can doublecheck that one is not lying. Although depending on the situation it may be hard to judge which peer is lying and which is telling the truth, so you may end up having to trust "the majority".

Also, an upcoming update called Segregated Witness is going to make Fraud Proofs possible. That will allow a single honest node to simply prove a statement, so even if the majority is lying you can still know for sure.


What happens an order and offer are matched but there is a significant gap between them?

It depends on the exchange; they will have rules for how order matching is handled.

On at least one of the exchanges I have used, if there existed a buy order for 1 coin for $2000 and you added a sell order with a $1000 limit, then you would get $2000. If however, the buy order at $2000 was only for 0.6 coins then you would sell 0.6 coins at $2000 and the remainder of your sell order (0.4 coins) would be matched by the next highest buy order, eg $1950, provided that another buy order existed at or over $1000.

I would expect this behaviour to be more common amongst exchanges that what @chytrik described in his answer.


How many transactions per block on Ardor? Plans for scaling?

If I'm right, the current hard-coded limitations are:

100 tx/block for main chain (block spacing is 1 minute)
100 tx/block for every child chain.

The current maximum capacity (if there were 100 child chains) would then be 10000 tx/minute (or about 160-170 tx per second), because child chains' transactions are bundled into a main chain ChildChainBlock transaction. A more realistic value would be 5000 (with 50 child chains), so there is space for 50 ARDR transactions per minute.

I guess that's largely a anti-spam measure and can be lifted once it becomes necessary. But even the "realistic" 5000 tx/min would mean about ten times Bitcoin's capacity. It would need relatively powerful nodes, but once child chain pruning is implemented, it would become much faster to sync and "catch up".

Waiting for an official developers' answer though ;)


Can I use wallet balance in satoshis as input for transaction builder ( bitcoinjs-lib )?

No. Bitcoins are not kept in addresses, but Unspent Outputs ("UTXO"). You must specify TXIDs and outputs indices ("vout"). Specifying amount to make a transaction is not needed, but BitcoinJS may ask you for it to calculate the change output and the fee.


Why can't an intermediary Lightning node take (nearly) all fees?

Sure there might be some game theory involved but two things speak against it:

Bob does not know what the fee or the final payment amount  is. Of course he could make an educated guess. But maybe the final payment was 101.5 sats and Charlie was supposed to forward for 500msat. Charlie would now even have to add 500msat to fulfill her 101.5 amt to forward.
It is currently differently implemented. Nodes will just not forward if the amount they reicieve minus the amount they are supposed to forward is below their fees. So if Bob would mess with the onions later nodes would currently automatically fail with insufficient fee error message. This of course could be abused for denial of service attacks.


Bitcoin follows a Unspent Transaction Output (utxo) model.
Our modern banking systems follow an account model - you're assigned a bank account number (similar to an address), and send and receive money from it. Any incoming funds increase your total account balance, and any outgoing funds decrease it. The bank does not keep track of which funds came from which deposit. It's just a single balance.
Bitcoin is closer to cash - Any funds in your Bitcoin wallet are the result of a previous incoming transaction, exactly how any notes in your physical wallet are the result of previous real life transactions you've made (whether an ATM/bank withdrawal, or received as change at a store).
Bitcoin tracks the output of each individual transaction, just like real life notes. When you receive 1 BTC, you receive an output (note) of exactly 1 BTC. This must be spend in its entirety, and cannot be split. So if you'd like to send 0.4 BTC, you put in the entire 1 BTC into the transaction, and send 0.6 BTC to one of your own addresses in the outputs.
This works much the same way as buying a $5 item with a $20 note - you must put in the entire $20 note, and you will get $15 back. You can't simply tear the $20 note into four equal pieces and create 4 $5 notes.
Of course, unlike real cash, in Bitcoin there is no risk of the recipient simply taking your BTC and refusing to return the change - the change is sent back to an address owned by you as part of the transaction building process. The recipient of the rest of the funds has no control over it.
A cleaner way to think about it is using the coin (physical coins, not bitcoin) analogy mentioned by Abdussamad in the comments - You can treat each output in your wallet as a single, indivisible coin of a fixed value.
When you spend these coins, transactions act as a melting pot - you can add in multiple coins to create a pot with a value of the sum of all coins, and you can use the melted coins to mint new ones of the values you want - 1 coin for the payment you're making, and one coin for the change that you keep with you. This even accounts for transaction fees - every time you melt down some coins, the pot claims a small amount that sticks to it, resulting in a final output that is slightly lower than the input.


I have the account system working! Only I didn't really test it, so it isn't stable.
https://github.com/jwz104/bitcoin-accounts

It works with an user, address and transaction table.

There is running a cronjob that registers all received transactions. If the adddress is found in the address table, it will add the transaction with the user id of the address. If the address has no user_id the transaction will not be added because it is a return transaction(Change).

When a transaction is created the package will send the amount of bitcoins to the address, and the bitcoin that are left are send to a return address(Address without user_id) so the user won't pay to much.


Do electrum fully support Hierarchical Deterministic Wallets?

BIP32 support is planned for Electrum version 2.0. The code is already there, but disabled.

You can find some features that were first planned for 2.0, but were included in a 1.9.8 release as the servers were being updated to a new important version so it was needed to apply some changes already to the client to put all in place for 2.0 https://bitcointalk.org/index.php?topic=518133.0


What order does Bitcoin Core place the inputs it spends in?

The inputs are chosen by the function SelectCoins() in CreateTransaction() and then added one by one (without shuffling) to the transaction.

The order is defined by the coin selection (CWallet::SelectCoinsMinConf) which does a random shuffle of the potential useful inputs and a stochastic approximation.

Mind also that Bitcoin-Core's coin selection could be improved and there are several issues and improve proposals ([1], [2], [3])


Print all states of getting from a random 256 bit private key to a corresponding encoded BTC address

The bitcoin developper pages show the steps in all details for type 1 addresses.

For the type 1 addresses, there is a good link here to test results.

Then there is HD wallets, Segwit, and many other extensions...

Maybe it is good to start for type 1 addresses, and extend with your ideas of "under the hood crypto". I stick to Nate's comment though.


What's wrong with this getrawtransaction JSON-RPC call?

I think that should be "params" not "param"


ccminer JSON-RPC call failed: Method not found

Above question was also asked at Github

  Sorry, but Bitcoin solo mining is no longer supported, because they
  removed the getwork command. Trying to mine Bitcoin is useless anyway,
  the difficulty is too high.


Taking control of the dynamic bitcoind tx fee

First: remind settxfee is not a absolute fee per transaction. It's a fee per kilobyte.

Example:

Alice sends 1BTC to Bob
Alice has 11 times 0.1 BTC in her wallet (she received 11 times 0.1 BTC from different persons)
Alice transaction will require all 11 x 0.1BTC inputs to create the 1BTC-to-Bob-transaction
Therefore the transaction is bigger (in terms of bytesize) then if she would hold 1 x 1.1BTC in her wallet.

Bitcoin-Core will only accept transaction to it's mempool which contains the minimum fee.


If a court orders mining pools to seize funds, they will modify their software to do it, or be shut down' - can this happen?

To spend some BTC, the network’s nodes will require a valid cryptographic signature on the transaction that consumes the UTXO in question. Each UTXO is locked to some bitcoin address, and to create a signature that is valid for that address you’ll need knowledge of the private key used to derive/create that address.

So a miner is not in any sort of privileged position to spend coins that are not theirs, since they do not have knowledge of everyone else's private keys. No matter what a court mandates, the miner will be unable to legitimately spend coins they don't own. Any attempt to do so would be easily identified as cryptographically invalid.

A miner could start creating blocks which move arbitrary coins to addresses of the miner's choice, but these transactions and blocks would be rejected by the rest of the network of nodes, so it would be of no consequence to the network. The miner creating these fraudulent transactions would simply be ignored.

Each network node is an individual instance of the code, working to independently verify the state of the network. Even if every miner started to break the rules, the nodes would simply ignore them (and we’d expect some miner to eventually capitulate and start mining valid blocks again, since they will gain profit for doing so, and otherwise lose money by mining invalid and useless blocks).


Why does coinbase make 2 transfers instead of one

When you receive money, a UTXO (unspent transaction output) is generated and assigned to your address. When you want to spend money, you can only ever spend entire UTXOs. However, you may have received 1 BTC but you only bought goods worth 80 mBTC in an online shop, so you don't want to send your entire 1 BTC UTXO to the merchant.

Enter change. A transaction can have an arbitrary number of outputs. 2 outputs to different addresses are very common. In the scenario described above, you send 80 mBTC to the merchant and 920 mBTC back to you. The latter is called change.

Now, it is possible to send the change back to the address you sent the money from. This way, it's possible to only ever use one address to hold your money. However, people could learn that that you always send from that address and associate it with you. This means reduced privacy.

It's of course not as bad as with banks where it's cumbersome to open a new account, everyone who sends money to you or receives money from you knows your name, you even have to use your ID to get an account in the first place, and in most cases people can even steal money from you when they just know your bank information which everyone you ever exchanged money with using that account knows.

But if it's worth doing, it's worth overdoing, because people. companies, and governments are still trying to figure out who made which transaction. To make this harder, wallet software uses new addresses for each transaction. You cant still receive money again and again payed by different people to the same address and will be able to spend it but if you get an arbitrary number of addresses completely for free, why not take the opportunity to improve your privacy? Some wallets let you control where the change goes but there aren't many reasons to not use a new address each time.


I mistakely Deposit my BTC to my Yobit.net BCC Address, How can i Get it Back

Sorry man but you are not able to get your money back unless someone from Yobit sends it back. Try to get in touch with their support team.


In Electrum, how does one watch/poll a wallet for an incoming payments to a certain address via API?

I have worked with Electrum 3.3.8 daemon through JSONRPC interface.
A vary simple explanation how it woks in my case:

I send to Electrum "addrequest" command which contains also amount of BTC, memo, timeout.
Get the address of payment in answer from Electrum and display it for payer person.
Store address in database for further checking.
Periodically checks (by cronjob) statuses of addresses by
"listrequests" command.

If status is "Paid" and there are more than 1 confirmations, then payment accepted.


Use UTXOs before transaction is signed/broadcasted

It depends.

If your UTXO is a segwit UTXO, then yes. You will have everything that you need to know to calculate the txid before you signed the transaction.

If your UTXO is not a segwit UTXO, then no, you cannot know the txid until you sign the transaction. This is because with spending non-segwit UTXOs, the signature is part of data that is hashed to become the transaction id. So you cannot calculate the transaction id until you know what the signature is.

Signing and broadcasting a transaction is not a single step that happens simultaneously. You can sign a transaction before you broadcast it. So you can make your 100 transactions and sign them as you make them. Once all are made, you can then broadcast the transactions.

Furthermore, if you are sending 100 transactions with one output paying someone, and the other being change back to yourself, why don't just create one transaction with 100 outputs? This is far more efficient and will guarantee that all 100 receivers receive their money at exactly the same time. This will also save you on transaction fees.


Transaction validity clause: output must exist

After reviewing the structure of a transaction, I now understand what is meant by that statement.

The input is the UTXO, and the output is the output of that UTXO. So when it says the output must exist and cannot already be spent, it's saying the output of the UTXO must exist and not already be spent.


Error in checkout while using Bitcoin Payments by BitcoinWay with WooCommerce, "CurveCurveFp Object"

FYI: this site seems to be using the Bitcoin Payments for WooCommerce plugin. If I'm wrong, then please disregard this answer.

This plugin is not compatible with the current version of Electrum. Give this a try (these instructions are for Windows):

Start -> Run (or press the Windows key + r), then type in %appdata%\Electrum\wallets and press OK.
Take a backup of all of your wallet files in this folder. If you have any funds in your wallet(s) and skip this step, you may lose those funds, so be careful!
Close this folder, and open a new one: Start -> Run (or press the Windows key + r), then type in %appdata% and press OK.
Delete the Electrum folder.
Uninstall Electrum.
Download and install electrum-1.9.8-setup.exe from https://download.electrum.org/.
Follow the normal install instructions for the plugin.

After you've tested it and have gotten it working, it is safe (and recommended) to upgrade Electrum to the newest version. You only need the old version when you first create your wallet. After upgrading, you can open your wallet backups you made in step 3 to access any old funds (but you can't use these wallets with the plugin).


obtaining currency exchange rate values for different coins via apis

If you are not actually trading, you can pull the price from multiple exchanges and show an average, since there is no such thing as fixed price for the exchange, preev.com is a nice converter that shows average of 4 sources which you can modify from the settings menu, it should give you an idea.


What can I do when the blockchain synchronization is stuck at a specific block?

I had this happen to me once. It was apparently caused by an incompatible peer node.

Delete $HOME/.bitcoin/peers.dat
Restart bitcoind

Afterwards, new compatible peers will be found, and hopefully, you'll start processing blocks as expected again.


Did Satoshi Nakamoto (in his blogs or the whitepaper) forecast that mining pools would exist?

Nakamoto did discuss the idea when others brought up the notion of cooperative mining, but I don't know if he wrote about it before anyone else came up with the idea.
You can search an archive of Nakamoto's communications
https://satoshi.nakamotoinstitute.org/posts/bitcointalk/threads/250/?view=satoshi

ribuck's description is spot on.
Pool operators can modify their getwork to take one additional parameter, the address to send your share to.
The easy way for the pool operator would be to wait until the next block is found and divy it up proportionally as:
user's near-hits/total near-hits from everyone


can there be a normal wallet that is equivalent to a multisig wallet?

the multisig wallet is just a normal wallet which the private key was derived from others wallets

That's pretty much exactly what it is. A multisig address lists the public keys that are allowed to spend the coins, and how many members of the group must sign (for instance, you can require 2 of 3 signatures). As long as enough private keys are accessible, the funds can be moved.


What if the brain wallet is just a memorable private key itself?

A series of random words (not a sentence!) long enough to use as a secure key should be about 12 words long, which could be around 100 characters long (figuring they're fairly long, 7-8 average, with a space in between). This gives you 2^128 combinations that you might have to try to crack your password, which might take about 1 billion billion years.

A private key, in base 58 format, is 51 characters long. Your idea of using a 51-character sentence as a private key would probably give about 51 bits of entropy (English is around 0.6 to 1.3 bits per character), which could be cracked in about 12.5 seconds.


The cost of restarting a lightning channel

Question 1

  Is it true that opening the channel and closing the channel each costs $1, so that the total cost is $2?

Yes.  You will still need opening and closing transactions for the channel, and will have to pay the network fee for each transaction.

Question 2

  So, she has to open a channel to Bob, after 100 days close the channel, open a new channel, and after additional 100 days, close the second channel. Is it true that the total cost now is $4?

Maybe.  If you were talking about a single direction payment channel, the answer would be yes, but lightning channels are bi-directional.  A channel only has so much money in it to begin with.  In your situations, we are assuming that Alice is fronting all upfront money for the channel, but this doesn't have to be.  It could just as easily be both Alice and Bob who split the funds that are tied up in their channel.  Let's say they both put 100 mBTC into opening the channel.  Now the most that can ever travel in either direction is 100 mBTC, so if money only ever flows from Alice to Bob, then a new channel will have to be opened when Alice's upfront money is all sent.

What you have forgotten is that in the lightning network, Alice and Bob aren't just terminal nodes...they are also hubs.  Other transactions from other parties can be routed over their channel.  So let's say that during this time period, Dave wants to pay Charlie.  Dave has a channel with Bob, and Charlie has a channel with Alice.  Now our network looks like this:

Charlie <----> Alice <----> Bob <----> Dave

Because the payments from Dave to Charlie put money back on Alice's side of the channel, Alice could very well pay Bob the full 200 mBTC without having to close and re-open the channel.  This is effectively how the traditional banking system clears transactions using deferred net settlement.

It's also important to note that if the channel is getting lopsided, Alice and Bob can incentivize routing in one direction by lowering the fee they charge to use their channel.  As you can see, it is often even in their best interest to charge a negative fee rather than incur the costs of re-opening a channel.

Question 3:

  "Instead of closing and re-opening the channel, I'll send you 100 mBTC through the blockchain, and you will send me 100 mBTC through the lightning channel. So the restart will only cost us $1 and the total cost will be only $3". Can this trick be done securely, so that neither Alice nor Bob can cheat?

Hopefully, you could avoid this situation as illustrated above.  If not, it sounds like Alice and Bob will have to have either 1) trust in each other, or 2) have some other sort of smart contract in place (which would likely lead to even more transaction fees, not less).  I don't see this as a viable or cost effective solution.  It would be best to incentivize others to use the channel to restore funds on Alice's side of the channel.


how can i get back money from my electronic wallet

This definitely sounds like a scam.

I am new to bitcoin and someone (the account manager) call me to buy and i made it last week

Bitcoin does not have 'account managers'. There is a well-known scam though, where the scammer will message/contact you pretending to be an investor/manager/miner/etc, offering amazing returns on your investment in BTC. If someone is offering large guaranteed profits, it is almost certainly a scam.

They said they have to make it to a mirror transaction first and then need to debit my credit card again

Bitcoin does not work this way, and neither do credit cards. There is no such thing as a bitcoin 'mirror transaction'. The scammer simply wants you to send them more money. Do not send them more money.

just saw my electronic wallet with money

This is part of the scam. The bitcoin blockchain is a public record, anyone can view and verify the apparent balance of an address, but only the person with the private keys for that address actually owns those coins (ie, can spend them). "Watch-only wallets" let you track the balance of any address of your choosing. The scammer will often show their victim a "watch-only" wallet to trick the victim into thinking they own that bitcoin. They do not own that bitcoin. The scammer may not even own that bitcoin. It is a mirage.
Also, there are no fees related in obtaining private keys. That is another tactic used by the scammers (eg. "please pay us a fee so that we can activate the private key").

How can i cash those out from it and transfer back to my credit card account? please help.

Your money is likely gone. You can report the crime to the relevant authorities if you so desire.

In fact, i dont know how to operation my electronic wallet.

Bitcoin is a really interesting and revolutionary thing, but you should take some time to learn about it before you start investing in it. This question is a good place to start: I am new to Bitcoin, how can I get started?


How does one manage the shifts of Channel Balances in the Lightning Network

It's actually a non problem deliberately set up in this video as a strawman. Professionally produced FUD.

In practice you're very unlikely to have a direct channel with the specific store in the first place, since for privacy reasons you actually want to be separated from that store at least 3 hops. But in either case you'd simply route your payment in the other direction through a different route towards that store. That's the whole point of this thing being a network. Payments can flow in both directions and the network is full of cycles.


Is it possible to execute a double-spending attack in Ripple during a network split?

Ripple should be immune to this attack because a transaction is not considered validated until an overwhelming majority of validators (that you care about) have signed a receipt saying that they have processed it (by validating a ledger that includes it either in that ledger or in one of its prior ledgers). If the network had split, you could not receive receipts from an overwhelming majority of validators.

Ripple servers have an internal "gate". They continue to track the network, try to reach a consensus, sign validations, and so on. But they don't report transactions as confirmed to clients until they pass this internal gate. To pass the gate, a ledger must have sufficient validations from trusted sources. Once a ledger meets that threshold, the gate is advanced to just past that ledger and everything up to that new point is considered fully validated.

Anything after the gate is in flux, subject to consensus with other validators. Everything behind the gate is forever committed. The overwhelming majority of validators have committed to it.

If you are on the minority side of a split (or even the slight majority side of a bad split), no transactions will pass the gate. The network will be unusable, but nobody will rely on a transaction that gets undone when a split is resolved.

In exchange for immunity to this attack and in exchange for Ripple's fast confirmations with no proof of work needed, a price is paid. One can imagine situations where transactions might fail to pass the gate even though there's no network split. For example, if a large number of validators suddenly stop validating all at the same time, you might think you're split off from them, and manual intervention might be needed to permit any transactions to pass the gate.


How is node capacity determined on 1ML.com?

Since 1ml is closed source I obviously cannot be 100% sure how it calculates the capacity of your node. But from my experience I can say that it does it in the same way as any other lightning node do it.

It takes the capacity of all payment channels which have been broadcast by the gossip protocol and have been received by the node in question and adds them up. This should be handled in the same way on your casa node. In particular 1ml has no chance of adding private channels (since they are private and not announced on the gossip protocol)

I believe the difference of the amount that you see comes from a different understanding of what capacity means. Let me elaborate:

The capacity of a payment channel is the amount of bitcoin that has been provided by the person who opened the channel (as long as dual funded channels are not implemented).
Your balance (or your funds) are the amount of bitcoin that you own in that particular channel.

So I believe what happened is that after your node was online for some time other nodes opened channels to your providing your node with more capacity (which is depicted on 1ml) but your funds / balance has stayed the same since those nodes only opened a channel but did not send money to you.
Therfor when you looked on the user interface of your casa node you saw a different amount because you most likely confused capacity with funds / balance.

In particular 1ml can only see the capacity of the channels and not the actual funds that you own as that data is private to you (and for each channel to your channel partner). Also I would highly doubt that you have earned more routing fees than a couple satoshis. The node of Alex Bosworth has some high routing fees configured and despite being online for a long time and very well connected the routing fees have not been high.


communicate programically Dash coin core wallet

You should add

rpcport=8666
rpcallowip=0.0.0.0/0

Working config file example:

rpcuser=username
rpcpassword=strong_pass
rpcallowip=0.0.0.0/0
listen=0
daemon=1
server=1
txindex=1
timestampindex=1
rpcthreads=4
rpcport=8666

and make sure the port is already open from your internet provider side and your system firewall.


Why don't miners charge more for high value transactions?

Miners don't charge anyone.

Users put aside some amount of satoshis to incentivize a miner to include a transaction in a block, as the miner takes those satoshis if they are successful in mining that block.

A miner has the incentive to maximize their own profitability by including the highest paying transactions into their block, and to squeeze as many in as possible to maximize that revenue.

The idea that miners might reject some large value transactions because they don't pay a higher fee is incompatible with their incentives, which are to compete with other miners for those transactions which pay the most per weight unit. If a miner decided not to include transactions with sufficient fee, some other miner would include them, and be more profitable than the miner who didn't. It only makes sense then that the miners will continue to operate as they currently do because attempting to adopt a strategy like you suggest would be harmful to them.

Ultimately, miners do not control anything. They merely attempt to profit from what the market is offering.


Can a testnet node have a separate bitcoin.conf file?

By default bitcoind will look for the file bitcoin.conf in its datadir directory, whether running on testnet or mainnet.  But you could use the -conf option when starting one or both of the daemons, to point it to a different file.


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

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

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

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

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