text:
Why does my PSBT's input script not have a pub key?
I have created a PSBT to sign an HTLC using a funded P2WSH, that I wish to sign with my xverse wallet. This is my decoded PSBT which I have created using bitcoin-cli
o@OscarPC:~/bitcoin-htlc$ bitcoin-cli -testnet decodepsbt cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA
{
  "tx": {
    "txid": "a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a",
    "hash": "a1eaefe490f5d3be11fbd6a5afeffcff20a9e92cfde3363484168c9f5769c57a",
    "version": 2,
    "size": 94,
    "vsize": 94,
    "weight": 376,
    "locktime": 0,
    "vin": [
      {
        "txid": "be9cc0e300d1c01b7fdbeeff1c99acc0fb8a7d9e8d025547b7bfc9635dedcbb3",
        "vout": 0,
        "scriptSig": {
          "asm": "",
          "hex": ""
        },
        "sequence": 4294967294
      }
    ],
    "vout": [
      {
        "value": 0.00000000,
        "n": 0,
        "scriptPubKey": {
          "asm": "1 988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3",
          "desc": "rawtr(988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3)#4xpnet5r",
          "hex": "5120988fa46449a345b974a03e854ea27b44a4a2a5ef99a522c8cf4c210d5ac4bbe3",
          "address": "tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd",
          "type": "witness_v1_taproot"
        }
      }
    ]
  },
  "global_xpubs": [
  ],
  "psbt_version": 0,
  "proprietary": [
  ],
  "unknown": {
  },
  "inputs": [
    {
      "witness_utxo": {
        "amount": 0.00001000,
        "scriptPubKey": {
          "asm": "0 a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca",
          "desc": "addr(tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr)#wjcfmgw8",
          "hex": "0020a608e7c6b6c3201d260931616c80b165d9c022fb960a4399b797fe7d95771cca",
          "address": "tb1q5cyw034kcvsp6fsfx9skeq93vhvuqghmjc9y8xdhjll8m9thrn9q5mv0nr",
          "type": "witness_v0_scripthash"
        }
      },
      "witness_script": {
        "asm": "OP_IF OP_SHA256 652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd0 OP_EQUALVERIFY OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ELSE 0 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 e399056c4ca63571aca44fc2d11b3fdac69a37e0 OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "63a820652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd08876a914e399056c4ca63571aca44fc2d11b3fdac69a37e06700b17576a914e399056c4ca63571aca44fc2d11b3fdac69a37e06888ac",
        "type": "nonstandard"
      }
    }
  ],
  "outputs": [
    {
    }
  ],
  "fee": 0.00001000
}

It is my intention to follow this sats-connect example from the official sats connect docs to do the signing using my xverse wallet:
import {
  BitcoinNetworkType,
  RpcErrorCode,
  request,
} from "sats-connect";

const signPsbtOptions = {
    payload: {
      network: {
        type: 'Testnet
      },
      psbtBase64: `cHNidP8BAF4CAAAAAbPL7V1jyb+3R1UCjZ59ivvArJkc/+7bfxvA0QDjwJy+AAAAAAD+////AQAAAAAAAAAAIlEgmI+kZEmjRbl0oD6FTqJ7RKSipe+ZpSLIz0whDVrEu+MAAAAAAAEBK+gDAAAAAAAAIgAgpgjnxrbDIB0mCTFhbICxZdnAIvuWCkOZt5f+fZV3HMoBBVljqCBlLH3Gh9mMmIkwTtLkCMdLYR6GpAyqUcS0Px3VkTxc0Ih2qRTjmQVsTKY1caykT8LRGz/axpo34GcAsXV2qRTjmQVsTKY1caykT8LRGz/axpo34GiIrAAA`,
      allowedSignHash: btc.SignatureHash.SINGLE | btc.SignatureHash.DEFAULT_ANYONECANPAY,
      broadcast: false,
      inputsToSign: [
          {
              address: "tb1pnz86gezf5dzmja9q86z5agnmgjj29f00nxjj9jx0fsss6kkyh03sjkqhpd",
              signingIndexes: [0]
          }
      ],
    },
    onFinish: (response) => {
      console.log('Signed PSBT:', response.psbtBase64);
    },
    onCancel: () => alert('Signing canceled'),
  };

  try {
    await signTransaction(signPsbtOptions);
  } catch (error) {
    console.error('Error signing PSBT:', error);
  }

However, whenever I try to sign the PSBT using my xverse wallet from the browser, it throws an error:
Input script doesn't have pubKey: 99,168,32,101,44,125,198,135,217,140,152,137,48,78,210,228,8,199,75,97,30,134,164,12,170,81,196,180,63,29,213,145,60,92,208,136,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,103,0,177,117,118,169,20,227,153,5,108,76,166,53,113,172,164,79,194,209,27,63,218,198,154,55,224,104,136,172

This brings me to my question
Why does my PSBT input script not have a pub key? In the inputs section of the decoded psbt, there is a scriptPubKey section inside the input field.

Though it is named scriptPubKey, it is a script which often does not contain a pubkey, nor even if it did, just a pubkey.
The PSBT does not contain a pubkey because Bitcoin Core does not know enough about the script in order to know what pubkey to place into it.
The script appears to be nonstandard and does not appear to be Miniscript either, so Bitcoin Core has no idea how to sign for it. As it does not know how to sign for it, it cannot figure out what other components are necessary, such as which public keys. Hence it does not insert any pubkeys or any other data into the PSBT.


text:
How do I determine whether an input or output is segwit? - revisited
This is a discussion that has already been had here, but bear with me.
We're gonna be talking about tx faae7e55db14a32e083cbf6a91db8a5ab6a3b05e050d9cefdec80b47f966848e

all I got is the encoded transaction
it has been marked as segwit (marker + flag)
tx has 3 inputs, only the last one is segwit
the segwit input has a script sig: 1600140c6259927541c4f8e88fc1398691e2661d15591a
got to decode the witnesses section correctly, implied there is only one

In the previous discussion, they mentioned that a segwit input is easily spotted as it has an empty script sig.
The segwit input we have here has a script sig... I know it's segwit cause I looked in a blockchain explorer. How can my software programatically tell it's segwit just by looking at the transaction's data?

Native segwit inputs have an empty scriptSig; P2SH-wrapped segwit inputs have a P2SH redeemScript in the scriptSig.

The way to determine whether an input has a witness is simply by seeing if it had witness data. I realize that's tautological, but there is nothing else to it: the BIP144 transaction serialization simply encodes the witness data for every input.

Ohhh I see, the witness section starts by 0, 0, 2... Thanks again @PieterWuille

The way the BIP141 segwit rules consider transactions is simply that every transaction input (even non-segwit ones) have a witness stack. Non-segwit inputs are required to have an empty witness stack however.
If every transaction input has an empty witness stack, the old pre-segwit transaction serialization is used for the transaction. If at least one inout has a non-empty witness stack, the BIP144 transaction serialization format (including marker & flag) is used. The non-segwit inputs then simply have an empty witness.
Now, there is a consensus rule that says that unless a transaction input is a segwit spend, its witness stack must be empty. An input is a segwit spend if the UTXO it spends is a witness program (OP_n + push of 2-40 bytes), or if it is a P2SH UTXO, whose redeemScript is such a witness program. If an input is a segwit spend, the scriptSig must be exactly empty or exactly the P2SH redeemScript and nothing else. If an input is not a segwit spend, the witness stack must be empty. But all of this is rules that govern whether a transaction is valid w.r.t. its witnesses and scriptSigs; it is unrelated to whether the transaction has witnesses.

Thanks for getting me going... you're an invaluable asset for the Bitcoin industry!

source: Stack Exchange

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

sort: votes


text:
How does the blockchain prevent spending money during a "short fork"?
I'm currently reading "Mastering Bitcoin" (i haven't finished it tho, but i don't see my answer and it bother me so I prefer asking it here) and there's something i don't understand. So from what I understand the "valid" blockchain is the one which has the most blocks in it. But what happens if :

a "hacker" is lucky with the hash function and manage to add a "wrong" block to the blockchain, in which, let's say that someone gives him 1BTC (even if there is no way to make a false transaction to receive 1BTC, he will at least have the bitcoins from mining a block)
Then the blochain of the "hacker" will have 1 block more than the others, thus it should be, at least for a few minutes, the "valid" blockchain

But what happens if he buy something with this 1BTC during those few minutes ? If for example, he buys a coffee, or some real items ? What prevents him from doing that ?
Is there a rule that makes that you can spend bitcoins from a transaction output only if the transaction is "old enough" (which mean that 3 or 4 blocks has been added after the block that contains the transaction) ?
If so, doesn't it make bitcoin transactions slow to process ? I already know that a transaction can be validated by a full node client and that you don't need to wait 10 minutes for the block to be in the blockchain, but if you need 30 minutes to be able to spend the money, doesn't it make transactions slow ?
Thank you in advance
PS : By the way i'm sorry if the term "short fork" is not the right expression but i didn't know how to call it

Then the blochain of the "hacker" will have 1 block more than the others, thus it should be, at least for a few minutes, the "valid" blockchain

This is incorrect. A block that contains an invalid transaction is invalid, period.
The network's rule is that the longest(*) valid chain is the one to be treated as correct. A chain with any invalid blocks in it is ignored by full nodes on the network.
Now, lightweight nodes on the network do not perform full validation, and thus cannot tell whether the longest chain is in fact valid or not, and thus they'll accept any chain. However, generally lightweight clients are only used by individuals that don't participate in much economic activity. A store that sells real world items for BTC is very much incentivized to use a full node that will never be fooled by this.
Furthermore, since creating a block is expensive, few miners will be willing to produce a block that contains invalid transactions, as such blocks will eventually not be considered acceptable to the network, and thus not result in any income for the miner. This long-term effect that economically-relevant full nodes have on miners through incentives in fact conveys security to lightweight nodes.

