What alternatives are there to hardcoding checkpoints into the Bitcoin client? Checkpoints seem like a crucial part of the security & validation apparatus in Bitcoin. Is there a written policy in place, among the developers defining the maximum interval between checkpoints?

What happens when the Bitcoin client becomes mature and releases are fewer and farther between. Has some other mechanism for checkpoint-like functionality been proposed?

Checkpoints serve two purposes:

They hardcode a historic part of the chain
They allow us to disable a check (expensive signature checking) in that historic part.

I personally dislike the first part, as it requires users to trust the software they're downloading contains the right checkpoints. Of course, they're already trusting the code anyway in much more substantial ways, but just requiring some piece of data to be updated frequently in a trusted way, to keep up with the block chain validation performance feels wrong to me. Of course, we can't have the second part without the first. Or can we?

There is a proposed idea, which isn't is implemented, to modify the synchronization mechanism to consist of two steps:

In a first step, only headers are downloaded and verified, in much the same way as blocks are now downloaded and verified. This will result in the client knowing the best valid chain of blocks, except it won't know whether the transactions in it are valid.
In a second step, the actual blocks along this chain are downloaded and verified.
Such a mechanism has several advantages, including being able to distribute the synchronization over several nodes, and not risking downloading side chains (sometimes called orphans).

In addition, it could have a rule "Do not validate signature checks if a block has N blocks on top of it". Since the client already knows there is a valid chain before doing the full transaction validation, there is no need for checkpoints to prevent getting a wrong chain.

Of course, this will have to be thought about a lot before implementing it, but I believe it will allow us to not rely on checkpoints anymore.

EDIT:
Benefits of checkpoints can be realized in better ways like assumevalid .

Recent versions(>= 0.14) of bitcoin core come with option --assumevalid <safe-block> . This gives the benefit of skipping signature validation upto the safe-block without hardcoding the history. If another heavier chain is seen which does not contain the safe block, the bitcoin software will correctly reorg to the other chain.
More Info: What are the trust assumptions in --assumed-valid in bitcoin core 0.14?


How do I compile Core 0.8.6 on Ubuntu (EC2)? I'm trying to compile v0.8.6 of the core client from source, in order to compare IDB (Initial Blockchain Download) performance between versions.

I created a fresh Ubuntu Xenial 16.04 machine on Amazon EC2. I then ran the following commands (which were sufficient for version 0.9.3 and up):

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential autoconf libboost-all-dev \
                     libssl-dev libtool pkg-config libevent-dev

In addition for this specific version I ran:

sudo apt-get install libdb++-dev libminiupnpc-dev

I then checked out the source and started the compilation:

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v0.8.6
cd src/
make -f makefile.unix

I'm only interested in running headless bitcoind, but I'm not sure if it was already separated form the UI at that release.

I get the following error:

