text:
Where can I see Taproot scripts?
I am trying to look more into Taproot scripts and was wondering if someone could help me on how to access them? I was thinking of using a blockchain explorer that decodes Taproot scripts but I can't seem to find any.

@Pieter Wuille how were able to tell what is an output and input. I thought they were all inputs because of the red arrow.

I didn't use mempool.space to inspect the transaction, but on that website: inputs are on the left (and have a red arrow before the address) while outputs are on the right (and have a red arrow after the address).

Does e.g. the "Details" button on Mempool.space satisfy your inquiry?

mempool.space doesn't support searching for Taproot (P2TR) addresses/spends does it? You need to know transactions that are spending from P2TR addresses.

And Bitcoin Core decodescript RPC can do that also (Pieter comment on another post)

Mempool.space recently added the mempool goggles that allow you to filter transactions in future blocks by various criteria: https://i.sstatic.net/Vk9ca.png

Neat, not currently live on the site right? I can't click on the next predicted block to be mined I don't think.

Just click the upcoming block: https://i.sstatic.net/LBUUb.png

Strange, I'm clicking on it and nothing is happening. Never mind, thanks.

I click the upcoming block (note that it is on the right if you swapped directions), which then pops up the "Next Block" view. When I hover over the content of the next block, the mempool goggles are shown in the top left of the square (https://i.sstatic.net/dYwRL.png). Click the goggles to get access to the filters. If you don’t see it, perhaps you forbid Javascript on mempool.space?

If you're looking for a blockchain explorer for Taproot scripts, there's scriptpath.info (disclaimer: I created it). It only shows transactions that spend Taproot script path inputs, decodes their scripts and gives some additional information. However, it doesn't allow you to search through the transactions in any way.
For any meaningful analysis you'll probably have to resort to reading the blockchain from a local node and extracting the Taproot scripts yourself (how to do that you can find out in other answers on this site, or you can just read BIP341).

So for this transaction:
https://mempool.space/tx/b8ef0b668eafb0f03f11c3af6ed7024a69c5f10a482e239b1179b8b293baa831
There is no Tapscript right? Even though they use P2TR.

@mark That transaction has two P2TR outputs, but only a P2WPKH input. P2TR outputs can be spent using just a signature ("key path spending") or by satisfying a script ("script path spending"), but the distinction only exists at spending time. As the transaction you link to has no P2TR inputs, there is nothing to say about it.

Taproot has evened the playing field. Bitcoin now has a clear path to deployment of smart contracts, decentralized autonomous organizations, and more. Products like the Lightning Network have already shown that fast and reliable transactions can still be backed with an immutable ledger, even without the access that Taproot will give developers of the future.


text:
What are the extra peers.dat files?
I am restarting my bitcoin node. I noticed there are more than one peers.dat files, and many don't end in .dat. Should these be deleted? Is my node compromised? Any explanation is appreciated. Thank you!

source: Stack Exchange

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

sort: votes


text:
Security of spending
New to Bitcoin. Looking at a tx structure, the input is signed to "unlock" it. What prevents an attacker from taking this and then spending as they wish? That is, Alice wants to send 1 BTC to Bob out of 2 BTC she has (the output of some other tx), so she creates a tx with her signature on the 2 BTC and 2 outputs: 1 to Bob, 1 to herself (neglecting fee here). Just before transmitting the tx, Charlie sniffs the signature, creates a new tx referencing those 2 BTC and with Alice's signature, and where the output is to him and sends it. What prevents him from doing so?

For standard pre-Segwit transaction patterns (e.g. P2PK,P2PKH,P2MS), the typical procedure is that Alice would sign a transaction template that includes the new transaction's exact output(s). For the signature to be verifiable, those outputs must be included as they are. So Charlie's new transaction with different outputs would not have a verifiable signature, and thus would be invalid.
There are ways to construct signatures in which the outputs are left open, however. Which of the six possible configurations of inputs and outputs that are signed can be set using the hashTypeCode (a.k.a SigHash flag). If Alice decided to use the SIGHASH_NONE flag, for example, the outputs would not be signed and Charlie (or anyone) could spend the new outputs.
For Segwit transactions (e.g. P2WPKH) a refined version of the procedure is used. See BIP143.

A cryptographic signature is only verifiable and valid in the context of the message that is being signed. In Bitcoin, the signed message is the transaction commitment (aka sighash). You can think of the transaction commitment as a fingerprint of the complete transaction. Generally, it commits to the entire transaction including all inputs and all outputs. If an output on the transaction is changed, its transaction commitment no longer matches the signed transaction commitment, and the signature is invalid in the context.
Due to the transaction commitment, generally, no third party can change the outcome of the transaction. For advanced transactions, sometimes signers will only commit to less than the complete transaction to allow other users to fill in parts of the transaction, but you can rely on your wallet software to always commit to the entire transaction unless you specifically instruct it otherwise.

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


text:
Bay Global Funding.com Legit?
I signed up for an account with this site for crypto exchange. My dashboard now shows a significant return but I now have to purchase a plan to withdraw it. Is this common and is this site even legit?


text:
Broadcast Error RPC error: {"code":-26,"message":"non-mandatory-script-verify-flag (Invalid Schnorr signature)"}
While broadcasting raw transaction has to chain, got the below error
RPC error: {"code":-26,"message":"non-mandatory-script-verify-flag (Invalid Schnorr signature)"} but signature verification method says its a valid signature for the given message.
I'm trying to do a simple taproot send transaction (key path spending). Signature is given by external signer
My data points are as below
{
  message: '60ccb78b5936d80f63c32eeafe9b746909d7e716f0f96988f437972e633ec7e0',
  signature: 'ed3061523f39137cdab4c9ca0bf9b62433b9642bb8165d996dcc120662866e8060e6f2314d7b03bab31f0a95b4574ddbed2892a176d2723810bd28fda66d1496',
  publicKey: 'ddb666300b8d7ef23e61e2ff3af3c70b59f882d6de1deb601590bb4d15b5d5d3'
}

Transaction hash
020000000001012bd272fa216d2370e265f591907266a8e76a26bc0be4318c9b1b340eaa6134860000000000ffffffff021027000000000000225120ddb666300b8d7ef23e61e2ff3af3c70b59f882d6de1deb601590bb4d15b5d5d3a8c8fa0200000000225120ddb666300b8d7ef23e61e2ff3af3c70b59f882d6de1deb601590bb4d15b5d5d30141ed3061523f39137cdab4c9ca0bf9b62433b9642bb8165d996dcc120662866e8060e6f2314d7b03bab31f0a95b4574ddbed2892a176d2723810bd28fda66d14960100000000

This is my entire code
import sha256 from "sha256";
import { Psbt, networks, payments, Transaction } from "bitcoinjs-lib";
import dotenv from 'dotenv';
import { verifySchnorrSignature } from "./mpc/address.js";
import { signBTCTransaction } from "./systemCallerUtils.js";
dotenv.config();

const UNCONFIRMED_HEIGHT = 4194303;

async function btcSendTransaction() {
  try {
    const address = process.env.BTC_ADDRESS;
    return await createSendTransaction(address);
  } catch (err) {
    console.error("Error in btcSendTransaction:", err);
    throw err;
  }
}

async function createSendTransaction(address) {
  const txObj = await handleTxObj(address);
  const { preSignTxHashes, psbt } = await generatePreSignTxHash(txObj);
  console.log("preSignTxHashes", preSignTxHashes);

  // Generate signatures for each input
  const generatedSigns = [];
  for (let i = 0; i < preSignTxHashes.length; i++) {
    const generatedSign = await signBTCTransaction(preSignTxHashes[i], "HASH");
    if (generatedSign) {
      generatedSigns.push(generatedSign);
    }
  }

  // Remove the '0x' prefix for verification
  const hashToVerify = preSignTxHashes[0].replace('0x', '');
  console.log('Hash for verification:', hashToVerify);

  try {
    const isValid = await verifySchnorrSignature(
      hashToVerify,
      generatedSigns[0].sign
    );
    console.log("Signature verification:", isValid);

    if (!isValid) {
      console.error('Verification failed:', {
        hash: hashToVerify,
        signature: generatedSigns[0].sign,
        pubkey: process.env.MPC_PUB_KEY
      });
      throw new Error('Invalid signature generated');
    }
  } catch (error) {
    console.error('Verification error:', error);
    throw error;
  }

  try {
    if (generatedSigns.length) {
      const response = await broadCastTx(generatedSigns, psbt);
      return response;
    }
  } catch (e) {
    console.error('Broadcast error:', e);
    throw e;
  }
}

const handleTxObj = async (address) => {
  try {
    let utxos = await getUtxos(address);
    utxos = utxos.filter((v) => v.height !== UNCONFIRMED_HEIGHT);

    const outputAmount = 10000;
    const feeRate = 200;
    const outputs = [{
      address: address,
      amount: outputAmount,
    }];

    const { selectedUtxos, totalValue } = selectUtxos(utxos, outputAmount + feeRate);

    console.log("selectedUtxos", selectedUtxos);

    return {
      fromAddress: address,
      utxos: selectedUtxos,
      outputs,
      feeRate,
      toAddress: address,
    };
  } catch (error) {
    console.error("handleTxObj error:", error);
    throw error;
  }
}

export function selectUtxos(utxos, targetAmount) {
  utxos.sort((a, b) => b.value - a.value);
  const selectedUtxos = [];
  let totalValue = 0;

  for (const utxo of utxos) {
    selectedUtxos.push(utxo);
    totalValue += utxo.value;
    if (totalValue >= targetAmount) break;
  }

  if (totalValue < targetAmount) {
    throw new Error('Insufficient UTXOs to cover the target amount');
  }

  return { selectedUtxos, totalValue };
}

export const generatePreSignTxHash = async (txObject) => {
  const network = networks.testnet;
  const psbt = new Psbt({ network });

  try {
    const { utxos, fromAddress, outputs, feeRate } = txObject;
    let inputSum = 0;
    const pubKey = process.env.MPC_PUB_KEY;
    const xOnlyPubKey = Buffer.from(pubKey, 'hex');

    // Add inputs using the actual UTXO script
    for (const utxo of utxos) {
      inputSum += utxo.value;

      // Get the actual UTXO details
      const txDetails = await fetch(`https://esplora.signet.surge.dev/tx/${utxo.txid}/hex`).then(r => r.text());
      const tx = Transaction.fromHex(txDetails);
      const outputScript = tx.outs[utxo.vout].script;

      console.log('UTXO details:', {
        script: outputScript.toString('hex'),
        value: utxo.value
      });

      psbt.addInput({
        hash: utxo.txid,
        index: utxo.vout,
        witnessUtxo: {
          script: outputScript,
          value: utxo.value,
        },
        tapInternalKey: xOnlyPubKey,
      });
    }

    // Add outputs
    for (const output of outputs) {
      psbt.addOutput({
        address: output.address,
        value: output.amount,
      });
    }

    // Add change output
    const totalOutputAmount = outputs.reduce((sum, output) => sum + output.amount, 0);
    const changeAmount = inputSum - totalOutputAmount - feeRate;

    if (changeAmount > 546) {
      psbt.addOutput({
        address: fromAddress,
        value: changeAmount,
      });
    }

    // Generate signing hashes
    const unsignedTx = Transaction.fromBuffer(psbt.data.globalMap.unsignedTx.toBuffer());
    const preSignTxHashes = psbt.data.inputs.map((input, index) => {
      const hash = unsignedTx.hashForWitnessV1(
        index,
        [input.witnessUtxo.script],
        [input.witnessUtxo.value],
        Transaction.SIGHASH_ALL
      );

      console.log('Input details:', {
        script: input.witnessUtxo.script.toString('hex'),
        value: input.witnessUtxo.value,
        hash: hash.toString('hex')
      });

      return `0x${hash.toString('hex')}`;
    });

    return { preSignTxHashes, psbt };
  } catch (error) {
    console.error('Error in generatePreSignTxHash:', error);
    throw error;
  }
};

export const broadCastTx = async (signatures, psbt) => {
  if (!signatures.length) {
    throw new Error('No signatures provided');
  }

  try {
    signatures.forEach((sig, index) => {
      const sigBuffer = Buffer.from(sig.sign.replace('0x', ''), 'hex');
      console.log(`Raw signature for input ${index}:`, sigBuffer.toString('hex'));
      console.log('Signature length:', sigBuffer.length);

      // For Taproot with SIGHASH_ALL
      const sigWithHashtype = Buffer.concat([
        sigBuffer,
        Buffer.from([Transaction.SIGHASH_ALL])
      ]);

      console.log(`Signature with hashtype for input ${index}:`, sigWithHashtype.toString('hex'));

      psbt.updateInput(index, {
        tapKeySig: sigWithHashtype
      });
    });

    psbt.finalizeAllInputs();
    const tx = psbt.extractTransaction(true);
    const rawTx = tx.toHex();

    console.log('Final transaction:', rawTx);
    console.log('Transaction details:', {
      version: tx.version,
      inputs: tx.ins.map(input => ({
        txid: input.hash.reverse().toString('hex'),
        vout: input.index,
        witness: input.witness.map(w => w.toString('hex'))
      })),
      outputs: tx.outs.map(output => ({
        value: output.value,
        script: output.script.toString('hex')
      }))
    });

    return await pushTx(rawTx);
  } catch (error) {
    console.error('Failed to broadcast transaction:', error);
    throw error;
  }
};

export const pushTx = async (rawtx) => {
  try {
    const endpoint = 'https://esplora.signet.surge.dev/tx';
    const resp = await fetch(endpoint, {
      method: "POST",
      headers: { "Content-Type": "text/plain" },
      body: rawtx,
    });

    if (!resp.ok) {
      const errorText = await resp.text();
      throw new Error(`HTTP error! status: ${resp.status}, message: ${errorText}`);
    }

    const txid = await resp.text();
    return { txid };
  } catch (error) {
    console.error('Push transaction error:', error);
    throw error;
  }
};

export const getUtxos = async (address) => {
  try {
    const endpoint = `https://esplora.signet.surge.dev/address/${address}/utxo`;
    const resp = await fetch(endpoint, {
      method: "GET",
      headers: { "Content-Type": "application/json" },
    });
    if (!resp.ok) {
      throw new Error(`HTTP error! status: ${resp.status}`);
    }
    return await resp.json();
  } catch (error) {
    console.error('Get UTXOs error:', error);
    throw error;
  }
};

export { btcSendTransaction };

Can anyone help me with this?


text:
Were emails real about my bitcoin?
I was receiving emails asking me to cash out or lose my bitcoin. I would receive them from different emails and for different amounts so I assumed they were spam. Not being updated on it at time I'm thinking they were trying to buy my bitcoin. Emails have been erased years ago. I don't even remember how I bought them. Are they just gone how could I find them? Help please I'm not computer smart or any technical expert at all.Thank you
Dawn Holder

Tempting offers in unexpected unsolicited email messages are a favourite tool of criminal confidence tricksters intending to deceive you into giving money to criminals.

Emails that exhibit some combination of the following signs
indicate that someone is trying to phish or scam you.
Red flags:

sent from suspicious domain names
communicate a sense of urgency
use a generic greeting
tell you about some unexpected windfalls
make unrealistic offers (e.g. "receive ₿10, if you send a $20 processing fee")
…

If you don’t remember buying Bitcoin or entering a cloud mining contract, it should make you suspicious when "Karen from Alpha Mega Trading" contacts you to remind you that you have a life-changing balance with them that you should collect.


text:
wondering How to use Bitcoin Parser?
I'm a freshman of bitcoin system and I'm trying to find out how to use bitcoin parser. I downloaded several from internet but they were not work out. Currently I am using Bitcoin Knots wallet and downloaded all blockchains (approx.223GB). I know those data are preserved in the file names blockchain and they are in the form like blk0xxxx.dat. But how to parse those files? I really want to know the answer!

But how to parse those files?

It is not too difficult to parse bitcoin blockchain if you have programming skills and know what you want to do. Have a look to my piece of code - this is just a working example that parsing is easy. Of course, you have to write code in your favorite language for your task
#include <QTimer>

#include "BlockChain.h"
#include "Util.h"
#include "MyByteArray.h"
#include "Target.h"

BlockChain::BlockChain ( QObject* parent ) : QFile ( parent ), blkFile ( START_BLOCK )
{
  connect ( this, SIGNAL ( block ( const QByteArray& ) ), parent, SLOT ( block ( const QByteArray& ) ) );
  connect ( this, SIGNAL ( doneFile ( ) ), parent, SLOT ( doneFile ( ) ) );
  QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}

void BlockChain::start ( )
{
  setFileName ( blkFileName ( blkFile++ ) );
  if ( !open ( QIODevice::ReadOnly ) )
  {
    _trace ( QString ( "cant open [%1]" ).arg ( fileName ( ) ) )
    emit block ( QByteArray ( ) );
    deleteLater ( );
  }
  else
  {
    _trace ( QString ( "processing [%1]" ).arg ( fileName ( ) ) )
    QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
  }
}

void BlockChain::next ( )
{
  if ( pos ( ) < size ( ) )
  {
    quint32 magic;
    quint32 sz ( read ( (char*)&magic, 4 ) );
    while ( !magic && pos ( ) < size ( ) - 4 )
      read ( (char*)&magic, 4 );
    xassert ( ( ( magic == MAGIC_ID ) || !magic ) && ( sz == 4 ) )
    if ( magic )
    {
      read ( (char*)&sz, 4 );
      emit block ( read ( sz ) );
      QTimer::singleShot ( 0, this, SLOT ( next ( ) ) );
      return;
    }
  }
  close ( );
  emit doneFile ( );
  QTimer::singleShot ( 0, this, SLOT ( start ( ) ) );
}

const QString BlockChain::blkFileName ( const int i ) const
{
  return
    ( i < 10 ) ? QString ( DATA_ROOT "\\blk0000%1.dat" ).arg ( i ) :
    ( i < 100 ) ? QString ( DATA_ROOT "\\blk000%1.dat" ).arg ( i ) :
    ( i < 1000 ) ? QString ( DATA_ROOT "\\blk00%1.dat" ).arg ( i ) :
    QString ( DATA_ROOT "\\blk0%1.dat" ).arg ( i );
}

Which library is this?

Python 3 parser available here https://github.com/alecalve/python-bitcoin-blockchain-parser

The easiest way is to use my simple python script (blockchain parser) that can parse whole raw data from the blk*****.dat files into the human readable text view. This script is very simple to understand and it would be the best way to find out what hiding behind the blockchain database.

I want to update the status of the Bitcoin parser projects, one month ago I have released the new Bitcoin parser caller SpyCBlock, it resides to github at this link.
SpyCBlock is a simple parser multicore written with C++11, it parsing the file blk****.dat and produce different serialization, like:

Serialization JSON Bitcoin blockchain.
Serialization Graph of transaction.
Serialization Graph of address (With version Bitcoin core <= 18.1)

You can see the demo graph with this web application.
Also, the very cool stuff is the JSON bitcoin blockchain because you can analyze it easier with your preferer language.
an example, with a Python demo I have to analyze the type of script used in Bitcoin blockchain, this is the result

also, you can see the result here too.
The demo analytics called AnalyticsPyBlock, written in Python3 and reside in Github ad this link https://github.com/vincenzopalazzo/AnalyticsPyBlock

The easiest way to parse the blockchain is to use the built-in JSON-RPC API instead of trying to get data directly from blk*.dat files. The official documentation is available here: https://bitcoin.org/en/developer-reference#bitcoin-core-apis


text:
How can I programmatically view individual sats?
so the concept of "rare sats" came up in conversation today and I am curious how one would check whether a sat is "rare" or not.
regardless of whether you think the idea is dumb or not, I'm just curious how to even view the level of detail needed for individual sats

It's important to note that there's no such thing as individual sats in the Bitcoin protocol. Bitcoin transactions spend and create transaction outputs of specific amounts, but there is no distinction of individual satoshis in a transaction output unless you apply some arbitrary social convention. Ordinal theory is one such convention and by far the most used, but it's just as valid as any other convention. A "rare" sat (which ordinal theory defines as the first output sat of a coinbase transaction) can end up in completely different unspent transaction outputs based on the convention you apply.
There are several ways to find out if a transaction output or address contains a "rare" sat according to ordinal theory:

Follow the Sat Hunting guide on the Ordinals website. This will require you to run the ord utility alongside a Bitcoin Core node. It's the most trustless and private way but requires a lot of disk space for the blockchain, txindex and ord index.
Download the rare.txt file from the Ordinals website and check all the listed unspent transaction outputs. This requires trusting the website that the file is genuine and up-to-date.
There are online explorers where you simply paste an address and they tell you if it contains a rare sat. This not only requires you to trust their response but also leaks the specific addresses you look up (alongisde your IP address if you don't use Tor or a VPN).

Ok thanks,
I don't understand ordinal theory at all. I'm trying to understand from a technical perspective but it seems like it's totally arbitrary

You can read the proposed BIP if you want to know the exact algorithm by which ordinals are transferred in a transaction. But yes, it's simply an arbitrary convention.


text:
Can I spend a P2PKH transaction via the script-path of P2TR?
Is it possible to use a P2TR script-path to spend a legacy P2PKH UTXO? I have heard it is possible to "wrap" a P2PKH transaction with P2SH. Maybe it would be possible to "wrap" the P2PKH transaction, then spend it via script-spend path of P2TR? I don't care how weird, inefficient, or expensive it may be. This is mostly for my benefit to learn more about the Bitcoin protocol, including rare edge cases. I do not care how expensive the transaction would cost-- if it is a valid transaction, I'd like to hear about it. Thank you so much in advance!

The ways in which you can spend a UTXO are limited to what its output script allows, constructions available for other types of scripts are not transferable. So no, you can't spend a P2PKH UTXO using P2TR rules.
If you've heard about "wrapping" P2PKH in P2SH, that might mean using the P2PKH script (OP_DUP OP_HASH160 <public_key_hash> OP_EQUALVERIFY OP_CHECKSIG) as a P2SH redeem script instead of a bare output script (example transaction). This is possible, but not useful, since there's no reason to hash the key and not use it directly. You can do the same with script-path P2TR (example transaction), but again, not useful.

The wrapping isn't just useless in this case, but irrelevant, as it's something that has to be decided before the output is created.

No.
Outputs must always be spent according to the corresponding input type. Anything else would require a hardfork to introduce.


text:
Which mobile clients allow payments using Near Field Communications (NFC)?
Which Bitcoin apps (or mobile-enabled websites) support the ability to pay using Near Field Communications (NFC)?

Andreas Schildbach's open-source Bitcoin wallet supports this feature. With the "Request bitcoins" screen open, tap another device to send it the bitcoin: URI to send to (that opens the "Send bitcoins" screen on the other device). You can also scan an NFC tag containing a bitcoin: URI to open the "Send bitcoins" screen with the fields filled in.

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


text:
What provably fair Bitcoin gambling sites work well on a mobile?
Are there an Bitcoin-based gambling sites or apps that work on a mobile?
Most of the sites seem to be assuming the player is on a full size display.
If the service isn't considered "provably fair" then I'm not interested.  An example of a provably fair game is one where the host gives the hash of the secret, then a client seed is generated, then after play at some point the secret that was used is revealed.

Provably fair means the player can prove the operator didn't cheat.  With website-based provably fair systems, the generation of a random number and/or client seed is easily to see and monitor.  Unless a mobile app is open source, this same capability is not available.
So a provably fair website that provides an app doesn't mean the app provides provably fair online gaming as well.   An open source app could be provably fair.
You won't find any of (or at least not many of) these apps on the Google Play store since they are online gambling that is a prohibited app on their service.  But the apps can still be installed from external sources:

Seals With Club poker has a mobile app.
Bitcoin Video Casino has an Android app.

Coin Controller is a provably fair game and works on mobile devices as well. Its a little bit different than most traditional gambling games, but its a nice easy way to win some extra coins, and there is an awesome affiliate program.
Check it out, better explanation and details on how to play on the site. Also, accepts Litecoins and Bitcoins.

You can see a list of verified "provably fair" Bitcoin casino sites, here:
http://provablyfair.org
"Provably Fair Gaming means you can verify each played to ensure you always get a fair deal. Modern cryptographic algorithms hash algorithms compute the fair random number based on data from the blockchain."
Depending on the type of games you like, you can find what you are looking for.
I like Roulette, so I play Bitcoin Roulette:
http://Bitcoin-Roulette.com
This is the algo they use:
The pseudo-code:
$hash = TRANSFER_ID;
$secret_key = SECRET_KEY;
$finalhash = hash_hmac('sha512', $hash . $secret_key);
$temphash  = substr($finalhash, 0, 4);          // get 4-bytes of final SHA256 hash
$converted = base_convert($temphash,16,10);     // convert to integer
$final_answer = $converted % 36;            // get a number from 0 -> 36

As far as I know, SatoshiDice doesn't need anything except a wallet.  You send your bet to a certain fixed address (which you could add to your address book) and then your winnings are sent back to your address.
Granted, there isn't really a game to play in this case.

DoubleDownBTC has a mobile friendly version and looks great on iPads or phones.  The problem with most native apps is the legal grey area of Bitcoin gambling.  There are some self published android apps out there, but I'm a little nervous about malware, etc.  The mobile optimized websites seem like a better choice.

Your answer doesn't fit the question, as this is about provable fair gambling.

DoubleDownBTC claims to be provably fair so I think this is a valid answer.

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


text:
Can I connect a hardware wallet to Bitcoin Core using HWI?
Presumably HWI on github.com is to do with creating a hardware wallet interface with Bitcoin Core. Am I correct?
What stage is development at presently?
Will one be able to connect a hardware wallet to Bitcoin Core with this interface?

Yes, you can connect an external signer to Bitcoin Core. You can either use HWI (Hardware Wallet Interface), which is developed by Bitcoin Core developers but currently considered experimental, or use a compatible script if one is provided by your hardware wallet vendor.
To use the external signer feature, start bitcoind with the parameter:
$ bitcoind -signer=<path/to/hwi.py>

Or if you use the Bitcoin Core GUI, you can fill in the "External signer script path" field in the "Wallet" tab.
Some relevant links:

Bitcoin Core external signer documentation
HWI documentation

And by connecting my hardware wallet to bitcoin core, what will that allow me do?

@EoinMcQuinn What wallets normally allow you to do, that is receive and send transactions.


text:
What do the files in bitcoin/src/rpc/ do?
I know that RPC stands for Remote Procedure Call. Does Bitcoin Core do RPCs with other nodes on the network?

No, Bitcoin Core speaks the Bitcoin P2P protocol with other nodes.
The RPC interface is specific to the Bitcoin Core software, and for communication with the (human) operator of the software (through the bitcoin-cli tool), or for other (local) software to interact with (e.g. instructing it to create addresses, send funds, compute statistics, ...). The same commands can also be given in the Debug window in bitcoin-qt.
You can find documentation about the various supported RPC calls on https://bitcoincore.org/en/doc/.

Why aren't these called 'Commands', rather than RPC's? You would think that they would more closely resemble commands to the system. I don't know much about RPC's, but why are they called RPC's?

Probably because initially they were primarily intended for interaction with other software, possibly running on other machines, than for interaction with people. They do use a communication protocol called JSON-RPC (see jsonrpc.org), which may have inspired the name. What's in a name?

Are these [link]https://bitcoincore.org/en/doc/ all the possible commands which can be entered into the bitcoin-cli, or are there more?

The website lists all documented RPC calls (up to version 24.0; it's not updated for 25.0 yet, though I don't think that much changed). There are a few undocumented RPC calls that are only intended for testing purposes; those are not listed on the website either.


text:
How do miners signal approval for a BIP via nVersion, exactly?
Where, exactly, do these tags for scriptSig and nVersion get entered or modified? I don't see any field to do so on my asic config webpage, nor on my USB miner cgminer.
For example, I have a small USB miner, using cgminer, connected to my own pool running on my umbrel node. How would I have signaled support for a previous BIP (or possibly in the future)? Does the vote only count if you win a block?
I also have an ASIC miner connected to a third party pool. Would I be able to "vote" with that miner? Or is my "vote" simply my choice to mine to that pool versus another?

The version and other parameters that could be used for signaling are generally set by the work producer, i.e. your own node or the pool you are mining with. That will issue the work for your mining hardware and include what block version to produce.
For your own pool or node, you would have to configure your pool or node software to produce work with your desired block version. It depends on the software - it may have some setting that you can set, or you may need to use a different version of the software itself.
If you mine with a third party pool, you'd generally have to switch to a different pool if you wanted to signal.
Note that it is not voting, but rather it is signaling readiness. The purpose is for miners to signal to every other node on the network that they are ready to enforce the new soft fork rules. Since the hashrate hardware is not receiving and validating new blocks and transactions, having it set the version (or other signaling mechanism) would not make sense. Thus the entity that is issuing the work needs to set the version as that entity should be receiving and validating new blocks and transactions, and can therefore make the decision about whether it is ready to enforce the new rules.

Does the vote only count if you win a block?

Yes. The only way for other nodes on the network to know what you are signaling is by receiving a valid block from you. So you have to produce valid blocks to be counted.


text:
Can I tell if my peers enable mempoolfullrbf?
Trying to ensure my node is connected to some fullrbf peers, but it doesn't seem that there is a discoverable service for fullrbf? Am I stupid or missing something?

Bitcoin Core pull request #25600 proposed advertising full-RBF on service bit 26 and connecting to four other full-RBF nodes. This was never merged, but some people use this patch on their nodes nevertheless. Peter Todd maintains the patch, and his Libre Relay fork also has it, among other changes that relax the mempool policy.
However, enough people have probably enabled mempoolfullrbf that you might already be connected to full-RBF peers, especially if your node accepts incoming connections and thus has a lot of peers.


text:
How to lock funds in Bitcoin and modify additional data without affecting the locked amount?
I want to lock funds in Bitcoin using a transaction and include some additional structured data (let's say a struct with several fields). The locked amount should remain unchangeable, but I want to later update certain fields within the struct without modifying the locked amount.
Is it possible to construct a Bitcoin transaction that allows locking funds while also posting some additional data? And more importantly, can the fields of this data structure be modified in later transactions without affecting the locked funds? What would be the best approach to achieve this?

@hyunhum-cho can you please have a look at it ?

I don't see how this is compatible with the notion that confirmed transactions are immutable - do you expect other nodes to somehow replace part of transaction data in old buried blocks in their local storage? -  can you explain?

Yeah I also think it isn't compatible with Bitcoin architecture. Is there any workaround to achieve same result ?

@RedGrittyBrick I can explain my architecture so you will have more context

Signed Bitcoin transactions are immutable. Their content cannot be changed without invalidating the signature. The only way to "change" a transaction is by replacing it with a new transaction that conflicts with it.
Once transaction data is included in the blockchain it can only be replaced by mining a conflicting transaction into an alternative chaintip that replaces all blocks since it was confirmed. This is practically infeasible even for just a few blocks unless you control a majority of the hashrate for an extended period of time.
Given your recent series of questions, it sounds to me like you jumped into a project very deeply without getting an overview of how Bitcoin works on a fundamental level. You may want to take a look at e.g. Mastering Bitcoin 3rd Edition which you can read online for free.


text:
Can I use Relative Locktime (BIP 68) to send funds to myself that can only be spent after a specific time in Bitcoin?
Context: I want to send funds to myself in Bitcoin but prevent them from being spent until a specified period has passed, using Relative Locktime (BIP 68). I'm exploring whether this is possible and how it affects the state of the UTXOs before the locktime expires.
Question:

Is it possible to use Relative Locktime (BIP 68) to send funds to myself that will only become spendable after a certain amount of time or blocks have passed?
What is the state of the UTXOs before the relative locktime expires? Can they be used in any way, or are they completely locked until the specified time or block count has passed?
Thank you in advance for your insights!

Yes, you can create a script to lock your funds for a certain amount of time/blocks. For example, this script requires you to wait 2016 blocks (about 2 weeks) after the output is confirmed before you can spend it with a single key:
OP_PUSHBYTES_2 0xe007
OP_CHECKSEQUENCEVERIFY
OP_DROP
OP_PUSHBYTES_33 <public key>
OP_CHECKSIG

In this case, the script does not in any way permit spending the output before the locktime expires, so it is as you say "completely locked". However, you can add conditional branches to the script that allow you to skip the timelock if some other condition is satisfied. For example, this script requires you to either wait 2016 blocks and spend with one of two keys, or spend with both keys at any time:
OP_IF
  OP_PUSHBYTES_2 0xe007
  OP_CHECKSEQUENCEVERIFY
  OP_DROP
  OP_1
OP_ELSE
  OP_2
OP_ENDIF
OP_PUSHBYTES_33 <public key 1>
OP_PUSHBYTES_33 <public key 2>
OP_2
OP_CHECKMULTISIG


text:
Running out of RAM with Bitcoin Core
I'm encountering a persistent issue with RAM exhaustion while running Bitcoin Core on my system. Here's a brief overview of the problem:
Problem Description:
I have a Bitcoin Core node set up on my system, and I query it every minute using an python script consulting for new blocks and query every tx using API REST.
Despite setting the 'dbcache' parameter in my bitcoin.conf file to the default value of 450MB, I've noticed a gradual increase in RAM consumption over time.
To solve this problem I must close bitcoin core and reopen it from time to time
09:00:00

16:49:00


text:
Bitcoin core having trouble connecting to peers
New to Bitcoin.
I have been trying to host a full node on my Mac. I just installed bitcoin core but while syncing, it seems my node is unable to connect to any peers. I am regularly checking the debug.log file and it has been giving a "Potential stale tip detected, will try using extra outbound peer"  regularly about every 10 minutes and this has been going on for 3-4 hours. I checked online and it says there are some firewall issues and maybe my internet connection isn't allowing me to connect to port 8333. I checked my firewall settings and I am not blocking any ports from my end. Here is my debug.log file:
2024-04-04T03:46:06Z Waiting 300 seconds before querying DNS seeds.
2024-04-04T03:55:17Z Loading addresses from DNS seed seed.bitcoin.sipa.be.
2024-04-04T03:55:20Z Loading addresses from DNS seed seed.bitcoinstats.com.
2024-04-04T03:55:20Z Loading addresses from DNS seed seed.bitcoin.wiz.biz.
2024-04-04T03:55:21Z Waiting 300 seconds before querying DNS seeds.
2024-04-04T03:56:02Z Potential stale tip detected, will try using extra outbound peer (last tip update: 2651 seconds ago)
2024-04-04T04:14:37Z Potential stale tip detected, will try using extra outbound peer (last tip update: 3766 seconds ago)
2024-04-04T04:14:37Z Flushed fee estimates to fee_estimates.dat.
2024-04-04T04:30:22Z Potential stale tip detected, will try using extra outbound peer (last tip update: 4711 seconds ago)
2024-04-04T04:46:42Z Potential stale tip detected, will try using extra outbound peer (last tip update: 5691 seconds ago)
2024-04-04T05:02:42Z Potential stale tip detected, will try using extra outbound peer (last tip update: 6651 seconds ago)
2024-04-04T05:03:02Z Loading addresses from DNS seed dnsseed.bitcoin.dashjr.org.
2024-04-04T05:03:02Z Loading addresses from DNS seed seed.btc.petertodd.org.
2024-04-04T05:03:03Z Loading addresses from DNS seed seed.bitcoin.sprovoost.nl.
2024-04-04T05:03:03Z 204 addresses found from DNS seeds
2024-04-04T05:03:03Z dnsseed thread exit
2024-04-04T05:20:04Z Potential stale tip detected, will try using extra outbound peer (last tip update: 7693 seconds ago)
2024-04-04T05:20:04Z Flushed fee estimates to fee_estimates.dat.
2024-04-04T05:37:15Z Potential stale tip detected, will try using extra outbound peer (last tip update: 8724 seconds ago)
2024-04-04T05:56:46Z Potential stale tip detected, will try using extra outbound peer (last tip update: 9895 seconds ago)
2024-04-04T06:14:17Z Potential stale tip detected, will try using extra outbound peer (last tip update: 10946 seconds ago)
2024-04-04T06:31:39Z Potential stale tip detected, will try using extra outbound peer (last tip update: 11988 seconds ago)
2024-04-04T06:31:39Z Flushed fee estimates to fee_estimates.dat.
2024-04-04T06:48:50Z Potential stale tip detected, will try using extra outbound peer (last tip update: 13019 seconds ago)
2024-04-04T07:00:05Z Potential stale tip detected, will try using extra outbound peer (last tip update: 13694 seconds ago)
2024-04-04T07:14:56Z Potential stale tip detected, will try using extra outbound peer (last tip update: 14585 seconds ago)
2024-04-04T07:25:26Z Potential stale tip detected, will try using extra outbound peer (last tip update: 15215 seconds ago)
2024-04-04T07:31:39Z Flushed fee estimates to fee_estimates.dat.
2024-04-04T07:37:48Z Potential stale tip detected, will try using extra outbound peer (last tip update: 15957 seconds ago)
2024-04-04T07:48:18Z Potential stale tip detected, will try using extra outbound peer (last tip update: 16587 seconds ago)

This goes on forever.
I have an M1 chip and macOS 14.4.1

wondering if you found a solution here. I don't have this particular issue but on my node running on a Mac (m1 mini) I occasionally see long periods of "connecting to peers". And in general initializing my node is taking a very long time. I'm 4 weeks in and still only at 72%! I'm also on macOS 14.4.1

@neils4fun If you run bitcoin-cli getchaintips, do you see "invalid" anywhere in the output?


text:
No bitcoin.conf file on my (Mac) node?
I installed a full node on my old Mac (running on Catalina 10.15.7) and though running well it looks like it will go over my ISP's monthly data limits. I was thinking I'd try changing the maxconnections in the bitcoin.conf file, but I'm not seeing that file under Application Support, even when I reveal hidden files. Do I need to create it or should I be looking elsewhere?
Full Node Noob

Yes, no config file is created by default. If you want one, you need to create it yourself.
Without config file, all settings stay at their built-in default values.


text:
How to claim BTG from an Electrum wallet?
Claiming BTG after the Fork did not work
I have tried :
using Coinomi wallet,this way.
I could not locate the address holding eligible for BTG value.
All addresses i tried was contained no fund.
In the history tab i could not spot the addresses details.

Perhaps the issue is that BTG uses a different address format than BTC? This means that the addresses you held coins in before the fork need to be translated to BTG first?

Try this: Claiming my BTG from my BTC private key
Worked for me
To know where your BTG are use this explorer: https://bitinfocharts.com/bitcoin%20gold/

I have already used this site. It was very useful. But still there all of the pricate codes leads to the same error: The privte key does not contain any fund.

When you are on https://www.bitaddress.org, try sweeping the QR code private key on the left, if it does not work try the one on the right

I found the solution!
After browsing through the addresses in the Electrum wallet, I looked for all addresses that have non-zero Tx value. I found the one holding BTG in the last address of the list located in Addresses>change>Used , it was the last one of them. And indeed that is the one showing up in the history of the last transaction of my wallet , in its detail's input tab.
View private key in that address , and then scanning from Coinomi, using "Sweet wallet got me the last amount before the fork of my wallet in BTG

I had the same problem. The default filter in the addresses tab is 'receiving'. None of those, including the non-zero-transaction ones, had any Bitcoin Gold. But changing the filter dropdown to 'change', and then checking each of those non-zero addresses (using https://bitinfocharts.com/bitcoin%20gold/ ), worked. Two of the addresses between them had the number of BTG that I was expecting. Thanks!

I assume now it wouldn't be worth?  Even if I had 1 BTC before the split?

bitaddress.org will not accept electrum private keys, saying invalid key version 133 not supported.
electrum only gives one private key per address.
"This is independent of the wallet you are using, and you should be able to export it, all wallets allow it" - don't think electrum does this. at least I cannot find a way.

When I say "private key" I dont mean "electrum's private key", I mean the private key associated with your Bitcoin address. This is independent of the wallet you are using, and you should be able to export it, all wallets allow it (I dont know electrum so I cannot help on this one)

electrum provides only one private key per address, nothing independent as you say

Obviously there is one and only one private key per address, and yes the private key is wallet independent, otherwise you are not talking about private key but something else


text:
Legally shuttering miners and full nodes by adding illegal information to blockchain
In many jurisdictions possession or distribution of certain information or content is illegal. Illegal primes, classified information, magnet links to copyrighted torrents, hate speech, outlawed pornography, incitements to terrorism, etc. Not all of this is efficiently encoded in the blockchain, but at least some can be.
Let's say a wealthy malicious actor wanted to disrupt the bitcoin network or crater the price. He could subsidize transactions containing illegal content. Moreover he could most likely do this anonymously or near-anonymously.
One or two instances would most likely be ignored by legal authorities. But persistent violations would most likely raise the ire of the courts. US federal judges regularly issue injunctions taking down websites. It's unlikely that they would make an exemption for block chains. Especially considering that most judges are technically illiterate.
Since all full nodes would contain the illegal information, it would become illegal to run the existing blockchain in the US. It would probably be impossible to enforce against your typical home user. But any public facing wallet provider or large-scale miner based in the US would be shuttered. GDAX, Coinbase, all the wallet providers, all the US-based exchanges, etc.
The scenario would be extremely disruptive, and either require a hard fork or make bitcoin untenable in the US. Very likely it would crater the price, as nearly all US demand leaves the market. Is there any possible remedy if such a situation were to occur?
EDIT Re duplicate question: The designated answer to the original question is fallacious. The assumption is that the protection of ISPs would extend to blockchains. Even if that was exactly true, it's still insufficient to protect against this attack.
Yes, US law exempts ISPs from copyright infringement liability. But only if they remove the offending content. A federal judge would likely extend the same logic to the blockchain in question. The only way to remove content from the chain is to hard fork at the point it was inserted.
Not only would that reverse all transactions that occurred subsequent to the offensive content. It would likely destroy split the currency every single time a content violation block is added. Theoretically that could be every single block. From the standpoint of US compliant parties, the network would be unusable.

StackExchange is not the place for legal advice or discussion.  Consult a lawyer fluent in the necessary area.

Max, this isn't a solicitation for legal advice whatsoever. This is a discussion of a (possibly major) vulnerability in the bitcoin protocol. Yes, the attack vector does happen to be through the legal system. But regardless, if you think a Federal injunction outlawing full nodes wouldn't massively affect all Bitcoin users, you are being naive. If I discovered major vulnerability in the Bitcoin Core, would you similarly dismiss it?

I'm not dismissing your question.  I'm dismissing that fact that a legal discussion is valid here.  Perhaps a judge will make bitcoin illegal, and perhaps they won't.  That won't affect the blockchain unless that judgement has worldwide effect.  Do you worry that illegal content could make computers illegal?  Would the US outlawing computers reduce the amount of illegal content?  It's an open-ended discussion, and open-ended discussions are off-topic on stackExchange.


text:
Verifying Bitcoin Core - Developer Key Fingerprint Confusion
I downloaded the latest version of Core on my Mac and I'm stuck on step 7 of the verification instructions on the Bitcoin Core website:
7. Bitcoin releases are signed by a number of individuals, each with a unique public key. In order to recognize the validity of signatures, you must use GPG to load these public keys locally. You can find many developer keys listed in the bitcoin-core/guix.sigs repository, which you can then load into your GPG key database.
For example, you could load the key builder-keys/fanquake.gpg by downloading the file as fanquake.gpg and using this command:
gpg --import fanquake.gpg
The output of the command above should say that one key was imported, updated, has new signatures, or remained unchanged.
I've downloaded GPG Keychain, downloaded some .gpg files from the link above and opened them into GPG Keychain. But which ones I choose, how to verify, etc. just hasn't clicked.
In a few cases I matched the Fingerprint of a developer in GPG Keychain to the Fingerprint they posted on their website or social media page. Is that verifying correctly, though?
And is the final step in this section entering "gpg --import fanquake.gpg" (or the name of the file) into my Terminal to verify? If that's the case, I'm still not sure what to verify after entering the command.
Thanks.


text:
Why is this P2WSH spend triggering a verification failure when broadcasting?
I'm experiment with building SegWit transactions manually, and I've written a non-standard simple script just for testing. No signing or anything, just your usual "add two numbers, check equality" script. However, when attempting to broadcast it, I get an error.
I already sent the coins to the script, now I'm just trying to spend from it.
Here is my input:
{
  "txid": "174692a9b447d62043b90059c83237b0526bc09551aa39839a1d4fafc29252b7",
  "hash": "27afb30315f82dd64815ef259b7f4075359d42390f549b9a05132d11cf0d5670",
  "version": 2,
  "size": 205,
  "vsize": 154,
  "weight": 616,
  "locktime": 206,
  "vin": [
    {
      "txid": "1e025a8b1af84f4b7f0724b89ed0fc3b0ee6f2e8d1c0b635827edf6f60a0ff9e",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "2b8aac44cbfe12c56ddfd1ff2a0021c6f9b4e76b0325b44a647365ae9e695044029f6f7eb409baee56803e80e47a643711703795c955a8bdc5a0abc5761902fe"
      ],
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 1.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 8b88aeecc8810057147ae75bb5fef0b88e74cdd69877a0b0d9119cbc0a13bd18",
        "desc": "addr(bcrt1q3wy2amxgsyq9w9r6uadmtlhshz88fnwknpm6pvxezxwtczsnh5vq8ynwca)#88xz032h",
        "hex": "00208b88aeecc8810057147ae75bb5fef0b88e74cdd69877a0b0d9119cbc0a13bd18",
        "address": "bcrt1q3wy2amxgsyq9w9r6uadmtlhshz88fnwknpm6pvxezxwtczsnh5vq8ynwca",
        "type": "witness_v0_scripthash"
      }
    },
    {
      "value": 46.99952700,
      "n": 1,
      "scriptPubKey": {
        "asm": "1 ab0af65a053979dfd08b9673405900f185b6d45edea4dddd5dec9b7ec2eba5fc",
        "desc": "rawtr(ab0af65a053979dfd08b9673405900f185b6d45edea4dddd5dec9b7ec2eba5fc)#utsgce08",
        "hex": "5120ab0af65a053979dfd08b9673405900f185b6d45edea4dddd5dec9b7ec2eba5fc",
        "address": "bcrt1p4v90vks989ual5ytjee5qkgq7xzmd4z7m6jdmh2aajdhasht5h7qx008qn",
        "type": "witness_v1_taproot"
      }
    }
  ]
}

Vout 0 is the output of interest here.
Here is my decoded transaction when I attempt to spend it:
{
  "txid": "0110d9fd63ec46c2b47bc589d2f032d10f288912e4d82c88c8aaa1dfed251909",
  "hash": "08881deca20dc914f14a03d5caf97bd4b7c717ef9047b1a6f70f5deb44eb8545",
  "version": 1,
  "size": 96,
  "vsize": 86,
  "weight": 342,
  "locktime": 0,
  "vin": [
    {
      "txid": "174692a9b447d62043b90059c83237b0526bc09551aa39839a1d4fafc29252b7",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "63000000",
        "5193016487"
      ],
      "sequence": 0
    }
  ],
  "vout": [
    {
      "value": 0.50000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 43620bf89a7acd30cc09914e023cdce377e70828",
        "desc": "addr(bcrt1qgd3qh7y60txnpnqfj98qy0xuudm7wzpgz5c02y)#thrxqf0c",
        "hex": "001443620bf89a7acd30cc09914e023cdce377e70828",
        "address": "bcrt1qgd3qh7y60txnpnqfj98qy0xuudm7wzpgz5c02y",
        "type": "witness_v0_keyhash"
      }
    }
  ]
}

