In a Lightning Network who commits to the blockchain the final transaction?

So let's imagine a Lightning Network made up of thousand of nodes. Transactions are routed until the moment comes where all the channels need to be closed and commited I presume. Which node actually takes care of this?

No, that is not how lightning works. All channels are not created and closed at the same time. They are created individually and closed individually. Each channel has its own 2-of-2 multisig, not the entire route. And channels are not established just for one route, that would be inefficient. Routing happens because there are channels that are already open between people and it is more efficient to route than it is to establish a new channel.

When a channel is closed, the two people in that channel will create the final commitment transaction for that channel and once that is broadcast and confirmed, the channel is closed.

  who will actually pay the fees to the BTC network?

With the current lightning protocol, the person who requested the creation of a channel will be the one who pays any transaction fees. Although if both parties mutually requested the creation of the channel, they can probably split the fees with a bit of manual transaction modification/creation.

  Whoever is listening and has the transactions in hand can build this huge transaction (as long as the timelocks are respected) and soon it will be mined.

No. Commitment transactions require the signatures of the parties involved in the channel.


Slow synchronisation bitcoin-qt - bread wallet

You need to import your bitcoin-qt private key(s) into breadwallet.


Proving two public keys are derived from the same seed, without revealing the xpub and the path?

This is possible with zero-knowledge proofs but not with the math used in BIP32 alone.
This is because Key0 and Key1 are not related to each other mathematically except that they were derived from the same parent key, using the same chain code (an extra 32 bytes of entropy described in BIP32). Therefore to prove they are derived from the same parent public key you must reveal that parent public key and the chain code -- and these are the two most important values contained in an xpub (there is some metadata as well).
Note that you do not have to reveal the MASTER public key of the seed, just the parent key which in your example is at path m/44'/0'/0'/0.
For details, read how child public keys are derived from their parent public key in BIP32.
(summarized):
let I = HASH512(<chain code> || <parent public key> || <index>).
let J = the first 256 bits of I
child public key = <J> * <G (generator point of curve)> + <parent public key>

So the only relationship between Key0 and Key1 is that they were both derived this way, where <index> = 0 and <index> = 1.
Vitalik Buterin wrote a great article for Bitcoin Magazine in 2013 about this problem. If you reveal an extended parent public key (which includes the chain code) and any (unhardened) child private key, the parent private key can be computed. This is because the data needed to derive a child private key from a parent private key is available to the attacker (in the parent xpub). So the attacker can just subtract that value from the child private key to compute the parent private key.
As a final note, don't forget that if you need to prove that you control two keys, you can just sign the same message with each key :-)


1) You should not derive a master private key from a "passphrase". You need a secure PRNG (/dev/urandom) to generate 32byte of entropy. This 32bytes (256 random bits) is your master seed which can be "turned" into your "extended master private key".

You can later encrypt the 32byte entropy with a AES256 key derived from the passphrase (use a proper KDF).

2) Public keys can be calculated form the private keys.

3) If you have a private key, you can always calculate the public key

4) You cannot calculate the private key out of a public key (discreet logarithm)

5) The same applies to "extended" private/public keys (bip32 keys starting with xpriv, xpub, etc.)

6) You can give someone your extended public key which would allow him/her to watch your balance, watch your transaction


Yes, in general node A will send the entire block with all transactions in entirety to other nodes for them to validate. The receiving nodes will receive an entire block with everything in the block header and every transaction in the order that is required by the merkle root and they will validate everything in that block.

There is a network optimization where node A would send the block header, the coinbase transaction, and the list of transaction ids of the transactions in the block. This saves network bandwidth. By using a list of transaction ids (and not the transactions entirely), node A assumes that the other nodes already have those transactions because they were in its mempool (i.e. those transactions were unconfirmed and broadcast to the network prior to a miner including them in a block). The receiving nodes would then pull those transactions out of its mempool and reconstruct the block. If they are missing any transactions, those are requested from node A.

The end result is that they have constructed a block that looks exactly the same as the one that node A has, i.e. it is the same block. They can then pass this reconstructed block through the exact same verification functions as they would have with any other block received in entirety.

This optimization is known as Compact Blocks.

Either way, when node A sends a block to another node, that node will end up with a block that has the block header and all of the transactions contained within the block. Node A always sends the list of transactions included in that block.


Is it possible to discover the set of bitcoin addresses from a public key?

Expanding shesek's comment as an answer:

The "SIN" key you're looking at, on a profile on bitrated.com, is a particular feature of that site.  These keys are not directly used for Bitcoin transactions at all, so you certainly can't discover addresses from them.