rpcrawtransaction.cpp:241:77:   required from here
/usr/include/boost/variant/get.hpp:178:5: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’
 BOOST_STATIC_ASSERT_MSG(
 ^
makefile.unix:172: recipe for target 'obj/rpcrawtransaction.o' failed
make: *** [obj/rpcrawtransaction.o] Error 1

Interestingly 0.7, 0.6 and 0.5 do compile successfully, although they get stuck during IDB, so perhaps compilation just failed silently. I'll make a separate post for those later.

I suspect that I need to install some very specific versions of dependencies, but I'm not sure which and how to go about that. I haven't used Linux in years.

I still have the VM, so I can provide more details if needed.

I'm open to alternative approaches, even using a Windows VM :-)

You can use the gitian build system. Instructions for building 0.8.x with gitian are available here: https://github.com/bitcoin/bitcoin/tree/0.8/contrib/gitian-descriptors and here: https://github.com/bitcoin/bitcoin/blob/0.8/doc/release-process.md. Using gitian should get you exactly the same binaries as those that were released.


unrecognized output wallet when using Electrum to send bitcoin help me understand this transaction - https://www.blockchain.com/ro/btc/tx/1318a3e54cff78fdd8f6b54e6fe5115072586091788c9bfa08ca82d83e4bc276 .
Never sent bitcoin from hardware / hot wallet before so I am new to this
So I tried a demo send from one wallet ****c276 to my crypto.com wallet **xmhue

so I understand that my wallet was converted to a new wallet ****qhev with the remaining amount

what I don't understand:

0.001 of my bitcoin got sent to the correct crypto.com wallet, but 0.001 of my bitcoin got sent to a unrecognized wallet - ***myAn - I don't understand what this is
I don't know how Electrum chose that wallet for sending the payment , is the choosing of the wallet automatic from Electrum ?

I don't know how Electrum chose that wallet for sending the payment , is the choosing of the wallet automatic from Electrum ?

Maybe its a change address. You can read about change addresses in the below links:
What does change address mean inside Electrum wallet?
What all the addresses are in my Electrum wallet?

I am not sure why change address is starting with "3" which can be a p2sh-segwit address because input address bc1qxesjp5g4d23kpt9xghwxlu4mfhu9xxrehp0ytnm023ely43kdh9spsy4k7 is most likely an address from 2 of 3 multisig wallet with p2wsh addresses.


How Bitcoin dose find and verify UTXO ? is this efficient? If Bitcoin sees all blocks, it will be very slow based on chain length and block size but, it can certainly verify incoming transactions.

I know that blockchain is never modified any previous block. so if user consumes own transaction, Bitcoin dose just create new TXO which is reference to UTXO. so it is two penalty. one is that our disk is quickly filled and lastly it must check all the blocks to see whether TXO(reference to UTXO) is existed or not.

I have a good idea. that is we should mark something in the UTXO. so it gives two good points. one is that we don't need to create TXO to figure out whether UTXO was used or not. and lastly we don't need to fill our disk with TXO.
But my idea has strange point that information of transaction already written on block should be modified.

How think about it? I would like to discuss about my point.

Sorry for my English.

How Bitcoin dose find and verify UTXO?

By Bitcoin, I think you must mean "Bitcoin core" - the Bitcoin wallet software derived from the original reference implementation by Satoshi Nakamoto. The word Bitcoin also encompasses the specific set of concepts outlined in the Bitcoin whitepaper, the network protocol definitions, the Bitcoin improvement proposals (BIPS), the worldwide network of Bitcoin nodes and Bitcoin users, etc.

How Bitcoin core manages UTXOs is probably best answered by inspecting the source code. I can however make some guesses, which even if wrong will show that the issue which concerns you is a non-issue.

Bitcoin core maintains several sets of data files. One of these is the wallet.dat file. Another set is the blockchain data itself, represented in a series of files. There may be other sets of data.

  I know that blockchain is never modified any previous block

Yes, but that does not mean that some Bitcoin software has to have a persistent storage format that exactly follows the over-the-network blockchain block layout. The software could store the data in a normalised SQL database and only reconstruct the blocks when it needs to re-verify the hashes, signatures etc - which would normally only be needed to be verified once when the block is first received. Such a data storage arrangement would allow lots of additional fields and associated tables to store extra information such as a flag showing whether a TXO had been subsequently spent (hence no longer a UTXO). Alternatively the Blockchain data could be stored in files exactly as received and ancilliary files used to store additional indexes of block-numbers and transaction-IDs associated with addresses of interest or a table of UTXOs that are added to and deleted from as blocks arrive and are verified and processed.

  it must check all the blocks to see whether TXO(reference to UTXO) is existed or not.

No, it only needs to check each block once. After that it can consult an efficient index into a separate small efficient table of current UTXOs which it maintains independently of the actual blockchain data.

  I have a good idea. that is we should mark something in the UTXO

Effectively this is already done. Except that most likely the mark is not made in a copy of the blockchain block structure but in separate data structures that Bitcoin core maintains for this purpose.

There is no need to alter the agreed Blockchain data structure that is used to transmit blocks between nodes.

It is not necessary for any node's software (wallet or not) to store Blockchain blocks at all, especially not SPV wallets. They are all free to choose any internal storage implementation and formats that their designers feel addresses their goals.

Nodes may need to be able to transmit to other nodes, requested blocks that they have previously received. But this could be achieved by reconstructing blocks from other, completely different and more comprehensive, storage formats.

  I would like to discuss about my point.

Please note that this is a Q&A website not a discussion forum. Try our chat room or some other website (e.g. reddit, facebook, twitter, etc)


What escrow system does the official Bitcoin bounty progam use? There is a list of bounties on the wiki here:

https://en.bitcoin.it/wiki/Active_Bounties

How are the BTC pledges collated and eventually paid? I assume there is some kind of escrow system but I can't find out anything about it.

Multisignature transactions can act as escrow.

A transaction could require a party and a trusted third party to complete, or it could be the trusted third party alone who signs to complete the transaction.


How is the Merkle Tree sequentially propagated, and are the parts addressed? When downloading the Merkle Tree, are all branches from the root downloaded in order?

Are the individual pieces of the tree cataloged in such a way so that the position of each piece is known?

In short, how does one know what piece of the tree goes where?

The Merkle tree isn't included in the download data.  Just the root hash is included in the block header.  The client has to reconstruct the tree in order to verify the root hash.  It does this by going through the transaction list as it appears in the block data.  Each transaction hash is a node at the top of the tree.  So, if you have 6 transactions, you have 6 nodes (the last transaction hash is repeated if you have an odd number of nodes).  Then the next level of the tree is computed where each node is formed by hashing the two nodes above it (again, the last node is duplicated if you have an odd number).  This process continues until you have just one node - the root node.  It is checked against the root in the header to make sure it matches.  If it does, you know the transactions have not been modified.  Note that the block hash is only over the block header and does not include the transactions themselves.

Here is an example with 6 transactions (Tx1-Tx6)

Tx1    Tx2    Tx3    Tx4    Tx5    Tx6
    \   /        \    /        \   /
     L2A -      -  L2B          L2C -     - L2C (repeated)
          \    /                     \   /
            L3A  ---            ----  L3B
                    \          /
                         Root


How secure is Secure Print? Armory gives the option of Secure Print for making paper backups. I understand that the developers give this option in case your printer stores a cache, or if the wallet could otherwise be compromised in transit from your computer to your printer. In other words, it is not intended as an encrypted paper backup, but just as a feature to help securely print your paper wallet.

My question is, even though this feature was not intended to make an encrypted paper backup, is it secure enough to enable one to widely disperse paper backups, assuming  only the actual wallet owner controls the generated password (which I think is around 10 characters)? What type of encryption cipher does it use?

The source code (qtdialogs.py) has this to say about SecurePrint:

  # USE PRINTER MASK TO PREVENT NETWORK DEVICES FROM SEEING PRIVATE KEYS
  # Hardcode salt & IV because they should *never* change.
  # Rainbow tables aren't all that useful here because the user
  # is not creating the password -- it's *essentially* randomized
  # with 64-bits of real entropy. (though, it is deterministic
  # based on the private key, so that printing the backup multiple
  # times will produce the same password).

So it is 64-bit, or ~10^19 combinations. Armory uses a scrypt-based key derivation function for the SecurePrint code. It takes a noticeable amount of time (not long at all, but not seemingly instant) on my computer to calculate the wallet keys/ID from the SecurePrint code. Let's say an attacker has your printout, and it takes 0.1 seconds per attempt. He would need about 58 billion CPU years to find the right private key by guessing the SecurePrint code. So yes, it would appear that it is secure enough to disperse paper backups, as long as you're not going to have an extremely valuable (e.g. billions of dollars) wallet.

You might consider whether scrypt ASICs (which will come in some form, unless Litecoin and its kin die off) can attack your key as well. I wouldn't expect it to be faster by a factor of 500 billion (which would put the time down near a month), but if you consider this to be a "lifetime wallet", you might not want to have this as a potential weakest link.

Warning: I'm not an expert in Armory, just some guy who took a look at the code and knows a bit about cryptography. If you decide to post your SecurePrint-secured paper wallet all over the Internet and someone steals your bitcoins, don't come crying to me.


Why has Intersango stopped accepting UK bank transfers? http://www.reddit.com/r/Bitcoin/comments/ztjcf/intersango_no_longer_accepting_uk_bank_transfers/

  I hadn't been on the site in a while, but last night I sent £30 to
  Intersango, only to find out today that they no longer accept
  transfers. Have opened a ticket with them but am a bit worried that my
  money will be lost in the ether!

Was the a formal announcement? Do they expect bank transfers to resume?

What's the deal?

In the UK, banks are free to discontinue providing a banking relationship with certain customers.  Metro Bank chose to do so with Intersango.  They now have no bank in the UK, and there is very little trading on their BTC/GBP market since the August 30th action as there are no methods for moving GBPs in or out..

There have been no mentions that I've seen of this being resolved anytime soon.

http://bitcointalk.org/index.php?topic=63877.msg1122824#msg1122824

For updates, see Intersango's status page.


Why the signature of the same message changes in some wallets, but not all? Using the "message signing" feature in the Bitcoin and Dash it's static with the same message. Signing the same message with the same private key will result always in the same signature.

This behavior is not the same in Peercoin or in the old wallet of Bitcoin. In these wallets, the signature changes even if both messages are equal, for me it has some "nonce" inside.

Example:

Message: xxx

Address: 18ZbyqYYwgEmn5hVMtJpihPeYxsUpCLhr7

Bitcoin 0.8.5-beta:

INbwudFmql3iOH6c1UWylOpgLu5zrrqGrcFCanirz+Zb/nmJkcDXSkug5J0s3Yawb1/GzZKqXVjRHRNVSenRdMI=
II7W5su7EBQ4u1ppSKMVcmy8etnJsSOsvQHZ3j+moJs2P/vjwpqMlZkvOQ+W5odCdmwOz/5wK2T0RDV6aiqaEQs=
H7XNf5of1kmpwvcvLqVKIYc3TY5eN3kIrZWJPlDYhKVZekZ7Xk2qnJWjNDdsODkYtLEYn5p6fJfIC9LR+/rQky0=

Bitcoin 0.14.2:

IBl6SRpJwzGjXTDbO/IuUcHzlbxqbzN+MmeGRLRIAcPjKpQ9XgQG+gBOzo5PcgtBbtDqXhJIKnbUH9vEcQ5CNlM=
IBl6SRpJwzGjXTDbO/IuUcHzlbxqbzN+MmeGRLRIAcPjKpQ9XgQG+gBOzo5PcgtBbtDqXhJIKnbUH9vEcQ5CNlM=
IBl6SRpJwzGjXTDbO/IuUcHzlbxqbzN+MmeGRLRIAcPjKpQ9XgQG+gBOzo5PcgtBbtDqXhJIKnbUH9vEcQ5CNlM=

In the old Bitcoin-qt the same message with the same private key create different signatures. But in the new Bitcoin-qt it's result in the same signature.

What is the difference between this signature method? Have an alternative to continue getting the PK from a signature in the second case? Have name of this specific change?

You're seeing the effect of RFC6979.

When generating a signature, some randomness is needed (called the nonce), as there are multiple valid signatures for the same message/key pair. The algorithm used, ECDSA, is extraordinarily vulnerable to weak randomness. An attacker who knows just a slight bit of information about your nonces can learn your private key after observing many signatures.

However, someone figured out that it doesn't need to actually be random. The only thing required is that it is unpredictable for the attacker. As a result, a standard was created that suggested using basically the hash of your private key and the message as your nonce. That standard is called RFC6979, and Bitcoin Core switched to using it in version 0.10.0. Clones that forked off before that version typically don't use it.

I have no idea why pubkey recovery does not work without deterministic signatures. I think it should work fine.


Is there a class or sequence diagram for BitcoinCore? I'm looking at the code located at https://github.com/bitcoin/bitcoin/tree/master/src

Does anyone have a basic diagram of what calls what, just a sequence chart of how all the classes piece together and what's a good entry point.  There was a thread with some overview but there has been a lot of change since it seems.  Just wondering if anyone has gone through this process.

You can use source code browsing tools like Source Insight(proprietary) or doxygen(Free software) to create dependency diagram of functions and files.

The doxygen documentation for Bitcoin source can also be found at https://dev.visucore.com/bitcoin/doxygen/


How do I access coins purchased at ZipZap using a moneygram? I used a moneygram to purchase some Bitcoins.  Using the information I  got from ZipZap, I was able to get the address where the money was sent and through block explorer that it is there.  I have the ScriptPubKey that contains (I hope) what I need to do to get the coins.  Unfortunately, I have no idea how to get at it.  I have very little knowledge of programming or coding.  How can I release this information without going back to college?

If you purchased coins you probably gave them an "address" to send it to.  Although "address" is the preferred terminology it can be called a ScriptPubKey.  Sounds like someone is being too technical and requiring too much college (as you put it).

The question is, how did you generate or create the address?  There are two halves to an address.

The address itself, and analogous to a PO Box. It's fairly anonymous, and secure.  You can deliver to it...  but can only take things out of it if you have a private key.
The private key (not to be confused with ScriptPubKey).  This is a secret to be protected.

I have never used ZipZap, so they will either ask you for an address to send coins to, or they will give you a voucher at Mt Gox.

You'll need to give us more information about how you purchased the coins, or contact ZipZap themselves.


Why does Mt Gox disallow YubiKeys purchased direct from Yubikey.com? I have several Yubikeys and would like to use one or more with MtGox.... however it seems that I can only use keys purchased from Mt Gox on their site.

Why did Mt Gox choose to implement security this way?
Suppose I'm creating my own secure website based on Yubikey.. what are the conditions that I would choose to implement a "closed" system like this (and not allow other Yubikeys)?

I asked Mt Gox support this very question and all they told me was:

  Hello, Thank you for the email. Please note that the yubikeys
  has to be pre-configured with our systems, so unfortunately it is not
  possible to add yubikeys that are purchased outside. Thanks, MtGox.com
  Team

... so I'm hoping to get a better understanding on why this choice was made.

Properties of a yubikey:

A yubikey contains a secret symmetric key.
Knowledge of this key allows emulating that yubikey.
The server needs to know that key.

  The YubiKey AES Key information can never be extracted from a YubiKey device – only programmed to it

So Mt.Gox's insistence on sending the key to you ensures several important properties:

You're not tempted to use the same key to authenticate to other websites, which would allow those websites to break into your Mt.Gox account
You don't need to send the key to the Mt.Gox server through your potentially insecure computer
Nobody but Mt.Gox knows the key stored in your yubikey

So pre-programming yubikeys and sending them to you only after the key was programmed into the device rules out several possible threats, and thus seems reasonable risk management.


How do I open up the transaction dialog popup in Ardor Ignis via the URL parameters when the wallet gui loads in the browser? I'm able to get to open up the wallet gui via the browser and go straight to the asset page, but how do I open up a transaction popup?

I don't think there's a way to open up popups using just the URL, because it's not built inside the codebase.

The only reason you were able to go to a specific page was that there's a loader function for that page.

For instance, loadAssetFromURL() for the asset page in ardor/html/www/js/nrs.assetexchange.js


How can you view the Ripple orderbook without being logged in? Is there a service that exposes the orderbook without requiring a Ripple account?

http://xrp.webr3.org/usd-xrp has the orderbooks of Bitstamp BTC/XRP, Bitstamp USD/XRP. https://ripplewise.info has Bitstamp, SnapSwap, RippleChina orderbooks.


Is it more efficient to use multiple computers when I have multiple GPUs? I have 4 video cards: 2x 7970 & 2x 6970.

This is a question of efficiency regarding MH/s. Simply, I would like to know which is better:

~1900 MH/s on one machine
~1200 MH/s and ~700 MH/s on respective machines
It does not matter

Could the answer please include efficiency for both solo mining and pool mining?

This is a question of efficiency regarding MH/s. Simply, I would like to know which is better

It doesn't matter. Every hash has an equal probability of finding a block. However, that being said, there's some hidden teeth:

Putting graphics cards together will make them harder to cool.
Putting them in multiple computers will use more electricity - all computers use some electricity, even at idle.

  Could the answer please include efficiency for both solo mining and pool mining?

My advice applies for both.


Payment channels with dynamic signatures Talking about single-funded payment channels, the idea is quite simple: Alice puts 10 btc into a multi-sig signed with Bob, and then they each update the state accordingly to send money to each-other back and forth.

Now, imagine a third person joins the picture, say Carol. And Alice wants to send her some btc. Can the channel state be updated with someone else's public key?

I'd like to understand if something like this is possible. If not, I'd like to know why this isn't possible (I'm for sure missing something about how payment-channels work and I'd like to understand what). Perhaps using Channel Factories something like this is possible?

The main idea here is that someone can set funds aside for a new person, without having to create a new channel, but by using the funds in an already created channel.

Please note that this doesn't have to do anything with routing. It's simply using funds within a channel for another person rather than just the 2 parties of the channel.

EDIT

Perhaps there's the possibility of creating "off-chain channels" (maybe this is channel factories?) that are somewhat connected to the main branch, using other participants. I want to stress that in this example Carol has never participated in a on-chain channel -- she's a new participant involved using "off-chain channels":

It's possible for Alice and Bob to agree among themselves to pay Carol and any number of other recipients (subject to limits on transaction size).  However, it's not possible for Carol and other additional recipients to receive those payments with the same trustless security available to Alice and Bob through the payment channel construct.

Alice and Bob open a channel by committing funds to a multisig address that requires signatures from both of them in order to spend.  For Alice, this guarantees that her consent is required for any transaction spending the funds to be valid.  Bob receives the same guarantee that his consent is required.

The innovation of bi-directional payment channels (including, but not exclusively, those used by Lightning Network) is that each payment in the channel can be revoked by the recipients, allowing a subsequent payment to take its place.

The encumbrance (redeem script) that protects a revocable payment is larger than a normal Bitcoin encumbrance, so the most desirable end to a payment channel is a mutual close where the last revocable payment is revoked and converted into a non-revocable payment that looks like a normal Bitcoin 2-of-2 multisig spend.

The only known way for revocable payments to work is for each party to have a complete list of every payment ever made and (if it has been revoked) what data is necessary to revoke it.  This is what prevents Carol from having full payment channel security.

Alice and Bob can both mutually consent to paying Carol and they can tell Carol about this payment.  If the transaction containing that payment gets broadcast, Carol gets her money.  But because the multisig address to which the funds were initially deposited only requires Alice's and Bob's mutually consent to create other payments, they can create other payments in secret from Carol.

If one of the secret payments created between Alice and Bob gets broadcast, Carol doesn't have the data necessary to prove on the block chain that it was made fraudulently.  Alice and Bob can thus, by mutual consent, steal Carol's funds.

A more conceptual way of looking at it is to envision the block chain as a trust anchor for payment channels.  You need to have some degree of control over that anchor in order for you to be able to trust the resultant channel.  Alice and Bob have that because their consent is required to use the anchor; Carol does not have any control over the anchor and so cannot trust it.


Is there a way to force fail the transaction in testnet network I would like to test my application with all the edge cases. Could you please tell me is there a way to force fail the transaction in the testnet blockchain so I can test if my application handles that case correctly.

Thank you for the answers in advance.

You can set fees to very low (for example 1500 for a small 1 input 1 output transaction), not zero though. That will (most likely) get your transaction to be not mined in a few days and dropped.


How do I lookup Blockchain sizes for crypto-currencies like Litecoin and Dogecoin? I am new to mining cryptocurrencies. I am planning to set up a wallet for both Litecoin and Dogecoin. I am just curious on asking what are the current total blockchain sizes of both coins? This is to prepare me to download them ahead of time.

Bitinfocharts.com lists stats for the main cryptos including the block chain size. You will find "Blockchain size" near the bottom.


re : minimum sizes of transactions and blocks I see there's a similar question provided here:

What are the minimum sizes for transactions and blocks in Bitcoin?

But the answer provided might be not correct in the light that "A valid transaction requires at least 100 bytes" or am I missing something here ?  See checklist #6.

If relevant to minimal transaction size, my question then would be, was this standard introduced after or before the answer provided.
Also, did the answer provider care about distinguishing between valid transactions and invalid transactions ?

That limit (which is different today) pertains to node policy and transaction standardness. It is important to keep in mind that something that is non-standard is not necessarily invalid. Validity and standardness are two different things, although standardness is a subset of validity.

A transaction smaller than the standardness minimum can still be valid. It will just be considered non-standard and not be accepted by nodes following that particular policy (which is most nodes as that is part of Bitcoin Core). The limit today is 82 bytes which is the smallest size a standard transaction can be.

  If relevant to minimal transaction size, my question then would be, was this standard introduced after or before the answer provided.

This policy rule was introduced in 2010, long before the referenced question and answer. Furthermore, that wiki page was written containing that information in 2011. Also note that the wiki page is outdated as the rule in question is incorrect.

  Also, did the answer provider care about distinguishing between valid transactions and invalid transactions ?

The answerer (me) did. The smallest valid transaction is as I state in that answer. Such a transaction will be considered non-standard and will not be relayed per the policy rule, but if a miner were to include such a transaction in a block, it would be accepted by nodes as being completely valid.


Sweeping a bitcoin private key using PHP Is there a PHP script where it validates a bitcoin private key and also gets the public address from the key?

My goal was to:

verify the private key
Get the public address using that private key
Check the balance using an external api
Sweep if balance > 0

I know I can test it by sending some bitcoins to it, or use electrum to attempt the sweep, but let's say I have 100 private keys I need to verify, how would I go about that?

No MVP PHP code, but some bits that could help.

  verify the private key

Assuming you want a private key to be in the secp256k1 ECDSA range. You could check if the key is any number between 0x1 and  0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140. Take a look in the bitcoin wiki entry to private keys about the key range.

  Get the public address using that private key

The library BitcoinECDSA.php could help you out here. Especially

$bitcoinECDSA->setPrivateKey($privateKey);
$bitcoinECDSA->getAddress();

  3 + 4.Check the balance using an external api and sweep if balance > 0

This step can be easily combined. If you want to rely on a third party you could use the Block.io PHP API and Libary. They have an example PHP code for sweeping.


Why is HMAC-SHA512 used on root the root seed to create master private key and chain code in HD wallets? The process is depicted in this picture. Specifically, given that the root seed was derived using PBKDF2 (with 2048 rounds of hashing with HMAC-SHA256 already), why do we undergo an additional pass of HMAC-SHA512, besides for creating 512 bits of entropy? Why not just use SHA512 alone? I've asked here before and the answer I got was that the HMAC version is used to ensure unique generation of the key, but I don't know what that means. It seems for derivation of the master private key and chain node, the function is being used as a one-way hash function only, so why is a MAC being used? There is a single thing being encrypted, we are not additionally trying to guarantee authenticity on anything here, right?

I'm willing to bet the 2048 rounds of hashing required by the BIP 39 Standard takes considerably more energy than 1 round of hashing.

Put another way, substantial computing cycles are required to create brute forced Rainbow Tables when lower entropy human readable seeds are functionally mapped to private keys. This is somewhat analogous to the leading hash zeroes values miners satisfy to add blocks to a PoW-based blockchain, except the computing cylces are fixed by mnemonics-to-seed portion of the BIP39 Standard.

The Python stretch can effectively implement the mnemonics-to-seed functionality written into BIP 39.

stretch->passlib.pbkdf2(secret, “mnemonic”+salt, rounds=2048, keylength=64, sha512)

The two two Bitcoin-related examples of piped commands using stretch and bx yield the same result.

% stretch -f sha512 -r 2048 "bunker wreck real edge inflict aerobic buddy mercy divorce wolf bright immune fat foot poet section sustain reveal unique reflect have latin problem chapter" mnemonic123 | bx base64-decode | bx base16-encode | bx hd-new | bx hd-private
xprv9veSXAfA7GoYvaMAXgm3uYGS4VLH1Foc9qmTBRCb4c3F2Vqd261k2vo646nLU54MRVseFx2BbhZYQS9HDUy4dvTV3fygVGxedqYSR82B3he

% echo "bunker wreck real edge inflict aerobic buddy mercy divorce wolf bright immune fat foot poet section sustain reveal unique reflect have latin problem chapter" | bx mnemonic-to-seed -p 123 | bx hd-new -v 76066276 | bx hd-private
xprv9veSXAfA7GoYvaMAXgm3uYGS4VLH1Foc9qmTBRCb4c3F2Vqd261k2vo646nLU54MRVseFx2BbhZYQS9HDUy4dvTV3fygVGxedqYSR82B3he


Is blockchain.com the only place where you can see the blockchain? I've been investigating Bitcoin and when I would try to find out where the blockchain is stored, I was told that it is stored on everyone's computer. Then I would ask where was the blockchain stored on my computer and the response was it is stored in your wallet.
Since Bitcoin is decentralized, I supposed that it must be found anywhere. But I found no information about that.
My question is actually: Where can I see the blockchain without going to blockchain.com?

Blockchain.com is a wallet service and provides a "blockchain explorer". The company is named after the Bitcoin network's transaction journal, the blockchain.
Bitcoin is a permissionless peer-to-peer network. Users interact with the network by running software that implements the Bitcoin protocol.
There are various types of software that interact with the network to different degrees, but the backbone of the network are the so called "fully validating nodes" or fullnodes. Fullnodes distinguish themselves by downloading and verifying the complete blockchain. Archival nodes maintain a complete copy of the blockchain, while pruning nodes discard the oldest parts of the blockchain data after using it to calculate the current ledger. New nodes joining the network download the blockchain data from existing nodes.
Most Bitcoin software does not download, verify and store the complete blockchain. These "thin-clients" rely on other nodes or central services to serve data about the Bitcoin network's state to them. Wallet software (such as e.g. the Blockchain wallet) usually belongs to this category of node.
So, to answer your other question: your computer only stores the blockchain if you run a fullnode, e.g. Bitcoin Core. Then you can "see" the blockchain by requesting data from the fullnode. There are various projects that bundle visualization or blockexplorer software with the fullnode, to make the "seeing" part a bit more user friendly. ;)


