Chaining unconfirmed raw transactions I'm currently working on a system that provides payouts to users from a bitcoin address as they 'burn' other assets on the site (think something like ShapeShift, where you pay someone BTC to get some other cryptocoin, and you pay this coin back to get BTC).

I'm using public apis to build and send raw transactions using bitcoinjs. However, I have the issue that I sometimes need to wait for previous transactions to confirm before I can send more out. This will often involve bitcoins that will - no matter the result of the confirmation - be mine.

Here's an example. I have 10 BTC, and I have posted a tx to User 1, sending him 5 BTC and 5 BTC back to myself. Now I am sure that I have 5 BTC in my account (regardless of whether the tx confirms) - but this isn't easy to confirm for me, especially when multiple such txs get chained and a lot more inputs and outputs get involved. How do I check and design a transaction so that I can send 3 BTC to User 2?

Can I chain unconfirmed transactions? I understand this would be dangerous if any of the transactions failed (insufficient fee, corrupt data, etc). Setting this aside, would there be a possibility that the transactions aren't mined in the order they are broadcasted - or that a latter transaction is discarded because a former one does not exist in the chain yet?

Finally, is there a better way to do this? For an outgoing bitcoin account that only makes payments to users, what would be the best practice? Would it be useful to split the account into multiple sending accounts - how is this done on existing systems like exchanges?

I understand there is a similar question here, but it does not discuss transaction ordering, and my concern is primarily about setting up an outgoing Payment system by which I can send multiple outgoing transactions per block as payouts.

How do I check and design a transaction so that I can send 3 BTC to User 2?

You reference the 5 BTC unconfirmed UTXO for your next transaction and pay 3 BTCs to User 2 and 2 BTC back to yourself.

  Can I chain unconfirmed transactions?

Yes, you can.

  Setting this aside, would there be a possibility that the transactions aren't mined in the order they are broadcasted - or that a latter transaction is discarded because a former one does not exist in the chain yet?

Yes, there is a possibility. The latter transaction will not be discarded, it will be in another node's orphan tx set so as long as that limit has not been met. So there's also the possibility that some node's orphan tx set is full and your orphan tx will get rejected outright.

Tx1 (unconfirmed, accepted) <- Tx2 (unconfirmed, not yet visible) <- Tx3 (unconfirmed, accepted && orphaned)

The above transaction chain is a valid chain of unconfirmed transaction.

  Finally, is there a better way to do this?

Not quite. The recipient can use CPFP to bump the fees, so the transaction fee that pays for the entire transaction chain becomes greater. That increases the probability of immediate confirmation. Otherwise, you as the payer can use RBF to bump the fees.

  For an outgoing bitcoin account that only makes payments to users, what would be the best practice?

Only pay from confirmed transactions, otherwise pay sufficient transaction fees which results in probable immediate confirmation. You as the payer would still have the opportunity to bump the fees with RBF to provide better user experience. Or you may insist your users to use CPFP to accelerate their receipts.

  Would it be useful to split the account into multiple sending accounts - how is this done on existing systems like exchanges?

Exchanges don't really care about the speed at which recipient receives their fees, they usually pay a decent transaction fee so that you'd receive your transaction in "due course".


Lightning node on a Bitcoin SPV is there a way to run a Lightning node on a Bitcoin SPV node at the moment? I've read that both lnd and c-lightning need a Bitcoin Fullnode at this time.
This might seem ignorant but i don't want to go through the hassle of syncing the whole chain for a small test setup right now. The Bitcoin Lightning Wallet for Android for example claims to run on a Bitcoin SPV so there has to be a way.

Thanks, any help is appreciated.

LND is experimenting with the new Neutrino BIP157-style SPV at the moment. Check out their repo for news.

Both Bitcoin Lightning Wallet and Eclair on Android use a trusted server for syncing with the network.

BIP-37-style SPV is not a good choice for anyone (because of privacy issues), but particularly not for Lightning wallets, because it is very easy for an adversary to help a channel partner in cheating by withholding critical transactions that your wallet would have to respond to.


What percentage of nodes currently support segwit? What percentage of nodes currently support segwit?

It seems Bitnodes could figure this out, but I can't find such a stat on its website.

According to Luke-Jr's statistics, 96.15% of nodes are advertising the Segwit P2P protocol service bit, which implies that they support segwit.


can i use one Mnemonic Code to create both(TestNet and MainNet) wallets currently i am using bitcoinj library to create wallet for both Main-net and Test-net using Mnemonic code(Mnemonic Code is different for both), my question is can i create both Wallets(Test-net and Main-net) using one Mnemonic Code, if yes, then how?

Yes. You can create Mainnet and Testnet wallets using one Mnemonic Code.
Here is an example to switch networks.

> java HelloWorld testnet
> mrbZfHK4MuJYEH98w7gENLsrfnY1e4Lq8B

> java HelloWorld mainnet
> 1C5cNEE5YssHTAfXDYhrYRfXonwJe2u1Wf

.

public class HelloWorld {

    public static void main(String[] args){

        String seedCode = "yard impulse luxury drive today throw farm pepper survey wreck glass federal";
        long creationtime = 1409478661L;
        DeterministicSeed seed = null;
        try {
            seed = new DeterministicSeed(seedCode,null,"",creationtime);
        } catch (UnreadableWalletException e) {
            e.printStackTrace();
        }

        NetworkParameters params;
        if (args[0].equals("testnet")) {
            params = TestNet3Params.get();
        } else {
            params = MainNetParams.get();
        }
        Wallet wallet = Wallet.fromSeed(params, seed);
        Address address = wallet.currentReceiveAddress();
        System.out.println(address);

    }
}


Detailed guide on how to Create a Litecoin Fork, With Pre-mine instructions I need a Detailed guide on how to Create a Litecoin Fork, With Pre-mine instructions, I would be very grateful if someone posted a comprehensive guide on how to Create a Litecoin software fork, with a Pre-mine.

Off the top of my head:

You need a new genesis block.
You need a different address byte (e.g. bitcoin uses 0).
You need to change the default port and rpc port.
You need a way for clients to find one another. You can run a DNS seed.
You need to change the "backup client list" which is a bunch of 32 bit integers which represent IP addresses.
You need somebody to mine initially, because otherwise transactions won't confirm.
You need to alter the default datadir directory.
You need to change the magic number in the protocol header, otherwise your client might connect to the Litecoin network by accident, wasting bandwidth.
You need to change the alert keys, otherwise the Litecoin devs can send alerts onto your network.
Add a transaction to the UTXDB which is your premine transaction

That's all I can think of, though obviously you'd want to change GUI elements to the actual name of your currency.


How to let a peer connect to a peer's peer? I'm testing a new altcoin that I've created between several computers in LAN but encounter a situation as follow:

Computer A's client connects to computer B's client through the B's IP in the addnode field in the config file and only B's IP is specified in it. The same thing happens between B and C as C only knows B through the config file. It seems that there is no connection between A and C since the the command getpeerinfo in both A and C doesn't show the other's IP. Indeed, when I shut down the client on computer B, the two clients on A and C become disconnected to the network.

So my question is: what should I do to make A and C connected since they share a common peer's connection? (assuming that the new common connections are random, not known in advance to be included in the config file)

I've read somewhere that there are seed nodes which stores IPs of clients which have connected to them and that they usually don't need to keep connecting to those new nodes, just save the addresses in the database and disconnect. In case of new peer connects to the network, those seed nodes will help to provide list of peers' IPs. So how can I configure a node to be a seed node? Is it in this case the DNS seed? (I guess it's not)

Thank you in advance and all kinds of help will be highly appreciated.

The basic problem you need to solve is this: B knows about other nodes on the network, and needs to inform A of this.  So, your coin's protocol will have to include some way for this to happen.

In Bitcoin, node A would send a getaddr message to B, and  B would respond with an addr message, listing other nodes it knows about (in this case, C).  Then A can try to connect directly to these nodes.  See https://en.bitcoin.it/wiki/Protocol_documentation for more information about these messages.  If you started with the Bitcoin source for your altcoin, then you should investigate why this isn't happening.

A seed node is a special case of this, to handle the situation where a brand-new client doesn't yet know about any other nodes on the network.  Someone promises to operate a node that should stay working reliably and be available at a specific IP address or DNS name (a so-called DNS seed).  This address or DNS name can then be hard-coded in the client source code, so that new clients will try that node first.  See What is a DNS seed node vs a Seed Node?. Using the getaddr/addr protocol, the seed node can then inform the client of other nodes.  Once the client connects to some of those nodes, it can find out about additional nodes, and so on until the client reaches whatever connection limit it has configured.

In some cases the seed node might be configured to only respond to getaddr requests and not to any other type of request, so that it does not get overloaded with relaying blocks, transactions, etc, and stays available for its main job of helping clients find each other.


How could block propagation time be reduced? This website measures block and transaction time propagation.. At the time of writing, the time required for 90% of surveyed clients to get a block is about twelve seconds. (I just averaged the last five days.)

How could this be reduced? On a related note, what are the major causes of propagation delay? Is this primarily caused by network latency, network bandwidth, or by clients verifying the block?

Related:

How long does it take for blocks to propagate?
"Information and Propagation in the Bitcoin network", by Decker and Wattenhofer.

Gavin Andresen wrote a bit on the topic here: O(1) Block Propagation.

Essentially, he is implementing the conclusion from your answer, a way to get around resending all transactions when propagating a new block. He is working on implementing Invertible Bloom Lookup Tables to use for set reconciliation. IBLT excel at comparing sets of significant overlap, and therefore are very efficient at relaying the differences between included transactions and Mempool of recipient.


How do I use the XPub to generate the Public addresses Given the XPub and an address, can I write an algorithm to say whether or not that public key was derived from that XPub and consequently belongs to the same user?

Given the XPub and an address, can I write an algorithm to say whether or not that public key was derived from that XPub and consequently belongs to the same user?

[Edit: my terminology was off, answer edited substantially to be correct]