As for Bitcoin public keys, one public key generates one address; you cannot use a public key to compute other addresses belonging to that user.  (Though you might find other addresses that participate in transactions with the first one, and guess that they belong to the same person; but that's not proof.)

If someone is using an HD wallet, there is a concept of a master public key, from which one can determine the public keys for many different addresses that the user might be using.  People usually don't share those if they value their transaction privacy.


Open source data for bitcoin Blockchain analysis

I am not sure if this will help but there does seem a set of transactions tagged as silkroad seized bitcoins on the blockchain explorer. Silkroad was notorious for a while as an underground marketplace for drugs and other illegal activities:
Silkroad seized bitcoins


Would it be possible for miners to discriminate Lightning Network transactions?

The most distinguishing feature of a LN channel-opening transaction would be an OP_OR in the scriptPubKey of the channel-funding UTXO, where one side of the OP_OR requires two signatures, and the other side a single signature with an OP_CHECKLOCKTIMEVERIFY.

A closing transaction can be recognized simply based on the fact that it spends a channel-funding UTXO.  If miners were attempting to detect lightning channels, they would need to detect funding transactions.  Once detected, they could either choose to block the funding transaction, itself, or transactions that attempt to spend the funding transactions and close the channel.

Remember, however, that lightning channels will not be the only smart contract that will use UTXOs like described above.  Miners would have to boycott all kinds of smart contracts in order to keep lightning channels off the blockchain.  Also, P2SH would be used, so that miners would not know what the scriptPubKey contains until after the closing transaction is published.  This means they would lose the ability to prevent opening a channel.  In addition, MAST could be used to hide the complexity of a smart contract, even after the contract is fully executed.  This would prevent miners from being able to stop a channel from closing as well.

On the whole, lightning channels would be difficult for miners to discriminate against.


Eliminating all private keys records from pc

What you describe has some risks:

The new PC and router likely won't have the latest software updates, which could increase the chance of it being compromised immediately
The bitaddress.org website may have been compromised, in which case it may generate pre-determined addresses that are monitored for stealing coins deposited to them. This is a real and significant risk that you should take steps to avoid.

I suggest that you look at a process like this:

Download a copy of the bitaddress.org page and store it on USB.
Open it from a cleanly booted offline PC, perhaps from a live linux CD, or even better, from a permanently offline PC.
Verify the bitaddress.org code (I'm not going to cover this here; it would make a good separate question perhaps)
Generate your private keys


I have a old version of Bitcoin QT on Apple

I don't have the wallet.dat files as I never generated that back on my old computer

It's not clear to me what you mean by this. There is only one wallet.dat file (plus any backups for safety). It starts empty when Bitcoin QT (currently Bitcoin Core) first runs, and after that the wallet.dat file accumulates your Bitcoin transactions which determine its bitcoin balance. The transactions are stored in the blockchain, which Bitcoin QT initially downloads from peers on the internet and then subsequently updates whenever it is running.

It seems that you cannot boot from the old drive. Can you access it at all to see and possibly recover files from it?


I've never heard of a site that has done an in depth review of the security of these devices. The common point of difference on the hardware security is this: 'The TREZOR is essentially a small computer while the Ledger Nano S uses two secure elements/chips."
Otherwise, a lot is the same for other hardware security such as no WiFi or Bluetooth.


what countries accept and refuse BTC as money?

I think the most up-to-date list is from Wikipedia. If you want more countries and more recent news, I think you have to search for each country individually. For example, in the Netherlands it is declared by a judge as NOT money, but has the same status as gold and silver. This is the translated source from google.translate. If you are dutch and want to read it, this is the link to the original document.

The legal consequences differ from country to country, and I will not be surprised if it changes over time.


Technical analysis of Blockchain.info security breach

I have not seen a thorough technical review. However, after reading about the issue, my understanding is that the issue related to reusing the same k nonce value for ECDSA, not in generating private keys.

Blockchain.info's blog post about the issue is here.

Blockchain.info's GitHub commit that fixed the issue is here.

The individual who noticed its effect on transactions is a forum user by the name of "johoe" and you can see the discussion that unfolded beginning with this post.

It is a known requirement for ECDSA that for each signature with a particular private key, a unique k value must be used, otherwise with even just two signatures of the same k the private key used in the signature can be recovered. This issue is described in depth here.

Here is an open source project that discovers vulnerable private keys on the blockchain. This slide show discusses the issue, the open source project, and some investigation into which wallets are susceptible (Blockchain.info is among the unsafe ones listed).

The solution for this has been known for a while: use RFC 6979.


How exactly do new bitcoins come into existence?

However, how exactly does the system determine that bitcoins that were previously nonexistent should be awarded to whoever solved a block?

That was decided when the system was designed. Everyone knows it now because it's part of the public specification. The block reward schedule is well known and well understood.

It's no different from how we all know that a nickel is worth half as much as a dime -- if you want to use US coins, you have to know and understand that rule because everyone else follows it. Everyone who wants to use US currency has to learn the rules, otherwise others won't accept their payments.

  My understanding is, once all bitcoins have been mined, the only way to gain any profit from mining is through fees that were voluntarily added to a transaction. How does the system right now know that this is not the case for a given transaction (or a group thereof) and that it should instead create new coins "out of thin air" to reward the workers?

How do people know a nickel is worth less than a dollar? If you want to use a currency, you have to learn its rules. You must know the value of a nickel or you can't properly credit and debit payments that use nickels. You must know the relative value of dollars and pennies. And so on.

These are the rules of Bitcoins. If you want to use Bitcoins, you (or the software you use) must understand the block reward schedule, otherwise it won't be able to properly credit or debit payments.

There's nothing complicated or mysterious about it -- it's just the rules everyone else has agreed to, and thus the rules you must agree to if you want to exchange Bitcoins with other people.


What could this Python Assertion error mean?

This comes from the code where the checksum of your private key is validated, and suggests that the key is not valid.  However, the private key shown in your code seems to pass validation on bitaddress.org, so the Python library you're using might have a bug.

(By the way, please don't reveal the private keys to real addresses!  It looks like all the coins were moved out of that address (1LLZQ...) a couple hours ago, hopefully by you, but any further coins sent to that address are likely to be stolen immediately.)


It sounds like you are using the non-segwit sighash algorithm. This is not correct. Segwit uses a different sighash algorithm as defined in BIP 143.


I have no ready-usable python code, and doubt there is. But here is the transaltion and details, which I generated with a set of shell scripts. This explains, and should help you to get started. More details can be found by searching the web for "ECDSA signature" and "ASN1-DER structure".

    48: OP_DATA_0x48:        push hex 48 (decimal 72) bytes on stack
    30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
    45: OP_LENGTH_0x45:      length of R + S
    02: OP_INT_0x02:         type tag INTEGER indicating length
    21: OP_LENGTH_0x21:      this is SIG R (33 Bytes)
        008377DF63977C2B:3212F11FFBF098B3
        28B4F246A86D131F:AA75EFFE53CEF856
        8A
    02: OP_INT_0x02:         type tag INTEGER indicating length
    20: OP_LENGTH_0x20:      this is SIG S (32 Bytes)
        0C7187E5898F4DC6:05819BB6CDB7E357
        EC6993CE1AD11A87:A621A7A579FE6D92
    01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)
    41: OP_DATA_0x41:        length uncompressed Public Key (X9.63 form, 65 Bytes)
        04A2B3AEF09705DA:98696F357DFA7860
        5F6490F4115D55A8:E0A5ADA4152F77A5
        0E4FAA479B0ED241:BB8699E356644DBE
        8DE5058C2BBB739E:42F8928E95AD8D7A
        18


I have composed one of the more comprehensive comparison charts of the various Crypto 2.0 platforms over at http://tiny.cc/Crypto (or a more direct link).

It currently has pretty comprehensive comparison between Ripple, Ethereum, Mastercoin, NXT, Counterparty and BitShares, with information on other platforms also available although in smaller quantity.


Source: fork.lol (PNG by me)

mining\space profitability$$\frac{\mathrm{BCH}}{\mathrm{BTC}}=\frac{\frac{(\mathrm {BCH\, block reward + estimated\, total\, transaction\, fees \, in \, a \, BCH \, block})\cdot (\mathrm {BCH\, exchange\, rate\, (in\, USD)})}{\mathrm {BCH\, block\, difficulty}}}{\frac{(\mathrm {BTC\, block reward + estimated\, total\, transaction\, fees \, in \, a \, BTC \, block})\cdot (\mathrm {BTC\, exchange\, rate\, (in\, USD)})}{\mathrm {BTC\, block\, difficulty}}}$$


Google Wallet does not support bitcoin.

You could send him PayPal and then he could use https://xcoins.io to convert into Bitcoin.

Or you could purchase Bitcoin with Paypal from https://xcoins.io and then send the Bitcoin you purchased to his Bitcoin wallet address.

Another option if you're not in a rush is to use https://coinbase.com but buys are not instant for new users as far as I know.

The only reason I recommend xCoins is because you said PayPal and Bitcoin.. and xCoins is the quickest way to get Bitcoin.

NOTE: I work for xCoins as a engineer.


Can funds from a LN channel be recovered if both participants suffer data loss?

I don't know exactly how static channel backups are implemented in lnd and what is being saved there but I can give you some general thoughts and at least a partial answer.

If A and B both lost their channel state but still have their master key / mnemonic seed they can probably derive the key that was used in the 2-2 multisig wallet that is used to encode the payment channel.

Generally if two parties agree on how to spend the funding tx of that multisig wallet (e.g. 50/50 or in a different ratio as someone might have a screenshot of the channel state and both parties consent) they can do so.


How does one checks which customer made a payment?

Do you really care which customer paid, or do you care which bill was paid?

Say you have customers Anna and Bob, who both order something. Bob notices he's out of money, so Anna says she'll pay for both. If you really want the sender to reveal their identity, your system would already fail, as Bob never pays anything.

In almost all cases, all you care about is which bill is paid, and you have no need for the payer's identities (which could be a privacy violation in some cases).

The normal way to do this in practice is by creating a new payment address for each payment you want to receive. You track which bill was paid by tracking at which addresses you received money. Creating new addresses is very cheap, and they are sufficiently long that it is exceedingly unlikely that the same one will ever be produced twice.


Python code to generate private ECDSA key

Yes, it will generate a random ECDSA private key in hexadecimal ASCII form. You don't really need to specifically check whether the key is greater than the maximum -- pretty much every implementation that will take an ECDSA key in hexadecimal ASCII knows how to handle a key above the maximum sanely. (By subtracting the max value from the key and then using that.)


BitcoinJ has its own wallet format, and official bitcoin client its own.


What values should be initially assigned to Checkpoints for a new Genesis block?

You can generate several blocks and put (block_height, block_hash) pairs into the following field. Or just delete all of the checkingpoints : )

static Checkpoints::MapCheckpoints mapCheckpoints =
        boost::assign::map_list_of
        ( BLOCK_HEIGHT, uint256S("0xBLOCK_HASH"));

static const Checkpoints::CCheckpointData data = {
        &mapCheckpoints,
       bitcoin-cli getblock [last checkpoint block], then get the unix time, // * UNIX timestamp of last checkpoint block
        Write a script to count?,   // * total number of transactions between genesis and last checkpoint
                    //   (the tx=... number in the SetBestChain debug.log lines)
        estimate_a_number     // * estimated number of transactions per day after checkpoint
    };


If price increases over a time period, what is the best explanation(s) if hash rate goes down?

The price was pretty stable and very low for most of those three months, it only picked up significantly in the last few weeks.

As the price had been low and in a long-term down-trend, the profit margin would be extraordinarily slim, making the market even more competitive. This should have limited additional investments by current players, and curbed interest of new players to enter the mining market. It appears that any technological advancements have only driven out less efficient rigs and improved profit margins slightly.

As the acquisition cost of mining rigs represents a significant portion of the total operation cost, I would assume that short swings would only cause less efficient hardware to be turned back on for the time being, but a major wave of new acquisitions would need a pronounced long-term up-trend. Even if the current swing is perceived as such, order, delivery, and taking into operation will lag behind the trend some weeks to months.


Stratum mining, jobID and stale/rejected shares

This depends on the Stratum implementation. There are many. The Stratum protocol does not require implementations to accept or reject the second proof of work you send in with this scenario.

Most likely the pool will quickly send you new work data after you send in the block solution. After that it will receive your second proof of work and it will be rejected as stale.

There will always be some stale work as new blocks are found.

Clients should submit their data as quickly as possible. Pools should distribute new work data as quickly as possible when new blocks appear, to reduce the amount of wasted work. Pools should also distribute blocks to other pools as quickly as possible, to reduce the amount of orphaned blocks.


2nd 'air-gapped' computer / cold wallet setup for travel

This seems a lot like an XY problem. For the vast majority of users, the threat model simply does not require more guarantees than those provided by a solution such as Ledger.

Naturally, if you are dealing with very large amounts, you would be wise to take better steps to secure it. But something like a Ledger, which will parse the tx being signed and display the outputs on the Ledger itself prior to signing, should cover most use cases.

Additionally, as Chytrik mentioned, you have wallets such as the Cold Card which can operate without being directly connected to a computer at all, transferring Partially Signed Bitcoin Transactions via an SD Card.

Beyond that, if you really do need the security benefits offered by a fully offline computer, you should consider buying a cheap netbook or laptop, epoxy the ports, strip out any networking hardware, and verifying it as far as you can to be in a secure state - If you are genuinely moving amounts while travelling that merit that kind of security, then your best bet is to carry the extra 800 gram to 1 kilogram of weight.


Allowing bitcoind startup script to access daemon commands

Add $1 to the end of the command in your script. This is more a general scripting question. Doesn't have much to do with bitcoin.

~/bitcoin1/bitcoind -conf=~/bitcoin1/.bitcoin/bitcoin.conf $1


Digital currencies pegged to dollar value

NuBits is really interesting in how it pegs to the USD, which they explain in the white paper. I'm guessing you don't want to go hunting through there (white papers can be ... daunting), so the short version is....

If the demand for NuBits goes up (ie, lots of people want to buy Nubits, so the price for a NuBit should rise above $1 USD), the custodians of NuShares ("Shareholders") will vote to issue newly minted NuBits to satisfy the demand and therefore drive the price back down to $1 USD.
If the demand for NuBits goes down (ie, nobody wants NuBits, so the price for a NuBit should drop below $1 USD), holders of NuBits are able to "park" their NuBits (aka, keep them off the market) in exchange for dividends paid in PeerCoin, which reduces the supply and drives the price back up to $1 USD.

There's actually lot more going on here than these two things, but these seem to be the main ones. More importantly, they seem to be working as NBT has been transacting around $10,000 USD daily (as of today) and I've only seen the price fluctuate +/- $0.01 USD over the past few months.

If you want the whole story (which includes lots of other mechanisms to stabilize the peg to the USD), take a look at the price stability page on the NuBits website.

The practical conclusion here is: if you ever see NBT selling for more than $1 USD, don't buy it, because the price will be back to $1 USD soon, so you're wasting your money.


Set up a Bitcoin full node: static or dynamic IP address?

How frequently a full node with static IP get DDoSed?

It depends on who owns the full node, and whether the owner of a full node is known. A full node by itself is unlikely to be DDoS'd since there is little point in attacking any random node. However, if the node is owned by, say, an exchange and it is known that the node is owned by the exchange, it might be DDoS'd as attacking that node may result in some gain for the attacker. But in general, full nodes don't get DDoS'd because there's no point.

  Is there any strong reason for favoring static IP address over dynamic IP address?

Connections that peers make to you are based upon the IP address. They remember the IP addresses of other nodes and try to reconnect to them later if they go offline. With a static IP address, it is more likely that your node will get connections because it will have been at the same IP address for a while and nodes have remembered it. Static IP has no effect on your outbound connections (which, to your node, are the most important, not the inbound ones).


What temperature should a USB ASIC Miner have while running?

If this graphic is true, the miner's PCB should run at around 125°F (51°C)

However, If reviews are to be believed, you shouldn't run it at all.


Is there a way to determine the difference between a BTC prefix 3 address and a LTC prefix 3 address?

No, there is not. There isn't anything network specific about an address. Such addresses can be used on both Bitcoin and Litecoin. You could also spend both the Bitcoin and Litecoin associated with that address so long as you have the private key. Because Bitcoin and Litecoin use the same Elliptic Curve and the same scripting system, all you would need to do is to export the private key from one wallet and import it into the other.


''Which one is a more desirable feature in an altcoin?'' that's not an easy question and the answer depends on the philosophy you impart in your coin. X11 is in essence a PoW with 11 hash functions (blake, bmw, groestl, jh, keccak, skein, luffa, cubehash, shavite, simd, echo) if one of them gets cracked there's still 10 more to deal with. It does allow for reduced energy draw and heat output from GPU but that's pretty much all I could say about it's cons. The downside of X11 algorithm is in that it's not as long-term as some expect it to be. The experts claim that it will take a maximum of two years before this algorithm gets ASIC’d. Even though it’s complex, X11 is one of the mining algorithms which isn't relying on hardware memory hence it's much more simple to implement on ASICs. In my opinion all PoW algorithms need to use memory bound functions so if you are thinking long term I'd suggest you go with CryptoNight.

CryptoNight relies on random access to the slow memory. And a megabyte of internal memory is almost unacceptable for the modern ASICs. So far quite a few coins have been using this algorithm, all of them are CryptoNote-based. Bytecoin (BCN) is probably the most prominent one since it was the first coin to have built its architecture around the CryptoNote protocol. Bytecoin has been around since 2012 but from what I've heard the development started as early as 2009. It is a CPU-minable coin with anonymous transactions feature and immunity to ASICs. You could try mining Bytecoin with a GPU but the coefficient of performance would be comparable to CPU-mining. Bytecoin is doing pretty well and there are other coins with CryptoNight algorithm; Fantomcoin, Quazarcoin or Monero.

Theoretically you could implement X11 and CryptoNight together in a cryptocoin but two years later you'll inevitably face the ASIC problem for your X11 PoW. So I don't really see any practical use of such a combination.


why not make DIY, upgradeable, ASIC mining rigs?

So, why not just sell the parts for making ASIC rigs, and let mining enthusiasts build their own?

ASICs are highly specialized hardware, advancements in ASIC technology involve new hardware architecture (eg smaller, faster transistors), so a modular design would not allow a DIY-er to just add a new part on to keep up with the current tech. I think it would also be incredibly difficult to create a miner that is modular without losing efficiency when compared to a non-modular ASIC.

GPU cards are like a ‘general purpose’ miner, so if one coin is no longer profitable to mine, there may be another coin with a different algorithm that a miner can switch to. With ASIC chips, there is just one algorithm that the chip is optimized to run. For example, you could not use a bitcoin ASIC to mine ethereum, even if the ASIC was a modular design. You would need to swap out the chipboard itself to achieve this goal, and the chipboard is the most expensive part of the device.

From a manufacturer’s standpoint, if the majority of the unit cost comes from the chip itself, then the most straightforward business plan is to just sell the complete unit. Having a modular product means a lot of extra logistical considerations, which means increased prices for the end customer.


LOCK(cs_main) causes the thread to stop execution until a lock can be obtained on cs_main. cs_main is an object representing a type/class/scope of lock. Once the lock is obtained, it lasts until the end of the LOCK statement's scope. (The LOCK macro creates an object on the stack, the destruction of which releases the lock.)

cs_main is already locked in that place, and LOCK uses recursive locks, so your LOCK doesn't do anything.


When I use the "send_many()" function in the blockchain.info api, have I to pay the fee only once or for each?

You will pay the fee once, since it is one transaction with multiple outputs (thus only 5000).

However, also read this


Easiest way to control a remote bitcoind instance?

Assuming you're using a Linux-based system, Xpra is a great tool for running GUI apps headless and attaching to them on a remote system. Make sure you install a recent version from one of the Winswitch repositories.

I haven't tried the Winswitch front-end since command line usage is so simple. Just do this on your server:

xpra start :7
DISPLAY=:7 bitcoin-qt

And this on the client:

xpra attach ssh:my.server.ip:7


Buying a Gridseed Mini ASIC Miner -Beginner

No. It's old, slow and obsolete. Buy modern mining hardware instead.


Is there a platform where I can use Bitcoins to gamble online?

There are several. One of the first and most established is Satoshi Dice.

As far as I read you need not verify your identity but I haven't used it myself.


HD Wallets - Why Extend a Private Key with addition? (Non Hardened)

My question is, why is reversible arithmetic (addition of the parent private key and output from the hashing function) used instead of a “one way” function such as elliptic curve addition or others?

To allow public derivation.

This means that it is possible to give someone a parent extended key (public key + chain code), and they can derive all public keys in the chain.

If the final secret key is computed by a one-way function directly, no equivalent operations exists with public keys to compute the public version of the result.


How do you find historic VWAP at a given time in a specific exchange?

VWAP isn't calculated at a specific point in time, it is calculated over a period of time (commonly 24 hours or 30 days). A "24-hour VWAP at 1/1/2013 00:00:00" is actually the VWAP over the period from 12/31/2013 00:00:00 to 1/1/2013 00:00:00.

To calculate it, you'd want to use the exchange's API to get a list of the trades that were executed on the exchange during this period, where for each trade you have the execution price and the amount of BTC traded.

You then find the average of the price, weighted by volume; that it, you multiply each price with the corresponding amount, sum all these values, and divide it by the sum of all amounts traded.

Other sources can provide you with the needed data using their API, such as http://bitcoincharts.com/.

Bitcoincharts also offers this information via its web interface. For Bitstamp data, for example, go to http://bitcoincharts.com/charts/bitstampUSD, and click on "Load raw data" below the graph. You will get a table with each interval (day by default) and its "Weighted Price" in the last column. If the default chart does not contain the date you are interest in, you can change the date range with the "Time Period" control at the top.


Buy an ASIC. In this age, it's not profitable to mine using usual computers. These specialized computers are used for mining.


First bitcoin payment, sent X BTC, but transaction amount on blockchain.info shows as more than 2X?

The amount you sent (0.01047) plus transaction fee (0.00054597) totals 0.01101597. This is how much was spent from your wallet balance (0.09079308) leaving you with 0.07977711.

You wallet balance consists of multiple bitcoin addresses. What you are seeing on Block Explorer is that one of the addresses in your wallet containing 0.02272056 was used, from which the transaction amount 0.01101597 was deducted, leaving 0.01170459, which was transferred to a different address back into your wallet. 1Gntc8EwpUXEhc7yAJsD25Y9YEBYTn6TnQ is a change address for your wallet - that balance is still yours.

The main difference is that Electrum is showing you the total balance of your wallet, but Block Explorer is showing you only the balance of the individual bitcoin addresses from your wallet that were used to make the transaction, including the change going back into your wallet.


What is the proper way to handle reorgs when fetching headers

The getheaders message allows you to list multiple block hashes. So instead of just putting the current chain tip, you can insert multiple block hashes. Responding nodes will see if any of those hashes are in its main chain and start sending headers from there. Since reorgs tend to be small, you could put the most recent 10 block hashes and it should be enough to handle the reorg.
Note that the maximum number of hashes you can put in a getheaders message is 101.


Is it possible to restrict where coins from a given P2SH address can be sent to?

No, Bitcoin script has no view of the output of a transaction as a design decision. This sort of behavior is called a covenant, which is usually regarded to be a fairly poor idea.


What's the difference between the Bitcoin's peer to peer protocol and the RPC API?

The Peer to Peer protocol (using version, verack, getdata, ... etc. messages) is used by all clients communicating on the network. This protocol is how data is spread through the network. This is done directly over TCP/IP. Messages have their own format (not JSON) and allow the spread of transactions and blocks through the network. Read more at: https://bitcoin.org/en/developer-reference#protocol-versions.

After a Bitcoin Core full node has received the block and transaction data via this P2P protocol, then a user can use the RPC interface to query the node about the data it has received. The JSON-RPC interface used is specific to Bitcoin Core, although other clients may introduce similar interfaces for ease of use. Nodes do not typically communicate with each other using the RPC interface at all, the RPC calls are more like tools that Bitcoin Core provides for developers to give them access to the blockchain data.


XAPO's flow from wallet to vault - a different wallet address used for the transfer

Now when I have moved my bitcoin from my bitcoin wallet to vault and checked the transaction in the blockchain.info, I was kind of surprised that from address was different from original deposit address a1.
Also, looking into blockchain.info, I was surprised to find that my deposit address a1 was used to send bitcoin to other addresses as well which I have never initiated. So, it looks like XAPO has provided the same deposit address a1 to other users as well, which is not good.

Instead of thinking as the addresses being "my addresses", think of them as Xapo's or the exchange's addresses. You are not depositing into your wallet, you are depositing into Xapo's or the exchange's wallet and the addresses they give you belong to their wallet. When they receive your transaction, they just update an internal database for your account's address. The money that you deposited becomes the service's money and they promise to give you back the same amount when you ask for it. This is similar to how banks work

In that case, I have to be dependent on their internal ledger to claim my funds, no?

Yes. This is the same for basically all exchanges and all online wallet services (with a few exceptions). They are custodial, you give them money and they promise to give you back the same amount when you ask for it. In the meantime, they can do whatever they want with the coins. This model is generally easier to implement and less costly as the service can move around coins to reduce cost later.
Furthermore, instead of then having to keep everyone's coins in hot wallets (wallets that are connected to the internet), they can move most coins to cold wallets (wallets that are not connected to the internet) and keep some in hot wallets for people who wish to withdraw. Actually assigning and "spending from" addresses for each user results in perpetual hot wallets which is not secure.

Will the withdrawal process be same as well, meaning when I withdraw from Vault to wallet, the from address will be different from what I see now as my vault address, b1? And when I finally move my fund out from wallet to let's say Bittrex, that txn will also show a different from address?

Yes. The transaction will "send from" addresses that belong to other people as is convenient for the service.

In addition to that, if XAPO regularly moves the fund around, won't it cost them a lot of fees?

Xapo probably isn't actually move the coins around internally, but rather the coins that you deposited went into their hot wallet and someone requested a withdrawal so those same coins were sent to that person.


Can multiple small graphic card memory collect more mining hash rate

Currently you can not do that.
DAG should be loaded to card's memory to mine. Current miner software do not support this kind of cross-card memory management


cpuminer - what command line tools are required?

Compiled it on Linux. These are the dependencies once compiled :

$ readelf -d minerd

Dynamic section at offset 0x1c178 contains 22 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libcurl.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
...

That's only libcurl and glibc. Since glibc is just a standard C library, and Mac probably has its own equivalent, you can ignore that one. The only runtime requirement is libcurl.

Judging by the source code the minimum required version of libcurl is 7.10.1. You'll also need yasm for 64-bit SSE2 code generation. And of course a C compiler that can handle C99.


Running another instance of bitcoin-qt dedicated to testnet/regtest?

Depending on your OS you can start a 2nd bitcoin-qt acting on a non-mainnet with ./bitcoin-qt -testnet or ./bitcoin-qt -regtest (from a shell). You can also define a custom datadir and place a bitcoin.conf there (use bitcoin-qt -datadir=<path>).

On OSX/Mac you would need to use Terminal and run something like /Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -regtest


How can I brute force decrypt my blockchain wallet?

You can wrap a brute-force wrapper around any of the answers here. Just write some loops that iterate on all possible passwords, and call one of the functions in the linked question to try and decrypt you wallet.

This is what I used in a similar scenario (Javascript/node.js).


What Means the Final Option in Bump Fee / Increase Fee Electrum Wallet Option

Selecting final will disable RBF for the transaction and you will not be increase the fee anymore.
Example: I did a transaction 7d1a7ecd1a68443c07f89f38180d3f3dc945edb2784ebfb7f7c113842d7d8509 with fee rate 1 sat/vByte, increased the fee rate to 3 sat/vBbyte and replace the transaction with d47e59db69c91f3e653da9c5ed0e0f9fc8fdc4422a4e8650d4d6b66c1db60f18 and increased the fee rate again to 5 sat/vByte but selected final this time so RBF was disabled for this transaction 2a7241f60d301ccda31a7be875d58610637534fe477e8c76d0e67bc31ef5824f
Cannot increase the fee rate anymore using RBF because it was disabled. Either I can wait for it to get confirmed or use CPFP.


Will any of the proposed Scripts (OP_XXX) allow subscription/recurring type payments?

In order to send someone Bitcoins, you need to sign a transaction with your private key.
Each transaction on your set of coins refers to the previous transaction. It is possible to create a daisy chain of transactions like this, but if you'd perform any operation in between the start and the finish of such sets of payments, the remaining transactions would be invalidated.

This makes it impossible under current model of transactions to perform such an operation. You could define a new OP that would allow one to redeem coins only after a certain amount of time, but then you'd be paying the full amount up front anyway.

You could, however, create a client that would be scheduling payments. But there is a problem - it is generally advised to keep your private keys encrypted, so nobody could steal your coins. A client can't sign a transaction with an encrypted key, so you'd have to be prompted for passwords every time. On the other hand, one could imagine a single address in a wallet to be kept unencrypted for such transactions. In the end though, it is not a matter of creating a new OP in the protocol, but new functionality in a client.


Can a Finney Attack make SatoshiDice betting profitable?

The short answer is: yes, but it would not be profitable in the long-term.

A Finney Attack is not easy to pull off, because guessing when the rogue miner's block will be generated is imprecise and inaccurate. Guessing gets easier with the more hashing power the rogue miner puts on the network, but you probably won't see real profit unless you get a pool to participate in your attack.


Using ASIC for password cracking - mad concept?

It will not help even if passwords were hashed with DSHA256. This link explains why. https://rya.nc/asic-cracking.html

Basically the ASIC loads the header into its memory and increments the nonce until the hash of the header is lower than the the specified target.

Therefore you cannot use this to brute force a password seeing as the logic is incompatible.


Is it possible to create an address from a predefined private key?

You can choose the private key to be whatever you want, and calculate the corresponding public key and bitcoin address.
Adding to this answer, there is really no reason to want to do this. But if one really insisted, here is a way to do it with hal. First start with generating a random private key
$ hal key generate
{
  "raw_private_key": "7019c07716861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898",
  "wif_private_key": "KzycuDEqJaMyjHWJDD9cdyPeH1rtCTgE5m1EHfCdnTs4ng2D43Bt",
  "public_key": "02260106e42d7aef51b92c6c4aa2d0a5a6f3e0c6ad68ee9fadd8bd50d8cbe1a0b4",
  "uncompressed_public_key": "04260106e42d7aef51b92c6c4aa2d0a5a6f3e0c6ad68ee9fadd8bd50d8cbe1a0b4349d9106ee1724cf51c954e6aec9522febd7fcb46d7248a0ce390810fc0ac6a0",
  "addresses": {
    "p2pkh": "1J6wqBd7QVGt7vGCNfUShoDEwQg2LFTgRR",
    "p2wpkh": "bc1qhwvl6yyrtheep7rmsxmf536m45dzfz4wrxdacu",
    "p2shwpkh": "3QLdovvKokkyiyX3jTzgfaMCv9MiaoVW5C"
  }
}%

Then change the beginning of the raw private key to deadbeef or whatever you want
7019c07716861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898
->
deadbeef16861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898

Then get the address for it
$ hal key inspect deadbeef16861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898
{
  "raw_private_key": "deadbeef16861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898",
  "public_key": "02de9367c92d7a42953e1afdf74d509d3992ba78bfb93f448859a1557e2685ca60",
  "uncompressed_public_key": "04de9367c92d7a42953e1afdf74d509d3992ba78bfb93f448859a1557e2685ca60b142aa0a4f495e16f80f811ec4556e3d33be28c930fab6e6a051e9a5bdc91d52",
  "addresses": {
    "p2pkh": "1BhftRM4fNZRYdDYMUdujq9C84bRX84Qf8",
    "p2wpkh": "bc1qw439kmezxvdff0hnalmeqvfsnttd9gkjux5rct",
    "p2shwpkh": "34KVR36eoQrf48bmjQ46JU5dGVg1gqdUFg"
  }
}%


Get confused on the merkle tree algorithm

The Stratum server is delivering a partially hashed merkle branch in the response… for which the miner needs to provide, ‘A’ (the generation/coinbase transaction) concatenated with the ‘first’ transaction (B). The remaining elements of the array are ‘pre-computed’ portions of the merkle tree. As indicated on slush’s bitcoin.cz site (http://mining.bitcoin.cz/stratum-mining) “merkle_branch - List of hashes, will be used for calculation of merkle root. This is not a list of all transactions, it only contains prepared hashes of steps of merkle tree algorithm.”

The items returned by the Stratum server for the merkle branch are essentially [b,h(c,d)…] pre-computed to reduce the number of calculations required later to complete the merkle root.


How likely is it that the structure of a raw transaction will change?

All transactions people can reasonably create today will likely still be valid in the foreseeable future, the devs try really hard to stay as backwards compatible as possible.

But new features are introduced regularly. For example SegWit might require you to update your script. The recent Locktime BIPs may have already. SegWit also allows easier updates (or whole alternatives) of the scripting language, which will likely be put to use fairly quickly after SegWit rolls out.


What to do when a website says that my bc1... address is invalid?

The address that you are using starts with bc1 and is a bech32 address. Many online wallets still do not support this form of address, which is the reason you are getting the invalid Bitcoin address error. If you want to use segwit and still be compatible with these online wallets that do not support bech32, you can use a P2SH(P2WPKH) addresses that begin with 3.


Should I put my bitcoin wallet on an encrypted disk or not?

This only helps when someone malicious has physical access to you hard drive while your computer is not operational (shut down, account logged out, screen locked, etc.). When your operating system is running, an attacker running malware on your machine won't even notice your disk is encrypted.

Make sure your wallet is encrypted. That's much more important. Of course, having your disk encrypted has other benefits but as long as someone with physical access to your machine isn't trying to steal specifically your money, there is no advantage in this regard which would not already be there if you used an encrypted wallet. But the latter has the additional advantage that malware capable of reading your files can't just send your private keys to the attacker when you're using your computer and your files are available.


Blockchain API support - receive payment IPN

It is possible to test it offline. Check your phpinfo() to confirm, but I perform operations with the blockchain API from my XAMPP server all the time, as I am currently working on a site that uses the API. All you're doing is sending a request to a URL (like when you loaded this page) and getting the contents of that file. If you're interested, check out this class I wrote for using the blockchain API with PHP: https://github.com/lukesims/Blockchain-API-PHP-Class

With that, you could ad more functions or modify it to interact with your database simultaneously.


NBitcoin how can I get notify when I receive coins?

NBitcoin is only a library. In order to get notified upon receipt of funds you would need to be running a bitcoin implementation such as bitcoin-core and use it's JSON-RPC, or ZMQ or it's built-in features like walletnotify.
https://github.com/NicolasDorier/NBitcoin.Docs/blob/master/README.md
How do I use walletnotify?


the transaction are all available here:

http://www.blockchain.info

or here:

http://www.blockexplorer.com

or if you set up a full node on your own machine.

for a transaction to be valid it needs to appear on that global auditable log


There is more to a blockchain than just a linked list of hashes and a proof of work. There's more to Bitcoin than just a linked list of hashes and a proof of work. What defines Bitcoin and its blockchain are the consensus rules. These are a set of rules that determine what constitutes a valid block and a valid transaction. The blockchain is a linked list of blocks which contain transactions that conform to the consensus rules. Every block in the blockchain must also conform to these consensus rules.

One of the consensus rules is that a transaction cannot create more value in its outputs than it spends in its inputs. It can create less value, and the difference is the transaction fee. But it cannot create more value as that would lead to infinite inflation and Bitcoin would not work as a monetary system. This rule is completely independent of the linked list of hashes and completely independent of the Proof of Work.

Furthermore, there is no such an object as a Bitcoin. What people refer to as Bitcoin are simply values associated with transaction outputs. There aren't actually Bitcoins; it is solely based around the transactions and their outputs.


What is the benefit of using a Merkle Root rather than simply hashing all of the transactions in the block?

The Merkle tree allows verifying that a transaction exists in the block without having the entire block, by following its Merkle branch. Among other things this enables:

SPV (lightweight) clients
Blockchain pruning
Smart pool miners


How to generate a public key from a private key using Elliptic Curve Digital Signature Algorithm

Yes.
Imagine that all you can see is the point at G, and the point at 8G. You're trying to determine how many times the point was added. And the number isn't 8, it's somewhere between 1 and 2^256.

  Am I missing something or does it only become irreversible in the discrete logarithmic equivalent.

I have no idea what that means; I'll leave that for someone else to answer.


The Bitcoin Foundation is a non-profit corporation started by some of the most respected members of the Bitcoin community created to accelerate the global growth of Bitcoin. They follow the model of open source bodies like the Linux Foundation, or the Tor Project.

The foundation at the moment consists of five board members. During the first term the board consisted of:

Gavin Andresen
Jon Matonis
Charles Shrem
Mark Karpeles
Peter Vessenes

The goals of the Foundation from their About page:

To standardize Bitcoin - "As a non-political online money, Bitcoin is backed exclusively by code. This means that—ultimately—it is only as good as its software design. By funding the Bitcoin infrastructure, including a core development team, we can make Bitcoin more respected, trusted and useful to people worldwide."
To protect Bitcoin - "Cryptography is the key to Bitcoin’s success so far. It’s the reason that no one can double spend, counterfeit or steal Bitcoins. If Bitcoin is to be a viable money for both current users and future adopters, we need to maintain, improve and legally protect the integrity of the protocol."
To promote Bitcoin - "In the context of public misunderstandings, misinterpretations and misrepresentations, Bitcoin needs to be clearer about its purpose and technology. Allowing the community to speak through a single source will enable Bitcoin to improve its reputation."

Any person or corporation can join the Bitcoin foundation. Asides providing their name and address, one needs to pay their fees. For individual level, those are (effective as of 2012 07 23):

25 BTC for a lifetime membership
2.5 BTC for an annual membership

Companies can also apply by paying the following fees:

500 BTC for annual Silver Membership
2500 BTC for annual Gold Membership
10000 BTC for annual Premier Membership

Each level of membership allows an individual or corporation one vote in each of their respective voting class.


What's the minimum age to join or use Bitcoin?

There is no minimum age, my children have Bitcoins and have for years.

Service by service should implement whatever safety or age restrictions they need.

I am not aware of any work done on this front, perhaps somebody else can enlighten.


What is the format of the value of a transaction in the litecoin ledger

The transaction format was never altered in the clone Tenebrix or its clone Litecoin. The bytes you have posted are correct, and do indeed decode to 50 BTC when read out as an unsigned, little endian, 64 bit integer.

~> python
>>> import struct
>>> struct.unpack("<q","\x00\xF2\x05\x2A\x01\x00\x00\x00")[0]
5000000000


It is started working now.
I guess after stabilizing ABC chain it is started working as expected tried with https://testnet.wormhole.cash/faucet/

https://coinfaucet.eu/en/bch-testnet/
Thanks.


Which part of code (function) handles received transactions?

Any transaction

main.cpp, AcceptToMemoryPool:

bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
                        bool* pfMissingInputs, bool fRejectInsaneFee)

A transaction that pays to or from you

wallet.cpp, CWallet::AddToWallet:

bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)