Using a wallet generated from an out of sync client with a synced client So I wanted to move my wallet from laptop to computer, and the Bitcoin client on my laptop is out of sync but I still generated a wallet.dat from it. If I then use this wallet.dat in an up to date client, will everything be fine?

Yes, but you will have to resync that wallet if it has pending transactions.


33 byte private key? I have read that private key is 256 bits or 32 byte. see here

I generated a key on bitcoin-test network.

WIF:

  cVe4tA6QHduboeSiQD6Y6nzV1QjaVpDVG2YHbqbtJiSCxsNDYYUF

HEX:

  f06e4a9c228dafff48e6a44eb9527a14374a203a5750de01c0cf39e7280ce45501

if you notice above hex is 33 bytes!

I went  on to sign a transaction :

  01000000015760c907060ca47bbf97a964a435387c38fd86c307e920c1d29ce1a3d0d4d56b010000001976a914ca560954433f0fd1bda9bb566607d1724559b0db88acffffffff02d0070000000000001976a914f9ad22432bb6eb5e4262f9e4bcfb09fda2f5167b88ace068be07000000001976a914ca560954433f0fd1bda9bb566607d1724559b0db88ac0000000001000000

generated the following tx hash:

  01000000015760c907060ca47bbf97a964a435387c38fd86c307e920c1d29ce1a3d0d4d56b010000006b483045022100f2224f424a63675682f062fbf6699028727e13d26dc382af6dca57dfb21e9910022011b485e63f8f0045c40f8df41bcab13040bc554da4c176a380c81d18c615b210012103b9dc990c2b8a999ba68bf80cbff94fd85d62a01c7dc48252156f78c813b0aa67ffffffff02d0070000000000001976a914f9ad22432bb6eb5e4262f9e4bcfb09fda2f5167b88ace068be07000000001976a914ca560954433f0fd1bda9bb566607d1724559b0db88ac00000000