Given the xpub and an address, you would indeed be able to discern whether the two are related.

BIP32 is the specification that describes hierarchical deterministic (HD) wallets. To extend a parent public key, it is combined with the chain code and the index, then hashed through HMAC-SHA512. The hash output is split in two, and the 'left half of the hash' is added to the parent public key, to produce the child public key.

So by knowing the xpub (parent public key + chaincode), you can write an algorithm to determine if the two addresses have a parent/child relationship, and you would be able to find additional child addresses.

Without the xpub, remember that BIP32 derived keys are otherwise indistinguishable from any other keys. So you can not just look at an arbitrary address and know with certainty how it was derived.


A Butterflylabs 5 GH/s Bitcoin Miner running at 270 Watts? A 5 GH/s Bitcoin Miner is running at around 270 Watt. I tested it with an Wattmeter. Is that a reasonable amount of Watt? In the comparison list on Bitcoin.it it says that those devices are running at 30 Watts! What is wrong with this miner?

If you can hold your hand on the Bitcoin Miner for an extended period of time without burning it, I doubt the cube is consuming 270 Watts. What does your mining software indicate the temperature is?  My two cubes run at temperatures between upper 30s and low 50s Celsius. (These cubes do make nice winter hand warmers for cold typing hands:-)

Once you rule out the cube is not sucking the power, the question then becomes what about the associated power brick or the integrity of the meter. Again, imagine the heat a sixty Watt indecent light bulb puts out.  If your brick can't be held for an extended period of time without burning your hand, you got a bad brick that mightbe a fire hazard.  Otherwise, you got a bad meter or your house may need capacitive power factor (PF) correction where you plug your cube into an outlet.


How do I provide proof of a transaction for tax purposes? How do I provide proof of a transactions for taxation purposes?

I suppose that you want to (legally, not scientifically (Big difference!)) prove that you issued a certain transaction.

First off: State the transaction ID so it can easily be looked up.

You can prove that you are in possession of the private key which issued the transaction by signing a message using that private key. How easy this is depends on your wallet and if your wallet doesn't support it, it depends on your operating system and the software available for it.

With Electrum, it's super easy:

Just right-click the address you sent the money from and choose Sign/verify message.

This window opens:

Enter a message which says that you (state your full name) issued the transaction:

Click the Sign button. You will be prompted for your password. After entering it, the signature will be printed in the bottom text area:

State this signature along the message you entered (Every character needs to be exactly the same!) and the transaction ID.


Where can I download the Litecoin binary for OSX? Where can I find a compiled litecoin minerd binary for Mac OS X?

Perhaps a multi-coin implementation?

Asked it in the forums, and here's the response:

https://bitcointalk.org/index.php?PHPSESSID=039d3d0433adcf037196613c03d139e1&topic=47417.msg605132#msg605132

Edit - direct link to github downloads


Get notified of incoming Bitcoin transaction, as soon as it broadcasted After a few weeks of searching for an answer, I decided to ask here.

I want to accept a Bitcoin payment, to a specific wallet, and immediately, when the user approved the payment, to receive an indication that the payment was made.

The problem is, I don't want to wait until it is verified in a block, which takes around 10 minutes, I need the approval in seconds, not minutes.

How can I receive an indication that a Bitcoin transaction was occured to my wallet, in the last seconds?

If using the wallet notify option in bitcoin.conf, you can get a notification any time a transaction occurs on the network that matches a bitcoin address in the wallet. To use this, of course, you'll have to keep Bitcoin-QT or bitcoind running at all times.

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

Once you have the transaction id, you'll have to look up the transaction, either at an online service like blockchain.io or use a bitcoind json-rpc command to learn more about the transaction and what action you would like to take.


How to calculate velocity of Bitcoin? So determining the value of bitcoin is not the question at stake here.

Suppose there's a new bitcoin with a production algorithm that's tied to the feedback rule proposed by McCallum and adjusts according to a datafeed of Nominal GDP.
http://en.wikipedia.org/wiki/McCallum_rule

Part of the feedback rule linked above is the variable of Velocity. It's pretty straightforward to calculate it.
http://en.wikipedia.org/wiki/Velocity_of_money

There are other threads such as This one and This one too that ask similar questions, but debate over the actual solution.

Can anyone provide a straightforward answer? Velocity will have to be calculated in a way other than simple bitcoin days destroyed since the velocity figure from this calculation would be far too high if actors transfer between personal wallets.