As explained in their FAQ, Trezor works together with existing wallet software, it's not a standalone wallet.

What happens is that the wallet you use gets the addresses from your wallet from Trezor and can display your balance with that information. When you want to spend money, it will create a transaction as it would normally do,  but instead of signing the transaction itself, it sends it to Trezor. Trezor will show the transaction on the display and ask for your confirmation. When you confirm, it will sign the transaction with the private keys (that are only stored on the Trezor) and send the signed transaction back to your wallet software, which will broadcast it to the network.


How can I convert my private key from bitaddress.org to WIF without putting the key into a website or a programme?

bitaddress.org already provides your private key in Wallet Import Format, which is encoded in base58check format.
In the example screenshot below, the base58check-encoded WIF private key is KzNKqwBPaVehsA2F94n9UJ5mrkM9NazBjqBBwsb2U9pAGLdc4md3
To address your "rule 1", the most secure way to handle this data is load Electrum onto an airgapped machine, enter the private key into that secure computer, and then use it to sign a transaction you build with an "online" machine that has access to the UTXO set and your wallet address.

Warning: Do not use the key or address in this example for any reason at all besides looking at it and learning! Pasting private keys on websites is always a terrible idea.


The definition of cond is

cond thn els = match (drop els) (drop thn)

Expanding this in your definition of full yields