and when i broadcasted it got accepted!

Now my question is, how can 33 byte private key be valid signing key?

P.S. please don't take out the coins, they are worthless and i need for testing. thanks!

Got it: the last byte 01 stands for compression and has to be dropped


How are some coins premined? Did the developers of the various premined coins have to wait for those coins to be mined first or did they change the code to first issue themselves the premined coins?

I'm referring to the list of coins at http://altcoins.com/scamcoins

Both options are possible. I don't know how most scamcoins do it but I believe it's more common to actually mine coins before the chain is released to the public.


Why can't my bitcoin-qt sync with network? For the last 32 hours my bitcoin-qt has been unable to sync with the network even with my firewall and VPN switched off. Any ideas what else to check? Using Windows 7 SP1 x64 and have rebooted the machine. Internet connection is fine, plenty of space for the blockchain.

Please have a look at the debug window. Does it show peers? In addition, look at the debug.log file, it might show specific problem information.


Is it possible to have a single input or output with multiple addresses I've seen in more than one Blockchain API provider's specs where the transaction inputs and outputs are in the following format:

addresses: ARRAY
The address (or addresses in the case of multi-sig) to which the value was transferred.

I'm confused about the array. When I try these APIs with a transaction where one of the outputs is to a multi sig address, I still see a single multi-sig address in the output.

In which cases would I see multiple addresses in a single output or input?

This the same in these api providers:

https://chain.com/docs#object-bitcoin-transaction

http://dev.blockcypher.com/#transactions

https://toshi.io/docs/#get-transaction

The answer here is escrow outputs.

When one of the outputs is sent to escrow, the related addresses are listed in those arrays.

Here is an example: https://insight.bitpay.com/api/tx/09dd94f2c85262173da87a745a459007bb1eed6eeb6bfa238a0cd91a16cf7790

A single output will be displayed to have multiple addresses.

Blockcypher's API will show an address starting with 4 instead of multiple adresses. And output script type = pay-to-multi-pubkey-hash

{
      "value": 10860,
      "script": "5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae",
      "addresses": [
        "4bkHBecr4EQvVUa8Lsa2kH6rGtvsC9AZ5Y"
      ],
      "script_type": "pay-to-multi-pubkey-hash"
    },


Browser based mining What happens if while mining, you lose internet connection?  Do you lose all the work your computer has done, or is something like bitcoin-plus smart enough to post the data across when the internet connection has been re-established again?

The work done when mining is not accumulated over time.  Each hash calculated is independent from the others.  Think of mining as repeatedly rolling a huge die and trying to get an extremely low number, instead of working towards a solution of a complex problem.

If a miner loses connection to the internet, it will be unable to submit work during this time period.  Work done during the outage may or may not be stale (too old to submit) when connectivity returns.  However, no previous work will be lost, as this work would have already been submitted immediately to a pool/the bitcoin network if it was useful.


How does Electrum compute seed byte just before BIP-32? As a newbie in Bitcoin and programming it, I am trying to generate BTC addresses from mnemonic. So I read about the BIPs, and found codes in Github that implement those.
I found out that Electrum doesn't implement BIP-39 (by default if I have not mistaken), because mnemonics that are invalid in BIP-39 are accepted by Electrum!
So my question is: How does Electrum do its own "From mnemonic to seed" section (atleast for standard wallet)? This "seed byte" is the one to be used in BIP-32 for generating keys, if I have not mistaken.
I tried the following Python psuedocode (from "Electrum Seed Version System"):
hmac = hmac.digest(b"Seed version", b"...(12 word mnemonic)...", hashlib.sha512)
bip32_thing = Bip32(secret = hmac[:32], chain = hmac[32:]) # default: Bip32 main net version (idk what this means)

But my generated master public key and Electrum's doesn't match (most likely I misunderstood the "Seed Version System" altogether). Thanks for responding!
In case it helps: I am using bip-utils in Python.

After many hours, I found it! It is exactly what Mnemonic.mnemonic_to_seed() does in mnemonic.py! (link)
The most relevant part is what it returns:
seed_byte = hashlib.pbkdf2_hmac('sha512', mnemonic.encode('utf-8'), b'electrum' + passphrase.encode('utf-8'), iterations = PBKDF2_ROUNDS)

Where PBKDF2_ROUNDS = 2048. Then, I just did...
bip32_node = Bip32.FromSeed(seed_byte)   # Derivation path: "m/"


Did Satoshi know since its publication all the applications that the blockchain would enable? Or he only thought about Bitcoin?

Did Satoshi knew since its publication all the applications that the blockchain would enable?

I doubt it. Even the phrase 'blockchain' was coined long after the Bitcoin paper was published. However, Bitcoin uses primitives like HashCash to do something that their creators never envisioned, so I don't think he would be surprised by the ideas of Bitcoin being used for things that he didn't think of.


Replace by Fee- Unconfirmed Transaction Would anyone here please be able to tell me how to do RBF using the ledger nano- I can see the transaction was RBF and has been stuck for about 24 hours now. The TX is 5c119ce4b0bce440c16b2ad48e720c22422454118bf15ece0602904349d0b568 and it still has not been accepted.
I have been looking at accelerating it and also RBF, I have been unable to find anything for RBF in line with Ledger Live. I would really appreciate any help and if you could look at the transaction ID for me. I do not understand it unfortunately.
Many Thanks

Ledger Wallet doesn't support RBF but you can do Child Pays For Parent:
Make a transaction to your address 3M6EhQL3QUQHAFkSPH3vLc3VDCrJKP3iMv with amount  0.011, set a fee rate, preview the transaction and check and confirm the transaction only if one of the inputs is 0.01187067 BTC.
If this doesn't work, download Electrum and CPFP from there.
But honestly, the fee rate of your transaction is not terribly low. I would wait another 24 hours.


Clients without Isstandard() function Are there any bitcoin clients without the Isstandard () function which would allow non standard transactions to be broadcast?

I don't know about any client that removed standardness checks altogether. However there exists some alternate clients with different default policy settings, such as Bitcoin Knots.


Negative volumes returned from MtGox websocket api request I am using MtGox's websocket api to construct an order book. The trouble I'm having is that every once in a while, the depth event will return an JSON object with negative volume and negatie volume_int

{
  "channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe",
  "depth":{
    "currency":"USD",
    "item":"BTC",
    "now":"1323644358437819",
    "price":"14.43",
    "price_int":"1443000",
    "total_volume_int":"849766000",
    "type":1,
    "type_str":"ask",
    "volume":"-2.71",
    "volume_int":"-271000000"
  },
  "op":"private",
  "origin":"broadcast",
  "private":"depth"
}

What does this mean? I'm wondering if it could perhaps be to indicate an order has been canceled

So I ran a test where I placed an order that I knew would be unique and then promptly canceled it, the whole time logging all depth objects to my terminal

The result was

{ price: '66',
  type: 2,
  type_str: 'bid',
  volume: '6.66',
  price_int: '6600000',
  volume_int: '666000000',
  item: 'BTC',
  currency: 'USD',
  now: '1370548662105838',
  total_volume_int: '37301280846' }

and

{ price: '66',
  type: 2,
  type_str: 'bid',
  volume: '-6.66',
  price_int: '6600000',
  volume_int: '-666000000',
  item: 'BTC',
  currency: 'USD',
  now: '1370548667379328',
  total_volume_int: '36635280846' }

Which leads me to conclude that negative volumes are in fact the result of a canceled trade


Is it safe to create a Bitcoin account for another party? Is this a scam? A guy I have been talking to says he is having trouble accessing his account and asked me to make a wallet in blockchain and then wants my login, password, and wallet id so he can use it in another country. I have $0.00 in my wallet. Is this safe to do? I’m trying to figure out if this is a scam and if so how ? I also have no intentions of buying any bitcoin for myself now or in the future

This is unsafe and definitely a scam.

One common way it's done is as follows.  Using your login and password, the guy will secretly retrieve the recovery phrase for the wallet.  He will then let you change the password.  Then, he will make up some story to convince you to acquire some Bitcoins and put them in the wallet (or maybe he'll just wait until you decide to do so of your own accord).  You will think this is safe because he doesn't know the new password.  However, using the recovery phrase, he will be able to take all the coins from the wallet, even without the password.

If he really just wanted access to a Blockchain wallet, there would be nothing to stop him from just making one for himself.


Is SIGHASH_NONE encompassing of other signature types? Say I am building a transaction in private:

Input 1 is signed with SIGHASH_SINGLE  ( | SIGHASH_ANYONECANPAY)
Input 2 is signed with SIGHASH_NONE | SIGHASH_ANYONECANPAY

SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction. Am I able to communicate this privately-signed transaction in such a way that Input 1 is also locked on the condition that Input 2 is included?

For example, I send this partially-signed transaction, with both signatures, to a person I do not trust.

Are they able to spend Input 1 (the SIGHASH_SINGLE) in another transaction without Input 2 included?

What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?

SIGHASH_NONE implies that Input 2 will only spend if Input 1 is included in the transaction.

This is false.