edit: topic=46241.0 <-- thread on bitcointalk discussing velocity as well. (Won't let me link directly)

I don't see how this can be possible. Obviously you can look at the block chain to see the transactions that occurred, but since addresses are anonymous, there's no way to tell whether a given transaction transferred coins to a new owner (which should count toward velocity) or to an address belonging to the same person (which should not).


Solo mining on OS X with Diablo Miner I want to test Solo mining on OS X with Diablo Miner, so I pass options:

./DiabloMiner-OSX.sh -u my_user -p my_pass -r 8332

and I get:

[5/1/13 11:01:37 PM] Started
[5/1/13 11:01:37 PM] Connecting to: http://localhost:8332/
[5/1/13 11:01:37 PM] Using Apple OpenCL 1.1 (Aug 10 2012 19:59:48)
[5/1/13 11:01:38 PM] Added GeForce 9600M GT (#1) (4 CU, local work size of 512)
[5/1/13 11:01:38 PM] ERROR: Cannot connect to localhost: Connection refused
[5/1/13 11:01:38 PM] Added GeForce 9400M (#2) (2 CU, local work size of 512)
[5/1/13 11:01:38 PM] ERROR: Cannot connect to localhost: Connection refused
[5/1/13 11:01:38 PM] ERROR: Cannot connect to localhost: Connection refused
[5/1/13 11:01:39 PM] ERROR: Cannot connect to localhost: Connection refused

What could be the reason for this error?

Make sure That you have, in your bitcoin.conf file located in ~/Library/Application Support/Bitcoin at least the following:

server=1
rpcuser=<username>
rpcpassword=<your_password>

Restart Bitcoin client, enjoy Bitcoin solo mining. ;)


Who would buy my bitcoin? (Hypothetical question) Lets say if 1 BTC = $1000USD tomorrow and I have around 1000 BTC, how would I sell my 1000 BTC to put $1,000,000USD in my bank account?

Even a better hypothetical question.

If I go back in time and buy 10,000 bitcoins for half a dollar (USD) back in 2009 and wish to cash it on 2013 when 1BTC was around a grand, whom or how would I sell all my BTCs to get the maximum profit? How much should I have paid in taxes?

A lot of exchangers have such liquidity but you will encounter issues with withdrawal limits depending on your verification level. Also I don't think you can expect transfers of that magnitude to happen at once - they will likely chunk it out by agreeing it with you.

As for the tax, it all depends where you live as I believe you will be taxed on income.

We all wish we could go back in time - however you have to look to the future, what tells you 1 Bitcoin won't be worth $100,000 in 5 years time?


berkeley db debian wheezy I am trying to make a website that supports bitcoin, but I cant install bitcoin core because berkeleydb is under 4.8. I tried installing it via apt-get squeeze repository but that didn't work. I also downloaded the tar.gz file and installed that but that also didn't work. Does anyone know how I can install berkeleydb or what linux distro has full support of berkeleydb?

Here is good guide (read comments too)
https://www.howtoforge.com/tutorial/how-to-compile-and-install-bitcoin-core-on-debian-wheezy/

also you can use bdb 5.1 (./configure --with-incompatible-bdb) if you don't have a plan to move bitcoin data to/from other computer


Current Bitcoin symbol: Who designed it, when and why? I am looking for informations about the authors of the current symbol used for Bitcoin. I am also interested about any brand design explainations such as graphic guidelines, and the way this symbol was adopted (contest, vote, imposition…). As a supporter of the symbol Ƀ, I am not sure this choice was right.

The very first icon (created by Satoshi) is visible here:
https://bitcointalk.org/oldSiteFiles/images/screen3.png

Satoshi later updated this using the B with two vertical strokes
https://bitcointalk.org/index.php?topic=64.0
http://i.imgur.com/D6pj0.png

He never posted much about why he chose this symbol. It was not in use before Satoshi put it in the logo.

The current Bitcoin-Qt logo was created by bitboy:
https://bitcointalk.org/index.php?topic=1631.0

This logo replaced Satoshi's old one when the bitcoin.org GUI was rewritten from wxwidgets to Qt by Wladimir van der Laan. I don't think there was much discussion about it.


Why is it recommended to "not send round number amounts when making payments" for increased privacy? I got this advice today to increase my Bitcoin privacy:

Do not send round number amounts when making payments (eg send 0.00104103 BTC, instead of 0.001 BTC)

Why do they say this? Why does the amount matter? And either way, it's not like I normally can "decide" how much the amount is, unless shuffling coins around my own wallets?

To understand why this is important, you need to understand how a bitcoin transaction is structured. Bitcoin uses an 'unspent transaction output' (UTXO) model, I would recommend reading through this question for more info on that.
So each transaction is composed of one or more inputs, and one or more outputs. As example, if you have a 0.50106550 BTC output, and you want to send someone a payment of 0.2 BTC, then your transaction may look like this (ignoring transaction fees, for simplicity):
Inputs: (0.50106550 BTC)  ->  Outputs: (0.2 BTC) (0.30106550 BTC)
Now consider what someone who is watching the blockchain can infer, just by looking at the amounts in this transaction. Knowing that the excess value from the input will be paid back to the user as a change output, it becomes fairly easy to infer which of the two outputs is the payment (0.2 BTC), and which is the change. This becomes even more clear when including transaction fees: the chance of ending up with a change output that has a small number of significant digits (ie, a round number) is very small! By making this inference, the observer can start to map out which outputs are owned by which user, and this is obviously not good for privacy.
On the other hand, consider the situation if the transaction is tweaked slightly, to remove the round number payment:
Inputs: (0.50106550 BTC)  ->  Outputs: (0.20010852 BTC) (0.30095698 BTC)
Now it is less clear which output is the payment, and which output is the change. As a consequence, it becomes more difficult for a third party observer to determine who owns each output from this transaction. Which one is the payment? Which one is the change? It is difficult to say, based on only the output values. Note that in this case the payment amount was increased by ~0.054%, which is relatively small.

Breaking heuristics like this represent a small gain in privacy, but it is a very simple and easy way to increase privacy nonetheless.


Does more fees means quicker transaction ? lets say hypothetically , two persons having access to same private key. makes a transaction with 1 input and 1 output.

person 1 sets fees = 500 sat/Byte
person 2 sets fees = 10 sat/Byte

case 1 :

both the persons broadcasts transaction  at the exact same time.

Which transaction goes through and which gets marked as double spend ?

case 2:

person 2 (with lower fees) broadcasts at 0 second
while
person 1 (with higher fees) broadcasts at 1 second

Which transaction goes through and which gets marked as double spend ?

There is no definitive answer.  Each miner can make their own decision to include either of the two transactions (or neither) in either case.  Whichever miner is lucky enough to find the next winning nonce, their decision determines which transaction is confirmed.  (If that miner chose neither transaction, then the can is kicked down the road.)

In practice, a miner's "decision" depends on the algorithm used by their mining software.  A "greedy" algorithm might choose the higher-fee transaction in all cases; if they get the lower-fee transaction first, they would initially include it in their candidate blocks, but then replace it with the higher-fee one if that one arrives later.

A "naive" algorithm might just choose the first transaction which is seen by the miner, and not replace it by a later transaction, even if the fee is higher.  (Even if they are sent at the same time, the miner has to process one of them first; this might come down to infinitesimal differences in network propagation, and make the choice practically random.)

You could also imagine more perverse algorithms that always choose the lower fee, or the later arrival, or make the choice in some other bizarre way.

There's also the possibility that a miner receives one of the transactions, adds it to their candidate block, but finds a winning nonce for that block before the second transaction arrives.  In that case, they would presumably already have published their winning block, so they can't do anything with the second transaction even if they want to.

I don't know whether there are any statistics as to what fraction of miners use which algorithm.


Do unconfirmed transactions expire after some time? Sometimes confirmation process is very slow. I think that is because of the price of the fee. In that time, is it possible to cancel the unconfirmed transaction and re-send with higher transaction fee?  Are there any expiry features? E.g. the transaction will be canceled after 7 days?

As far as I read other posts, the answer is NO. If so, do I need to wait for the confirmation forever? For instance, when I set a zero transaction fee accidentally.

In addition to Mark S.'s answer, since Bitcoin Core 0.12 there actually is an expiration in the mempool, which evicts unconfirmed transactions after N hours, where N is set by -mempoolexpiry, and defaults to 72 hours.

This is not a reliable feature, as wallets (and really, anyone) can rebroadcast the transaction, but helps keeping the mempool fresh.


How to get my 24 word seed using bitcoin-cli I've tried:
bitcoin-cli sethdseed 'word1 word2 ...'
but i got invalid private key.
please help me getting my 24 word seed using bitcoin core

You can't.
Bitcoin Core is not BIP39 compliant.


Private Key in HD Account Bither Watch Only I have a watch only HD account in Bither and I've got a password of the wallet but I don't have a private Key. I need to send  BTC received in that account to another address in another account

If you don’t have the private key, you cannot spend the bitcoin in a watch-only wallet. There is no way to find, calculate, or recover a private key for a given address.

After all, if you were able to do that, Bitcoin, and many other systems that use public key cryptography, would be broken.

Beware: some scams involve a scammer telling you to pay for access to a private key for an address that was set up as a watch-only address. If this sounds like the situation you are in, so not send the scammer any money, you will likely receive nothing in return.


Is there an easy-to-use tool for creating and signing offline transactions? From what I understand, signing a transaction offline means I don't have to ever expose my private keys to a web-connected computer. From what I've found, the only program that allows something like this with WIF keys is sx, are there any other tools that perform something like this? Or is sx the only way do accomplish this?

You can do this using Bitcoin Core, and it'll be even easier with Bitcoin Core 0.10's watch-only wallet support.

With the current Bitcoin Core, you create a wallet on your offline machine.  Using it, you get one or more addresses (saving them, for example, to a text file).  You copy those addresses to your online computer and give them to people to pay you.  When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it.

Core dev Greg Maxwell has instructions for all this on his site: Offline Signing Demo.  There's another example aimed at developers on Bitcoin.org: Offline Signing Example.

The problem with both methods is that you need to know the TXID of any payments made to the addresses corresponding to your offline keys, and current (December 2014) versions of Bitcoin Core don't make that easy.  However, the next version of Bitcoin Core (0.10.0) will include watch-only address support.  So you'll take that list of addresses you generated and use the new importadddress RPC command to add them to your wallet.  The private keys will still be offline, but your online Bitcoin Core will track those addresses as if they were regular parts of the wallet.  Then you'll be able to use the listunspent RPC to get the TXIDs and vouts for incoming payments without any extra work.


Transfer bitcoin from gdax to my nano s and now it’s pending I transferred 1.05 bitcoin using gdax to my nano s
and now it is pending in my Coinbase account without
any miners fee or transaction ID. I was never given a
chance to review the transaction! The receiving
address is correct. What do I do?

Quoted from GDAX:

  Withdrawal transactions will be generated instantly, and the value
  withdrawn from your account.

  There are occasional delays with both deposit and withdrawal
  transactions. If you believe that your transactions are taking too
  long, please contact us and provide as much of the following
  transaction information as possible:


How to generate public and private key pairs from the 12 seed words in python I basically followed the instructions here How to generate mycelium addresses from the 12 words in python

So my code is similar:

from bip32utils import BIP32Key
from bip32utils import BIP32_HARDEN
from bip32utils import Base58
import os, bip39

strength_bits = 128
entropy = os.urandom(strength_bits // 8)
wallet_generator = bip39.Mnemonic('english')
mnemonic = wallet_generator.to_mnemonic(entropy)
assert wallet_generator.to_entropy(mnemonic) == entropy  # see, bijective!

# Or specify the mnemonic directly if you prefer:
mnemonic = 'aware report movie exile buyer drum poverty supreme gym oppose float elegant'
passphrase = 'test'

seed = bip39.Mnemonic.to_seed(mnemonic, passphrase=passphrase)
key = BIP32Key.fromEntropy(seed)
account_number = 0
i = 0
print "Address: " + key.ChildKey(44 + BIP32_HARDEN) \
         .ChildKey(0 + BIP32_HARDEN) \
         .ChildKey(account_number + BIP32_HARDEN) \
         .ChildKey(0) \
         .ChildKey(i) \
         .Address()

And I verified it using https://iancoleman.io/bip39/#english that the generated address is indeed the first address that this webpage generated as well. However, I also want to get the public and private key pairs using this same library. I originally tried:

print "Public Key: " + Base58.check_encode(key.ChildKey(44 + BIP32_HARDEN) \
         .ChildKey(0 + BIP32_HARDEN) \
         .ChildKey(account_number + BIP32_HARDEN) \
         .ChildKey(0) \
         .ChildKey(i) \
         .PublicKey())

print "Private Key: " + Base58.check_encode(key.ChildKey(44 + BIP32_HARDEN) \
         .ChildKey(0 + BIP32_HARDEN) \
         .ChildKey(account_number + BIP32_HARDEN) \
         .ChildKey(0) \
         .ChildKey(i) \
         .PrivateKey())

However, the output of these two calls are not the same as the ones provided by the website above for the same address.

So my question is: what's the proper way for me to generate the public and private key pairs?

Edit: To clarify, for the exact mnemonic and passphrase above, the website I'm using for reference tells me the first address and keypair should be:

While the output of the above python code is:

Address: 1K6WQtD7bLQ5nQ14GyBV33mBWSbkiRKhQs
Public Key: 62Yi9HBYYagf8CY1Ve2fquHKjBqAA7GFjGUUtkUHbkP5PHzv3W
Private Key: EGHMsAp7nY7Jo9F589zCU227KBLTDhiwRq5vYVvRVZxJNPJn4

So the address matches, but not the keypair.

Please try the following demo, and the result is same with https://iancoleman.io/bip39/.

$ python3.6 test.py
{'addr': '1A9vZ4oPLb29szfRWVFe1VoEe7a2qEMjvJ',
 'coin': 'BTC',
 'mnemonic_words': 'aware report movie exile buyer drum poverty supreme gym oppose float elegant',
 'privatekey': 'L3g3hhYabnBFbGqd7qReebwCrRkGhAzaX4cBpYSv5S667sWJAn5A',
 'publickey': '029dc2912196f2ad7a830747c2490287e4ff3ea52c417598681a955dcdf473b6c0'}

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import pprint
import binascii
import mnemonic
import bip32utils

def bip39(mnemonic_words):
    mobj = mnemonic.Mnemonic("english")
    seed = mobj.to_seed(mnemonic_words)

    bip32_root_key_obj = bip32utils.BIP32Key.fromEntropy(seed)
    bip32_child_key_obj = bip32_root_key_obj.ChildKey(
        44 + bip32utils.BIP32_HARDEN
    ).ChildKey(
        0 + bip32utils.BIP32_HARDEN
    ).ChildKey(
        0 + bip32utils.BIP32_HARDEN
    ).ChildKey(0).ChildKey(0)

    # return {
    #     'mnemonic_words': mnemonic_words,
    #     'bip32_root_key': bip32_root_key_obj.ExtendedKey(),
    #     'bip32_extended_private_key': bip32_child_key_obj.ExtendedKey(),
    #     'bip32_derivation_path': "m/44'/0'/0'/0",
    #     'bip32_derivation_addr': bip32_child_key_obj.Address(),
    #     'coin': 'BTC'
    # }

    return {
        'mnemonic_words': mnemonic_words,
        # 'bip32_root_key': bip32_root_key_obj.ExtendedKey(),
        # 'bip32_extended_private_key': bip32_child_key_obj.ExtendedKey(),
        # 'path': "m/44'/0'/0'/0",
        'addr': bip32_child_key_obj.Address(),
        'publickey': binascii.hexlify(bip32_child_key_obj.PublicKey()).decode(),
        'privatekey': bip32_child_key_obj.WalletImportFormat(),
        'coin': 'BTC'
    }

if __name__ == '__main__':
    mnemonic_words = "aware report movie exile buyer drum poverty supreme gym oppose float elegant"
    pprint.pprint(bip39(mnemonic_words))


What if a multibit classic private key is decrypted into garbled codes? 7 years ago I exported the multibit classic wallet and private key, both encrypted. Only remember the key password now. Problems occurred when I tried to decrypt the key in following ways:

installed MultiBit Classic 0.5.17 from web (might be dangerous).
Created a new wallet and tried "tools--import private key". Chose the old key, input the password and clicked "decrypt". The password seemed correct because there wasn't a fail note, which always appeared for other passwords.
Then, when I clicked "import private key", a fail note said "could not understand address in import file".
To compare I exported a new encrypted private key and followed steps above. It worked well. Though the new key had a wrong timestamp in 2014, it didn't hinder the import.

Used openssl in cmd to do direct decryption, found the only code:

openssl enc -d -p -aes-256-cbc -md md5 -a -in multibit.key  -out key.txt  -pass 'pass:myPassword'
that can decrypt the new key successfully. When decrypting the old key, it didn't show any error either, no "bad decryption". But the plain text was garbled like

?躠磱Q?39'ad"t鉼!?狡

_決[qp嗽雔紧鸘:?A濵彆r闞? &*绉i#唹B7鼞_z?

Tried lots of text-code-converter and they only gave different garbled text...
How would this happen? Was the old key exported incorrectly in 2013? Is there any hope?

I think what you are seeing is binary data being viewed using a program (or command) that expects ASCII or UTF-8 encoded character data.
I would add -base64 to the openssl command and see if that produces the results you expect.
If you need the key in a different encoding (like say base58 or WIF) you might have to do that as a separate step using a second command/program.

Decrypting keys from Multibit
I found some instructions for decrypting Multibit keys which don't say if they are for Multibit Classic, Multibit HD or for both. It may be they only work for one and not for the other.

This is the format of the MultiBit private key file
Keys are saved in an ASCII encoded text file.
There is one key per line (empty lines and lines starting with '#' are ignored).
\<Base58 encoded private key\>[\<any number of whitespace characters\>[\<key createdAt in UTC format\>]]

To decrypt a MultiBit private key export file use:
openssl enc -d -p -aes-256-cbc -a -in \<ciphertext file\> -out \<plaintext file\> -pass pass:\<password\>

Note that this command lacks the -md md5 option you used. I would try this version.
The OpenSSL manual page says

-md digest
Use the specified digest to create the key from the passphrase. The default algorithm is sha-256.

so this would affect decryption.
The results you are reporting suggest that either the instructions you used don't apply to the particular version of Multibit you used or that you don't have the correct data file or perhaps don't have the correct password.

Importing keys into Electrum
According to instructions for importing keys into Electrum, Electrum needs the key in Wallet Import Format (WIF) so you'll need to convert your exported Multibit key into that format. It looks like it is easiest to start with a hexadecimal representation rather than the Base58 Multibit and others use.
Note that you can't just import a private key into Electrum at any time. You can only do that when you first initialise and create the Electrum wallet, not subsequently.


Python code to generate private ECDSA key Would this Python code generate a valid ECDSA private key?

import random

def r(a, b):
    sys_ran = random.SystemRandom()
    return sys_ran.randint(a, b)

def create_private_key():
    hex_chars = '0123456789ABCDEF'
    ran_hex = '';

    for i in range(64):
        ran_hex += hex_chars[r(0, 15)]

    max_hex = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'

    if int(ran_hex, 16) <= int(max_hex, 16):
        return ran_hex
    else:
        return create_private_key()

private_key = create_private_key()
print('Private key: ' + private_key)

As far as I can tell from the Bitcoin wiki, an ECDSA private key is any 64 character hexadecimal (or the corresponding decimal) number between 0x1 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141. It doesn't mention anything about any special algorithms required for the private key to be valid.

Yes, it will generate a random ECDSA private key in hexadecimal ASCII form. You don't really need to specifically check whether the key is greater than the maximum -- pretty much every implementation that will take an ECDSA key in hexadecimal ASCII knows how to handle a key above the maximum sanely. (By subtracting the max value from the key and then using that.)


Is a 'seed phrase' independent of the type of wallet? I have had a few things happen on my PC and for the moment can't directly call up my bitcoin in its old wallet. There are files from various wallets sitting in my home directory but before I try to get a wallet program to retrieve from them, will find a piece of paper where I wrote a seed phrase.

The question is, can this seed phrase be entered into any wallet, whether it is Armory, Electrum, Wasabi, Bither to get the bitcoin back, or must I be careful to install exactly the same wallet which gave me the seed phrase in the first place?

First of all, some software wallets imports are supporting only 12 word or 24 word combinations.
Some support different BIPs and thus path derivation schemes (32/44/84) by default, and some only single one of them.
Some have additional feature for a specific seed passphrase.
All of the differences you can check on https://walletsrecovery.org/

So to answer your question, you have to install the wallet that uses the same seed format and path derivation as the one you've originally created.


How does the blockchain resolve arbitration issues? I understand that a bitcoin wallet is nothing but a transaction record performed on the block chain.
How are transaction details updated in the decentralised block chain?
In a centralised system a transaction is based on the transaction record maintained in their centralised servers. For example A and B are connected to centralised C. When   A initiates a transaction with B, C refers to its centralised database and verifies whether it is a valid transaction and permits the transaction based on the validation results. In other words, there is a central log for cross verification and debugging to settle issues when there is arbitration needed by any one of the two transacting parties.
But in decentralised transaction there is no centralised arbitrator. How is arbitration provided in case of a misplaced transaction?
In other words is there any confiscate mechanism to strip the owner of his bitcoins who is involve in illegal practices?

I understand that bitcoin wallet is nothing but transaction record performed on block chain.

A bitcoin wallet stores keypairs, and allows the use to interact with the network by sending/receiving bitcoin transactions.

How are transaction details updated in decentralised block chain?

A 'full node' can be run by a user that wants to independently verify the state of the network for themselves. Each full node keeps their own local copy of the network state (blockchain history), and the nodes communicate new blocks and transactions to each other. By doing so, all of the nodes will come to agree upon the current network state, without the need for a central server.

How are arbitration resolved in case misplaced transaction.

Network nodes follow a set of rules (often called 'consensus rules'), that allow them all to arrive at the same conclusion about what the network state should be. In the event of conflicting blocks, the chain with the 'most work' is eventually ruled the valid chain.

In other words is there any confiscate mechanism to strip the owner of his bit coins who involve in illegal practices?

No.


How are transactions verified by nodes other than the initial receiver? If I understand correctly, when I create a new transaction from my wallet, I have to sign it and encrypt it. My wallet encrypts the message using the public key of the node it is connected to, so it can decrypt the message when it receives it, and signs the message with my private key, so the node knows it was me who sent the message because my public key is then sent along with the message.

What I don't understand is that when this message is transmitted to the other nodes for verification, how can they decrypt it if it was encrypted using the initial node public key. Furthermore, I read that also the miners should verify the validity of the transactions they have received. How can they decrypt the transactions?

If I understand correctly, when I create a new transaction from my wallet, I have to sign it and encrypt it. My wallet encrypts the message using the public key of the node it is connected to, so it can decrypt the message when it receives it, and signs the message with my private key, so the node knows it was me who sent the message because my public key is then sent along with the message.

You understand incorrectly. Nothing is encrypted in Bitcoin, there is no need to do so, and, as you noticed, it would make it impossible to verify the contents of the transaction.

Transactions are only signed. The signature both ensures the integrity of the transaction and proves that the sender is actually allowed to send the Bitcoin.


At what prices I will be buying/selling bitcoins? Scenario 1:

I bought k bitcoins at unit rate X in the past, with amount A. If I want to sell them now, I look at three unit prices:

Buy Price
Sell Price
Spot Price

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

Scenario 2:

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

Buy Price
Sell Price
Spot Price

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

For the sake of understanding, lets say I am using either Coinbase or GDAX

List item

to buy/sell in both above scenarios.

Thanks

Scenario 1

Using a simpler example, if you visit bitcoin.com.au to sell Bitcoin you will get the sell price for k Bitcoins. In this example, it is a spot sell price.

Scenario 2

Using a simpler example, if you visit bitcoin.com.au to buy Bitcoin you will pay the buy price for k Bitcoins. In this example, it is a spot buy price.

Elsewhere

On market exchanges, the buy and sell price are market indicators. These are the general level of the buy and sell orders. You can creae a buy or sell order for, usually, any price you like but the indicators show current trade values.

If the exchange lists a spot price, this is usually their spot buy price, for if you wish to sell to the exchange directly without creating a market order and waiting.


Do we have failed transactions in bitcoin? I was checking the failed transactions and gas used in Ethereum: https://blockchair.com/ethereum/transactions?q=failed(true)
Do we have similar transactions in bitcoin that I can compare with?

No, a bitcoin script has to evaluate to true to be spendable.
https://en.bitcoin.it/wiki/Script


Confirmations on sent/receive transactions, still have 0 balance I've tried to transfer Bitcoins from one address to another address, both of which I own. I bought a new computer, so I downloaded the Bitcoin client for OS X, and transfered from the old computer to the new computer. This was before I realized I could simply copy over my wallet.dat file.

This was also before I had a good idea of how Bitcoin actually worked. Just a few minutes after I hit send on the transfer, I shut down the old computer and put it away.

I sort of forgot about the whole thing until yesterday evening. I tried to check in on my balance and found it at 0.

However, after about an hour, I see that there are transactions in my Bitcoin client for the Bitcoins sent, and the Bitcoins received.

The received address is mine, there is a credit for the amount of Bitcoins I sent, and there are 20k+ confirmations for that transaction. The weird part is that transaction is dated 6/15/2011. The sent from transaction address is also mine, there is a debit of the correct amount, there are 68 confirmations, and the transaction is dated 8/6/2011.

The problem is that the balance is still 0.00.

Is there something I can do to make sure I still have these Bitcoins? Is it a matter of waiting until there are more confirmations? Have a made a horrible mistake?

It is possible if the client crashed it didn't finish processing the block containing your transaction (due to bad timing) and now that it is past that block doesn't go back to "double check".

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

There is a command line argument -rescan which forces the client to recheck every block for transactions related to the current wallet. In windows it would be done from Command prompt "bitcoin -rescan".  I assume OS X has some sort of commandline option.

Alternatively you can stop the client.  Make a backup of your wallet.dat.  Delete all the files from bitcoin configuration folder other than wallet.dat file.  Restart the client.  It should show 0 blocks and not have the "bad transaction".  The client will download the blockchain. This could take an hour or more.  Once block chain is fully downloaded the transaction should appear and balance updated.


How do I generate a bootstrap file on Ubuntu? I would like to generate a Bitcoin and Dogecoin (qt) bootstrap file on my ubuntu machine. Is there any way to do this? I know it's possible with Windows but I'm on Ubuntu.
Thanks.

Find your local blockchain:

cd ~/.bitcoin/blocks

Or, to bootstrap testnet, find your local testnet blockchain:

cd ~/.bitcoin/testnet3/blocks

Concatenate all your blkxxxxx.dat files and place the result in bootstrap.dat:

cat blk* > bootstrap.dat

Warning: Using tar -cf (as instructed by this answer) did not work for me.  I'm importing from bitcoind into btcd.


How to generate a Litecoin Private key and correspondent Public Address in C# I found this C# tool to generate addresses for Bitcoin (compressed and uncompressed):

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

https://github.com/casascius/Bitcoin-Address-Utility

It works perfectly for Bitcoin, but for Litecoin it seems not to work.

Any ideas how to use similar code to generate Litecoin Addresses?

Thanks

That's odd, since BAU's docs say that they ought to work with Litecoin. In the drop-down menu that selects the coin type, have you selected Litecoin?

Alternately, if you're willing to run an RPC node, you could use BitcoinLib, and call CoinService.GetNewAddress(String).

Generally, it's exactly the same as generating Bitcoin addresses, except that the version byte is 48 instead of 0.


What happens when a fork/network split occurs on the Stellar network? Say some country decides to somehow block all outgoing Stellar connections for 30 minutes. With a voting based consensus that Stellar has chains in both networks progress with a similar speed. After the network split is over there will be two Stellar networks with a diverged history.

How would such an outcome be resolved/avoided with the new consensus changes? Is there some way to determine which network state is correct after the split? Can the smaller split network know that it's split and pause accepting transactions?

Assuming people chose adequate quorum slices and the system has quorum intersection (which is how the system is intended to be used), then with Stellar's new consensus protocol, at least one of the two partitions would be unable to settle transactions for the duration of the network outage.

Stellar does allow for redundancy, in that validators can have multiple slices.  For example, a slice might consist of any 5 out of 7 validators spread across countries.  In that case, if the partitioned country has only 1 or 2 validators, the rest of the world can continue to make progress.

This kind of scenario is actually unavoidable.  You have to chose at most two out of Consistency, Availability, and Partition tolerance.  This is sometimes known as "Brewer's theorem" because Eric Brewer conjectured it and Seth Gilbert and Nancy Lynch subsequently proved it.  See: http://www.cs.luc.edu/~pld/353/gilbert_lynch_brewer_proof.pdf


Electrum: seed is 0 length . Lost seed Its been months since Ive used my electrum wallet.

When I try and send coin I get an invalid password message.

Then when I go to my seed, I type in that same password and it takes me to the seed generator and says my seed is 0 length.

I see there was someone else with this same issue, he was just two characters off. If thats the case, I kind of know my password. What kind of brute force programs could I use to crack my password?

Thanks

This is probably because you entered a wrong password. There was an old version of Electrum that sometimes returned a zero length seed instead of raising an Incorrect Password error.

Before posting issues, upgrade your software.


What is Delegated Proof of Stake (DPoS)? I know that it is a consensus algorithm that is different from Proof of Work (PoW) and Proof of Stake (PoS) which is used in a few blockchains including but not limited to STEEM, BitShares and ARK, but how does DPoS work?

Important distinction of DPoS from PoS is that in DPoS, there is no minimum stakeholder token requirement to participate and instead of stakeholder tokens proportionately representing their ability to produce blocks, users cast votes proportional to their stake to select block producers.

The process for reaching consensus in a round can be broken down into the following basic steps.

Block producers are elected by the stakeholders in a round of voting.
Once the producers are selected, they are deterministically given a
round-robin rotation for a round of blocks equivalent to the number
of producers selected.
This creates a competitive market within the    round, ensuring
reliability.
Block producers validate and broadcast    blocks to the network.
Consensus is reached and the next round    begins.

For their services, block producers receive a reward. If they do not produce a block, then there is no reward and the reward is transferred to the next block producer if a successful block is produced. Producers do not have the ability to change transaction details, however, they could collude to prevent specific transactions from being included in blocks.


College Economics Student in Support of Crypto Looking for Live Hashrate Data I am a college economics student doing a Thesis project in support of the long term viability of Crypto. Does anyone know where I can get live Hashrate data for free or for sale? I appreciate it - thank you!

You can get a current estimate of this info by running the bitcoin-core full node software and calling the command:
bitcoin-cli getnetworkhashps


Why can't someone create a valid digital signature without knowing your private key? I understand from the following two posts that private keys are not displayed by the sender when getting their transaction validated by the bitcoin miners:

What happens to Private Key on Payment

How can transactions be verified without the private key?

Instead a digital signature is provided that is based on the Private Key, and, as far as I understand, that digital signature is verifiable when "compared" to the Public Key.

Why then can't someone generate a verifiable digital signature using only someone else's public key?

Or put another way, quoting an answer from the first post listed above:

"A valid signature cannot be created without access to the private key" - why not?

Bitcoin uses something called the Elliptic Curve Digital Signature Algorithm (ECDSA) for signing and verifying transactions. Read the linked Wikipedia article for exact process of how ECDSA works. If you understand how the modulo operator works, it should make sense as to why you can't make a signature without the private key.

It's kind of hard for me to explain this as it does rely on some complex mathematics, but I will try.

To produce a valid ECDSA signature, you need the private key, which is a large integer. It is explicitly used in the signature creation algorithm, but the public key is not. Furthermore, the public key is not an integer like the private key; rather it is a point on an elliptic curve. So even if you know the public key, you can't create a signature with it because it is not the private key and you can't recover the private key from the public key.

The private key cannot be recovered from the public key because of a problem called the Elliptic Curve Discrete Logarithm Problem. From Wikipedia:

  it is assumed that finding the discrete logarithm of a random elliptic curve element with respect to a publicly known base point is infeasible: this is the "elliptic curve discrete logarithm problem" (ECDLP).

The private key is the discrete logarithm. Although this is an assumption, it has been shown in practice that ECDLP is a hard problem, i.e. it is hard to find the discrete log given a base point and public key point. So you can't get the private key that is required in ECDSA to produce the signature.


Generate my own public/private key to secure my bitcoins I have a few bitcoins on a bitcoin platform (Kraken). I do not trust any bitcoin platform. I want to own my bitcoins.

I do not trust Ledger devices too.

What i want to do is to generate my own public/private key and keep this keys on a paper in my pocket.

Here is what i want to do. Can you tell me if it is good:

First, i want to build a bitcoin node on a dedicated server

git clone -b 0.18 https://github.com/bitcoin/bitcoin.git
Next, i will wait to download all blocks on this server.
Next, i will generate an address:

bitcoin-cli  getnewaddress
Next, i will send all my bitcoins to this address through kraken website
Next, i will export my public/private key with this command:

bitcoin-cli dumpwallet export.txt

Next, i will print or save export.txt file
Next, i will ERASE the dedicated server.

Can you confirm me i will own my bitcoins if i only keep export.txt file ?

As long as you have the wallet dump, you will be able to access your bitcoin.

However, your approach doesn't line up - if you are already at the point of not trusting hardware wallets, trusting a random dedicated server is not a reasonable approach. In fact, a dedicated server may be a worse choice simply because you have no control over the storage drives - it is trivial to recover deleted files from most drives, especially when such a small amount of data is being written.

Additionally, you also are exposed to any compromise on your local machine. The moment you copy over the wallet dump, or even cat it, anyone who has reasonable access to your local machine via a remote access tool or other malware will be able to see the keys.

The entire point of devices like the ledger is to ensure that the private keys are never, ever placed on any computer at all. They exist solely on that device, and on the paper backup of the mnemonic words.

If you want to go a step further, you can use something like the Cold Card (this is not an endorsement, I have no relation to them, and cannot vouch for them). These aren't even connected to a computer at all, and work with PSBTs via SD cards.


Why do so many bitcoin exchanges have their bank accounts closed and have problems establishing bank accounts? I find it really strange that it happens that so many Bitcoin exchanges have their bank accounts closed.
Outside of the Bitcoin world, I find it very unusual to have a bank account closed, for a reason other than inactivity. The only case I remember is Julian Assange's Swiss Postfinance.ch account closed.
Maybe it's a specific practice of banks in certain countries?
Many banks that I had been dealing with, seemed to have the attitude that everyone with a passport (for individuals) or company papers (for companies) can just open an account, no matter what his business is - whether he is trading spaghetti, sand on the beach, air or voucher codes - it's none of the bank's business. Their only worry is whether the person who opens the account is really the one who he says he is. The bank doesn't have to understand your business, their business is to verify ID and do maths. The rest is the customer's business and responsibility. Of course, the bank has to report transactions over a certain threshold and/or suspicious to a certain government agency, but closing accounts?
Maybe it's the matter of attitude, common practices, banking culture being different in those countries that the banks closing the accounts where established? The Bitcoin exchanges accounts are closed mostly in "old" western EU (UK, France), and the much more relaxed "no bullshit" attitudes of banks I have encountered is mostly from Central/Eastern EU banks ("new" EU countries).
Is it common for western EU banks to be so picky about customers, and closing accounts despite meeting formal ID requirements of the companies?
The sometimes mentioned claim that it might be illegal to "hold other people's money if you are not licensed to do it" is not very plausible, as any business "holds other people's money" for some time, and there are even ones which sell "numbers which hold a value" for money - prepaid vouchers for mobile phone recharges for example. That voucher is usually a 16-digit long number that holds some value - if that is fine, then Bitcoin must be no different - both are basically selling numbers which hold monetary value.

Countries have AML (anti-money laundering) laws that limit activities that could enable money laundering. A Bitcoin exchange arguably can be used for money laundering. Even if the letter of the law doesn't say anything specifically relevant to Bitcoin, banks don't want to take chances.

To be able to respect AML and other laws, banks do need to know a few things about the owner and the business, and they have a "know your client" procedure for it. For most businesses this goes uneventfully, for others (e.g. Bitcoin exchange) it could be a problem.


Can a resynchronization be avoided when recovering a wallet in Bitcoin Core? I have tried to restore my wallet by replacing wallet.dat with my file, but the issue is that Bitcoin Core started synchronizing from 8 years again. Can some one help me to avoid this because I frequently format my system. So, is there any way to avoid needing to repeat the synchronization?

I have tried -rescan too but it did not work. :(
It shows my transaction history but does not show my balance for which I assume the sync needs to finish.

The only way to avoid a full resync is to make sure your backup contains the blockchain as it was when you made the backup; not just your wallet.

Then the core should only need to update with any more recent transactions.

Here is a good article on the subject:  http://bitzuma.com/posts/moving-the-bitcoin-core-data-directory/

And here it is from the Wiki:  https://en.bitcoin.it/wiki/Data_directory


building a multisig transaction using RPC I´m trying to build a multisig transaction using RPC. Till now my code looks similar to this:

At first I get the unspend outputs calling listunspend()

With those UTXOs I´ll try to create the rawtransaction:

createrawtransaction
'[
{"txid":"03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0117","vout":0},
{"txid":"03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0116","vout":0}
]'
'{"mwCwTceJvYV27KXBc3NJZys6CjsgsoeHmf":0.05}'

The result of this call I use for signing:

signrawtransaction
020000000117017d17e296b4cd41cd63758bff8aadf214410505ccaeddb4252579ccffa4030000000000ffffffff0100b4c404000000001976a914ac19d3fd17710e6b9a331022fe92c693fdf6659588ac00000000
'[
    {"txid":"03a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0117","vout":0,"scriptPubKey":"a91421ce1507d06ed2742be0bf18a018bbcdd812a26487","redeemScript":"00149835f2e0dff9d7f6a4060140696bc7e00b12edd5"},
    {"txid":"13a4ffcc792525b4ddaecc05054114f2ad8aff8b7563cd41cdb496e2177d0116","vout":0,"scriptPubKey":"b91421ce1507d06ed2742be0bf18a018bbcdd812a26486","redeemScript":"10149835f2e0dff9d7f6a4060140696bc7e00b12edd6"}
]'
'["cMahea7zqjxryy6NWaKxmhDyb1JzuNKCZAg8sxaJoXSBkRXjnib9"]'

At this point I get the error Missing amount and I can´t figure out why.
I´m not sure which values to use for the signrawtransaction() call. Should I use the same txid and vout values as for the createrawtransaction? Where do I get the correct scriptPubKey and redeemScript values from?

Note: the provided txid´s and addresses are only samples (maybe not valid) and not the ones I´m using for my code.

UPDATE:

Latest unsigned raw transaction in BTC live net:

020000000195b96fa7fff141564feba34cb669bdeb94953c98ae864465623def3fbe9e9fb10100000000ffffffff01e87a0100000000001976a914d05bddfbc9059d06168b7bf08bd20d5f1fdaf79588ac00000000

if you are on testnet/regtest, it is completely ok, to provide "correct" data (no need for masquerading). There is the famous 2-of-3 multisig from Gavin, which provides a step by step approach using RPC. This should give you the idea behind.

Generally you are correct, you would search for listunspents, take one of the transaction numbers, and see in the transaction, which unspent output you can use (usually it is a 0 or 1 for the first or second). And for sure this transaction should have some amount, that you can spend. Use "decoderawtransaction" to see the details of the tx. When you have created the tx with "createrawtransaction", then it returns a string of data, that can be used as parameter to the "sign" call.


Why I can't do a transaction by use sendtoaddress? It's seems like this question, but it's no clear show. I have followed this step by step, and after finish last step which generate a block to confirm the transaction, I couldn't see my second address have add money (bitcoin). Anyone who encountered such problem?

My bitcoin.conf

[frank@localhost bin]$ cat ~/.bitcoin/bitcoin.conf
rpcpassword=this_is_a_password_for_api_call

Run my bitcoind like

[frank@localhost bin]$ ./bitcoind -regtest -daemon
Bitcoin server starting

Run my bitcoin-cli as

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
0.00000000

[frank@localhost bin]$ ./bitcoin-cli -regtest generate 101
[
  "7b611f41281c882c7b786c74e01b70e990c102aefb5fc28ee12c1d5b90156fb3",
  "505699b3bcb9faa394cb3533ed970ca48195643e1a034fc8fe64a34e019e12cd",
  "3845286183586d91f3b6a64aa5fb7f741378747b82ed781bc32e2a9d79ac22af",
  "342c881a888de56524368fc04735edfbb23ab1767717df8f9c68218a57b852ee",
....]
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
50.00000000

You can see what I've done at above, everything so far so good. When I try to do the following thing, I meet some trouble.

[frank@localhost bin]$ ./bitcoin-cli -regtest getnewaddress
2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV

[frank@localhost bin]$ ./bitcoin-cli -regtest sendtoaddress 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV 10
89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18

For now, I will list all transactions to you:

[frank@localhost bin]$ ./bitcoin-cli -regtest listunspent 0
[
  {
    "txid": "89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18",
    "vout": 0,
    "address": "2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV",
    "account": "",
    "redeemScript": "0014b24df37ce7d779a84b06b35517fae3c8229daa3c",
    "scriptPubKey": "a914910f020cef414bcafc49ab1236c82be6367045f287",
    "amount": 10.00000000,
    "confirmations": 0,
    "spendable": true,
    "solvable": true,
    "safe": true
  },
  {
    "txid": "89d08e5517a8f40cfca50b0323c835056c166255d8430897affa6c1cde797b18",
    "vout": 1,
    "address": "2NDjzxeozTK8uZ567tCBvCY9aqCL5wKL4rs",
    "redeemScript": "00143a1c7678f95db28e17c47ab32e9a7e8be5b5150a",
    "scriptPubKey": "a914e0d3b4074fdb1a3defd5ca0e660d3c656b0b054087",
    "amount": 39.99996240,
    "confirmations": 0,
    "spendable": true,
    "solvable": true,
    "safe": true
  }
]

You can see the transaction's confirmations is 0, it's mean no confirmed. so last step I will generate a block to confirm it. but before confirm I simply check both account's balance.

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
49.99996240
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV
0.00000000

And we absolute sure the transaction is submit, so go on.

[frank@localhost bin]$ ./bitcoin-cli -regtest generate 1
[
  "0636e8cba682cc382833923e23028664e49ade44764cdf81b375b59675b84e7e"
]

Okay, We have generate a new block and it's also successful. How about the balance? let check it.

[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance 2N6UDwsexfRwRmRYwDFeWjmPvaXtkrsRnFV
0.00000000
[frank@localhost bin]$ ./bitcoin-cli -regtest getbalance
99.99996240

Sadly, I got nothing in the dest account, but the origin account has increment the balance .So my question is how it's going ?

I think it did work, but the getbalance function does not work as you expect. The ./bitcoin-cli -regtest help getbalance reveals that getbalance returns

  "The available balance is what the wallet considers currently
  spendable."

The address you generated with ./bitcoin-cli -regtest getnewaddress is probably just a script that routes the funds back into your main account, so it's address is different, but can be spent using the private key in the main account. You can verify this by ./bitcoin-cli -regtest listaccounts and seeing if it returns something like:

{
  "": 10.00000000,
  ...
}

The "" account is the default account, and you can get it's address using: ./bitcoin-cli -regtest getaccountaddress "".

It might be more convenient to generate an address as a new bitcoind wallet account. Try using:

./bitcoin-cli -regtest getaccountaddress "<optional_name>"

Then send the coins to that address and check it's balance using ./bitcoin-cli -regtest listaccounts


Transaction shows transferred instead of sent and zero bitcoins sent to zero recipient I sent 0.00185 BTC to this bitcoin address 14UdCugXpW3ukYgGPNM18v3VqVxyp3S3Ak using blockchain.info wallet,
But transaction log shows 0.0 BTC transferred to zero recipient with transaction fee boldly written.

The transaction has been confirmed in blockchain but the recipient address is not showing on the transaction log and blockchain.

Don't know if the recipient have seen the bitcoin.
Please help.

TX ID :
https://blockchain.info/tx/6e4c6f24326f922201f90874663d609bf787639f13c8ca9378dd09183b09dc11

The TX id you posted is wrong. The correct one is https://live.blockcypher.com/btc/tx/a6334b9b391d98083b3f011d6fcf5e097f5c67dbe10ecf41442d335a4694ae2f/

It is showing that 0.00185 BTC was indeed sent to: 14UdCugXpW3ukYgGPNM18v3VqVxyp3S3Ak

After that a large TX was sent that contains 58 inputs one of which is 14UdCugXpW3ukYgGPNM18v3VqVxyp3S3Ak

TX: https://live.blockcypher.com/btc/tx/792405e7a85a468d0cbfa99ac7fc7c4409942768a91d26eb13e8fb9efba46c95/

If the recipient and the owner of 14UdCugXpW3ukYgGPNM18v3VqVxyp3S3Ak did not sent that TX, the priv key of 14UdCugXpW3ukYgGPNM18v3VqVxyp3S3Ak is most likely got compromised and the funds were stolen. Sorry.


How much will Segwit *actually* increase bitcoin capacity for realistic transactions? I often see claims that Segwit increases transactions per block by 1.7x to 2x. I'm not sure if this is true, but if I do the math myself, I don't get this number.

My understanding is:

1) The “weight” calc changes from:

weight = transaction size
to:
weight = non_sig_siz * 4 + sig_size

where total max "weight" per block goes from 1024^2 to 4*(1024^2).

Really weight is a new concept, previously it was measured in bytes.

2) That typical transactions are around 500b, and that signatures are 65b of that. They vary, but you can check here for average historical transaction sizes:

https://tradeblock.com/bitcoin/historical/1h-f-tsize_per_avg-01101

3)

((500.0 – 65.0)*4+65)/4.0 = 451.25
1-(451.25/500) = 9.7%

Suggesting we’d only get about 10% not 70-100% more transactions with segwit.

I'm not sure if there a mistake in my math, or my understanding of segwit weights, or typical tx sizes, or something else. I've seen 1.7 to 2x in posts from people more knowledgeable than me, so I would be interested to see how this works.

Of course if transactions were not typical, and had almost nothing but signature data in them, you could fit far far more transactions in a block.  E.g. if you could find a way to create a transaction that was only signature data, you could fit about 8x as many transactions per block, though those transactions would be useless.

For typical realistic use cases, is my 10% figure in the right order of magnitude, or is there something I'm missing that would allow 2x as many realistic useful transactions?

Note that the scriptSig field is not just the ECDSA signature itself (65 bytes) but also the public key in the case of a P2PKH input, or the redeem script for a P2SH input, and a couple more bytes for sizes. Also, there is a scriptSig for every input, not just one per transaction. You are looking at the average transaction size, most of which contain multiple inputs, but then assuming only one signature of 65 bytes.

Let's take an example transaction with a single input and output: https://blockchain.info/tx/82d62d5f4e69ae8338c39b7ae2e1d33db59bdf62c869ded7344adc936bab8653

This transaction is 226 bytes, 108 bytes of which is the scriptSig (including the length byte), which is nearly half the size of the transaction. Because the average transaction has more than just one input, the multiple scriptSigs make up a higher percentage of the total transaction size in those transactions - on average around 60% of the transaction. Taking that into account gives you the estimated increase on average, which was based on simulations run with the new rules according to current usage I believe.

  Really weight is a new concept, previously it was measured in bytes.

Indeed, it's misleading to say weight was the transaction size in bytes before this new weight was defined, you should compare the old size to the new virtual transaction size (which basically is what you did anyway by dividing by 4)


In MuSig-DN why not use a truly random number for the nonce instead of a pseudorandom function? In MuSig-DN why not use a truly random number for the nonce instead of a pseudorandom function (PRF)? If the nonce space is big enough it would never be reused.
This question was asked by emzy on Twitter.

This question was answered by Tim Ruffing on Twitter.

The answer is simply that it's not easy to get truly random numbers
right in practice. For example, you need to collect entropy in your
system, and it's hard to write a "test" that checks if your numbers
are really random.
Broken random number generators have led to numerous real-world
failures e.g.
https://www.schneier.com/blog/archives/2008/05/random_number_b.html
and
https://arstechnica.com/information-technology/2013/08/google-confirms-critical-android-crypto-flaw-used-in-5700-bitcoin-heist/
So it's better to simply avoid real random number generators in
practice, and this is well-established best practice for "normal"
single-singer signatures (Schnorr sigs, ECDSA). MuSig-DN makes this
possible for multisignatures, too.
But your point is correct in theory. If you have a working source of
truly random numbers, this will just do the job.

Pieter Wuille and Jonas Nick added on Twitter:

A working source of random numbers and a place to keep them securely
and tamper-proof between the rounds of the signing process.
Or just a place, to keep a counter securely and tamper-proof between
the signing sessions. Ideally combined with an RNG.

But that is also true for the generation of the private key and we tolerate that there?

Perfectly right, yes.  I think the answer here is two-fold:

We can at least try to avoid real numbers as much as possible. Even for key
generation, we can derive all keys from a single seed, and then we
really rely on randomness only once in the life of a wallet for that
seed

It seems that the randomness is particularly brittle when it comes
to nonces used in signatures. For example, if you fix a single bit in
the nonce, then a few signatures may already be enough to derive the
secret key.

And maybe my second point is not even a valid one. I don't know enough about the concrete attacks to tell if signatures become suddenly insecure when we fix a single bit in the secret key (instead of the nonce)?

Diego Aranha added on Twitter:

Your second point is valid when applied to nonces, but a lot more than a few signatures are needed for 1-bit bias (something like 2^60 for an attack of feasible complexity for secp256k1). Fixing bits of the private key should just reduce the key space

And Akira Takahashi added on Twitter:

Indeed, attacking 1-bit nonce bias of Bitcoin ECDSA is currently out of reach, but 2-bit bias is already exploitable given about one million signatures and 3-bit only requires several thousands (or even less if lattice attack works). Not sure how bad a biased private key can be.
A middle-ground solution would be to include some nonce as PRF input. This way, you retain security even if the nonce is not truly random (proof: https://ia.cr/2016/290) and it should thwart the devastating rewinding attack on Schnorr multisig without ZKP.
But just to be clear, this solution still breaks down once the honest signer reuses the nonce. Dealing with such a stateful scheme is annoying and this is why purely non-stateful solutions like MuSig-DN are preferred in practice.


Buying and selling Bitcoin on a hardware wallet and not sending to an exchange How can I buy and sell my Bitcoin from a Trezor or Ledger hardware wallet, without sending Bitcoin to an exchange?
For example, are there any hardware wallets that allow you to keep your Bitcoins on a hardware wallet and buy and sell. This would mitigate the risk of an exchange getting hacked.

Both are quite easily done. Selling and buying bitcoin, straight from a hardware wallet, can be done at the so called 'fiatgateways' such as www.satos.nl (dutch), I believe Changelly deals with the same strategy. You simply open an sellorder and simply send the amount you have set to sell to the walletadres (straight from your ledger) given by the fiatgateway. Buying is exactly the same at these fiatgateways, not an exchange which comes in between your coins. Your keys, your coins! :)


How to burn confidential assets or pegged bitcoin on Bitcoin Liquid sidechain I used to burn bitcoin sending to a bogus address like 1111111111111111111114oLvT2

There is any equivalent confidential address for Elements/Liquid?

destroyamount is the rpc call you are looking for

https://github.com/Blockstream/liquid/blob/3f937d39f7c516e49f62d05c12d41b63b79ca043/src/wallet/rpcwallet.cpp#L586


how to create a transaction that can only run in bch-abc using javascript? I use the "bitcoincashjs" or "bch-lib" and want to add a new opcode "OP_CHECKDATASIG" to output.How to do?

const utxo = {
    'txId' : 'b76e4563bfe2e9e40355e3791e060b774ceb9ba04bef70df151763f82acb69a0',
    'outputIndex' : 0,
    'address' : '1bbLNcTwoffAjuWTyBuu4vSwNUBNMgYgHL',
    'script' : '76a9147f27b2a0a88bc84d3db72f22ea82d52c99a6a0e088ac',
    'satoshis' : 2000
    };

    const transaction = new bch.Transaction()
    .from(utxo)
    .to('1bbLNcTwoffAjuWTyBuu4vSwNUBNMgYgHL', 1500)
    .sign(privateKey);

They added it to their examples.md recently.

var privateKey = new bch.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var utxo = {
  "txId" : "115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986",
  "outputIndex" : 0,
  "address" : "17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV",
  "script" : "76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac",
  "satoshis" : 50000
};

var transaction = new bch.Transaction()
    .from(utxo)
    .addData('bch rocks') // Add OP_RETURN data
    .sign(privateKey);


Person did not receive the amount of bitcoin I sent I sent $4300 in bitcoin to my friend and he only received $415. I'm so upset because I lost over $3500.  Is there any way to get this corrected?

Here is the transaction you sent, displayed by a block explorer:

It can be seen that the transaction created two outputs:

1AHpgNCRHg41wmX4SWvsA8eq7wcN6gPKMi 0.59573100 BTC

1LSpWLjsQS3Z5j49gFXNy8YYHz8sMjUMr4 0.00046671 BTC

I assume that the 1AHpg.. address is what you paid your friend, and the other address is your change. But in any case, neither of the outputs is ~$400 in value currently, so your friend is mistaken/lying to you about what they received (or they are using some extremely broken wallet software).


How is a doublespend prevented in the Lightning Network? How Lightning Network handles double-spend? What will happen when the other person is not available online to enforce the integrity of the transactions?

PFB my understanding of the Lightning Network.

  Lightning Network builds an additional layer on top of the Bitcoin network that enables instant off-chain transfer of the ownership of the Bitcoin. Lightning Network utilises bi-directional payments channels that consist of multi-signature addresses.  Meaning Bitcoin will be held in a multi-signature address where transactions will use a multi-signature address as their input and point at two different addresses as their output. The transactions inside the lighting network are not broadcasted to the bitcoin network as long the channel is open (in order to reduce the load on the blockchain).

In this example how is Alice prevented from double spending?

Alice and Bob both send 0.05 BTC into a shared 2-of-2 multisig address. This requires a transaction on the Bitcoin blockchain.
Alice wants to pay 0.1 BTC to Bob.
      a. Alice creates a new transaction B2 and changes the balance to 0.4 BTC to Alice and 0.6BTC to Bob.
      b. Alice signs B2 and sends to Bob
      c. Now Bob creates a new transaction A2 and changes the balance to 0.4 BTC to Alice and 0.6BTC to Bob.
      d. Bob signs A2 and sends to Alice.
After step 2a (before Bob verifies the transaction), can Alice close the channel and double spend the money?

Doublespends are not possible, because a payment on LN is only considered finalized once both payment channel owners have revoked the previous state of the payment channel by handing their partner a breach remedy that invalidates the previous state.

Thus, Bob should not hand over whatever service Alice was purchasing until the payment is finalized. Once the payment is finalized, Alice can no longer broadcast the old state without opening herself up to the penalty transaction being broadcast by Bob.


What forces transactions to be visible to all miners? How are transactions provided to the miners?  And what keeps the following scenario from occurring?

A valid transaction is initially reported to a "rogue" node, A, in the network.  If that node is a miner, it simply keeps the transaction for itself so that it can (eventually) obtain the incentive the next time it gets a block into the chain.  The network will accept the block since the transaction is valid, eh?

If the A is not a miner, it simply works with a "partner" miner B which gives A a portion of the incentive earned for each transaction A sends to B and B successfully got into the block chain.

So, in a sense, what keeps miners from (illegally) paying other nodes in the network for more (valid) transactions?  In light of something like net neutrality, perhaps miners can pay to for better service from nodes that receive transactions?  How many nodes must know about a transaction before it can be put in a block?

A transaction can go in a block if it's valid (references inputs that are already in the same or previous blocks, scripts are legal and return success, and signatures validate ok), regardless of whether any other nodes have ever seen it before or not.  So if a "selfish" node associated with a particular miner receives a transaction, it's perfectly free to sit on it until it can include it in one of its own blocks.

That's why you don't send your transaction to just one node.  You send it to as many different nodes as you can.  (Bitcoin Core by default will try to remain connected to up to 125 nodes at any given time, and as far as I know it would attempt to send a newly created transaction to all 125 of them.)  Perhaps a few of those nodes are "selfish", but you hope that at least some of them are not affiliated with any particular miner, and will make an effort to relay your transaction as widely as they can, as is the default behavior of standard node software.

With reasonable luck, your transaction will quickly propagate to every miner on the network, and each of them has an incentive (namely the fee) to include it in the very next block they mine.  (If Miner X declines to include it in his next block, hoping to sit on it until he mines another block at some later time, he risks that some other miner Y who has received the transaction will include it in one of her block before Miner X gets to mine a second block.  In that case, Miner X never gets the fee at all.)

So, a node that fails to relay a transaction, saving it for its next block, doesn't do much harm and also doesn't gain much.  A node that tries to save a transaction for a later block does some harm, but also risks a monetary loss, and so has an incentive not to do that.


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

You have to import the keys into electrum. To do that, download electrum on your PC, click on new wallet > import private key > click next and you should see all the coins.

You can do more research by using the bitcoin forum on reddit https://www.reddit.com/r/Bitcoin/


Why do I need my password to generate a new receiving address in bitcoin-qt? I heard that the wallet has 100 of the next receiving addresses already.  Shouldn't I be able to get one of those without unlocking it?

The Bitcoin-Qt/bitcoind client will try to maintain a key pool of unused keys at an even size (default is 100 keys).  So each time you click "New key" it is going to try to add one to the key pool.

These keys in the key pool need to be encrypted, so your passphrase is required to do that.

The getnewaddress API call will, I believe, give you an address from the pool and if the wallet is locked, will simply deplete keys from the key pool without requiring the passphrase to replenish.


How does the mempool work? What happens to the mempool when there are two equal length chains on the network? Is there just one mempool or does each node keep a copy of the mempool?

From my understanding each node needs to keep a copy of the mempool.

If that is true then how is mempool consensus reached? Does it need to be reached?

What happens to mempool transactions when there are two equally long chains on the network?

If I have BTC in my account and send it to someone, but during that time there are two equally long chains on the network, what happens?

Is there a chance that the BTC gets forever lost in a mempool when one of the chains is rejected?

Is there just one mempool or does each node keep a copy of the mempool?

Neither. Every node has their own mempool of transaction they expect to see confirmed. It's not a copy as there is no consistency between nodes.

  From my understanding each node needs to keep a copy of the mempool.

No, mempools are completely optional. You can configure your node to not keep one at all. The only downside is that you won't know about transactions until they confirm.

  If that is true then how is mempool consensus reached?

There is no mempool consensus. If there was, we wouldn't need a blockchain.

  What happens to mempool transactions when there are two equally long chains on the network?

Nodes have just one active chain which they treat as correct. There may be competing chains, but nodes will typically assume that the version they see first will win. If they keep a mempool, they try to keep it consistent with the blockchain as they accept it, not with any possible alternate versions of history.

  Is there a chance that the BTC gets forever lost in a mempool when one of the chains is rejected?

Miners have complete power (together) in determining which transactions are accepted into the chain. It's certainly possible that you issue a transactions which never gets included, but that has nothing to do with chains being rejected.


Discrepancy Between Nonce for Single Block I'm looking at nonce data from blockchain.info for block #1 ( https://blockchain.info/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 ) and it shows a nonce value of 2573394689 However when I take a look at blockcypher.com ( https://api.blockcypher.com/v1/btc/main/blocks/1 ) they report a nonce value of 2083236893 for the first block.

Is this a mistake? Is it possible for there to be a conflict in the true nonce? When I check block #2 both sites show the exact same nonce.

The block presented with the second link (api.blockcypher.com/v1/btc/main/blocks/1) is not the same as the one presented with blockchain.info.

"api.blockcypher.com" says block 1 (Height=1) has a "previous block" of all zeroes:

but that is the block with Height=0, not with Height=1 !.

One could argue that "api.blockcypher.com" starts counting (oddly) on "1", but the problem is that their next block (block 2) has a "previous block" of "00000000839a8..." (correct) which in fact is not their block 1...

That is, there is a gap in their API, and the block with a "previous block"="000000000019d66..." or block with Height=1, is not accessible using block count:

"api.blockcypher.com" block 1 is really the block 0 (Height=0), and
their block 2 is the correct block 2 (Height=2), and so
the block 1 that you are trying to see is unreachable in that API (!).

That also means that Nonce=2573394689 for block 1 from blockchain.info is the correct value.


Sent Bitcoin Cash to a Bitcoin segwit address by accident on my Ledger Nano S Stupid but I sent bitcoin cash to a bitcoin segwit address I own on my Ledger Nano S. They are not shown in either wallet. Did I lose them or is there a way to get them back?

It is in principal possible to get them back, but the danger lies in the fact that as soon as you broadcast your new transaction to get them back anyone can change the receiving address, hence steal your Bitcoin Cash coins.

Bitcoin Cash interprets the outpoint which contains your coins as a P2SH. To spend from it you must provide a redeemscript that hashes to image in the P2SH after which the script itself is interpreted and must also validate.

In your case though the redeemscript is a Segwit redeemscript of the form 0014{20-byte-key-hash} (https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#P2WPKH_nested_in_BIP16_P2SH). Since Bitcoin Cash does not understand Segwit, it will evaluate it as a script that simply contains a push of 0 followed by your public-key-hash and therefore is immediately considered valid.

One solution may be to create the transaction that spends this outpoint by simply providing this redeemscript, but instead of broadcasting it to the whole bitcoin cash network somehow give it to a miner directly that does not broadcast the transaction but only includes it in its block...


A complete bitcoin implementation in Python? I recently became aware that python-bitcoinlib is not a full bitcoin node implementation, but rather a set of tools to work with bitcoin-core cpp. I would like to know whether there are some fundamental issues with implementing a complete bitcoin node using python? Also if it were to be tried as a code-golf exercise (the shortest code to get the full node running) how many lines of code will it amount to in python ??

That strongly depends on your definition of complete. There are a number of implementations that implement parts of the Bitcoin node functionality. For example cdecker/pycoin has a solid network implementation, but does not include wallet management code and validation logic. richardkiss/pycoin on the other hand has some of the wallet logic, but lacks networking. Other libraries include:

vbuterin/pybitcointools
petertodd/python-bitcoinlib

But as far as I know there is no standalone client that includes a wallet as well as the networking code.


After a long connection to the wallet, it offers to reinstall blocks and synchronize all Bitcoin core blocks 1)I installed bitcoin core on an ssd drive. Some time did not include it, a month after the inclusion of bitcoin core when you start the application with ssd asks to re-download all the blocks, the path is correct , and the folder has already downloaded the blocks. I don't understand, my old wallet can't download or wants to download the resulting blocks while offline. Please help to understand.                                      2) If I installed a portable ssd drive I can connect it to any device and use the wallet and funds on it? In such an attempt, it requires downloading blocks again

The restart after moving data to a new machine might be because some program data is stored in the Windows registry (Computer\HKEY_CURRENT_USER\Software\Bitcoin\Bitcoin-Qt) which you might have left behind on a conventional HDD.

In particular the path to the data directory is stored in the registry. However simply the absence of any bitcoin key in the registry may be enough to convince Bitcoin core that it is running for the first time.

You can copy the blockchain data from an old install over the data directory created by a new install, so you can prevent the new install downloading the data you have already downloaded.

See How to transfer only the blockchain to a friend's computer?


When a mining pool pays out to the workers, why does it not just cache the transaction and then pay zero fees on its next successful block? If you had a mining pool that was generating a few blocks per week, then why not just cache all the payout transactions (if the clients were happy to do this) and then just put them in the next successful block it mines - thus saving on transaction costs ?

Sure, you can use your own blocks to send transactions instead of spreading them out on the peer-to-peer network and let anyone include them in their blocks (may require fees).

The upside as you say is that you can save on fees.

The downside is that it can sometimes be a long wait, even for a big pool.

Still could be a good idea to offer these payouts for free, and if you want your coins faster, you have to pay a fee.