text:
Any studies on minimum USD value needed on BTC to make mining worth the cost?
My understanding of the Bitcoin ecosystem is that the task referred to as "mining" is actually the processing (confirming) of the Bitcoin transactions, and that the miner "finds" a coin when they find the accepted hash of a block of transactions.
Based on the information in other questions here, the mathematical difficulty of processing the transactions is expected to increase as more Bitcoins enter the ecosystem while at the same time the block reward is expected to halve at every 210,000 blocks.
The mathematical difficulty present in the mining process has of course a bearing on the cost of electricity and processing time of the hardware. On top of that the miners do have costs for paying for the warehouse or other location where the server farms are kept, besides indirect costs in things like depreciation of the hardware.
Currently we also have the situation that the USD value of BTC has been going down.
With this in mind I wanted to ask if there are any studies about the minimum USD value that Bitcoin should have in order to make mining profitable?

Mining is worth its cost for self-protection. Irrespective of the network, you'd invest as much as you can to protect the value-exchange between 'you' and receiver, even if it was just you two in the whole world using it.

I don't think a study is necessary - logic should suffice.
The difficulty of the hashing "puzzle" (how many zeroes the hash must start with) is automatically calculated based on the current hashing power - ie. how many miners are trying to solve the puzzle.
The difficulty is calculated so that the average time to mine a block is always around 10 minutes. No matter how many miners are trying to solve it.
...so if the dollar-value of bitcoin goes down it will lead to:

The value of the block reward going down - so the incentive to mine drops.
Some miners will then stop mining - because it's no longer profitable for them (who goes first depends on each miners ability to compete - ie. his cost for electricity and so on compared to competing miners - but someone will quit to do something profitable instead).
The combined hashing power of all miners will go down - since there are fewer of them.
The difficulty of the puzzle will self-adjust (it will become easier) - making it more likely for each remaining miner to solve a block and get the (smaller) reward.

And balance is restored... the miners who continued mining will still be able to turn a profit in spite of a lower reward per block.
It will always be profitable for some miners to continue mining - unless of course the value of bitcoin goes all the way to zero.
The point is that whatever the total reward for "finding" a block is (block reward and fees combined) - that is how much will be invested in mining it (minus of course a small profit for the miner - but this is likely only a tiny fraction of the actual reward).
The important point is that the lower the difficulty is, the lower the security is.
If we imagine that value goes all the way down to the point where the total reward for mining a block is for example $1, someone will still be mining - but there will be so few that it will be easy to do a 51% attack: You'd be able to construct an "alternate" history for just $1 per block, so it wouldn't cost much to get the longest chain.
...but the reward for taking over the chain will also be almost nothing - so why bother :)

There is a recent study by Morgan Stanley, described in this article titled "Bitcoin 'miners' are losing money at any price below $8,600: Morgan Stanley" by CNBC.
The article says

"We estimate the break-even point for big mining pools should be
  US$8,600, even if we assume a very low electricity cost (US$0.03
  kW/h)," equity analyst Charlie Chan and his team said in a Thursday
  note.

The article included the table shown below

miners in China could be paying 1/10 of this assumed electricity price

With this in mind I wanted to ask if there are any studies about the minimum USD value that Bitcoin should have in order to make mining profitable?

In general, there will not be a catch-all answer for this, as every miner will have different costs for their operation. There are mining-profitability calculator websites out there that may be of interest to you.
Also consider that if coin value falls, some miners will become unprofitable and turn off their machines, but many others will still be profitable, and will continue mining. The most efficient miners would likely still be profitable even at extremely low coin prices, once the difficulty has adjusted accordingly. The network self-adjusts to always incentivize miners to mine.
In an extreme example, consider a power producing business that routinely generates excess power that they cannot use or store, and so instead it goes to waste. A business like that would effectively have a negative electricity rate, as the power would go to waste if not used.. So even with a very low coin price, at current difficulty they may turn a profit.


text:
bitcoin chainstate database parsing in python giving wrong value
I am trying to decode chainstate db for a specific out index for a transaction in python just for learning.
Transaction ID: 4d4a4c6ca4f3c91e69563199943336d3279fad71c9e8d9c1708ef9dc6ac16000
out index = 1822
chainstate_db = plyvel.DB(os.path.join(os.getenv('HOME'),".bitcoin/chainstate"), compression=None)
def getObfuscationKey():
    value = chainstate_db.get(b'\x0e\x00' + b'obfuscate_key')
    print('obfuscation key = %s' % value)
    obfuscation_key = value[1:]
    return obfuscation_key

def applyObfuscationKey(data: bytes):
    obfuscation_key = getObfuscationKey()
    new_val = bytes(data[index] ^ obfuscation_key[index % len(obfuscation_key)] for index in range(len(data)))
    return new_val

def b128_varint_decode(value: bytes, pos = 0):
    n = 0
    while True:
        data = value[pos]
        pos += 1
        n = (n << 7) | (data & 0x7f) # 1111111
        if data & 0x80 == 0:
            return (n, pos)
        n += 1

def txout_decompress(x):
    # x = 0  OR  x = 1+10*(9*n + d - 1) + e  OR  x = 1+10*(n - 1) + 9
    if x == 0:
        return 0
    x -=1
    # x = 10*(9*n + d - 1) + e
    e = x % 10
    x /= 10
    n = 0
    if e < 9:
        # x = 9*n + d - 1
        d = (x % 9) + 1
        x /= 9
        # x = n
        n = x*10 + d
    else:
        n = x+1
    while e:
        n *= 10
        e -= 1
    return n
...
def getChainstateData(txn_hash_big_endian: bytes, out_index: int):
    key = b'C' + txn_hash_big_endian + b128_varint_encode(out_index)
    value = chainstate_db.get(key)
    value = applyObfuscationKey(value)
    code, pos = b128_varint_decode(value)
    height = code >> 1
    coinbase = code & 0x01
    print('height = %d, coinbase = %r' % (height, coinbase))
    decoded_varint_amount, pos = b128_varint_decode(value, pos)
    amount = txout_decompress(decoded_varint_amount)
    print('amount = %d' % amount)
if __name__ == '__main__':
    getChainstateData(binascii.unhexlify('0060c16adcf98e70c1d9e8c971ad9f27d3363394993156691ec9f3a46c4c4a4d'), 1822)

I get below result:
    height = 355833, coinbase = 0
    amount = 12353
When I do getrawtransaction in bitcoin core daemon I get amount as 12200.
./bitcoin-cli getrawtransaction 4d4a4c6ca4f3c91e69563199943336d3279fad71c9e8d9c1708ef9dc6ac16000 true

For out index 1822 I get:
{
      "value": 0.00012200,
      "n": 1822,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c40c4870c3874cafb3385dca3731d637ac51110d OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c40c4870c3874cafb3385dca3731d637ac51110d88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1JscA3193KByPvFv4X6nNEV2SGjdXVcVq6"
        ]
      }
    },

So there must be problem with code which I am not able to figure out. I think problem is in

txout_decompress(x)

method. But this is strange because I have directly used method in bitcoin core

uint64_t DecompressAmount(uint64_t x)

in

src/compressor.cpp

after converting this to python.
Please help me solve this issue.

After investigating I found the x in txout_decompress(x) was not an integer which was causing the difference in answer so during division I typecast it to int and it worked. So the corrected code:
def amount_decompress(x: int):
    # x = 0  OR  x = 1+10*(9*n + d - 1) + e  OR  x = 1+10*(n - 1) + 9
    if x == 0:
        return 0
    x -=1
    # x = 10*(9*n + d - 1) + e
    e = x % 10
    x = int(x / 10)
    n = 0
    if e < 9:
        # x = 9*n + d - 1
        d = (x % 9) + 1
        x = int(x / 9)
        # x = n
        n = x*10 + d
    else:
        n = x+1
    while e:
        n *= 10
        e -= 1
    return n

source: Stack Exchange

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

sort: votes


text:
How can someone broadcast intermediate lightning transaction? Where the network fees come from?
Let's assume Alice and Bob creates a channel in which Alice locks her 100 mBTC.

Alice 100mBTC and Bob 0 mBTC -------->  2-of-2 contract

Alice Pays Bob 30mBTC through this channel:

Alice Commitment Txn:

Input:
 - Contract
 - Alice Signature
 - Bob Signature