Input 2 is essentially a blank check. SIGHASH_NONE signs none of the outputs (I don't care where the BTC goes), and SIGHASH_ANYONECANPAY signs only input 2 (I don't care who else is participating in the tx. This essentially creates an input, which if you give to anyone else, is the equivalent of "Here's a blank check for X BTC, do what you want with it".

  Are they able to spend Input 1 (the SIGHASH_SINGLE) in another transaction without Input 2 included?

Since Input 1 is signed using SIGHASH_SINGLE, only output 1 is signed under it. However, the SIGHASH_ANYONECANPAY flag means that only input 1 is signed as well, which completely decouples it from input 2.

Now, if you were to remove the SIGHASH_ANYONECANPAY flag from input 1, then you end up with a tx that is able to spend up to input 1 + input 2 BTC, but is only spending output 1. In this scenario, spending input 1 is dependent on spending input 2 as well. However, since input 1 is SIGHASH_SINGLE, and input 2 is SIGHASH_NONE, anyone you share the tx with is able to add their own outputs to it, but not add any more inputs.

Moreover, since input 2 is SIGHASH_NONE | SIGHASH_ANYONECANPAY, anyone you share the tx with can extract just input 2, and reuse it in a completely different tx without requiring input 1. The way to counter that would be to remove the SIGHASH_ANYONECANPAY , so that it is at least locked to being spent with, and only with, input 1.

  What can I do to lock these two inputs together, with one of the inputs also being locked to an output, while still allowing people to add inputs to the transaction?

You could spend to to a single output, then create a new partial tx with that single output being spent with your required destination and amount, and sign that with SIGHASH_SINGLE | SIGHASH_ANYONECANPAY


How effective is the blockchain algorithm? I am studying the algorithm of Bitcoin and I don't understand one thing. If all miners are mining the next block at the same time, and there are thousands of nodes, how could it be that there are no collisions (two blocks found at the same time)? I wonder how effective this process is? As I understood the algorithm, the mining must be sequential (with order), and this can only be done if all miners mine the next block at the same time, because hash of the previous block must go within the next block. But if they mine it at the same time, there must be a lot of collisions. However I can't find anything about collisions or low effectiveness of this blockchain algorithm.

how could it be that there are no collisions ?

There are.

  I wonder how effective this process is ?

Very ineffective. ~$10 natural cost for securing one transaction :)


How to handle POST data sent from Blockcypher WebHook API I've been trying to get this to work for the past 3 days and I've all but given up on it. Basically, I've used requestb.in to monitor if any POST requests are going through; requestb.in always displays a response. However, I can't replicate this on my own website.

I simply can't find a way to read the body of the response that's getting called back to my server.

For reference, I'm using this sample provided by BlockCypher:

 require __DIR__ . '/../bootstrap.php';

$webHook = new \BlockCypher\Api\WebHook();
$webHook->setUrl("http://mysite.com/dev/data/index.php");
$webHook->setEvent('unconfirmed-tx');

/// For Sample Purposes Only.
$request = clone $webHook;

$webHookClient = new \BlockCypher\Client\WebHookClient($apiContexts['BTC.main']);

/// Create WebHook
try {
    $output = $webHookClient->create($webHook);
} catch (Exception $ex) {
    ResultPrinter::printError("Created WebHook", "WebHook", null, $request, $ex);
    exit(1);
}

ResultPrinter::printResult("Created WebHook", "WebHook", $output->getId(), $request, $output);

return $output;

I had tested the callback url using requestb.in:

http://requestb.in/zphhv1zp?inspect

I've been going crazy testing everything I could find online, but nothing really helped me out. What should I be using to retrieve the POST data?

PS: this is the code that I've been testing most recently

<html lang="en">
<head>
</head>
<body>
    <?php
        $url = "http://requestb.in/zphhv1zp";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($ch);
        curl_close($ch);
        echo $data;

        // $inputJSON = file_get_contents('');
        // $input = json_decode( $inputJSON, TRUE );
        // echo $input['hash'];
    ?>
</body>
</html>

Full disclosure: I'm BlockCypher's Developer Advocate.

I'm not a PHP expert, but I know a number of our customers have had issues reading return data from PHP. This thread on Stack Overflow might help:

https://stackoverflow.com/questions/8945879/how-to-get-body-of-a-post-in-php


How do Bitcoin exchanges fill orders? If the order book looks like the following…

A)  Ask: 2 bitcoin at $100

B)  Bid: 2 bitcoin at $100

A trade will be done from A to B.

But what happens in the following situation:

C)  Ask: 1 bitcoin $100

D)  Bid: 2 bitcoin $100

Do bitcoin exchanges partially fill orders?

Does one of the following occur:

Nothing the orders need to be the same quantity.
Does the trade occur for one bitcoin.
If the trade does occur, what happens if the bid is cancelled? Is the trade for 1 bitcoin still valid.

Also, what happens in this situation:

E)  Ask:2 bitcoin $90

F)  Bid: 2 bitcoin $100

Does the Bid pay $100 or $90?

Thank You for your help

Q1: Yes, orders will be partially filled. Some exchanges offer advanced orders that can only be completed wholly, but that's not the default.

Q2: The deciding price is the one that entered the book first. So if first a $90 ask is placed and then a $100 bid is placed, the trade will be executed at $90.


What's the safest way to buy bitcoins in India? I have came across multiple companies selling BTC, but I’m not sure which one to trust. How can I find a safe way to buy bitcoins in India?

There are several legit companies where you can buy and sell Bitcoin officially in India such as Zebpay, Unocoin, Coinsecure,and Btcxindia.

I have personally used Unocoin and Zebpay, both are good.


Solo mining without a pool? Is it necessary to run a "full node" including port forwarding in order to solo mine Bitcoin without any involvement of a pool?
I see that pools are offering solo mining as an option, but why would I trust them to not take my 25 BTC?
I am willing to free up 30GB for the blockchain data on my hard drive.

Are you aware how much hashing power you need to stand a chance to solo mine? In case you don't the rest of the answer is moot and you'll need to study the topic of mining some more.

Yes you'll need a full node. You don't necessarily need port-forwarding though. Full node means you validate the full blockchain and has nothing to do with network connectivity.

A full node is more like 60GB disk space at the moment and will likely be >100GB within a year.


How does one programmatically "walk-back" on the block chain? I'm thinking (probably erroneously) along the lines of a linked list and C pointers, but how would one follow the block chain from some block all the way back to the genesis block? The previous block's hash is the "pointer", but in a C program (say), given any block how would the previous block be accessed?

The "blockchain" is a conceptual structure that is not directly represented in a program. If you were writing a program to work with the blockchain, you get to choose how you would implement it in a data structure.

If your data structure is a linked list, you would follow the back link pointer to the previous block
If your data structure is a hash table, you would look up the previous block hash in your table to find the previous block
If your data structure is an array, you would look in the previous array slot to find the previous block

As you can see, there are many possible choices one could make when representing the blockchain in memory. This is further complicated by the fact that the blockchain is probably too big to load into memory all at once, so you would probably need to involve some kind of on-disk storage too (a database perhaps).


Can I spend/transfer bitcoins directly from cold storage? From reading previous articles I understand that you can receive bitcoins to an address even if your wallet is in cold storage because the bitcoins sent to this address is recorded by someone on the block chain. Is this correct? and who is this someone?

Now If I have bitcoins stored in an offline laptop (I believe this is called cold storage) is it possible I can create some sort of QR code with my offline laptop and just have my mobile Android bitcoin wallet snap the QR code and wallah the bitcoins are transferred from cold storage to hot? Do I also need to enter my private key to enable this?

Every bitcoin and bitcoin transaction is stored in the blockchain which is online, distributed and known by every full bitcoin node.

What you have on your pc are private keys.   As long as you have this private key, you can sign any transaction which matches the corresponding public key.

An offline, or cold-wallet is a wallet that is not connected to the internet, so nobody can ever figure out your private keys by hacking you - the keys aren't connected to the internet.

Spending coins is basically signing (with your private key) that you wish to yield the control of your coins to someone else.

To sign this message, you will usually need a pc which is online to create the message to sign, and has a copy of the private key.  It also needs to be online to send that signed message.

So unless you have a way to transfer the message to sign to and from a completly offline computer, you will always have to bring your wallet online to spend your coins...


Could not detect boost libraries when configuring Bitcoin core - Apple M1 Mac Mini I´m trying to install Bitcoin from source on an Apple M1 Mac Mini (Big Sur 11.2.3) and Im getting this when running
./configure --prefix=$PWD/depends/arm-apple-darwin20.3.0

"We could not detect the boost libraries (version 1.58.0 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option."
config.log tells me:
configure:32586: checking for boostlib >= 1.58.0 (105800)
configure:32618: g++ -std=c++17 -c -g -O2 -I/opt/homebrew/opt/libffi/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DPROVIDE_FUZZ_MAIN_FUNCTION  conftest.cpp >&5
conftest.cpp:73:10: fatal error: 'boost/version.hpp' file not found
#include <boost/version.hpp>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
configure:32618: $? = 1

I have boost installed via homebrew in /opt/homebrew/Cellar/boost
(Version 1.75.0) and I did try
export BOOST_ROOT=/opt/homebrew/Cellar/boost

before building, but keep getting the same result.
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"

also didnt help. Any ideas very much appreciated. Thanks

Problem solved. Rosetta 2 was missing on the new system I set up. If anyone else runs into the same problem:
softwareupdate --install-rosetta

does the trick. Thanks to @AlgorithmicRisk on Twitter for pointing this out.


What would happen if you send Bitcoin (BTC) to a Bitcoin Cash (BCH, aka BCC) address? Could someone please explain what happens if someone sends bitcoin to a Bitcoin Cash address after the August 1st fork? Would there be a way to recover them?

As of what happens if someone send BTC from a BTC wallet to BCC wallet address, the transactions go through.
But you can only see that transaction in the Bitcoin Blockchain rather than Bitcoin cash blockchain.
I will explain with an example.

Say there is an address named "abc" in BTC and another address named "def" in BCC.

abc has 1 BTC (Bitcoin Network)
def has 0 BCC (Bitcoin Cash Network)

If a person by mistake (or for fun) sends 1 BTC from abc to def. Then the balance changes as follows:

abc has 0 BTC (Bitcoin Network)
def has 1 BTC (Bitcoin Network) [Assuming there was no transaction fees]
def has 0 BCC (Bitcoin Cash Network)

So, if the owner of def in BCC has the private key of that address, he can access the BTC in def as well.

