Are lightweight LN wallets vulnerable to transaction withholding?

As far as I know, LN requires the user to watch the blockchain in order to perform penalty in time. However, running full node is probably a heavy burden to some users, especially to mobile phones. I once heard that improved protocol for lightweight wallet (like Neutrino) can solve this problem, but I also heard that such lightweight wallet protocol still implies trusting the full node or server which provides service. Especially, a malicious full node can hide transactions from its clients, which seems to be a potential threat to lightweight LN wallets.

What does the prefix of the raw transaction encoding of an exported Electrum transaction file (.txn) mean?

I have exported a testnet transaction into a .txn file:

{     "hex": "45505446ff0002000000000101c6be24d86ab1ae5b54e7e7905b...",     "complete": false,     "final": false } 

However, as explained in this article, a raw transaction string starts with version number and:

The version number is four bytes long and is expressed as a hexadecimal value in little endian format.

There are two version types. Version 01 indicates that there is no relative time lock. Version 02 indicates that there may be a relative time lock.

So this hex is not a qualified raw transaction encoding, due to the prefix


The version number comes after this prefix:


So I was wondering, what is the function of this prefix that Electrum adds to the raw transaction string? And is it always the same length? Because I need to automatically splice it off in order to get a valid raw transaction string.

Bitcoin core and transaction fees

I’m using combination of ‘createrawtransaction’ and ‘fundrawtransaction’ API calls to create my transactions. I don’t pass ‘feeRate’ option to ‘fundrawtransaction’ and rely on bitcoin wallet to figure out the fee. Is this a good strategy for mission critical system like payment system or I have to manually estimate transaction fees and not rely on functionality provided by bitcoin core?

As far as I understand if fee is too low for a network conditions then transaction may stuck in the mempool of some nodes. Even worse it may be expelled from some nodes while still remain in others. Is there any way to cancel such transaction and make sure no miner will ever pick it up? If not then what are my options when dealing with stuck transactions?

Negative number of confirmations for a testnet transaction on blockexplorer

I am curious about the test transaction f72f59a32c1bac47ec87bc3678ec44e98eece5e235d29d79cd1f5461ccc5bf38. Depending on which site I view this transaction, the number of confirmations is positive or negative:

On there are -1797 confirmations.

However on there are +1318 confirmations.

Moreover, one of the outputs appears to be spent on blockcypher but unspent on blockexplorer.

I have two questions:

  • Why is there such a difference in the number of confirmations?
  • Is there something wrong with this transaction?

PSBT (BIP-174, Partially Signed Bitcoin Transaction) Ordering of keys

When serializing a PSBT (BIP-174, Partially Signed Bitcoin Transaction), I cannot find any information if the keys should be ordered when serializing the PSBT?

Under the “Test Vectors” section for the BIP-174 in the last example it is only mentioned that:

A combiner which orders keys lexicographically must produce the following PSBT[…]

But it does nowhere say that it is mandatory to order the keys. What is expected?

I am implementing test cases for a PSBT library and would like to know this to decide if I should compare the serialized PSBTs (where ordering does matter) or the objects themselves (regardless of ordering of keys).

Is it possible to generate(mine) a block with specific transaction via bitcoin-cli on regtest?

I want to generate a block with specific transaction via bitcoin-cli on regtest.

The “generate” command does not have the option. It collects transactions in mempool by the default rule.

I guess I can do it with some code change like the following way but I don’t want to change it if possible.

TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey) {     const CChainParams& chainparams = Params();     std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey);     CBlock& block = pblocktemplate->block;      // Replace mempool-selected txns with just coinbase plus passed-in txns:     block.vtx.resize(1);     for (const CMutableTransaction& tx : txns)         block.vtx.push_back(MakeTransactionRef(tx));

how can i create a sign usdt transaction with javascript?

first l konw run en omni core then used the omnicore cli can work but i don’t want to run a node in my local compute ,so


  1. create a sign usdt transaction
  2. get the hex
  3. broadcast the hex with the api


thanks for your think

Witness program hash mismatch while signing bech32 transaction

I’m trying to sign a transaction using signrawtransactionwithkey on bitcoin-core 0.17 but I’m getting the following error:

{"ERROR":"[{"txid":"c7e5bc9c9662384464182c713a6a6e20a2da72adb2b2a5799457be643d764139","vout":0,"witness":[],"scriptSig":"","sequence":4294967295,"error":"Witness program hash mismatch"}]  

parameters sent correctly since it’s working on the testnet network it’s just the mainnet

anyway the params sent as:


the inputs are


Do I need to add redeemScript for bech32? (I don’t think so)

Why mark a transaction as RBF (Replace-by-Fee) explicitly?

I could broadcast a second transaction that has the same inputs but a higher fee, without marking the original transaction as replaceable. Miners would most likely favor the second transaction and reject the original one. Why should I mark my transactions as replacable if they can always be replaced by broadcasting another conf-0 transaction?