If so, doesn't it make bitcoin transactions slow to process ? I already know that a transaction can be validated by a full node client and that you don't need to wait 10 minutes for the block to be in the blockchain, but if you need 30 minutes to be able to spend the money, doesn't it make transactions slow ?

Unless you trust the sender, you always need to wait for a number of confirmations, as there is always a chance that a (short) non-malicious reorganization of the chain happens, which confirms a conflicting transaction to the one that pays you.
This makes Bitcoin, in adversarial settings, much more appropriate as a settlement layer than as a payment system. And at that, it excels. Compared to say a credit card payment, the receiver knows the transaction is final within hours, compared to maybe months for a credit card payment.
This is an inherent restriction of a public consensus systems: it is inherently hard and slow to get the entire world to agree on an exact state of the ledger. For payment solutions people are building layers on top, which take advantage of the guaranteed settlement, but permit payments in a direct fashion with just knowledge of the involved parties. The Lightning Network is a good example of this.
(*) Technically it is not the longest chain that matters, but the chain with the most work. These definitions are almost always identical, but in the few edge cases where they differ, the difference is important.

Ok, that make sense, thanks. While i'm here, i was reading about the double spending issue and i read about Finney attack (https://bitcoin.stackexchange.com/questions/4942/what-is-a-finney-attack) is there still no way to prevent this attack ?

I expanded my answer a bit. A Finney attack is inherent weakness of this sort of system, it is not solvable at the blockchain layer.

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


text:
How can I get stealthVersion from bitcoin's source code?
I found that a library called Bitcoinkit use stealthVersion.
Network.swift
public class Mainnet: Network {
...
    override var stealthVersion: UInt8 {
        return 0x2A
    }
...

I tried to search 0x2A,0x2a and 42(decimal from 0x2a) but find nothing in source code.
Is this calculated in bitcoin source code?
PS:
I found some Altcoin have a stealth.cpp which defined stealthversion:
(Verge)
const uint8_t stealth_version_byte = 0x28;

I suspect this is for a feature called stealth addresses, which are not supported by Bitcoin Core, so naturally you wouldn't find it in its source code.

I thought it too. But why it is 0x2A instead of something else?

You'll have to ask the person who picked that value.

Yeah. I have just noticed that. The value is same as the bitcoin's version. Mainnet is 0x2a, Testnet is 0x2b. I couldn't find these too.


text:
How are the requirements of the hash for mining a new block determined?
How are the requirements of the hash for mining a new block determined? Is it published or a message is sent?

I think this reference is a good reading for undestend the mining

The difficulty calculation is part of the consensus rules that nodes on the network follow. It can be calculated at any time by a node and is calculated every 2016 blocks (two weeks, on average). When the correct number of blocks has passed, the node calculates it based on the last two weeks and adjusts in order to maintain a 10 minute block time (on average). The calculation is in CalculateNextWorkRequired.
Miners can request a block template from a node, in order to start mining, which contains the hash target (i.e. difficulty), see getblocktemplate.


text:
Is it possible to configure bitcoind to allocate blocks in larger "chunks"?
In the bitcoind log there are many entries similar to this:
Pre-allocating up to position 0x200000 in rev02037.dat
There are often several messages regarding pre-allocation of the same file. This is concerning because copy-on-write filesystems (such as BTRFS, in my case) have to allocate new extents when files are written in this manner. Such writes cause an increase in filesystem metadata block consumption, which of course eats away at the overall available storage. For example, here are the size and number of extents consumed by two of the files:
# ls -lh *02036.dat
-rw------- 1 bitcoin bitcoin 128M Apr 16 16:49 blk02036.dat
-rw------- 1 bitcoin bitcoin  17M Apr 16 16:49 rev02036.dat

# filefrag *02036.dat
blk02036.dat: 87 extents found
rev02036.dat: 103 extent found

Both files consume more extents than what they actually need considering their sizes. After defragging them with btrfs filesystem defrag they were rewritten and now only consume one extent each.
Since the blk and rev files each tend to be roughly the same size, I prefer to have bitcoind perform the allocations such that it's most likely to only need to perform one pre-allocation. Is there such a configuration option available?

If you referring to the blkxxx.dat file it will always have a maximum size of 128 MB which is defined in the bitcoin the source file validations.h
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB

Also in this file you can see that the maximum pre-allocation chunk size fixed.
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB


text:
How did I get a Test net
I was downloading bitcoin for the first time and during the last 3 minutes while doing some other work on my computer, something about an interruption flashed and then it looked as if nothing had ever happened and it was not downloading. I went to the file I had saved it in and there was a Bitcoin Core [test net] so I clicked on it and it is now synching. Is this normal? Any advice? I was told to start the download again?

Bitcoin Core's installer will also setup a shortcut for testnet. Testnet is a different blockchain and network specifically for testing. This is normal and expected behavior, but there is no reason for you to be using testnet. You should stop Bitcoin Core and just use the normal launcher.


text:
why is the header for the JSON RPC interface text/plain? vs application/json?
the bitcoin core docs call out that RPC HTTP requests must include a Content-Type header set to text/plain and all the example commands confirm this header. why is it text/plain instead of application/json?

It is a bug, you should report it.


text:
is it safe to share the indexes folder between computers?
my understsanding is the indexes folder is created if you have tindex set to 1 and want to keep an index of all transactions. all of the material i've seen (bitcoin core documentation, on this site, etc) either:

says it's safe to copy only blocks + chainstate between computers
lists files + folders which are expressly unsafe to copy (ex. wallet.dat).

my understanding + intuition of the indexes folder (from docs + inspecting the files myself) is that it has no pii and should be safe to copy but i just wanted to confirm.

Yes, indexes is safe to copy. It only contains transaction data and is completely unrelated to the wallet. In fact, indexes used to be part of blocks so with older versions, if you had txindex=1, then copying blocks meant you also copied indexes. Only recently was this separated into its own folder in the datadir.


text:
Sweeping paper sweeping private keys from 2009-2010 into electrum wallet
I have several wallets from 2009 and 2010 that have not been touched since day one.I recieved 25 dollars USD worth of BTC for downloading and running a program in the background. Im guessing i was mining BTC. Didnt think another thought about it. I was alittle irritated because 25 bucks didnt just shoot outof the computer screen!! Lol.
Luckly my dad never throws away anything. So after scanning 18 hard drives ( it is a whole learning exp.)i have recovered 13 or so private kets and wallet ids. And still looking.
So obviously i am very slow to do anything and am stuck on this sweeping thing. The files may have had a list of words. I dont recall. They were not encrypted though. So are the priv. keys considered a masterkey? The only options for a standard wallet is seed or master key. One of the files did say rootsomethingor another. None were wallet.dat. i hid one file in a music folder. So where do i go from here? Also,what is xprv yprv and zprv? And what is the purpose of the console for sweeping if any at all? I am not in tye console.
Anybody have any clue how to guide me on this?

In 2010 there were no such thing as recovery seeds with words, master keys, xpriv, or even encrypted wallets.

So i guess my question is-- when sweeping my private keys into electrum on the screen to enter private keys the address on that screen should be the new electrum wallet address? Or the address that was originally with the private keys.

Also am i going with standard or import address and keys? And lastly, when i sweep the keys, it should reflect my balance immediatly? Because i backed up the wallet immediatly after downloading the program. So it hasnt ever synced until now. What are the steps to take for this process? I have googled so much that google just shows me the same stuff even when the questions are different.

Ahh, sweet! So i am on the right track then!! So i am just sweeping the private keys into an electrum generated wallet?

so how do I get the addresses to show transactions. They all show zero balance and zero transactions

So where do i go from here?

You should create a thread on a bitcoin forum like bitcointalk.org or the bitcoinbeginners subreddit. In that describe what you have found. For example do the private keys begin with 5, L or K? Do they have base58 or hexadecimal characters? Describe what you have without giving everything away. Don't share the private keys with anyone!
Figuring out what you have will take some back and forth so a forum thread is more suitable for it. Share the link to your thread here so we can contribute too.

You have to import the keys into electrum. To do that, download electrum on your PC, click on new wallet > import private key > click next and you should see all the coins.
You can do more research by using the bitcoin forum on reddit https://www.reddit.com/r/Bitcoin/

thanks, I will give that a try.


text:
Determining xprv from xpub and child private key
I'm confused by the wording in BIP0032:

One weakness that may not be immediately obvious, is that knowledge of
  a parent extended public key plus any non-hardened private key
  descending from it is equivalent to knowing the parent extended
  private key (and thus every private and public key descending from
  it). This means that extended public keys must be treated more
  carefully than regular public keys. It is also the reason for the
  existence of hardened keys, and why they are used for the account
  level in the tree. This way, a leak of account-specific (or below)
  private key never risks compromising the master or other accounts.

The default recommended wallet layout is m/0'/0/i.
So if I leak the xpub of m/0'/0 (which, in theory, my auditor has) and a private key in m/0'/0/14, then wouldn't all keys in m/0'/0/i be compromised? I understand that m/1' and m are safe but now you've lost an entire account when all that needed to be done was harden the index. What is the cause for this recommendation?

Does this answer your question? Derivation of parent private key from non-hardened child

This recommendation comes directly from one of security considerations from the same document:

Note however that the following properties does not exist:
  (...) Given a parent extended public key (Kpar,cpar) and a non-hardened child private key (ki), it is hard to find kpar.

The reason for this recommendation is the fact all the non-hardened key derivation bases on some of the elliptic curve properties. One of them is that you can add some number to private key (which itself is ordinary number). When you convert the same number to the point on elliptic curve you can add it to public key (which itself is the point on elliptic curve). This new private key is exactly the private key for the new public key.
The problem is that this number we add  (parse256(IL)) can be calculated from parent public key and parent private key.
So, if we know the child private key kchild and before mentioned number parse256(IL) (which we know, because we know parent public key), then we can rearrange the equation from which this key was derived:
kchild = parse256(IL) + kpar (mod n)
and find kpar which is the parent private key.

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


text:
Step by Step to Connect to ElectrumX via Nodejs
I am developing a simple app that will need to retrieve BTC wallet Address Balance and relative transactions
Initially I thought to use some existing APIs (btc.com, blockchain.com etc.), but the limitation in terms of request rates do not fit my project...
Looking at other options it seems that my best bet is:

Identify an ElectrumX public server
Request blockchain.scripthash.get_balance (via JSON RPC)
Request blockchain.scripthash.get_history (via JSON RPC)

now, I am not a techy person, but I like to learn and play around :) therefore I need to "translate the theory into practice"... where do I start? is there a step by step guide "for dummie" tutorial?
Thank you all