But if he unfortunately does not hold the private key of that BCC address (like it can be of an exchange where you don't have access to the private key), then the BTC cannot be accessed by the owner of the BCC address.

Hope this answers your query well.


Is there a reason why miners should respect the default maximum block size? Actually the default maximum block size is 300,000 Bytes and the protocol hard limit is 1MB.

So what I understood is that all blocks over 1MB will be rejected but the ones between 300,000 Bytes and 1MB will not.

So if there are lot of transactions with little fees that make that a miner can create let's say a 700,000 Bytes bloc. Will it be profitable for the miner to create such a block or is there a additional risk that his block will be rejected?

You should know that as of bitcoin 0.8.6, the default maximum block size is actually now increased to 350,000 bytes.

The 350,000 bytes is a soft limit. All miners are motivated to maximize filling the block size to 1MB for each block because it would be irrational for them to do any less and leave fees to other miners that they could easily collect themselves.

Thus all blocks are usually mined to the maximum limit with paid transactions and then free transactions are included once all fee-based, unverified transactions have been verified.


Recovering an old Multibit wallet file (76 characters long) I have a wallet file from 2011 back when I used to play around with Bitcoin.
I used an old version of Multibit which has since long been unavailable.
My wallet looks like this:
# KEEP YOUR PRIVATE KEYS SAFE !
# Anyone who can read this file can spend your bitcoin.
#
# Format:
#   <Base58 encoded private key>[<whitespace>[<key createdAt>]]
#
#   The Base58 encoded private keys are the same format as
#   produced by the Satoshi client/ sipa dumpprivkey utility.
#
#   Key createdAt is in UTC format as specified by ISO 8601
#   e.g: 2011-12-31T16:42:00Z . The century, 'T' and 'Z' are mandatory
#
U2FsdGVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXsnQhpZ6
 2013-10-30T20:52:01Z
# End of private keys

I managed to get a version of Multibit HD from the web archive but this doesn't support this wallet.
I also tried using OpenSSL with the following command:
openssl enc -d -p -aes-256-cbc -md md5 -a -in C:\key\wallet.key.txt -out c:\key\wallet-decrypted.key.txt

This output a file which wasn't correct and gave a bad decrypt error. I know the password for this file.
Does anyone know the correct method of decrypting this?
UPDATE: While I'm at it, I found a whole bunch more .key files. This one has a different format:
org.bitcoin.productionm!œ;€ò=°´zXXXXXXXXXXXXXXXXXÌñ9,o( 2D
ä¢¦]5+¡XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXE}Û@nŸé(2

ÐáXXXXR#
org.multibit.walletProtect.2 ZYour wallet description`

Does anyone know the correct method of decrypting this?

It doesn't seem to be encrypted. The comments at the start of the file don't mention any form of encryption. It only mentions a common form of encoding - Base58. Encoding is not encryption so no decryption is needed.

#   The Base58 encoded private keys are the same format as
#   produced by the Satoshi client/ sipa dumpprivkey utility.

That Base58 key ought to be able to be imported into several different modern wallet programs.
See

Private keys importing in format got by dumpprivkey
How to get the private key in hex from the output of dumpprivkey
https://btcinformation.org/en/developer-reference#dumpprivkey


Is it possible that one knows how much BTC is in wallet.dat without knowing password? Someone says that he or she wants to sell his or her wallet.dat which seems to contain a lot of BTC.
He shows screenshot of wallet software containing many BTCs.
He says that when I place wallet.dat in the wallet software location I can see how much BTC in contains, but it needs password to transact.
Is it possible?
Otherwise, is he trying to cheat me out of money?

is he [or she] trying to cheat me out of money?

Yes.

Even if you had a copy of their wallet, they have the private-key and can control any funds that appear in your copy of the wallet, now or in future. Even after they give you the password and even after you change the password.

What they are probably giving you is a "watch-only" wallet - often used by conmen to deceive people. The password to a watch-only wallet does not let you spend the money in it.

There's no need for a genuine seller to use this convoluted method of selling a wallet.dat file.

If they really wanted to sell Bitcoins they would  have you set up your own wallet without their help and have you tell them your bitcoin-address so they can send the bitcoins from their wallet to yours (note that the underlying reality is more complex, wallets hold private-keys not bitcoins, but this is the normal way to sell Bitcoins).

There is never a good reason to exchange wallet-passwords or private keys. You should never get involved in any arrangement that involves doing this.

You should do your own research on Bitcoin first and never accept advice or assistance from people who show such deceitful intent or appear to be trying to confuse you.


I just sent my Bitcoins to a Bitcoin Cash wallet. Did I lose my coins? I just sent my Bitcoins to a Bitcoin Cash wallet by mistake. Did I lose my coins or will they be converted to Bitcoin Cash coins after August the first?

Bitcoin Cash is just a future right now:
https://coinmarketcap.com/currencies/bitcoin-cash/

It won't exist until Aug 1st.


What is the incentive for including transactions in a block? I've been doing research in trying to answer this question and haven't found a good answer yet. I was wondering what is the incentive for miners to include a transaction in a block when mining bitcoin? Since it's a race to solve the proof of work problem, why wouldn't miners just leave the block empty to save time?

The reward for mining the block is much bigger than the transaction fee(s) so it doesn't seem to make sense to me to waste time validating transactions for the block just to accumulate small transaction fees. If anyone can provide an answer, that would be greatly appreciated. Thanks.

Three reasons:

Leaving the block empty doesn't save any time. They still hash however many times a second they hash.
Transaction fees make up a significant fraction of the mining reward today. Such a miner would be foolish.
Miners have invested in expensive hardware that is valuable only if bitcoins remain valuable. If too many miners mine empty blocks, confirmation times will go up and the usefulness of the network will be diminshed.


How would one get Bitcoin cash from their existing Bitcoin private keys? I have my bitcoin private key, how would I get bitcoin cash and where would I dump it for real bitcoin?

You can use your private keys to get your Bitcoin Cash on any Bitcoin Cash wallet. I personally moved it to Bittrex since they'll support both after the split so I will automatically get my Bitcoin Cash there. Bittrex will allow trading with Bitcoin Cash right away but it won't allow transactions so you could sell it immediately if you want.


How much Bitcoin is needed to start a Lightning node? I've never used Lightning but can someone recommend how much Bitcoin I need to fund a Lightning node? I will be using the Eclair client.

Thanks

When you start using lightning, the minimum bitcoin you need is the cost of opening the channel + anything else you want in the channel.

The cost of opening the channel is equal to the fees you pay to send a transaction.

So as a minimum you will need:

the lowest fees you can get away with to send a transaction + the amount you want to put in the channel.

You can check out the lowest fees required from any number of services, for example earn.com's service is pretty popular - https://bitcoinfees.earn.com/


What is the exact formula for calculating transaction fees? According to the Wiki:

  If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc.

What is the exact formula that determines the transaction fee?

See GetMinFee() in main.h for the code which determines the minimum transaction fee.

The part you're describing is implemented as follows:

// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
{
    if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
        return MAX_MONEY;
    nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
}

where:

nBlockSize depends on who we are:

if we're a user making a new transaction, nBlockSize is 1
if we're a node deciding whether to relay an incoming transaction, nBlockSize is 1000
if we're a miner deciding which transactions to include in a new block, nBlockSize is the size of the block we're building before adding the new transaction

nNewBlockSize is the size of the block including the new transaction
MAX_BLOCK_SIZE_GEN is 500kB
MAX_MONEY is 21 million BTC (all the money in the world)

so it's saying:

if we're either deciding whether to relay or mine the transaction, and adding the transaction would make the block over 50% full:

never allow a transaction that makes the block 100% full
otherwise scale the fee up by a factor of 500kB / (500kB - nNewBlockSize)

Note: by rearranging the symbols, we get exactly what Meni wrote in his answer:

Fee = Normal fee / ((500kB - size) / 500kB)
         = Normal fee / (1 - size / 500kB)


Decrypting Bitcoin Wallet for Android Does anyone know how to decrypt on a mac? I used openssl enc -aes-256-cbc -md md5 -a -in /Users/adriangonzalez/Desktop/bitcoin-wallet-backup-2019-06-26-22-20 -out ~/Desktop/file.txt, but the resulting file does not show mnemonic 12 words.

I'm using Bitcoin Wallet for Android.

I found the answer seconds after I posted my questions. I was not writing the code right, here it is

openssl enc -d -aes-256-cbc -md md5 -a -in /Users/adriangonzalez/Desktop/bitcoin-wallet-backup-2019-06-26-22-20 -out ~/Desktop/file.txt

https://github.com/bitcoin-wallet/bitcoin-wallet/blob/master/wallet/README.recover.md


Is it possible to pay part of a Bitcoin to someone? Bitcoins are over $800, I need to pay someone about $200. Is it possible to pay someone with a partial bitcoin?

Yes! To send $200 at a Bitcoin price of $800/BTC, you'd send 0.25 BTC. Bitcoins are highly divisible, up to eight decimals behind the point. The smallest subunit of a bitcoin is currently still less than 1/1000 of a cent.

Many Bitcoin clients will also keep track of the current value of Bitcoin and allow you to enter the amount of a payment either as bitcoins or your preferred national currency.

For example, when I want to send someone $5 from my phone, I could either enter BTC 0.00625, or $5 to set the amount.

As Bitcoin has become so valuable that one bitcoin is worth much more than many things we want to pay for, some people have moved to denominating prices in mBTC, i.e. millibitcoin, which are 1/1000 of a bitcoin.


What is the incentive for continuing to mine bitcoin as we get very close to the 21 million cap? The Investopedia article on Bitcoin explains the Bitcoin issuance schedule and how it's halved every four years. Currently, roughly 18.5 million have been mined, with the total cap being 21 million. It's assumed that the last Bitcoin will be mined in the year 2140, which is obviously quite a ways off.
Given both the monetary and energy cost of mining Bitcoin (the two are related since it requires a large amount of computing power), isn't there a diminishing incentive to continue mining Bitcoin as we approach the hard-cap limit of 21 million bitcoins? In other words, as the supply of Bitcoin nears its cap, and the reward for verifying transactions is halved, what will incentivize individuals to continue mining Bitcoin if their odds of verifying a transaction before anyone else decreases? And on the off chance that they do it first, the reward will be miniscule. Investopedia touches on this:

In actuality, as the year 2140 approaches, miners will likely spend years receiving rewards that are actually just tiny portions of the final bitcoin to be mined. The dramatic decrease in reward size may mean that the mining process will shift entirely well before the 2140 deadline.

Follow-up question: Couldn't this lead to a monopoly situation where fringe miners give up entirely and only the biggest mining networks reap the profits of continuing to mine Bitcoin?

When that runs out, the system can support transaction fees if needed.

Satoshi Nakamoto

The fact that the subsidy (newly minted bitcoins) decreases does not mean that the overall reward that miners receive decreases too: they also collect the fee of all transactions they verify and these tend to increase with the use of the bitcoin network.
Furthermore the value of the reward, measured in fiat terms, has compensated the decrease in bitcoins received with the increase in their price (at least so far).

Follow-up question: Couldn't this lead to a monopoly situation where
fringe miners give up entirely and only the biggest mining networks
reap the profits of continuing to mine Bitcoin?

For what we have seen so far, fringe miners are those have high electricity costs or use inefficient hardware, these factors affect more the sustainability of business than the scale of the farms.
It will be always possible run small farms or even a single miner (maybe using an old and cheap asic) if you have near zero energy costs.


Why was an insecure merkle tree implementation chosen? At risk of creating a "lets discuss politics" question, let me clarify that what I want to know is whether there is a known benefit to Satoshi's "duplicate the last hash" merkle tree implementation over the seemingly obvious "append zeros".

For those who don't know, the bitcoin merkle tree algorithm allows blocks to be mutated if a transaction can be duplicated which lead to CSV-2012-2459.

As with many things in Bitcoin, it is likely simply because it worked well enough, and such an attack was not immediately obvious.

Several of the choices made in the early days of Bitcoin don't have a full justification behind them, and were simply made because it worked at the time without any major, obvious shortcomings. This is one such scenario, as far as I'm aware.


How do I make a transaction I want to make a multisig transaction but dont how to do it. I am using this site: coinb.in

And what is Txin or N that it also can be called.

The certificates have been fixed and SSL/HTTPs is working properly now.

TXID referrers to the transaction ID

N referrers to which input you want to use from that transaction.


I have read many times that bitcoin is a public blockchain. Why is that? Is there some special reason that Satoshi made bitcoin like this. Wouldn't in a private blockchain, transfer of currency would be more secure?
Also, is it possible to create a separate blockchain to transfer bitcoin in that circle.

The whole point of bitcoin is that anyone can verify it, it's supposed to be trustless. If transactions were private, how could you trust anyone claiming to have BTC? How could you trust that BTC being sent to you in fact exists, instead of the sender just making up a transaction spending outputs which never existed? That's why all full nodes verify all transactions since the genesis block, to ensure all bitcoin being sent are legitimate.

A separate blockchain is possible but perhaps not in the way you think. It's possible to use sidechains or second layer networks like Lightning, but to make a separate blockchain itself would be to create a new currency completely, it would be an altcoin not bitcoin


How to use Bitcoin Core's submitblock method I'm trying to understand how mining works. For learning purpose I'm using Bitcoin Core as solo mining pool. Getblocktemplate will return data that is enough to start mining witch is simple founding correct nonce. But what is next step?

I found in bitcoin core method submitblock that have one argument / block data. I didn't found any example how that data should be build. Please give me some advice.


Checking the received fund on an address of an HD Wallet I'm running a bitcoind on my web server now. I would like to generate deterministic address (HD Wallet) and then check how much coin being received on such address. I'm looking at the Server API and it's quoting that:

getreceivedbyaddress <bitcoinaddress> [minconf=1]
Returns the amount received by <bitcoinaddress> in transactions with at least [minconf] confirmations. It correctly handles the case where someone has sent to the address in multiple transactions. Keep in mind that addresses are only ever used for receiving transactions. Works only for addresses in the local wallet, external addresses will always show 0.

That's being say the address need to be present in the local wallet for the check to be effective? Since I'm generating deterministic address outside of the bitcoind active wallet, is it considered non-local? If yes, how can I know the received amount?

Bitcoin Core clients do not keep track of the balance of addresses that aren't yours.

To make sure that they do keep track of them, import the private keys into your wallet, and restart your Bitcoin client with the -rescan option.

That's what they mean by non-local.


How can i trace a transaction where my bitcoin has been withdrawn from my paper wallet? My bitcoin has been stolen from my paper wallet, can I track where its gone and is it possible to do so with my paper wallet?

Technically you only need your bitcoin address from your paper wallet to track it.
But that would be tracking it on the bitcoin blockchain.
You can use any of the bitcoin blockchain explorers, just paste your paper bitcoin address into any of these and see which address it was sent to:
https://blockstream.info
https://mempool.space

However as you track your UTXO, you'll start seeing that it gets more difficult if it has been sent many times to different addresses.
And if you're looking to track it into real world (meat space) you have even fewer options. You can look into popular exchange addresses and see if someone deposited them there and reach out manually.


Are there any POS (point of sales) machines that accept BTC? We would like to know if there are any POS in the market that accept BTC or any other Cryptocurrencies? How do you think if these kinds of POS will be the trend in future?

Yes, depending on what country you are in. A quick check of Big Internet Search Engine for the term "Bitcoin POS" finds me two top of the list answers, once country specific with invoicing, payment and POS and, the other a global.


Can I generate an offline Bitcoin wallet using only OpenSSL? From what I understand about Bitcoin, a wallet is really just a pair of public/private keys.

So, if someone needs to send me Bitcoins, all I need to do is just generate a pair or public/private keys using OpenSSL or some other tool, and send the public key to that person, without actually downloading a Bitcoin client (which will download a 12 GB block chain), or saving a wallet.dat.

Am I correct?

You are almost correct ;-)

You can create a public/private key using OpenSSL (in fact, some wallets use OpenSSL libaries to generate the keys). However, the bitcoin address is not your public key but a function of such public key. The exact function is defined here
https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses

So, once you generate your pair of keys and compute the bitcoin address from your public key, you can receive bitcoins in such bitcoin address.


Fiat to Satoshi Relationship Is there a formula to calculate the fiat value of a Satoshi using your fiat principle?

The number of satoshi per bitcoin is 1e8 or 100,000,000, so if you have a fiat value per bitcoin such as $7000/BTC, the calculation is:

$/satoshi = $7000/1e8 = $0.00007 per satoshi

Of course, there is no fixed fiat to satoshi value because the fiat value of Bitcoin is determined by the market, i.e. exchange value.


Can i use one pair public and private key for all transactions? Can I use one pair public and private key for all transactions, digital signatures and wallet addresses?
In the other hand, I have a private key and want to sign all transactions and have a public key for broadcast. Can I do?

Is this way secure?

Each private key is associated with exactly one public key, which is associated with exactly one address.  So if you only want to use one private key, then you can only have one address.  This is "secure" in that it won't make it any easier for people to steal your money (barring a successful attack on ECDSA) but it is not so good for privacy, since people will have an easier time identifying your transactions as yours.

It is also possible to have one "master" private key or seed, from which many different "child" private keys are generated.  This is how an HD wallet works.  It is associated with a master public key, which can be used to identify your addresses and generate new ones, but as mentioned above, it would not be good for your privacy to actually make it public.


Why most of pubkeys in the first batch of blocks in blk00000.dat are different For example: the pubkey in the first 3 coinbase's output are

04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f
0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee
047211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073dee6c89064984f03385237d92167c13e236446b417ab79a0fcae412ae3316b77

Actually, I checked the first 6k transaction, most of the pubKey in the pay-to-pubkey script is different, less than 10 pubKeys have duplications.
Is that means satoshi use multi miner jobs to mine the block at the beginning or anything I misunderstood?

The reference link is here.
block0:
https://www.blockchain.com/btc/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
block1:
https://www.blockchain.com/btc/tx/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098
block2:
https://www.blockchain.com/btc/tx/9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5

The original Bitcoin software (and even the current Bitcoin Core) always used a new private key (and thus public key) for every transaction. Keys were never reused. Since the Coinbase transaction for each block is a new transaction, the software would use a new key for each one. It is the same behavior as asking for a new receiving address; a new one will be generated and given to you.


Have I lost my ripple I was hoping someone could help me please?

I used to have a desktop wallet for XRP which I just found out had been deleted and that’s where my coins were.

Is there anyway to access those coins again?- I am unable to download that desktop wallet since I cannot find it- id really appreciate any help.

Is there anyway to access those coins again?

If you wrote down your ripple secret (string of about 28 letters & numbers, starting with “s”), then you're OK unless a thief somehow got hold of your ripple secret. If your wallet software gave you a seed phrase and you wrote it down, then you're OK. (You can use your seed phrase to recover your ripple secret, either by using the same wallet software or by using tools such as Ian Coleman's mnemonic converter, linked below.)

If you had no such back ups, then your only hope is to undelete your wallet-file, using either a professional data recovery service or some sort of undelete tool (in which case try not to use the disk before). A skilful user of undelete tools might be able to find a ripple secret in a damaged relic of your wallet-file, but only if it's not encrypted.

Assuming you recover your ripple secret, what next? First of all, don't post it on the internet: it's secret for a reason! The same goes for seed phrases. You can use a ripple secret to access your coins via several freely available in-browser tools (examples linked below, but some of them are rumoured to misbehave in the Mac web browser Safari.). Whatever tool you use, I strongly recommend that you study it on a computer that's disconnected from the internet. If you're using it properly, it will tell you your address (string of about 34 letters & numbers, beginning with “r”.  It's safe to look up your address (beginning with “r”) on the internet, e.g. here, to see if your coins are still there.

Ian Coleman's mnemonic seed converter. If you use this, download the page and open it on a computer that's disconnected from the internet. Don't expose your seed phrase to the internet!
Bithomp wallet. Read the opening message very carefully before you start (“Introduction”, “Features”, “Offline mode”, “Online mode”).
Ripplerm's wallet. This one opens up with a demo account, so you have to set it to your account by clicking the blue Change button & then the use secretkey button. It's denominated in drops (1 XRP = 1 million drops), so don't let that confuse you. It has cold-signing functionality, so there's a lot you can do while safely disconnected from the internet. Don't try anything with the four pale blue buttons at the foot of the page.
Jatchili's minimalistic ripple client. Avoid the rekey account button.


How dependent is Bitcoin on the clock? Bitcoin takes into account clock of nodes on the network when propagating transactions tru the mempool and persisting them into the next block. If majority of the network clocks are compromised what kind of issues would occur?

How dependent is Bitcoin on the clock?

A lot less than many other applications.

  A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours.

https://en.bitcoin.it/wiki/Block_timestamp

AFAIK this means that a block can have a timestamp that is earlier than that of its parent (a block can appear older than its parent). I vaguely recall that there are some such blocks in the Bitcoin blockchain.

So if computers become unable to keep good time to within 2 hours of the correct time, they will start to be problems, blocks will be rejected and the Bitcoin network might, I suppose, fragment.

Note that time synchronisation protocols such as NTP can synchronise times on computers to less than a few tens of milliseconds across the planet, despite significant latency and jitter. There's no good reason for computers to have time drifting apart by seconds, let alone hours.

Compromising clocks might be exploitable but it seems non-obvious.


Tool to build a relational db from .dat block files No need to elaborate too much. I'd like to build a real SQL db starting from the directory blocks. Is there any tool out there? I work on a mac and I'd prefer something cross OS if possible.

parsing blockchain blk**.dat files - is very simple task. you can traverse all blocks from the begninning and put the data in your sql-database


Do you know any download site for full blockchain header data (6) in CSV ASCII format? do you know any download site for full blockchain header data (6 variables) in CSV ASCII format ?

I would like to enter block header data for every block from No.0 to latest into mining simulator to let students see, every nonce calculated works and any other nonce, random selected fails.

thank you

For your purposes may be this dataset is sufficient: http://headers.electrum.org/blockchain_headers

It spans from block 0 to 477636 (2017-07-26 09:03 (just 9 months ago)) and contains just the block headers.

It is binary, but can be easily converted to a csv ASCII file with this Python script:

#!/usr/bin/env python
# convert binary file http://headers.electrum.org/blockchain_headers
# to CSV ASCII

import binascii

STRUCT_OF_BLOCK = [ 4, 32, 32, 4, 4, 4 ] # blockchain_headers does not contain always "0x00" txn_count
BLOCK_SIZE = sum(STRUCT_OF_BLOCK)

FILE_OUT= open('blockchain_headers.csv','w')

FILE_OUT.write( "version,prev_block,merkle_root,timestamp,bits,nonce,txn_count\n" )

with open('blockchain_headers','rb') as FILE:
    block = FILE.read(BLOCK_SIZE)
    while block != b'':
        position = 0
        for i in STRUCT_OF_BLOCK:
            FILE_OUT.write( bytearray(binascii.hexlify( block[position:(position+i)][::-1] )).decode('ascii') + ',')
            position += i
            if position >= BLOCK_SIZE:
                FILE_OUT.write("00\n") # blockchain_headers does not contain always "0x00" txn_count
        block = FILE.read(BLOCK_SIZE)


Securely erase a previously used address from bitcoin-core I'd like to completely delete an address from bitcoin-core, in such a way that someone who obtains all the data on my computer could not find out I ever used that address.
Is it enough to delete wallet.dat? Is there a less destructive way?

No, and in fact, deleting a file is not destructive enough.
File deletion typically does not actually delete the file. Filesystems will just mark a file as deleted and allow it to be overwritten. If the file does not end up overwritten, it can be recovered from the drive using some forensic tools.
Furthermore, the way that the hard drive itself writes data physically often leads to data being left behind and just marked to be overwritten. So there could actually be multiple copies and fragments of your wallet.dat file left on the hard drive. Forensic analysis tools can then recover those fragments even after the file has been deleted, and some portions overwritten.
A better guarantee that no one can recover the data is to wipe the hard drive and overwrite every part of it with random data. However there is the potential for bad sectors or other issues with the drive which prevents an overwrite from actually overwriting some portions of the drive.
To be absolutely sure that data cannot be recovered, you have to do what companies like Google do to ensure that data cannot be recovered from their used drives: completely destroy the physical drive. Physical destruction is actually the only way to ensure that no data can be recovered from a drive.


is it possible to replace the cryptography and public key algorithms in Bitcoin? Is it possible to replace the cryptographic algorithms used in Bitcoin, such as the hash algorithms and the elliptic curve public key cryptography?

Does this require a soft fork or a hard fork?

Is it possible to replace the cryptographic algorithms used in Bitcoin, such as the hash algorithms and the elliptic curve public key cryptography in Bitcoin?

Yes.

  Does this require a soft fork or a hard fork?

It'll definitely be a hard fork since older clients will not be able to process the new transactions that require different cryptographic algorithms, especially sighashing.


Can the outputs of a transaction change over time? I would like to know if the outputs of any given transaction can change over time. For example, suppose I send a payment to three different addresses creating an unconfirmed transaction with several outputs:

Output 0: Address1
Output 1: Address2
Output 2: Address3
Output 3: Address4
Output N: AddressN

If I examine that same transaction two or three months later, can the outputs index association have changed in any way? For example, could Address1 have becomed the Output3? Or is that information deterministic in itself?

Thank you.

No. A transaction is composed of a sequence of inputs and outputs in a specific order. This data structure is hashed and makes its way to the Merkle root and block header, and thus if the transaction were to change, all the blocks that follow would be invalidated.

It's possible that a fork with a different transaction double-spending the same inputs would usurp the chain you originally observed (less likely the more confirmations it has); and the status of these outputs can of course change from unspent to spent.


What would happen if the BTC price collapsed and the reward for mining dropped below the cost of mining? Miners will only mine bitcoins if the reward they get from mining outweighs the cost of mining it.
The network difficulty is adjusted every 2016 blocks (approximately every 2 weeks).
If the price suddenly collapsed by a large percentage such that the new minted bitcoins would be worth less than the electricity it costs to mint them, what would would happen?
The network difficulty rate would be stuck at the unprofitable rate until 2016 blocks are minted before it gets adjusted.

The block reward is composed of two parts, the block subsidy and the transaction fees. While the block subsidy is fixed respective to the height of a block, the transaction fees are a product of the blockspace market. If Bitcoin's exchange rate dropped precipitously, the profitability for miners would drop of course. Since each miner has a different situation, it would not be just one spot at which every operation suddenly becomes unprofitable, but rather a range, though.
As the exchange rate drops, some miners would stop mining. This would reduce the block cadence. Then, as transactions get processed more slowly, we'd see feerates of unconfirmed transactions go up as users vie to be included in the next block. Between the added revenue from transaction fees and the immense hardware investment miners have fronted, hopefully there would be enough incentive for some miners to continue mining. Then with the next difficulty adjustment, the difficulty would drop and mining profitability would increase again, likely causing some of the miners that had paused their operations to return.
Note that it would not take 2016 blocks for the first difficulty adjustment in most cases, as the exchange rate could drop at any point in a difficulty epoch. If the hashrate dropped significantly in the middle of an epoch, the first difficulty adjustment would likely not reflect the full drop, though.
You can see a similar effect around halvings: after the block subsidy dropped from 12.5 BTC to 6.25 BTC on May 12 2020, the difficulty dropped by 6.0% and 9.3%  in the two following adjustments.


how to get the whole balance of a privatekey or publickey BTC As there are some bitcoin address types of one privatekey or publickey. I can get the balance of one address, but how can I get the whole balance of the privatekey or publickey. How can list all the address from one privatekey or publickey. What's more how to process multisig address which generated from not the same privatekey of publickey.

next to the answer from MeshCollider, I would like to outline a bit more, what can/cannot be done...

  How can I get the whole balance of the privatekey or publickey?

a priv/pubkey pair can generate several addresses. A privkey is the most standard used for P2PKH addresses (beginning with "1" on bitcoin network). They can be derived from a compressed or an uncompressed pubkey. A good playground is here. Then you can create P2SH addresses, of all kind with this key. They would start with a "3". And yes, multisig addresses would just be one of the possibilities. There are many combinations possible (1-of-1, 1-of-2, 1-of-3, 2-of-3, 2-of-4 ...), each resulting in a different "type 3" address. So if you have created the addresses within bitcoin client, you can use the command "getbalance". This command is linked to accounts, and once the addresses are grouped in accounts, one can display total balance in wallet or particular accounts. Addresses used in accounts can be seen with "getaddressesbyaccount", and then the addresses can be evaluated with "listunspent", gripping for the address you need. There is also the command to see the total amount received per address (getreceivedbyaddress).

In summary: you may want to create some coding logic to use the API calls. The API calls list is available in the source code, or in the wiki.

  How can list all the address from one privatekey or publickey?

as MeshCollider explained, this needs some manual setup, nothing in bitcoin client that fits the request.

  What's more how to process multisig address which generated from not
  the same privatekey of publickey?

When you created the multisig address with bitcoin core client ("addmultisigaddress"), then the client should display the values on this address. When the multisig was created "outsides" of the client, it will not display values for the account, even if you add the address as a "watch only" address (setaccount is now deprecated, and impogrtaddress is obviously the way to go). Anyhow I couldn't make my wallet see a balance on these imported addresses (though I am on regtest, and used txindex=1 in bitcoin.conf).
Even more, if the address is "only" known, and hasn't been used on the blockchain, then the P2SH multisig addresses are covered behind a hash, which is a one-way function. So you never know the details of keys or logic used inside...


Trouble using existing .wallet with MultiBit HD I have an existing .wallet on my PC. I want to use this with MultiBit HD. Is it possible to use this wallet instead of creating a new one?

This is because the two versions use two different types of key management systems.

Multibit HD is hierarchical deterministic key management. All keys generated can be recovered from a seed since the keys are generated deterministicly.

Older multibit clients used single key management where you could not recover all keys unless you had a back up of your wallet or private key.


Where can I download bitcoin core version 0.16.0 I changed my passphrase around march 2018 and now I can't use my new passphrase on the new bitcoin core version. When I put the back up wallet.dat into the new versions of bitcoin core, it tells something about my wallet not being compatible? So where can I download the older versions of bitcoin core, especially version 0.16.0 because it was around that time that I changed my passphrase and back up my wallet.dat. I have tried bitcoin core versions 15.1 and 16.1, but they don't work, so I think 16.0 will work because this was the time with the segwit wallet issue. Or if there is another possible solution, please let me know.
Thanks ahead of time.

As you've explicitly asked for Bitcoin-core 0.16.0 download link, Just went through the links for version 0.16.0 under bitcoin.org & bitcoincore.org & yes, links are broken!

So, even though I agree with Andrew that you may use other minor versions (e.g. 0.16.1, 0.16.3) without any loss, but when it comes to merely helping you to download your desired version, you've got a couple of choices:

Download the source files & Build the client on your own
Use the Docker container here & you will be up & running in minutes.