text:
Are OP_RETURN transactions not stored in chainstate database?
I'm running a bitcoin node on regtest. I'm writing scripts to interact with the chain-state database.
For my purpose, I'm creating, signing and sending a transaction to my node (pretty much following the instructions from here, specifically chapter 4 and 8)
{
  "amount": 0.00000000,
  "fee": -14.28700000,
  "confirmations": 200,
  "blockhash": "41dd1e98ab12148e8cd5c0ad06aab27beb4117f54b1e51916b7238535884cac2",
  "blockheight": 1001,
  "blockindex": 1,
  "blocktime": 1644326961,
  "txid": "9286a6f8e3814977efa6acd6320a4d4367f0bed85f9477c78da6c122086f49df",
  "walletconflicts": [
  ],
  "time": 1644326955,
  "timereceived": 1644326955,
  "bip125-replaceable": "no",
  "details": [
    {
      "category": "send",
      "amount": 0.00000000,
      "vout": 0,
      "fee": -14.28700000,
      "abandoned": false
    }
  ],
  "hex": "..."
}

Below is the transaction outputs:
 "vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 6268696a6b6c0a",
        "hex": "6a076268696a6b6c0a",
        "type": "nulldata"
      }
    },
    {
      "value": 10.71300000,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 e2698bbd6d475f022f8e5f852fa10ac761faa9c7",
        "hex": "0014e2698bbd6d475f022f8e5f852fa10ac761faa9c7",
        "reqSigs": 1,
        "type": "witness_v0_keyhash",
        "addresses": [
          "bcrt1quf5ch0tdga0sytuwt7zjlgg2casl42w8c2pr6d"
        ]
      }
    }
  ]

My problem: When I query the chainstate database and decode the TXIDs and output indexes, I see only the second output and not the first (i.e. the OP_RETURN one). I've retried on clean slate, other wallets, etc, but the problem still persists.
I've read 200 confirmations is as good as go, but I've tried the same after generating 400 more blocks too. Even still, that doesnt explain why I cant find my OP_RETURN UTXO in the chainstate folder.
For reference, this is my Python script that queries the chainstate folder:
db=plyvel.DB(chainstate_folder_path,compression=None)
arr=[]
for key,value in db:
    hexval=key.replace(b'C',b'')[::-1].hex()
    arr.append((int(hexval[:2]),hexval[2:]))

arr.sort(key=lambda x:x[1])
for i in arr:
    print(i)

What am I missing out? I really want to be able to parse my OP_RETURN UTXOs.

Since OP_RETURN are "provably" unspendable they are not stored in the chainstate database (nor cached in RAM).
If you want to see your OP_RETURN outputs you'll have to parse the block chain (or use -txindex and getrawtransaction on your node).

Thanks, I'll try this out and let you know. I have a followup question: OP_RETURN is the only way to add arbitrary data onto the chain, right? Are there any other ways for the same?

Before OP_RETURNs were introduced, people would write data into output scripts instead. This had more overhead size for the data written, and since these outputs weren't provably unspendable, everyone has to carry them around in their UTXO set forever. So, OP_RETURNs were the middleground. Users can write stuff to the blockchain, but at least we don't need to keep it in the UTXO set.

But information about OP_RETURN transaction must have been stored somewhere, right? How else would I be getting transaction info when running 'bitcoin-cli listunspent' then?


text:
Are there any risks to giving someone your wallet address?
I set up a fundraiser for my friend and I got a message from a stranger asking for a wallet address so they can donate using BitCoin. I don’t know a whole lot about BitCoin beyond the basics, so I wanted to ask if this person does happen to be a scammer, are there are any potential risks in giving this person a BitCoin wallet address to send the donation to?
I know if he tries to send me any links or files or anything I won’t click it, I know that much, so I wouldn’t do anything more than give the address to an empty wallet. I just don’t know much about BitCoin scammers and if they have any methods other than the obvious to screw me over somehow.

As long as you make sure you give them a new Bitcoin address (not one you're used in the past) there are no risks in just giving them an address.
If you give them an address you're used before, they may be able to see some of your old payment history.
A scammer could try to convince you they've paid you when in reality they haven't. To avoid that, give them the new address, check for the payment on your own wallet or a trusted blockchain explorer, and don't click links they give you to "prove" they've sent the money or believe that they've sent you money until you see the coins on your own wallet or blockchain explorer yourself.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Exodus exported private key
I'm trying to understand why I'm having a hard time at importing exodus private keys in other wallets like jaxx o scatter.
I can't understand why I don't get the public address from the private key with this script:
var bitcore = require("bitcore-lib")
var privateKey = bitcore.PrivateKey.fromString("**** exodus private key ****")
console.log(privateKey.toAddress().toString())

I'm not able either to get the address from the seed phrase by using https://iancoleman.io/bip39/ indicating bip32 derivation path to m/0/0.
Could anyone tell me what I'm doing wrong?

You are probably deriving a legacy P2PKH address (addresses that start with 1) versus the bech32 P2WPKH address (addresses that start with bc1) that Exodus uses.
A single WIF private key can generate multiple address types, other wallets and software are likely defaulting to a different type which is probably why you are having trouble. This is the same for seed phrases as well.
Also just FYI Bitcore-lib is an old outdated library and is not compatible with modern address types. The code example you provide would create a legacy P2PKH address (start with 1).

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Do the same conditions apply for the same trading pair on the same exchange in different jurisdictions?
If an American resident in the US and a Canadian resident in Canada had 1btc each and they each converted it on Binance to USDT, would they get the same result?

Yes as long as the exchanges give the same rate of bitcoin because USDT means United States Dollar tether. So it will equal one US dollar not Canadian dollar. Hope this helps. :)

No because they are in different jurisdictions. This question is off topic at this subsite and applies elsewhere.

What do you mean by "get the same result"?

@chytrik I mean would the converted USDT amount be the same in both cases?

I think your question boils down to:

Can businesses charge different prices for their services in different markets? Yes they can and sometimes do. For example, in the case of a currency exchange this might be represented as a different spread between buying and selling prices or in a transaction charge. Arbitrage limits this, especially for online services.

Can different countries impose different regulations that have some effect on retail prices? Yes, different governments might have differing rules about   either taxation or some other regulatory burden that businesses try to recover the cost of from their source of income

Does Changpeng Zhao love his compatriots more than he loves south north Americans? Probably not.

In this regard is any Bitcoin related business significantly different from any other type of financial business? Is it different from general business? Probably not as much as many folk seem to think.


text:
When, if ever, will "peak bitcoin" occur?
My (limited) understanding of bitcoin and other cryptocurrencies is that the costs of "mining" bitcoins was quite low in the early days, and the limiting factor in how fast they were mined was the small number of people who had the infrastructure to do so.  As time went on, however, the algorithms for mining bitcoins made it harder and and harder to get a new bitcoin in this way, and it is now rather difficult for anyone but the most serious miners to successfully mine a new coin.
This description of bitcoin's history makes it sound like an awful like a normal commodity such as crude oil:  it's easy to get the first barrels out of the ground, when there's not much capacity to do so;  but it gets harder as time goes on.  The net result (according to Hubbert, at least) is that there is a peak in the extraction rate of the commodity.  This is often referred to as "peak oil" in the case of crude oil.
Has anyone done a similar analysis to find out when "peak Bitcoin" or "peak Etherium" or what-have-you will occur?  In other words, in what year will the rate at which new bitcoins are being mined reach its peak?  Has this happened already?  Or is there something about cryptocurrencies that make them immune to these sorts of effects?

I've removed some comments that were needlessly unkind and debated a peripheral aspect of the question. Please keep comments constructive and nice, post follow-up questions as new topics, and post answers in the answer section, not in comments on the question.

At the beginning of Bitcoin, every newly mined block (about every 10 minutes) creates 50 bitcoins. This is called the block subsidy. About every 4 years, this number cuts in half. Therefore, the peak extraction rate was about the first 4 years of Bitcoin's existence.
In fact, it was from 3 January 2009 to 28 November 2012.
The block reward includes both the block subsidy, and the transaction fees of transactions included in the block, so miners still get bitcoins, but they are not newly "extracted" bitcoins, they are bitcoins that someone else has paid.
Note that one block is mined about every 10 minutes. The number of miners is irrelevant. The speed of the miners is irrelevant. The system automatically adjusts itself so that one block is mined about every 10 minutes. That is the only reason why mining requires a lot more computational power than it used to - you are competing with a lot more people.

Small nit: the block reward is composed of two parts: transaction fees and the block subsidy (the new coins). So when you say block reward, you may want to more specifically write "block subsidy".

It sounds like an important difference between bitcoins and a natural resource such as crude oil is that the total production rate is "throttled" by design, and that the total production rate has been slowly decreased over the years (again, by design).  So the economic forces that lead to a nice symmetric Hubbert peak for a natural non-renewable resource are obscured or overwhelmed.

According to comments by the project's founder, Bitcoin's issuance rate was indeed inspired by that of precious metals. However, it is implemented algorithmically, of course, which artificially limits the issuance rate rather than actually being an abundant resource getting consumed over time.
The bitcoin reward schedule halves the block subsidy every 210,000 blocks (~4 years) and the difficulty adjusts every 2,016 blocks (~14 days). The adjustment retargets the network to a 10-minute block interval. This process has increased the mining difficulty by more than a factor of 20 trillion since Bitcoin started.
Per the halvings, the reward schedule implements a geometric series. Each reward epoch produces half of all remaining bitcoins: 1/2 + 1/4 + 1/8 + … ↦ 1. The first reward epoch from 2009 to 2012 minted 50 BTC per block which resulted in creation of 10.5M bitcoins (again, half of the final supply).
However, we can be even more specific. Among those four years, 2010 saw the greatest increases in hash rate which resulted in blocks being found much faster than the targeted 10 minute interval throughout the year.
Blocks per year:
2009: 32,486
2010: 67,920
2011: 59,623
2012: 59,324 (subsidy halved in November)

Due to the exploding hash rate, 2010 produced 13.9% more bitcoins than 2011. So, I'd say that "Peak Bitcoin" was 2010 with 3,396,000 bitcoins created in a single year.

The question contains a brief description of Bitcoin’s history, followed by this:

This description of bitcoin's history makes it sound like an awful like a normal commodity such as crude oil …. The net result (according to Hubbert, at least) is that there is a peak in the extraction rate of the commodity. This is often referred to as "peak oil" in the case of crude oil.