The witness script (5193016487) is 1 OP_ADD 100 OP_EQUAL. The witness stack also has 99 (63000000).
Why do I get this verify error when I attempt to broadcast it?
error code: -26
error message:
non-mandatory-script-verify-flag (unknown error)

You need to encode the number 99 (0x63000000) as a single byte (0x63) because

OP_ADD returns the result in the fewest bytes sufficient to store the value and because
OP_EQUAL takes the length of its operands into account. For example it considers 0x63 to be not equal to 0x6300.

I played around with a script debugger to check the length of the value returned by OP_ADD and the effect of operand lengths on OP_EQUAL.

Related

Why is there a OP_NUMEQUAL opcode? Does OP_NUMEQUAL offer a subset of the functionality of OP_EQUAL?

Finally got it. Turns out I needed to encode the number on the witness stack as a single byte. 63 instead of 63000000.
I don't suppose anyone can explain why that is necessary?


text:
Unconfirmed transaction for 18 days
My transaction has been sitting in mempool unconfirmed for 18 days. I was dumb enough to use a custody wallet so there's absolutely nothing I can do to fix it on my end. Is there anything I can do to get it kicked off the blockchain?


text:
Sats stuck in "pending" after lightning channel force closure
I had a lightning channel force close because the other node went offline. Its now been 24 days yet the on chain sats are still stuck in "Pending" status and can't be spent.  This is the closing tx and the 834,777 sats are seen in the UTXO. I'd like to learn what is happening here.
You can see from the Thunderhub screenshot below that 24 days ago 834,777 sats were sent (this tx) during the force close. Additionally there was another 147 sats which i dont know what it was which has not been confirmed. These are showing up as a deposit as well but the tx for the 147 not confirmed or even broadcast to the network.