text:
Consequences of sibling keys when xpub and xprv are leaked
Let's say the following keys are leaked:

44'/60'/4'/0 extended private key
44'/60'/4'/0 extended public key (you can just derive this from the above private key)

Now using the above information can we derive the private or public key of this path:
44'/60'/4'/1
I don't think we can derive the private key because to get the private
or public key of 44'/60'/4'/1, we need to know the private key or
public key for the path 44'/60'/4'. But that's not something which
we can calculate from the above information. Is my understanding right ?

You have interpreted that correctly. If your child extended private key belonging to path m/44'/60'/4'/0 is leaked, the attacker cannot figure out the child extended private key from path m/44'/60'/4'/1.
The non-hardened derivation for child private key is kchild = kpar + hash(Kpar, cpar, i). Here k represents private key, K is the public key, c is the chain code and i is the index number. If you note, the index number sits inside the hash function in the child key derivation. Since hash functions are undeterministic, slight change in its input can have a very different effect on the output. Hence incrementing the index number i from 0 to 1 will yield completely different result and hence cannot be back-calculated.
However, do note that according to BIP 44 derivation, the index number after the account level denotes whether it is receiving or change. The child extended private key that has been leaked (index = 0) will act as a parent private key to derive all receiving addresses belonging to account 5. Thus all receiving addressees derived from the 5th accounts are compromised in your case.

Whey you say 5th account, do you mean 5th level ? If not, can you give an example for the same.

@Sibi BIP 44 key derivation has the path m / purpose' / coin_type' / account' / change / address_index. If you check the xprv you mentioned, you are using BIP 44, so purpose is 44'. coin_type is 60' so that is ETH. account is 4' so that is the 5th account. you can increment index at the account level and generate number of different accounts from which you can then generate receiving and change addresses. Users can use accounts to organize funds in same way as bank accounts; for donation purposes (where all addresses are considered public), for saving purposes, for common expenses etc.


text:
Pending transactions 0/3
I sent bitcoin from my blockchain to my paxful and it says pending in my paxful history 0/3 confirm. Please what happened. And the bitcoin has left my blockchain wallet and it only showing unconfirmed in paxful history

This means you have to wait until the transaction has 3 confirmations before you can use it on Paxful.  The time needed for each confirmation is random, but averages about 10 minutes.
By the time you read this, your transaction probably will have 3 confirmations.
If after several hours it still says 0/3, then go and read Why is my transaction not getting confirmed and what can I do about it?.  You may have set a transaction fee that was too low.

It is due to lower fees. You can delete it (replace by fees) and make another with more fees. It will confirm.quickly.


text:
Why do I get -4 error code from Bitcoin RPC
I'm directly dealing with Bitcoin RPC and my first step is loading wallet. At first I try to check listwallets to find the current wallet there. If not, trying to load wallet:
Post body = {"method":"loadwallet","params":["aaa34f5c59305e2a13d5438e0ce*****"],"id":"jsonrpc"}
Address = /wallet/aaa34f5c59305e2a13d5438e0ce*****

Sometimes as a result of loading request I get:
{"result":null,"error":{"code":-4,"message":"Wallet file verification failed: Error loading wallet aaa34f5c59305e2a13d5438e0ce*****. Duplicate -wallet filename specified."},"id":"jsonrpc"}

So, this results in error, but after some time (a couple of minutes) listwallets contains my wallet (aaa34f5c59305e2a13d5438e0ce*****). What did happen?
I also noticed that listwallets always contains 50 results. I didn't find in the documentation about this limit but it can be somehow related.


text:
Why does Bitcoin RPC load wallet too slowly?
I'm trying to load old wallet (which I have not been opening for months) and it takes too much time (~minutes). In this time seems like I can't do any further requests to RPC. After this new calls to this wallet takes milliseconds.
Is it true, that Bitcoin somehow synchronize old wallet with the current state of the network and that's why it takes so much time?

Is it true, that Bitcoin somehow synchronize old wallet with the current state of the network

Yes. If the wallet file is not synced with the current blockchain state, a rescan will occur starting from the block that is recorded in the wallet file. It does not rescan all of history, only the things that it has not yet seen.

and that's why it takes so much time?

Perhaps. There are other things that can effect wallet loading times. In particular, if you have a lot of keys and transactions, loading the wallet could take a long time too.


text:
Can I run 2 Bitcoin nodes with the same wallets?
We have a full Bitcoin node with its wallets on the server. The issue is that the majority of our wallets were synchronized long time ago. For us, it would seem that this synchronization task can take a significant amount of time in which the Bitcoin node will be unreachable for all other requests and our server will be unavailable for users.
We think about replicating the current Bitcoin node on the separate server and synchronize wallets there. After this process will be finished we will copy wallets back to the origin server.
Is it doable? Or we can't have the same wallets on two different Bitcoin nodes?

This is doable. You can run as many nodes with the same wallets as you want.
I imagine you want to do this because the synchronisation process will be faster on another node?
After the process is done, you will have to copy the complete blockchain data, not the wallet itself.
You might want to consider checking for what your bottleneck is - could be the hard disk or the CPU, or in some cases the internet bandwidth.

by complete blockchain data you mean full .bitcoin folder with wallets, blocks etc.?

during wallets synchronization, our bitcoin node stops to respond on any other requests (creating transactions, loading wallets balance...). So, I tend to think that the bottleneck here is the node itself. That's why would like to perform a sync on the separate server

I think the whole .bitcoin folder should suffice, yes. It's been a while since I've done that so I'm not 100% sure. If you do it correctly, you won't be prompted to rebuild the indexes. Have you checked the disk and CPU usage?

Yes, we did. During the process, one core of CPU is busy for 100%.

I'm not sure why there's only one core at 100%. All cores should be doing the work. Anyway, if the CPU is at 100%, that means the CPU is the bottleneck and you need a faster CPU for faster synchronization times.
You should also update to the newest bitcoind version and use more cache (memory) with -dbcache option. The default is 450 I think, you can bump that to 5000.

ok, I will keep investigating. thanks


text:
How do lightweight nodes and SPV wallets calculate balances?
Can they do it? Or they "talk" to a full node for that purpose and are used only for mining purposes?
Thanks in advance for your answers.

See BIP37: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki SPV nodes receive transactions from full nodes that match a filter pattern.

And how do they calculate balances? I read what you posted and I can't understand a word.

Possible duplicate of What is an SPV client?. See How is a wallet's balance computed. Answers to your other questions are: Yes, Yes, No.


text:
A question about transaction broadcasting and block creation
Let's say we have transaction X and transaction Y. The timestamp of X is chronologically earlier than that of Y. X's spender broadcasts X to the network and the same goes for Y's spender.
Let's say that miners receive Y first and they add it to the next block, which reaches the max number of stored transactions. Will X be included to the block after this one? Will it be discarded?
If X will be included to the block after this one, isn't it a problem that it happened before Y?
Thanks in advance for your answers!

A transaction itself doesn't have a storage structure for timestamp. So the transactions don't know when they're created. But, after bundling the transactions into a block and while solving the hash problem to solve the block, the miner inserts timestamp at the block level.
So, even if in reality chronologically earlier transaction comes later, it will be included into the next block if current block if full. Low fee transactions mostly experience this.
Imagine Alice is paying Bob
Alice puts a timelock on the transaction,

Time locks are a transaction level encumbrance. That is, the transaction is invalid and not propagated if it did not age past it's locktime.
But know that the UTXO the locktime transaction is spending(referencing) is free to be used. So, while Alice shows Bob that the transaction is under timelock, Alice can meanwhile spend the referenced UTXO and make that timelocked transaction invalid after it becomes ready to be propagated(past timelock) and Bob is scammed one could say.

Bob asks Alice to use CheckLockTimeVerify,

CLTV is a UTXO level encumbrance. So the transaction from Alice will go through as valid and a UTXO is added to Bob's UTXO set. That UTXO is spendable only after the time specified in UTXO has elapsed.
So if Bob wants to spend that UTXO, he has to create a transaction referencing that UTXO and have timelock value greater than or equal to CLTV value on UTXO.

This way, Alice has paid(sent UTXO) to Bob and Bob can be sure that he isn't going to get an invalid transaction.

If I undestend the your question, you referer to the lockTime inside the  transaction and not the block timestamp.
The lockTime is a int value, and this value rappresent "When the transaction can be unlockd to an inputs" and not "When the transaction was published"
Lock time: Defines the first instant in which the transaction is considered valid and can be transmitted on the Bitcoin network, represented by an integer value between 0 and 500 million, assuming different meanings based on the value assigned, that is:

Lock time = 0: the transaction is propagated and executed at the instant of
creation.
0 < LockTime <= 500: the value is interpreted as a block height, ie the
transaction will be valid only after the block with height
equal to the lock time value has been published.
Lock time> 500 million: the value is interpreted as a unix timestamp and
therefore the transaction will be valid only after the
date represented by the lock time value.

If you mean if the transaction has a timestamp, the answer is two:

Within the structure the transaction does not have a timestamp, but
rather a lock time.

The transaction could have an insertion moment in the block, which
depends on the block, because it is he who holds the timestamp as a
value.

A real use case:
  My transaction has a block timestamp equal to 8/23/2019, 2:08:43 PM GMT + 2, this represents the time in which the miner started the cryptographic challenge, and it is the instant in which the miner has also taken into consideration my transaction including it in the block.
My transaction has a lockTime of 0 because it is an immediate execution transaction.
No one excuses that my transaction before the block was published was ALSO inside some other block with a slightly different timestamp
If you want have turned a detailed explanation of what and how a transaction works, I recommend this reading on bitcoin book
Update from Bitcoin Dev
In the comment, Pieter Wuille in the comment below post the following answer and explain that my answer is wrong, and a very precise answer is reported below

The nLockTime of a transaction determines the earliest possible time
it can be included in a block. It is illegal to have a block which
includes a transaction whose locktime has not passed yet. There are
however mechanisms to forcing a transaction output to be only be
spendable with a future transaction which has a certain locktime - the
net effect being that this output can be included on chain, but
transactions spending it cannot until such time passes.

So transactions don't have a timestamp?

No, the block has the timestamp and it defines when the miner starts the cryptographic challenge

I thought the cryptographic challenge happened before the block was added and once it is done, the block is actually added.

The transactions are published in the block timestamp because all the data structure exists from the moment of publication and in the centuries to come :)

You got me confused. ( :P )

So a block can store a "future" transaction? that is mined but not actually calculated?

The block stores a "future" transaction, because neither the block nor the transaction are actually verified and published, that is the work of the miner, who creates a block with the new transactions inside, solves the cryptographic challenge and publishes the block, I have added a real example to my answer

is this a kind of a state? the blockchain saves the locktime block after block and reduces it to 0 and then executes it?

I don't understand, this "the blockchain saves the locktime block after block and reduces it to 0 and then "

I mean if the transaction is programmed to happen in 1/1/2030, will then every block include it until 1/1/2030?

The lock time can be seen as a state, yes, the status of the transaction in my example is immediate, ie "as soon as possible". but do not confuse the timestamp with the locktime, the timestamp only indicates the age of the block, like a date of birth.

@evannemo No, the transaction will only be published in the first available block, but can only be spent after 1/1/2030

All right! My question is, if two transactions are about to spent once they are published (locktime = 0), but Y is included on the current block and X on the next, even though X was broadcasted first to the network, doesn't this create problems?

What problems are you talking about? before answering, I would like to have an example of a complete use case

For example, The transaction Y could be spent before X, even though X was broadcasted first.

Absolutly yes, A transaction is not spent at the time of publication, but the newly published transaction spends a transaction already present on the blockchain called the comunemenete UTXO, I added an excellent reading to my answer, you will have answers to all your doubts

There are mistakes here. The nLockTime of a transaction determines the earliest possible time it can be included in a block. It is illegal to have a block which includes a transaction whose locktime has not passed yet. There are however mechanisms to forcing a transaction output to be only be spendable with a future transaction which has a certain locktime - the net effect being that this output can be included on chain, but transactions spending it cannot until such time passes.

Ops! All the information inside my answer are wrong, but I can not remember what I try to explaining here. Fortunately, My English evolved and I need to rewrite this answer, but before I need to make backtracking to find what I described here. For the moment I added an alert in the post, and again Thanks to ping me @PieterWuille.


text:
A question about Proof-of-Work(PoW)
I will describe my question using an example.
Let's say the network is working on adding block #100 to the blockchain. An attacker recreates block #99 with a combination of transactions that are "legit", meaning that they can be hashed to the same hash that the actual block #99 is using (and there is no double-spend).
Then, he broadcasts the block to the network. How does the network know that this block is fake and rejects it?
I think it has something to do with PoW, but I'm not 100% sure. Can someone explain to me the process of rejection with a detailed explanation?
Thanks in advance for any answers!

In your example, if block 99 actually did hash to the same exact value (infinitesimally unlikely), then there is nothing that distinguishes it from the actual block 99, so it would not be considered fake, and would not be propagated because it already exists in the inventory vector. The property of the hashing functions used to create the block hash would prevent this because without the same exact data, it will not result in the same block hash. See Digital Fingerprinting.
The block hash is created by creating a hash of all of the transactions (using a merkle tree), and hashing that along with the other meta data in the block header. Changing a transaction (even just the order of the transactions) will change the merkle root, and thus change the block hash. See https://en.bitcoin.it/wiki/Block_hashing_algorithm

The fact that it is infinitesimally unlikely, doesn't make it 100% unlikely to happen. If it happens, the blockchain will have two variations. How will wallets know which one is the correct in order to calculate balances?

the block would be ignored because another block with the same hash was already seen by the nodes. Updated my answer, see https://bitcoin.stackexchange.com/a/38385/60443

Just answer me this and you get the correct answer mark. If they have the same hash, how does the network know which one is the valid one? If the attacker runs a full node, he can make a copy of the blockchain which includes the spoofed #99 block. He can then make a website where others will download the blockchain copy and if the original block #99 and the spoofed #99 one have the same hashes, then the spoofed one will pass any validation checks if sent to other honest nodes. Am I wrong?

No, that is correct. As I mentioned, it is indistinguishable from the correct block unless that node has already seen a block with the same hash. But, as I mentioned, a SHA256 collision is basically impossible, and would not happen given billions and billions of years, so it is assumed that it will never happen.


text:
Question about Merkle trees and blocks
There is something I cannot understand about Merkle trees. I understand how they are calculated and etc., but I cannot understand how they are used on a blockchain. If a block stores only the Merkle root, how can a blockchain explorer let you search and view specific transactions? I think this requires that a block must store the whole array of transactions, not just the Merkle root. Please help me understand this. Thanks in advance.

The block header contains the merkle root, but the full block itself contains all the transactions, in order of their appearance as merkle leaves.

All right now I think I understand. Does that also mean that a light node saves the chain of the block headers and a full node saves the whole blocks?

@evannemo Yes that is correct. SPV nodes store the block headers of all the blocks which is how they can verify that a transaction is included in the block when they are provided with a Merkle path by connected full nodes.

@UgamKamat Can you explain this a little further? What is a merkle path? And how is this verification done? I have opened a new question, if you think you can explain it in details please have a look here: https://bitcoin.stackexchange.com/questions/89854/what-is-the-complete-process-and-purpose-of-a-block-validation-using-merkle-tree


text:
What will a miner do when a high-fee transaction comes but he has constructed his block and is solving the puzzle?
As far as I have known, the mining process is as follows,
step 1: collect a series of transactions and construct a block by filling required information like hash of the previous block and the Merkle tree root, etc.
step 2: solving a puzzle by constantly changing the 'nonce' field of the block to make the hash of the block header less than a target.
When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?

What work would he give up exactly?

The work to change the "nonce" of the current block

A modern mining system will do both.
Today, miners and mining pools have more hashpower than required to check all iterations of a nonce and extraNonce for a single block template. They get around this by consecutively operating on multiple block templates, usually varying on the block timestamp, data in the Coinbase transaction, and the list of selected transactions.
These updated block templates are constantly generated in parallel to the actual hashing operations - as more attractive transactions are discovered, the next set of block templates generated will be updated to contain those transactions. As soon as the mining hardware finishes with its current block template, it will grab a new, likely optimal template from the pool.
If a single worked discovers a valid block with a suboptimal template, miners will broadcast that block - there is little sense in discarding a block over a relatively small fee increase and giving up the entire block reward.

Perhaps importantly the cost of transmission for a solution is essentially zero.

When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?

Either that work produced a block or it did not. If it produced a block, he will definitely broadcast that block. If it did not produce a block, then he loses nothing by giving it up. So there's no "work he has done" that he might "give up".
Work that miners do either produces a block or it doesn't. There's no way to be part way to producing a block only to start over.

The block template is updated, (maybe) every a few seconds, updated with new transactions.

will the miner give up the work he has done

Every block with a hash satisfying the target is propagated. But if a block wasn't made, remember that mining is a Poisson Process, with the most important property being memoryless-ness. If a block takes 10 minutes on average to mine, and after 5 minutes of mining, changing the block template wouldn't reduce the time expected until the next block (hence "give up" is not the best word)

reconstruct the block and restart solving the puzzle?

Yes.

Let's consider this situation: before the high-fee transaction comes, a miner didn't update his block and kept changing the "nonce" of the same block, the space of the useless results he got is S. Now the high-fee transaction comes, the miner reconstructs the block and restarts solving the puzzle, what if the results he gets fall into S again? Doesn't it mean that the work he has done is wasted?

SHA256, like other good cryptographic hash functions, has avalanche effect, which means even one bit changed in the input will cause the output to be entirely different. The new hashes found will be entirely different as the Merkle hash of the transactions (or the hash of all TXIDs in the block) can also act as a nonce to change output hash. @Better

Computing a single hash takes time in the order of nanoseconds, and every attempt is independent. It's not because you've tried a billion failed hashes already that you're in any way "closer" to finding a solution. In other words: PoW is progress free, apart from the time it takes to compute a single hash, which is so short compared to the time scale at which transactions happen.