So let us go through it and see if Bitcoin really is like a “normal” (physical) commodity.

[Bitcoin] My (limited) understanding of bitcoin and other cryptocurrencies is that the costs of "mining" bitcoins was quite low in the early days

[crude oil] it's easy to get the first barrels out of the ground

Correct on both counts, but for different reasons. These reasons are discussed below.
In fact, in the early days of Bitcoin, the mining cost was so low that Bitcoin Core had a user-friendly “Generate Coins” option.

[Bitcoin] the limiting factor in how fast they were mined was the small number of people who had the infrastructure to do so

[crude oil] it's easy to get the first barrels out of the ground, when there's not much capacity to do so

(emphasis added)
Incorrect on both counts:

Bitcoin: As explained in the other answers, the target rate of Bitcoin mining is arbitrarily set at one block per 10 minutes. To achieve this, the difficulty of mining a block is adjusted every 2 016 blocks (about 2 weeks).
Crude oil: The initial ease of extracting crude oil was related to the large reserves of crude oil in easily accessible locations. The lack of activity in this area was only indirectly related; this lack of activity meant that the easily extracted reserves had not yet been extracted.

[Bitcoin] As time went on, however, the algorithms for mining bitcoins made it harder and and harder to get a new bitcoin

[crude oil] but it gets harder as time goes on

Correct on both counts, but again for different reasons.
Bitcoin Core’s “Generate Coins” option did not last long. The option was removed in 2011 via pull request #142, which noted:

GUI users … are unlikely to understand upon first contact that they will waste electricity for year(s), before possibly generating a single block.

The underlying code was removed in 2016.
Why was this? Of course, as time went on, the miners collectively became better at mining, and therefore mined blocks faster than the target of one per 10 minutes, which resulted in the difficulty increasing. As the difficulty increased, new ways of mining had to be developed. Mining moved from CPUs to GPUs to even more specialised hardware. (Interestingly, miners also began chasing cheap electricity.)
As for crude oil, producers naturally extract the easiest reserves first, meaning that the remaining reserves are more difficult to extract.

[Bitcoin] As time went on, however, the algorithms for mining bitcoins made it harder and and harder to get a new bitcoin in this way

(emphasis added)
What way?

[Bitcoin] and it is now rather difficult for anyone but the most serious miners to successfully mine a new coin.

Correct. Bitcoin mining now requires specialised equipment that is generally expensive to obtain and expensive to run. The difficulty of locating, never mind extracting, crude oil has also greatly increased.

Has anyone done a similar analysis to find out when "peak Bitcoin" or "peak Etherium" or what-have-you will occur? In other words, in what year will the rate at which new bitcoins are being mined reach its peak? Has this happened already? Or is there something about cryptocurrencies that make them immune to these sorts of effects?

We can now see that these questions do not make sense, at least not in the way you thought they did. In fact, there is another problem with your analogy: Bitcoin includes arbitrary reductions in the block subsidy (the amount of new Bitcoin created each time a block is mined). This has no analogue in physical commodities.
But, in practice, we can observe when peak Bitcoin occurred, which has been covered in the other answers. It occurred during the early days of Bitcoin, when the block subsidy was at its highest and an explosion in mining capacity overwhelmed the fortnightly difficulty adjustment.


text:
Can a Ledger Nano X hold multiple Bitcoin Wallets?
From my reading of Ledger Nano X, it can hold multiple types of currency, for instance, Bitcoin and Ethereum.
Can it hold two or more separate Bitcoin wallets with different balances?

Yes, you can have multiple bitcoin wallets in ledger nano x by adding a new account
All these accounts share the same seed, but have different derivation path

If I recall, you can access different wallets by using a different passphrase, which is added to the seed phrase as a "25th word", resulting in a completely different entropy seed and different key-pairs at every index in every path.
https://support.ledger.com/hc/en-us/articles/115005214529-Advanced-passphrase-security
So you could have one passphrase with your "actual" money in it, and a second passphrase with just a couple of bucks in and out. If you are held at gun point and forced to unlock your ledger, you can enter the second password and show the attackers how broke you are :-)
Disclaimer: hypothetical dramatization only

I now have a Ledger Nano X.  When I try to add a second BitCoin Account, Ledger Live won't let me.  There is no 25th word that I can find.  So the answer to my question would seem to be "no", the Ledger Nano X will only allow one wallet per coin type.


text:
How to create a new POS altcoin?
I am looking to download a POS (Proof Of Stake) files to create my new altcoin, but all the instructions I found online is for the POW (Proof Of Work) and without any instructions for the blockchain. Can someone help please, or provide links?

Maybe you can look into Qtum's work. I am pretty sure they use the proof of stake concept. https://github.com/qtumproject/qtum

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How can extended public keys generate child public keys without generating the child private key in HD wallets?
According to the documentation on bitcoin.org and the Mastering Bitcoin book, you can use an extended public key to create child public keys in HD wallets by combining the lefthand side of the hash output of the parent chain code + parent public key + index:

The seemingly-random 256 bits on the lefthand side of the hash output are used as the integer value to be combined with either the parent private key or parent public key to, respectively, create either a child private key or child public key

I understand how this lefthand side output can be combined with the parent private key to generate the child private key, which in turn can be used to generate a valid child public key.
How is it possible that the child public key generated by combining the hash output with the parent public key corresponds to the child private key generated separately by combining the same hash output with the parent private key?
I thought that in was impossible to generate a public key without knowing exactly what the private key was. How is the relationship between child private and public keys (K = k*G) maintained when they are generated separately in this way?.

Upon a bit more searching, I found the derivation for getting the child public key without the private key here:
child_private_key == (parent_private_key + lefthand_hash_output) % G
child_public_key == point( (parent_private_key + lefthand_hash_output) % G )
child_public_key == point(child_private_key) == parent_public_key + point(lefthand_hash_output)

In terms of K, k and G where prime denotes the child and h denotes the left-hand hash output:
k' = (k + h) % G
K' = point ( (k + h) % G)
K' = point (k')
K' = K + point(h)

Here are the exact implementation details from the BIP 32 documentation

You may want to mention that point() is the ECDSA public key creation function i.e. point(private_key) == public_key.

How is the relationship between child private and public keys (K = k*G)

(a+b)*G = aG + bG

Thanks for answering! Its helpful to see how associative addition in elliptic curve math applies to generating the public key while using the private key. But I still don't understand how that generates a public key without using a private key. If a = [lefthand hash output] and b = [parent private key], I can see how that equation generates the public key, but how does that get me the child public key without the parent private key?

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Bitcoin wallet balance doesn't add up to what my addresses have
I have had a Bitcoin Core wallet on Windows for a long time. For most of this time I have been inactive. My client has gone out of sync and  my wallet sat on my computer as well as a backup on a usb stick. Recently I decided to get back into crypto, so I re-synced my client to the blockchain. Dropped my old wallet back into the client. It went through the rescan process, and to my surprise I had more bitcoin than my addressees say they have on blockchain.info.
I even decided to dump all my private keys from my Bitcoin Core wallet, and import them into an Electrum wallet to see what it would yield. And upon doing so, my lectrum wallet has less bitcoin than my Bitcoin Core wallet.
How is this possible, considering both wallets are built off the same private keys?

Are you sure that your Bitcoin Core sync was completed fully?

yes, absolutely sure

Perhaps some of your keys were used for output scripts of multiple types.

I struggled with this too. There are many other addresses created when you send/receive funds from bitcoin.
Don't just run dumpprivkey with your receiving BTC addresses; run dumpwallet to a file instead and import all keys (left-hand side of the dump file) prior to 1 Aug 2014 to Electrum.cash wallet.

Partially inaccurate.


text:
How can I circumvent an “Unable to open channel, funding amount is too large” error?
Getting this error when trying to open a channel with an existing peer:
Unable to open channel, funding amount is too large, the max channel size is: 0.16777215 BTC

Where is this limit set up and why is there?
Is there a way to allow the creation of a 'large' channel?

If you have the same/similar issue check if protocol.wumbo-channels=true is under the protocol section of your lnd configuration file:
[protocol]
; // If set, then lnd will create and accept requests for channels larger than 0.16 BTC
; protocol.wumbo-channels=true

If not there, this look is a default setting in LND nodes, to change this settings you need to add protocol.wumbo-channels=true
$ sudo vi /mnt/hdd/lnd/lnd.conf

Then you need to restart LND
$ sudo systemctl restart lnd

You can keep an eye on LND logs as it restarts
$ sudo journalctl -f -u lnd

YOU HAVE TO WAIT A FEW MINUTES BEFORE TRYING AGAIN TO OPEN A CHANNEL AS YOUR LND WILL HAVE TO RECONNECT TO ALL ITS PEERS *

Then open your faaaat channel


text:
Is there anything I can do to speed up the synchronization of litecoinj?
I am using litecoinj which is forked from bitcoinj but compared to bitcoinj, the wallet creation and block synching is slow when using litecoinj. So, I searched for a solution and found a post that suggests to download checkpoints in a file and pass the file while creating wallet, but I guess it's not working.
kit.setCheckpoints( new FileInputStream("checkpoints"));

How can I speed up the syncing of litecoinj?

So after digging I got the solution, using this kit.setCheckpoints( new FileInputStream("checkpoints")); it was checking the file in the same package so to provide the exact path I have used
kit.setCheckpoints( ReadProperties.class.getClassLoader().getResourceAsStream("checkpoints"));


text:
Where do I find my bitcoins after buying from an ATM?
I don't know where to find my bitcoins. I have a receipt from the ATM:  and the transaction is confirmed:

When you purchase bitcoins at an ATM, you have to provide a destination where they'll deliver the bitcoins. Recipient information is provided in form of addresses. The receipt shows an address to which the ATM delivered the bitcoins. As pointed out by other answers, the bitcoins were actually sent to that address.
The question is now, how did you provide the destination address for the purchase? Did you perhaps show a QR code from a wallet on your phone, or had a printed QR code that you got scanned by the ATM? The bitcoins would have been received to the corresponding wallet, e.g. on your phone if it was a mobile phone wallet.

Yes i opened app from phone & then scanned qr code provided to me from bitcoin wallet & scanned to atm. But i still have no coins??

Are you sure the address was your own and not that of a previous business partner of your? Was the address that you scanned one of your own "receive addresses"? What do you see when you log into their web interface?