The lightning node wallet shows the 834,777 and the 147 deposit as well:

Lastly, you can see in Thunderhub dashboard that there are a total of the sum of the two as "pending".

Can anyone explain what is going on here? What is thunderhub reading onchain that tells it those sats are in "Pending" state vs others?

This seems to be the same issue as described here. Publishing the tx from my umbrel node with the below fixed it:
./umbrel/scripts/app compose lightning exec lnd lncli wallet publishtx <TX>


text:
Trying to reconcile the amount sent versus amount transacted

Newbie here trying to understand how an amount sent from coinbase gets put onto the block at a different value.
In this transaction, I sent 0.55076816 LTC to a wallet.

There’s a network fee of 0.00100816 which means I receive 0.54976.

But what I don’t understand is the figure 0.57441138 on the right hand BlockCypher screen.
Where did the extra 0.02364322 LTC (0.57441138-0.55076816) come from that I didn't send from Coinbase???

Say I owe you $8, but all I have is a $10 bill. I'll make a transaction that spends my $10 bill and delivers $8 to you and returns $2 to me. The extra 0.02364322 LTC is Coinbase's change, just as the extra $2 is my change.
Coinbase didn't happen to have precisely 0.55177632 LTC in an unspent transaction output, they had 0.5734121 LTC. So they returned some change to themselves.