full = match (drop unit) (drop u)

The correct pruned version should be

pruned = assertl (drop unit) (commitmentRoot (drop u))

which has commitment root that matches:

let full = cond unit unit in (flip Numeric.showHex "".integerHash256.commitmentRoot) (full :: CommitmentRoot (Bit, ()) ())
"dded2b0938bb9f58f20324ab1f699e7006ffd8e9251b3ddd0f551de1d66fe119"

let pruned = assertl (Simplicity.Term.Core.drop unit) (commitmentRoot (Simplicity.Term.Core.drop unit :: CommitmentRoot ((),()) ())) in (flip Numeric.showHex "".integerHash256.commitmentRoot) (pruned :: CommitmentRoot (Bit, ()) ())
"dded2b0938bb9f58f20324ab1f699e7006ffd8e9251b3ddd0f551de1d66fe119"

Better library support for pruning expressions is something that will be developed.


What is the memory usage for checking transaction inputs?

You are right UTXO set is stored on disk on .bitcoin/chainstate directory using leveldb. It is stored in compressed state and the current size is around 1.5GB

To speed up access bitcoind uses an in memory cache which can be configured using -dbcache option.

  So, I assume the chainstate-db is stored on disk, but accessed
  multiple times per second to check transaction inputs. What amount of
  memory usage does this induce on a node?