You can't do anything with the adress. Are there any other codes on the receipt? If so, download https://electrum.org/#home and try to import them on there.

Yes i have a transaction id:

Do you have access to this address?
If not, then you bought someone else some bitcoins.
https://blockexplorer.com/address/1LacZjntH84Ap6FPEkb5UBxpZqjH9dw7F4

Yes i have the qr code provided by blockchain & yes i did open app from my phone & scanned qr code. So idk where or why coins arenr showing up in my wallet?


text:
Transfer incoming funds from Bitcoin Core to another wallet before blockchain sync is completed
This is my situation:
I have a Bitcoin-QT wallet on my Mac (Qt version 4.7.4.- yes I know its very old). only recently I've been working out how to operate and exchange bitcoins. well to cut a long story short i went to bitbargain.co.uk and bought an mbtc, managed to completed the transaction with relative ease and saw the bitcoin in my Bitbargain.co.uk account.
I then decided to transfer this purchase to my wallet on my Mac and did so but entering a received address on the bitbargain account page. I waited and waited and have not seen the bitcoin come through on my Bitcoin-qt wallet.
It looks like there is a lot of syncing to do! only 45.65% complete, needs to catch up around 1720 days, this I estimate will be around 2 months if not more? that is if it actually completes?
My question is this, is there a way to move this purchase to another wallet I have, without having to let this wallet sync 100%? as the time frame required is very uncertain?
Can i transfer a bitcoin from bitcoin-qt to another wallet even though it is not showing up in my wallet becuase it is 1720 days out of sync?
Thanks for the help with this guys!
Best
FT

Closely related: https://bitcoin.stackexchange.com/q/6056/5406

After watching more than 100 videos, because I couldn't find a solution here, I was able to regain access to my BTC successfully from my old QT wallet without synchronizing the 310GB of blocks.  The solution is to import the private key of your old bitcoin-QT into a new Electrum wallet (this happens without fee):

Install from Electrum.org and create a new Electrum wallet  choosing the option "Import Bitcoin address or private keys"
Install from Bitcoin.org and create a new Bitcoin-Core wallet.
If Bitcoin Core is already open, stop the main sync in the lower right corner.
Turn off Bitcoin Core. Go to C:\User\yourname\AppData\Roaming\Bitcoin\wallets\your new wallet\wallet.dat
Obviously, this new Bitcoin Core wallet was never used, so delete the wallet.dat file
Paste your  old-wallet.dat file (the one you backed up years ago from your bitcoin QT), rename the pasted old-wallet.dat to wallet.dat
Open Bitcoin Core again --> hide --> stop synchronization (bottom right) --> Window --> Console --> Type below the command dumpprivkey and the old public address --> Enter.
When your private key appears, copy it. (In my case it didn't ask for my old passphrase.) Now go to your new Electrum wallet and paste the private key in the "Import Bitcoin address" box -> Next.
(do it in private and without cell phone cameras).
Now enter a new password twice and accept the wallet encryption.
Ready, now you have access to your BTC (with the same old public address) to spend or send them wherever you want,   but since your private key is exposed, I recommend you send them as soon as possible to a new destination that is safer (even if you have to pay a fee this time).

Hi AndreH, welcome to Stackexchange, thank you for taking the time to share your research! Am I understanding right that these are the instructions for Windows?


text:
Why can't I minimize to tray when I launch Bitcoin on startup?
If I set Bitcoin Core to start on system login, the option to "Hide tray icon" and "Minimize to tray" become disabled. On my system (Pop_OS!) This causes bitcoin-qt to be neither on the system tray, nor in the taskbar when I minimize it, and I don't know how to make it show again.
Is there any reason for these options to be disabled?
How can I make it show again in this scenario?

See "Compatibility" under https://bitcoincore.org/en/releases/0.21.0/ - if you can repeat this under Ubuntu it might be worth reporting to BitcoinCore . If unable to reproduce under Ubuntu I'd report it to Pop_OS.

This occurs when Qt (the GUI library Bitcoin Core uses) detects that there is no system tray available. I don't know how you would resolve that, but it is a starting point for further research.


text:
Why search for a nonce linearly (+1) vs searching only even or odd nonces?
As a solo miner, you have the disadvantage of a minuscule hash rate compared to mining pools. Is it not possible to searching for only even nonces? Of course you risk the chance of missing the nonce, but you gain an effective 2x hash rate.
I wonder how this or other nonce searching methods might impacts your chance on average.

What if you search downwards for a nonce?
Skipping (even, odd, every third, etc).

A 2X rate with a 50% chance of missing a winning nonce is no advantage at all. Incrementing the nonce is the easiest mechanism of choosing the next nonce to try, so you try the most nonces per second that way. That's all that matters.
Perhaps you are under the mistaken impression that everyone is trying to mine the same block. That is not so. If you are a solo miner, you are the only one trying to mine a block that pays you the block reward. Nobody else is trying to mine the same block you are, so all that matters is how many tries you are able to accomplish. You aren't racing anyone else. If someone else finds a block, you don't care if they found it before you did or after you did (except in very rare instances where you both find a block at very close to the same time), you found a block either way.

I see, so a solution in a mining pool instance is just as rare as a solution found solo mining? For some reason I was under the impression that there was some partitioning within a mining pool.

@aitee Mining pools intentionally give you easier problems to solve so they can measure your hash rate. But finding a block is the same.

Do you know of any information/documentation that contrasts pool mining with solo mining (from a technical perspective)?

You should see the Stratum protocol specification. This is the protocol used for communication between miners and pools. Althougth the protocol is not entirely specified anywhere, you may find some usefull information. You could also review the code some open-source pools (for example the UNOMP node merged pool).

You need to find any nonce, so that the block becomes valid.
It is of no regard, what algorithm you are using to chose a nonce, as long as the block meets or exceeds the difficulty target.

Alternative algorithms used for choosing the next nonce to hash will not improve upon a simple integer increment. You will still be checking the same number of hashes per second.
An increment of two instead of one will not double the hash rate. The hashing rate will be equal in both cases.

I understand it doesn't really change the rate. But if the solution happens to be near the end of the range, you would reach it at twice the rate because you are only checking half of the numbers.

@aitee Or you miss it entirely because you're only checking half the numbers.

Is it not possible to searching for only even nonces? Of course you risk the chance of missing the nonce, but you gain an effective 2x hash rate.

Yes. It is of course possible. You are allowed to modify the whole mining software if the resulting block is a valid bitcoin-block. But you don't gain a 2x hash rate. It doesn't make any difference wheather you try all numbers between 0 and 29 or you try all even numbers between 0 and 59 because they are still only 30 numbers.

What if you search downwards for a nonce?

As I said: You could do that. But it doesn't make any difference in average. The normal case: The difficulty is very high. So you need to try all the nonce-numbers (0-4.294.967.296). If no one else mined the block, you can change the timestamp or modifiy the coinbase-text and try all the nonces again and again because the hashes will be completly different then.

Skipping (even, odd, every third, etc).

There is no advantage. It's actually a little disadvantage because you need to calculate nonce++ 2 times instead of 1 time or you need to do the if statement if(nonce%30==0) or whatever instead of doing nothing. So you would waste energie, time and mining power instead of hashing a block.

Regarding your last paragraph: jumping by two can be implemented by nonce += 2. This would typically turn into a single instruction, in fact the same one used to implement nonce++ except with 1 replaced by 2. So in that particular case, there is no disadvantage in execution time. Of course an if statement would take extra time but that's a rather inefficient way to do it.


text:
Why does my bitcoin "to US dollar" worth change when the stock market is closed?
My bitcoin wallet "US dollar" amount is changing. It's Saturday the market is closed. How is this happening?

To my knowledge, bitcoin is not traded on any stock markets.  It is traded directly on exchanges specialized in cryptocurrencies.  These exchanges don't necessarily close, and therefore trades are always occurring.
Your wallet is reading the price feed from one of these exchanges (you can probably configure which one if you look at the settings), and is therefore getting updates about the going rate on that exchange.  Whether a stock market is open or closed it's irrelevant.

Bitcoin is not a stock. It's a decentralized currency and its markets are open 24/7.


text:
Why is it hard to fake proof of work?
Does someone understand this?

"Because of all this work, when a Bitcoin client signs on to the network it can trust the block chain that was most difficult to produce (since this is evidently the one that was being worked on by the most miners). If there was a "fake" blockchain competing with the real ones (say, where someone pretends that they didn't actually give Sofia those 8.4 bitcoins and they still have them), the fraudster would have to do as much work as the whole rest of the network to make their block chain look as trustworthy. So essentially, the intense work that goes into finding blocks through hashing secures the network against fraud. There is also, of course, some nifty code that figures out how to choose between conflicting transactions; and what to do if two people find valid blocks at the same time."

Yes, I'm sure someone understands this.

For each new block to be fixed to the end of the blockchain, a mathematical puzzle must be solved. In simple terms, the block is hashed, along with a hash of the previous block and a 'nonce', to create a new hash. The nonce can be thought of as the 'solution' to the block. It is a value such that, when all the information (previous hash, transactions and nonce) are hashed together, the resulting hash is below a certain value. (You can see that all the hashes of blocks have a long string of leading zeroes.)
The aim is for a new block to be completed every ~10 minutes, so the network agrees on a 'hash threshold'. The more computers that are competing to find the nonce, the lower the threshold becomes. How many computers are competing is gauged by whether blocks are regularly found in less than, or greater than, ten minutes on average.
So if your Bitcoin client finds a long blockchain, where each nonce is found according to a low threshold, it can surmise that a lot of work has gone in to creating that blockchain.
Even if another blockchain of the same length existed, for it to have such 'rare' hashes a lot of computer time would need to be dedicated to its construction. The longer the (real) blockchain gets, the harder it is to construct one that is equally long and has equally low hashes for each block.


text:
Is it possible for a country to control Bitcoin usage?
Imagine that I run a country named "MyAwesomeCountry". I accept Bitcoin as a currency that can be legally used to buy things and also pay taxes.
Then I say that there are some bad guys (let's name them "errorists") and say that if that known that some address is used by an errorist is will be blacklisted, so will be any future recipient from that address.
Then I build an information system to track and blacklist any addresses that received bitcoins from already blacklisted addresses. All that information is open and anyone can check any address to make sure if it's not blacklisted.
If someone is caught buying something using bitcoins from a blacklisted address s(he) will be put in jail.
So, none of the money that I don't accept can be used in MyAwesomeCountry. Then I can extend prohibitions not only to errorists but on other people (e.g. prohibit bitcoins of some organizations that I don't like). Then after some time, I can prohibit any bitcoin addresses that are not registered in my governmental databases.
So from now, I control bitcoins in my country like any other money.

Is it possible for a country to enforce blacklists/whitelists as described?
Can that be a problem for the citizens of MyAwesomeCountry?
If yes, what can people do to prevent such things from happening?

yes and yes. If you control down to the level described, it is possible to black/whitelist on known addresses, and for sure cthis can be a problem for the citizens. People can use Bitcoins to prevent these things from happening, cause it has several layers of circumventing this. Adress re-usage, conjoins (or mimblewimble), exchanges in foreign countries, localbitcoins... there is many options. I think this post is having interesting assumptions, and is highly speculative, and as such does not fit in reality.

I'm voting to close this question as off-topic because there are many assumptions making it highly speculative to predict the future.


text:
If I reuse the same address can a previously used transaction be reused?
I was wondering, if I used an address adr0 to spend some coins in a transaction tx0 that give the coins to a different address adr1, and eventually, after some time, I receive some (completely unrelated) coins to the same address adr0. Can somebody take the transaction tx0 I signed and publish it in order to spend the new coins with the old transaction? (after all, they belong to the same address, and I already signed and gave a transaction that spends coins from this address).
If so, how is it that address reuse is not directly forbidden?
if not, can you detail why?

Can somebody take the transaction tx0 I signed and publish it in order to spend the new coins with the old transaction?

No.
Firstly, the transaction inputs are already known to have been used. Any node examining the block will know that the rerun transaction has invalid inputs.
Secondly I expect (but haven't checked) the inputs to the signature include both addresses. This prevents the signature being misused in the way you suggest. (See Murch's clarification in comment below)
It may help (if not you, some other readers) to remember that bitcoins don't exist outside or inside the blockchain. The only thing that exists are transaction inputs and outputs. You can't use a signed transaction with inputs A,B and C to use inputs D and E. The signature prevents you altering the signed contents without invalidating the signature.

how is it that address reuse is not directly forbidden? if not, can you detail why?

Addresses can be reused. The most obvious problem is one of privacy. If you give someone an address so they can buy $0.01 of tent-pegs from you, they can then see on the blockchain that you also received $300,000,000 recently to that address and go buy a big hammer and come to visit you at 3 a.m.

Small note: privacy is not the only concern, though perhaps it is the most pertinent. Having multiple signatures from the same privkey could potentially weaken the security assumptions of asymmetric key cryptography— though no current attacks are currently known, it is not impossible that one will be discovered in the future. This is a small worry that could be fixed if needed, but worth mentioning.

Do note that there is a small edge case, where if a transaction is signed with SIGHASH_SINGLE, but the vin given is outside the bounds of the transaction, that signature is valid for any transaction output to that address, past, present, or future!

It may help to clarify that the utxo is identified uniquely via the outpoint. Strictly speaking the signature doesn't commit to the address of the input, but only fulfills the corresponding output script the funds were locked to. In the case of P2PKH this happens to reference the address to identify the intended spender. ;)

For this you should take a look at a system called "unspend transaction outputs" (utxo).
This system works as follows:
Every transaction consists of one or more inputs and one or more outputs. The input specifies, where the money came from by referencing a previous output. And the output describes who and/or how the money can be spend.
So when you sent the coins in tx0, you spent the output, in which you received the money in the first place. As this output is now spent, it cannot be referenced again. And following from that, your previously used tx0 which was signed by you cannot be used again. It would be invalid because it tries to spend an already spent output.
For the reasons why you shouldn't reuse addresses, see this


text:
Transaction has 100 confirmations but it's not being shown in my Exodus wallet
I have sent a transaction to my Exodus wallet but it isn't being shown there. The transaction now has more than 100 confirmations. What does mean when it has a lot of confirmations but doesn't show up? What I can do to return it? Is there anything can I do ?

Can you provide a receiving address the funds are confirmed at, or a tx ID? If the tx is confirmed (100+ blocks deep), and Exodus is showing you the correct receiving address (that the funds have been confirmed at), then it sounds like the Exodus wallet is not properly in sync with the network.

address: 1UyoYU6kTD7uuZK6vXEpNiVNN66X9WNj6                                       actually Exodus show me nothing, there is no transaction.

the address indeed shows funds, but your wallet doesn't. So the link between the private key and the address is broken. There is no way to "calculate" a link between these two, otherwise the entire bitcoin system would be broken. So you might need to double check, what addresses are really included in your wallet, and compare them one by one. Maybe there was a typo, when providing the address to the sender? Also you may ask the person you sent the funds to, if it is really "his" address...

I can't see the transaction on exodus wallet to compare it. can I use this address to send it to another wallet or it may cause another problem ?

The address 1UyoY... is currently funded, so the transaction did indeed go through.
If Exodus wallet shows you 1UyoY.. as a receiving address but no current balance, then your wallet is not in sync with the network.
If you cannot get Exodus wallet to sync with the network properly, you could try exporting the seed phrase / private key from Exodus and import it into some other wallet software.
Bottom line: the bitcoin are sitting at that address, so if you have the private key to that address, you just need to find some software that will properly sync with the network so that you can spend the coins.

thank you. I have a recovery phrase, is that what you mean ? can you please tell me for example which software I can use to do that ? I want to say also when I get the receiving address from Exodus nothing registered after that. the wallet is empty. no funds and no receiving transactions registered.


text:
Why isn't bitcoin itself its own ledger?
Sorry if I'm asking a very daft question here, bitcoin newbie.
When I first heard of bitcoin, I thought bitcoin itself kept a record of who had spent it and when. I didn't know the blockchain was a decentralized ledger, in fact ledgers were not in my radar at all. I somehow simply thought that a bitcoin was an object (or an object instance) where it itself knew who it belonged to. So for instance it would say: "This coin now belongz to Alice" and when Alice spent the coin to send to someone else like, Bob, the coin itself would modify itself to say: "This coin now belongs to Bob".
Why hasn't anyone yet written that, or why wasn't it written like that, and why wouldn't that work better than a bunch of decentralized ledgers/blockchains? Why couldn't you make the coin itself be its own ledger?

There is inherent problem with digital assets, namely they can be perfectly copied.  Until Bitcoin came along, there was no decentralized solution to digital scarcity.  If you wanted a digital asset to be unique, you had to rely on a central authority who kept track of who owned the "real" one.  Think of a piece of software that you were asked to register with the company.  That's how digital scarcity used to work.
Bitcoin solves the problem by creating a single, public ledger that is copied between nodes on the network.  A protocol was defined for the nodes to use in order to come to consensus on the state of that ledger.  This protocol has some ingenious protections against malicious use.  Specifically, the proof of work component makes it fiscally unviable to "cheat" for a sustained period of time.
Encoding an owner into the digital asset itself, does not solve this problem.  Let's pretend a bitcoin was like a file that you can store on a hard drive (it's not, btw).  Let's say Bob has one that has encoded in it some ownership indicator that says "I belong to Bob".  Let's even suppose that this indicator was cryptographically signed by whomever gave the bitcoin to Bob.  What stops Bob from making 10 million copies of his one bitcoin?  If he did so, it would be cryptographically signed by the person who gave it to him, and Bob would have the ability to sign each one over to someone else.