text:
Anonymity through paying by bitcoin
I am considering the VPN service Privateinternetaccess. One of it's payment methods is bitcoins. As described on this page paying with bitcoins strengthens anonymity. In contradiction, this page claims bitcoin is not normally anonymous. To what degree is bitcoin anonymous? How does this anonymity differ compared to paying by other means such as credit card, Paypal or through Amazon?
Since the steps described in the second link are only for the U.S. I would have to find an alternative way to exchange my dollar to bitcoins. I'm wondering is it worth the effort? Is the worse privacy compromise if I didn't use bitcoin that it could be known I am a user of Privateinternetaccess? Any advice is greatly appreciated.

Anonymity:
Every transaction ever made in Bitcoin is public. You can see the most recent here:
https://blockexplorer.com/
What makes it anonymous, is that you may not know who owns which account number (Bitcoin address). If Privateinternetaccess picks a new receiving address for every transaction, it's very difficult for an outside person to see who is receiving your bitcoins.
Also, there are 'mixer' services which will send on the correct amount to an address, but maybe not use the same coins, so there's no visible link. blockchain.info has such a 'mixer' service.
Buying Bitcoin outside of US:
This question pops up a lot, so I'm making a site right now to show how to buy bitcoins from each country:
http://howtobuybitcoins.info/
Feel free to throw me any questions you have.