text:
What is the currently most efficient and reliable method to store the Bitcoin blockchain in a local database?
I have seen several posts on this before, and have tried all the suggested solutions, but I can't get any of them to work.
I am interested in analysing transactions with the OP_RETURN opcode for a project, and need to dump the entire Bitcoin in a database to start working on that. I have already installed Bitcoin Core and downloaded all data until today.
There is a list of tools available to do this, and I have had problems with all of them:

WebBTC: The files don't seem to be available
BitcoinDataBaseGenerator: This seems like the most promising solution, as it is easy to set up on Windows, and a MS SQL Server database is easy to use. However, after file blk005**.dat it crashed, saying that there are blocks with an unknown version. I also can't try to run it again because the queries to delete data from that file won't finish executing and timeout after ~2 hours. Looking at the issues at GitHub, people seem to be having problems with that too, as the repo is not maintained any more.
Blockparser + SQL: This only keeps the data in memory.
BitcoinABE: I have not tried this one yet. I read many issues that it is very slow though, and there are generally many open issues. Might work though, I will try later.
NBitcoin.Indexer: Made for Azure, I want to have a local database though.
Blockchain2Graph: This also seems promising, and it is under active development. It uses neo4j, which is fine. At the moment I have no preference for either SQL or graph databases. I set up a Debian Virtual Machine and followed all the steps, which did work. However, at the end I can't get the application to actually show up in the browser. From my understanding it uses RPC calls and not the blk*.dat files directly.

Then I found one more on Google:

Bitcoin-to-neo4j: This takes the block files directly and puts them in a neo4j database. The problem with this is that the database is apparently six times the size of the actual Bitcoin data. I don't have 1.7 Terabytes of free storage space available. It also mentions that it takes several weeks to process it all. I simply don't have the time to wait for that.

So, my question is if there are any other tools currently available to easily write the Bitcoin blk*.dat files to a local database. Maybe I did something wrong, with the above mentioned solutions, but none of them seem to be an ideal solution. How easy would it be to write a custom application that only extracts the data I'm interested in, and are there code templates for that?

The most efficient thing to do is design your tools to not need this sort of implementation. There are no open source tools which will be able to do this efficiently given to the sheer amount of data in the block chain (and the indexes that you'll no doubt be wanting). You're talking about interacting with billions of rows in a database, with a huge amount of cross relations that would have been to kept up to date as the data changes, it's a non-trivial engineering challenge that would need serious server hardware behind it to execute.

@Anonymous I agree, it's not a trivial task. However, all the tools above show that it is possible. Especially BitcoinDatabaseGenerator seems like a good solution, as that takes care of indexing and the resulting data is not larger than the original data. The problem is not the storage or processing power required to do this, as I would query only once for the results I want, not on demand. I might be successful if I modify that application a little, but it's weird that there is no easy solution to this.

The tools not working is a good demonstration that it isn't possible. If you're just interested in the small number of OP_RETURN outputs, why do you need complete indexing of the block chain? They're a vanishingly small portion of the total size.

For reference, it takes under a couple of minutes for me to read every block from disk and filter it for outputs which contain a OP_RETURN. Making less generalized tools is a powerful solution rather than throwing an entire engineering team at something unnecessary. You might be interested in bitcoin-iterate if you want to do the same.

@Anonymous I need to have some way of getting all transactions with OP_RETURN outputs, and the only way to do this is to go through the entire blockchain. If there are any datasets or maybe even APIs out there that do this, please point me in that direction. Of course it's overkill, but I don't see another way currently.

I linked a tool above which can filter the entire 300GB chain for OP_RETURN outputs in a couple of minutes, limited by your disk speed only.

@Anonymous Thank you, that seems like a good solution, I will check it out. I wasn't aware of any tools that can do this, which is why I made this post.

I want to add another idea, I worked on analysis of Bitcoin blockchain and I the result was that insert all information on database is inefficient but is possible. I have proposed the new solution for problem to analysis Bircoon blockchain. My idea is, convert the blk into json version and developer an Softwer for easy developed of different analysis Bitcoin blockchain into json version. I can implement an answer with more details

Thanks to @Anonymous who pointed out bitcoin-iterate, I think I have found a solution that will work for me.
This tool makes it very easy to extract all data you need in a custom format. All the tools that I listed in my original question had some pre-defined structure.
I decided on a preliminary data structure that I defined in JSON. I will probably remove some values later on when I realize that I don't need them.
{
  "blocks": [
    {
      "bLength": 0,
      "bVersion": 0,
      "bTimestamp": 0,
      "bTxCount": 0,
      "bHash": "",
      "bHeight": 0,
      "transactions": [
        {
          "tNumInBlock": 0,
          "tHash": "",
          "tVersion": 0,
          "tInputCount": 0,
          "tOutputCount": 0,
          "inputs": [
            {
              "iHash": "",
              "iIndex": 0,
              "iScriptLength": 0,
              "iScript": "",
              "iSeqValue": "",
              "iNumInTx": 0,
              "iUTXOBlockNum": 0,
              "iUTXOTxNum": 0
            }
          ],
          "outputs": [
            {
              "oAmount": 0,
              "oScriptLength": 0,
              "oScript": "",
              "oNumInTx": 0,
              "oUnspendable": 0
            }
          ]
        }
      ]
    }
  ]
}

When I have the entire data in that file, I will probably try to write that to a database, and a graph database such as neo4j seems like a good option to do that. However, I'm open for suggestions on that one.
To get the data in that format, I'm using the following bash command to run bitcoin-iterate:
./bitcoin-iterate --blockdir='path/to/blocks' \
--cache='path/to/cache' --quiet --progress='100' \
--block='{"bLength":%bl,"bVersion":%bv,"bTimestamp":%bs,"bTxCount":%bc,"bHash":"%bh","bHeight":%bN,"transactions":[]}' \
--transaction='{"tNumInBlock":%tN,"tHash":"%th","tVersion":%tv,"tInputCount":%ti,"tOutputCount":%to,"inputs":[],"outputs":[]}' \
--input='{"iHash":"%ih","iIndex":%ii,"iScriptLength":%il,"iScript":"%is","iSeqValue":"%iq","iNumInTx":%iN,"iUTXOBlockNum":%iB,"iUTXOTxNum":%iT}' \
--output='{"oAmount":%oa,"oScriptLength":%ol,"oScript":"%os","oNumInTx":%oN,"oUnspendable":oU}' \
| sudo tee path/to/output.txt >/dev/null

The problem with this is that each block, transaction, input, and output will output their formatted string in the order they arrive. This means that I can't nest the JSON, as there will be multiple transactions per block, and multiple I/O per transaction. To solve this, I will write a small helper script which takes the JSON file with a JSON object on each line and move the objects into the pre-defined arrays. I couldn't find a better solution to this yet, and I'm also open for suggestions on that one.

There are roughly two approaches as you've noticed:

process the block .dat files from running bitcoind
rpc to a node, pull blocks or headers, and batch process them in parallel

For speed, probably doing #1 is best, as BitcoinDataBaseGenerator does.  Unfortunately, as you've noted, it stopped being maintained in early 2017 and so does not support Segwit.  I think in practice, a lot of people do 2, as you can then rely upon external nodes maintained by others.
I have a working prototype using #2, but will not link it here, as it is missing some things.  I only mention this to say that I did not find it tremendously difficult to do so (the work I did was scattered over a period of time where I was busy with other things also).  I think probably the real challenge is trying to construct the right tables for whatever you need; the actual work to persist the blockchain data into say, a Postgres db, is fairly straightforward.  It did take me a week or so to persist the data, but this was using a small EC2 instance.
It is rather surprising solutions aren't more widely available, but in the end, understandable.  I do think everyone needs to tweak their databases a certain way and it's just easier to process the data yourself in a way you understand.
Having said that, the Cross-Chain Group has a working implementation that connects to an Electrum server and persists it into sqlite.  Looking through the code, I don't believe it would be difficult to change the persistence code to persist to another db.  They've done the hard work of processing the block headers and transactions.

You may use my blockchain parser. It convert dat files to a simple text stream (files), and it is more than easy to change the code for yours needs. For OP_RETURN opcode analysing you need to focus on "script" fields and do some tiny changes for to goal your result. I think that my answer would be helpful for you.
But if the question is really about the the most efficient and reliable method to store the Bitcoin blockchain in a local database for the opcode analysing that you want to proceed, so I think would be better to parse dat files uses parser into the some simple and lightweight form (not the all data from dat files) and then do what you need.

https://github.com/tenthirtyone/blocktools. this program will help you ,but it doesn't put data to the data base,you need to change it.


text:
Is it yet possible to send a message to the wallet which receives Bitcoin when making a transaction?
I wish to be able to do something like this:
bitcoin://anaddressgoeshere?message_to_wallet_owner=Keep+up+the+good+work,+dude!

After clicking that link, which opens the user's Bitcoin Core wallet, the user sees that message and can edit it freely, and then go through with the transaction. Now, the usual blockchain stuff happens, not storing that message in the blockchain. Considered "off far less importance" than the transaction, and to prevent abuse, this message flies around in the RAM of nodes on the Bitcoin network until I come back online and my wallet "receives"/sees the transaction, upon which point that message is fetched by my wallet and displayed to me in relation to the transaction, and then marked as "dropable" from the network.
That is, the blockchain does not store this message, and if I'm offline for longer than, let's say, a few weeks or so, I never receive the message. It doesn't "fly around" forever; it's merely a very useful extra feature for people who are online reasonably often, as I would be if I'm accepting donations/payments and want to know what exactly people are donating/paying for.
Having a "dynamic" website with a live database and dispensing unique receive addresses is simply not practical for a lot of people and situations. Even though I know how to do this technically, and have done it in the past, it's a major PITA as well as a massive headache of maintenance compared to a more "static" website which is generated as HTML files and uploaded in bursts. The latter is far more secure and thus desirable for me, and that's why this would be a great thing to me.
I assume that it doesn't exist, or if it does, it doesn't have support, but it would be really cool if it did.

There are networks built explicitly for the transport of private, textual messages, but the bitcoin network is most definitely not one of them. Send your bitcoin transactions on the bitcoin network, and your other data on a different network (eg TCP/IP, email, etc). What you have described here has severe DoS issues, as well as privacy issues.

No, it is not possible, and likely never will be possible.


text:
Python implementation for LND path finding algorithm
The most common Lightning nodes use GO, C or Scala for their implementation. Is there any publicly available Python implementation for the path finding algorithm any of the most known clients use (LND, C-Lightning, Eclair)?

These implementations use some form of the Dijkstra algorithm which is implemented in the open source networkx python lib https://networkx.github.io/documentation/stable/reference/algorithms/shortest_paths.html also electrum wallet is working on lightning. I think they followed pretty much the lnd code base so one could check their pathfing implementation at https://github.com/spesmilo/electrum/blob/master/electrum/lnrouter.py

Thank you for the great reply! The default networkX algorithms won't do because the Lightning algorithms require self defined and dynamic weights which is not supported by the library. The electrum routing is definitely helpful since the function lnrouter.py does exactly what I was looking for. However, Electrum is an entire client and it will be very tricky to isolate just the function that I want to use but it is definitely worth trying. Thanks again!


text:
Opening a wallet with bitcoind
I am running bitcoind after previously running bitcoin-qt. I made a wallet with bitcoin-qt (and encrypted it) and I would like to open it now with bitcoind. The folder that contains the wallet.dat file is in the data directory, but when I run either of the following:
bitcoin-cli listwallets
bitcoin-cli getwalletinfo

it does not show my wallet. I have tried:
bitcoind -wallet="directory with wallet.data file"

and still no luck, it just tried to rund bitcoind and says it is already running (not sure why, I am running bitcoind -daemon).
Any idea how I can import this wallet?

Have you tried bitcoin-cli loadwallet <wallet name> where <wallet name> is the name of your wallet (i.e. the name of the directory containing the wallet.dat file)?

Run RPC listwallets and check if your account is listed.
If not, run loadwallet with only account name:
(assuming directory on disk: /home/user/.bitcoin/wallets/accountname/wallet.dat)
Command: loadwallet accountname


text:
Blockchain save destination folder
I am going to activate a Bitcoin Core full node on my PC. Selecting a custom folder in which to save the blockchain, however, I get the error message:
"A fatal error occured. Bitcoin can no longer continue safely and will quit.".
The only button I can press is "OK", after which the Bitcoin Core application crashes / closes and restarting it, the same error appears again each time. Is it a bug or is it something wanted by the developers not to be able to change the save destination folder of the blockchain?
My OS is Ubuntu 18.04, my Bitcoin Core version is 0.19.0.1 (Snap).
Thank you.

Would help to share how exactly you are passing the custom folder details.

By starting Bitcoin Core for the first time, when it asks where I want to save the blockchain, I can check the box that corresponds to the default folder, or click below to choose it manually. I then type in the path I have chosen, which in my case is a folder created ad hoc in Home.
Giving the ok, here is the error and the only action I can do is press OK. After that Bitcoin Core closes on its own and when I try to restart it, the only thing that appears on the screen is the error message mentioned above.

Are you sure the user that runs the app has permissions to write there? Can you create the folder before starting the app and then choose it?

I have PC administrator permissions, also I personally created the folder in question in Home and its subfolders successfully before installing Bitcoin Core.

Can you include the contents of the debug.log file? It should be found in that folder. If not, check whether it is in the original datadir.


text:
How to write down an entire Bitcoin Core wallet through text
I have unclear ideas and I write because I would like some good soul to clear them up.
I'm looking for a way to be able to recover a wallet created with Bitcoin Core, having only a short sequence of characters, so that I can write it somewhere (therefore without necessarily having the wallet .dat file and relevant password).
Aware that Bitcoin Core doesn't support the famous random words (BIP-39, if I don't get it wrong), I tried with the HD seed.
So here's how I did it:

I did dumpwallet /path/Test.txt.
I have pinned down the private key marked "hdseed=1".
I closed the wallet and deleted it.
I created a new wallet: I tried both doing it "normal", and blank.
I gave sethdseed true "private key that I had pinned".

It didn't give me any error messages any time, I also gave another dumpwallet /path/walletname.txt and compared the two texts to see if they were the same and it seems to me so, or at least the PMK is identical.
Convinced that it was the right way, however, I tried to repeat the same procedure with a wallet in which I have some BTCs, but when I restored the wallet it remains without any Bitcoins inside.
What am I missing?
If a wallet on Bitcoin Core cannot be restored in any way through text, but only through his .dat file, what is the use of dump the HD seed, the Private MasterKey, the wallet.txt, etc.?
I am aware of all the risks associated with paper cold wallets, all of this is for educational purposes only.
The aim would be to find a way to export through a short text an entire Bitcoin Core wallet, not just the private key of a public key.
Thank you in advance!

Did you perform a rescan after using sethdseed? Depending on when your wallet was made and whether it is encrypted, there may be more than one hdseed or private key that you would have to backup in order to restore the entire wallet.

@AndrewChow I hadn't really thought about doing a rescanblockchain. Having some time this morning I tried to redo the whole procedure and wait for the rescan end and in fact everything works correctly. Thank you very much!!


text:
bitcoind and bitcoin-cli and bitcoin-qt
following the hackernoon for full node btc, https://hackernoon.com/a-complete-beginners-guide-to-installing-a-bitcoin-full-node-on-linux-2018-edition-cb8e384479ea
i have some small questions,
is there's any control for any service on that wallet ? the developers of it ? is that's the way the online exchanges and ledgers create our online wallets and their offline wallets or there's still a deeper way?
after making getnewaddress, how can i create/view its private key?
from the bitcoin-qt setting>encrypt wallet, what is it about exactly ? is that creating a password for the whole wallet to open it on other pc, or creates custom private key, or 12 words like blockchain.com?
if its just a password for the wallet on the pc or another pc usage
where can i get the private key for every getnewaddress?
also how can i create 12 words that can work on http://blockchain.com when i enter them ? or it cant be as long as this 12 not from blockchain.com directly ?
last and not least i didnt find any online documentation that includes all bitcoinq / bitcoin-cli command lines with their explanations and usage, do you have any link including that ?

Bitcoin Core is the name of the software you are referring to, and it is the software that runs Bitcoin. Computers that run Bitcoin Core are usually called nodes on the Bitcoin network. It is open source, and there are hundreds of developers around the world that have and are contributing to it over the last 10+ years.
The software can be run by anyone, and so the wallet that is included with the software must be secured by you. Online exchanges may or may not use Bitcoin Core, but likely have their own wallet implementation. You do not need to run your own node to transact in bitcoin, the wallet software will submit transactions to a node, however.
To create and view a private key for an address in bitcoin core, use:
$ bitcoin-cli getnewaddress
<your new address>

$ bitcoin-cli dumpprivkey <your new address>
<your private key in WIF format>

Encrypting your wallet just makes it so if someone opens your Bitcoin node, they must have your password in order to be able to spend your bitcoin. It is highly recommended to do so. This password is unrelated to the private keys for your bitcoin addresses. The 12 word mnemonics you are referring to is not implemented in Bitcoin Core, and not generally recommended.
Docs for the RPC commands can be found here: https://bitcoincore.org/en/doc/0.18.0/

thank you very much, so based on this that means the bitcoin core is the best/safest retail wallet? that even if the developers stopped supporting it or their code got hacked my addresses and pvt keys are not on any database and still secure until i am hacked personally ? also, if i created btc address through it and turned off the machine i created through it forever, does that make it a offline wallet until i use the pvt key on any online wallet to use my coins ? thanks in advance <3

It is not the only wallet that lets you control your own keys, but yes in that way it can be more secure if you understand how to secure your keys. If you have no connection to the internet, it would be an "offline" wallet.

but likely have their own wallet implementation.
this was also one of the points i mean, to have the whole thing owned by me to meet the maximum security
do you know any source which explains how to generate btc address with pvt key from the scratch without using helping softwares like bitcoincore or whatever

https://medium.com/coinmonks/how-to-generate-a-bitcoin-address-step-by-step-9d7fcbf1ad0b

thank you very much, last thing.
do you think it will really work if i turn of the internet before making
getnewaddress will it really give something real?
then also getting the private key while the internet is offline?
because for example, bitaddress provides fake address and pvt key if used it offline when it fail sending the pvt key to the website owner database, what's your opinion in bitcoincore case do you think it will work offline ? if so will the info be real 100% and valid, or may find out i got fuc**d up after trying to use the address in years to get the btc i sent to it ?

as i wish to keep it offline even before the first use, or better to create the getnewaddress and its private key while connected to the internet?
also if its fine to do it offline when the address is generated offline and never seen the internet, how the blockchain will locate it when i send funds to it while it never been online before? also how can later when i try to open the address from any service how does it know that the private key i wrote is the real private key of the address? ain't that strange if there's no big database online for the addresses and private keys?