In the case of my "system", you would prevent copying by generating a
  unique random seed based off the keys of the two agreeing parties.
  Kind of like normal serial numbers in paper bills now, ensuring each
  two-party coin transfer agreement has a unique id, hence cannot be
  copied.

You are incorrect; it could still be copied.  The end result is still copyable, and it would do no good without an authority to verify the unique number with.  If Alice gave Bob one bitcoin, digitally signing it with a unique random number agreed by both parties, and then Bob made millions of copies, who would ever know?  Bob can pay Charlie and Dave with copies of the same coin, and neither would be any the wiser.  This would require a central authority that knows about the Alice->Bob transaction, as well as the Bob->Charlie and Bob->Dave transactions.  Recipients of payments would have to verify with this authority in order to be able to trust Bob.  This solution solves nothing.

How would you know the bitcoin changes ownership? Bob must (digitally - that is cryptographically assured) sign the coin now belongs to Charlie. And to prove that Bob was the owner he must provide Charlie a signature from Alice (the previous owner) that he was given the ownership. This ownership chain must be provided up to the original owner.
This is also what bitcoin does!

The question is: why is that not enough, but you must also have a unique main store (known to everybody) of all ownership chains of all coins (the blockchain)?
Notice that the above described model would allow Bob to double spend the same coin, once to Charlie and once to Dave and give each of them the proof Alice gave him the coin. They would have no idea Bob tricked them.
So all ownership changes must be tracked somewhere, and know to everybody, to assure there are no double-spends of coins.

I don't get it. I don't see why Bob has to prove to Charlie he was the owner when the coin itself already says: "I belong to Bob". The fact the COIN is saying it belongs to Bob is proof enough. And to transfer ownership all you really need is to sign your coin off to Charlie and Charlie sign off that he received it. Then the coin simply says: "I belong to Charlie". Whether the coin first belonged to Alice or Dave or Zaphod Beeblebrox doesn't matter, does it?

With the system as I'm describing, where the ownership record is embedded in the COIN itself, in fact, not only is there no double spend, but there's also no way of stealing coins, because the COINS know who they belong to. Not you. The coins.So if I take Alice's coins and try to give them to Dave, all Dave has to look at is the coin's ownership record and see that the coin says: "I belong to Alice", and see that it does not belong to me, thus rejecting the transaction.

But the coin is not physical entity. It is a sequence of bits so it can easily be copied. So Bob can make 10 copies of a coin and then change the ownership of each to M1, M2, M3, ... and give each copy to respective person.

But that's the thing. You can't change the ownership unless there's cryptographic agreement by TWO parties. You, and the person you're giving the coin to. It is like a two-way contract, or a lockbox with two keys. Without the key of the owner and the receiver, the coin doesn't change ownership. As for copying, well, what prevents me from copying a bunch of bitcoins now? I could flood the network with a bunch of fake coins and attack the network to see if they get accepted before the other nodes check their ledgers, no?