I don't know much about the Bitcoin part but depending where you live you can buy a no name Visa/MasterCard gift card in a shop for cash and you are set?


text:
Headers-first sync and malicious peers
Since headers-first syncing specifies that the entire header chain is downloaded from a single peer, how does the downloading node know that it is not being served a manufactured out-of-consensus header chain? Does it perform any cross referencing against other peers? What is the exact mechanism used here?


text:
Does the miner determine the amount of coinbase transactions manually?
When the miners try to extract the block with the submitblock method, do they determine the amount(value) of coinbase by themselves?
Or does the network automatically give them some amount as a reward?
Thanks for any advice.
best regards,

Both.
The consensus rules allow miners to claim up to a certain amount of coinbase output value, namely the sum of the fees of all (non-coinbase) transactions in the block plus the subsidy (which halves every 210000 blocks).
The miner does have to actually construct that coinbase transaction to claim these funds, and they are allowed to claim less than what is allowed. If that happens, the missed amount is permanently lost.


text:
What is this || notation in BIP 341?
SHA256(SHA256(tag) || SHA256(tag) || x)
What is the || notation? Is this the conjunction of the different elements? Bitwise OR? or modulus?

The meaning of the two pipes is explained in BIP340:

|| refers to byte array concatenation.

The tags for the various tree elements are repeated to amount to 64 bytes. The doubling allows the first step of the outer SHA256 hash to be pre-computed as sha256 processes the input in 64 byte-chunks.


text:
Recovery from theft — Tracing money to exchanges
I created a paper wallet on bitcoinpaperwallet.com and lost all my coins. Only later did I google to realize this is all a scam. The coins were moved on 22 August 2020. Can anything be done? Please help. I lost my life savings.
Is it possible to determine which exchange the coins were sent to by looking at the transaction ID or wallet ID? Maybe I could write to exchange to block it?

Sometimes it can be traced to exchanges, sometimes not at all or not yet. You might post the transaction or the scammers BTC address in order to allow tracing. In case tracing to an exchange is successful you'll need law enforcement support.

In brief:

You are not going to get your money back
If you try, you will lose more money
The money has by now probably passed through many exchanges and mixers in many corrupt foreign countries. And through the hands of other tricked victims.
As a victim of one crime, you are especially attractive to other confidence tricksters for further crime.  Be on guard.
Report the theft to the police
Ask your police commissioner and/or political representative to act
Accept the loss, move on.

Longer answer:

can anything be done?

No
I would contact local police. Though they won't be able to recover any money.
You will now be contacted by scammers using private messaging. They will tell you they can get your money back. Once they have your trust, they will tell you about a small release fee or a transaction fee or that you need to put money in to meet a refund threshold. In short they will make up lies to trick you into giving more money to criminals. Ignore all messages that are not on a public place, like this website, where many people can read the advice you get and correct any bad advice.

I lost my life savings

I'm sorry to hear that.
In retrospect you made some mistakes which I would suggest anyone else reading this should take care to avoid repeating:

Don't put all your savings into one place.
With volatile high-risk assets like Bitcoin, don't invest money you can't afford to lose completely.
Never use online paper wallet generators (some are relatively safe to use offline, but best advice is avoid all).
Always do as much checking as possible before sending money to online businesses.

Is it possible to determine which exchange were the coins sent to, looking at the transaction ID or wallet ID?