Accessing the leveldb database itself is like accessing any other nosql database. You basically lookup the key which is the utxo and get a value as output which you need to deserialize and store in a memory variable


This seems normal. Wait 10 minutes and see if theres some "Yay!!!" messages


Do the leading zeros in the desired hash pattern for mining change?

Q: does this "desired pattern" always have the same leading zeros?

No.

  Or does that change now and then?

It changes every ~14 days (2016 blocks). The change depends on the hashing power of the bitcoin network at that moment. The new required hash needs to have that many leading zeros so that it takes ~10 minutes to find that hash.

  Q: If it changes now and then, what triggers this?

An algorithm triggers it. It's built into the bitcoin protocol. Every 2016 blocks the difficulty of finding a new block is recalculated.


Are transactions containing zero-value output accepted by miners?

Each miner (or mining pool) sets their own policy, but miners using Bitcoin Core 0.9.0 and later will, by default, mine OP_RETURN (null data) outputs with zero value.  They will not, by default, mine any other outputs with a value below the dust threshold, which is 1/3 as many satoshis as it would take to relay the output plus the corresponding input according to your node's relay fee policy.

For example, if your node's relay fee is 1000 satoshis per kilobyte, the output is a 36 byte P2PKH script, and the input that spends it is expected to be 148 bytes, then the minimum allowed value is 546 satoshis.

To learn more about the default Bitcoin Core rules, you want to check its IsStandard() function which determines what transactions it accepts into its memory pool.  Bitcoin Core will mine anything in its memory pool.  The rules have changed a lot over time, so here are a few different links:

Bitcoin Core 0.9.x latest rules
Bitcoin Core 0.10.x latest rules
Bitcoin Core development branch latest rules

(Note: the links above may not point to the right place if code gets moved around.  Just search the page displayed for "IsStandard".)


Your only hope would be getting that private key for your bitcoin address! Once you get that then import it into bitcoin cash wallet. You should be able to see your money and send it accordingly


Why are the inputs of Bitcoin transactions signed?

There may be multiple utxos that the same script would unlock. The most common example is two transactions that both pay the same address. If inputs weren't signed, an attacker could replace one input utxo by a different utxo that pays the same address, and this would be bad.

Consider the following scenario.  Alice has received two payments to her address 1Alice, both in the amount of 1 BTC: one with txid 234abc in the amount of 1 BTC, and another with txid 567def.  She wishes to pay 0.5 BTC to Bob, so she creates and signs a transaction using the 234abc utxo as input, with the following outputs: 0.5 BTC to the address 1Bob, and 0.4999 BTC to some "change" address, 1AliceChange.  (This leaves a transaction fee of 0.0001 BTC.)

After this transaction is broadcast and confirmed, Bob modifies the transaction so that the input is 567def instead.  The scriptSig works equally well for every transaction that pays 1Alice (they all have the same scriptPubKey), so this new transaction is also valid.  Bob broadcasts it and effectively steals an additional 0.5 BTC from Alice, which she never intended to give him.

This only works as long as 567def has the same value, or greater, than 234abc, but that's not much of a restriction.  (If 567def has a greater value, say 10 BTC, then Bob's new transaction still only returns BTC 0.4999 to 1AliceChange, so it effectively has a transaction fee of BTC 9.0001.  Any miner would be extremely happy to confirm this transaction; indeed, maybe a miner will perform this attack even if Bob doesn't care to.)


How proof-of-work detects Sybil attack in Bitcoin?