In the case of my "system", you would prevent copying by generating a unique random seed based off the keys of the two agreeing parties. Kind of like normal serial numbers in paper bills now, ensuring each two-party coin transfer agreement has a unique id, hence cannot be copied.

No you cannot attack bitcoin that way. Why is a question in itself. If your coin contains a serial number (based on the ID of current and previous owner), previous owner can copy its coin and with each party he sends one copy create a separate serial number. Then each new owner will have own copy of coin with own serial number.

Ok, I get it. But couldn't someone write some super clever software that whenever you make a bitcoin it has something that prevents it from being copied? Like how do they protect CDs and stuff? I dunno. It all seems very mysterious to me. I shall think about it. Thx for the comments.

CD's are not protected from anyone with even a casual understanding of how their "protection" works.  The entire concept of DRM is cryptographically flawed.  DRM is basically the manufacturer encrypting content, and giving the key to the customer.  The problem is that the customer is also the attacker, who is trying to gain access to it.  If you want to play a CD, you need the key.  Therefore they give the key to everyone with a CD player.  It's not exactly protected if everyone has the key.


text:
senting wrong address from BCH to BTC address PLEASE HELP!
please help me I am New to this please show me step by step how to recover the lost coin let me explain.
First I used Trezor wallet sent bitcoin(BTC) out convert to bitcoin cash(BCH) using shapeshift.io, however the received address I input BTC received address instead of BCH address so I email shapeshift and asking to recovery my lost coin, they emailed me and say they're nolonger access to my coin to recover it, so they sent me a LINK (https://blockdozer.cominsight.tx.......) ask me to extract the coin using your private key...
please show me how, Im lost...
thank you so much..

Just did the same blunder. Spent the better part of the day working around it.
In my case I sent bitcoin cash (BTH) from Coinbase to a mycelium wallet.
Here is how I recovered the funds.
First installed on my phone a wallet that supports BCH (mycelium is working on that, but even though I installed the mycelium bitcoin cash module app, no new app appeared and nothing changed in my existing mycelium app).
The wallet of choice was Coinomi.
Then I used the 12-word BIP39 mnemonic to restore the mycelium wallet into coinomi and also added Bitcoincash support (upper left corner, tap burger menu, bottom has +COINS where you add supported coins to see in your dashboard).
Afterwards, went on my PC (needed PC screen to scan a QR code with the coinomi app) to https://iancoleman.io/bip39/ and typed again my BIP39 mnemonic. Then scrolled down to Derived addresses. Looked up under column Address the BTC public address to which I had sent the BTH and ended up with this mess in the first place. Hovered mouse over Private key value corresponding to the BTC public address that received the funds. This showed up a QR code.
Back to coinomi, clicked the QR scan icon and in Ian Colmen's BIP39 page I scanned the QR of the private key mentioned above.
Happy ending.
Link to github issue for reference.


text:
What is the definition of an inactive channel?
On the Lightning Network, after how much time since the last received channel update is a channel considered inactive?

If you look at the channel_update message of BOLT 07 you will find that a node

MAY create and send a channel_update with the disable bit set to 1, to
  signal a channel's temporary unavailability (e.g. due to a loss of
  connectivity) OR permanent unavailability (e.g. prior to an on-chain
  settlement).

MAY sent a subsequent channel_update with the disable bit  set to 0 to
  re-enable the channel.

This means that if you shutdown your node correctly the node or the peer will set the channel to inactive and send a channel message. In particular there is no time(out) encoded to the protocol.
If your node stays online and the TCP-connection stays alive the channel won't become inactive.
If your node dies the peer might send an inactive message. However from the specification it is not clear when and how this will happen.
In general it is considered to be a good practice to shut down your node properly and send out the fact that the channel is inactive so that others won't experience unnecessary routing errors. I think lnd will start collecting statistics about failed routing attempts and locally start to rank nodes by their reliability. While planned downtime is also not as nice as constant uptime it will certainly not downrank your node as much as discovered downtime during routing attempts.
Sorry that this answer might be not as satisfying as you hoped for. Another way to approach this would be to look at the implementations and check when and how they send channel_update messages. For example in c-lightning the send_channel_update function is called 5 times. in Most cases to activate a channel. I can only find 2 cases in which the channel might be broadcasted to be inactive:
static void maybe_send_shutdown(struct peer *peer)
{
    u8 *msg;

    if (!peer->send_shutdown)
        return;

    /* Send a disable channel_update so others don't try to route
     * over us */
    send_channel_update(peer, ROUTING_FLAGS_DISABLED);

    msg = towire_shutdown(NULL, &peer->channel_id, peer->final_scriptpubkey);
    sync_crypto_write(peer->pps, take(msg));
    peer->send_shutdown = false;
    peer->shutdown_sent[LOCAL] = true;
    billboard_update(peer);
}