The transaction ID does not identify people or businesses.
There is no  Wallet-ID but there are "addresses" which people sometimes call a wallet ID - although a wallet can have hundred or thousands of different addresses. Nowadays, wallets generate a new address each time they are used to receive money. Bitcoin addresses are not like real-world addresses - they don't identify a person, business or place, Bitcoin addresses are random-looking numbers that are generated from other secret random-looking numbers.
Sometimes you can guess that an address was generated by an exchange because it is subsequently used in a bulk transaction with hundreds of other addresses - either consolidating funds or dispersing them en-masse. This doesn't tell you which exchange was used. A diligent forensic analyst may be able to eventually identify an exchange by use of test transactions and long-term data analysis.

Maybe I could write to exchange to block it?

The problems are:

The money won't stay at an exchange long. The exchange probably no longer has the money.
The exchange won't disrupt their customers business at the say so of a random stranger
The exchange has data-protection responsibilities. The have to protect the identity of their customers. It may take a court order to get them to act.
Criminals don't use their own name and KYC details at an exchange, they trick other victims into opening accounts in the other victim's name and giving the criminal the password (see numerous "sugar daddy" and fake-job scams reported here).
You may be dealing with exchanges, or a trail of different exchanges in far- away places like Russia, China, Nigeria, Switzerland and other tax-havens or countries with corrupt or semi-functional law enforcement. Getting their cooperation will be hard.

You have to involve law enforcement.
Recovering the money may cost tens or hundreds of thousands of dollars and take years. Most likely it will prove impossible. You were duped once, if you go down this path you will almost certainly be duped again. Several times.
I hate giving this sort of advice because making people give up aids the bad guys. But I don't like to think of people throwing good money after bad and making their situation even worse. The best thing you can do is probably work with local law enforcement, try to get your local political representative to appreciate the impact this type of crime has on their electorate - you are not the only one affected.

thx. is it possible to determine which exchange were the coins sent to, looking at the transaction ID or wallet ID? Maybe I could write to exchange to block it?

@rogerwhite: Answer updated


text:
Does the mempool size as reported by Blockchain.com include the size of txs only?
Does the mempool size as reported by  (for instance Blockchain.com) include the sum of the 'size' of transactions only?  Or does it also include the overhead (due to indexes, allocation overhead, metadata)?
for instance, the ancestor-descendant mappings that it calculates and updates at every incoming transaction, is the size of the data structure used to store that also included in the total size as reported here https://www.blockchain.com/charts/mempool-size or here https://jochen-hoenicke.de/queue/#0,24h


text:
Open Channel Transaction without RBF is stuck
An open-channel transaction has too low fees and does not get confirmed. It has opted in to RBF, but there is no change output. So I think it is not possible to use lightning-cli openchannel_bump?
Isn't it possible to simply use bitcoin-cli abandontransaction to remove the transaction from mempool and then open a new channel using the same UTXO with higher fees? Is there a chance that something goes wrong this way that I do not see?
Update 1:
Tried now bitcoin-cli abandontransaction, but did not work. I think either because the lightning wallet is not on the bitcoin node or because it is a pruned node.
Next I searched for a method on core lightning to stop the  open-channel transaction to be pushed to the mempool. Did not find one. Should such functionality be implemented?
So I expected that this happens automatically when I close the channel. So I did a bitcoin-cli close. It worked, but channel did not get closed for another 48h. So I tried force close.
This is the point where I am stuck now. The transaction still gets pushed to mempool. Now I do not know what I can further try and I am a little afraid that the transaction gets confirmed and the channel is not usable because it is closed.
Update 2:
Found in the lightning FAQ the article How to forget about a channel? which sounds like what I need. So I tried lightning-cli dev-forget-channel $NODEID and it worked to remove the channel from my node.
But now my lightning wallet does not see my UTXOs which where used to open this channel anymore. I still see the transaction in mempool Explorer to be not confirmed.
So I tried to start lightningd with --rescan=depth and used a depth which is higher than the transaction where I got the UTXOs. But also after rescanning lightning wallet can not see my funds.
Would be very happy for some help / ideas.

I cannot answer all of your questions, but I can give you some help.
From the bitcoin point of view, you can always spend a transaction output (TXO) if it is not spent already by some confirmed transaction.
That said, if you opened a channel but the funding transaction is not confirmed you can spend the TXO that funded the channel, but I don't know how lightningd would react to this.
You said you have closed the channel. If you funds are still stuck it means both the funding channel and close channel transactions are unconfirmed in the mempool.
I would try to spend the TXO in the close TX in a child-pays-for-parent fashion. However, when trying to reproduce that scenario in regtest I find troubles with the clightning user interface.
I did the following to simulate your situation:

I create a channel with peer

$ l1-cli fundchannel 0397d48baf82cf731fc8967c16e3d9575f10606bdf481738eb9cafeda29d0e3d67 1000000sat
{
   "tx": "02000000000101ee026cb7c44f482eb9b1e11f6faf11956ac26f4cdb7e0c1aa9ef94025ec412c30000000000fdffffff0240420f000000000022002075e9a102dbb348646e2f1804cc3cfec9edb6f5551a074f33a615f29cbd45eeaa4c5bd70500000000160014deb1f4e1123694ca3e418cefe496d3c26b0ddde202473044022068b402d53f16204324b28607eca046a4f7121d8f83c62e17de9c9131e307b5cf022077a3aa538469f9e0983cce98c3de4c5427731b398ed395d9614cf7b54d4f5cdd012102f5093f8fd66c909fc72ee556e70cb038ae92b03fd1b56d710cf53b3cc019868e73000000",
   "txid": "11b8967c62c584da9bbba5243d61bc95b4da210760bca04adb7c349319edba19",
   "channel_id": "9dfe0df4c502c31e92c266bfa28af18d6f6d11a0b0197b838797f8c990625168",
   "outnum": 0
}

I closed the channel

$ l1-cli -k close id=9dfe0df4c502c31e92c266bfa28af18d6f6d11a0b0197b838797f8c990625168
# Sending closing fee offer 139sat, with range 139sat-183sat
# Received closing fee offer 139sat, with range 139sat-1000000sat
{
   "tx": "020000000119baed1993347cdb4aa0bc600721dab495bc613d24a5bb9bda84c5627c96b8110000000000ffffffff01b5410f00000000001600141b420a80810dda8fd3621e6ba4ce14ce85b6877e00000000",
   "txid": "e6a7d6cc0960f0f7481a3e9a18b9d9cc18ee695dd626a597883be4599c043699",
   "type": "mutual"
}

At this point both the funding (11b896...) and settlement (e6a7d6cc...) transactions are in the mempool and unconfirmed.
The situation is shown in the diagram below
tx:c312c...(confirmed) ---> tx:11b89... (funding tx unconfirmed) ---> tx:e6a7d6cc... (settlement, unconfirmed)