PoW does not detect sybil attacks, it prevents them. Sybil, or sockpuppet, attack means that an attacker can spawn a large number of nodes which they control.

If your full node suddenly finds itself connected to fake nodes spawned by an attacker which claim that difficulty of the block they are sending you is much less than it was upto now, your node will know something is wrong and discard those blocks. The idea is that those fake nodes would have to mine at the current difficulty, but at that point they are not fake/sybil nodes, they are miners.

Similarly, when you run a full node for the first time you need to be able to connect to other nodes in the network to receive all the blocks that occured in the network so far. If by some chance your node connects to attacker's nodes they could try faking the transaction history. But since each block contains the difficulty at which it was mined, fake nodes being regular pc's or something like that would produce blocks at very low difficulties. If you ever connected to a real node, you would quickly discover that your node is under attack and receive the real history.

The point is that if the fake nodes wanted to produce blocks at anything close to the current difficulty, they couldn't be just regular PC's and just fake the difficulty. They would have to be miners like the rest of the network, but then they are entering the race with other miners to produce blocks (or are trying to pull off a 51% attack).


How create coinbase transaction with createrawtransaction?

It is not possible to create a coinbase transaction using createrawtransaction. There are numerous rules that coinbase transactions must follow that the createrawtransaction RPC does not have the ability to set the fields to meet those rules. For example, BIP 34 requires the coinbase contain the block's height in the scriptSig. However createrawtransaction does not allow you to set the anything in the scriptSig.
Miners must use software that can independently create the coinbase transaction. Miners actually prefer doing this because they want to be able to modify the coinbase to use as an extra nonce so that when they run out of nonces, they don't necessarily have to re-select the transactions to include in the block. Instead they can change the coinbase to cause the merkle root to change.


How to make a new blockchain from scratch

I think I Found it.  Someone wrote a C program to generate a genesis block.  Code is on github here:

https://github.com/Gnaf/GenesisBlockZero

The original code was pulled from a discussion on the bitcoin developer forums:

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

Compile and run the program to generate the initial SHA256 hash, the time and nonce, then plug those into the bitcoin main.cpp source and recompile.  I think that's all you have to do to start a new blockchain.


What does the MiniWallet class currently do and need to do in the Bitcoin Core functional test framework?

At the moment, MiniWallet doesn't do any signing. It generates an address and sends an effective regtest coinbase to it. It then constructs an OP_TRUE transaction that spends to yourself with a fee.
I'm not sure at this stage if this is enough to replace the reliance on the Core wallet for all non-wallet functional tests but I will look into it more.
MiniWallet is not a wallet handled by the node, it is an "external" wallet coded in Python for testing. gettransaction only works for those wallets handled by the node, that's why the error says: non-wallet transaction id


How can one find everyone holding IOUs from a given issuer in Ripple?

To find all the accounts that hold an asset, e.g. USD/gw1, you just need to use the account_lines API on the gw1 account and filter out the USD entries (or whatever currency code you are interested in).

Although you could recursively look up the account lines of each found account in turn, that doesn't tell you anything more about who "holds the IOUs from a given issuer" which was your question. It instead tells you how much each found account would currently be able to redeem via the issuer. For example, if account_lines on gw1 says UserA has 100 USD/gw1 and account_lines for UserA says they also have -50 USD/UserB, then UserB could redeem 50 USD via gw1 (not accounting for any quality or transfer rates that may be set).


How do you create a merkle tree that lets you insert and delete elements without recomputing the whole thing?

You can use a Merkleized binary trie.

You first hash all the elements of your set individually. In this example, I use a 3-bit hash function rather than 256-bit.

Let's say you have 5 elements in your set, and they hash to:
A: 011
B: 101
C: 111
D: 001
E: 010

Now you arrange them in a tree, by using the bits of the key hash as split conditions:

root

0

0

1: D

1

0: E
1: A

1

0

1: B

1

1: C

Now you associate every leaf node with the full key hash, and every internal node with the hash of its concatenated children.

The resulting root is:

Fast to update: the number of hash operations for an add or delete is proportional to the number of bits in the hash function (and does not depend on the number of elements in the tree).
Authentic: the root commits to the entire tree structure, so indirectly to all its leaves.
Deterministic: the order of insert/delete operations does not affect the tree structure.

A possible optimization is to compact branches constructed from internal nodes with 1 child. This leads to the following structure:

root

0

0: D
1

0: E
1: A

1

0: B
1: C

Now operations are on average logarithmic in the number of elements, and all other properties remain.


A private key is a 256-bit number. You can represent it using only digits (so there is no need for lowercase letters). However, if you want to use the Wallet import format to represent the key, then you will need both upper and lower case letters (keys are encoded in Base58).


It seems that the transaction hash and the merkle root are both serialized in the gettxoutproof, but byte-wise reverse.
As stated in the bitcoin developer reference,

  Bitcoin Core RPCs accept and return the byte-wise reverse of computed SHA-256 hash values.

So regarding your example, the hash (byte-wise)

81 48 74 0e ... 24 3c c4 a8

is contained twice in reverse in the gettxoutproof as:

a8 c4 3c 24 ... 0e 74 48 81

In this special case it is contained twice, of course, because with only one transaction the merkle root equals the according transaction hash.


Why not hardened keys in addresses BIP44?

Change in this case represent external/internal chain. Usually if that's external chain, you can share it with parties. Imagine having a client which is obliged to send you bitcoin very often. If you'd give him xpub for the whole external chain, he can generate addresses on his own and you don't have to be bothered. It's not heavily used, but sometimes happens.

If this derivation was hardened, the external party couldn't derive child keys (addresses) for this chain. Also watch-only wallets wouldn't be a thing.

BIP44:

  Constant 0 is used for external chain and constant 1 for internal
  chain (also known as change addresses). External chain is used for
  addresses that are meant to be visible outside of the wallet (e.g. for
  receiving payments). Internal chain is used for addresses which are
  not meant to be visible outside of the wallet and is used for return
  transaction change.

  Public derivation is used at this level.


what is the motivation behind one-cpu-one-vote rule?

The motivation for this rule is simple - there is a requirement to have some voting mechanism , and this 1-CPU-1-vote mechanism is fair, in the sense that everyone can buy more CPU (or GPUs or ASICs) and mine. The rewards are proportional to the invested effort - better harder costs more, it doesn't matter if it's CPUs, GPUs or ASICs.

So, the protocol rewards miners in proportion to the amount of money they invest in buying mining gear. It's certainly better than rewarding per IP address, which is controlled by various organizations and ultimately centrally managed.

Also, I believe satoshi did foresee the evolution in mining gear, although it seems that it's not mentioned in the original whitepaper.


Why do we need SegWit (technical explanation)

After reading a lot of articles, whitepapers and videos I am still confused why do we need SegWit and Lightning instead of just bigger blocks.

It's not a question of one or another. They are all approaches to capacity increases, and I expect that in the long term, all of them will happen. However, due to the risks and tradeoffs involved some were far easier to deploy and get agreement across the ecosystem on.

SegWit is a solution to the transaction malleability problem, introduced in a way that also provided a moderate capacity increase. By design, SegWit is backward compatible - meaning that it did not require the entire ecosystem to migrate to different software.

Lightning is one proposal for a layer on top of Bitcoin that makes much more efficient use of transaction capacity, as well as giving instant transactions. Implementing Lightning became much simpler with SegWit. It only affects those who use it.

Just a block size increase is a bit underspecified, as SegWit for example was technically a block size increase too. If you mean increasing the capacity without any other changes, that is something that I expect will happen in the long term, but has multiple issues. One is that it is a hard fork, which means the degree of consensus needed for it happen without incidents across the network is much greater.

The biggest issue - and this is certainly subjective - is that it is not a solution at all to scaling. It offers a way to double the capacity of the system while making everything twice as costly (in terms of resources) for participants to validate the system's security. If we want to make Bitcoin accessible to the world, no such approach will help. Blocks could be made 2x bigger or 10x bigger, but the result is only 2x or 10x more transactions. Who cares? That does not fundamentally enable use cases that weren't otherwise possible. In my view, the part of the ecosystem that views capacity increases in this way as a necessity do so from an expectation that all transactions need to happen on the blockchain. That's just not what the technology is good for. Building layers on top is harder, and will require time, research, and money. But it may bring us a world where billions have access to a currency without third party control. In contrast, larger blocks risk setting the ecosystem on a path where its only way forward is ever increasing blocks size.

Lastly, there is the issue of immutability. Bitcoin is hard to change if people believe it is hard to change. And this on itself is an incredibly valuable property. This means people can rely on it retaining the properties they signed up for, even if potentially powerful entities would like it to change. If controversy is a reason to step away from this, it's an avenue to outside influence. This does not mean change cannot happen at all, but it must happen in a way that is cooperative, and without rush. We're in it for the long term…


deleted Bitcoin Wallet before transaction processed

Whenever you create a new wallet, a number of private keys are generated for you. These private keys are used to authenticate yourself as the owner of bitcoins sent to the keys' corresponding addresses. Therefore, you must keep these private keys safe. For Bitcoin Core, these private keys are in a file called wallet.dat in the Bitcoin directory. If you've deleted this file there will be no way to recover your coins, as private keys cannot be regenerated.

However, I think that the wallet file may remain even when Bitcoin gets uninstalled, so if you didn't delete the whole directory, but just uninstalled it, you might want to check if you can still find the wallet.dat.


Default behaviour when network partitions/pruned network

Bitcoin Core does not support pruning witnesses. It supports pruning blocks entirely, but that is independent from segwit.

No full node in the network will accept a segwit block without the witnesses. It's simply impossible to validate a block without it, so not having a witness is treated as equivalent to not receiving a block at all.

SegWit does enable dropping witnesses for relay. It is a bandwidth optimization for lightweight clients, because they don't care about the witness data in the first place.

In theory, nodes could indeed choose to not store witnesses at all, but why bother? They can already delete the blocks entirely if they don't care about serving other nodes that want to verify history.

All pruning node have a minimum requires number of kept blocks, which corresponds to a few days of time. That should be sufficient to overcome reorganizations and temporary partitionings.