The Bitcoin Core wallet does not need internet to generate private keys or addresses, it also does not share the keys with any other software (provided you are running a verified build that hasn't been tampered with). Don't trust, verify.


text:
bitcoin-cli getnewaddress
can i customize my address start through getnewaddress?
for example instead the address start with 1asdjIOAWJRA
i write getnewaddress 1xxxx then it continues as it wish
also what's the difference between addresses starting with 1 and addresses starting with 3?
can i choose from bitcoin-cli to get my address starting with 1 or it must be random and can be started by 3 while i dont wish that?
the reason of the need to customized addresses to make sure that it really creates this offline addresses instantly and is not in a hidden database installed while installing the bitcoin-cli

That is called a vanity address, and Bitcoin Core does not support generating vanity addresses. In order to do that, you would have to find a vanity address generator (separate piece of software). But then, you have to audit the code to make sure it is not doing anything funny with your private key. Bitcoin Core is open source, so you can audit the code that generates the keys if you want.
The address prefix denotes the type of script the address encodes. A bitcoin address that starts with a 1 is a Pay-to-Pubkey-Hash address, and a 3 is a Pay-to-Script-Hash. See Address Prefixes
You can change the type of address the cli generates by passing an optional argument to getnewaddress see RPC Docs - getnewaddress:
bitcoin-cli getnewaddress "label" "address_type"

address_type options are "legacy", "p2sh-segwit", and "bech32"

if my address starts with 1 is it preferred to send transactions to addresses starts with 1 also ?
as both are different in some way may face any issues in the future sending 1 to 3 or from 3 to 1? that make coins get lost

can you also check that for vanity for btccore? https://bitcointalk.org/index.php?topic=1387.0

It doesn't matter which address you send to and from as long as the wallet software knows how to spend it. Bitcoin Core wallet can spend from any address it generates. I don't understand your second comment.

the second comment is a guy who created customized address through 'getnewaddress' the link from his bitcointalk.org  post

sorry I can't comment on that, i don't see the attachment, but the thread looks pretty old

can i customize my address start through getnewaddress?

No, getnewaddress will return a new address each time, and the address string will be random. To create an address that begins with a specific string of characters, you will need to use some software to iterate through many random addresses, before an address with your desired string is found. This type of address is called a ‘vanity address’. If you search for that term you will find more info.

also what's the difference between addresses starting with 1 and addresses starting with 3?

An address starting with a 1 is a ‘pay to public key hash’ (P2PKH) address, whereas an address starting with a 3 is a ‘pay to script hash’ (P2SH) address. If you search for those two terms, you’ll find lots of additional info on this site about the differences between the two.

the reason of the need to customized addresses to make sure that it really creates this offline addresses instantly and is not in a hidden database installed while installing the bitcoin-cli

If you build bitcoin-core from source, then you can audit the code yourself ensure that no pre-derived/hardcoded addresses are being presented to you. Alternatively, you can trust the open-source process that involves countless developers that have audited the code to ensure no backdoors like this exist.
But if you really must verify the legitimacy of the presented addresses in this way, you’ll need to write a program to generate new addresses repeatedly, and then check the returned address to see if it matches your desired string. You may be able to find a ‘vanitygen’ style of software that can do this more efficiently, which is desirable for finding longer specific strings. Each additional specific character you desire will make the search 58x more difficult (since the address format is in base 58).

I have written a program in Python3 that allows you to search for any address on bitcoin core whether it belongs to your wallet or not.
Here is the github link:
https://github.com/ORP967/Bitcoin_Core_RPC_par_address
Let me know what you think or if you have any improvements you might have.


text:
reorg a bitcoin transaction
does anyone here have btc reorg full concept documentation that can be seen online?
also i wonder if a specific block can be reorged?
or all the blocks thats after the transaction must be reorged?
for example the guy who lost 8,999 BTC in 2011.
can the miners help him now to reorg his block to get it back?
or they have to re-un-mining all the blocks they did between 2019 and 2011 to do that successfully ?

A blockchain is a chain.
Each block is a link in this chain, that depends on the previous link (block) by definition.
If to change block N, all blocks from N until now must be mined again as well.
Moreover, if you want to alter a specific transaction, you are limited to only removing it if you do not hold the key(s) used to sign the transaction. If you wish to perform an alteration that changes where the BTC is sent, you must not only mine the entire section of the chain again, but also hold the private key(s) involved in that transaction to produce an alternative, valid tx.

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


text:
Wallet recovery history
My Blockchain Wallet Has Been Hacked By Recovery Words.and my wallet id changed
How Can I Get Access To My Wallet Recovery History?

Blockchain.com wallet?

You can't. Most if not all wallet software don't keep logs as to who accesses recovery seeds or mnemonic phrases. (as would be stupid if not impossible)
(I'm assuming you're talking about Electrum here?)
The most you can do is see where your funds went using a third-party tool such as Walletexplorer
If you're lucky and he sent them to a regulated exchange, (coinbase et al), you can file a police report and they'll probably someday hand over the KYC data + IP adresses.
Don't get your hopes up though, your funds are gone.

If you are reffering to the non-custodial wallet blockchain.com, you could attempt to login with those same recovery words (since the user-id/wallet-id login was compromised), and potentially acess a log of IP addresses that have logged into the service, and which could offer a clue (although perhaps not meaningful if the hacker used a VPN or other IP masking).


text:
When changing transaction data in a block change the hash of previous block?
If i only manually change the data on the block without touching/modifing the already calculated hash, then hash on the block its still valid because its already saved and was not touched ... so,
When the blockchain revalidate the hash with the content of the block? ...
In every paper that i read i see that all the security and inmutability of the blockchain its based on the already calculated hash, so, its like its easy to change data without touching hash so block still be valid in all the merkle tree and chain... how this modification its protected?

When a new block is received by a node, it is validated. This validation includes verifying the validity of each individual transaction, constructing the merkle tree and the merkle root, verifying the merkle root against the block header, verifying the PoW in the block header, and finally verifying the hash itself.
After this validation is completed, the block is saved into the node's local chain database.
If you were to go and modify the stored data, it would have little effect - no other nodes will see your modified data, and all you will achieve is a broken local state if you run a reindex or reindex-chainstate.

Thanks for your answer, so, if this change go viral on many nodes (more than 51%) then wallet balances can be affected until a reindex its executed on all affected nodes? (i know that in bitcoin its almos imposible, but think in a private blockchain fork, that its my concern)

If the data is modified on any N nodes, it will not affect their wallets, as wallet txs are indexed and stored separately. If you modify the wallet data, future transactions might fail with invalid inputs, or result in absurd fees/change values, but would be pretty easy to catch for someone paying attention. As soon as a node realizes its data is bad, it will simply download the correct data again


text:
Hash pointers: Are hashes of data used as addresses?
I am wondering how hash pointers are implemented in reality. Currently, I am reading this article about hash pointers. According to this website a hash pointer allows both to request data and to verify its integrity. The following picture is supposed to illustrate the basic structure of a blockchain
Obviously, the input of the hash function is the pointer to some data in memory. At the same time the hash is supposed to be the hash of the stored data. How is this possible? I can't imagine to interpret hashes of data as addresses.

I'm not sure you are asking the exact same thing, but I think this question is close: https://bitcoin.stackexchange.com/questions/44213/hash-versus-hash-pointer

I've already read this question, but unfortunately it does not answer my question. There is no hint how pointers, hashes and data correlate. How can the hash of arbitrary data used as pointers?

Obviously, the input of the hash function is the pointer to some data
  in memory.

No.
Each block consists of header (80 bytes) and body (transactions).
Hash function hashes 80 bytes input giving 32 bytes output.
The input of the hash function of block N is the entire header of block N-1 (80 bytes). These 80 bytes are hashed and the resulting hash (of size 32 bytes) is stored in the block N header (filling the part of its 80bytes).
The hash of N-1 header in block N header proves (provides integrity) the position of block N: that it comes behind block N-1 in the blockchain.

Note there is another hashing process happening in each block, hashing of block's transactions producing so called Merkle root that is also placed in the header and provides integrity of block's transactions.

The hashes are not of addresses, they are of blocks. The "hash pointers" (in the blockchain, those are just hashes written into the header of a block, it doesn't actually point to anything) are the hash of the block that precedes the block that the hash is in.

The term "pointer" may not be the best in this case, since people tend to think that means "pointer to memory address".  It does not.  Here, the term "pointer" is being used in the data structure sense, not the variable primitive.
A better term might be key, such as a unique identifier in a database.  That actually is what is meant when people refer to a hash pointer.  The hash is an identifier that can be used to uniquely select a transaction in a database.

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


text:
how do you stop scammers
just wondering if you can stop scams

If you were talking about Fake Bitcoin Transactions, The best way to avoid any type of that is Waiting at least for 6 confirmations
I've read many articles about that, and the final answer is waiting for six bitcoin network confirmations.
You can read more about irreversible_Transactions.


text:
Lost usb with wallet backups
I was hoping someone would be able to help please?!!
I backed up my litecoin core wallet and neo wallet to my usb- today i took that usb out with me since I had other stuff on it too and needed to use it. I lost the usb like an idiot- is there a way to change the seed for my neo wallet and address for litecoin wallet so if someone finds my usb, they can't get into the wallets. I know I have backed them up on the USB but I am not sure what other info I have left on there.
I know I am an idiot- please help this idiot!!

If someone finds your USB and it has a full backup, they’ll be able to recreate your current wallets and steal all the funds. If you still have a working instance of those wallets, then you should immediately transfer all funds out of them and into new wallets. Do not use the original wallets to store funds ever again, create a brand new wallet (ie new seed) and use that from now on.
Be careful with your backups, if someone stole your coins you would likely have no recourse at this point.

Right, so what I have done is created new wallets and seeds for neon and on the litecoin core wallet I encrypted it and I got a message saying something like one previous backups will cease to work? is that right?

@Polyscript unless encryption involves your wallet sending a tx to move all coins to a new address, I don’t think it would be sufficient (I am unsure of exactly how litecoin core works in this regard). In general, I would just create a new wallet and transfer your coins to it. Then you will for sure be safe against someone finding the USB

The simplest way would be to simply create a new wallet for each, and transfer your coins to it. The seed is easy to change, but anyone with the old seed can still access the old wallets, so you should cease to use them immediately.
Ideally, don't keep backups on a drive you carry regularly with you. Instead, either store them on paper or a USB that you can safely lock away. Even better, get a hardware wallet.

Right, so what I have done is created new wallets and seeds for neon and on the litecoin core wallet I encrypted it and I got a message saying something like one previous backups will cease to work? is that right?

Yes, naturally. If you recreate the wallets, they have no relation to any previous back up you made, since the keys have changed.


text:
Have I lost my ripple
I was hoping someone could help me please?
I used to have a desktop wallet for XRP which I just found out had been deleted and that’s where my coins were.
Is there anyway to access those coins again?- I am unable to download that desktop wallet since I cannot find it- id really appreciate any help.


text:
Incorrect Network
I was hoping someone could help with a transaction please.
I sent BTC to my binance account via my ledger. I think I used BTC segwit to send but sent it to the BTC address on binance- I was not aware there was a BTC segwit address on binance when sending.
Will I still receive the BTC in my binance account as the BTC address was still connected to my binance account?
Many Thanks

There's distinction of "bitcoin" and "bitcoin segwit". It's just Bitcoin.

Does that mean the bitcoin will arrive? its been over an hour- so I sent it on BTC segwit but to a BTC address.

Yes. They're identical and still processed the same. You can use a tool like https://mempoo.space to estimate confirmation time.

You're a star- thought i'd lost my BTC. Guess I have to wait a while due to using a low fee. Cheers mate.

You're welcome. I can't edit my comment, but I meant mempool.space as the tool to use to check confirmation time. best of luck.

Hey sorry to bug you again- if you get this notification could you please take a look at my transaction to see how long it should take. Its been there over 12 hours now.
5c119ce4b0bce440c16b2ad48e720c22422454118bf15ece0602904349d0b568


text:
Could a computer virus made less than a mb, which is sent as transaction that attacks miners?
What happens if computer virus less than a mb is sent as transaction that attacks miners?

The transaction would likely not be relayed. Even though a block could theoretically contain such a transaction, nodes would not relay such a large transaction. There is a transaction relay policy where nodes will refuse to accept and relay a transaction that is larger than 100 kb. Furthermore, depending on how this virus is encoded in the transaction, it may be marked as being non standard and thus not be relayed either. It could also be considered invalid if not constructed correctly.
But of course, given that we are talking about malware, it could, in theory, exploit some code path before these checks occur. Even if your transaction meets all validity and standardness rules, it would still have to do something that exploits some vulnerability that allows malicious code to be injected and executed. Such vulnerabilities are known as Remote Code Execution vulnerabilities and are rare and difficult to find. It is extremely unlikely that existing node software have RCEs that can be exploited via an incoming transaction, but not impossible.
If a RCE could be found and a transaction crafted that is able to exploit it, then what happens next depends entirely on the malware being executed. It would then be able to do other things similar to what other malware can do. From there, it all depends on what the attacker wants to do and has written the malware to do.
Of course such a virus would also infect other nodes on the network. It is further possible that nodes relay this malicious transaction. Or at least, they would likely also receive it in a block and potentially get the virus from block relay. So in the end, it could result in the entire network having this malware.


text:
possible victim of non-spendable scam
A bitcoin trader opened a blockchain wallet for me and then sent me my profit but it is non-spendable. I know they can no longer get into my account because I changed the password and I have two-step verification. And I don't see them created passphrase, that means no private key was stolen?
Can they still access to my wallet?
I'm the simlar situation as below thread, but how do I know private key was taken?
Non-spend Blockchain.com
How to unlock private key of bitcoin

Possible duplicate of https://bitcoin.stackexchange.com/q/88910/5406

Yea they can still access your wallet.
When the scammer created the wallet, they will have written down the mnemonic seed phrase for the wallet. With this seed phrase, they can recreate your wallet using some other software, since the seed phrase will allow them to derive all of the same addresses. They do not need the password to do this, and changing the password will not stop them either.
Think of it like this: you have a secret (the seed phrase) hidden in a box, and your password is the lock on the box that protects that secret. If the scammer steals the secret before you lock the box, they won’t need your password. They already have the secret!
So, the best thing to do is just never use that wallet (or seed phrase) again, and stop talking with the scammer.

There is no point in them accessing your wallet. The wallet doesn't hold the key needed to transfer the bitcoin anyway -- that's why they show as non-spendable. They didn't send you any profit, they sent profit to their own account and showed it to you. Let's walk through what you said:

A bitcoin trader opened a blockchain wallet for me and then sent me my profit but it is non-spendable.

So it's not your wallet. They opened it. It's their wallet. They configured it so it could see the profits they transferred but not transfer them. That's why they show as non-spendable.

I know they can no longer get into my account because I changed the password and I have two-step verification.

You don't have an account. You never created one. You locked a wallet, but there's nothing in that wallet. They never put anything into that wallet except to allow it to watch their account.

And I don't see them created passphrase, that means no private key was stolen?

No private key was stolen because they hold the private key and never put it anywhere you could get it. They hold the private key and then they created a wallet for you that did not contain that private key.

Can they still access to my wallet?

No, but so what? The wallet doesn't have the private key anyway.

I'm the simlar situation as below thread, but how do I know private key was taken?

It wasn't. You never had a private key. That's why the funds show as non-spendable. You do not have and did not ever have the private key.

As far as I understand these scams, the scammer will ask the victim to send money to the wallet in order to ‘unlock the private key of the non-spendable’ funds. If the scammer set the wallet up, they could be running scripts to insta-empty any funds sent to any address the wallet does have a key for. So while what you wrote about the victim not having the key for the non-spendable funds is true, I don’t think you should downplay the risk of the attacker having the privkeys that the wallet does control. The wallet should definitely be abandoned.

In this case, they don't need any scripts to do anything. The funds are sitting in an address 100% owned and controlled by the scammer. The scammer will show the mark funds at that address, convincing the mark those funds are theirs but "locked" until the mark sends more funds.


text:
Perfect option scammed
I have been scammed from the platform Perfect Option.
Does anyone else have any dealings with them?
I am interested to find out further information

They're an obvious scam. I mean, absurdly obvious.
I'm really baffled how anyone could fall for something like this. If someone had a way to reliably invest $10,000 and turn it into $120,000 in a month, what would they want your money for?
At that rate, $10,000 would become over $800 quadrillion dollars in just a year, 2,400 times the amount of money that there is in the entire world! Why would they bother setting up a web site and dealing with customers?
Investing always involves a risk/reward trade-off. If there was some way to get large rewards without taking large risks, everyone would do that and be rich. But that's obviously impossible -- there is no economic engine with that capacity. The planet would be entirely owned by every random person with $10,000 to invest in less than year. Where would all those planets full of yachts and mansions come from?
So such a low risk, high reward system doesn't exist. It can't exist. It is so many orders of magnitude outside of the bounds of what is even conceivable, much less possible.
There are a lot of copy/paste scam websites like this. They all have the same red flags all over them. Untraceable testimonials, bad English, no identifiable people in their management, and paragraphs of meaningless mumbo-jumbo.
But most importantly, there is no way anyone could tell what level of risk they would be taking even if the offer was legitimate. Of course, it can't be legitimate, because it doesn't tell you what risks you are taking. Anyone who understood what investment was should be able to immediately tell this is not a legitimate investment because the risks are not clearly disclosed.
If this were possible, nobody would ever have to live in debt. Just borrow $10,000 and next month you have $120,000. You could pay back the $10,000 loan, pay off $100,000 in debt, and have leftover to live off for the next month. Of course, nobody would be in debt -- why would anyone lend anyone $10,000 if they could invest it and have $120,000 in a month? Why would mortgages exist?
Seriously, I have to slap my forehead that people could think this is legitimate. I don't mean to be mean, but geez.


text:
How a transaction is permanently accepted by the blockchain?
If a miner A creates a block containing a transaction A and a miner B creates a block NOT containing the transaction A about at the same time, then some of the other miners will first receive the block of the miner A and the others will receive the block of the miner B. (Fork)
If the chain of the miner B grows faster than the chain of the miner A, then the transaction A will never be accepted (like it never happened). So, how the user A who created the transaction A can be sure that the transaction A was accepted/verified by the blockchain?
Also, is there a possibility that the transaction A is verified by the blockchain at some point and then in the future another subchain (from a previous fork) not containing the transaction A will grow faster, thus rejecting transaction A ?
Are there any time checkpoints created that all the miners should agree upon ?

If the chain of the miner B grows faster than the chain of the miner A, then the transaction A will never be accepted (like it never happened).

The transaction A is still unconfirmed in the mempool for any nodes following the best chain building on miner B's block. Any subsequent block is free to include it. The best chain has only one block at each height. Any competing blocks that don't end being part of the best chain are irrelevant for the network's state. So, if the block mined by miner A ends up being in the best chain, transaction A gets confirmed in A's block. If the block mined by miner B ends up being in the best chain, transaction A is free to get mined in the subsequent blocks following the block mined by B.
Confirmation of transaction is always probabilistic. Theoretically, an arbitrary long part of the chaintip could be reorganized to a better chain. It's just increasingly unlikely the longer the tip is. Many users consider transactions with six confirmations to be reliably confirmed. For smaller amounts, they may even trust fewer confirmations, larger amounts may cause the recipient to wait longer.