Solution 1 (that doesn't work)
My idea is to spend the settlement output with a higher fee.
However, I have problems with lightning-cli to get this working.
If I try to spend the settlement output, which is controlled by my wallet:
$ l1-cli -k txprepare outputs="[{\"bcrt1qx77wq9fyxvhsncswpl6kgqpnc49m5e5lzmls0g\":\"all\"}]" utxos="[\"e6a7d6cc0960f0f7481a3e9a18b9d9cc18ee695dd626a597883be4599c043699:0\"]" feerate=100
{
   "code": -32602,
   "message": "Unknown UTXO e6a7d6cc0960f0f7481a3e9a18b9d9cc18ee695dd626a597883be4599c043699:0"
}

So probably lightnind is saying: "that UTXO is not in the blockchain, I cannot spend it".
I tried a work-around, creating a PSBT with bitcoin-cli:
$ bt-cli createpsbt "[{\"txid\":\"e6a7d6cc0960f0f7481a3e9a18b9d9cc18ee695dd626a597883be4599c043699\",\"vout\":0}]" "[{\"bcrt1qx77wq9fyxvhsncswpl6kgqpnc49m5e5lzmls0g\":0.00900000}]"
cHNidP8BAFICAAAAAZk2BJxZ5DuIl6Um1l1p7hjM2bkYmj4aSPfwYAnM1qfmAAAAAAD9////AaC7DQAAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAAA

and then signing it with lightning-cli:
$ l1-cli signpsbt cHNidP8BAFICAAAAAZk2BJxZ5DuIl6Um1l1p7hjM2bkYmj4aSPfwYAnM1qfmAAAAAAD9////AaC7DQAAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAAA
{
   "code": -1,
   "message": "No wallet inputs to sign"
}

It seems that clightning doesn't like to sign transactions inputs that are not confirmed.
Solution 2 (the ugly)
I would spend the TXO that funded the channel since the funding transaction is unconfirmed.
$ l1-cli -k txprepare outputs="[{\"bcrt1qx77wq9fyxvhsncswpl6kgqpnc49m5e5lzmls0g\":\"all\"}]" utxos="[\"c312c45e0294efa91a0c7edb4c6fc26a9511af6f1fe1b1b92e484fc4b76c02ee:0\"]" feerate=100
{
   "code": -32602,
   "message": "UTXO c312c45e0294efa91a0c7edb4c6fc26a9511af6f1fe1b1b92e484fc4b76c02ee:0 already reserved"
}

So, clightning sees that even though that TXO is not confirmed it is spent by a channel funding.
Let me try forcing again with bitcoin core PSBT:
$ bt-cli createpsbt "[{\"txid\":\"c312c45e0294efa91a0c7edb4c6fc26a9511af6f1fe1b1b92e484fc4b76c02ee\",\"vout\":0}]" "[{\"bcrt1qx77wq9fyxvhsncswpl6kgqpnc49m5e5lzmls0g\":0.98900000}]"
cHNidP8BAFICAAAAAe4CbLfET0guubHhH2+vEZVqwm9M234MGqnvlAJexBLDAAAAAAD9////ASAY5QUAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAAA

and then get a signature from clightning wallet:
$  l1-cli signpsbt cHNidP8BAFICAAAAAe4CbLfET0guubHhH2+vEZVqwm9M234MGqnvlAJexBLDAAAAAAD9////ASAY5QUAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAAA
{
   "signed_psbt": "cHNidP8BAFICAAAAAe4CbLfET0guubHhH2+vEZVqwm9M234MGqnvlAJexBLDAAAAAAD9////ASAY5QUAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAEBHyae5gUAAAAAFgAUrxY3yj79dai67Z9mJ4hHAjQSIzMiAgL1CT+P1myQn8cu5VbnDLA4rpKwP9G1bXEM9Ts8wBmGjkcwRAIgMdOln+3Bzrm5lWqUrBbtEleqYgclYdwSadbs7T8V+18CIFTRsrlwhdZrvrG+UiCGf44+TJrF+Oqj4w+hLFmucBcfASIGAvUJP4/WbJCfxy7lVucMsDiukrA/0bVtcQz1OzzAGYaOCK8WN8oAAAAAACICAoqr3sVLia14vPyrtYQRxA+wniCHWDV34AMh8C5p18haCDe84BUHAAAAAA=="
}

OK, so this time we have a signature, now we can construct the transaction
$ bt-cli finalizepsbt "cHNidP8BAFICAAAAAe4CbLfET0guubHhH2+vEZVqwm9M234MGqnvlAJexBLDAAAAAAD9////ASAY5QUAAAAAFgAUN7zgFSQzLwniDg/1ZAAzxUu6Zp8AAAAAAAEBHyae5gUAAAAAFgAUrxY3yj79dai67Z9mJ4hHAjQSIzMiAgL1CT+P1myQn8cu5VbnDLA4rpKwP9G1bXEM9Ts8wBmGjkcwRAIgMdOln+3Bzrm5lWqUrBbtEleqYgclYdwSadbs7T8V+18CIFTRsrlwhdZrvrG+UiCGf44+TJrF+Oqj4w+hLFmucBcfASIGAvUJP4/WbJCfxy7lVucMsDiukrA/0bVtcQz1OzzAGYaOCK8WN8oAAAAAACICAoqr3sVLia14vPyrtYQRxA+wniCHWDV34AMh8C5p18haCDe84BUHAAAAAA=="
{
  "hex": "02000000000101ee026cb7c44f482eb9b1e11f6faf11956ac26f4cdb7e0c1aa9ef94025ec412c30000000000fdffffff012018e5050000000016001437bce01524332f09e20e0ff5640033c54bba669f02473044022031d3a59fedc1ceb9b9956a94ac16ed1257aa62072561dc1269d6eced3f15fb5f022054d1b2b97085d66bbeb1be5220867f8e3e4c9ac5f8eaa3e30fa12c59ae70171f012102f5093f8fd66c909fc72ee556e70cb038ae92b03fd1b56d710cf53b3cc019868e00000000",
  "complete": true
}

and broadcast it
$ bt-cli sendrawtransaction 02000000000101ee026cb7c44f482eb9b1e11f6faf11956ac26f4cdb7e0c1aa9ef94025ec412c30000000000fdffffff012018e5050000000016001437bce01524332f09e20e0ff5640033c54bba669f02473044022031d3a59fedc1ceb9b9956a94ac16ed1257aa62072561dc1269d6eced3f15fb5f022054d1b2b97085d66bbeb1be5220867f8e3e4c9ac5f8eaa3e30fa12c59ae70171f012102f5093f8fd66c909fc72ee556e70cb038ae92b03fd1b56d710cf53b3cc019868e00000000
41304c4e992a0718d29cf7c46adb0f361c319d31b92eeb8d7dbc811aebc2b39f

If the miners include the last transaction 41304..., then the funding 11b896... and settlement e6a7... will be invalid. But you still have your funds.
tx:c312c...(confirmed) -X-> tx:11b89... (funding tx unconfirmed) -X-> tx:e6a7d6cc... (settlement, unconfirmed)
|
+---> tx:41304... (confirmed)

Side effects
clightning sees the new funds, but it is still waiting for the previous transactions to confirm:
$ l1-cli listfunds
{
   "outputs": [
      {
         "txid": "11b8967c62c584da9bbba5243d61bc95b4da210760bca04adb7c349319edba19",
         "output": 1,
         "amount_msat": 97999692000,
         "scriptpubkey": "0014deb1f4e1123694ca3e418cefe496d3c26b0ddde2",
         "address": "bcrt1qm6clfcgjx62v50jp3nh7f9kncf4smh0z2v5q3d",
         "status": "unconfirmed",
         "reserved": false
      },
      {
         "txid": "41304c4e992a0718d29cf7c46adb0f361c319d31b92eeb8d7dbc811aebc2b39f",
         "output": 0,
         "amount_msat": 98900000000,
         "scriptpubkey": "001437bce01524332f09e20e0ff5640033c54bba669f",
         "address": "bcrt1qx77wq9fyxvhsncswpl6kgqpnc49m5e5lzmls0g",
         "status": "confirmed",
         "blockheight": 116,
         "reserved": false
      }
   ],
   "channels": [
      {
         "peer_id": "0232a73b00b1e4eb6ee1787785640dca55a67bf5e6b338e42efff6a9b21da26c93",
         "connected": true,
         "state": "CHANNELD_NORMAL",
         "channel_id": "a8664ad1bbc4debd16ea2a49b07167f35d3dd9cacac60c0ad6d60fbb76ce78e7",
         "short_channel_id": "103x1x1",
         "our_amount_msat": 1000000000,
         "amount_msat": 1000000000,
         "funding_txid": "c312c45e0294efa91a0c7edb4c6fc26a9511af6f1fe1b1b92e484fc4b76c02ee",
         "funding_output": 1
      }
   ]
}


text:
Why I can transfer btc from unconfirmed balance?
I am facing a problem of long waiting unconfirmed transaction since yesterday. (Same problem with many people here). All of my wallet and transaction are Blockchain.info
But while I am waiting for confirming transaction, my destination wallet already got balance and I can do transfer from this wallet to another wallet.
I have 4 wallets (A, B, C, D)
https://blockchain.info/tx/1dac8a76f5fc6115e1c1df2c65f034d89555bf73e09849c615d5e91887d2909a
A->B
https://blockchain.info/tx/dfcf3799b41d0a555d461dc6dda2b28f6f412c3a7ff7ad76a105140752003046
C->B
https://blockchain.info/tx/686a32191cba7b3b4299b60398a23de10e96f1737e26e15cbd6111d6a26d48ce
B->D
The question are
 1. why my B wallet got available balance and can transfer out?
 2. what will happen to my B->D transaction?
Thank you

Transactions spend outputs from other transactions. Just because the transaction hasn't been included in a block yet, doesn't mean it isn't valid. It's valid as long as it isn't a double spend, so spending unconfirmed transactions is all about trust and risk. If you trust that the transaction is not going to be double spent (e.g. it's your own transaction) or its relatively low risk (e.g. small amount being sent), you can safely spend from it. If it's higher risk, though,
 (e.g. larger payment), it is safer to wait for it to be included in a block to reduce the chance of it being double spent and invalidated. If the unconfirmed transaction becomes invalid, so does it's child.


text:
After all possible Bitcoins are created, won't transaction fees eventually consume all Bitcoins?
After all possible Bitcoins are created, won't transaction fees from miners validating transactions eat away from the total and eventually consume all Bitcoins?
Right now, because new Bitcoins are still being created, kind of like planned inflation, mining fees are adding Bitcoins to the circulation.
But after all Bitcoins are created, it seems that an infinite number of transactions would transfer all Bitcoins via fees to miners, self-defeating the currency.
I wonder if this problem, if real, is another reason why a little bit of inflation is a good thing, since some types of fiat currency transactions consume fees (e.g., credit card transactions) but others do not (cash, direct bank transfers, ATM withdrawals from member bank systems) or don't per transaction ( flat monthly checking account fees). It seems a little bit of inflation prevents fees from taking an ever greater percentage of a currency.
I'm skating on very thin ice with my limited understanding of Bitcoin and currency in general, and that's why I'm posting here.
Fees are a mammoth devil in the details of the world economy, maybe including Bitcoin.
=======
MAJOR EDIT ADDITION
There seems to be a misunderstanding about my question. I'm not questioning the value of miners. I'm wondering about the mathematics of compensating miners after all 21 million bitcoins are created. This isn't a moral judgement. Miners are creating bitcoins now, providing a valuable service. But since there's a finite number of bitcoins, 21 million (?), after they're all mined won't miners still be necessary to process all transactions? But instead of creating new bitcoins, after the maximum of 21 million coins are created, won't miners then be taking bitcoins from other people instead of creating new ones? Just mathematically, after all 21 million bitcoins are created, wouldn't an infinite number of transactions transfer all bitcoins to miners? I'm just wondering about the math theory of mining after all 21 million bitcoins are created.

Miners don't work for free.  They get bitcoins by mining, and sell the bitcoins to users for cash. They use that cash to pay their bills so that they can keep mining.

Your edit suggests that you did not read or understand a single answer.  No, miners will not get all the bitcoins, because they will keep selling bitcoins to other users.

People will exchange other currency or services for bitcoin  and miners will also exchange bitcoin for services.

There are two objections I would raise:

Miners have expenses. You need to pay your power bill. You need to pay your employees. You need to pay for new ASICs when the old ones inevitably become obsolete. You need to pay off your initial investment in ASICs. All of these things cost money.
You might object that miners wouldn't be doing this unless revenue exceeded expenses. This is true, but it's also true of every other profession. Therefore, we should view 'miners will eventually have all the money' the same way we view 'dentists will eventually have all the money.'

In general, people don't acquire money for the sake of having money. It's usually in service of some other kind of goal, like financial security, providing for someone else, or buying food. Sitting on a hoard of money that you cannot spend accomplishes none of these goals.

No. Miners do not "eat" the transaction fees. The fees are their income and they can spend them later.

Technically yes, but miners themselves can then sell those Bitcoins back into the pool for non-miners to pay for their own goods and services.  While this brings up an interesting point about an eventual "miner elite", this is far in the future and for now a non-issue. Ultimately, some other coin may need to become dominant to stop this centralization you describe.
As others have pointed out, Scrypt coins democratize mining, and proof of stake type coins also offer a way out of that sort of dilemma!

In addition to all that has been said:
You, like everyone else, can become a miner (or part of a mining pool).
So, every miner is in competition with every other miner, and as said, will have an interest that the coins remain in circulation (the mined coins keep real value).
In a perfect bitcoin world, everyone would be part of mining too.


text:
MtGox websockets vs HTTP - which is more real-time?
MtGox currently offers both a websockets and HTTP API services. According to the documentation the HTTP service caches prices for 10sec but there is no clarification (that I can find) that details the real-time guarantees of the streaming services?
Which would be expected to be closest to real-time?

You would expect websockets to be more real-time because it is designed as an upgrade to HTTP to enable live streaming and real-time services.

Thanks. Do you have any direct experience of this?


text:
Lost Litecoin wallet?
Using Litecoin-QT
First I created wallet a. Then I sent 2 LTC to that wallet's public address.
Then I imported a private key in Litecoin-QT and wallet a was gone?! Aren't all .dat files  that has been used stored somewhere, or do they get overwritten everytime you import a new key to your wallet?

Importing a private key should not cause you to lose your wallet. If you import a private key and then restore from a previous backup, you may lose that key, however.

authors: Анатолий Лоскутов


text:
Buying Litecoins Directly
Is it possible to buy litecoins directly with money from an institution like Mt.Gox without buying Bitcoins first and swapping them ?

BTC-e offers LTC/USD, LTC/EUR, and LTC/RUR pairs that enable the direct purchase of LTC.  However, depending on your location and the payment methods available to you, it may be easier and cheaper to buy BTC first and then exchange them for LTC.

The following exchanges allow you to buy Litecoins directly:

Harborly
Crypto-Trade
BTC-E
UpBit
OKCoin (Chinese)
Kraken
Or you could find a local trader

Yes you can use expresscoin. we provide fast and easy way to buy litecoin and other digital currencies.


text:
Mt.Gox Graph Question
This is the last month's graph:

And this is the last day's graph:
So these are my questions:

If the today's price is about 800$ in daily graph, why is the today's price displayed as about 200$ in montly graph?
What does tell the mini graph tell us below the main graph?
What is meant with the Volume? If it's the traded amount, why should i bother with it, instead of directly looking at the amount price movemont?

PS: By the way, to see the graphs larger, click on the corresponding image with the right mouse button and then click on view image.

Are you saying I can get BTC for $800 somewhere? I'll give you $50 commision if you tell me where!

