text:
Problem with Bitcoin Core’s regression test mode
I have started bitcoin daemon with -regtest flag. The output was

Bitcoin server starting

But, when I run
bitcoin-cli -regtest generate 101

command, it shows

error: couldn't connect to server: unknown (code -1) (make sure server
  is running and you are connecting to the correct RPC port)

How this happens?

Try changing port number in bitcoin.conf.
open file
nano ~/.bitcoin/bitcoin.conf

add new line

rpcport=18332;

save the file and restart bitcoind

This is only the regtest RPC port then?

This will effect all instances of bitcoind that are started, regardless of network.

@Willtech I think it is

Adding rpcport=18332 temporarily solve your problem. If you want to run mainnet or testnet at the same time when regtest is running, you wont be able to use them, it is because when you assign rpcport=xyz all  bitcoin instances will try to interact through same rpcport when daemon is started but at one time only single daemon can access single port number.But in your case all three daemons tries to take rpcport as 18332.
Infact what you can do is, try to get connected to default rpc port for regtest by typing command:

bitcoind -regtest -daemon -rpcport=18443

Mainnet:8332
Testnet:18332
Regtest:18443`

Note:For bitcore v15 rpc port is same for testnet and mainnet where as in v16 rpc port is diffrent for all of them

From their docs, for testnet&regtest port is same. ie.18832. Is there a different port for regtest?!

@Prayagk   For bitcore v15 rpc port is same for testnet and mainnet where as in v16 rpc port is diffrent for all of them

ok..that's new for me

you can see which version you using with command getinfo


text:
CPFP: Child Pays For Parent Clarification Needed
With the Child Pays for Parent (CPFP) Do I sent more bitcoin to the SAME address the stuck transaction was sent to? The second transaction (with fees high enough to cover both transactions) will push the first transaction through? Or will they both get stuck? Or will the latter bypass the lesser?
For example.
1- I sent 5 BTC to address flsdjlfksdjfli3w320r89we2182eq78e9r7239
and it gets stuck
2 - so I sent ANOTHER transaction to flsdjlfksdjfli3w320r89we2182eq78e9r723 (+ fees for both transactions),
3 - and then both transactions go through?
Thanks in advance for the answers.

No, it's not a matter of sending to the same address multiple times, rather, CPFP works by spending the output of a previous transaction in a second transaction with a higher fee.
Example:
An unconfirmed transaction A with 500B size paid 20000 satoshis fee which corresponds to a fee rate of 40 satoshis per byte. The transaction has two outputs:

A:0 is signing over funds to the recipient
A:1 is signing the remainder back over to the sender

Let's say that the transaction is stuck because it would have needed a fee rate of 100 satoshis per byte to get selected into a block.
As the sender, you now create a second transaction B that uses the unconfirmed transaction A's change output A:1 as one of its inputs. Let's say that this second transaction B has 250B. To pay a fee rate of 100 sat/B for the second transaction, you'd specify a fee of 25,000 satoshis. But you also wanted to speed up the unconfirmed parent transaction! To do so, you add another 30000 satoshis, which brings the child transaction's fee up to 55000 satoshis.
This leaves the parent transaction A with a fee rate of 40 satoshis/byte, and the child transaction B with a fee rate of 220 satoshis/byte, but the two transactions in sum with 75,000 satoshis for 750 bytes of transactions, or a fee rate of 100 satoshis per byte. In order to get the juicy fee from the child transaction B, a miner has to also confirm transaction A as B is invalid if A is unconfirmed. They are thusly incentivized to include both A and B by the child paying for the parent.
Note that the recipient has the same option by creating an analogous CPFP transaction via spending A:0. (H/T Thalis K. for pointing this out in the comments)

Thank you. How do you choose the send address on an exchange?

@Shes2smart: As far as I know all exchanges take custody of your funds, so you cannot.

Worth noting, that a CPFP transaction can by created either by recipient of funds i.e. recipient of A:0 in the example above, or by the spender (initial sender) if the transaction has change which would be A:1 in the example above.

@ThalisK.: Thanks, I've added a comment to point this out.

source: Stack Exchange

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

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

sort: votes


text:
How to create an omnilayer transaction by myself?
As far as I understand from reading a specification and this blogpost, creating Omnilayer transactions is a rather tough thing to do yourself, because format is quite intricate. Are there any examples on how to create and decode omni transactions in javascript/python? Or maybe there is even some lightweight library for this?
What I'm trying to do is to send my custom omni transactions to blockchain.info testnet and later discover them by another app. That's why I need to be able to both create and decode them. However I couldn't find any helpful resources on how to accomplish this.

A was able to do that. I posted a small snippet:
https://gist.github.com/caffeinum/f64a51ce55d5ac9075bb2f5f2f439c0d
If you're familiar with bitcoinjs-lib, the omni-specific piece of code for tx creation:
  const simple_send = [
    "6f6d6e69", // omni
    "0000",     // version
    "00000000001f", // 31 for Tether
    "000000003B9ACA00" // amount = 10 * 100 000 000 in HEX
  ].join('')

  const data = Buffer.from(simple_send, "hex")

  const omniOutput = bitcoin.script.compile([
    bitcoin.opcodes.OP_RETURN,
    // payload for OMNI PROTOCOL:
    data
  ])

  tx.addOutput(recipient_address, fundValue) // should be first!
  tx.addOutput(omniOutput, 0)

  tx.addOutput(alice_address, skipValue)

If you're insterested in working towards publishing small library, feel free to tap me at https://bykhun.com

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


text:
Atlcoin: Peers don't sync after one creating new block
I have made an altcoin flowing these steps:
1. Generate genesis block and modify in source code
genesis = CreateGenesisBlock(1525404232, 5226643, 0x1e0ffff0, 1, 50 * COIN);
    consensus.hashGenesisBlock = genesis.GetHash();
    assert(consensus.hashGenesisBlock == uint256S("35bd3f056789cdf9b03bda2da62b3051387a91af784314966c6b303e33ec0f0b"));
    assert(genesis.hashMerkleRoot == uint256S("52b2455696516c14fde6fb8bf13891f34a49b339b99aa863942e5cd54db71fc1"));

Remove checkpoints
checkpointData = {
        {
            { 0 , uint256S("0x35bd3f056789cdf9b03bda2da62b3051387a91af784314966c6b303e33ec0f0b")}
        }
    };

Now, I run this code in two machines (two nodes) and make them connect to each other with command "addnode ".
After that, I start mining in the first node
generatetoaddress 1 <address>

After first node create block 1, I check the chain info of the second node
getblockcount

and it return 0. Any suggestion for me to solve this problems?

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


text:
How to run multiple node in same machine?
I have created an altcoin base on litecoin source code. I want to test it in multiple node to test peers of each node weather each node can connect to each other. So I try to run "mycoind" in multiple but it not work. Any way for me to run multiple node in same ubuntu machine?

can you provide the last few lines of debug.log and config files?

My config file:
rpcuser=dogerpc
rpcpassword=DLKKWE93203909238dkkKKeowxmIOw0232lsakwL02k
rpcport=8334
rpcallowip=192.168.1.*
rpcallowip=127.0.0.1
server=1
daemon=1
listen=1
testnet=0

Try to use -datadir with mycoind and specify that node's data directory address there.Remember each peer needs different port and rpcport, so for example :
 mycoind -port=<port> -rpcport=<rpcport> -datadir=/home/user/.mycoind2(or whatever) -(other parameteres)

I you want to add node just simply use "-addnode=127.0.0.1:" along mycoind command.

It is definitely a combination of all of the above answers.

Ports should be different for every node
From my testing in the past there can only be 1 server=1 when running the same nodes for the same altcoin.
Specifying a -datadir on each node is required because if not it will on look in the default location.
Each Node should be different ports and datadirs, if it's the same altcoin then there should only be one node with server=1.

I hope this helps.

Your problem here is nodes are trying to use the same port Accept connections from outside.
You have to change the default port or disable listening.
-port=<port>    Listen for connections on <port> (default: 8333 or testnet: 18333)

or
-listen Accept connections from outside (default: 1 if no -proxy or -connect/-noconnect)

If you want to add another peer just simply add "-addnode:127.0.0.1:" to mycoind command.


text:
How is blockchain not responsible for someone stealing my Bitcoin?
I'm new so please forgive me if I'm just not getting this. I have done nothing wrong. I did all the 2fa all recovery phrase I was told to do. I wake up to see 1200 dollars in crypto just gone from my account. It's weird the moment I set my recovery phrase was when my money disappeared. Blockchain hasn't said anything but oh well this is what happens. So I do all the things I'm supposed to and I lose money that I don't have with noone to help me get it back? I mean if I have to send in all my identity documents doesn't everyone? I see where it was sent cause it's public and NOONE can tell this thief that they need to give my funds back? I'm not well and my husband isn't well at all. We received this money as  payment for work my husband done on a house we been waiting for and it's just gone and nobody can tell me anything. I didn't get an approval from blockchain for entering my account no sms verification code sent to my phone. So is it blockchain itself? Just glancing at messages I see blockchain alot with this issue. I'm devastated I don't know what to do. I hoped maybe I sent to a offline storage or something but I have no idea. Can anyone please tell me what happens when you set up the recovery phrase did that automatically send my coins somewhere or did I just get robbed? I just want to stop wondering and get past this and leave cryptocurrency alone

How is blockchain not responsible for someone stealing my Bitcoin?

Many people have asked similar questions here concerning theft and recovery but I think the question of responsibility is a good one.
This answer makes a few digressions but I hope by reading to the end, the issue of responsibility will be clearer.

Unexpected transfers

Can anyone please tell me what happens when you set up the recovery phrase did that automatically send my coins somewhere

No. That wouldn't be normal.

Control of cash
It is probably useful to clear up a few basics.
If you live in the USA, when you go to a coffee shop and pay cash in paper dollar bills or coins for a cup of coffee, this obviously does not involve the car rental business called Dollar (website: dollar.com) even though you are paying in dollars. If there was a bank called Dollar Bank Inc, your use of paper dollar bills and coins to buy a cup of coffee would have nothing to do with them.
Businesses like blockchain.com or bitcoin.com are not in control of bitcoin. Just as dollar.com is not in control of the US dollar. You don't have to use those businesses (or any others) to use bitcoins (or dollars)
Bitcoin was created as electronic cash that does not depend on trusted third parties like banks.
From what you write, you chose to give your money to a company named blockchain.com. If you are unhappy with their service or feel they have failed to take proper care of the money you gave them, that is something that you must take up with them. No-one else has any special inside knowledge of what that business does.

Theft

It's weird the moment I set my recovery phrase was when my money disappeared.

It seems likely that someone else saw that recovery phrase and used it to take control of your money and spend it. Maybe your computer or phone has been infected with malware that lets a criminal spy on your use of it using a software keylogger or some other malicious technique.

Responsibility

I see where it was sent cause it's public and NOONE can tell this thief that they need to give my funds back?

That is correct. Bitcoin is mostly anonymous. You can see an address where money was sent but there is no central registry of who controls which addresses. The addresses all look like random numbers. Bitcoin is a peer-to-peer cash - which means there is no central authority who can intervene to reverse transactions.
This is the nature of cash. If you are walking through a train station or airport and a pickpocket removes a paper $5 bill from your pocket without you noticing. The next day there's no government agency and no bank you can ask to press a button that will put that paper $5 bill back into your pocket. Cash doesn't work like that.
If you feel you have evidence you have been robbed. you should report it to your local police. That's what you would do if a pickpocket stole the cash in your pocket.

Recovery
You will get lots of offers for help but all of them will be from conmen and scammers who are trying to get you to trust them so they can trick you out of more money. They will eventually try to confuse and panic you by talking about refund fees, release fees or the need to prime a wallet with money and lots of other lies.

Related Questions

How do I recover from a cryptocurrency scam?

Thanks for your information and your help. I do believe something is for sure wrong. I didn't get the normal approval email or the sms code showing up on my phone. I did receive a email april 25th I had an approval to disable my 2fa from this same wallet which I never asked for. I for sure appreciate your help.

One chance to get the funds back would be catching the scammer with analytical methods. Not all companies offering this are scamming (I program for two companies doing it honestly) but the warning is important because at least 90% offering this are scammers. You recognize them because they give great promises before investigating the case. E.g. if the scammer didn't move the coins yet then in most cases it's too early to investigate. And even after a successful analysis it could be that the scammers jurisdiction isn't cooperating to yours.
In your specific case I would not try to trace the scammer (for costs risks because you'd need to pay the analytics company and later a lawyer). Just report the evidences to police in case there were other victims with higher losses and they caught the scammer already somewhere or if they will catch him in future.
Wish you luck to get the funds back!


text:
Why are Paxful transaction fees so low?
Recently I used Paxful for the first time I had bought 0.00022665 BTC and then had sent them to my Electrum wallet. The whole amount have arrived to my private wallet successfully, so that means that Paxful didn't charge me with any fees.
But when you use your private wallet such as Electrum you have to pay a large transaction fee just to get your transaction confirmed?
How does it work? Why doesn't Paxful wallet have transaction fees for outgoing transactions?

Paxful has withdrawal fees, as any other exchange or Bitcoin service that I am aware of: sending bitcoin is costly, so it will be very unlikely that some company will send you btc without charging a fee.
This is from Paxful Fees webpage:

So Paxful charge you with 0,0004 btc if you withdraw more than 20$, which is usually more than you have to pay to send a standard transaction with Electrum.
As a side note I tell you that in the last few days Bitcoin network fees went crazy, a sharp hashrate reduction has created a long queue of pending transactions and sent commissions to the highest level for 3 years now; so right now you can pay more than 0,0004 btc but it's a very rare case as you can see at this historical chart: https://jochen-hoenicke.de/queue/#BTC,all,count


text:
Why does mining / validation of new blocks have to be complicated / time consuming?
Why does mining / validation of new blocks have to be complicated / time consuming ?
Why it can't be as simple as just find a hash for a text?
Is it just to control / limit the amount of new crypto volumes coming in ? If this is the case, isn't it an energy consumption issue ? Aren't there any other solutions ?
Sorry for asking too many questions. I am just a bit confused.

Does this answer your question? Why do we need Proof of Work in bitcoin?

If mining was simple I could find a hundred million blocks in the next five seconds.
Would that be helpful? What would we do with all those blocks?
Thinking about these questions should help you answer yours.


text:
How will mining work after 2140?
The nonce header of a block has 32 bits. The vast majority of the time, none of the 2^32 nonces will result in a block hash below the target. So to continue mining, miners usually change the extraNonce in the coinbase transaction. But what will happen once all the bitcoins have been mined and there is no coinbase transaction anymore? I know this will only happen in 2140, but have we thought of a way to change the nonce range when it will be the case?
Thank you for your help.

There’s no such thing as a block without a coinbase transaction. Even if the block reward plus fees is zero, it is still a mandatory transaction at the start of every block, it just pays nothing.


text:
Discrepancy in the blockchain size
There are approximately 700,000 blocks as of March 2021 [1]. How comes the blockchain size is only ~350 GB [2] and not 700 GB given that the block size is 1 MB?
Thank you for your help.

The block size is not 1MB, It is 4 weight units (which can be comprised of up to about 4MB of data). This change came into effect in 2017, so the upper bound of the possible blockchain size is actually larger than OP suggests.

1 MB was the maximum Bitcoin block size until 2017, not the size of each block. In the early years there were few transactions and most blocks were almost empty.
After the august 2017 segwit soft fork, the way how the transactions size are measured and the maximum space available has changed, now blocks can be bigger than 1 MB.
If you are interested, you can find here how the things works now: https://en.bitcoin.it/wiki/Weight_units
This is the historical chart of Bitcoin average block size

currently the average block size is about 1.33 MB

Edit: I have updated my answer to take into account the changes introduced with segwit soft fork.

I corrected the answer, thanks

modified, I hope it goes well now :)


text:
Is there a Blockchain Refund Department
I was scammed 3 years ago by FXTrade, i know for sure that they invested my money into BTC.
About 6 months ago i recieved an email from a lawfirm that told me i had BTC to recover under my name in Blockchain, and i should be contacted by an Blockchain agent soon.
I was contacted by an agent 2 months ago, he showed me my account and there was my lost BTC in this Blockchain wallet. The agent now saying that i had to pay an upfront fee of 15% of the amount, but he was willing to reduce this payment to half of the amount and take the rest from my refund. Is there anyone that's had the same experience and do you believe this is just another scam attempt?

It's a scam. If they had your money, why would you need to send them anything? They could just reduce the amount they give you by their fee.

Scam! The only reason to send a little amount to their bitcoin address would be the hope they spend the coins together with other BTC addresses so that tracing of the scammers could be possible.


text:
Will the miner be provided with reward if a hard fork occurs?

When will the miner be provide with reward(if at all) when a hard fork occurs?
When will the miner be provide with reward(if at all) when a soft fork occurs?

Miners are rewarded iff they produce valid blocks that become a part of the blockchain record. The reward is included in the block itself, so the only way to receive a block reward is by publishing a valid block to the network.
Miners cannot force a hardfork upon the network, doing so would just mean that the network's nodes would ignore those blocks, since they would be invalid by the network's rules. The hard fork blocks would be effectively creating a new network, that only(?) the miner is on, making the blocks worthless. If some users happened to join the hardfork network, so that both the legacy and hardfork networks remained active after the fork, then miners on either side of the fork would be creating blocks that contain rewards of some value.
A majority of miners can force a soft fork onto the network though, if they work to make all non-soft-fork-compliant blocks stale. In that case, any miner that wanted to participate in the network (ie, receive rewards) would need to create soft-fork-compliant blocks. If a minority of miners wants to activate a soft fork, they will not be able to do so. The minority could still mine softfork-compliant blocks, and receive the block rewards for them, but the rules of the softfork would not be enforced on the network at large.


text:
How to transfer BTC from desktop wallet to mobile wallet (without fees), say using Electrum or Bitcoin Core
I have both Bitcoin Core & Electrum wallets installed on both my desktop & mobile.  How do I transfer BTCs from respective desktop to mobile wallets (& vice-versa) directly (i.e., not thru the blockchain) to avoid fees?

By exporting and importing the WIF private key?

To accomplish this you will not 'transfer the bitcoin', you will just import the keys that can spend your bitcoin, into a new wallet.
Not all wallet software will support importing/exporting keys in every format, so you'll need to ensure that your current wallet software is capable of exporting keys in a format the the new wallet will accept. There are several formats for private keys, as well as other standards for backing up/recreating wallets, such as BIP32/39/44/84, etc. Be sure to familiarize yourself with these formats, and know which ones you'll need to use in order to accomplish your goal. Any wallet software worth using will allow you to export keys in some way or another, and hopefully provide some sort of documentation to help with this.
Very importantly, you need to understand that the private keys (or mnemonic seed phrase) that you'll be handling is the literal key to your bitcoin. If you store it on, or enter it into a compromised device, your bitcoin could be stolen.
Once you have the keys that control your bitcoins exported, you can import them to the new wallet, and (potentially after a rescan of the blockchain to locate your funds), your funds should appear in the new wallet.


text:
How to upgrade Bitcoin Core on Mac OS with binaries from tarball?
I want to upgrade to version 0.21.1 from an older version I built from source. However, it is unclear to me how I can upgrade using the .tar.gz file that's available from the Bitcoin Core website.
I think I found how to do the first step:
tar -xvf bitcoin-0.21.1-osx64.tar.gz

But after that, it's unclear to me how to proceed. Just trying to learn this stuff - many thanks for your help.

why don’t you download the .dmg installer instead of the .tar?

Does that also update the binaries used for the CLI?

No, the binaries are in the tarball. Upgrading should be as simple as replacing the old ones with the new ones


text:
Are trades done on exchanges added to blocks?
I found a few answers to this question here, here, and here, but my doubts weren't cleared.
Are trades done on exchanges added to blocks? Or are they only added once you withdraw the funds to your own wallet? If this is the case, how does the exchange decide on transaction fees?
Based on the above posts the answer to the first question seems to be "no". Most exchanges seem to work off-block. Now, is it possible that as a buyer one may be buying bitcoins that don't actually exist? How is this controlled?
If I misunderstood and all transactions made on exchanges are confirmed into a block, who sets the fees?
Any good articles or pieces out there to learn about the work behind the scenes of exchanges? I can't seem to find anything that addresses this.

Are trades done on exchanges added to blocks?

No.

Or are they only added once you withdraw the funds to your own wallet?

Yes.

If this is the case, how does the exchange decide on transaction fees?

Fees for trading are just a property of the exchange, transaction fees on Bitcoin transactions for withdrawals are just their choice to make. They might absorb that cost, or pass it on to the user depending on the exchange.

Now, is it possible that as a buyer one may be buying bitcoins that don't actually exist? How is this controlled?

It isn't controlled at all, you trust that the exchange actually has something to sell. There's no way of knowing if they actually do or not as a client or an outsider. They might be a complete sham, might hold only a portion of the funds they claim to, or they might be completely legitimate.


text:
Best Public cyrptocurrency APIs to develop exchange
We are developing cyrptocurrency API where we are relying on Blockcypher for several currencies. But we would like to add more and more currencies to our exchange. But it seems all crypto currencies look to develop our own node and make rpc request to that from localhost itself.
We are looking free REST api to generate addresses and make transactions.
Is there any source or idea from where we can get the API of most of the currencies.


text:
How many nodes have to confirm a transaction for it to go to a mempool? Or is it somehow based on hashing power?
I am trying to understand chronologically what happens to a transaction from the second it is sent to the moment it is added to a block.

None. The mempool is composed by unconfirmed transactions.
If you send a valid transaction to other nodes, the first node that receives can be a miner, then it puts on his/her mempool. Or it can send it to other nodes unit it eventually reaches a miner. There's no limit for how many nodes relay it.

My semantics were off. I should have said validate a transaction instead of confirm a transaction. So let's say there is a network off 100 nodes. A transaction propagates through the network and the 51st node says that it is a validate transaction. Would you argue that a network has reached a consensus that the transaction is indeed valid. Also, I didn't realize that each node has its own mempool thank you for teaching me that!

The network only 'reach a consensus' by mining, not relaying an validating transactions. That's what's mining for.


text:
How do I double SHA-256 the header of block #59,500?
I'm not sure how to combine all of this information.
https://blockchain.info/block/00000000096af43105123c499521e1d131d172e7e1bf2ed0843290a921f1f6a7
Version
1
Time Bits
470771548 (is this the right number to use for Time Bits?)
Merkle Root
 ff682ef66cd1b56213fd4db9462fb138f6d8c16d706d41969a7eacc819528038
Nonce
16641419
Hash of Current Block
00000000096af43105123c499521e1d131d172e7e1bf2ed0843290a921f1f6a7
Hash of Previous Block
00000000023bbab0e78a22d27fbd2d0cd13f8302fb3f560138e0e81d087ac7a1

take first 160 symbols from https://blockchain.info/block/00000000096af43105123c499521e1d131d172e7e1bf2ed0843290a921f1f6a7?format=hex
should I explain more? :))))
update:
01000000 version
a1c77a081de8e03801563ffb02833fd10c2dbd7fd2228ae7b0ba3b0200000000 prev hash
38805219c8ac7e9a96416d706dc1d8f638b12f46b94dfd1362b5d16cf62e68ff merkle hash
27b80a4c timestamp
5c670f1c bits
8bedfd00 nonce

Thank you for the reply! I do apologize, I am a still bit confused as to where all of those numbers come from in the link you attached. And why the first 160? Is that in anyway related to RIPE-MD 160? Thanks!

this is block in hex format. first 160 symbols are block header (80 bytes)

As noted above, you should take the first 80 bytes from the serialized block. Since this data is hex-encoded, and each byte takes two hex-digit to encode, a block header is 80 * 2 = 160 digits.
You will notice that a few fields are inverted, it's because they are represented in little-endian format. Once you double-sha256 this data, you'll find a hash with trailing zeros and not leading, this is also because endianness.
Here is how the mentioned block looks like:
Take the first 160-digits serialized header
01000000a1c77a081de8e03801563ffb02833fd10c2dbd7fd2228ae7b0ba3b020000000038805219c8ac7e9a96416d706dc1d8f638b12f46b94dfd1362b5d16cf62e68ff27b80a4c5c670f1c8bedfd00
And parse:
Version: 01000000 (This is 1 in little-endian)
Previous block hash:   a1c77a081de8e03801563ffb02833fd10c2dbd7fd2228ae7b0ba3b0200000000 (Notice the trailing zeroes)
Merkle Root: 38805219c8ac7e9a96416d706dc1d8f638b12f46b94dfd1362b5d16cf62e68ff
Timestamp: 27b80a4c
Bits: 5c670f1c
Nonce: 8bedfd00
A python 3 code that hashes it:
import hashlib
data = bytes.fromhex("01000000a1c77a081de8e03801563ffb02833fd10c2dbd7fd2228ae7b0ba3b020000000038805219c8ac7e9a96416d706dc1d8f638b12f46b94dfd1362b5d16cf62e68ff27b80a4c5c670f1c8bedfd00")
h1 = hashlib.sha256(data).digest()
h2 = hashlib.sha256(h1).digest()
print(h2.hex())

It results in a7f6f121a9903284d02ebfe1e772d131d1e12195493c120531f46a0900000000, that's precisely the little-endian version of 00000000096af43105123c499521e1d131d172e7e1bf2ed0843290a921f1f6a7


text:
How are transactions hashed together to form a Merkle Root?
In block #59,500 there are 2 transactions
Transaction 1. 6653ad77d695752cff9fe63bbb5702a53807be534c537251d53de06aac5ca093
and
Transaction 2. 72e8781092c01e9eb1c21ba33d52ad6abc42f3807601bcd8b8074d583446346e
Would you double SHA-256 transaction 1 and then double SHA-256 transaction 2 and then combine those and double SHA-256 that value to get the Merkle Root?

Do you know if the coinbase has to be hashed as well? Would you have to copy the first transaction twice because there would technically be 3 transactions to hash?

The coinbase is included in the merkle tree. You could duplicate the last tx to make an even number for the tree

And the coinbase is hashed as well then?


text:
I want to know how I can express a phenomenon found in Merkle Trees mathematically
I want to know how I can express a phenomenon found in Merkle Trees mathematically. If I want to figure out which leaf node in a Merkle Tree has changed I can look at the authentication path to figure it out. Let's say there is one leaf node and one root node. If the root node changes you don't have to look at any other nodes (0) to determine which leaf node must have changed. In Figure 2 there is a 0 across from 1. If there are 2 leaf nodes and the Merkle  Root changes you only have to look at 1 node to determine which leaf node must have changed. As we increase the number of leaf nodes there is a relationship that exists with the total number of nodes you need to look at. I was wondering if there was a way I could express this mathematically in a clean way. Thanks!
Figure 1.
2*0 = 0  (1 zero)
2^0 = 1  (1 one)
2^1 = 2  (2 twos)
2^2 = 4  (4 threes)
2^3 = 8  (8 fours)
2^4 = 16 (16 fives)
2^5 = 32 (32 sixes)
2^6 = 64 (64 sevens)
Figure 2.
Leaf (Left Column)   &   Total Nodes (Right Column)
1         0
2         1
3         2
4         2
5         3
6         3
7         3
8         3
9         4
10        4
11        4
12        4
13        4
14        4
15        4
16        4
17        5
18        5
19        5
20        5
21        5
22        5
23        5
24        5
25        5
26        5
27        5
28        5
29        5
30        5
31        5
32        5
33        6
34        6
35        6
36        6
37        6
38        6
39        6
40        6
41        6
42        6
43        6
44        6
45        6
46        6
47        6
48        6
49        6
50        6
51        6
52        6
53        6
54        6
55        6
56        6
57        6
58        6
59        6
60        6
61        6
62        6
63        6
64        6
65        7
66        7
67        7
68        7
69        7
70        7
71        7
72        7
73        7
74        7
75        7
76        7
77        7
78        7
79        7
80        7
81        7
82        7
83        7
84        7
85        7
86        7
87        7
88        7
89        7
90        7
91        7
92        7
93        7
94        7
95        7
96        7
97        7
98        7
99        7
100       7
101       7
102       7
103       7
104       7
105       7
106       7
107       7
108       7
109       7
110       7
111       7
112       7
113       7
114       7
115       7
116       7
117       7
118       7
119       7
120       7
121       7
122       7
123       7
124       7
125       7
126       7
127       7
128       7

Ceiling of the binary logarithm?

Cool!!! Would you mind explaining the what the ceiling is? Besides in a house.

Ceiling means rounding up to the next integer.

@BenStolman: Did you see the word "ceiling" is a link to Wikipedia?

@NateEldredge: I did indeed, but my brain could not comprehend it.

Whenever you are interested in a mathematical function that you can give a sequence of integer examples for, search OEIS: https://oeis.org/A029837


text:
Restoring old wallet
I am trying to restore an old bitcoin backup i found in my google drive.
The original backup date is 2013, and i am quite interested to see if there is any money on it :)
I tried to follow this https://github.com/bitcoin-wallet/bitcoin-wallet/blob/master/wallet/README.recover.md but i get an error stating : Unknown wallet version from the future
I found the file named "secret.backup" and i just changed it to "wallet" with no type.
Opening the file in nodepad, the only readable part is : org.bitcoin.production
My end goal would be to check for funds, and transfer to my exodus client

You should make clear which wallet you were using, at first I assumed you were talking about Bitcoin Core but it seems not.
I would have suggested you directly open an issue on the wallet github as they are more likely to be able to help you, but it seems they have a backlog of issues.

I have taken another crack at it, and ended up succeding.
I followed this guide: https://walletsrecovery.org/recovery-docs/bitcoinwallet-recovery.html
BUT i cloned and older repository, i choose release 0.11 as it came out in 2014 and i saw my backup was from 2013.
It is now succesfully syncing.


text:
Convert 12 word seed with passphrase -> 12 word seed without passphrase
Is it possible to derive a new 12 word seed from a 12 word seed with passphrase (13th word) such that they both produce the same master key?

No, this is not possible.
The mnemonic and passphrase are put through PBKDF2. Any change in the input results in a completely different output.
While it is possible that there exists some 12 word mnemonic that just happens to hash to the same seed as your original mnemonic + passphrase, this would require bruteforcing all possible mnemonics to discover, and would not be derivable from the original mnemonic in any form - a hash collision would be completely unrelated.


text:
How to find out the requirements for spending an output script?
How do you find out the requirements to spend an output script?
Do you decode the hash?

The question is not very precise, maybe some background info here: https://bitcoin.stackexchange.com/questions/69062/why-does-bitcoin-uses-a-script-language/69077#69077, and for sure in Andreas book „Mastering Bitcoin“.

I'm assuming you're talking about P2SH addresses here, since that's really the only time this matters.
For standard P2SH addresses, you cannot find the spending requirements by just looking at the address. Let's look at 3DzSVk4veMCkNbNT9CdETeE26uWxmNbBnD from a recent block as an example.
The output script of this address is a91486ed17bfa7bd80cf87cf7e80abd9289079b78c5b87. This alone simply amounts to HASH160 PUSHDATA(20)[86ed17bfa7bd80cf87cf7e80abd9289079b78c5b] EQUAL. This means that to spend the tx, you need to provide some input, that once run through HASH160 equals 86ed17bfa7bd80cf87cf7e80abd9289079b78c5b.
This is the general format for any P2SH output script. To actually know what kind of script it is, you need the redeem script, which can be found in your wallet. If the address is not one of your own, the redeemscript is revealed when an output to that address is first spent.
Looking at this tx for the above address, we can find the redeemscript as 5221038934160de8ad1dd529329f5bf51e3086cc0f6d19e10fb4120385f23d871c0c1d21021659435e23e3891d39ec2b0266b3c14a68cb4e45adb8543f31508310c98722d952ae (the final push in the script for the input).
Running the above redeemscript through the decodescript command gives us:
2 038934160de8ad1dd529329f5bf51e3086cc0f6d19e10fb4120385f23d871c0c1d 021659435e23e3891d39ec2b0266b3c14a68cb4e45adb8543f31508310c98722d9 2 OP_CHECKMULTISIG

This identifies the script as a 2of2 multisig.
This could very easily have been any other form of script, such as 2of3 multisig, or not multisig at all. It could even be a segwit address wrapped in a p2sh address. However, just by looking at the address, you cannot determine the type of script. You must have the redeemscript to determine the spending requirements.


text:
How to create a valid unsigned transaction
How can I create a valid unsigned transaction which can be broadcasted and mined using these addresses?
Could someone create the raw transaction and show me?
sender's address: 1NsRUK6vmPbtQa8sSjeXVxeYQiGCGNi6W3
receiver's address: 37KSBUjixDYxmgmTdepb79aso69vPZrLu2
Note: These are both my addresses and their balances are 0.

This is not how Bitcoin works.
Bitcoin does not use an accounts system nor does it use addresses on a protocol level. Spending Bitcoin means that you are spending from a transaction output. If there is no available transaction output for you to spend from, then you cannot create a transaction. So with addresses with 0 balance, no such valid transaction can be created.
Next, the "sending address" that you specified requires a digital signature in order to spend outputs associated with it. This is because that address type tells wallets that an output should be created which has the form OP_DUP OP_HASH160 <hash> OP_EQUALVERIFY OP_CHECKSIG where the address encodes the <hash> and the type of address specifies the other opcodes. So you cannot spend outputs that are associated with this address without being able to provide a valid digital signature that corresponds to the public key that hashes to <hash>.
What you could do is have a transaction output whose script is something like OP_DUP OP_HASH160 <hash> OP_EQUAL. This does not require a signature, but such a script, even though it can be constructed with the provided address, does not correspond to that address because it does not have the construction that the address type specifies.
Thus it is impossible to create such a valid unsigned transaction because 1) there is no output to spend and 2) the address requires a signature in order to spend from outputs associated with it.

Such a signature-less script as a I described corresponds to no address; there is no address type that specifies it.
The output script would look like this:
76a914ef0ffa5f1cc59bed17cf4e35ae9cbf396cddf17088

A transaction spending from that script would look like:
0200000001deadbeef000000000000000000000000deadbeef00000000000000000000000000000000222103061e97605659c9dc77ed437cbc345ec41633888ae3b2c75fdd532db789cc476fffffffff01000000000000000016a914ef0ffa5f1cc59bed17cf4e35ae9cbf396cddf1708700000000

So could you provide an example of the transaction output script and the address type as well as a transaction like that in hex please?

Like what? The example script I provided that requires no signature?

yes as well as an example of how the transaction would look like in hex and an example of the address type,

I updated the answer with an example. Note that the example does not actually spend from any existing outputs.

But if you created a p2sh transaction with the scriptsig as OP_TRUE using an output script like that, would it not be possible?

Yes it would be possible, but also completely unrelated to the addresses you provided.

So what would happen if you change the op codes of a utxo in order for it to be spent without a signature?

You can't change the opcodes of an existing UTXO. Changing a UTXO requires changing the transaction that contains the UTXO and re-mining the block containing that transaction AND all blocks following it. It is impossible for someone to do that if they don't have the private keys involved in the transaction that created the UTXO too.


text:
Can larger transactions have a lesser fee per byte than smaller ones and still get equally treated?
Is the term "volume discounting" applicable in bitcoin transactions, meaning can a user pay less satoshi/Byte if a few transactions are bundled into one?
In other words, would a fee for a single bundled transaction be less than the sum of fees for several small-sized (in bytes) transactions?

No. There is no unit price discount for making larger transactions. Such transactions consume similar resources to multiple transactions which sum to the same size. They consume the same amount of block space, so they will cost the same in transaction fees.

Perhaps it would be useful in this context to note that while all of the above is true, batching multiple payments into one transaction will result usually result in a smaller transaction, though.


text:
Bitcoin private network on Amazon EC2
I am looking to set up a private network of Bitcoin nodes over multiple machines (e.g, on multiple VMs on Amazon EC2) for experimentation. I want to be able to control how the different nodes are interconnected to each other in this network. Is there a way to do this on Bitcoind? The regtest mode that is commonly cited as a solution for this seems to have the ability to create multiple nodes on a single machine. Can it also be used to interconnect nodes across different machines according to a specified topology?

I want to be able to control how the different nodes are
interconnected to each other in this network. Is there a way to do
this on Bitcoind?

As per bitcoin.conf I suggest setting up the connect = X.X.X.X flag on your nodes. It will enforce connecting only to the peers specified by you. Not sure if this is the answer you are looking for though?


text:
Bitcoin core behind Tor Hidden service problem
Recently I had to reinstall/compile Bitcoin Core in my freshly installed Debian Buster laptop.
I followed instructions here for method 2 at the bottom of the site:
https://en.bitcoin.it/wiki/Setting_up_a_Tor_hidden_service
But shortly after I started my node, I noticed that the command
bitcoin-cli getnetworkinfo

was reporting 2 onion addresses at the bottom of the returned JSON object, at section localaddresses.
    {
      "address": "rs6srmllckfcveu2.onion",
      "port": 8333,
      "score": 6
    },
    {
      "address": "53hhdjgv4jailcee.onion",
      "port": 8334,
      "score": 4
    }
  ],
  "warnings": ""

These are my settings related to Bitcoin Core and Tor
Bitcoin Core config file
proxy=127.0.0.1:9050
listen=1
bind=127.0.0.1
externalip=53hhdjgv4jailcee.onion
onlynet=onion
port=8334

and in /etc/tor/torrc
HiddenServiceDir /var/lib/tor/bitcoin-service
HiddenServiceVersion 2
HiddenServicePort 8334 127.0.0.1:8333

I also added this to
but these lines are for c-lightning node configuration, so I assume they play no role for Bitcoin Core configuration regarding method 2.
SocksPort 9050

CookieAuthentication 1
CookieAuthFileGroupReadable 1
CookieAuthFile /run/tor/control.authcookie

Inside /var/lib/tor/bitcoin-service/hostname I can see only one onion address which is the one in my Bitcoin Core config file.
I already tried to delete my bitcoin onion_private_key file and also deleted my /var/lib/tor/bitcoin-service folder, but still 2 onion addresses are showing up.
So, where is it Bitcoin Core picking up the other onion address?
Can anyone help me?

I'll try today after work and will let you know @Prayank

@Prayank if I remove those lines, the service won't be controlled by Tor any more, if I understand correctly. Which was the point of that config. However, I'm not using that config any more. If I get back to it, I'll come back to this thread. Thank you!


text:
How do I concatenate two hashes in Python?
Concatenating and double SHA-256 hashing
"a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
with itself
"a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
should output
15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3

import hashlib
      header_hex = "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
      '2b4a9fdb97e89e73c4647791e476090eaad04f43c93a3de21a95d2c4fc8e8e0c'

I'm getting the wrong answer :/?

Your code looks correct. Where do you read that the double-SHA256 hash of a751... input concatenated with itself should have 15eca... as output?

https://bitcointalk.org/index.php?topic=44707.msg534605#msg534605 the bottom of the last page

https://www.blockchain.com/en/btc/block-index/120872 the Merkle Root in the example on the forum is the same as the one on Blockchain.info

Block hashes are often displayed in byte-reversed order. Try reversing the bytes before hashing, and again on the computed hash.

import hashlib
header_hex = "435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7"
header_bin = header_hex.decode('hex')
hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
hash.encode('hex_codec')
'b3b366122163d146f56ecdcd0f5029f387da1d9f62e0fbb4b9c22c3eaaa0ec15'
hash[::-1].encode('hex_codec')
'15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3' YIPEE THANK YOU PIETER!

Don't forget to write an answer yourself if you fixed the issue.

You have to byte-swap the hex values BEFORE concatenating them. You also have to byte-swap the double hashed hex string!

import hashlib
      header_hex = "435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7"
header_bin = header_hex.decode('hex')
      hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
      hash.encode('hex_codec') 'b3b366122163d146f56ecdcd0f5029f387da1d9f62e0fbb4b9c22c3eaaa0ec15' >>>
hash[::-1].encode('hex_codec') '15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3'


text:
Unconfirmed transaction almost 5days waiting :(
Anyone could help me this is my first time
{
"Version": "1",
"LockTime": "0",
"Vin": [
{
"TxId": "f766b698554f5fd23ba0ad4efce5d39eef4242609dd11a6feebb496af5d5bb5d",
"Vout": "20",
"ScriptSig": {
"Asm": "304402205025420f7d7ff0601baa2d208e54442f44ec6ad11f506ed0fb7e5ebd555d1d3d02204659c608dc031e653c729619cc4138b4fb811c9b8f6013564a651f3008e83d8f[ALL] 03beeb2aa4b2afc2601a54aa3e9b02e75dcc9ab53d6135c83317327cb3c165e739",
"Hex": "47304402205025420f7d7ff0601baa2d208e54442f44ec6ad11f506ed0fb7e5ebd555d1d3d02204659c608dc031e653c729619cc4138b4fb811c9b8f6013564a651f3008e83d8f012103beeb2aa4b2afc2601a54aa3e9b02e75dcc9ab53d6135c83317327cb3c165e739"
},
"CoinBase": null,
"TxInWitness": null,
"Sequence": "4294967295"
}
],
"Vout": [
{
"Value": 0.04616479,
"N": 0,
"ScriptPubKey": {
"Asm": "OP_HASH160 4b87b8e34b41ceb6e4de7d716b153187e75e0f86 OP_EQUAL",
"Hex": "a9144b87b8e34b41ceb6e4de7d716b153187e75e0f8687",
"ReqSigs": 1,
"Type": "scripthash",
"Addresses": [
"38aPC5NBgWUWzV9Ccaro5ePhxfn5vQDZyj"
]
}
}
],
"TxId": "4587a71a9bbf4038d2479a7496e05119c5d6972f3d5ad70f04222368428e5fce"
}

Hi James, the Bitcoin network is somewhat backlogged at the moment. Your transaction was sent with a feerate of 8 satoshi/byte and the network is currently requiring 70 satoshi/byte to get into a block. It might take a few days for your tx to confirm. The question that I linked you to explains it more comprehensively.

Next time I will explain it nicely it was just my first time and it almost 6days still not confirm.

It's alright, we get that it's a bit confusing for people that just discover Bitcoin. We created that linked question because we tend to get a dozen or so of similar questions like yours in a week like this. :) I hope the linked question helped you understand better what's happening.


text:
How can I sign a bitcoin address that is on a paper wallet?
I have a bitcoin address that shows I held the BTC prior to December 2019.  I need to verify this but as the address refers to a paper wallet I don't seem to be able to do so.   If I move the coin to a hardware/software wallet I can verify BUT I will have created a new address that doesn't meet the criteria in that case.
Is there a way to sign a message with my paper based bitcoin address?  Or import the paper wallet into something that can sign messages?


text:
Is my ECDSA signature always unique?
In P2PKH the validation script is:
<sig> <pubKey> OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

If I always use exactly the same private key and always sign exactly the same message with it, is my <sig> unique among all my transactions?
Furthermore, if <sig> was always the same for all my transactions, would that mean that everyone who knows my <sig> can impersonate me?

Related: https://bitcoin.stackexchange.com/q/100253/5406

well, the message you're signing for each transaction changes, because the message includes the transaction data. all someone could do with your signature of an old transaction is attempt to replay that exact same transaction, which is only really an issue during a fork.

Digital signatures really aren't much alike someone's John Hancock. Digital signatures cryptographically commit to exactly one message and resolve as invalid for any other messages. Unlike someone's three crosses they cannot be lifted from one document to another or easily imitated.
ECDSA's signature algorithm uses two inputs, the private key and the message that the signature commits to. In the case of Bitcoin, the "message" is the Bitcoin transaction you mean to commit to.
The signature is mathematically derived from the message, the private key, and a random component generated during the signing. While producing the signature requires knowledge of the private key, the signature can be validated by anyone who knows the message, the signature, and the corresponding public key. The signature will only ever fit that specific transaction. Any other transaction would require a signature to commit to a different "message", and such a signature could not be produced without knowledge of the private key.
As a transactions spends at least one unspent transaction output (UTXO), and each UTXO is unique¹, the premise of "signing the same message" is in conflict with "same for all my transactions". As each transaction must be unique, signatures do not transfer, even if the transaction spends inputs associated with the same private key. Therefore, yes, every signature is unique.

Furthermore, if <sig> was always the same for all my transactions, would that mean that everyone who knows my <sig> can impersonate me?

No, that's not how signatures work. If your signature was always the same for all transactions, they would not be useful. Such a "signature" would not prove that you committed to something specific and therefore could not be a means of authorizing a payment.

¹ A UTXO are uniquely identifiable by their outpoint which consists of the txid that created it and the output's position in that transaction's output list. txid are the SHA256D digest of the transaction data. This is defacto unique since BIP34 requires Coinbase transactions to include the block height, which therefore by induction means that no transaction can ever consist of the same data.


text:
Can a full node measure bandwidth to and from its peers?
For example, can I run a full node, connect to some 8 peers, and measure my uplink and downlink bandwidth to each of my peers?

You can to a limited degree with custom software, but ultimately the data you would get is noisy and not particularly useful. A number of years ago I was crawling the Bitcoin network to get estimations of the speeds that nodes could attain by connecting, downloading a known quantity of blocks, and measuring the time it took. This makes assumptions about the nodes you are connecting to being otherwise idle, and therefor only gives you a lower bound of what their line speed might be. It isn’t an intended function of the network in any case.

What do you mean by "it isn't an intended function of the network"?

There’s not specific tools or interfaces for doing it, I was just doing something intentionally bandwidth intensive be measuring the peak throughout.


text:
How to get IPs of 8 peers my node propagates transactions and blocks to?
I see that bitcoin-cli can do getpeerinfo. However, it typically returns around 30 different IPs. Even if I ask for only outbound ones, I get around 16 addresses.
$ bitcoin-cli getpeerinfo | grep "inbound\": false" | wc -l
16

How do I narrow down to those 8 that will be used to propagate the next block my node gets to propagate?

Bitcoin Core nodes propagate blocks and transactions to all their peers, not just outbound ones.
And if you have 16 peers that getpeerinfo reports "inbound": false for, then all 16 are outbound connections. Presumably you're using addnode functionality, or using modified source code, as Bitcoin Core itself will not make more than 10 automatic outbound connections, but for manual connections (addnode) there is a separate limit.


text:
How to access "change" account from LTC transaction?
I bought LTC on Coinbase, and then transferred it all to my Jaxx wallet address.
The transaction hjas been confirmed, and the amount sent shows in Jaxx. Looking at the transaction on blockcypher.com, there are 2 output addresses - my jaxx wallet and an unknown.
My searching suggested that the unknown was where the change went - as the allocated fee was higher than the actual fee paid. However, I have no idea how to access this change, from this other address. I assumed it would maybe return to Coinbase, however Coinbase still shows 0 as my LTC balance, and Jaxx balance shows only the amount sent to the primary output address.
How do I access this change?

If you can link a tx ID or receiving address so that someone can look up the tx, it will be easier to help you. Was the amount you received in your jaxx wallet less than expected?

Tx: https://live.blockcypher.com/ltc/tx/8b76a36d30971c56c9f0a710a29eacc53a4a2cda9d204117d9a2c26f9af52534/
input was my coinbase, and the larger output was my jaxx. What is that other output, and how would I access it, assuming I am meant to be able to? Jax only recieved the larger amount of the 2.

You didn't answer the more important part of the question: did you receive less than expected? If the answer is no, then it is simple: that output is coinbase's change address, and thus not your litecoin.

I recieved the amount I expected when setting up the TX, but after reading online that the second output was the "change" to the transaction I should have access to, then yes I recieved less than expected.

The change address belongs to the sender of the transaction, not the receiver. In this case, Coinbase sent the LTC to your receiving address. So the LTC in the sent to the address  LcBnfq... belong to coinbase, not you.


text:
Crypto Exchange Price based on BTC
I can't seem to find a solid answer for this but looking at a chart that I have linked below, this altcoin (altcoin X) has a price that is based on BTC from an exchange that is only a crypto exchange.  Now BTC is very volatile and the price fluctuates a lot in a given day. My question is based on the chart where the current price is 0.00009468 BTC. Lets say this crypto X stays at this same price for Y time and BTC's price increases drastically in Y time.  Will the 0.00009468 BTC price take in the consideration that BTC has risen and lower that value of 0.00009468 BTC (for example down to 0.00006845 BTC on the Y axis) or will it stay the same where if I was to trade X for BTC and then traded to USD, I would recive the gains from BTC's rise?
Let me know if this dosen't makes sense.

When you talk about the price on the X-BTC market, that's what the market thinks is the fair price for X relative to BTC. When people trade BTC-USD, they don't really concern themselves with "oh, what will be the value of USD relative to EUR or GBP by the time I'm done with this trade". The quote currency is the basis of all measurements.
There is certainly some effect of a significant price change in BTC-USD market on the X-BTC market, there is varying levels of correlation in the way the price movements occur in one altcoin to another.

will it stay the same where if I was to trade X for BTC and then
  traded to USD, I would recive the gains from BTC's rise

Likely not. Because there are arbitrage traders who are probably faster than you. The price of X might too rise along with BTC. But if you were to sell X fast enough before a significant rise in BTC could take place and then sell the BTC for USD, you could theoretically profit from the price movement.
You can google more about triangular arbitrage, it should help bring clarity: https://www.investopedia.com/terms/t/triangulararbitrage.asp

When btc price in usd rises you will see raise in alt coins usd valuation because altcoins are valued based on their satoshis which is either in BTC, ETH or any pair.


text:
How do I send my coins from my Verge paper wallet?
I have created a paper wallet and send some coins from my account on binance.com to it ... How can I send them back to binance from the wallet?


text:
Claiming Bitcoin Gold from BTC address private key using Coinomi gives an error - "the private key does not contain any funds"
When I create a new wallet in Coinomi and try to sweep my old BTC private key (BTC since transferred to another address) I get an error - "The private key does not contain any funds".
I'm receiving with Bitcoin Gold and I'm using the WIF PK provided by blockchain.info - this is where the address (not a wallet) is located. I've also confirmed that I have BTG in my wallet using https://btgexplorer.com.
None of the issues detailed here: https://coinomi.freshdesk.com/support/solutions/articles/29000017747-i-can-t-sweep-my-btg-private-key are applicable.
How can I gain access to these coins?


text:
Lightning bumpfee completes but doesnt create a new transaction. Instead it waits in "pending sweeps"
I had a Lightning channel open transaction pending for 24 hours due to a low fee.
So I issued a bumpfee for the output index like so:
lncli wallet bumpfee --sat_per_byte <new_fee> <txid>:<output index>

This completed with a return value of 0.
However a new transaction was never created.
Instead there is an output in the command:
lncli wallet pendingsweeps

where I see the <new_fee> specified and the "outpoint" being the txid:output_index value
So what do I need to do to complete this CPFP operation?

My bitcoind didn't have the parent txn so the bumpfee never completed.
I restarted my bitcoind, lnd, rebroadcasted a raw txn that I got from another node's mempool and issued a bumpfee again.
A new txn was confirmed shortly after


text:
Recover BTC from seed
I wonder if you can help me.
I have my 17 word seed (yes 17 words) and my wallet crypto address and I can see my crypto on the blockchain under that address.
How do I restore my wallet with the above two things because my previous device failed and is dead.

Where did you get a 17 word phrase from? It’s not bip39 compatible, probably a proprietary algorithm

There have been other questions about 17 word phrases. It may be possible that they are legacy recovery phrases from obsolete wallet software provided by the business blockchain.info (now blockchain.com). That business has a web page for wallet recovery using legacy phrases.

Mnemonic Phrase
If you have a legacy wallet recovery mnemonic saved enter it below to view the password and login link.
NOTE: If you have a 12 word recovery phrase from our HD wallet, please go to the HD wallet recovery page.

I would hate to put a recovery phrase into a website of some random business, but maybe you originally used that business for your wallet for some strange reason? If so, that may be useful.

Not an expert on the issue, but try to find out what algorithm was used initially to generate your private key from those 17 words.
You should be able to apply the same algorithm and get it back.
I did not get from the question if your wallet was hardware or software, but either way, by checking the documentation of that wallet, you should be able to find the information above.
Hope this helps.


text:
Bitcoin data by country?
I am a political science graduate student looking to do research on bitcoin and cryptocurrency. To do so, however, I need data. While many datasets provide wonderful histories of bitcoin price and trade across time, I need data across space too for the type of research I am looking to do. I have found a large cache of data by countries' fiat currency used in transactions in the localbitcoins exchange here that does what I'm looking for, as an example: https://coin.dance/volume/localbitcoins/. I have also found graphs tracking traffic for major exchanges from Statista, but I haven't had any success finding or accessing the raw data. See here: https://www-statista-com.libdata.lib.ua.edu/statistics/944261/share-of-bittrex-visitors-by-country/ (same thing goes for the data for the data for Bithumb, Huobi, and Upbit on this site).
It doesn't matter to me so much what data exists (purchases, traffic, anything--I'm new to this stuff!) so long as there is some data out there on bitcoin by country. I also understand that this is a high ask considering the anonymity and decentralization of the blockchain, which are what attracted me to the topic in the first place. tl; dr where can I find bitcoin raw data by country?

try UsefulTulips.org for some good peer-to-peer trade volume data by geography. He doesn't do much exchange volume though.

I've written an open-access academic paper on Bitcoin full node data here, and the data is in the Electronic Supplements. I explain in the Appendix how I get and prepare the data if you need more fine-grained analyses. The data is country-year from 2014-2018. Good luck!
PS: The data includes Bitcoin merchant data worldwide too. Please do cite the paper after use.


text:
If nonce can change the hash then it should be changing the next block's previous hash?
I am studing blockhain and i know that a block hash is linked to the next block in previous hash and it cant be changed for valid reason.
Reason is : because if someone have changed hash then then he/she would have to change in hundreds or millions of nodes/system also otherwise it wont be valid.
My question is :
If nonce will be changed by some miner then the hash will also get changed and it should be changing the next block's previous hash.
correct me if i am wrong. I mean if a miner can change the hash of a block then how he can replicate that hash in all the nodes or system for that block? this is confusing.

Miners don't change the hash of a published block, they change the nonce of a block template until the resulting hash is less than the target and only then publish the block.
So until then, there are no other copies that need changing and there are no other blocks that refer to the older failed versions of the published block.

you mean they actually add new block and nothing is getting changed in previous block or already  published block?

@Aman: That is correct.

Thanks for this. nothing is more usefull on the internet for this confusion hence asked the question, as you can see other asnwer on this thread is also not clear.
Thank you.


text:
Some technical questions about Bitcoin
I'm a developer. I've read a lot about Bitcoin structure and how it works. But yet something confuse me.
I would like to share them with you and read your answers:

When a miner solves a block, how other nodes reward it? If they have the source code to generate Bitcoin, why don't they generate it for themeselves?

I know 6 confirmations are enough for a transaction to be valid. What If I run 6 full nodes by myself and hard code their addresses in a wallet to create a fake transaction?

3 . When 51 percent agreement is made? On every transaction? Or each block solved?

When a new transaction is made, do miners check all previous transactions in blockchain for maker person to check if it's lying or not?

If more than one miners create a new block and broadcast it into network, how other nodes would find out which one was the first?

I'm very curious about Bitcoin technology but I couldn't find a source that satisfies me.

Does this answer your question? What exactly is Mining?

Hi Robert, it looks like RedGrittyBrick already gave you answers to your five questions, but in the future, please only ask one question per topic. Focusing on one topic helps us build a searchable archive of questions and answers--something like "some technical questions about bitcoin" is hard to categorize and make searchable.

The first transaction in the block is one created by the miner, it pays the miner the current block reward + sum of transaction fees for other transactions in the block (if any). If that block is accepted by other nodes, after 100 more blocks the miner can spend the money. Other nodes check that spending of this new money meets all the rules.

Each confirmation is a block added on top of the prior block. You can't fake that, you have to mine it. You have to provide the needed proof of work. Ordinary non-mining wallets can verify a transaction but can't confirm it.

Each node works separately to decide what is valid and what isn't. The 51% attack refers to percentage of hashing power not percentage of nodes. Consensus is more of an emergent phenomenon, it isn't like explicit vote counting.

They already checked them and don't need to check them again. Nodes typically each keep and maintain a list of unspent transaction outputs (UTXOs) - you can think of a UTXO as a valid coin.

They don't care. They keep track of both. They pick one arbitrarily as true.  They regularly compare amount of work in each branch. It's only later that a branch with more work may require a reorganisation (e.g. of UTXO set etc). This happens automatically and isn't a problem.

Before asking follow-up questions you will find it best to  read some existing answers such as

What exactly is Mining?
How many nodes need to validate a newly created block?
51%


text:
How to get peer nodes information from bitcoin CLI?
I saw a feature called Node Window in the bitcoin GUI environment, that shows information about peer nodes, like User-Agent, Received (Data), Sent (Data), Ip, etc.
How do I can get such information from the bitcoin core full node CLI environment?

The getpeerinfo command returns the same data.


text:
in bitcoin core, how to use Tor for broadcasting new transactions only?
I have set up a full node with bitcoin core running on the internet.  I have also set up a wallet running on a private machine that communicates to the full node to broadcast new transactions.
To enhance privacy, I plan to enable Tor on the full node.  However, it is not clear to me how to use Tor only for broadcasting new transactions from my wallet.
Many tutorials tell you how to use Tor exclusively for everything.  That is not very good, because it wastes bandwidth, is slow and does not help bitcoin community.
Some other tutorials talk about using both Tor and IPv4/IPv6 at the same time.  However, with this setting it is not clear whether new transactions from my wallet are sent out via IPv4/IPv6 or not.  If they do, then you don't have much privacy after all.
Appreciate any pointers on this.

After some digging, I find out more about the answer.

In bitcoin core, it is possible to NOT broadcast your own transactions with "walletbroadcast=0" option
See more details at https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-July/009422.html, https://en.bitcoin.it/wiki/Privacy ("Tor and tor broadcasting"), and https://github.com/bitcoin/bitcoin/pull/5951
However, none of them provided a working script for doing so (I suspect it should be relatively simple, but did not dig in too much)
I'm using Electrum Personal Server (EPS) for my electrum wallet.  EPS happens to support tor broadcasting.  So I'm happy.

You cannot.
The node side of Bitcoin Core treats wallet transactions as any other transaction. They aren't treated any differently from transactions received over the network. So once the transaction is added to the node's mempool, it will be broadcast to connected nodes in the same way that any other transaction would be relayed.
All you can do is to temporarily run Tor only for transaction broadcast.

Thanks for quick confirmation, Andrew.  Isn't this a glaring omission from bitcoin core?  Was my expectation and the rationales behind it reasonable?
I am happy to roll my sleeves and create a patch if the feature sounds desirable to wider audience.


text:
Combine multiple Bitcoin balances into a new wallet?
I need $1000 worth of Bitcoin, but I'm going to use an ATM, and without I.D., there is a limit of $250 per transaction. Could I conduct 4 separate transactions back-to-back, tell the ATM to create a different wallet each time, and then later move those 4 balances into one wallet?

Yes, you can do that.
It is recommended to use a new receiving address for each transaction you receive.
Later, you can send all of the funds from that wallet, to a new address if you would like. But note that doing so will link your 4 transactions together, based on the common input ownership heuristic, so it is not great for your privacy.
If you need to send $1000 worth of BTC to someone, there realistically isn't much of a reason to first send the $1000 to yourself though. You can just send that transaction straight to them.
Note: there are a number of scams which ask you to purchase BTC through an ATM, and then send it to the scammer. Beware of these scams, it is often best to just ignore them, and not pay the scammer.


text:
Are there possible attack/failure scenarios when no new nodes verify old signatures anymore (keeping the assumevalid defaults)?
This question came up in a recent discussion with Hasu and I was wondering if there is a good/practical reason why a newly syncing node should change the assumevalid option to 0 (verifying all the signatures from the genesis block) or is it safe to assume that signatures buried under years and years of blocks are not "worth it" to be verified anymore? Is there anything that can go wrong (either by accident or as an exploit) when no new node verifies the old signatures anymore?

If you assume that a particular block is valid, then you are also assuming that all blocks prior to it are also valid, and by extension, all transactions and their scripts and signatures. This is the basic premise of assumevalid - that a particular block is valid and so is everything that came before it.
This assumption only holds if you assume that SHA256 is collision resistant. Each block commits to the previous block, and each block commits to its transactions and their contents. As long as the hashes are unique, then the assumevalid assumption holds as it would not be possible to produce a valid block of the specific hash.
However, if there were a SHA256 collision, it would be possible to produce a transaction with the same hash as another transaction but different contents. This would then break the assumevalid assumption as an invalid transaction could be inserted into the blockchain which would then result in a different UTXO set at the specified block hash. AFAIK, this is the only scenario where it would not be safe to assume that all scripts are valid.
But there are no known collision attacks for SHA256 and it is believed to be collision resistant. And so with that assumption, the assumevalid assumption also holds and so it is safe to not verify old scripts.

Thx. So beyond the SHA256 security assumption, do I understand it correctly that in the theoretical case in which no node on the network has ever verified scripts up until the assumevalid block, there are no systemic risks (neither for the individual node nor for the network as a whole)?
Fwiw, this post also was helpful: https://bitcoin.stackexchange.com/questions/59940/what-are-the-trust-assumptions-in-assumed-valid-in-bitcoin-core-0-14


text:
What happens if a miner deliberately ignores a transaction, and "wins"?
Suppose a miner decides to solve the nonce for a particular block, where the miner deliberately excluded a particular transaction from this block. The miner "wins", i.e. they found the nonce value that, when added to the string of the modified block they were trying to solve, hashes to a number below the target number. They send the solution to the network.
Does their block, that ignores the transaction, get accepted by the network? If so, what happens to the ignored transaction? If not, why not?

Miners have complete perogative over what transactions to include. They may include random transactions, the highest fee paying transactions, just their own transactions, or no transactions at all.
If a miner doesn't include a particular transaction from their mempool, it stays there. It will be available for later miners to pick it up and include in their blocks later.
To incentivize miners to include your transaction, you can include a fee. Miners in practice will pick the transactions with the highest fee first. First matters, because blocks have limited capacity, and so there may be more transactions on the network than can fit in a block.

Thanks for answering. So can a miner get away with double-spending if they double-spend, and then solve a block that contains only one of those spending transactions?

In case there are two conflicting (but otherwise valid) transactions, miners can choose which ones makes it. That's their primary function.


text:
How new nodes synchronize with ledger ?
I read several articles about how Block chain works, but didn't found any explanation about the following issue:
When new nodes (with empty ledger) entered to block chain, how they can check the correctness of the transaction, if their ledger is empty ?
How new nodes get synchronized with the block chain (get the list of the blocks, and all the history of the transactions ) ?

When new nodes (with empty ledger) entered to block chain, how they can check the correctness of the transaction, if their ledger is empty ?

It cannot. It must sync the entire blockchain first.

How new nodes get synchronized with the block chain (get the list of the blocks, and all the history of the transactions ) ?

A new node will connect to other nodes in the Bitcoin network. It does this through the peer discovery mechanism which uses DNS seeders and seed nodes to find nodes to connect to. From there it requests from its peers the blockchain and is thus able to download the entire blockchain. Of course the new node will also fully verify all blocks and transactions in what it receives to ensure that the data is correct and valid.


text:
What is the proper way to import a wallet from a file after removing it completely
Just wanted to ask a question about "importwallet" bitcoin-cli command.
After starting my bitcoind daemon, created a wallet, protected with a passphrase and made a backup to a file:
bitcoin-cli createwallet wallet1
bitcoin-cli encryptwallet mypassword
bitcoin-cli backupwallet ~/wallet1.backup

I want to test if I am able to recover my backuped wallet. This is what I am testing:
bitcoin-cli stop
rm -Rf ~./bitcoin/wallets/wallet1

And then start again my bitcoind server. At this point I want to import my wallet. I try this:
$ bitcoin-cli importwallet ~/wallet1.backup
error code: -18
error message:
No wallet is loaded. Load a wallet using loadwallet or create a new one with  createwallet. (Note: A default wallet is no longer automatically created)

But as you can see, the bitcoin-cli is requesting to create a new wallet. Just to import an existing one? I don't understand that point.
For this particular example, what should be the proper way to import the wallet? Tnks!

What you are looking for is the restorewallet RPC. As of 2/2/2022, this has not been included in a release of Bitcoin Core (although it is in the master code branch on GitHub). It will be included in the v23 release, expected in April 2022.
restorewallet "wallet_name" "backup_file" ( load_on_startup )

Restore and loads a wallet from backup.

Arguments:
1. wallet_name        (string, required) The name that will be applied to the restored wallet
2. backup_file        (string, required) The backup file that will be used to restore the wallet.
3. load_on_startup    (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.

Result:
{                       (json object)
  "name" : "str",       (string) The wallet name if restored successfully.
  "warning" : "str"     (string) Warning message if wallet was not loaded cleanly.
}

Examples:
> bitcoin-cli restorewallet "testwallet" "home\backups\backup-file.bak"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "restorewallet", "params": ["testwallet" "home\backups\backup-file.bak"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
> bitcoin-cli -named restorewallet wallet_name=testwallet backup_file='home\backups\backup-file.bak"' load_on_startup=true
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "restorewallet", "params": {"wallet_name":"testwallet","backup_file":"home\\backups\\backup-file.bak\"","load_on_startup":true}}' -H 'content-type: text/plain;' http://127.0.0.1:8332/

The importwallet RPC is used in a different scenario, to import a list of keys from a dumpfile (a plaintext list of keys generated by the dumpwallet RPC).
To restore a backup with v22 and below, simply:

navigate to your wallets/ directory in your bitcoin data directory
create a new directory inside wallets/ with a unique name of your choice for the restored wallet.
Copy the wallet file into this newly created directory, and rename it to wallet.dat
Start bitcoin core, and you should be able to load the wallet.

I am getting this error:
$ bitcoin-cli restorewallet "wallet1" "/home/user/wallet1.backup"
error code: -32601
error message:
Method not found
It seems restorewallet is not included in my version?
$ bitcoind  --version
Bitcoin Core version v22.0

Huh, good point. It was merged in August but only just missed the v22 release. I'll update my answer with an alternative method.

That works! :-) This was really helpful both to understand why the "restorewallet" was not found and for the workaround to make this working. I'll check the next version in April. Thank you for the explanation!


text:
Is periodically transferring Bitcoin from an exchange to a private wallet cost effective?
I'm new to this, I've read a lot about it and I've decided to start saving money on Bitcoin by buying a fixed amount every month.
I know it is safer to store my Bitcoin on a private wallet instead of having it on the exchange I'll use to buy. But I know that moving it from the exchange to the wallet will incur a blockchain fee.
It feels to my that by moving Bitcoin to my private wallet each month I'll be constantly paying and would be cheaper to just store it on the exchange.
What are your thoughts on this? What's the must cost effective way of moving it to my wallet? Will doing this once a month be as costly as doing it in larger amounts once a year?
I'm looking to hold for a long time.
Any advice will be much appreciated. Best.
PS: I've done my research before asking here but couldn't find a good answer.


text:
How do I accept Bitcoin Cash without using a third-party?
I'm looking for a way to accept Bitcoin Cash on my e-commerce site without using a third-party payment processor such as Rocketr. Third party services would not be ideal for me because:

I would not hold the private keys to my Bitcoin Cash.
I would pay a fee for each transaction.

Seeing this as the case, I'm only willing to use software on my own servers to accept Bitcoin Cash in a security-minded way.
Here's my current approach:

Have two servers: Server A, which runs Apache; and Server B, which runs a Bitcoin Cash wallet such a Bitcoin Unlimited.
Server A requests addresses from Server B through the JSON-RPC interface.
Server A displays the address to the user and pings Server B at intervals until the payment is confirmed.
The user sees a confirmation page and the order is complete.

Advantages to this approach:

I hold my private keys.
I would not have to "refill" the server with public keys.
Private keys (theoretically) never leave Server B.

Disadvantages:

Both Server A and Server B must be online in order to accept transactions.
Server B must be configured in a way so that the commands dumpprivkey, dumpwallet, createrawtransaction, and send* are disabled. (How?)

So, is my approach the way to go, or is there a superior alternative?

There are POS software for that. Here's the list: https://github.com/dsmurrell/awesome-bitcoin-cash#point-of-sale-systems
If you'd like to use an HD wallet, I suggest Pyxpub.

Your Bitcoin cash server may be a target for many since it has all the private keys.
I would suggest you get one private master key and public key.
use your public key to generate addresses and your private key to spend Bitcoins.
You can createrawtransaction and all the other commands using PHP or javascript without the need to have a running server.
these libraries are helpful: bitcoinlib-js for javascript and bitcoin-php for PHP
You may need a server just for broadcast a transaction if you want to send bitcoins. you could use your own server or use public servers like electrum servers or blockchain.info


text:
What is the purpose of the 20 XRP cost to start a wallet?
Does the money stay in the wallet or is it used to pay for something?
If it's used to pay, who does it go to?
If it stays in the wallet, am I allowed to take it out and drain the wallet later without any consequences?

Unlike a bitcoin receiving address, a funded Ripple wallet is a real thing on the ledger that has properties. This has advantages and disadvantages, but one of the disadvantages is that there's a cost associated with having one. To cover the costs imposed on the network, the XRP Ledger has a "base reserve" that is XRP that is not spendable or transferrable. You can use the reserve to pay transaction fees and, if the reserve drops, you can transfer out XRP to the new reserve level.
Some of the advantages of this scheme include:
The ability to change the key protecting an account without changing the receiving address.
The ability to configure an account for multisign and change the keys, signers, or quorum, again all without changing the receiving address.
Addresses can configure what assets they're willing to accept as payment and payments to them can automatically route through intermediary assets to find the cheapest path.
Accounts can place offers to trade one asset for another on a distributed exchange that follows deterministic rules.
The reserve goes up (currently by 5 XRP) for every additional object an account owns in the ledger (such as a trust line, offer, or escrow). You can reduce your reserve by eliminating these objects, but current rules do not allow the base reserve to ever be transferred or spent -- it covers the cost associated with recording the fact that the account has already performed certain transactions and without this recording, those transactions could potentially be replayed.

What dos this statement mean in the post above "The reserve goes up (currently by 5 XRP) for every additional object an account owns in the ledger (such as a trust line, offer, or escrow)" Dos this mean you loose more than 20 Ripple when sending somewhere ? It is not clear what a additional object is / trust line ? Thankyou if you are able to clarify

You never really lose anything, It's just XRP that can't be transferred, though it can be used to pay transaction fees. So if you have three offers on the books, your reserve would be 35 XRP, and if you had 50 XRP, you could only transfer or trade 15 XRP.

In order to activate the wallet, you need to send 20 XRP to it. You don't lose this money in any way, it's yours to use after you get 20 XRP. Note that you can send 20 XRP over multiple transactions, but you're wallet will show a balance of 0 XRP until all transactions are confirmed. Then the true balance of the wallet will show up.
You can go below 20 XRP anytime, but your wallet will become temporarily disabled. This means you cannot send any more transactions from that wallet. You would need to send it more XRP to reactivate it.
This is analogous to a bank account with a minimum deposit. This documentation goes more in-depth about the purpose of the threshold.

You can send transactions from a wallet whose balance is below its reserve. You just can't spend or transfer out XRP.


text:
2-of-3 multisig with Schnorr signatures
From what I understand, Schnorr signatures will allow n-of-n multisignature transactions, however m-of-n isn't possible using the key path alone.
Or is it?
Suppose we need a 2-of-3 scheme. As far as I can tell, we can use a 3-of-3 scheme and just give each party two of the three keys in such a way that any two parties when combined will have all three keys. (One party gets keys A and B, another one gets B and C and the last one gets A and C.)
Would this method work? Is there some problem I don't see?

From what I understand, Schnorr signatures will allow n-of-n multisignature transactions, however m-of-n isn't possible using the key path alone.

That's not quite accurate. Schnorr signatures, as described in BIP340, are purely 1-key-1-signature.
Alternative schemes, which are compatible with BIP340 validation, exist.

One is MuSig (1,2,DN) which permit n-of-n signatures, verifiable against a single aggregated public key, which represents the agreement of all consituent keys.
Another one is FROST, which permits arbitrary k-of-m thresholds, similarly verifiable against a single key. It needs an interactive setup however, where the (potential) cosigners need to cooperate (while having access to their private keys) to construct the aggregate key, so it isn't compatible with e.g. having a multisig wallet whose addresses are derived on the fly using BIP32 keys. It also lacks accountability: you cannot after the fact tell which parties signed.

Suppose we need a 2-of-3 scheme. As far as I can tell, we can use a 3-of-3 scheme and just give each party two of the three keys in such a way that any two parties when combined will have all three keys. (One party gets keys A and B, another one gets B and C and the last one gets A and C.)
Would this method work? Is there some problem I don't see?

Yes, this is possible. If you generate all 3 keys on one machine, you get a somewhat uninteresting security model, as you apparently all 3 have one machine you trust to do key generation honestly. You could probably equally agree to let that machine do the signing.
A variant of what you suggest is perhaps more interesting: each of the 3 parties generates 1 key, and gives the private key to their right hand neighbor. Now any subset of 2 of them has all 3 keys.
More schemes like this exist. The simplest one is an unaccountable interactive-setup 1-of-n scheme: one party generates a fresh key, and gives it to all others. Done.
I don't recommend using this though, while deceptively simple, the devil is in the details to make such schemes secure, and you're probably better off using FROST or something similar instead, as it's well analyzed.
If you want accountability, or non-interactive setup (the ability to generate addresses without having the cosigner keys online), none of these approaches are sufficient, and you should probably use (in the context of BIP341) a tree where every leaf is a 2-of-2 musig aggregate of 2-of-3 subsets.


text:
How are the transactions chosen from the Mempool if every node has its Mempool?
I have this scenario:
So whenever a wallet user is initiating a transaction, this goes as far as I understood into a Mempool. And that each node has its own Mempool.
I have some questions though: Do every node get all the transactions in their mempool, meaning it's like a syncronisez place where everybody can see the same transactions? If so, how does the rest of the network of miners know that the transactions they have chosen from the mining pool isn't already being mine by another miner?
Or each and every node get different transactions in their Mempools? If so, how is the transaction broadcasted? Does it go randomly to some miner's mempool?
Thank you for your patience!

When a new transaction is broadcast, it will be passed from the originating node to all available peers. Those peers will then pass it to all of their peers, and so on, until (hopefully) every node in the network has heard about the transaction. Each node can keep a mempool if they so choose, and that mempool will store all of the transactions they have heard about recently. Node operators can configure several variables in their software to only store a certain certain amount (in bytes) worth of txs, to only relay transactions that are above a certain fee rate minimum, etc.
The mempool of each node may thus be a little different, there is no consensus enforced on what is stored in the mempool of each node. In fact, a node operator may choose to not keep a mempool at all!
Miners will run full nodes that communicate with the network, this is how they hear about new transactions to include in the blocks they are mining. Once a new block is found, the miner will broadcast it to the network. As each node hears about the new block, they will work to independently validate the block and all of the transactions in it. Part of this process involves identifying which transactions are confirmed in the block, and removing those transactions from the node's mempool. Soon after hearing about a new block, each node's mempool will be updated to remove the now-confirmed transactions.

Do every node get all the transactions in their mempool, meaning it's like a syncronisez place where everybody can see the same transactions?

There is no enforced synchronization or consensus or mempools, but many mempools will likely have many of the same transactions stored at any given point in time.

..how does the rest of the network of miners know that the transactions they have chosen from the mining pool isn't already being mine by another miner?

Chances are there will be a large overlap in the transactions stored in each miner's mempool. When working on a new block, miners will use transaction from their mempool, but it doesn't matter if more than one miner tries to mine a block with the same transactions in it. Eventually one of the miners will find a valid block, and upon broadcasting it to the network, the other miners will simply update their own mempools to remove the now-confirmed transactions that were included in the last block (in the same way any other node will). Then the process starts all over again, with everyone racing to mine the next block, again using the unconfirmed transactions they have in their local mempools.


text:
At what prices I will be buying/selling bitcoins?
Scenario 1:
I bought k bitcoins at unit rate X in the past, with amount A. If I want to sell them now, I look at three unit prices:

Buy Price
Sell Price
Spot Price

Question # 1: At which price I will be selling the k bitcoins that I have?

Scenario 2:
I have A dollars with me and I want to buy bitcoins with it. I am looking at 3 unit prices:

Buy Price
Sell Price
Spot Price

Question # 2: At which of these unit prices I will be buying the bitcoins?

For the sake of understanding, lets say I am using either Coinbase or GDAX
List item
to buy/sell in both above scenarios.
Thanks

Scenario 1
Using a simpler example, if you visit bitcoin.com.au to sell Bitcoin you will get the sell price for k Bitcoins. In this example, it is a spot sell price.
Scenario 2
Using a simpler example, if you visit bitcoin.com.au to buy Bitcoin you will pay the buy price for k Bitcoins. In this example, it is a spot buy price.
Elsewhere
On market exchanges, the buy and sell price are market indicators. These are the general level of the buy and sell orders. You can creae a buy or sell order for, usually, any price you like but the indicators show current trade values.
If the exchange lists a spot price, this is usually their spot buy price, for if you wish to sell to the exchange directly without creating a market order and waiting.

Simpler exchanges which offer direct buy/sell will usually try to avoid holding a position. Although it's not visible, their orders are usually backed by larger market makers, who rely on order books from multiple exchanges (which is why you see larger spreads when buying on Coinbase vs GDAX, since Coinbase will try to ensure an order will go through by going deeper into the order book than GDAX, so that other users' trades will not usually impact each other instantly)

It depends on if you are adding or removing liquidity from the market. i.e., if you are placing limit or market orders.
Order books are divided into asks and bids. An ask is the lower price that someone is willing to sell their asset for, and a bid is the highest price that someone is willing to pay for an asset.
An order is executed when an ask is matched against a bid, or vice-versa. If you enter an order for which the corresponding liquidity is already available, you are effectively placing a Market order - It will be executed immediately.
If you enter an order that is far enough from the ask/bid to execute immediately, it is a limit order. You will end up with an entry in the order book, and someone has to place an equivalent order at your price (but in the opposite direction) before your trade goes through.
For example, Alice has 1 BTC and is willing to sell it for $1000. Bob has $990, and is willing to buy 1 BTC.
The order book in this case has an ASK of $100, and a BID of $990. Since there is no match between the ask and the bid, no trade happens. These are limit orders, which means they will only execute at that price.
Now John comes in and puts an order to buy 0.5 BTC at $1000. Since Alice is already offering 1 BTC at this price, half of her order is filled, and all of John's order is filled immediately. Since this is removing liquidity, it is essentially a market order (even though it was placed as limit). The order book is now ASK 0.5 BTC @1000, and BID 1 BTC @ 990.
Now let's say Smith comes in and places a market order for 1 BTC. When placing a direct market order, you don't specify a price. You will automaticaly trade at the lowest ASK/highest BID depending on the direction of your trade.
Since our order book only has 0.5 BTC available for sale, the 1 BTC market order only fills 50%.
In short, the price depends on the type of order you use, and how much liquidity there is in the market. The spot price is simply the last price a trade was executed at, and there is no guarantee that there is liquidity available at the spot price (the last trade may have consumed all the liquidity).

Its so confusing. Let me re-iterate. In an exchange scenario (lets say coinbase.com), I am getting three unit prices like (buyprice, sellprice, spotprice). I have k bitcoins with me. At what price of the three i will be selling my k bitcoins? Similarly, if I have $$, at what price of the three will I be buying bitcoins?

It depends on how much is available for sale/buys at what price. If you are selling more BTC than people are buying at a particular price, you will either not be able to sell all of it, or sell parts at different prices, lowering your average sale price (this is known as slippage). The same thing works in reverse when buying

Hmm..but being a consumer using an app, it shows me a price at which i can sell or buy. What is that price in the case of a buy, and what is that price in the case of a sell?

That would depend on the app, how deep their order books are, whether they impose an artifical spread, and a number of other factors. It's really difficult to explain this for specific apps. I suggest you read some guide on how markets are made, it would clear it up a lot better than trying to explain in comments. money.stackexchange.com might also offer some better insights

@khan If I go to bitcoin.com.au and sell Bitcoins I get the sell price for k bitcoins. If I buy, I get the buy price for k bitcoins. Elsewhere, they list the market buy and sell price, where you can register a transaction and wait for the market to pick it up. In that case, the spot price is usually how much the exchange is willing to pay to buy directly.