and:
static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown)
{
    struct channel_id channel_id;
    u8 *scriptpubkey;

    /* Disable the channel. */
    send_channel_update(peer, ROUTING_FLAGS_DISABLED);

    if (!fromwire_shutdown(tmpctx, shutdown, &channel_id, &scriptpubkey))
        peer_failed(peer->pps,
                &peer->channel_id,
                "Bad shutdown %s", tal_hex(peer, shutdown));
    ...

The last one handle_peer_shutdown is the regular shutdown the first one maybe_send_shutdown seems to be called at three points in the code. It can be traced down from there to see if there are any special circumstances at which the channel is broadcasted as inactive.

So the inactivity of a channel is generally something that is announced from the remote node, not something that your own node assumes, right?

The common case is that you would deactivate your channel / node before shutting down by sending that message. If your peer detects it the peer can also send out the channel_update for the remote note / the channel

The timestamp field is used by nodes for pruning channel_updates that are either too far in the future or have not been updated in two weeks; (BOLT #7)


text:
What happens if a transaction does not signal replaceability but spends an output from an unconfirmed RBF transaction?
What happens if a wallet spends an output of an unconfirmed Opt-In Replace-by-fee (BIP125) transaction, but does not flag the spending transaction as Opt-In Replace-by-fee?
Receiving wallets would see that transaction as a non-RBF transaction, while it actually is, because its parent can be replaced, making the child transaction replaceable.


text:
Purpose of the LN transaction description
According to Bolt 11, an invoice may contain a short description. However, what I fail to understand is who is sending this information to whom.
Since the invoice is usually generated by the payee, I'd argue that the short description is some information for the payer, like "Purchase: Product A, Product B". However, I've seen Lapps like tip boxes, where it is the payer who creates the message for the payee.
Or is the idea that the payee could propose a description, but the payer could then change it as he wants?

I believe it is to explain the "purpose of the payment" as described in BOLT11:

Short description of purpose of payment (UTF-8), e.g. '1 cup of
  coffee' or 'ナンセンス 1杯'

This would be the payee letting the payer know what they are paying for, e.g. in case there are multiple outstanding invoices, just like any normal invoice outside of LN. Like you said, it's perfectly reasonable for the payer to suggest a description, and would probably be preferred in some cases, so the payer knows the payee has agreed to the purpose of the payment and is expecting it.


text:
Being offline: when do other nodes close channels?
If my lightning node goes offline, how long will it take until my counterparty nodes close the channels they co-own with me?
This is obviously up to the counterparty nodes, as they can choose individually when they want to close channels, but what are the default settings for the main implementations?

A Lightning Channel does not have any requirement as to when to close the channel, as specified by BOLT. It is entirely decided by the user, and the implementation. For the case of lnd, whenever the user wants to close the channel, he will call
closechannel trying first to perform a cooperative close, unless specified otherwise:
Name:     "closechannel",
Category: "Channels",
Usage:    "Close an existing channel.",
Description: `
Close an existing channel. The channel can be closed either cooperatively,
or unilaterally (--force).

A unilateral channel closure means that the latest commitment
transaction will be broadcast to the network. As a result, any settled
funds will be time locked for a few blocks before they can be spent.

In the case of a cooperative closure, One can manually set the fee to
be used for the closing transaction via either the --conf_target or
--sat_per_byte arguments. This will be the starting value used during
fee negotiation. This is optional.

To view which funding_txids/output_indexes can be used for a channel close,
see the channel_point values within the listchannels command output.
The format for a channel_point is 'funding_txid:output_index'.`,

Even when calling closeAllChannels , being that counterparty node offline, the shell prompts to the user before unilaterally closing the channel:
        // If the channel is inactive, we'll attempt to
        // unilaterally close the channel, so we should prompt
        // the user for confirmation beforehand.
        if !channel.GetActive() {
            msg := fmt.Sprintf("Unilaterally close channel "+
                "with node %s and channel point %s? "+
                "The closing transaction will need %d "+
                "confirmations before the funds can be "+
                "spent. (yes/no): ", channel.RemotePubkey,
                channel.ChannelPoint, channel.CsvDelay)

So lnd does not automatically close channels after some time?

no, this is not required by design. Users would have to agree to this.

this would however happen in Duplex Micropayment Channels


text:
I have mistakenly sent my LTC to (M) address instead of (3) address
I have mistakenly sent my litecoins to (M) as the starting letter of the address, whereas the Litecoin address now has changed to (3) as the starting letter. So can anyone help me to recover this?

Litecoin was having issues with users confusing Bitcoin and Litecoin addresses. To that end, they introduced a new address format for Pay-to-Script-Hash (P2SH) addresses. This new address format encodes the address with an M prefix rather than the original 3 prefix which is also used by Bitcoin's P2SH address format.
As any underlying address can be expressed in either address format, each address with an M prefix has an equivalent address with a 3 prefix. They simply are two different encodings of the same P2SH address.
Check out the address in question on the CryptoId block explorer for example:

When you search the address in question on this block explorer, you should be able to see both the M address that you meant to send to as well as the 3 address that your address now changed to, just like for the random example in the image.
 A transaction output will arrive in the same wallet with either of these two addresses given as destination.

Litecoin addresses have not changed to (3). its just SegWit address.
if you've sent funds to (M) Address so the receiver should have it now.

Adresses that start with M or 3 are not Segwit, but P2SH. ;)

Yeah :D, I don't know why I always fail with this mistake, Maybe because P2SH addresses start with 3 as Segwit

Well, there are two types of segwit addresses: Native segwit has its own address format (Bech32), and the earlier one more widely deployed is actually P2SH-P2WSH, i.e. a witness script wrapped by a P2SH, so it's not strictly false, it's just that these segwit addresses are a subset of all P2SH and the other segwit addresses aren't P2SH at all. ;)


text:
Is it possible to get rid of mining pools and therefore get a truly decentralized bitcoin?
There are some criticism that PoW of bitcoin and ethereum protocol suffers from the centralization of mining pools, and dPos such as EOS claimed to be more decentralized in practice than bitcoin and ethereum even it only has 21 block producers.
My question is, is there any possibility to get rid of large mining pools centralization? Ethereum tried to make the hashing algorithms ASIC hard, but it seems that it doesn't do any better.

There's a group of us working on a new iteration of p2pool based on braids (a DAG-chain) and mining into payment (Lightning) channels.  Like p2pool, each miner would construct his own block, and provide commitments/proof that payouts from the share-chain will be made to the appropriate Lightning channels (probably using "channel factories").  Braids solve incentive problems due to latency, and payment channels allow for small payments to a large number of miners without having those payouts compete for block space. p2pool is all but dead for a number of unfortunate reasons...among them is that it actually punishes latency more harshly than the underlying blockchain, and a widespread (incorrect) perception that people were making less money on p2pool.
To answer your question, yes it's most definitely possible to get rid of centralized mining pools, but there's lots of work to be done.  Such a pool could in principle execute the selfish mining strategy for pool members if it had enough hashpower (without reducing the security of the chain).  This would cause centralized pools to be less profitable than the decentralized pool, and economically encourage everyone to join the decentralized pool.
There's also a concept of pooled-solo mining which as far as I know has never been implemented, though the idea is from 2013.
Join us on irc.freenode.net in the channel #braidpool if you're interested in working on this.

Ethereum is ASIC resistant. 2x gain of ASIC vs GPU in my opinion is still beeing ASIC resistant. An algorithm that has the same performance with ASICs, GPUs and FPGAs is the perfect algorithm because it gives miners freedom of choise for their hardware. A combination with the right balance between PoW and PoS could lead to an almost perfect decentralization. Pure solutions like PoW only or PoS only are bad because "PoW only" leads to mining and pools centralization while "PoS only" is not secured mathematically, it's like buying magic the gathering's cards. Decred has both PoW and PoS but it's not ASIC resistant so in my opinion this project missed the point.
Bitcoin never fought this battle this is way I think that sooner or later it will perish while other projects are frenetically looking for a robust solution.


text:
Do bitcoin or crypto assets impact the total supply of money in a country?
Bitcoin like crypto asset are invisible coins or on boarding coins that have the implicit value and intrinsic values but accepted as legal tender currencies in India by RBI.

I think this would be a better question on economics.SE.  It is interesting, does gold mining increase the money supply?  That works as a functional means to transfer value in the US.

It does not mean how much we have gold mines as bullion.I am asking about gold bullion market.Instead it,I want to explain about the exchange value of gold in our Reserve bank of India.That the gold reserve held by the central bank against the printing of legal tender currency.Gold mining and mint cost are both different  in meaning.Gold standard is although invalid in our monetary system but the prevalence of freely floating exchange rate and purchasing power parity theory has been adopted in present day monetary system.Gold reserve act as a differed payment in exchange market as well as PPT.

Do bitcoin or crypto assets impact the total supply of money in a country?

They must do in practical terms, just as the use of foreign currency does
However, though not an economist, I suspect economists most often report on the money supply of a single government-mandated currency. This would be a question for an economics stack exchange website if one exists.

accepted as legal tender currencies in India by RBI.

Not so far as I can see
https://www.rbi.org.in/commonman/English/Scripts/PressReleases.aspx?Id=2152

The Reserve Bank of India advises that it has not given any licence / authorisation to any entity / company to operate such schemes or deal with Bitcoin or any virtual currency. As such, any user, holder, investor, trader, etc. dealing with Virtual Currencies will be doing so at their own risk.

Legal tender
The phrase "legal tender" has a special meaning, at least in jurisdictions following the UK model - it determines what forms of payment can be legally used in settlement of a debt. A shopkeeper can refuse legal tender offered for payment for goods or services  where there is no established debt.

The bit coin is a virtual currency ofcourse.As,l am not confirmed about latest RBI information.Although,it is not accepted as legal tender currency but it is considered as legal in circulation among the stake holders.So,I am sorry about this wrong information.However,the bitcoin never contribute in total supply of money of a country.Because total supply of money in our country consists of M1, M2,M3 and M4 but this bitcoin is not included among theses four category of money.

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
Transaction Fee in Confidential Transactions
Is there any transaction fee for Confidential Transactions in the Liquid Network?
In the UTXO model, Alice has 10 btc. She sends 1 btc to Bob, 8.999 btc as return change, and 0.001 as fee.
Input :  10     btc (Alice)
Outputs:  1     btc (Bob)
          8.999 btc (Alice)

The remaining balance of 0.001 is considered the fee but not recorded as a transaction output.
Is this the same for Confidential Transaction?
Input : C1 = Commit (10btc)
Output: C2 = Commit (1 btc)
        C3 = Commit (8.999 btc)
        C4 = Commit (0.001 btc)

C1 = C2 + C3 + C4
If C4 is not there, then can we assume C4 = C1 - C2 - C3.
But is there any coinbase tx in Liquid to take the C4 fee?
I 'm confused.

In Confidental Transactions, like they are implemented in Blockstream Liquid, transactions have an explicit (plain text) fee field, and the rule is that sum(output_commitments) + commit(fee) = sum(input_commitments).
Without clear text fee field, miners indeed would not be able to claim the difference between outputs and inputs.

Thank You. there are too many followup questions on this! I will post another question.

Fees in liquid are explicitly defined as an output, as describing them as the deficit between input and output is impossible when the values are unknown to the validator.

Thank You. there are too many followup questions on this! I will post another question.


text:
How can the compressed UTXO set be stored in just 4GB?
According to S. Delgado-Segura, C. Pérez-Sola, G. Navarro-Arribas, J. Herrera-Joancomartí, "Analysis of the Bitcoin UTXO set", Financial Cryptography and Data Security, pp. 78-91, 2019, the distribution of the UTXO set as of 2017 was:
No of UTXO                  52,543,649   100%      Size
Pay-to-PubkeyHash (P2PKH)   43,079,604    81.99%   147-179 bytes
Pay-to-ScriptHash(P2SH)      8,987,799    17.11%   40 - ? bytes
Pay-to-Pubkey(P2PK)             66,759     0.1%    113 bytes
Others                         409,487     0.8%    114-1483 bytes

There are 66.6 million UTXO in April 2020. Assuming the same distribution, the size of UTXO set should be approximately:
No of UTXO: 66.6 million = 100%
Pay-to-PubkeyHash (P2PKH)   81.99%    147-179 bytes   7.475712318GB
Pay-to-ScriptHash(P2SH)     17.11%    40 - ? bytes    0.424506515GB
Pay-to-Pubkey(P2PK)          0.1%     113 bytes       0.007008947GB
Others                       0.8%     114-1483bytes   0.056567788GB
Total                                                 7.963795569GB

Per statoshi.info the serialized UTXO set is 4GB as off April 2020.
I understand UTXO data does not have lot of leading zeros. How can the serialized UTXO set be compressed to 4GB?

The sizes you give don't match the paper. I can't even find mention of the sizes you give in the paper itself. Those sizes are incredibly wrong and way too large. They seem to be for input sizes, not output sizes. Input sizes are irrelevant to the UTXO set.
P2PKH are 21 bytes, P2SH are 21 bytes, P2PK are 33 bytes, everything else is their actual script size.

P2PKH = 1.147 GB
P2SH = 0.2393 GB

I've decided to omit the other outputs types because there are so few of them that their size is negligible.
The amounts are at most 0.5328 GB. However the amounts are compressed, so that should actually be smaller.
The outpoints (txids and output indexes) are at most 2.398 GB.
So in total the serialized UTXO set is approximately 4.3171 GB which is close to what we actually observe.
There are some more bytes due to the omitted scripts and because of the LevelDB's overhead, but there shouldn't be much (and certainly not several GB). Additionally the amounts and the output indexes are compressed which significantly reduces the serialized size. So in total, it's ~4 GB. My node reports 3.9 GB.

https://eprint.iacr.org/2017/1095.pdf .Look at table 3. I think I misunderstood the paper.

Table 3 is for input sizes. The UTXO set contains outputs. You want the output sizes which, AFAICT, are not listed in the paper.

ok TQ TQ, Noted.  The table put p2pK and the sigscript on the same row. I mistaken it as  P2pk size. Sorry.

Each UTXO entry must add 8 bytes for bitcoin amount in satoshi.  2. P2PK got 2 format compressed is 34 bytes(~50%), uncompressed is 67 bytes (~50%).  Just finish manually decoding few bitcoin TX to understand it better.


text:
How to create hex of raw transaction
Below is my response after creating the transaction. How do I create the hex encoded string of raw transaction in PHP. Is there package for it in PHP ?

{
      "tx": {
        "block_height": -1,
        "block_index": -1,
        "hash": "e489b823ac92e0f6f254f40ffca90aa026536c0a969302c0dbf27cc746613283",
        "addresses": [
          "C4TBnUyFj5kX9CPp4im8LDWa8d9kgJZMP8",
          "CCLA1wbxJEKLugrPvfpbzo9ApFVPg54asv"
        ],
        "total": 954600,
        "fees": 45400,
        "size": 119,
        "preference": "high",
        "relayed_by": "182.72.122.170",
        "received": "2018-02-06T08:47:01.900244013Z",
        "ver": 1,
        "double_spend": false,
        "vin_sz": 1,
        "vout_sz": 2,
        "confirmations": 0,
        "inputs": [
          {
            "prev_hash": "48e09cbf4701230038783a8ea3ef8c6b46b79aef897f54ed7af9ffc130f2072b",
            "output_index": 0,
            "output_value": 1000000,
            "sequence": 4294967295,
            "addresses": [
              "C4TBnUyFj5kX9CPp4im8LDWa8d9kgJZMP8"
            ],
            "script_type": "pay-to-pubkey-hash",
            "age": 1695612
          }
        ],
        "outputs": [
          {
            "value": 10,
            "script": "76a914d2a9103585799178a88be5cc9c6e7fcb4813e29788ac",
            "addresses": [
              "CCLA1wbxJEKLugrPvfpbzo9ApFVPg54asv"
            ],
            "script_type": "pay-to-pubkey-hash"
          },
          {
            "value": 954590,
            "script": "76a9147c3c71d0560de62cbfcb70d7f753aa487191646988ac",
            "addresses": [
              "C4TBnUyFj5kX9CPp4im8LDWa8d9kgJZMP8"
            ],
            "script_type": "pay-to-pubkey-hash"
          }
        ]
      },
      "tosign": [
        "3fad63985892f8e3ddb36f926503b6873bd91c456a24e12771d47a0cb5dc730f"
      ]
}

I'm voting to close this question as off-topic because this is a simple programming question that belongs on stackoverflow.com

I'm voting to close this question as off-topic because this is a simple programming question that belongs on stackoverflow.com

I am just interested in knowing the type of encoding get followed while encryption of the txSkeleton.
Can you please help me out with this?

I agree, this should get migrated to Stackoverflow.

Bitwasp-PHP can do it. with much more features.

Is there any other way where I can easily encode my raw transaction into HEX without using any package?
I have mostly used curl call for the creating transaction so it would be a good option if I get any code segment to convert my transaction into HEX.

Yes, you need to take the fields in the arrays of your result, construct the objects in bitcoin-php, and then call getHex on the transaction. With the library you can also create raw unsigned transactions without using curl/bitcoind.

Welcome Shubham to bitcoin.SE. To my knowledge there isn't a library, but maybe you are working on it? I found two links, which might help you to come to the goal:
What you would need to do, is get the details of the tx correctly serialized. Amaclin explained in his answer very detailed, how to do this.
And then some there is some string to hex conversion in PHP (maybe here).


text:
Can't inititate network handshake with my full node
I am running a custom Python script to initiate network handshakes with other nodes. While testing the code I decided to initiate an handshake with my own node but I am getting a timeout error.
TimeoutError: [Errno 110] Connection timed out

I know the script works, because I have tried with other well known nodes in the network. Also the script is from Programming Bitcoin by Jimmy Song, so I am reasonably confident that it's tested.
This is related (I think) to my earlier problem where I was checking connectivity while setting up the node and https://bitnodes.earn.com/ can't reach my node. I didn't pay much attention because my node successfully established incoming connections.
  bitcoin@bitcoin_fullnode:~ $ bitcoin-cli getnetworkinfo
{
  "version": 180000,
  "subversion": "/Satoshi:0.18.0/",
  "protocolversion": 70015,
  "localservices": "000000000000040d",
  "localrelay": true,
  "timeoffset": 0,
  "networkactive": true,
  "connections": 18,
  "networks": [

So this means my node is reachable from other nodes somehow, yet I can't manually reach it.
My node's public IP:
bitcoin@bitcoin_fullnode:~ $ curl https://ipinfo.io/ip
103.24.86.29

My ufw settings:
18333                      ALLOW       Anywhere                   # allow Bitcoin testnet
8333                       ALLOW       Anywhere                   # allow Bitcoin mainnet

I am getting a local ping reply from my server. But no response from its public IP.
rajarshi@linuxpc:~$ ping 192.168.1.185
PING 192.168.1.185 (192.168.1.185) 56(84) bytes of data.
64 bytes from 192.168.1.185: icmp_seq=1 ttl=64 time=5.25 ms
64 bytes from 192.168.1.185: icmp_seq=2 ttl=64 time=3.34 ms
64 bytes from 192.168.1.185: icmp_seq=3 ttl=64 time=4.65 ms
^C
--- 192.168.1.185 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 3.347/4.418/5.250/0.797 ms

rajarshi@linuxpc:~$ ping 103.24.86.29
PING 103.24.86.29 (103.24.86.29) 56(84) bytes of data.
^C
--- 103.24.86.29 ping statistics ---
9 packets transmitted, 0 received, 100% packet loss, time 8197ms

Similar situation for 8333 port using telnet:
rajarshi@linuxpc:~$ telnet 192.168.1.185 8333
Trying 192.168.1.185...
Connected to 192.168.1.185.

rajarshi@linuxpc:~$ telnet 103.24.86.29 8333
Trying 103.24.86.29...
telnet: Unable to connect to remote host: Connection timed out

Somehow it seems that my public IP is not reachable. Can anyone suggest where should I look at? I am running Bitcoin Core 18.0 on a Raspberry 3 connected to a TPLink router. Router Firewall is disabled, UPNP is enabled, Port Forwarding done for 8333 and 18333. What else I should debug to figure out this problem? I am aware that it's not a Bitcoin specific problem, but any help is much appreciated.
Thank you. :)
PS: Also relevant part of my bitcoin.conf file, in case that's helpful.
upnp=1
listen=1
#testnet=1

#Along with clear ip also tell bitcoind that you are using tor
onion=127.0.0.1:9050

#these are other Tor nodes that will help your node find peers
seednode=nkf5e6b7pl4jfd4a.onion
seednode=xqzfakpeuvrobvpj.onion
seednode=tsyvzsqwa2kkf6b2.onion

#these lines help limit potential DOS attacks over Tor
banscore=10000
bantime=11


text:
Why is the block size so big, taking into account a relatively small number of transactions?
Why the size of the block 656143 is so big (Size: 2,337,727 bytes), taking into account a relatively small number of transactions (Number of Transactions: 84)?
Extra question: What is the block size limit in Bitcoin nowadays?
I found some guidelines here:

Bitcoin blocks now have a theoretical maximum size of 4 megabytes and a more realistic maximum size of 2 megabytes.

However, the size of the block 656143 is ~2.3Mb; therefore, a "more realistic maximum" is not that realistic :)

Why the size of the block 656143 is so big (Size: 2,337,727 bytes), taking into account a relatively small number of transactions (Number of Transactions: 84)?

It contains a number of transactions which are substantially larger than average (it is spending a very large number of outputs, legacy P2SH multisig scripts), so an assumption based on the average size of transactions does not hold.

However, the size of the block 656143 is ~2.3Mb; therefore, a "more realistic maximum" is not that realistic :)

The quote refers to the assumed average size, not including obvious outliers like this.

Shouldn't it be "inputs" instead of outputs in a "very large number of outputs"?

Possibly! The nomenclature in Bitcoin is always a little strained, in this case the transaction is spending a large number of outputs (UTXO entries), which are the inputs to the transaction I showed in the screenshot.


text:
Is a P2WPKH address synonymous with a Bech32 address?
BIP142 when encoding a segwit P2WPKH address is using a base58 address format (address p2xtZoXeX5X8BP8JfFhQK2nD3emtjch7UeFm in the example).
I understand that BIP142 predates BIP173 but are P2WPKH and Bech32 synonyms now? Is there such a thing as Base58 P2WPKH address?

are P2WPKH and Bech32 synonyms now?

No. Bech32 is also used for P2WSH addresses. Native segwit and Bech32 are synonyms.

Is there such a thing as Base58 P2WPKH address?

No.

Not quite; Bech32 is just the encoding scheme, which is more general than Bitcoin's use of it for P2WSH/P2WPKH addresses.

P2WPKH and bech32 are not quite synonymous.
Native segwit describes a type of output schema in which the scriptPubKey (the "locking script") is composed of a witness version and a witness program. P2WPKH is a native segwit v0 output type.
Bech32 refers to an encoding scheme and an address format to represent a recipient's scriptPubKey in out-of-band communication.
We use "bech32 addresses" to instruct spenders to create "P2WPKH outputs":

Pay to Witness Public Key Hash (P2WPKH) and Pay to Witness Script Hash (P2WSH) are native segwit v0 outputs that get represented using bech32 addresses.
Pay to Public Key Hash (P2PKH) and Pay to Script Hash (P2SH) use base58 addresses.
Pay to Taproot (P2TR) and future native segwit output types will use bech32m addresses.


text:
Is it possible to copy transactions between Bitcoin's forks blockchain?
Do Bitcoin forks share the same transaction protocol after the fork? If so, is it possible to copy/ duplicate a transaction that uses common input transactions in the other blockchain?
Let me explain what I mean:
Let's say, I have 1 BTC in an unspent transaction which happened before a fork (Bitcoin Cash for example).
So after the fork, I own 1 BTC in Bitcoin blockchain and 1 BCH in Bitcoin Cash blockchain.
Then, I send that 1 BTC to another person.
At this point, can that person copy my transaction code and re-send it in Bitcoin Cash network so that he gets 1 BTC and 1 BCH?

Yes, some people call this a 'Replay Attack'. But it's not literally an attack, but the desired outcome. If a fork don't want this to happen it can change the rules to prevent it.
You can also avoid it but using inputs mined in BTC after the fork, if your wallet app allows this kind of selection.

Thanks.That's what I was looking for, but couldn't google anything without this term.


text:
Do I need to be already running a full node to run LND Lightning?
I want to start learning about lightning network and try setting up a channel.  However I don't know if I need to already be running a full node.  I stopped my core client from syncing a while back.

You do not need to be running a full node. As Antoine mentions, you can locate a full node that is capable of serving light clients (Neutrino specification). A testnet full node run by Lightning Labs is available here. However, if you are interested in learning and experimenting I'd recommend that you do run a full node as you will not be restricted by the availability/services of third party full nodes and you also won't be fully dependent on Neutrino which at the time of writing is an experimental light client. It shouldn't be a problem to resume syncing your Bitcoin Core client and depending on when you stopped it shouldn't take too long to catch up with the latest block (obviously dependent on speed of CPU and internet connection). The latest LND installation instructions are here.

Using LND, you can use the neutrino client (which is a lite client). Instructions are available here.


text:
How do Bitcoin balances work when an address is controlled by multiple parties together?
user1, pubkey1, 1.1 BTC
user2, pubkey2, 1.2 BTC
user3, pubkey3, 1.3 BTC
user4, pubkey4, 1.4 BTC

user4 sends 0.4 BTC to a 2-of-3 multi-sig account controlled by user1, user2 and user3 using P2SH.
The transaction is successful.
What is the account balance for user1, user2 and user3?

Bitcoin balances conceptually are not like bank account balances, but more akin to banknotes: uniquely identifiable, good for a specific amount, and can only be spent in full. The "account balance" shown by your wallet is simply the sum of funds that the wallet knows how to spend. In the case of your multisig example, if user1, user2, and user3 each have their own wallet but each wallet keeps tracks of the multisig unspent transaction output (utxo) as its own, they would each see it as part of their balance.
Basically, it's up to the users to decide how to interpret the spendability of their shared funds. The network would enforce that they would only be able to spend the UTXO once in total, though. Alternatively, it's possible that they share one "watch-only" wallet to track the balance, but each hold their own separate key. In that case this shared watch-only wallet would track the balance only once, but they'd each hold their own key independently.
So, concretely, the users' balances after the transaction from user4 would be:
user1, pubkey1, 1.1 BTC
user2, pubkey2, 1.2 BTC
user3, pubkey3, 1.3 BTC
user4, pubkey4, 1.0 BTC
{user1,user2,user3}, 2-of-{pk1,pk2,pk3}, 0.4 BTC

Where the last UTXO is controlled by the multi-party address as described and has different spending properties than the individual balances of the the users.

As per my understanding of P2SH transactions, the concept of "account balance" does not really exist.

But the fact that 2 out of the 3 users can unlock the corresponding redeem script with their signatures gives them the opportunity to spend the utxo (0.4BTC) of the said P2SH transaction.
Independently, of course they could also spend the utxos of other transactions that had their public key (hash) in their output.

later on user1, user2 wants to spend 2.5 BTC to user5, how should they sign the transaction??? how many inputs? Balance BTC who will get it?

that new transaction would need multiple inputs. For example, one P2PKH utxo from pubkey1, one P2PKH utxo from pubkey2, and the utxo from said P2SH transaction. Each input of the new transaction would need to be signed with the corresponding private keys. In the output of the new transaction, you specify how much user5 should get. Specify a change adress for the change. Rest goes as fee.


text:
How is "additional information" stored in the ledger and which blockchain projects don't allow it?
So there have been these rumours going around about child abuse information being stored in the bitcoin ledger, that might make bitcoin illegal to possess.
How is this infirmation stored and are there any other blockchain projects (Ripple, Ethereum, etc.) that don't allow it?

In Bitcoin, you can use an OP_RETURN output to encode arbitrary data into a transaction output.
But there are also ways to do that without actually explicitly saying something is arbitrary data. For example, you could cut up the data into 32 byte slices and claim it is a public key. To an outside observer, it very well could be a public key. So then the person encoding the data creates a lot of P2PK outputs or a large bare multisig output with public keys which are actually the data.
In order for data to be put on the blockchain, it typically has to be transformed in some way (e.g. slicing it up) and it has to be interpreted specially in order to get the encoded data out. That someone has encoded illegal information into the blockchain is not a new idea, but in order to actually get the illegal information, you need a special decoder, otherwise it is just arbitrary bytes.

An exact explanation of how the data is stored, what data was analyzed and what was found can be found in the paper A Quantitative Analysis of the Impact of
Arbitrary Blockchain Content on Bitcoin by Matzutt et al which appeared in this year's Financial Crypto conference.


text:
If the nodes are what keep Bitcoin decentralized, what if some big internet company spun up 60%+ majority nodes?
If the nodes are what keep Bitcoin decentralized, what if some big internet company spun up 60%+ majority nodes?
What’s stopping them from manipulating the blockchain to change transactions?

I have a complementary question to that : let's said i ask an exchnage platform to change bitcoin at address XXX , but I'm lying: address XXX has no bitcoins. But i set up "false nodes" in the Bictoin P2p network that said address XXX has bitcoins: how will the platform avoid to ask "my" nodes for the value of address XXX? And more largely, how would someone setting up a new node do the difference when downloading the blockchain between "good" and "false" nodes?

Block verifiers don't manipulate the block chain. What matters is the economical weight of those verifiers, not the number of node processes they run.

Each Bitcoin transaction is signed using the private key(s) of the sender(s). The cryptographic signatures both provide authorization of the payments and ensure integrity of the transaction. The signatures commit to a digest of the transaction, which means that the signatures are invalid out of the context of exactly that transaction, even if the transaction were only changed by a single byte. Transaction without a signature or an invalid signature are not accepted of course.
The immutable valid transactions are then collected in blocks. The blocks are spaced out in time by means of a distributed lottery, the mining process. The mining process also ensures that a substantial amount of computation has been performed when a new block is found. Each block collects a group of transactions with a cryptographic commitment, rendering it just as immutable as the transaction data itself.
As these blocks propagate, each node individually verifies that all transactions and the block as a whole follow the the protocol rules. Someone spawning a multitude of nodes could potentially hamper propagation of block or transactions, isolate users on the network, or try discovering the original senders of transactions. Nodes alone cannot change either blocks or transactions, though.

If the nodes are what keep Bitcoin decentralized, what if some big internet company spun up 60%+ majority nodes?

Nothing. There is nothing special about the number of nodes.

What’s stopping them from manipulating the blockchain to change transactions?

When one node talks to another node, it either sends valid messages or it sends invalid messages. If it sends invalid messages, the receiving node (if honest) will ignore it. If it sends valid messages, the receiving node (if honest) will honor it, but it will make that node do the right thing.
There is simply no way for any number of nodes to tell an honest node to do the wrong thing. A message either exists or it doesn't and it makes no difference how many places you receive the same message from. Nodes don't vote.


text:
Could a government or company run thousands of unique nodes?
Let’s say you’re a tech giant or control a tech giant.
So you have access to money, computers & thousands of unique ip addresses.
Could these giants spin up so many unique nodes that they could perform a 51% attack?

In theory, it is possible. But it will be better to use all that power to do things right. With all that power, they could be earning more by actually mining bitcoin and protecting the network.
A 51% attack in bitcoin is possible but really improbable because the Bitcoin network is huge.
Anyways, an attack like this by a large corporation or company would trigger all the alarms, and probably the price of bitcoin would go down, really down, making that attack probably worthless.
So, the original idea of Satoshi remains; it's cheaper to play by the rules than to try to trick the network.

I can't tell, I suspect an eclipse attack should be many orders of magnitude cheaper and easier than a 51% attack...

Yes, but running a lot of nodes would give them little to no influence on the network. Controlling a lot of nodes on the network could aid in identifying originators of transactions, or might be useful to perform an eclipse-attack, where an attacker supplants a victim's entirety of peer connections with their own nodes to control their inbound information.
To perform a majority attack (51% attack), you need to control the majority of the hashrate. Most nodes today do not contribute any hashrate to the network, the hashrate is providing by specialized hardware, ASICs.


text:
RPC call to lnd
I wanto to send a simple "getinfo" request to lnd using golang. I currently have
package main

import (
    "fmt"
    "log"
    "net/rpc"
)

func main() {
    client, err := rpc.Dial("tcp", "localhost:10009")
    if err != nil {
        log.Fatal("dialing:", err)
    }

    type Rep struct {
        identity_pubkey       string
        alias                 string
        num_pending_channels  uint32
        num_active_channels   uint32
        num_peers             uint32
        block_height          uint32
        block_hash            string
        synced_to_chain       bool
        testnet               bool
        chains                string
        uris                  string
        best_header_timestamp int64
    }

    var reply Rep

    args := ""

    err = client.Call("getinfo", args, &reply)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(reply)
}

but i get 2018/04/12 23:41:09 unexpected EOF

Lnd uses

GRPC Protobuf for API (prefered way) or HTTP REST. Command line tool lncli uses GRPC to communicate with lnd
SSL for data encryption
macaroons for RPC authentication https://github.com/lightningnetwork/lnd/blob/master/docs/macaroons.md It can be disabled using --no-macaroons flag

Here is an example code for connecting to lnd and doing getinfo request. It assumes that you use macaroons. You may need to insert correct paths for tls cert and macaroons file.
package main

import (
    "context"
    "fmt"
    "github.com/davecgh/go-spew/spew"
    "github.com/lightningnetwork/lnd/lnrpc"
    "github.com/lightningnetwork/lnd/macaroons"
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"
    "gopkg.in/macaroon.v2"
    "io/ioutil"
    "os/user"
    "path"
)

func main() {
    usr, err := user.Current()
    if err != nil {
        fmt.Println("Cannot get current user:", err)
        return
    }
    fmt.Println("The user home directory: " + usr.HomeDir)
    tlsCertPath := path.Join(usr.HomeDir, ".lnd/tls.cert")
    macaroonPath := path.Join(usr.HomeDir, ".lnd/admin.macaroon")

    tlsCreds, err := credentials.NewClientTLSFromFile(tlsCertPath, "")
    if err != nil {
        fmt.Println("Cannot get node tls credentials", err)
        return
    }

    macaroonBytes, err := ioutil.ReadFile(macaroonPath)
    if err != nil {
        fmt.Println("Cannot read macaroon file", err)
        return
    }

    mac := &macaroon.Macaroon{}
    if err = mac.UnmarshalBinary(macaroonBytes); err != nil {
        fmt.Println("Cannot unmarshal macaroon", err)
        return
    }

    opts := []grpc.DialOption{
        grpc.WithTransportCredentials(tlsCreds),
        grpc.WithBlock(),
        grpc.WithPerRPCCredentials(macaroons.NewMacaroonCredential(mac)),
    }

    conn, err := grpc.Dial("localhost:10009", opts...)
    if err != nil {
        fmt.Println("cannot dial to lnd", err)
        return
    }
    client := lnrpc.NewLightningClient(conn)

    ctx := context.Background()
    getInfoResp, err := client.GetInfo(ctx, &lnrpc.GetInfoRequest{})
    if err != nil {
        fmt.Println("Cannot get info from node:", err)
        return
    }
    spew.Dump(getInfoResp)
}

There is a great resource about lnd https://dev.lightning.community/
Hope this helps.

Thanks a lot, but I get a
./client.go:49:61: cannot use mac (type *"gopkg.in/macaroon.v2".Macaroon) as type *"github.com/lightningnetwork/lnd/vendor/gopkg.in/macaroon.v2".Macaroon in argument to macaroons.NewMacaroonCredential ./client.go:57:36: cannot use conn (type *"google.golang.org/grpc".ClientConn) as type *"github.com/lightningnetwork/lnd/vendor/google.golang.org/grpc".ClientConn in argument to lnrpc.NewLightningClient error. I am going to mark it as answered for the moment :)

Do you use dep? It seems like you didn't add google.golang.org/grpc to your dependencies. So some libraries are taken from vendor, some not.

Using dep it worked, I don't quite understand why but it works, thanks.