The numbers for the price are on the right of the graph (under the word Price that is turned 90 degrees clockwise) and the numbers on the left are for volume (under the word Volume that is turned 90 degrees counterclockwise.
Price is the amount that was paid on a per-bitcoin basis, the "candles" show where trading occured during the time period in question and the "wicks" show spikes in those same time periods.
Volume is the number of bitcoins bought and sold during a given period, with each period being represented by a direction change on the line graph. This is an important metric because it shows how much trading is happening, whether or not the price is changing significantly (since many people might buy/sell at some times/prices and other times there are few available bitcoins at a given price.)
Price will always remain the same at different levels of zoom, but volume will change based on the number of trades that happened, and since zooming changes the size of the periods (daily in the top, hourly in the bottom) the volume numbers on the left will shift as needed.
The mini-chart allows you to see the volume of the exchange over a very long period, and the highlighted section is what you are currently looking at in the chart above. You can adjust the scope of the main graph by pulling the handles on the mini-graph if you want to see a period of time in more or less detail, or select a specific period of time (like October)
To get more information on asset pricing charts I recommend http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis and for other bitcoin specific charts and graphs be sure to check out http://bitcoinity.org, http://bitcoinwisdom.com, and http://bitcoincharts.com/charts


text:
Why does Avast and other antivirus' detect gpu miners as viruses?
For example I was downloading the latest cgminer and Avast blocked the download saying it was a virus. Is this true or is it a false positive? I've had other antimalware (I think Malwarebytes) detect cgminer as a virus.

Also true for CPU miners.

This is probably because hackers install these miners on peoples computers without their knowledge or make a botnet of miners.
Solution to this is placing your miner to ignore-list or get another antivirus like Avira, Avg, or just switch to linux and no need for antivirus anymore.

Is Eset good?..

Antivirus and Windows defender will block most of the Miner programs and wallet files. They are false positive and you can add exception to it. Before you do it make sure you've downloaded the program from reliable resource.
Here is a interesting guide which I found on this
https://coinguides.org/miner-detected-virus/


text:
Blockchain beyond bitcoin etc. - Who is mining?
People are praising the blockchain for use in all kinds of environments where a secure transaction history is required, e.g. logistics etc.
My question: Let's say someone sets up a blockchain for logistics transactions - what would be the incentive to provide the proof-of-work, i.e. to mine?
In the Bitcoin blockchain, I receive bitcoins as a reward. But wouldn't a similar kind of reward be required for this non-bitcoin blockchain to work in real life?

If this is the wrong community, please point me to one that is better suited. Also, my question is based on my current understanding of the blockchain technology, so please also let me know if the question does not compute.

These days there's a lot of new systems being shipped - or marketed even before that - that came with 'blockchain' attached somehow. We're not sure how and why someone would set up a blockchain for logistics transactions, to stay on your example. Most of the news about 'adopting blockchain technology' we see on the media fails to explain why they need a blockchan at all - or are afraid to say they will anchor data on Bitcoin or Ethereum chains.
One can design a database with hashes and digital signatures in blockchain's fashion and call that a 'blockchain', without mining. They can even have ming with no reward or token of value, and call that a 'blockchain'. There's no one to stop them.
But the meaning of 'blockchain' as it's used in Bitcoin, is something where mining is hard and needs incentives like block reward to happen. That's the design originally proposed by Satoshi Nakamoto in his solution for the Bizantine Generals Problem.

Thanks for your comment! I think by now I have a much better understanding of the Blockchain technology and I tend to agree with you — almost all of the blockchain stuff around disruption and new business models is nonsense and just part of the hype. The answer to my original question lies in things like proof of stake, proof of authority, etc. (I.e. any of the other consensus methods). However, even then, most of the people talking about blockchain in the media/business world seem like they do not really understand what they are talking about...


text:
How a new wallet knows balances locked in P2SH transactions?
If my old wallet created and submitted a P2SH TX to the blockchain, and I migrate to a completely different wallet, how can the new wallet detect that that UTXO belongs to me? Since the script is hashed, it can be anything and contain unpredictable information, like other PKHs in multisig transactions

In short, it knows because it knows. Whatever information was used to make the original wallet construct the addresses (whether that consists of a seed, a set of keys, a master key, a descriptor, a mnemonic phrase, ...) must be imported into the new wallet too.
The P2SH redeemscript is not created randomly: there is a procedure to generate it from keys the wallet has, and those keys may themselves also be generated from such information. What that information is depends on the standards or schemes involved, so it's hard to be very specific here.
Deterministic wallets have been standard since 2013 or so, and pretty much all wallets have some means of deterministically constructing keys from some fixed immutable piece of data. For single key policies (simple wallets) a wallet also needs information to turn those keys into scripts/addresses. Common ways include P2PKH (address contains a hash of the public key), P2WPKH (similar, but uses segwit for spending), or P2SH-P2WPKH (where the address is a P2SH address containing the hash of a segwit program that contains the hash of the public key). The wallet needs to know which (possibly more than one of these) is used to convert the keys into scripts, and that implies also a way for computing the redeemscripts involved. Sometimes this choice is implicit in the standard being followed; sometimes it needs to be imported/chosen specifically.
For multisignature or other policies it is more complicated, as wallets also need to know how the other participants generate their keys, but this information is always needed - both in the first and the second wallet.

Thanks for answering, Pieter! I guess I was under the impression that all you need to access your funds is your mnemonic and then you can scan over deterministic paths and trivial spending scripts. But apparently, this is not the case if your funds are in multisig or other nontrivial script placed into P2SH UTXO. Need to be careful not create such "exotic" transactions in your wallet, to avoid loosing funds in case the wallet is lost. Or at least export and backup that extra information somehow, but is there a compatibility standard for that, so that wallets can be inter-operable?

There are multiple approaches. Don't expect wallets to be interoperable, especially not when doing more complicated things than just single signatures.

P2SH addresses can either be P2SH-P2WPKH addresses (wrapped segwit) or they can be multisig or something else. If your wallet is using P2SH-P2WPKH addresses, the wallet should be able to recognize your address upon initialization. Otherwise, you will probably have to manually import that address.
Regardless, the amount of btc held in that address is on the blockchain, so your node or wallet will know that amount of bitcoin held in that address once you have imported (if necessary) the address.


text:
Removed transaction
I have this transaction I made some days ago (8) and it wasn't processed by the miners and it was unconfirmed (for very low fee). Today I made a quick check and it looks like REMOVED / EXPIRED. What should I do? It will be send back to my wallet?
For info: it's a transaction from Mycelium (Android wallet) to Bitfinex.
Thanks everyone!
TRANSACTION LINK

Yes, send another transaction with a significantly higher fee. You should look at this chart to estimate how much fees you should be paying.

Since I have no money on my wallet I can be little tricky. Is there another way?

What wallet are you using?

I wrote it, Mycelium. The thing is that I transfered ALL the BTC I had on that wallet to my Bitfinex account, so send another transaction can be painful becuase I have to buy BTC, then send to Mycelium wallet and the send to Bitfinex = A LOT OF FEE. I'm wondering if is exist another way

Don't buy more BTC, you do not need to. You should have an option for CPFP (Child pays for parent) on Mycelium. That's what you should be looking for. I did a little search and looks like Mycelium has a "Bump fee" feature which is what you should do.

Yeah, I found it but it gives me error, probably because it need more BTC to use as fee and my wallet is completely 0.

You can't do a CPFP here, the recipient is an exchange wallet. You got 3 options: 1. Ask miners for help 2. Double-spend aka replace-by-fee 3. Wait until it gets dropped by mempool or confirmed by its own


text:
Sweeping funds from addresses generated by Extended Private Key (BIP39)
I have a site that is trying to process micropayments. It uses a mnemonic / extended private key generated here to generate a new Bitcoin address for every payment.
Everything works fine except I'm realizing now that it will be expensive to recover funds from the generated addresses because it will cost a ~10,000 satoshi mining fee per address.
This is a small fee but it is too high considering the totals being extracted are only 20,000 to 30,000 satoshi.
Are there any options to solve this problem? I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?
A few other options I've been considering:

BlockCypher had a microtransactions API which seems to be shut down now
Some node APIs including BlockCypher offer payment forwarding though I don't understand the fees involved or how it works internally
Payment channels / Lightning Network

I know Bitcoin has this concept of "sweeping" funds. Does that still involve incurring a flat fee for every address generated by the master private key?

No, sweeping an address involves inputting a private key into some wallet software, and then having the wallet software initiate a tx to empty that address’ funds entirely into a new address that the wallet controls the private keys for.
While a BIP39 xpriv key can be used to derive many child keypairs, the xpriv cannot itself be used to spend the UTXOs of those child addresses. You need the private key of each address in order to spend it’s funds. The network has no way of knowing how a key pair was derived, so only the private key of each individual address can spend its funds.
For best efficiency, you’ll want to batch all of the UTXOs into a single transaction with a single output (or maybe more than one, depending on how you want to divide and store the funds).
A single tx with a lot of inputs will have a higher fee than any single tx, but it will be lower than the total fees paid if you send each one individually.
I’m not familiar with blockcypher, but in general if a tx is sent on the network, and then you’d like to spend those funds again, a network fee will be incurred. So I’m not sure their service will save you money in the way you’re looking for.
Lightning network is a potential solution for payment processing with lower fees, but the network is still young so it will take a little time for adoption to happen.

This is really helpful. I honestly wasn't aware of batching. A few questions: am I really gaining anything by depending on BlockCypher's service? I figure I can just host my own node to minimize risk of fees. Does batching multiple inputs to multiple outputs apply to other coins like Ethereum?

I'm not familiar with BlockCypher's service, sorry. Their service may manage incoming payments more efficiently than you will be able to on your own, but it may also come with fees of its own. In either case, you'll still have to pay network fees when sending transactions. I am not sure how Ethereum manages batching, you'll have to post a new question and hope someone else can answer.


text:
If my node is connected to 7 nodes and 4 of those say that a block they transmitted to me is valid will i mark it as valid?
Let's say I am a node and I am connected to 7 other nodes.
4 of those nodes transmit me a tx or a block and say it's valid.
(I am aware they do not explicitly send a message saying that something they sent is valid or not they would not send it in the first place.)
So will my node accept the block/tx as most of the nodes I am connected to agree that this "x" tx or block is valid?

No, every node validates transactions and blocks independently according to a shared ruleset. It doesn't matter if someone creates a hundred nodes to connect to you and send you invalid transactions and blocks, your node will simply reject them and in most cases disconnect from those nodes.

Thank you so much! Was just a bit confused after reading the full white paper. Thanks again!

In practice the ruleset may be shared, but more importantly, your node evaluates the data according to the local ruleset of the software that you chose to install!

I think it is worth reading the short "white paper" by  the inventor of Bitcoin in 2008. They said their objective was to create a system where one person could pay a second person without any trusted third parties.
Bitcoin does not require you to trust anyone in the Bitcoin network. You only have to trust that the second party, the recipient of the money, will deliver the goods or services you are paying for.
As Vojtěch Strnad wrote, all wallets verify all the data that can be verified. The network protocols etc are designed to make that possible.

Yes I had read the white paper. I was just a bit confused tho I was expecting this answer all along. Thanks!