Do mining pools centralize the Bitcoin network and make it less secure?

The short answer to your question is "yes".

Efforts are underway to develop schemes that allow pooled mining without the pool manager being able to control what transactions go into the pool's blocks, leaving that decision (as well as which chain to extend, so long as it is reasonable) to the individual miners. All the pool really needs is proof that the miner is mining for the pool.


Does blockchain have any value if you trust all nodes?

By design, a blockchain is inherently resistant to modification of the data, so if you own or trust the nodes and you can modify that data anytime, so blockchain is ineffective.

If you were trying to use the blockchain technology just for storing data and for the highest availability, A regular database with some extra connected nodes would do the job.


Lightning Network state deprecation secret keeping

Unless bob uses a watchtower service where he outsources the storage of data Bob needs to know all previous revocation secrets. However he does not need to store and save all of them as the revocation secretes are derived in a deterministic way. This means whenever I know a revocation secret of a current state I will be able to derive all previous revocation secrets from it.
You can find the details of the key derivation in the key's section of BOLT 03
That being said revocation secrets are not the same as preimages of HTLCs (which I believe your question implies / confuses) The old preimages of settled HTLCs do never need to be stored or need to be reproduced. This is because in the penality transaction case from the second stage HTLCs the revocation secret is sufficient to access the funds before the timelock.


It's a scam, it will never reach 100%. Your money is gone. You can report the theft to your local police but they won't be able to recover your money for you.
A safe website to find guidance on Bitcoin wallet software is https://bitcoin.org/en/choose-your-wallet
The correct website for downloading Bitcoin core is https://bitcoincore.org/en/download/
Ignore any other websites offering a wallet whose name ends with the word "core". There are many scammers who exploit the lack of knowledge of people new to Bitcoin.

See also

Bitly core website not loading
Please i need help about BitlyCore.com
Bitswallet core

It will help to also read

Can't spend Watch-Only coins, have I been scammed?
How can I get a private key for this address


No. Your premise is wrong. There is no guarantee a solution exists in a range. If a miner exhausts a nonce range he changes other components of the block header. Mining is a Poisson process with each hash attempt independent of any others.

Hence, there is nothing to gain with this particular kind of collusion. Of course, pooled miners enjoy less variance than solo miners (which is legitimate), and there are other methods of attack.


Bitcoin API - How can I identify new incoming payments?

If you want to identify incoming payments, the recommended way is creating a new receive address for every request. When the confirmations of a transaction to a given address get high enough, you can consider the payment confirmed.

Using the 'sender address' does not give you reliable information - it can only identify (one of the) addresses that were previously in control of the coins. There is no guarantee that these correspond to the sender of the payment (it may be a webwallet with shared coins, for example).

Not reusing addresses also has other benefits, like making bitcoins as a whole less easily traceable.


Will mining Bitcoin slow or stop other computers on my home network?

Absolutely not. The bandwidth required to mine Bitcoin is very low as shown here: What are the bandwidth requirements of a mining rig?

  So that's 700 bits per second out and about 2,000 bits per second
  back. Essentially, zero.

This means that your son can mine 24/7 and your daughter won't notice any slowdowns whatsoever.


A node is only called a peer if you're connected to it. So by definition you are always connected to all your peers.

I assume you're asking whether you're connected to every node in the network. The answer is no; most Bitcoin node software implementations only connected to around 8 others.

What happens if one is malicious? Bitcoin is trust-minimized by design. This means that it verifies to the extent possible whether incoming data is correct. Where this isn't possible, it uses a objective and unforgeable metric (proof of work) to select the winner in case there are multiple acceptable possibilities (blocks).

For most types of attacks, the assumption is that at least one of your peers is honest. If that's the case, you'll eventually learn the best valid version of history the rest of the network learns too. If all your peers are malicious, they may prevent you from seeing actual history - though it is very hard even in this case to forge and invalid version of history and convince your node of that.


https://blockexplorer.com also has this same functionality. I believe some bandaids need to be placed on insight-ui in order to get the cashaddr format working fine, but there is a branch of bitcore that is designed to work with bitcoin cash.

https://github.com/bitpay/bitcore-lib/tree/cash


Who bears the transaction fee for settling HTLC in Lightning Network?

Tl,;Dr answer:

The fees for the htlc are covered by whoever claims the output
The fees for the commitment tx are always covered by the party who opened the channel.

Sorry to say that but I believe there are many things wrongly stated in your question:

The fee for the commitment transaction is not necessarily paid by Alice even if she force closes the channel. The fee is always covered by the the person who has opened the channel. This is independent of who closes it and what type of close we have.
The commitment tx does not have two outputs htlc success and htlc timeout. It has 3 outputs: a) a relative timelocked to_local b) to_remote  c) the htlc output which has two conditions to be spent: one is the htlc success and the other one is htlc timeout tx. (note of course there could be more than 1 htlc output in the commitment tx if there are several htlcs in flight)

The fees for claiming the htlc output must necessarily be paid by the person who claims the output, since the funds go to them and noone else. (of course ln could have decided that they could have been taken from the commitment tx but I think this would have been a wired and unclean solution) So yes in your case they are paid by Bob.
Note that the htlc output is again a multisig Adress to enable the second stage htlc process. AFAIK this is necessary to decouple the relative timelocks of the commitment tx from the absolute timelocks of the htlcs. That being said as far as I understand the situation Bob isn't able to replace by fee the htlc success tx without getting signatures from Alice. (note that in commitment signed message there is one signature for the commitment tx to spend the funding TX and then a list of signatures for every htlc as the htlcs are in a musig Adress (this is also necessary to allow the penalty tx in case if broadcasting old state). Thus without Alice's help Bob cannot create a new htlc success tx. In the case of a force close we assume there is no help.


What is the difference between Gridseed ASIC and Scrypt ASIC

Gridseeds are small dual-mode miners offering SHA256 and Scrypt.

Gridseeds have a very low scrypt hashrate (<400kH/s). The hashrate affects the share difficulty and therefore it's quite a good idea to offer a seperate mining port for low hashrate devices.

It seems there are so many gridseeds still out there that it's worth to mention that on the pools help page.


This sort of question comes up moderately often.
Bitcoin.stackexchange.com is a self-help Q&A website and has never provided Bitcoin wallets or acted as a custodian of money or as a register of Bitcoin accounts. It has always been no more than a place where people like you and I can answer other people's questions.
You need to do one of the following:

Find a file named wallet.dat. Find or remember any password you might have used to protect the wallet.
Find a piece of paper where you wrote a "private key" - a string of letters and digits similar in length to E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262.

Without something more definite than you wrote above, your $25 is lost forever.

Similar questions (not exactly identical) which also have potentially useful answers.

Recovering bitcoins
signed up in 2010-now trying to access
Bitcoin Recovery Email or Hard Drive


There's many different types and formats for Private Keys.

For example, a single address private key(WIF) should look like:

5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

other types:

Hierarchical Deterministic (HD) Wallet Keys

  Wallet software may use a BIP 32 seed to generate many private keys and corresponding public keys from a single secret value. This is called a hierarchical deterministic wallet, or HD wallet for short. The seed value, or master extended key, consists of a 256-bit private key and a 256-bit chain code, for 512 bits in total. The seed value should not be confused with the private keys used directly to sign Bitcoin transactions.

Example:

xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi

Mnemonic phrase
A mnemonic phrase, mnemonic recovery phrase or mnemonic seed is a list of words which store all the information needed to recover a Bitcoin wallet. Wallet software will typically generate a mnemonic backup phrase and instruct the user to write it down on paper. If the user's computer breaks or their hard drive becomes corrupted, they can download the same wallet software again and use the paper backup to get their bitcoins back.

Base58 Wallet Import format

  When importing or sweeping ECDSA private keys, a shorter format known
  as wallet import format is often used, which offers a few advantages.
  The wallet import format is shorter, and includes built-in error
  checking codes so that typos can be automatically detected and/or
  corrected (which is impossible in hex format) and type bits indicating
  how it is intended to be used. Wallet import format is the most common
  way to represent private keys in Bitcoin. For private keys associated
  with uncompressed public keys, they are 51 characters and always start
  with the number 5 on mainnet (9 on testnet). Private keys associated
  with compressed public keys are 52 characters and start with a capital
  L or K on mainnet (c on testnet).

Mini private key format Some applications use the mini private key format.

  Not every private key or Bitcoin address has a corresponding
  mini private key - they have to be generated a certain way in order to
  ensure a mini private key exists for an address. The mini private key
  is used for applications where space is critical, such as in QR codes
  and in physical bitcoins. The above example has a mini key, which is:
    SzavMBLoXU6kDrqtUVmffv

You should know which private key they're asking for and you are sending the correct one.

Importing private address key (WIF) command should be like that:

importprivkey yourPrivateKeyInWalletImportFormat "TheLabelThatIWant"


Bitcoin daemon Error: Invalid combination of -regtest and -testnet

So this was because .conf file has line of regtest=1


Answer is here, question already asked (sorry about that):

How to integrate a Bitcoin payment service in my auction site

my choice: https://bitpay.com/


You can use this code for genesis block:
https://github.com/nasa8x/genesis-block


How does cryptsy.com currency trading works?

You do not own a LTC-address (or BTC, or any other altcoin) on cryptsy or any other virtual currency exchange site. You can however see your balance of all crypto currencies in the 'Balance' tab. When you scroll down, you will see the LiteCoin with your current available balance and the balance that is in possible orders. If you want to have your LTC in an address, you should download an LTC-wallet app, and create a wallet in there, and then withdraw (from cryptsy) to that wallet.

And your second question: yes, cryptsy is a crypto currency exchange. So far there is no option to trade in any real currency, but I see that option is coming in a week or so, because this text is above the BTC/USD market

This market is for Verified Accounts Only. The User Verifications system will open within the next week.

Anyhow, what happens when you withdraw LTC to your own wallet, is that cryptsy looks at deposit wallets (for other people) they own. For example person A, B and C have all a different deposit wallet, and they deposited 1, 2 and 3 LTC respectively. You had fun trading, and want to withdraw 2.5 LTC. Cryptsy sends 2.5 LTC from the deposit wallet from person C, so there is only 0.5 LTC left in that wallet and you have (after confirmation) 2.5 LTC in your wallet.