Output:
 - 70 mBTC (Alice's Balance)
 - - If revocation key then pay to Bob's Pubkey.
 - - Else Alice can pay herself after one day.
 - 30 mBTC (Bob's balance)
 - - Pay to Bob's pubkey

And,

Bob's Commitment Transaction:

Input:
 - Contract
 - Alice Signature
 - Bob Signature

Output:
 - 30 mBTC (Bob's Balance)
 - - If revocation key then pay to Alice's Pubkey.
 - - Else Bob can pay herself after one day.
 - 70 mBTC (Alice's balance)
 - - Pay to Alice's pubkey

Then Alice and Bob shares revocation key before sending sending next transaction.
Now Alice Pays Bob 10mBTC through this channel:

Alice Commitment Txn:

Input:
 - Contract
 - Alice Signature
 - Bob Signature

Output:
 - 60 mBTC (Alice's Balance)
 - - If revocation key then pay to Bob's Pubkey.
 - - Else Alice can pay herself after one day.
 - 40 mBTC (Bob's balance)
 - - Pay to Bob's pubkey

And,

Bob's Commitment Transaction:

Input:
 - Contract
 - Alice Signature
 - Bob Signature

Output:
 - 40 mBTC (Bob's Balance)
 - - If revocation key then pay to Alice's Pubkey.
 - - Else Bob can pay herself after one day.
 - 60 mBTC (Alice's balance)
 - - Pay to Alice's pubkey

Alice tries to cheat Bob by publishing the previous transaction which is:

Alice Commitment Txn:

Input:
 - Contract
 - Alice Signature
 - Bob Signature

Output:
 - 70 mBTC (Alice's Balance)
 - - If revocation key then pay to Bob's Pubkey.
 - - Else Alice can pay herself after one day.
 - 30 mBTC (Bob's balance)
 - - Pay to Bob's pubkey

I am not able to understand how can Alice publish the transaction because there is no network transaction fee for confirming the transaction on Bitcoin Blockchain.
Please help me understand what I am missing here.

The transaction does have a fee and that is negotiated prior to the channel being opened. The participants will determine the feerate to set on the commitment transactions before the transactions are created. Thus every commitment transaction contains a transaction fee and could be sent to the network.
This is required in the case of a unilateral close. A unilateral close has one participant broadcast the latest commitment transaction. Since that commitment transaction must be able to confirm, it must pay a transaction fee. Fees can only be set at the time the commitment is created, and that is what is done.

Does this mean when we create 2-of-2-multisig-contract we include transaction fee as well?
So the funding contract has something like 101mBTC instead of 100mBTC.

Yes, when the multisig is funded, transaction fees have to be taken into account.

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


text:
Using PHP with RPC and cookie
Since 0.12 RPC uses a "random cookie":https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.12.0.md#rpc-random-cookie-rpc-authentication for authentication, but it's not clear how to use this cookie when accessing RPC.
I'm trying things like the below, without success (401 Unauthorized)
$Request = array(
    'http' => array(
        'method' => 'POST',
        'header' => "Content-type: application/json\r\n".
                    'Cookie: __cookie__=contentsOf.cookie',
        'content' => $Params
        )
    );
if (!$Response = file_get_contents(BITCOIN_RPC_URL, false, stream_context_create($Request))) {
    return false;
}

Every example I find online uses the user:pass authentication, I've yet to see an example using cookies.

Not sure if you're still looking for an answer, but I just stumbled upon this myself and for the benefit of anyone running into this.
Even though it's called cookie based authentication, you still authenticate via Basic HTTP.
Let's say your cookie was __cookie__:somerandomlongstring then:

Username __cookie__
Password somerandomlongstring

I figured this out after finding this comment on Github

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


text:
How to get paid providing full node services?
I run a full node.  I would like to get paid for the services I provide.  How can I go about getting that to happen?

Maybe you can clarify which of the following you mean: do you want to get paid for the fact that you are running a full node? Or are you offering other services and which to get paid to your qt wallet?

If you're asking how to get paid for the services a full node provides, you probably can't. There's no shortage of full nodes.

I would like to see all full node operators get paid for the services they provide.  I have a copy of the blockchain.  Someone wants it or a portion of it.  No problem.  All of the full node operators bid to fulfill the request.  The winner (maybe the lowest bid or higher quality service) gets paid.  As the blockchain gets bigger and bigger eventually unpaid full node operators will begin to drop off the network.

@DavidRabahy: Maybe you should check out something like NXT where you can use proof-of-stake to get paid. Bitcoin won't cut it. In Bitcoin, only Chinese factory owners get paid.

Presently, you cannot.
According to BitNodes, as of this writing there are over 5000 full nodes on the network, all of them providing this service for free.  This certainly seems to be sufficient for everyone who wants to use it.  So nobody is going to pay you money for a service they can have for free.  The effective market value of your services is zero.
It is possible that someday, as the cost of running a full node rises, there may not be enough people running free full nodes to satisfy the demand.  In that case, the market value of this service may increase above zero, and you might be able to get people to pay to use your node.  Note that if this happens, you'll probably also have to pay other nodes for the privilege of sharing their data with your customers, and getting them to help distribute data from your customers.  But at this point, this is pure speculation.

Note that Bitnodes' count does not reflect the real count of fully-validated nodes on the network but rather the clearnet-and-publicly-listening nodes count.
A more accurate count can be found here [ https://luke.dashjr.org/programs/bitcoin/files/charts/software.html ], as of 2020 it's about 50 000 nodes.

A Dash masternode is a full node that provides additional network services, and masternode owners get compensated. A Dash masternode must be collateralized with 1000 Dash.  Once a masternode is cryptographically collaterized, one can earn interest that gets paid to the public address of the 1000 collateralized Dash. This is a form of Proof of Stake (PoS). Current count of active Dash masternodes. One may outsource masternodes to specialized masternode virtual private server providers.

If you want to start getting paid for your service you must get a list of those 5000 full Nodes providers and reach out to each one and get them to collaborate with you to take down their Nodes until Bitcoin agree to pay a percentage to at least cover the ware and tear of your computer, internet access, Electricity consumption and management of each node.
I am sure that this service is not free for you and so, it should not be free for Bitcoin or anyone else.
I am not advocating for mutining, I am just making it clear everyone else that Bicoin is not going to voluntarily start paying for something if they can get it for free.
If you can get at least half of the 5k nodes provides to co-operate with you, you'll be in business. Good luck. :)

Even if we could get a significant number of people to agree, taking down our non-mining full nodes as a form of protest wouldn't have the desired effect.  The miners would just continue along despite the reduction in the number of non-mining full nodes.  SVP wallets would be obliged to connect to the miners directly,

you have the solution running your own code and application doing all the work
1. have a bitcoin wallet to generate each customer it's payment address
2. flush the address on the payment screen for each customer
3. check the blockchain to see if the address received the transaction
4. wait for confirmations
or, connect to bitcoin payment service provider (like paypal for money)

I'm too lazy to be bothered to write my own code.

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


text:
Does Electrum Daemon give a transaction id even when balance is too low?
Occasionally in my database I have a transaction id output from electrum for some bitcoin sent but that transaction id is invalid. If the balance is too low on electrum and I try to send an amount greater than the wallet balance will electrum still give me a bitcoin transaction id?
This wreaks havoc on my service because it appears that transactions happen when in fact those txids are invalid.  This wasn't happening before, but now it appears to happen a few times a day (with a volume of a few hundred transactions - everything works, except for those occasional invalid trx)

What do you mean that it's invalid? Is it just not getting into the chain? Can you give an example of one of these transactions?

yes, its just not getting to the chain - if you look one up it says not found on block explorers - except blockchain.info which will claim it  is a double spend


text:
work source hash rate smaller than worker hash rate
Why would my Work Source hash rate be smaller than my worker output hashing rate?  I'm using MBPM and my work sources Hashrate is always lower than my X6500Hotplug Hashrate.  I'm just looking for a good explanation for the difference, thank you.
-frankenmint

There are two factors to consider: sampling at the pool and stale rate.
The sampling at the pool is the time the pool considers to calculate the average hashrate. The only thing the pool sees is the rate at which you, the miner, produces valid shares, whereas your computer sees exactly how many individual hashes were done. Since the shares can be said to be distributed uniformly at random, there is a large variance in the rate at which you find shares. The pool uses the rate of your shares to calculate an expected hashrate that matches your share submission rate. Therefore the pool might overestimate your hashrate if you are lucky and find a few shares quickly one after another, but it might also underestimate your actual hashrate if you're unlucky and don't find a share for some time.
Stale rate on the other hand is the ratio of shares that are rejected by the pool as invalid, either because they came after a block switch or the mining software/hardware you're using is faulty. Most mining software keeps track about the rejected stales.

I do get something called socket timeout...but never any stales.  Could those be equal to one in the same?

Oh, I completely missed connectivity issues, you're right. If the miner cannot report back the shares to the server, whether that is a complete disconnection or a delay that simply is too high, the shares will of course not be counted towards the work you did and the pool server will underestimate your hashrate. Please note that the hashrate on the pool server is the one that counts towards your reward. You need to check your Internet connection or test another pool. Keeping this setup will definitely lose some income.


text:
How would i use a quantitative data site like coinmarketcap.com?
I understand that I could calculate my hashrate and thus expected profitability per hardware speed, but I don't understand how to valuate what market price 'should' be and how to actually valuate an alt-coin.  I am trying to get past feelings based speculation and want feedback from what other crypto day traders do.

I'm not sure if I understand... are you trying to use the data from that site to determine what alt-coins 'should' be selling for vs what they are selling for?

Exactly - I just want to know what they 'should' be sold for.

I believe that that question of how much money something "should" cost is fundamentally unanswerable. If there were a way to answer that, the market would reach a point where there would be noting to gain from selling or buying and the speculation market would collapse. There are two ways to succeed at speculation: one is luck; the other is by possessing and acting upon knowledge that others do not. So if you want to get past feelings based speculation, you're need to research the market in order to understand how and why bitcoin is used.


text:
If there are a significant number of pruned nodes on the network will it impact network security?
The size of the Bitcoin blockchain is reaching 350 MB and adding more than 60GB per year. I feel verification node centralization a risk if the cost of storage does not drop.
My question 1:
Is using pruned nodes as good as full nodes?

I think a pruned node will have the same UTXOs as a full node (with a full blockchain) and it should be able to verify all incoming transactions and blocks.
It will not be able to provide blocks to a requesting node if it does not have them in its blockchain. But as long as newer nodes have the hash of the previous block this should not be a problem.

My question 2:
If there are a significant number of pruned nodes on the network will it impact network security?
Is there something I am missing?

So, 1Tb total in ~10yrs. I strongly question your assumption that verification node centralization is a risk if the cost of storage does not drop.  4TB SSD is $400 today, 14TB HDD was $500 (until recently when the miners apparently started buying high capacity drives for proof-of-store coins).  Not out of the reach of many people and absolutely not a factor for institutions.  It's possible some hobbyist or enthusiast nodes will drop out, but the growth of bitcoin as a value store will ensure that # of full nodes grow fast as many more people/companies get involved. I run 2, myself, 1TB SSDs.

If SegWit becomes popular we may see blockchain size rising 100GB per year. Currently, it is 60GB. I run one full node on my laptop.

Your points 1 & 2 are both correct. The good news is the only time those old blocks get requested is by new nodes that are still bootstrapping and downloading the blockchain for the first time. As long as those old blocks are available and accessible somewhere, those new nodes will sync up just fine.
Another fact about pruned nodes is they are required to store at least the most recent 288 blocks. So if your node has only been offline for a day, you can still sync up from a pruned peer.


text:
Getting wrong version number of block from block index of Bitcoin Core
I am reading block index using plyvel python package.
Following is the location of block indexes:
export BLOCK_INDEX_DB=$BITCOIN_HOME/blocks/index

Following is the method to decode b128 varint:
def b128_varint_decode(b: bytes, pos = 0):
    n = 0
    while True:
        data = b[pos]
        pos += 1
        n = (n << 7) | (data & 0x7f)
        if data & 0x80 == 0:
            return (n, pos)
        n += 1

LevelDB database for block indexes:
block_db_g = plyvel.DB(os.getenv('BLOCK_INDEX_DB'), compression=None)

Following method gets values in block index:
def getBlockIndex(block_hash_b: bytes, block_db):
    key = b'b' + block_hash_b
    value = block_db.get(key)
    jsonobj = {}
    jsonobj['version'], pos = b128_varint_decode(value)
    jsonobj['height'], pos = b128_varint_decode(value, pos)
    jsonobj['status'], pos = b128_varint_decode(value, pos)
    jsonobj['tx_count'], pos = b128_varint_decode(value, pos)
    if jsonobj['status'] & (BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO):
            jsonobj['n_file'], pos = b128_varint_decode(value, pos)
    if jsonobj['status'] & BLOCK_HAVE_DATA:
            jsonobj['data_pos'], pos = b128_varint_decode(value, pos)
    if jsonobj['status'] & BLOCK_HAVE_UNDO:
            jsonobj['undo_pos'], pos = b128_varint_decode(value, pos)
    return jsonobj

Following is the caller main:
if __name__ == '__main__':
    prev_blkhash_s = '0000000000000000000c5fc4ba692dc2cf016b8f45ec75eea2e12274879945a8'
    prev_blkhash_b = bytes.fromhex(prev_blkhash_s)[::-1]
    jsonobj = getBlockIndex(prev_blkhash_b, block_db_g)
    print(json.dumps(jsonobj, indent=4))
    print('-----------------------')
    print('0x%x' % jsonobj['version'])

I get the following results:
$ python3 SoftForkSupport.py
{
    "version": 210000,
    "height": 681458,
    "status": 157,
    "tx_count": 2313,
    "n_file": 2560,
    "data_pos": 46435432,
    "undo_pos": 5527623
}
-----------------------
0x33450

This is wrong as I can see the actual version of the block is 0x2f900004.
How can I get the actual version of the block from leveldb indexes?

The version that you are deserializing is not the block version but rather the client version that wrote that entry to the database. In your case, a client version of 210000 means Bitcoin Core 0.21 wrote that entry.
The block header (which includes the block version) is found after the status conditional fields (i.e. after undo pos). It is serialized as the header would be when received over the network.

Ok... This means I have to get the version from the actual block instead.

@VizeetSrivastava You shouldn't need to go to the actual block data. The block header should be included in the record you are already looking at. It should just be after all of the stuff you have deserialized.

Thanks, Andrew I'll look into this.

I am able to get it. The block index also contains block header. I modified the program to get it.


text:
What if all nodes stopped working
Based on my understanding, blockchains are stored on each node. Each node has a copy of the current blockchain and are updated whenever there is a new valid transaction. But what if all nodes stopped working? For example, there are 1,000 people currently using bitcoin. What if the computers of these 1,000 people stopped working? What will happen to the network? What if there is a new person not included in that original group of 1,000 people tried to run a blockchain client?

Without nodes in a network, there is no network.
In the situation where the 1000 nodes (or even a subset of them) suddenly came back online, the network would simply continue where it left off.
In the situation where all nodes went offline, and all existing data was lost, then the network would begin from scratch with a new blockchain whenever the nodes came back online.
Keep in mind that data loss of the blockchain is highly unlikely.  Since there are so many copies, it would take a fairly catastrophic event to destroy all copies.  In all seriousness, it's more likely that all members of the human race will be destroyed than it is for all copies of the blockchain to be destroyed.  Assuming that a copy exists, the network can always be restarted from one or more backups, and conflicting backups will follow the consensus algorithm to determine which version is more "correct".
Bitcoin is extremely resilient.

Thanks. But still theoretically, the blockchain can still be inaccessible. Was this the case at for example the start of bitcoin? Where say there were only 5-10 adaptors of the cryptocurrency. What if at that time, they all went offline? Would that mean that a new person trying to join will not see any network unless one of those 5-10 people come back?

Yes.  No other nodes to communicate with means no communication will happen.  There is no central server.

If no full node is present, then the network will not exists. Therefore no new client can use that network.


text:
is the chain code considered secret?
I'm confused by a statement in https://bitcoin.org/en/developer-guide#hardened-keys

"For this reason, the chain code part of an extended public key should
  be better secured than standard public keys"

I'm confused because I thought the chain code was an intrinsic and easily deciphered part of an extended public key.  For example the top answer here explains how to derive the chain code from any extended public key:
Key derivation in HD wallets using the extended private key vs hardened derivation
So how exactly is one supposed to obey the advice from bitcoin.org to "secure" this chain code when it's openly exposed in the public key itself?  Does a "hardened" public key not likewise expose its chain code?

The idea is that you shouldn't reveal the extended public key (and thus the chaincode) unless you want people to be able to know all of your addresses and potentially recover the extended private key. It should be considered semi-secret; more secret than just the public key itself, but less secret than the private key.
Knowing the extended public key allows someone to know what all of your addresses are, so you lose security. But it does not allow them to know the private keys except in certain circumstances. Because of the extended private key could be derived from the extended public key, you shouldn't give out the extended public key.
However there are few use cases where others do need to know the extended public key, and if you avoid the insecure case, it is safe and secure to reveal the extended public key. You just need to be extra careful in the future to avoid revealing a child key.

"it does not allow them to know the private keys except in certain circumstances"
what circumstances?

@Antoni If keys were derived from an xpub using unhardened derivation, and a child private key is known along with the parent xpub, the parent xprv can be derived. Doing this requires knowledge of the chaincode, but that is available in the xpub.

You can have your answer by considering why chaincode exists?
It exists to add entropy. If you read this answer you will find out that if any of your child-private-key leaks, chaincode can enable private key discovery of keys up the tree, including the master.
So it is part of a secret and hence a secret most definitely.


text:
does extended public key derivation go both directions
I understand that unhardened extended public child keys may be derived from any unhardened extended public key without access to any private keys.
Is the reverse also true -- can a parent extended public key be derived from a child extended public key?

Is the reverse also true -- can a parent extended public key be derived from a child extended public key?

No. BIP 32 uses hash functions in order to derive the child keys. In order to be able to derive the parent key from the child key, you should need to be able to reverse the hash function, which is currently impossible (I say currently because some vulnerability could be discovered which allows it to be reversed, but that is unlikely to happen).
Furthermore, the child key derivation also involves calculating a public key from a private key (that private key is basically temporary and doesn't actually reveal anything about the child private key). You would need to reverse that too, but doing so is also currently impossible (it is theoretically possible with a quantum computer).

Thanks for this.  I don't understand then how is it that an unhardened pub key + any child private key could compromise the entire tree all the way back to root -- wouldn't the ability to derive a parent pub key from its child be needed?

The issue is when you have the parent pub key and any child private key. That lets you derive the parent private key.

Ah OK.  But still now that you have a parent pub key and have derived the parent priv key, is that enough to then break into the grandparent layer, ie the parents of the parents?  In other words, can a parent key be derived from a child pub + child priv?  What I'm hearing described here is more of a sibling derivation at the same level.

No, the parent key cannot be derived using only child keys. But once you get the parent private key, you can derive all child keys, and, from there, any descendants of those child keys.


text:
Broblem for wallet blockchain privet key
When I want to convert btc from my wallet blockchain, they ask me to enter my private-key. When I enter it, I am asked to enter the password for the private-key. I do not know the password for private-key.
Is there a solution?

Without more information, I see a few posibilities:

You may have a BIP38 encrypted private key.

see: https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki
I suspect that maybe you are trying to claim a paper wallet?  If so, you need to know the password, or brute force it (unlikely).

If you are referring to a blockchain.com (formerly blockchain.info) wallet, those are proprietary to them and use their own format for the keys.  Again, you need to know the password, or brute force it.

If you don't have the password to your key any longer, then there are some wallet recovery services on the internet, which are risky and take a large percentage of the balance.  You can google "bitcoin wallet recovery", and always check reviews before engaging with one of these services to check their reputation.  Even so, they may be unable to recover the password.
Barring that desperation, do not provide your private key to anyone!

yes, depending on how much knowledge and effort you want to spend. But it is cumbersome, and requires a deep learning curve. Normally the private key should have 51 chars starting with "5", or 52 chars starting with "K" or "L". In rare cases you might have a hex value private key, that is a 32 characters long string. (Never post your private key here!!!).
Also you need to verify, if you have a "xpriv key" - that is a slightly different way of presenting a priv key, and has additional usage. This plays a role, when reloading into another wallet.
I am not familiar with blockchain.info, and if the private key is somehow encrypted with this password - maybe some research required. If it is encrypted, then this is not of much help, and I can't do anything for you.
So if you have one of those priv keys beginning with "5" or "K" or "L", then you have options:
You might get a wallet (like Electrum), and load the priv key there. It would then show you the corresponding address, and you can verify, if it is correct. It would then also show the funds.
Also you can assemble a transaction manually, sign it manually, and get it relayed to the bitcoin network. But this requires a good amount of sophisticated knowledge of the bitcoin network (at the command line layer).


text:
Given N addresses, Is there any way to know how many address are linked to a single entity?
Let's assume that we have N wallet addresses - Addr1, Addr2,.... AddrN, Is there any way to know how many of these addresses are owned by a single entity on the considerations that there's no direct or Indirect transaction links between any of these accounts and all of them are making transactions independently.

There is no clear way to do this.
Chain analysis techniques exist that can attempt to identify relations between addresses based on transaction patterns. However, these are not guaranteed to work and often miss relationships or result in false positives.
This "feature" is why it is recommended to use addresses only once, since it is hard to link multiple addresses to a single owner.


text:
RegTest with mainnet addresses
I am trying to run a private Bitcoin network for testing.
I tried to run a RegTest network, but I need the addresses to be in the format of the ainnet.
Can I configure the RegTest to run with Mainnet addresses?
Thanks!

Why do you "need" to do this? Mixing up addresses from different networks is a really bad idea. They have distinct formatting for a reason.

I want to test a product that is interaction with the node.
I have no way to change the code of this product, so I cant make it work with the testnet addresses.
And I prefer not to spent hundreds of dollars on tests and fees :(

Well I suppose you could run bitcoin in mainnet mode, but prevent it from actually finding any peers except local nodes you control. You should be able to generate blocks at the low difficulty of the genesis block and send transactions. You would need to be responsible for the keys and addresses you use and make absolutely certain that no one loses any real money.

Are you getting addresses from Core or using Core RPCs that take addresses (e.g. sendtoaddress)?

I am using the Core RPC only. I am not using the built in wallet

Tried to create a mainnet node and mine the first block. But by my computations, in my PC it will take me about 8 hours to mine each block.
Which is not ideal

Solved it!
I downloaded the bitcoin core source code,
changed the regtest node address parameters to be like the mainnet in the file src/chainparams.cpp.
Then compiled it, run the node on regtest and it worked like magic!


text:
What is the difference between Root Hash and Block Hash?
I was reading about how Bitcoin works from Satoshi's original paper. I had a query while going through the 7th paragraph. What is the difference between Root Hash and Block Hash? Isn't the block hash same as the hash of the root of its Merkle Tree? I have studied Merkle tree and understand how it works.

First, all transactions are hashed along a Merkle tree. The root of that tree is the Merkle root.
Then the block header is created with 6 fields: version number, the hash of the previous block, the time, the difficulty, and the Merkle root computed in the previous step.
Then that block header (which contains the Merkle root) is hashed, resulting in the block hash.

hashed* you mean? Thank You, solved my query.

@VaradBhatnagar You can help the site by marking answers as accepted if they are correct and address the question so that the question does not remain as "unanswered".

genius answer :)

Isn't the block hash same as the hash of the root of its Merkle Tree?

No

What is the difference between Root Hash and Block Hash?

The root hash is a 'Merkle Tree' of all the transactions in the block.
The block hash is a separate hash derived from data in the block header. Data in the block header includes the Merkle Tree hash, but also includes:

the block version number
the 256-bit hash of the previous block header
the current timestamp expressed as seconds since 1970-01-01T00:00 UTC
the current target in compact format
a random 32-bit 'nonce'.

Source: https://en.bitcoin.it/wiki/Block_hashing_algorithm


text:
Where is the lightning history persisted?
In relation to this question:
Alice & Bob where they transfer 1 BTC each other.

Both Alice & Bob transfer 1 BTC into a shared multisig address.
A ‘balance sheet’ is created where 1 BTC is paid by Alice -> Bob and 1 BTC is paid by Bob -> Alice.
In the above transaction, Alice signs the transaction and gives to Bob and vice-versa.
Either Alice or Bob can sign their counterparts payout transaction and broadcast it to the blockchain.
Alice will update the ‘Balance sheet’ as 0.5 BTC to Alice and 1.5 to Bob and send the payout transaction to Bob to sign.
To ensure neither Alice  or Bob revert to the old transaction, each will create an ‘anti-cheat’ transaction.
If Alice and Bob wants to close the channel, they can consensually close the channel and broadcast the transaction to the blockchain.

Where is this balance sheet persisted? What happens if BOTH Alice AND Bob lose this information?

We like to say that Bitcoin is decentralized, and it is, but all the data can be viewed as having a centralized "source of truth": the blockchain.  All transactions that have ever occurred are a part of this source of truth.  The management and upkeep of this source of truth, however, is decentralized.  Nobody is in charge of it, yet everybody agrees on a single set of data.
The lightning network, however, is even more decentralized.  It doesn't just manage and update itself without central authority, but there is no agreed upon "truth" of the network.  The activity that occurs between two participants in a channel is only the business of the participants, and nobody else ever needs to see it.  Therefore it is not shared, and unless the participants want to, it is not stored.  Once a channel closes, the participants have completely settled all transactions between each other with a single transaction to the main Bitcoin blockchain.  They may very well persist the activity data for their own purposes, but it is in no way required for them to continue to participate.

I understand that it is not shared with the public, but what happens if none of the channel participants are storing the transaction history, how would the final balance be committed to the chain when the channel closes?

The split of which party gets how much of the opening transaction at close is precisely the information that is being updated throughout a channel's lifespan.  It is updated by exchanging updated, partially signed transactions as part of the smart contract.  This exchange is pretty much all the LN is for.

@Dashi As a participant in Lightning, you yourself are responsible for broadcasting the final state to the network and the chain whenever your peers misbehave (including when they would disappear).

The balance sheet is persisted on both Alice's and Bob's Lightning nodes. If Alice and Bob lose all the data stored on their Lightning nodes and have no backups then the funds in the channel will be locked in a 2-of-2 multisignature address on the blockchain but all pre-signed transactions to close the channel will have been lost.
Whether the funds can be recovered or not will be dependent on whether Alice and Bob still have the private keys to sign a transaction from that 2-of-2 multisignature address. If they both do then they can negotiate the proportion of funds to be returned to both parties and both sign that transaction. If they are unable to come to an agreement the funds will be locked forever. If either one of them have lost their private key then the funds will also be locked forever.


text:
Difference between transaction chain vs blockchain
What are the difference between transaction chain in bitcoin and blockchain used in bitcoin?
Is it sufficient to say to each transaction refers to previous transactions in the transaction chain and also each transaction is part of a block which is a part of blockchain?

I've never heard of the term 'transaction chain' and I don't think this is the correct way to look at transactions. A transaction just uses an UTXO as input and puts out a new UTXO. The input becomes spent.

In order to say that a transaction is valid like A pay B 5 BTC, A has to refer to the previous transaction where he receives equal to more than 5 BTC, right?
So aren't all the valid transactions linked together like a chain?

You may find this question and its answers useful: https://bitcoin.stackexchange.com/questions/49569/why-does-the-blockchain-need-blocks

The blockchain consists of blocks which are collections of transactions. The blockchain is a linked list; each block has 0 or 1 previous blocks and 0 or 1 following blocks.
A transaction chain is a chain of transactions which is completely independent of the blockchain. A transaction chain is a directed acyclic graph; each transaction must have one or more previous transactions and zero or more following transactions.

There is a transaction hash chain. Each new transaction contains a back-link to the hash (often called the transaction ID) of the previous transaction. The blockchain contains blocks, each of which contains one or more transaction IDs. Each block on the blockchain maintains a back-link to the hash of the previous block on the blockchain. So you are correct: There are in fact two chains--a transaction chain and a blockchain.


text:
What is stopping pool managers to fake a miner?
What if a pool manager introduces a miner that is not there and then uses the reward distribution?

The pool members will notice that the pool is not mining as many blocks as it ought to, given its supposed total hash power as reported by the manager, and that they are therefore not earning as much money as they should.  A certain amount of this could be attributed to "bad luck"; but over time, or if it becomes extreme, they can tell statistically that something is fishy, and then they will switch to other pools.


text:
Hypothetical, is it possible to retrieve stolen blockchain currency?
It is my understanding that blockchain technology is decentralized meaning there is no middle man in transactions. This seems like it has benefits but it also has downsides. When necessary, middlemen are able to retrieve objects under their control and redistribute. But with blockchain, if a private key is stolen (this will inevitably happen a lot; probably due to social engineering) and funds are transferred, how can they be recovered? Other than getting the culprit to hand over their private key of course. Is there any "police" mechanism within the blockchain technology?

Proof-of-work blockchains offer transaction immutability, meaning transactions can't be undone or modified after the fact without having to redo all the work that was done since the time of the transaction.
In the case of a fraudulent transaction, several problems arise:

How can it be proven the transaction was indeed fraudulent? How can validators and miners determine which of the parties involved is the "rightful" owner? As far as the system is concerned, providing a valid signature is proof of rightful ownership.
If the transaction in question was confirmed, you'd need 50+% of miners to agree to redo all the work they already did in order to create an alternate history where the fraudulent transaction didn't occur. This rewriting has a huge cost on the network (while miners redo the work, they can't build on top of the latest block, grinding the chain to a halt). Getting people to agree to this would be nearly impossible.

Some blockchains (in particular Ethereum) had to deal with this issue (DAO problem) and opted for a custom change to the consensus code, which made that change opt-in and eventually resulted in a chain split between the people that wanted to remove the "fraudulent" transactions and those that didn't. Others (OMNI in the case of a Tether heist) decided to blacklist the addresses containing the stolen funds, requiring yet another custom, opt-in change to the consensus code.
Both cases involved humans making hard decisions and leaving some people unhappy about it, there isn't so far a generalized, on-chain, way to deal with this issue.

Does each individual bitcoin have a serial number?

@mathewbruens No. The blockchain is an immutable record of transaction outputs by which a balance is available to spend for the holder of the relevant private key. Transactions are instructions to move utxo's to new utxo's. Really, all that exists is utxo's and the instructions necessary to spend them.

If a transaction had to be reversed, it cannot be. What is necessary is a new transaction spending the balance of the fraudulent transaction's utxo's to a new address, which requires the private keys for the fraudulently obtained utxo's to sign for the transaction. Only catching the crook and forcing him to pay back stolen Bitcoins will work.

The attraction of bitcoin is that it has no administrative functions. If it had some kind of "reverse transaction" administrative function, who would be authorized to operate it? Every government? Some governments? There is no government that represents everyone who might use bitcoin.


text:
Why validate past the first node?
In Grokking Bitcoin on page 7, it is noted that:

Invalid transactions are dropped.  They will not reach further than the first node.

If so, why do nodes after the first node continue to validate the transaction?  If the node is not the first node to receive the transaction, doesn't that mean its valid -- otherwise it would not have reached further than the first node.
Can't the nodes just receive a broadcast of the tx and save themselves from the redundant verification?

This describes what the first node is supposed to do.  However, there's no guarantee that they will actually do it - they could be running modified software that passes along a transaction even though it is not valid.  The other nodes have no way to ensure that the first node is well behaved, except to redo the check for themselves.
This goes back to the trustless and decentralized nature of Bitcoin.  You don't want to have to rely on other people to avoid being cheated - you want to be able to verify everything independently.


text:
What if 0 value SHA256d block is mined?
I've been wondering about this for a while. It might even be impossible due to hash value of block being SHA256 value of SHA256 value of the block data, as far as I know (or is this only for Bitcoin addresses?) and there simply might not be a SHA256 value that produces 0 when it's hashed again, unless SHA256 outputs are very well distributed, which they might be in this case.
I have seen on some blockchain explorers that for the genesis block the previous reference block is 0. I thought that perhaps this would mean that Bitcoin blockchain might loop unexpectedly, but I figured out that coinbase transaction has 50BTC as an output, which would I guess make it invalid now that the block reward is bellow that.
Would there be any special problems with this?
Obviously if the difficulty gets too high, block hashes will start overlapping which could create these loops, right?
But I do understand that it is very likely that difficulty would have to grow quite unreasonably high for this, which it never might.

Words like "could" and "might" are misleading here.  If you try to determine the probabilities of this actually happening, you will understand why software is designed with the assumption that it never will.

Welcome to Bitcoin.SE! An interesting topic to consider. I have not looked at the genesis block, however, usually, a block hash is many characters long making a new block having a hash of a simple one 0 an impossibility. I sure hope that the code does not think of block hashes as a numeric representation!

The probability of a block hash being all zeros is the same of all being ones, and the same of odd digits being ones and even digits being zeros, and the same of being every other number.
So the problem created by a future block having the same hash as the genesis block or the block the genesis block points to as its previous block is the same problem of any future block having the same hash as any existing block today. It would not be a special problem.
It's currently believed this have a very low probability to happen, as there are not known SHA256 weakness.
In the practice, however, if something so unlikely happens, maybe some software like wallets or block explorers use the 'zero' value to identify the genesis block and present some bug or erratic behavior. Maybe some miner even mines another block on top of it, and then it broadcasts the new block to the network, where it may be rejected as a sibling of the genesis block, being regarded as part of orphaned chain.


text:
What roles has the TIME information play in the bitcoin header?
What role does the time play in the bitcoin header? Is it ok to set it to 1 sec after the last block and never change it while calculating? Will the block be rejected when the gap is to large?
If 2 people get the correct block ( reach the traget ) who will win? Does the time decide?
Information about the header is taken form here:
https://en.bitcoin.it/wiki/Block_hashing_algorithm

What role does the time play in the bitcoin header?

nTime is primarily used for calculating the difficulty at the next difficulty retarget.

Is it ok to set it to 1 sec after the last block and never change it while calculating?

Yes, but this will cause the difficulty to increase in a manner that is undesirable. Furthermore, if the time of the block is too far from real time, nodes may reject that block.

If 2 people get the correct block ( reach the traget ) who will win? Does the time decide?

The "winner" is decided by the blocks mined afterwards. The time is completely unrelated to this.

the time feature really doesn't play a role in the broadcasting of two simultaneously mined blocks. Those are just handled through broadcasting effect, forking and subsequent blocks mined. Time is started from the moment the miner began hashing to solve the POW. Its used to know how long it took in comparison with recent blocks found for the difficulty re-targeting calculation. It also serves as a record to know when a block was mined.

I believe OP is asking about the nTime field in the block header, which is an absolute timestamp, not the time since the miner started hashing.


text:
Can't find an API which gives me a full list of cryptocurrencies ordered by market cap
I need to know the top-10 crytocurrencies ordered by market cap so I am looking for an api that returns a list of coins ordered that way.
Does anyone know?

Welcome to Bitocin.SE! I see you already have an answer, you are on your way!

Take a look at this website. I think it what you're looking for.


text:
Is there information about the buyer and seller in the Blockchain?
Suppose I wanted to track transactions by an individual entity in the Blockchain, say Mr. Smith. Is that possible?

Welcome to Bitcoin.SE! You ask a serious question and I see you have several good answers already. Good luck!

I will revise my question slightly:
Suppose I was not interested in the identity of the person, but I was interested in tracking an ID. In other words, I don't care about Mr. Smith as such, but I want to isolate Mr. Smith's trades, and analyze them seperately from Mr. Jones'. Is that possible?

Yes & No
You can track a person's transaction only if you know that person's wallet address/es
By the wallet address/es, you can see the transaction.
The incoming transaction can be a buy, or a sale completed, etc.
The outgoing transaction can be a sell, or a purchase, etc.
You can also track a person using all his xpub key to know all the address/es at once.
Buy you cannot track a person just with a name or a single wallet address (if he owns multiple, which at this time, people do).
Hope this answers your question.

Suppose I was not interested in the identity of the person, but I was interested in tracking an ID. In other words, I don't care about Mr. Smith as such, but I want to isolate Mr. Smith's trades, and analyze them seperately from Mr. Jones'. Is that possible?

Still the answer would be a yes and no. Yes, if you know his xpub key and he only makes wallet from that xpub key. No, if he have multiple accounts (which is the case in normal scenario)

The question is very generic ... as such: No.. There are only addresses, pubkeys and address hashes visible. No names. But (!): assuming you buy s.th. at Amazon with your address, then Amazon knows about the link between address and name (to send the goods to). And we know,that data protection is not their main focus :-)
This is the reason why you want to use addresses only once.

Privacy is one of Bitcoin features. Regardless of the infrastructure that wallets follow to protect user privacy.
generating a new address for each transaction is a must.
Even if you have Mr.Smith Address. You will never get full and accurate information about his total balance or his contacts.
What if Mr.Smith address is belonging to an exchange? You are tracking the wrong person.

Is there information about the buyer and seller in the Blockchain?
Private information, no. Public information, yes. A transaction contains the input addresses (utxo's), public keys, output addresses and, the change address. None of these is stored with any private information on the blockchain and, even the different input or output addresses are not linked in any meaningful way apart from their association in an individual transaction.
Ordinarily, change will be sent back to a different receiving address than the inputs used to fund the transaction, and there is no way to distinguish a change address from any other outputs. Even to determine which of the outputs is the spend output and which is the change address back to the sender (if any) is at best a guess.
Occasionally, a user may be using a wallet configured without the ability to create new addresses. In this case change goes back to one of the input addresses, however, apart from that one address we still have no idea how many additional addresses the user may have with a balance in their wallet, they are not linked.
Suppose I wanted to track transactions by an individual entity in the Blockchain, say Mr. Smith. Is that possible?
The best you could hope to achieve without guessing is to determine the specific balance of specific addresses but with no way to link those together to understand wallet or user balances. No, that is not possible unless Mr. Smith discloses ownership of all of his addresses and you can find that information to link them.
I will revise my question slightly: Suppose I was not interested in the identity of the person, but I was interested in tracking an ID. In other words, I don't care about Mr. Smith as such, but I want to isolate Mr. Smith's trades, and analyze them separately from Mr. Jones'. Is that possible?
Given the above, no. There is no way to know which outputs are directed to any particular user, so you cannot then know who is spending. Even if you follow a transaction chain from output, to input, to output, you have no way to know when any BTC has changed hands.

Bitcoin means that the people are action pseudonomously. It's almost impossible to find out who is the owner of a random address.
But if you know the pseudonym (if you know that Mr. Smith has address XY), you can track every transaction to/from this address.

No, not really.  The blockchain tracks which transactions are comprised of outputs of previous transactions.  Since a transaction can have multiple inputs (pointing to the outputs of previous transactions) and outputs, each transaction can be paid from multiple people and paid to multiple people.  The addresses, themselves, have no association on the blockchain with any person or organization.  The blockchain simply doesn't store data on users.
However, if you were able to supplement the blockchain with data on who owns which address, you could to a certain degree of accuracy determine where money is coming from and where it is going.  Best privacy practices, however, make this more difficult...even if you have data to supplement the blockchain with.  This is why we say that Bitcoin is "pseudonymous".  You can track how money flows, but not the people/entities behind the movement.


text:
Segwit Addressed from xpub key
How can i get the public key of my segwit address with my extended public key. when i import the xpub into electrum it automatically creates a legacy wallet for me. i'm not with my nano and won't be with it for a while, please how do i go about it, thanks.

You have to convert the xpub into p2wpkh or p2wpkh-p2sh format. You can use this script to do it.

I have no idea how i am meant to run that script, can you please guide me?

see the readme file. you have to run it with the python3 interpreter in a terminal/shell.

You should change derive path to 49 instead of 44. if you are planning to use bech32 addresses then you should make your path 84 but it's not supported yet on electrum.

Thats the problem it doesn't let me choose the derivation path, it goes straight to creating the wallet when  i put in my xpub key

you should use the mnemonic phrase to import your wallet because I think they assume the path is 44 for that xPUP

As i said in my original post, i am not close to my ledger or my seed i just want to monitor my address, please do you know another way?

if you have your addresses you can add it to electrum as (watch-only) so you watch it.

I only have the xpub, i thought that was all i needed and when i import into electrum i get the legacy address and i use segwit.


text:
Recover keys from legacy blockchain wallet's mnemonic?
I have an old blockchain wallet that is worth trying to salvage
It seems the old password that the 18 word mnemonic originally had isn't working and another password I had listed also doesn't work.
I used their tool and it shows the original password.
I also have the wallet backup json file.
I have the email address for this account (I see all the notifications)
Can I derive the keys from either the mnemonic or json with the original password or perhaps with no password?
And has anyone be able to get blockchain to 'backup restore from an earlier date' like it says they can on their legacy mnemonic page?

The legacy blockchain.info mnemonic does not correspond to any private keys. Private keys are not derived from that as blockchain.info did not use HD wallets when they had those mnemonics. Rather the mnemonic is an encoding of your blockchain.info password.
In order to get your private keys, you will need the JSON file as that is what contains the private keys. If you know your password, the mnemonic is useless. If you don't know your password, get it using your mnemonic.
Unfortunately I don't think you can use blockchain.info JSON files outside of blockchain.info (at least not easily). You can try importing it to a new blockchain.info wallet using this: https://blockchain.info/wallet/import-wallet

Hi - thanks that seems like where I am right now.  I have the original pw and had a 2nd one written next to it..  I fear there must be a third pw that I changed it too that I don't have.   I was using a tool from git hub that lets me try passwords on the json file and once i get it right then i would get the private key that way.   Or like you say, use the import tool on blockchain and try different pw until i can crack it.   thx - I guess this will be a hobby going forward to guess it

https://github.com/blockchain/my-wallet-backup-decryption-tool/releases


text:
The Bitcoin Network
Isn’t it right that bitcoins transactions are only confirmed when a block is mined? So when we hit 21.000.000 and there are no blocks to mine, how will you transfer your bitcoin if it can’t be confirmed?

this is 100% a duplicate.

A misunderstanding. Blocks will continue to be mined after the last new bitcoin is delivered as a block reward several years from now. Miners are also paid any transaction fees as well as the block reward. This is why there are transaction fees. The number of blocks is not technically limited, provided several caveats e.g. there is enough storage available to download the blockchain.

Thank you for your comment. I just want to know things for sure, because normal bitcoin website explain it like this:
"Roughly every ten minutes, a new block is created and added to the blockchain through the mining process. This block verifies and records any new transactions. The transactions are then said to have been confirmed by the Bitcoin network."
See: https://www.buybitcoinworldwide.com/confirmations/
So really how could the network confirm it, without new blocks?

The quote is correct. The current consensus is that there will only be ever 21,000,000 Bitcoins (BTC) mined, however, there can be an indefinite number of blocks. Once the block rewards reduce to zero and the supply of new Bitcoin runs out, mining new blocks just continues without the block reward.

Thanks for your explanation! (if its still not clear for others: you can read comments from the same question I asked here: https://bitcointalk.org/index.php?topic=2940759.0)


text:
Ed25519 Successor to ECDSA in Bitcoin?
Bitcoin is currently using the secp256k1 curve. Understand that Ed25519 is technically superior -- i.e., offers better security than ECDSA and DSA, speed and most importantly, I think, resistance against side-channel attacks.
Sia, Scorex, BigchainDB, Chain Core, Monero are some examples where ED25519 is used.
Understand that BIP32 made mention of Ed25519. Has BIP32 and/or ED25516 been implemented in Bitcoin or?
https://www.ietf.org/mail-archive/web/cfrg/current/msg09115.html
https://datatracker.ietf.org/meeting/interim-2017-cfrg-01/materials/slides-interim-2017-cfrg-01-sessa-bip32-ed25519/
Nathan Aw


text:
How to verify that a signature was signed by a pubkey? Taproot and BIP0322
Using wallets like XVerse, users can sign a message using their ordinal btc address, let's say bc1XXX, the message is hashed based on BIP0322.
So I have:

User wallet: bc1XXX
Message hash: YYY
Signature signed by bc1XXX: ZZZ

So this data is sent to my backend server, and I want to verify that ZZZ was indeed signed by bc1XXX (and contains YYY as message).
I'm using this so far:
    const msgHash = bip0322Hash(message);
    const signatureBuffer = Buffer.from(signatureStr, 'base64');

    const decodedSignature = signatureBuffer.slice(2, 66);
    const recoveryId = signatureBuffer[0];

    // Extract public key from the signature
    const recoveredPublicKeyBuffer = secp.recoverPublicKey(
        msgHash,
        decodedSignature,
        recoveryId, // Recovery ID (0 or 1)
        false
    );
    console.log(publicKeyToTaprootAddress(recoveredPublicKeyBuffer)); //no match with my original pubkey that signed the message

But I have a hard time getting the correct address from recoveredPublicKeyBuffer which I can't match with the public key address of my test set.
I'm trying to use this function, but the output doesn't match my pubkey:
    function publicKeyToTaprootAddress(publicKey: Uint8Array) {
        // Compute the SHA-256 hash of the public key
        const hash = sha256(Buffer.from(publicKey));

        // Construct the human-readable part and the data part of the Bech32m string
        const hrp = 'bc';
        const data = sha256(Buffer.from([0x01].concat(Array.from(hash))));
        const data2 = bech32m.toWords(Buffer.from(data));

        // Encode the Bech32m string
        return bech32m.encode(hrp, data2);
    }

If you are looking for working JavaScript code, I recommend bitcoin-sdk-js which supports BIP322 including taproot address signing & verification.
Below is how to implement BIP322 signing & verification for p2pkh(legacy), p2wpkh(segwit) and p2tr(taproot).
import * as bitcoin from 'bitcoin-sdk-js'

const keyPair = await bitcoin.wallet.generateKeyPair();
const privkey = keyPair.privateKey;
const pubkey = keyPair.publicKey;
const legacyAddress = await bitcoin.address.generateAddress(
  pubkey,
  'legacy',
);
const segwitAddress = await bitcoin.address.generateAddress(
  pubkey,
  'segwit',
);
const tapAddress = await bitcoin.address.generateAddress(
  (
    await bitcoin.tapscript.getTapTweakedPubkey(
      pubkey.slice(2),
      await bitcoin.tapscript.getTapTweak(pubkey.slice(2)),
    )
  ).tweakedPubKey,
  'taproot',
);
const msg = 'message you want to sign';
// When
const sigLegacy = await bitcoin.crypto.signMessage(
   msg,
   privkey,
   legacyAddress,
);
const sigSegwit = await bitcoin.crypto.signMessage(
  msg,
  privkey,
  segwitAddress,
);
const sigTap = await bitcoin.crypto.signMessage(msg, privkey, tapAddress);
// Then
assert.strictEqual(
  await bitcoin.crypto.verifyMessage(msg, sigLegacy, legacyAddress),
  true,
);
assert.strictEqual(
  await bitcoin.crypto.verifyMessage(msg, sigSegwit, segwitAddress),
  true,
);
assert.strictEqual(
  await bitcoin.crypto.verifyMessage(msg, sigTap, tapAddress),
  true,
);

Disclaimer: I'm the owner of the library.

Assuming that recoverPublicKey is performing the ECDSA key recovery, this does not apply to BIP340 Schnorr Signatures. If you want to use BIP322 with Taproot addresses, you need the original public key.

so there's no way to get that information from the signature itself? How can I verify that an address has signed a message in that case, knowing that I have the address 'bc1p...', the signature and the message?

The address has the public key, encoded in base 32. Decode the address and the witness program part (what comes after the version) is a 32-byte vector containing an x coordinate for an x-only public key. Look for a public key parsing in the lib you're using

ok thanks for the help


text:
Are Monero Transaction Anonymous?
Lets say i have a monero address and want to send my coins to another address. Will that transaction be private? Can somebody find out that i sent those coins? Are there any altcoins that i can use to send funds from one address to another without anyone knowing that i did?

Short answer: yes, it will be anonymous
Long answer:
The following applies to all Cryptonote based coins, unless stated otherwise:
On the blockchain, all addresses are one time addresses. In Bitcoin, you are exhorted to not reuse addresses, but Monero enforces this. Every new transaction causes a new one time address to be generated, in such a way that the recipient can derive the private keys to that new one time address (and thus spend those funds).
Moreover, Monero uses ring signatures to obscure which outputs are being spent. Those ring signatures are made with 1 private key (the one you're spending) and an arbitrary of public keys, those of outputs that you cannot spend. The transaction you send will appear to spend one of that set. The trick is that you can generate signatures such that an observer (ie, someone finding the tx on the blockchain) can be assured that one of the outputs in that tx was spent with the corresponding private key, but cannot tell which one. On the blockchain, they only see the public keys of your spent output, and the N other public keys you picked from the blockchain.
So, to recap: an observer sees that an output among this set of outputs was spent, but does not know which one. And sees that it went to that new one time address, which has no link to the recipient's address (unless the observer has the recipient's view private key, nice trick to allow a third party read only access to your income).
Now, the devil's in the details. There are other ways inferences could be made, such as particular amounts being spent (ie, if you're sent a very specific amount of dust, it's the only output of that particular amount on the blockchain). The Cryptonote protocol splits amounts by denominations (ie, sending 153 monero will, create three outouts, 100 monero, 50 monero, and 3 monero, so it's a lot easier to hide). Monero is currently working on an adaptation of gmaxwell's Confidential transactions (https://lab.getmonero.org/pubs/MRL-0005.pdf), which can be used with ring signatures, so that this avenue will be fully blocked (this is Monero only, other Cryptonote coins do not have this).
So, yes, if you use Monero, your transactions will be private. Cryptonote is the state of the art in blockchain privacy, though Zerocash may top it once it is released, though Zerocash also has issues of its own, so this will be an interesting thing to see.
By the way, all the papers on https://lab.getmonero.org/ are worth reading if you want to know more about the details.

Coming soon: http://area51.stackexchange.com/proposals/98617/monero

private beta has now begun: http://monero.stackexchange.com/

For the math lovers, I will provide the mathematical intuition behind one-time public keys.
The assumption behind this technique is the hardness of discrete logarithm problem for groups like $Z_p^*$, Elliptic curve group.
Monero is using Elliptic Curve group as the underlying group. For simplicity, I will explain the concept with $Z_p^*$ but similar analogy and correctness will hold for any group where solving discrete logarithm is hard.
Consider the following
Let $Z_p^*$ be a group with multiplication modulo $p$ where $p$ is a prime and let $g$ be the generator of the group.
let $x$ be the secret key where $x$ is chosen uniformly randomly ${1,2,...,p-1}$ and the corresponding public key would be $ y = g^x$ modulo $p$.
Now using the key pair $(y,x)$ and any random string s we can generate one-time payable public key $(p',x')$ in the following way
        \begin{equation}
            x' = x + Hash(s)
        \end{equation}
        \begin{equation}
            y' = g^xg^{Hash(s)} \ \text{mod}\ p
        \end{equation}

Here the assumption is that Hash(s) will give us a string of length equal to the length of $p$.
Observe that only the user having secret key $x$ will generate $x'$ to spend from currency sent to the one time public key $y'$ under the assumption of the hardness of discrete logarithm problem on $Z_p$. And to an external observer, $y$ and $y'$ are statistically uncorrelated.

whereas the explanation seems to be quite nice, I wonder if this is an answer to the post below? Isn't the OP asking on privacy, whereas your answer goes more into "statistical unbreakability" of the ECDSA algo?

Through the answer, I wanted to show that the newly generated public key pk' is totally uncorrelated with the permanent public key pk, hence it provides privacy of the receiver. The maths for the privacy of the sender is little more involved. If anybody is interested have a look at  (https://people.csail.mit.edu/rivest/pubs/RST01.pdf) and (https://eprint.iacr.org/2006/389.pdf)


text:
Keeping valid shares for it's own when mining in a pool
How does a mining pool insure that the miner who will find the valid share for the current block will not use it for his solo mining?

The address the block reward goes to is in the data that is being hashed. That address is the pool's. If a miner finds a hash that meets the block difficulty, changing the address to the miner's own will cause a different hash, and you don't have control over the distribution of the bits in that second hash. So you don't get a block if you change the address.
Going the other way is the same: if the miner mines using his or her own address, that miner will not be able to send shares to the pool to secure part of next block the pool finds.
A miner can withhold the winning share though, which is detrimental to the pool, but cannot pocket the reward.

what about holding the hash hostage with a zero-knowledge proof?


text:
How can I convert my Bitcoin to Western Union urgently?
I tried posting in some forums but got no replies.
Is there any reputable exchanger out there that can send me Western Union transaction for my Bitcoins? It's not a big amount and I don't mind paying fees to both exchanger and the Western Union.

Many of the 419 scams (Nigerian Prince, distressed treasure, import scams, etc) are fully willing to just take your bitcoins, you don't need to convert them using Western Union.  If your scammer isn't willing to take bitcoins, find another scammer.

There are many Bitcoin buyers on LocalBitcoin who are willing to pay via Western Union. Look for someone with a very high feedback rating and do not release the Bitcoins from escrow until you are sure the payment you have received is final.
https://localbitcoins.com/sell-bitcoins-online/western-union/

A few sites and forums have professional traders and they would offer you this service. Fees is generally lower than fiat transfer through WU.


text:
How to put pool name in a Bitcoin Block?
If someone access blockchain.info, see blocks and Pool name who finded. I want know how sign this?
Thanks

Mining pools self-identify blocks they've created by putting an identifier into the freely choosable input space of the Coinbase transaction.

Signed blocks come with a Relayed by IP address field belonging to the solver of the puzzle. Blockchaininfo then on its own, assigns names of mining pools to the respective IP addresses.

this is wrong answer

would you like to elaborate?

Blocks are not signed and they certainly don't include IP addresses when relayed. Blockchain.info does track what IP address it was relayed a transaction from first, but I assume that in the case of blocks they simply go by the self-identification included by the authoring mining pools.


text:
How to alter user's data in block in blockchain if i want to change user's details
In blockchain each user's data stored in seperate block, right? If I have created my own blockchain and i want to alter some user's data then I would need to alter some perticular block as I have stored data in that perticular block. but it will break proof-of-work. So how to change block in blockchain to alter user's data? If I create new block with updated details then what happened to old data and next time how to know which block to refer?

I think you are confused. There is no "user's details" stored in the blockchain.

In blockchain each user's data stored in seperate block, right?

No, blocks do not store user data, they store transactional data.
A user of bitcoin can create a wallet using software of their choosing, and the wallet will store their keys that allow them to spend coins. The blockchain simply has a record of transactions, but no accounts/personally identifying information.
Instead the blockchain just specifices where the coins exist (in a certain address as a UTXO), and then users can spend coins if their wallet software contains the keys to that address.
So you never have to go and change an old block in order to spend coins. If you're trying to spend coins that were last sent 10 blocks ago, then you just need to sign using the key that corresponds to the address those coins exist at. This will create a new UTXO, with your transaction specifying which new address the coins will be locked into.


text:
Visual Memorable Seed Phrase
Can you please help improve my thinking on any of the below?

A crypto (e.g. bitcoin) private key is a 256-bit number (a series of 256 digits that are all 0 or 1).
Private keys are usually derived (via 1-way hash) from a randomly-generated 24-word Bitcoin BIP39 Mnemonic Seed Phrase (which is human readable).
Sample seed phrase:
decade lobster engine jar matter life forum rule push stay slab manual pretty inflict future spare veteran voice biology problem glass derive bind enable

The words all come from this list of 2,048 words:
https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
Using the 2,048 word list of BIP-39, when constructing a seed phrase, each word adds 11 bits of entropy to the phrase, ensuring that a 24-word seed phrase contains enough bits (264 bits) to securely encode a 256-bit private key along with an 8-bit checksum.
One of the cool features of crypto is that wherever you are, no matter which borders you walk across, and no matter which companies are dominant in the world, you have control of property just via your knowledge of your private key.
Most people (other than those leaving their crypto on an exchange that holds their private keys for them) use a hardware device like Ledger to manage their private key(s), and for convenience they can access it with just a short memorizable PIN.
But if the hardware device gets lost or destroyed, that PIN is useless. The only way to “recover” your assets is via the private key (or a version of it, such as the 24-word seed phrase).
So people try to find ways to back up that seed phrase, such as using https://cryptosteel.com/  and then burying it somewhere private or putting it in a safe deposit box.
But I imagine that some (relatively few, though) people want to memorize their seed phrase and have NO physical or digital evidence of it anywhere.
I never hear about anyone attempting to memorize their ordered 24-word phrase.
It would be like trying to memorize 24 2-word pairs, since you’re really memorizing words plus their positions in the list.
Very difficult to do when the words come randomly from a huge list of all types of words (nouns, verbs, adjectives, etc).
It would probably require the skills of a world-record-holding memorization expert.
Hypothesis:
We could generate a more memorable seed phrase if instead of 24 2-word pairs we use 10 5-word phrases, as long as those phrases are more visually and viscerally memorable (based on some story you can make up for yourself).
Inspired by https://genius.com/Christmas-songs-the-twelve-days-of-christmas-lyrics which is 12 3-word phrases (e.g. “5” “golden” “rings”, “4” “calling” “birds”, “3” “French” “hens”).
The approach I’ve come up with so far is to think of your list of 10 as gifts that you’re giving to 10 people.
The 5 phrase parts are:

quantity
color
item
nationality of the recipient
profession of the recipient

Your “seed phrase” would then be very visual.
A tool would create 10 labeled images for you.
The partial proof of concept below is not what it would actually look like.
The 4th image in the following example would contain 4 brass-colored icons of a drill, the Brazilian flag, and the icon for a coach.

It’s still daunting to memorize 10 5-word phrases, even with pictures.
And most of us won’t even bother trying.
But I wonder if some people might really appreciate this.
To get enough entropy, there are:

10 phrases
40 colors (the most popular ones)
400+ objects
137 countries (ones with highest GDP)
40 professions

Please let me know if there are any problems (security or otherwise) with my approach.
If people think this could be useful, I can finish building out what I've started and share it.
P.S. If "brain wallet" is defined as a seed phrase that was decided by a human (rather than generated randomly with high entropy), this is not that.

I don’t think this is on-topic as this is a request for feedback, not a question. This would perhaps better be directed at the Bitcoin developer mailing list or a forum, perhaps with the idea described in a gist or blog post.

@Murch I bet I could alter the question to be narrower to make it on-topic, then, right? Since asking about security is on-topic? Do you have suggestions for how I could fix my question? Thanks.


text:
How can I find a digital forensics expert to help trace stolen bitcoins?
Are there any professional organizations that have lists of blockchain analysis and digital forensics experts by location?
I know some of this work can be done online but a directory of experts by location would be helpful, since I prefer to work with someone locally.

Contact erik voorhees. http://moneyandstate.com/looting-of-the-fox/

for what country are you looking for local forensic experts (if still applicable)?

I'm not sure of the existence of a directory of experts by physical location since Bitcoin is a digital currency.
Elliptic is a blockchain intelligence company identifying illicit activity on the Bitcoin blockchain and providing services to leading Bitcoin companies and law enforcement agencies globally. Their HQ is in London and main office in New York. More information of the company is available here. If you're based in either of these locations you could contact them locally.


text:
Uncomfirmed Transaction
I sent 2.1439245 bitcoins to
1AEcB37MngXzuvailFr1f31qobvzBFXF4e9
on May 27 and the transaction has still not been received. I contacted the merchant that I bought from and they said that they have not received any bitcoins and I should claim for a refund.
The transaction number is
6ff626d639d4fb9658ecaff

https://www.blocktrail.com/BTC neither of those numbers seem to be valid. What wallet are you using?

From whom would you claim a refund?  To me it sounds like you still have the bitcoin in question, so I'm not sure what needs to be refunded.  Since the address you listed is invalid, you couldn't have possibly submitted a transaction to the network paying that address.  Ask the merchant to give you a valid address, or you won't be able to pay them.

Before you send Bitcoin next time look up the receiving address in a block explorer to see if it is valid. Re-sync your wallet. Your Bitcoin is still there. You cannot lost Bitcoin by sending it to an invalid address.

As others already pointed out, neither the address nor the transaction id are valid. Therefore, you have not sent any bitcoin when using that address, except if you wallet is really poorly made.
It might, however, be the case that you wallet doesn't show you the funds any more if you tried to send them. In this case, export your private key and create a new wallet using it. The new wallet will show you your funds and you'll be able to send them to a correct address.


text:
unconfirmed btc transaction
im using bitcoin classic as a wallet and I've never had a problem before. I sent 1.8 btc over an hour ago and it's still unconfirmed. It's also not showing up on the blockchain..
https://blockchain.info/address/1787Dwi6a8p8yoNHYWBxe8fC337ssD1S4e
any help would be much appriciated.

Looks resolved.

If you need faster confirmations use Doge or other altcoin. BTC by design have long confirmation times and is a bit overcrowded nowadays with its 1MB blocks.

@JakubJagiełło or he could just pay an appropriate fee.

According to BC.i's info page on the transaction it was mined 7 minutes after they first saw it. One of two things occurred: either your transaction didn't propagate fast enough (eg. you had poor connectivity when broadcasting it, maybe only to Classic nodes or something) or BC.i only saw it late, just before it was mined.

authors: Нонн Болдырев


text:
During Bitcoin Script execution, what is the significance of the signature verification in the stack?
During execution of the script i.e. ScriptSig + ScriptPub , the last step is the verification of the Signature against the public key provided by the recipient. How does this work and what is the significance of verifying two entities which belong to the same user?

How does this work

Bitcoin uses the Elliptic Curve Digital Signature Algorithm. The algorithm is described on Wikipedia (linked). Bitcoin specifically uses the secp256k1 elliptic curve.

what is the significance of verifying two entities which belong to the same user?

There are not two entities.
The signature proves that the owner of the private key which corresponds to the public key created the signature over a given message. In the case of Bitcoin, the message is the hash of the transaction (excluding the signatures themselves because they don't exist yet). This ensures that the person spending the output is allowed to do so and ensures the integrity of the spending transaction itself.

Okay but according to my understanding, both the signature and the public key are provided by the same address. So how can it be fool proof?

The scriptPubKey of the output that is being spent specifies that the public key must hash to a hash specified by the scriptPubKey.

Can you please elaborate? I am a beginner in Blockchain and Bitcoin.

Each input must reference the output from a previous transaction that it spends from. That output contains an output script which is called the scriptPubKey. That scriptPubKey is combined with the input script, the scriptSig, and run as a program. The scriptPubKey typically specifies the hash of the public key that is allowed to spend the transaction output. The person spending that output has no control over the scriptPubKey; it is provided by the person creating the output.

A similar message, and a link to Andreas’ book, cause explaining here all the stuff would waste the space... https://bitcoin.stackexchange.com/questions/69062/why-does-bitcoin-uses-a-script-language/69077#69077


text:
Every bitcoin wallet user has one Private Key or every address has one private key?
I read somewhere that Private Keys are used to uniquely identify users and one user can have multiple addresses. So how does it work? Each private key derives a user or each private key derives an address ?

There seem to be a couple of misunderstandings that I will try to clarify (briefly).
In public-key cryptography a pair of keys is used; a private and a public. The private is kept secret and the public shared. Assume that Bob has the public key of Alice. Alice can then sign a message using her private key and send the signed message to Bob. Bob can use the Alice's public key to verify that it was indeed signed by that private key. Because of the mathematical properties of public-key cryptography only the owner of that private key could sign that message.
A Bitcoin private key can be used to derive a Bitcoin address.
A HD key can be used to derive several private keys which in turn can be used to derive a Bitcoin address.
So, to answer your question:
A private key does not really uniquely identify a user. It just allows someone to prove that he owns a private key (has control over a specific address)
Nowadays wallets are HD wallets thus use a master key that all private keys (and thus addresses) are generated from.
So one user can have multiple address because they have multiple private keys associated with them. The private keys could be generated from one master key (HD wallets) or randomly (several non-HD private keys). Anyone holding a private key can prove that he controls the derived address without revealing that private key.

Maybe this helps you:

1 user per private key (if you don't share it or give access to your wallet)
1 or many private keys per user.
1 private key per address (otherwise collision).
1 (or alternatively 2) address(es) per private key.
1 or many private keys per wallet

Okay, I understand but when a 1 input 2 output transaction happens and there is some change amount left, it is sent back to same user but at a different address. Does the wallet integrate all addresses belonging to a user to show him his balance/ unused bitcoins ?

yes, depending on the way the wallet is built (newer wallets use HD keys). The wallet is a "collection" of keys. The change address belongs to one of the other keys in the wallet. This has to do with the idea of not reusing keys. Have also a look into Andreas' book "Mastering Bitcoin", he explains it very well: http://chimera.labs.oreilly.com/books/1234000001802/index.html


text:
Bitcoin Withdrawn from Cryptobridge not showing up on my Bitcoin Core Wallet
Hey so I sold my Argo on Crypto-bridge and received bitcoin. When I withdraw said Btc to my bitcoin core wallet, how long does it take for it to show up?
There are two transactions in question here:
1) I withdraw the bitcoin to my wallet when it was syncing. Now that the syncing is done, I don't see anything show up. It's been 2 days now
2) I withdrew bitcoin to my wallet after it was done syncing. How long will this one get into my wallet. This happens today.
Both of these transactions have went through on Crypto-bridge but never showed up on my end.
My wallet address for bitcoin is
13zQ6niRwL4kWrJs76BCsf3FmERtBWDYke
Is Crypto-Bridge a scam market?
Please help me out

Welcome to Bitcoin.SE! You ask a good question, I will take a look.

I have no information on Crypto-bridge.
Currently, no transactions seem to have been broadcast to the network for your address.
You should confirm that you sent BTC to you Bitcoin Core wallet (and not altcoins with a different symbol, not BTC). I would get in touch with Crypto-bridge customer support to enquire.


text:
What is the exact difference between combinepsbt and joinpsbts
They seem to do pretty much the same thing.
The only apparent difference being that combinepsbt seems more for updating the same psbt with imcremental signatures while joinpsbts seems more for joining different transactions but given in combinepsbt you can also add different inputs and outputs I don't see the difference.

What makes you think that combinepsbt can add inputs and outputs? It is not supposed to, and if it does, that is a bug and should be fixed.

I think I got confused between "input data" and transaction "inputs". Now I get that combinepsbt combines only transactions that have the same inputs and outputs but different "input data".

combinepsbt takes multiple PSBTs that have different input data and merges them. The base transaction must be exactly the same, i.e. the same inputs are consumed and the same outputs are created. The information for each input is combined into the same input. Inputs and outputs cannot be added or removed. This allows for people to send the same PSBT to be signed by multiple different people and then merge the resulting the PSBTs back together.
For example, suppose you have a PSBT that consumes 2 inputs, with input 1 requiring person A to sign and input 2 requiring person B to sign. You give both person A and person B copies of that PSBT to sign. Person A returns you a PSBT which has input 1 signed (i.e. they fill in input information like UTXO, partial signatures, final scriptSig, etc.) but input 2 is not. Person B returns you a PSBT which does not have input 1 signed but input 2 is signed. combinepsbt allows you to merge the PSBTs from both person A and person B into a single one which has both inputs signed.
joinpsbts is very different from this. joinpsbts joins multiple PSBTs that have different underlying transactions into one transaction. It requires that the inputs of those underlying transactions be different from each other. Furthermore, joinpsbts will discard any signatures and finalized input fields from the original PSBTs (meaning the resulting PSBT will contain no signatures) as those signatures will likely be invalidated when joining.
joinpsbts lets you make transactions which has other people involved in them (such as CoinJoins) more easily. Each person can specify the inputs and outputs they want in a PSBT and then all of these PSBTs with different inputs and outputs are merged together using joinpsbts.

So A performs a walletcreatefundedpsbt.
B perform a walletcreatefundedpsbt as well.
B sends his transaction to A.
A perform a joinpsbts with the two transactions.
A perform walletprocesspsbt signing the unsigned transaction.
B perform walletprocesspsbt signing the unsigned transaction as well.
A or B perform a  combinepsbt of the two transactions, a finalizepsbt and broadcast?
Thank you for your huge work and for answering.

Yes, that is a possible workflow.


text:
Exact syntax for lightning-cli txprepare
I have tried many different forms but I cannot prepare a transaction with lightning-cli txprepare from the Linux prompt.
lightning-cli txprepare [{\"bc1qvzr0mwps952d0cdmchyd2pe5rlee5tfces5dzf\":\"all\"}] slow 1 [c2ff...:1]
lightning-cli: Incorrect 'id' in response: null

lightning-cli txprepare "[{\"bc1qvzr0mwps952d0cdmchyd2pe5rlee5tfces5dzf\":\"all\"}]" slow 1 "[c2ff...:1]"
lightning-cli: Incorrect 'id' in response: null

and many other trials.
What is the correct syntax?
How is it possible to avoid the double quote issue in the shell?
Is it possible to have an actual example of what SHOULD work?
Thank you.

For readers, this issue has been resolved here.
Note that Gabriele's syntax was correct but that you currently cannot use unconfirmed UTXOs with txprepare [1] ! The documentation has been update accordingly.
[1] This caused lightningd to crash but has been fixed by now.

Well,
It seems that this format works:
lightning-cli txprepare "[{\"destinationaddress\":\"all\"}]" slow 1 "[\"txid:1\"]"

It is  also logic from an encoding point of view but for a reason I don't know, I always mistake something.


text:
Were there any Bitcoin based prediction markets for the Brexit referendum?
Were the are Bitcoin based prediction markets for the Brexit referendum?
If yes, how did the prediction market fare compared to recent public polling data versus the actual referendum results?
Are there any studies comparing the accuracy of Bitcoin based prediction markets to other forecasting mechanisms?

There is at least one market I am aware of that covered the event although the contract language seemed to focus on the UK actually leaving the EU (which does not happen immediately) by a certain date rather than the referendum vote itself.
The prediction market below and every fiat prediction market I saw before the referendum vote predicted the "stay" votes were win. Although the polls were close, it appears that both the polls and prediction markets (that predicted the stay votes would prevail) were wrong on the referendum result.
"Long shares will resolve at m฿10 and short shares at m฿0 if the exit of the United Kingdom from the European Union is effective in 2016 or 2017."
https://www.predictious.com/politics/brexit-2017/leave
Hivemind is the most well known Bitcoin prediction market now in development.
http://bitcoinhivemind.com/
Here are a few more Ethereum DAPPs (which may accept the Bitcoin currency) in various stages of development:
https://www.augur.net/
https://groupgnosis.com/dapp/#/markets