When you trade, there is no 'real' LTC being transferred between wallets, only on withdrawl and deposits. Otherwise you cannot trade that fast (and other disadvantages, like fees and huge blocks)


What are the pros/cons of changing the targeting interval (difficulty)?

The targeting interval either amplifies or dampens spikes in the hash rate's effect on the overall difficulty.

Having a shorter targeting interval allows for the difficulty to adjust quickly to changes in the hash rate, however there is a greater possibility of an attacker pushing the difficulty to crazy heights with less hash power.

Having a longer difficulty dampens this effect, but at the same time a drastic drop in hash power will leave the network hurting for a longer period of time, since more blocks need to come out before the network recalculates the difficulty.

In the end it's more or less the same, shorter intervals can have their difficulty altered more easily, but is less lasting; longer intervals makes altering the difficulty more expensive, but is longer lasting.

It is possible for an attacker to do this, with the development of ASIC there were many who took advantage to attack TRC and other SHA based coins. This would not always be an attack on purpose. There are several miners and pools (such as multipool.us ) which will mine the most profitable coin, and doesn't pay much attention to how it's changing the difficulty. For example, if AB Coin were to inexplicably multiply in price 100x, the miners would all be trying to get AB Coin and would consequentially raise the difficulty 100x as well. Once this difficulty has been reached, there is no more benefit to mining AB Coin over another coin, and miners would go find another which is trading higher than it's difficulty. This leaves AB Coin in bad shape, as it's regular mining group is only 1% of what it used to be (in terms of blocks produced).


The accounts feature is only accessible through the RPC interface.

Also, unless you want to maintain separate balances for several users sharing the same wallet, it's unlikely you'll want to use this feature.


Do miners have to start over whenever a block is found?

In a sense, yes.

However as the mining process is essentially guessing the right number from a very large set of possibilities it's misleading to say you start the process again as you're just as likely to guess the next block first try as you are to have guessed the previous block. You basically start the process each "guess" anyway, whether you try again on the same block or start trying a new one is of little consequence.

You could very well find a new block the very second after you accept a block. In that case, you wouldn't have found a block if you had kept mining on the old block.


How to find bitcoin balance via command line

There is a simple RPC call getbalance. So bitcoin-cli getbalance should give you the number.


Lightning networks revocable commitments: unilaterally closing could cause funds lost forever?

What happens if B received the revocation key and decided to close the channel unilaterally without broadcasting the transaction

By definition, channels are only closed once a commitment transaction or the closing transaction is broadcast. So B cannot close the channel; he simply withholds data from A.

Your scenario is not possible because A will only give B the revocation key once both B has given A his new commitment transaction. So if B refuses to give A the revocation key to his commitment transaction, then A can close the channel by broadcast the previous commitment transaction which has not yet been revoked.


Is it possible to do this in PHP?

So far as Bitcoin is concerned, I believe it is probably possible.
For example, by looking at https://en.bitcoin.it/wiki/PHP_developer_intro I can see

The easiest way to get started is to run Bitcoin in daemon mode with which PHP communicates via local HTTP requests. A library called JSON-RPC is used to call the various functions of bitcoind, which will respond back with a JSON object.

It is however recommended to use one of the Alternative Libraries listed below instead, since they are more sophisticated.

It goes on to briefly describe setting up PHP and the other required software and has links to other material that may be helpful.

ETH and LTC are off-topic on bitcoin.stackexchange.com so I won't attempt to address that aspect of your question.


Why do you have to search for TXIDs in little-endian?

Because Bitcoin in general uses little-endian while most hashing libraries use big-endian.

For more details and links see here.


How long can popular hardware wallets last in cold storage?

It seems like the general consensus on how long the actual cryptographic chip in the Ledger and Trezor devices will last is ~20-30 years, comparable to a standard flash drive. The Ledger Nano X has a battery that is rated for a 5 year lifespan, after which you probably won't be able to use it without plugging it in, although the cryptographic chip should still work well beyond that.
Regardless, if you would like to ensure your crypto assets can be kept in cold storage for a very long period of time, it is recommended to keep a backup of the seed phrase. If you use a durable medium such as a steel or titanium wallet to record your seed phrase, your assets will be recoverable for as long as the seed phrase is legible.


Obtaining 12 word mnemonic from Private & Public Keys

Sorry you can't invert a private key from a detached BIP 44 path to obtain a BIP 39 seed words. That is the mathematical nature of BIP 39 when combined with BIP 44.  However, Electrum seed words used by Monero are invertible from a Monero private key.


Can Bitcoin software be used to create a private currency (single issuer)

If I understand you correctly, the answer is yes. You could use a Bitcoin-like system simply to track the movement of 'shares' or 'units'. All the 'coins' could start out pre-mined, and the system's sole purpose could be to track the movement of those units.

However, there would be a lot of reasons why this would be a bad idea. The primary one is this: the Bitcoin system makes a lot of trade-offs to get the benefit of decentralization (nobody needs to trust anyone else at all ever). If you want to have one central authority anyway, you are trading off all those things for nothing.

Securing the block chain requires sufficient hashing power such that a malicious organization can't easily muster 51% of it. So to keep the system secure on a day-to-day basis, you'd need some way to fund that massive amount of computing power. It's hard to see what benefit you'd get back for that cost.

There are systems, even cryptographic ones with similar properties, that are more suitable for a centralized currency. The basic design change would be that instead of having a block chain, you'd simply have the central authority (or authorities) sign all transactions.

For example, if I had 50 units of this currency, I could request a signed and dated statement from the central authority saying that I had those coins and showing my public key. If I want to transfer 10 units to you, I make a signed statement saying so and get the central authority to sign it. You can now prove you have those 10 coins with that signed statement. I can prove I have 40 coins by showing the signed statements and the central authority can't argue I made a transaction I didn't make because I have to sign them. So you get the same security properties and don't need all the CPU power.


How to run a python script when occur incoming transaction in Bitcoin core 0.18?

You're looking for walletnotify setting in bitcoin.conf

It will call the specified script for every transaction received for your own wallets.

walletnotify=/some/path/mywalletscript.py

Here mywalletscript.py will handle the JSON data passed into it.

Here is a sample walletnotify implementation including database access. It's a bit dated but should give you an idea on how to handle events.

As per this Bitcointalk thread you can also hook up handlers for blocknotify and alertnotify so you can create your own payment system by receiving alerts, checking block confirmations and so on.

Just wire up a walletnotify handler via bitcoin.conf as answered here and here.


How to delete an element of an array in an Ethereum contract?

Refer to the documentation:

delete myArray[arrayIndex];


my transaction is still uncormed after 48+ hours

You only attached ~$2 in fees. The average transaction fee right now is ~$40source. It will take a while, if ever, to confirm.


The change to the size of blockchain data files

The reason is future pruning functionality.

Pruning will be implemented by simply deleting files (and related metadata in index databases) with only old blocks in them. Having smaller files means higher granularity in choosing what to keep or not.


Bitcoins transaction is completed but I don't get the coins

The transaction ID would be helpful to further diagnose what went wrong, however without that information, you can try the following:

Refresh the transaction cache.

Go to "Settings" (gear icon)
Choose the BCH wallet
Go to "More Options"
Choose "Transaction History"
Choose "Clear Cache" to reset your transaction list.

Note that it will say 'Updating Wallet' until the list has been retrieved.

Refresh the server's cache.

Go to "Settings" (gear icon)
Choose the BCH wallet
Go to "More Options"
Go to "Wallet Addresses"
Choose Scan addresses for funds

Note that it will say 'Scanning Funds' until the addresses have been scanned.


The most current list of Litecoin exchanges, originally from the Litecoin wiki, updated in December 2017 to remove nonfunctional exchanges:

  Market exchanges

 Kraken
 The Rock Trading
 UpBit - Korean exchange
 Bithumb - Korean exchange
 BTCTrade - Chinese exchange
 OkCoin - Chinese exchange

  Fixed rate exchanges  Okpay
 Litecoinlocal
 BitBargain
 24change
 ALFAcashier
 GOLDUX


Who do I send money to if I want to create an OP_RETURN transaction

Nothing prevents you to send bitcoins to one of your own addresses. I guess I'd just create a new address on my node with bitcoin-cli getnewaddress, and then create a transaction with 2 outputs :

one to the address I just got with my whole input amount (minus mining fees)
another to a "dummy" address (can be one you generated with the same method, you can't spend it anyway!) with OP_RETURN + [your_data], and of course 0 as amount

As for the exact way to do this, the post you linked too seems like it could work, but I never tested it myself. The idea is to create the transaction first with the createrawtransaction method from bitcoin-cli, and then modify a piece of the data with yours.

As I said I never did that, I highly suggest you try it out on testnet first, there are many things that could just go wrong.


If Bitcoin is ratified as a currency would its code be BTC?

The normal rule is (two letter country code) + (letter), although that's arguably already been broken by the Euro having EUR instead of EUE.

BT is the country code of Bhutan, whose currency has the code BTN. If anyone will object to BTC for Bitcoin, it'll be them.

According to wikipedia, which is never wrong, multi-national currencies use the X prefix. XBC is taken by "European Unit of Account 9", but XBI is available.

http://en.wikipedia.org/wiki/ISO_4217


Is there still a shortage of available inbound connection slots?

It is due to a lot of people not port forwarding from their routers to their Bitcoin machines. Without the forwarding the client can only make outbound connections to those client that have port forwarding enabled. The limited number of such clients is probably due to people not realizing this need and now knowing how to change their router options.


Forks to be aware of other than Bitcoin Cash and Bitcoin Gold?

Current forks that I successfully sold on exchanges and got free BTC:

Bitcoin Cash
Bitcoin Gold
Super Bitcoin
Bitcore
Bitcoin Diamond

A few more forks that I wasn't able to sell yet:

Segwit2x
Lightning Bitcoin
United Bitcoin
Bitcoin God