Cannot sign txn with change address using bitcoinjs-lib psbt I am having a difficult time figuring out how to sign a spend from a change address. I get Error: cannot sign for this input with the key <value>. The initial transaction works fine, where I generate a transaction with multiple inputs to two outputs, one of them being the change address - it is the same as the spender addresses. Here are the steps:
1) I grab all UTXO for our spending address.

const unspentTx = (await listUnspentTxByAddresses([mainAddress])).data.result;

2) I add all inputs and outputs, sign, finalize, and submit.

  const fee = new BigNumber((await getEstimateSmartFee(2)).data.result.feerate)
    .times(100000000)
    .div(3);

  const output = {
    address: destinationAddress,
    value: parseInt(pullAmount.minus(fee).toFixed(0)),
  };

  const senderBalance = sum
    .times(100000000)
    .minus(pullAmount)
    .minus(fee);

  const change = {
    address: sender,
    value: parseInt(senderBalance.toString()),
  };

  // Adding the output
  psbt.addOutput(output);
  psbt.addOutput(change);

  for (let i = 0; i < txids.length; i++) {
    const transactionObject = await getTransaction(txids[i]);

    const input = {
      hash: txids[i],
      index: 0,
      nonWitnessUtxo: Buffer.from(transactionObject.data.result.hex, 'hex'),
    };

    try {
      psbt.addInput(input);
    } catch (e) {
      console.log('Add Input Failed e =>', e);
      return null;
    }
  }

  const key = bitcoin.ECPair.fromWIF(privateKey, testnet);

  for (let i = 0; i < txids.length; i++) {
    psbt.signInput(i, key);
  }

  psbt.finalizeAllInputs();

  const rawTx = psbt.extractTransaction().toHex();

  const withdrawPendingTx = await sendRawTransaction(rawTx);

This works the first time around, but as mentioned, the second time I call
await listUnspentTxByAddresses([mainAddress]) and follow the same exact procedure, the js library validation prevents signing with the main address key. It doesn't seem to make sense, so I hope there is an obvious error here. I'm pretty sure it's sent as a default P2PKH with SigHashAll.

Simple solution! index in input object was hardcoded to 0 instead of taking the vout nonce from UTXO list. I was going to delete, but I'll leave the post up.


will segwit2x fork affect bitcoin cash I read about the fact that segwit2x will split the BTC in BTC 2X. What will happen to BitCoin Cash BCH.

BitCoin Cash and Bitcoin are two different blockchains. Technically, segwit2x won't affect the BTC blockchain nor the BCH blockchain (the only thing that might be affected is the price of each coin).


Find used addresses of an HD wallet xpub (Extended private Key) End goal is to find all used addresses of a xpub programmatically, in batches, by querying a local node.

This PHP tool ( https://github.com/dan-da/hd-wallet-addrs ) extracts 'normal' addresses from an HD bitcoin wallet . Now I have to query a local bitcoin node to find out whether the extracted addresses have been used or not.

Whether an address has been used or not can easily be found out by querying the node one address at a time ( https://bitco.in/en/developer-reference#getreceivedbyaddress ). Which works but is too slow.

How can the same be done in batches ? i.e is there a Core function call or something to check info about a group of addresses ?

or any other way this can be accomplished ?

Thanks

This process is in general very complicated and – missing a possible transaction – can lead to lost funds. Be careful.
With HD, you always generate publickeys. To find corresponding transaction, you need to turn them into addresses (which involves a bitcoin-script template like P2PKH).
If you just going to create standard P2PKH addresses in order to find transaction, you may miss relevant transactions.
For example: For a long time, Copay used 1of1 multisig (P2SH) for single user wallets. Restoring a such xpriv HD master with just P2PKH can result in lost funds.
Also, you need to know the used BIP32 keypath scheme of the wallet you like to restore. Some wallets are using m/0'/k, some m/k, others stick to BIP44. This makes it again more complex to "regenerate" funds.

Without a fully address-index blockchain, scanning for funds can be complicated and may take serval hours.
Probably best practice is to generate a large lookup window, where the size depends on the type of the wallet. Example: if it was a merchant wallet, there are probably serval thousand key involved. This would speak for larger lookup window.
If you want to use Core, what you can do, is generating addresses in a first lookup window.
Example:

generate pubkeys from m/0'/0 . m/0'/5000 (lookup-window of 5000 keys). Attention, this will not catch BIP44 wallet funds.
You can use a BIP32 tool for that purpose (maybe https://github.com/libbtc/libbtc#the-bitcointool-cli).

Import all these pubkeys into a new wallet (use importmulti in Core 0.14, importpubkey before 0.14 without a rescan).

Restart bitcoin-core with the -rescan option.

Decide if you want to extend the lookup-window (maybe if addresses up to 4900 are used), and start again with 1.)

TL/TR:
Someone should write a script/tool/app.


Why use `update_add_htlc` when paying directly across a channel? If Alice opens a channel to Bob and sends a payment directly to Bob, the following messages are exchanged:
    +-------+                            +-------+
    |       |---- update_add_htlc ------>|       |
    |       |---- commitment_signed ---->|       |
    |       |                            |       |
    |       |<--- revoke_and_ack --------|       |
    |       |<--- commitment_signed -----|       |
    |       |                            |       |
    |       |---- revoke_and_ack ------->|       |
    |       |                            |       |
    |   A   |                            |   B   |
    |       |                            |       |
    |       |<--- update_fulfill_htlc ---|       |
    |       |<--- commitment_signed -----|       |
    |       |                            |       |
    |       |---- revoke_and_ack ------->|       |
    |       |---- commitment_signed ---->|       |
    |       |                            |       |
    |       |<--- revoke_and_ack --------|       |
    +-------+                            +-------+

(source: running lnd with TRACE logging and inspecting the logs)
Why is it necessary to use HTLCs at all, instead of just exchanging updated commitment transactions directly?
For example:
    +-------+                            +-------+
    |       |---- commitment_signed ---->|       |
    |       |                            |       |
    |       |<--- revoke_and_ack --------|       |
    |   A   |                            |   B   |
    |       |<--- commitment_signed -----|       |
    |       |                            |       |
    |       |---- revoke_and_ack ------->|       |
    +-------+                            +-------+

It is not necessary to use htlcs in the case of a direct payment. However as the protocol was designed with the idea to have a network of payment channels. This should allow multi hop atomicity of payments via htlcs.  For that the process with the htlcs to move forward the state in the channel operation protocol were necessary
I think from a design perspective it was cleaner to reuse this protocol for direct payments instead of implementing two protocols and make case distinctions


What is EUR to USD conversion rate at bitstamp? Bitstamp allows deposits/withdrawals using SEPA (EUR only), but all traidings are done using USD. It is nowhere described what exchange rate is used when doing these deposits/withdrawals.

There are some indications that amount of money lost in conversion may be significant:

The order book only offers bitcoin-dollar trading so conversion fees apply on deposits and withdrawals (the conversion spread can be queried by API). [1]
Bitstamp has an EUR bank account in Slovenia to which I deposited euros, then it converted to USD. Then it converted the EUR deposit to USD but I checked the daily EURUSD forex range and Bitstamp converted my EUR to USD at a rate worse even the worst rate in the 24-hour daily range; I have to say, clever: another small profit source for them. [2]

Does anybody know how big the EUR/USD spread at bitstamp really is? Is it significant?

[1] http://blog.kraken.com/post/97016109057/what-does-it-really-cost-to-buy-and-sell-bitcoins

[2] https://bitcointalk.org/index.php?topic=825459.0

I believe the EUR / USD conversions are preformed by the bank with which Bitstamp works. They have conversion rates which don't appear to be market-driven, but are set to a fixed rate that includes the bank's fees.

The exchange rates link provided on the website leads here:
http://www.raiffeisen.si/pripomocki/menjalniski-tecaj/


How to access a blockchain.info wallet's funds from another site like greenaddress.it I have imported a wallet to Blockchain.info but because my country now blocks the access to Blockchain.info I can't access my funds in that wallet. How can I import or somehow link my wallet to another wallet in greenaddress.it.

I have the mnemonic phrase that Blockchain.info created for me, but I don't know if it can be of any help for me to have access to my private key for that wallet without accessing Blockchain.info website. I believe if I can somehow extract the private key for that wallet I can easily import the wallet into greenaddress.it

Can anybody give me a solution

Thanks

You can't move out from blockchain.info to greenaddress.it since they are using p2sh and blockchain not!

You got many solutions:

Create new wallet on greenaddress.it and send your funds from blockchain.info to that new wallet, You can use some VPN software to access it.
install electrum, easy, lightweight and you can import your mnemonic phrase.


Wallet for Rise currency Does anyone know if there's a wallet application for Rise currency? Thank you!

You can use their web-wallet here: https://wallet.rise.vision/


How do I find the transaction ID of what I just transacted? If I send or receive something (with Bitcoin-QT), how can I get the transaction ID of that transaction?

context: I'm playing satoshi bones and they have verification code I can run to make sure they're playing by their own rules.  The game is based on a hash of the transaction ID of what I send them, so I just want to give it a check but I need the transaction IDs of my transactions with them.

verification code supplied by satoshi bones that I want to run:

import hashlib
import struct
def verify(txid,secret,lessthen):
   sha512 = hashlib.sha512()
   sha512.update(secret+txid)
   b = sha512.digest()
   result = struct.unpack("<H",b[0]+b[1])[0]
   if result<lessthen:
      print "win!"
   else:
      print "lose!"

With bitcoin-qt you can look in your transaction history and right click your transaction to find more info, including the txid.

When using bitcoind, the client gives you the txid as the response for a successful send.


bitcoin wallet validation/vetting Is there any validation service that tests/validates/vets wallet implementations?

I use bitcoin-qt on the desktop and I'm not worried about that wallet, I assume it's been well vetted, but if I were to get a wallet for my (Android) phone, is there a way I can be assured the implementation is correct, secure, and not malevolent?

Added elaboration: It seems feasible for a trusted 3rd party to be in the business of validating wallet implementations. Wallet implementers would submit their implementation to the service, the service would run the wallet through a test suite, examine the code, etc. and if the implementation passed the service would publish a hash of the wallet. When you get a copy of the wallet implementation you could check its hash and against the published hash so you'd know it hasn't been tampered with.

Likewise an online wallet service (Mt. Gox) could submit its implementation for 3rd party validation to increase its trust factor.

Short answer: no. Imagine this scenario: a developer writes a closed-source Android wallet that becomes extremely popular. At some point the combined worth of the user wallets is $100M. The developer could have purposely left an open vulnerability, and claimed that a hacker exploited it. There would be no way to know if he was telling the truth.

Rule of thumb: keep the bulk of your BTC in cold storage. Online wallets should be treated like the wallet in your pocket. How much cash are you comfortable carrying around, knowing that you could lose your wallet and it's gone? That's how much you should have in an online wallet.


How to open the port 8332 on EC2 instance? I'd like to access the EC2 instance that installed bitcoin mainnet node.
I've found out that I need to open the port 8332 of instance from the question, but I have not idea how to do it.

I tried to add port 8332 on the security group, however I cannot select 8332 port, only can select 80.

Could you tell me how to open the port and access bitcoin node?

Update

I've set port as the attached picture.
However, it returned the following error.

Connection refused - connect(2) for 'publicIP address' port 8332

It means that I still cannot connect the instance? or I've already connect the instance, but returned error by another reason?

In the Type dropdown menu, change HTTP to All TCP; enter 8332 as the port number; enter the IP of the computer that will be sending RPC requests under 'Source.'


Is there an Electrum based USB Distro? I would like to use a USB with a Linux distro, ideally with Electrum. The advantage of this is that the USB does not need to contain any information, just entering the seed would be enough, which provides extra security in my opinion.

Is there a distribution which does this? or there an instruction on how to do this?

I have considered building a electrum usb-distro but the problem is it would be hard to keep it updated after each new release. However if there is enough interest I might do so.

Your best bet is to simply take a debian live-usb and install Electrum on it; you can follow the instructions for linux on the electrum site.

If you have any specific Electrum questions you are always welcome to join #electrum on freenode and ask your questions there.


What does the index of an UTXO stand for? For example, here is the output of an API I hit with one of my testnet UTXOs. What is the meaning of the index field in this context ?
"utxo":[
    {
        "block_id":1899516,
        "transaction_hash":"14272c8d1be80d57f122ee336a7da655c1443cf6f95a7cfdfad2a1163b2d1247",
        "index":0,
        "value":1943034
    }
]

It is the position of your txo in the outputs array of the transaction that created it. You can see that this transaction created 2 outputs and that your output is the first one (0).
This index is also sometimes refer to as vout.


Random numbers using blockchain How are the block hashes generated?

Are they trully 100% random (generated by hardware) or is it pseudo-random (generated by software)?

Can i rely on it or any other blockchain data to make a 100% trustable raffle?

Regards,

Are they truly 100% random (generated by hardware) or is it pseudo-random (generated by software)?

Pedantic answer: No, they're not random, because the first twenty digits or so will always be zero.

Serious answer: The Bitcoin client does not use any hardware randomness, as far as I know. However, if even a single transaction in the block was generated using hardware randomness, the block hash will incorporate hardware randomness.

Also, I don't think you could predict the hash of a block that hasn't been found yet.

  Can I rely on it or any other blockchain data to make a 100% trustable raffle?

As Greg said, a miner can withhold blocks if releasing them would make the miner lose the raffle. Of course, the cost of withholding a block and not broadcasting it to the network is about $9000, so this attack might not be useful.

  How do I make a trustable raffle

Your method would probably work. This answer discusses how to exchange a secret between two parties that can't trust one another. You could use something based on that.


How to use deriveaddresses via a curl command I am trying to use curl via SSH to utilize the deriveaddresses bitcoin-cli rpc command.

let descriptor = "wpkh(xpub6Dy2ikUu5mXbDdhw2vAP1C4eiQM8rTz1NiWQt2BzGi83iHC2gEgTSD54JveyuHF9VLAqNkCGnee1jdBL7nA3JNorbqjSSS8DEV6Hn3PuNBt/*)#mn5jvyc3"

    let command = "curl --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"deriveaddresses\", \"params\": [\"\(descriptor)\" 99] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8332/"

    var error: NSError?

    let queue = DispatchQueue(label: "com.app.getInitialNodeConnection")
    queue.async {

        if let responseString = self.ssh.session?.channel.execute(command, error: &error) {

            guard let responseData = responseString.data(using: .utf8) else { return }

            do {

                let json = try JSONSerialization.jsonObject(with: responseData, options: [.allowFragments]) as Any

                print("json = \(json)")

            } catch {

            }

        }

    }`

I get the following error:

json = {
    error =     {
        code = "-32700";
        message = "Parse error";
    };
    id = "<null>";
    result = "<null>";
}

Is it not working because I need to escape special characters in the descriptor?

I figured it out, just need a comma after the descriptor param.

let descriptor = "\"wpkh(xpub6Dy2ikUu5mXbDdhw2vAP1C4eiQM8rTz1NiWQt2BzGi83iHC2gEgTSD54JveyuHF9VLAqNkCGnee1jdBL7nA3JNorbqjSSS8DEV6Hn3PuNBt/*)#mn5jvyc3\""

    let command = "curl --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"deriveaddresses\", \"params\":[\(descriptor), 99] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:8332/"

    var error: NSError?

    let queue = DispatchQueue(label: "com.FullyNoded.getInitialNodeConnection")
    queue.async {

        if let responseString = self.ssh.session?.channel.execute(command, error: &error) {

            guard let responseData = responseString.data(using: .utf8) else { return }

            do {

                let json = try JSONSerialization.jsonObject(with: responseData, options: [.allowFragments]) as Any

                print("json = \(json)")

            } catch {

            }

        }

    }`


Cancelling transactions I know it is currently not possible to cancel transactions in the Bitcoin. However, say someone wants to implement such mechanism in an altcoin. Is it theoretically possible without damaging the open nature of cryptocurrencies ? Do we have the required primitives for it ?

One of the fundamental principals of cryptocurrency is to be able to operate without the need of a trusted central entity.
I can't see how a transaction can be cancelled or reversed without involving a trusted central entity to arbitrate the transaction.

However we also have cryptocurrency like Ripple. In my opinion Ripple is not a cryptocurrency because of the centralized nature, but well what do I know.

Maybe in the future some genius will discover a method to implement this without a central entity :)


Cryptocurrency Arbitrage - What do I need to know? I'm curious as how one would go about arbitraging crypto currencies - How does it work? what do I need to look out for? What are the risks and caveats?

Arbitrage - What it is and how it works

Arbitrage refers to the process of instantly trading one or more pairs of currencies or odds for a nigh risk-free profit.

Usually, this involves two exchanges (this is then called a two-legged arbitrage); although more are, of course, possible.

There are several steps when executing an arbitrage:

Find a suitable opportunity
Execute trades
Rebalance accounts

Step 1: Find a suitable opportunity

This step is relatively easy. Simply check the order books of as many exchanges as you like, compare bids vs asks, and check if you can find a negative spread.

A small discourse into what a spread is

I will assume you're familiar with bids, asks and what an order book is - if not, you should definitely look up those first.
As for the negative spread, I'll elaborate a bit more on that. The spread is what is used to refer to the difference between bids and asks - lowest ask - highest bid = spread. This should be (and typically is) a positive value, since the best bid at an exchange must be lower than the lowest ask of an exchange - otherwise the matching engine of the exchange would settle these orders automatically.

In a perfect world, all markets and all market participants would have the same information, hence all top bids and all top asks of all exchanges would be the exact same, after fees were applied.

If you've seen the recent US elections, however, you're probably aware that the world isn't perfect, though. Hence, not all participants of a market know the same thing as the others, resulting in bids at exchanges which are higher than the asks at other exchanges - and this is what is called a negative spread.

Step 2: Execute trades

Let's assume you've found an amazing opportunity at exchange A and exchange B - a negative spread of 100$!

Exchange A: Ask 1BTC@450$
Exchange B: Bid 1BTC@550$

Luckily, you have proper funding at both to match these instantly - but how do you go about doing that?
Easy! Just place an order on the opposite side at each exchange with the quote's prices!

Exchange A: Place Bid of 1BTC@450$
Exchange B: Place Ask of 1BTC@550$

Since your placed order match an order on the opposite side of the book, the trading engine matches them and the trade is settled, leaving you with a theoretical profit of a smooth 100$! Why theoretically, you ask? I'll get to that point further below.

Step 3: Rebalance Accounts

Unfortunately, you were only able to trade once today, but hey! Tomorrow's another day - but in order to be able to properly trade, you need to even out your balances. Right now, your accounts look like this:

Exchange A: 2 BTC | 50$
Exchange B: 0 BTC | 1050$

Hence, you go about and send 1 BTC from Exchange A to Exchange B, and 550$ dollars to Exchange A from Exchange B. No magic here - all accounts are re-balanced and you're ready to make a fortune again, tomorrow.

Exchange A: 1 BTC | 550$
Exchange B: 1 BTC | 550$

Arbitrage - Why everyone's not doing it

This all sounded wonderful? That's exactly what I thought when I first set out with my own arbitrage bot. However, there a some technical aspects that can really turn a sunny day into a poopy rain on your parade.

Caveats and risks

1. It needs to be as close to real-time as possible

This is possibly one of the hardest things to get right, and also the most underestimated aspect of arbitrage in crypto currency. The markets, compared to ForEx trading, are ridiculously slow - at busy exchanges, there may be a couple of dozen trades executed. Which gives the illusion, that polling data for bots via the most common API type, RESTful, is enough to trade risk-free.
This is a misconception. Maybe for today this may appear to be enough - but what if markets picked up the pace? just 1 trade (or simply a placed order) within one second can change your opportunity from profit to loss.

2. Always trade limits, never market orders

Under the aspect of being the fastest, it might seem like a good idea to use market orders in order to be settled asap - you'd be terribly wrong. As discussed above, your data could be as old as 1 second (with above mentioned one order messing up your opportunity) - perhaps someone cleared the entire top level and all you're left with is a bid for twice the price you intended. Yikes.

2. REST API call rates make your life hard

Many exchanges employ a API call rate limit - that is, you're allowed to query data at the exchange X times every Y seconds. The differences are wide and nearly every exchange does its own little thing when it comes to limits.
The problem with them is, they severely limit your actions. If you don't constantly keep an eye on how often you send a request, you might run into the limit when it seriously counts - for example when you have to cancel an order, because you couldn't place its counter part at another exchange.
Unfortunately, websocket APIs are still rare and their brother on steroids, FIX sockets, even rarer - leaving you stuck with the turtle of programmable interfaces.

3. Integration with APIs can be a nightmare

There is no unified, standard definition for what an exchange API can do, or what data it returns. Which technically wouldn't be a problem, if they were documented properly. Incidentally, the exchanges with seemingly many opportunities also have the worst documentation (take btc-e.com's Documentation for example - heresy!).
Of course, also the opposite is true - GDAX, Kraken, Bitfinex all have excellent documentation. But nonetheless you have to dig through them to understand how they work, what their rates are, how they handle data types, authentication and so forth. That is, if they even mention anything about that.

4. Fees will minimize, if not eliminate your profits

In my above step-by-step guide, I purposely omitted fees of all kind. But of course, they're essential to successfully arbitraging. The most commonly known fees, are trade commission fees - these range anywhere from 0.1% to 0.6% and need to be considered in Step 1: Find a suitable Opportunity. On top come fees for deposits and withdrawals during Step 3: Rebalancing Accounts. Depending on your preferred pair, these may range from feasible (transferring crypto currencies usually is cheap enough) to quite steep.
For example, a deposit / withdrawal at Bitfinex entails the following fees:

Bank wire withdrawal & Deposit: 0.1% of amount deposited/withdrawn, 20$ minimum

And this does not include processing fees of your house bank - for me, for example, that's an additional 10€ for deposits, plus a 1% conversion fee.
If you do the math you'll quickly realize that you don't even have to bother starting to trade at Bitfinex, unless you have a really big stack to trade with.

But this does not just apply to BTC-Fiat pairs. Alt-coins suffer a similar fate. In order to make arbitraging worthwhile, you will have to have enough funds at as many exchanges to make trades AND re-balancing worthwhile. And this quickly gets to a point where you realize your last month's savings aren't equipped to get the job done.

  To give you a further example on how fees affect your profits, let's take a look back at the example from step 2, this time factoring in all fees. I'll walk you through it. For the argument's sake, we'll pretend to be a european trading BTCUSD at Bitfinex (Exchange A) and Kraken (Exchange B).

  Bitfinex: Ask 1BTC@450$
  Kraken: Bid 1BTC@550$
  These prices are raw- they do not include trade commission fees, not transaction fees. Let's add those.

  We'll define a taker fee of 0.25% at both exchange - the taker fee applies whenever you remove liquidity from the order book.
  Next, let's add deposit & withdrawal fees to the mix. At Bitfinex, we pay a minimum of 20$ for each fiat withdrawal & deposit, or 0.1% of the moved amount (if its more than 500$). At Kraken, we pay 0.09€ per fiat withdrawal, deposits are free.
  In addition, btc withdrawals cost 0.0005 BTC at kraken, while Bitfinex charges no fees for this. Deposits cost nothing at both exchanges.
  Furthermore, we can't transfer fiat directly from exchange to exchange - an additional 10€ fee per sent out transaction needs to be facotred in, as well as 1% conversion fee whenever we receive or send fiat from our bank account (2 times total).

  Let's list these fees to try and maintain an overview

  Profit from arbitrage (bid - fee - ask + fee )
  Withdrawal Fee Bitfinex  (20$)
  Deposit Fee Kraken (0.0$)
  Miner Fee for withdrawal at Kraken (0.0005BTC)
  Transaction Cost of our house bank (10€) (Bank to Bitfinex)
  Conversion Fee of our house Bank (1% of transfer amount x 2)

  Let's put some numbers to these:

  (550 - 550*0.0025) - (450 + 450  * 0.0025) = 97.5$
  Move ~497$ to House bank = 20$
  0.0$
  0.0005BTC * 500$ = 0.25$ # Assuming this is the end of day price of the  coin
  10€ * 1.05 = 10.05$
  (497 * 0.02) = 9.94$

  Which brings us to net profit of: 57.26$
  This translates to 42.74% reduction of your originally seen profit.

  This is neither a worst, nor a best case scenario - it's merely designed to show you how many hidden fees are involved in an arbitrage. Also, keep in mind that a 22% arbitrage opportunity is practically non-existant.

  As a matter of fact, had the spread been anything less than 40$, the fixed fees of our house bank and Bitfinex alone would have made our supposed arbirtrage opportunity a loss.

5. Volatility of coins is your enemy

  "No matter where the market goes, arbitrage makes a profit anyway!"

This is true - if your currencies don't tend to drop or rise by 50% within 24 hours. Ideally, both currencies you trade in should be relatively stable, while still showing a certain volatility - no volatility would mean the chart is a flat line, resulting in no opportunities for you.

The problem with pure crypto currency arbitrage (LTCBTC), however, is that Alt-coins can go completely fubar - as opposed to a fiat-based crypto arbitrage (i.e. BTCUSD).
A personal anecdote:

  When ZEC launched, I was instantly fascinated at the terrible market efficiency and arbitrage opportunities of almost 5% regularly. Hence, I bought in at 1ZEC@1.2BTC, thinking this is probably where market will stay at (at least it's not as bad as the guy who bought a ZEC for 3k BTC). I started arbitraging and immediately increased the amount of ZEC I was holding - completely oblivious to the fact that since I started trading, the price had fallen to 1ZEC@0.1BTC. My ZEC was worth 90% less, and I lost almost half a bitcoin worth of money.

Some volatility is great for arbitrage - too much volatility isn't.

6. Exchanges aren't as technically robust as they ought to be

Most of the time, you will find that smaller exchanges offer opportunities more often than big exchanges. This is in part due to the previously mentioned slow movement of information, but also their (often significantly lower) trading volume. Initially, this may appear like a steal - but there's usually a reason that particular exchange only has the low volume it currently does.

In a time where any one in the world can open up an exchange running on his Raspberry Pi and Ethereum, trading on the more alternative exchanges can be a serious risk to your investment.

From things like DDOS attacks and overloaded matching engines not matching your orders, to more serious issues like stuck withdrawals due to too low miner fees, or even theft - and the latter is a very real issue not exclusively affecting small exchanges, as the Bitfinex Heist has shown summer 2016; the list of potential technical failures is long and you should be aware of these at all times.

Conclusion

I'm aware this answer is overtly negative - this was intentional. Arbitrage, as well as crypto currency in general, is not the quick buck everyone on forums and dubious sites advertising trading bots make you believe.
While its inner mechanisms and workings are still quite cryptic* to even the most professional traders (sorry for the pun), even the fabled cryptocurrencies adhere to some basic principles, afterall. The 'quick way to wealth' usually will just end up quickly making you wealthless.

(*) Another great myth is that the chinese dictate the BTCUSD market. There is no empirical proven correlation between chinese and american markets. The only defacto correlation that has been found was that of google searches for bitcoin to btc trading volume - but whether this was positive or negative was inclonclusive.

Please feel free to add, comment or make improvement suggestions!


Bitcoin wallet integration with website I'm trying to create a website that will allow me to accept payment in bitcoins. What I need is a way to integrate the wallet with the website so that I can generate a unique address to give each user to deposit the bitcoins. The reason to create a different address for each user to pay is to create a sense of anonymity. The site is purely for transactional purposes and not for mining. How do I generate a unique valid address for each user?

You can use bitcoinjs-lib, a nodejs package which easily generates addresses. Apart from that it manages transaction signing and other useful stuff too which would help in development. You can check out their site (where there is a list of organisations, including blockchain.info, who use their package)

Bitcoinjs


Export wallet from Multibit to Electrum So, MultiBit is not updating the transactions in my wallet, I can see the transactions in the blockchain etc, so the money is there but its just not quite working...

I'm hoping to load that wallet with another client, and have been looking at Electrum.

I read another post on here but it seems to be for an older version and while it tells you how to export keys, which I've done, I can't work out how to import it in to Electrum properly.

Can anyone help me out?

In the current version 2.8.3 of Electrum it's very easy to import Multibit wallets (meaning, migrating from Multibit to Electrum). An important reason to migrate is because Multibit (not HD but the classic one) does not allow to change network fees, which makes it very hard or even unreliable to move funds.

Select wallet in Multibit and choose Tools > Export Private Keys and export without password to a .key file.
Open the .key file with a text editor (e.g. Sublime Text) and copy the private key(s) from the text file.
Create a new wallet in Electrum from menu File > New/Restore, give it a name, a location to save and create as Standard Wallet (other options may also work but haven't tried).
When asked for Keystore, choose Use public or private keys. In the next screen, you can paste your private key(s) from step 2.
You now have a Electrum Wallet with the addresses previously used in Multibit and you can send/receive BTC from this wallet.

Note: The addresses will still be accessible from Multibit, since you can use the same wallet (private keys) from various apps/wallets. I use Multibit now as 'watch only' and not transfer anymore from it.


How do I download the blockchain from a specific height (409668) I'd like to download the blockchain from height 409668 (first block on May 1st). I need data on time it was mined, and the amount of transactions it included.

If I don't need to download the blockchain to get this data, that would be 10x better. Where can I get a CSV of this? Otherwise, where can I download the blockchain and get this data from?

This should make it for you: https://blockchair.com/bitcoin/block/409668

Hope it helps.


My bitcoin transaction does not exist in blockchain.info nor does it exist in any tx accelerator I sent bitcoin to myself using Breadwallet.
Before that, I went to my Breadwallet which I made a purchase from a few days ago and when I login it says something about a payment being rejected so I'm thinking I got refunded for the purchase I made.
I go and try to send myself the bitcoin to my main wallet and then it says there's a transaction error and it said I needed to synchronize the wallet with the block chain or something similar. After that happens, it shows me that my older payment has been sent and my newer transaction of me thinking it was a refund is also being processed and is stuck on 40% but when I try to track the transaction using blockchain.info using the transaction id it says the transaction can't be found. This is the transaction ID: 9c542c7e6f31d313ba637ef95c7a6fc125ab0a0f7ea2e8a790babfac22a3df57

Did you maybe use a very low fee? In that case your wallet may have rebroadcasted the tx while other nodes dont relay it because of too low fee.

I expect you have the mnemonic to recover the breadwallet saved somewhere. Maybe try to deinstall breadwallet and reinstall it using your mnemonic and see what it then shows?


Average payout of mined bucket? What is the average payout of mined btc from blockchain to blockchain wallets?

The block reward for successfully mining a block is currently 12.5 BTC.

By participating in a mining pool the group has a significantly higher chance as a whole of solving a block. Rewards are then shared based on a formula. It can be suggested, though it is not always the only factor in the formula for a mining pool, that your individual hash rate as a share of the pool total hash rate determines your share percentage.


How to handle an old, abandoned Litecoin withdrawal from btc-e.com In 2013 I bought some litecoins on btc-e.com.
I noticed this website is down by now.

I found a e-mail from 11/2013:
"Dear (my login name),

We received a request to withdraw 25.87814001 LTC on purse Lh2x1hcGiRnWJRwGdfJP26sB4zw8j54e6m

To confirm the transaction, go to:
(Removed link)

To cancel a transaction, go to:
(Removed link)

IP: (my ip address)
Login: (my login)

Regards,
Administration of BTC-E.COM"

On https://live.blockcypher.com/ltc/address/Lh2x1hcGiRnWJRwGdfJP26sB4zw8j54e6m/
I found this exact same transaction. Does this mean it still is in the wallet of btc-e? Or is this my external wallet it is transfered to?

Thanks in advance

I sent a message to the support centre of the new exchange (WEX.nz).
I got this automated reply:
"Hello!
We informed in the news that we don't possess historical data on transaction and orders of the old platform, that's why we cannot approve or deny your words about funds deposit. The funds were credited to the new platform WEX.nz in the amount shown in your profile. During the period after BTCE closing and before WEX opening, all transactions were fulfilled out of control of the old platform as well out of control of the new one."

In my profile I got 0.00005462 Bitcoin and 0.00005462 Bitcoin Cash. Thats all.. It's worth about 1 USD.

How can I get those litecoins that still are on my address?

Thanks in advance


Why do two miners get different hashes for the same list of transactions? According to the Bitcoin Wiki:

  it is extremely unlikely for two people to have the same Merkle root
  because the first transaction in your block is a generation "sent" to
  one of your unique Bitcoin addresses.

What does this mean? Isn't the Merkle root the hash of all the transactions in the list? Why would we have a different set of transactions if the point is to validate the same set of transactions?

I think I'm not sure what 'generation' means here.

The first transaction in a block is called the "generation" or "coinbase" transaction. It has no real inputs, and spends no coins. Instead, it pays out the subsidy and fees to the miner that generated the block.

As any two miners will have a different address they want their payout to, their coinbase transactions will be different. If the coinbase transactions are different, the Merkle trees will be different too.

  Why would we have a different set of transactions if the point is to validate the same set of transactions?

The purpose of mining is not validation - every node in the network validates all transactions. The purpose of mining is ordering transactions, so as to choose one of multiple valid transactions that spend the same coins. However, miners are incentivized to only include valid transactions, because if they didn't, the network wouldn't accept their blocks (and their subsidy).

However, there is no guarantee that even ignoring the coinbase transaction, two miners are going to be working on the exact same set of transactions. In fact, if we had technology to guarantee that, we wouldn't need a blockchain or mining at all.

Specifically, it is possible that someone creates two conflicting transactions A and B, which are both valid, but spend the same coin. Clearly only one of the two can be accepted by the network. I connect to a node in Australia and to one in Brazil, and simultaneously send A to Japan, and B to Brazil. Nodes in Asia will likely see A first, and nodes in the Americas will likely see B first. Because of the finite speed of light, you cannot guarantee that any two nodes will see it at the same time. Someone needs to make a call about whether A or B will be accepted. Bitcoin's solution is to let miners choose - whatever the first miner who creates a block that includes A or B picks, wins.


Sending Bitcoins through Tor versus sending them through VPN I bought a VPN subscription using Tor and Bitcoins. The commercial VPN service provider does not know who I am.

Below are my questions:

Could someone tell me whether sending Bitcoins through Tor provides more anonymity than sending them through my VPN service?
Is it true that sending Bitcoins through Tor is awfully slow?
What are the other advantages of sending Bitcoins via Tor?

Well, if you are interested being as anonymous as possible, Tor is far more interesting. The VPN provider may not know who you are but it does know your IP address and the website you are visiting, which is almost the same if it comes in the hands of those you probably want to avoid knowing it.

With Tor on the other hand, node know each other's IP address. As you make a network request with Tor, it will pass through a number of nodes, usually 5 I thought. Of these 5 nodes, only the first one knows your IP address and only the last one can see the request you send. Supposing you use SSL as much as possible, the last node only knows the IP address your request is send to.

All intermediate nodes know nothing about you. So you are in fact the most vulnerable for the first node, because he knows your IP address. But he has no clue what website you are visiting, so no single computer in the Tor network will be able to see what you are doing.

Besides, sending a transaction with Tor does not have to be slow. That's just a small packet. You probably mean that syncing with the network and downloading all blocks is slow. Well, there is not much of a point for doing that via Tor. None of your addresses are sent along with block requests, so you can safely sync blocks over VPN or regular internet. The most information the outside world will get to know is that you are downloading Bitcoin data. But using a VPN that accepts Bitcoin, I doubt if they would be eager to share that information with others.


Efficient way to migrate a pruned node I would like to know what are the step to succefully migrate a pruned node.

I have a Raspnode (rPi2B+) and it is so slow that it doesnt seem to sync the blockchain after several days...

I want to sync the node that I have in my laptop and move it (pruned) to the Raspnode.

I have copy and paste all the files in the .bitcoin folder and when I execute the bitcoind -daemon command the follow is in the debug.log file

2016-03-22 23:25:55 Opening LevelDB in /home/pi/bitcoinData/blocks/index
2016-03-22 23:25:59 Opened LevelDB successfully
2016-03-22 23:25:59 Opening LevelDB in /home/pi/bitcoinData/chainstate
2016-03-22 23:25:59 Opened LevelDB successfully
2016-03-22 23:26:37 LoadBlockIndexDB: last block file = 474
2016-03-22 23:26:45 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=57, size=47829393, heights=403730...403810, time=2016-03-22..$
2016-03-22 23:26:48 Checking all blk files are present...
2016-03-22 23:26:48 LoadBlockIndexDB(): Block files have previously been pruned
2016-03-22 23:26:48 LoadBlockIndexDB: transaction index disabled
2016-03-22 23:26:49 LoadBlockIndexDB: hashBestChain=000000000000000005323717f768df54444ee6dfccbe080548287f120546e6e3 height=403810 date=2016-03$
2016-03-22 23:26:49 init message: Verifying blocks...
2016-03-22 23:26:49 Verifying last 288 blocks at level 3
2016-03-22 23:26:51 LevelDB read failure: Corruption: not an sstable (bad magic number)
2016-03-22 23:27:14 Corruption: not an sstable (bad magic number)
2016-03-22 23:27:14 : Error opening block database.

Do you want to rebuild the block database now?
2016-03-22 23:27:14 Aborted block database rebuild. Exiting.
2016-03-22 23:27:14 Shutdown: In progress...
2016-03-22 23:27:14 scheduler thread interrupt
2016-03-22 23:27:14 StopNode()
2016-03-22 23:27:14 Shutdown: done
2016-03-22 23:39:01 AppInit2 : parameter interaction: -prune -> setting -disablewallet=1
2016-03-22 23:39:05 Prune configured to target 30000MiB on disk for block and undo files.
2016-03-22 23:39:08

The idea is to sync the node in my laptop and then maintain the syncing (and pruning) on the rapsberry pi because I cant run the node all the time in my laptop.

Copying .bitcoin folder should work. Make sure bitcoind is not running (try ps -ef | grep bitcoin)  before you attempt to copy. Also make sure bitcoin.conf is same in both places

Also, change the bitcoin.conf file with the new datadir , rpcuser and rpcpassword


What literal thing is determining the price of Cryptos / stocks? Yes, supply and demand I know. But what literal thing is determining the price. When I see the price changing every second on Coinbase or Robinhood, what is controlling that. Is it an algorithm? What information does that algorithm take in? Is it just one algorithm determining this price, or are there different algorithms and it’s just an estimation? I have never found an answer to these questions.
What I want to know is what physical place is an app like Coinbase getting this changing price from.

The "current Bitcoin price" from an exchange like Coinbase is simply the last price at which a buyer and seller agreed to trade Bitcoin at that exchange, also known as the "last price". Every time a new trade takes place on that exchange, the price is updated.
The current price from sites that aren't exchanges themselves, like Robinhood or Preev, are generally taken as the averages of the prices of all of the exchanges they connect to. Sometimes these averages are weighted, so that the price from exchanges with higher trade volume is weighted more heavily than the price from a very small exchange.


Is scriptSig different for each input? Since scriptSig is a signed transaction hash with the spender's private key, how is the scriptsig different for each input?

yes, it is. For each input you create a raw transaction with the pubkey script in the scriptsig "slot". Then this raw tx gets seigned. Each input has a different "source" (previous input tx and previous input "outpoint"), since they are hashed before signing, it creates a different result. A sample how to do this for two inputs is shown here:

  How to sign a transaction with multiple inputs?


Is there any centralized cryptocurreny? Is there any centralized cryptocurrency? Is cryptocurrency a Bitcoin oriented concept only? From what i read almost all of the cryptocurrencies are derivatives of Bitcoin.

I think you are correct that almost all of the cryptocurrencies are derivatives of Bitcoin.  From that fact it would follow that they would all be decentralized.

That being said, there are centralized aspects of cryptocurrencies, including Bitcoin.  For example, online wallets, exchanges and mining pools are all centralized.


Are there Bitcoin addresses with an odd number of transactions? When I explore the blockchain on blockchain.info, all Bitcoin addresses seem to have an even number of transactions, e.g. 16Zugc8aq9sPkxBYXyYGqJHTizRzT5wTQg has 16 transactions.
I have looked at a lot of other addresses, too, but couldn't find any with an odd number of transactions.

Can anyone show me a Bitcoin address with an odd number of transactions?

I suppose that, normally, people spend their bitcoins soon and/or use several addresses (each one for 1 or few transaction); the following addresses shows an exception, which I, finally, found.

https://blockchain.info/address/126b9vwrfEYH6NehYmUCTjAga4Dg8UocAQ


Race Attack vs. Double-Spending Attack: are they same? Race Attack vs. Double-Spending Attack: are they same?

I know definition of both attack both some times it is called as "race attack" and most of the time called as "double-spending". I guess (maybe) double spending is a subset of a race attack that means race attack includes a groups of different attacks like double-spending, but I'm not sure about that.

It's the other way around. The race attack is a specific type of doublespend attempt. It requires the recipient to accept unconfirmed transactions as payment.

The attacker supplies an unconfirmed transaction to the victim that pays the victim. Meanwhile, they broadcast a conflicting transaction to the network. As the merchant saw their own transaction first, they are under the illusion of getting paid, while the rest of the network predominantly saw the doublespend first and thus it's likely the merchant will in fact not get paid.

This attack is much easier to pull off, when the attacker has a direct connection to the victim's node, and perhaps deposits the conflicting transaction directly to miners.

It is therefore recommended to turn off incoming connections to nodes used to receive payments, so that your node will seek their own peers, and not to allow the payer to directly submit the payment to the payee.

The Sybil attack takes this information asymmetry even further as the attacker isolates the victim from the network and restricts their access to information while doublespending them. Other doublespend attacks rely on having premined a transaction to yourself in a block kept secret before paying a victim with a conflicting transaction (Finney attack), or on having overwhelming hashrate (majority attack).


How to manually sign a transaction with multiple inputs and multiple outputs? I'm developing transaction constructor, but i faced several problems.  To some of which i found answer in How to sign a transaction with multiple inputs?, for the rest i'll try to explain:

When we have multiple inputs and multiple outputs and try to sign every input what do we fill in the output value section for each one of them: The total sum of the transaction inputs or the corresponding amount that every input that we sign has and we distribute between the outputs?

'version': 1,
'inputs': (2)
    {
    'output_tx_hash': 'aaaa',
    'output_position': 0,
    'script': the original script, like: '76a914' + hash + '88ac',
    'sequence': ffffffff,
    }, {
    'output_tx_hash': 'bbbb',
    'output_position': 1,
    'script': '', # Nothing
    'sequence': ffffffff,
    }
'outputs': (2)
    'value' : 100000
    'script' : '76a914' + hash of btc pub key + '88ac'
    'value' : 50000
    'script' : '76a914' + hash of btc pub key + '88ac'
'locktime': 0

In the section script in inputs, there is "Nothing", but what is the exact byte count of it - 1 byte, 4 bytes or something else?
Is there a step-by-step guide or tutorial for manual transaction building and signing that covers multiple inputs and multiple outputs transaction. I successfully send transactions to the blockchain but only the ones with one input.

When it comes to transactions, I think that a hex representation can explain more unambigiously than words.
That's why my answer uses hex along every step of the signature.
Given your P2PKH transaction with two inputs, here's the raw transaction that has to be signed with the private key corresponding to the first outpoint:
01000000
02
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
00000000
19
76a914<your-first-pkhash(160bit)>88ac
ffffffff
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
01000000
00
ffffffff
02
a086010000000000
19
76a914<hash-of-target-btc-pubkey1(160bit)>88ac
50c3000000000000
19
76a914<hash-of-target-btc-pubkey2(160bit)>88ac
00000000
01000000

Here's the raw transaction that has to be signed with the private key corresponding to the second outpoint:
01000000
02
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
00000000
00
ffffffff
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
01000000
19
76a914<your-second-pkhash(160bit)>88ac
ffffffff
02
a086010000000000
19
76a914<hash-of-target-btc-pubkey1(160bit)>88ac
50c3000000000000
19
76a914<hash-of-target-btc-pubkey2(160bit)>88ac
00000000
01000000

And here is the resulting signed transaction:
01000000
02
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
00000000
6a
47
304<...rest-of-signature>
01
21
<your-first-pk(264bit)>
ffffffff
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
01000000
6a
47
304<...rest-of-signature>
01
21
<your-second-pk(264bit)>
ffffffff
02
a086010000000000
19
76a914<hash-of-target-btc-pubkey1(160bit)>88ac
50c3000000000000
19
76a914<hash-of-target-btc-pubkey2(160bit)>88ac
00000000

Assumptions: (1) You're using compressed public keys. (2) type is SIG_ALL
Note: Length of signatures can vary, and as a result the bytes that indicate script length can differ from the example above.

Answering your 3rd question, there is a description here


can someone help me start my node please Using raspberry pi model 3 which is running raspbian, a flavor of debian.

I had the full wallet installed and syncing the blockchain.

Now i can't remember how to get the gui up and running again.

Try running the command 'bitcoin-qt' in your terminal.


Why are the seeds different when going from seed to mnemonic and back using bx? From an example in the documentation:

$ bx seed | bx mnemonic-new | bx mnemonic-to-seed | bx hd-new

655a1ed2d4fef69bb314198c7327f23c
grab special regret prepare urge evidence slush lobster midnight odor wish ketchup
57bae342ae8e69eb63f17ef993a90a59159e0f78114b602bf0ebabfec0e5d086e883c31975bf03f8a47a32853452623094d1303fd0549745db457145e5756582
xprv9s21ZrQH143K43CUCgNp5SmXzg2axQx2P4WupA2zEnKpFM19QfqfdqfpJR3yfzAXZnsHeUaQhWQMwyuqL8DbdeLeCbdMoKNn6pCY4RUn2pK

In Mastering Bitcoin, the example given here shows it going back to the seed that was originally created; this was done using an older version of bx though. Can someone explain how the seeds from line 1 and line 3 in the example are encoded/related?

They adopted bip39 where the seed mnemonic is run through a key derivation function to derive the seed. This is an irreversible step.


What version of C++ is used in Bitcoin Core? I can't find the information on which C++ version is being currently used in bitcoin core project?
Is it decided for future releases somehow? How does the situation looks now?
The only thing I could find was Pieter Wuille's comment:

Bitcoin Core is switching to C++11 in the upcoming 0.13 release. Meanwhile, C++14 is already standardized and C++17 is well underway. Stating that Bitcoin Core always uses the latest features seems like a strange statement.

It may look like some XY problem, so the reason I am asking is my GF is long time C++ dev and I am looking for resources to learn C++ to be able to understand bitcoin code. Her first question was which C++ version it's written in, as it supposedly doesn't make sense to learn older versions.

Bitcoin Core:

v0.1.0...v0.12.x: C++03
v0.13.0...v0.21.x: C++11
v22.0...: C++17 (current master branch, no releases yet)


Why has UTXO set stopped growing since 2017-06-03? The bitcoin UTXO set appears to have stopped growing on 2017-06-3 after 5 or more years of nearly constant increase. What are the reasons (or hypotheses) why?

Charts below:

2012 to 2017-07-11 https://blockchain.info/charts/utxo-count?timespan=all
60 days to 2017-07-11 https://blockchain.info/charts/utxo-count?timespan=all

It's hard to know for sure what's been going on. My guess would be it's a mix of :

Better coin selection algorithms used by large wallets (exchanges)
Increase in fees pushed some inefficient services to stop creating uneconomical outputs (low values). Those services would be gambling/faucets/etc.. They might now be forcing withdrawals to be above a given amount
Some services consolidating their wallets since fees have lowered a bit from the last few weeks.


Recovering a HD wallet from a partial seed phrase I am attempting to help recover a wallet where the owner only wrote down 11 of the 12 words in the seed phrase. Initially, I thought the task would be a quick and well-defined, but it appears to be a bit more complex than I assumed, and reference material is pretty scant. In the event that someone else has a similar issue to mine, I want to leave this post detailing the steps I followed (with working code samples).

The wallet I'm dealing with is Breadwallet, which apparently uses a different (older) mnemonic-to-HD-master-private-key derivation strategy from most modern wallets. For the moment, I'm only going to focus on recovering partial Breadwallet phrases, but I plan to eventually expand the answer to cover newer derivation strategies (BIP44) as well.

(The language used in this post is Python)

Breadwallet uses BIP39 to generate the 128-bit master seed from the 12-word mnemonic. The master seed is then used to generate a set of wallets/accounts containing chains of addresses, using BIP32.

First off, import hashlib and binascii, we're going to need them later.

import hashlib
from binascii import hexlify, unhexlify

Lets assume you have 11 of the 12 words in your seed phrase. For simplicity's sake, I'll use the first 11 words in the BIP39 wordlist:

partial_seed_phrase = [ 'abandon', 'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd', 'abuse', 'access' ]

The wordlist contains 2048 entries, which gives each word 11 bits of entropy (211 = 2048). The 12 words have 12*11 = 132 bits of entropy in total. The HD master seed is 128 bits in length, and there's a 4-bit checksum attached to the end, which brings the total bits up to 132. So far so good.

If we assume that the wordlist is a 2048-element list (omitted due to space constraints), we can find the index (in decimal) of the elements in partial_seed_phrase:

mnemonic_in_decimal = map(wordlist.index, partial_seed_phrase)
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Let's convert mnemonic_in_decimal into an array of 11-bit wide binary numbers.

mnemonic_in_binary = map('{0:011b}'.format, mnemonic_in_decimal)
# ['00000000000', '00000000001', '00000000010', '00000000011', '00000000100', '00000000101', '00000000110', '00000000111', '00000001000', '00000001001', '00000001010']

We know that a single word (11 bits) is missing from some unknown location in this array. In non-ideal circumstances, we would have to check each of the 12 locations for the missing word against 2048 possible words each, for a total of 24576 (12*2048 = 24576) potential master seeds.

for missing_word_position in range(0,12):
    # The missing word belongs at some index from 0-11 in the final 12-word phrase

    for wordlist_index in range(0, 2048):
        # Iterate over all possibilities for the missing word

        missing_word_binary = '{0:011b}'.format(wordlist_index)
        front_half          = ''.join(mnemonic_in_binary[0:missing_word_position])
        back_half           = ''.join(mnemonic_in_binary[missing_word_position:12])
        seed_and_checksum   = front_half + missing_word_binary + back_half

        seed     = seed_and_checksum[0:128]
        checksum = seed_and_checksum[-4:]

Thankfully, we have a 4-bit checksum, which means only one in every 16 seeds (24 = 16) will be valid. This means we will end up with a final total of approximately 1536 master seeds (24576/16 = 1536) to check for funds. The checksum is derived from the first bits (in this case, 4) returned by applying the SHA-256 hash function to the seed, so the final number of valid master seeds can vary, but will average out at around 1/16th of the total possible seeds.

[ More to come later, if anyone wants to help write descriptions or code for any of the following steps, I would appreciate it! ]

To do:

Calculate the actual_checksum from the first 4 bits of sha256(seed)
compare checksum to actual_checksum. If they are equal, push the seed into an array of valid master seeds.
Calculate the master node, which is HMAC-SHA512(seed)
Calculate an account from the master node
Calculate a wallet chain from the account
Calculate the first 5 private keys in the wallet chain
Calculate the first 5 public keys from those private keys
Write up a description and steps for recovering partial phrases for BIP44 wallets
Write a program to query either a blockchain locally, or a blockchain explorer API online. Pass it the combined list of generated public keys, and see if any have a balance.


Is it only out of sheer luck that all my "txid"s are unique? How should I handle multi-vout transactions? I have created a database table simply copying the information from listsinceblock from Bitcoin Core's API. I have a UNIQUE constraint set to "txid + vout", as I'm supposed to. But when, as I'm trying to understand how Bitcoin works at least on a surface level, I do this:
SELECT txid, count(*) FROM "Bitcoin Core transactions" GROUP BY txid;

Then it is revealed that not one of my txids have more than one vout. The count column says "1" for each txid, meaning they all have only one vout.
I've made numerous Bitcoin transactions. Why has none of them ever used more than one vout? And what happens the day this happens? I'm using this table's data in order to automatically update my separate bookkeeping of all my Bitcoin transactions ("transactions" here meaning actual transactions -- not some internal "txid + vout" concept). I obviously don't want some internal Bitcoin logic to result in two different "bookkeeping posts", when it's really just a single Bitcoin transaction!
I'm starting to wonder if I'm simply stupid for not understanding this, or if Bitcoin is deliberately designed to be as confusing as possible. How should I handle the possibility that there will at some point be one transaction which is listed as the same txid but multiple different vout ids?
If it weren't for the fact that my future and survival is dependent on this, I would have long ago given up on Bitcoin and rejected it as "cryptic nonsense". I don't understand what the problem is with just having a clear interface for the actual Bitcoin transactions. I don't care about some complex internal logic and don't want to be exposed to it. I can't escape the feeling of still having missed something important, in spite of all this endless reading and asking questions for years and years.
Using any kind of "intermediate" service or software would destroy the point of Bitcoin. Why can't Bitcoin Core just clearly list the human-relevant information instead of exposing internal mechanisms to the "end user"/programmer? Or is it?

Why has none of them ever used more than one vout?

If each of your transactions only sends Bitcoin to one receiver, then there's going to be only one receiver output in each of those transactions. Hence you only see a single vout per txid.
You can create transactions which send to multiple receivers. You should see multiple vouts for those. You can make them by using the sendmany command or by clicking the Add Recipient button in the GUI.

And what happens the day this happens?

Nothing should happen except that you will see multiple txids with different vouts. In the end, it all depends on your software and how it is handling that. Since it sounds like you have dealt with the uniqueness constraint correctly, nothing should happen.

Why can't Bitcoin Core just clearly list the human-relevant information instead of exposing internal mechanisms to the "end user"/programmer?

If you want human relevant information, use the GUI. The RPC interface is intended for developers and advanced users. The whole point of the RPC is to allow people to build software that use Bitcoin Core and they are going to need to understand and access all of this additional information.


What is it about a Trezor that means it can't be infected by malware? The Trezor testimonials include that

  TREZOR ... cannot be infected by malware

What is it about a Trezor that means it cannot be infected?

Trezor is a relatively simple, specialized hardware device. It does not run any OS, just a small program specifically developed for signing Bitcoin transactions and managing the keys. Thus, the attack surface is very small compared to conventional general-purpose computers. You can say it's practically impossible to infect it.

Security is a much more complicated area though and I wouldn't say it's impossible unless I can formally prove it. It is however the safest device I know of (but this is subjective).


Do bloom filters protect against a persistent eavesdropper? As far as I understand it, bloom filters can be defined with some target hashes and false-positive rate. When filtering the blockchain, all of the target transactions are guaranteed to be found, but many false-positives will also be returned to the client by design.

Suppose that an attacker is able to monitor many bloom filter specifications sent by an SPV client to its peers. Will he be able to eventually eliminate all false positives by performing subset matching on all transactions matching the filters?

As an example, let the set of all transactions be the integers from 1 to 100, and suppose that a client is interested in the transactions 4, 8 and 15. The first time he connects to the network, he transmits a bloom filter matching (1, 4, 7, 8, 15, 27, 44, 73); the second time, his filter matches (3, 4, 6, 8, 15, 27, 66). An attacker would immediately be able to narrow the possible transactions down to (4, 8, 15, 27); after several more invocations, he would then find the correct answer.

Am I misunderstanding how bloom filters work (e.g. the false positives do not change between connections), or is this a theoretical or even practical concern?

See this paper for a good discussion:

On the Privacy Provisions of Bloom Filters in Lightweight
Bitcoin Clients


How do I use an issued API key in my python 3 script to bypass the request limiter? I got an API key from blockchain.info to bypass the request limiter, but I don't know how to use it and I can't find any relevant info online.

 url = "https://blockchain.info/rawblock/" + str(s)
        usock = urlopen(url)
        data = usock.read()

where variable s is the block height.

As the python blockchain.info API states:

https://blockchain.info/rawaddr/$bitcoin_address
Address can be base58 or hash160
Optional limit parameter to show n transactions e.g. &limit=50 (Default: 50, Max: 50)

BUT it also states:

Request limits and API keys
In order to prevent abuse some API methods require an API key approved with some basic contact information and a description of its intended use. Please request an API key here.

The same API key can be used to bypass the request limiter.

However, I don't know how to incorporate it in the function.

Any advice is appreciated!

You need to get an "api_code", then use that when making calls.

You can use their official python client.


How does electrum interact with the underlying bitcoind service? I am a bit confused regarding the bitcoind peers and Electrum X peers.
From what I understand, the electrum X protocol is built on top of the bitcoin blockchain, but I cannot quite wrap my head around on how exactly they interact.
I get it that electrum needs to have access to a bitcoind process in order to sync up its database, but what happens after the sync? Does the electrum client receive notifications about new transactions from other electrum peers, or does it still use underlying bitcoind mempool? Or both?
Can somebody explain on how exactly these 2 services interact?

Electrum Server is a fancy abstraction on top of bitcoind and a custom index of UTXO data. Client wallets connect to it and send queries for details about their wallet, using its own index Electrum Server requests the correct information from bitcoind and returns it to the client. The Electrum Server keeps its index up to date by continuously querying bitcoind for changes such as mempool updates or new blocks.

All communication with the wider Bitcoin network happens through bitcoind, including block updates and transaction broadcasts. For the purpose of this discussion, Electrum servers are standalone and completely unaware of one another, there is no cross communication between them.


What would happened if two transactions have the same hash? What would happened if two transactions have the same hash?
Would it make the Unspent Transaction Outputs(UTXO) in the old transaction not spendable?
I think it would make the outputs in the new transaction spendable and the outputs in the old transaction not spendable.

Per BIP 30, transactions are not allowed to have the same TXID as another transaction which has unspent outputs.

This means that there can be transactions that have the same TXID, but only after the first transaction's outputs are already spent. So in this case, the duplicate TXID does not matter.

For transactions that do have duplicated TXIDs (there are a few of them), only the most recent of those transactions can have its outputs spent. The earlier transactions with the same TXID cannot be spent from and their Bitcoin are lost forever.


Can I Find out where I sent my bitcoin from my paxful wallet I Sent roughly "£25 worth of bitcoin to an online dark market which I'm sure was a Uk market called ''tom and jerry' but I CAN NOT For the life of me figure out or find that website I sent my coins to from my paxful address. Any way I Can work this out please??  thanks  Dale

I CAN NOT For the life of me figure out or find that website I sent my coins to

Bitcoin is not sent to a website, it is generally sent¹ to a bitcoin-address, which is simply a random number² so far as the Bitcoin network is concerned. Nowadays the receiver of money will generate a new receiving address for each transaction in order to increase privacy and achieve a higher degree of anonymity³.
There is no way for ordinary people⁴ to identify a website URL from a Bitcoin address, The bitcoin network does not record that sort of information.

footnotes:

Strictly speaking Bitcoin is not sent anywhere, what is transmitted is mostly instructions about changes in ownership of amounts of money (changes in control over money).

A bitcoin-address is a kind of pseudo-random number derived by a mathematical procedure that cannot be reversed. All the numbers involved are pretty much indistinguishable from mathematically random numbers. Addresses have a standard prefix and a checksum suffix but neither help identify recipients.

Bitcoin is often described as pseudo-anonymous. It is nearly anonymous, it strives for anonymity and it deliberately makes it hard to identify the people or organisations involved in transactions.

Unless you are a member of a governmental investigative agency or a wealthy individual willing to spend large amounts of time and money on an investigation.


My wallet won't load because it says it contained a duplicate transaction. Are my coins lost forever or can i load it some other way? Question pretty much says my dilemma. Wallet won't load due to a "duplicate transaction" which I thought could not happen. I use multibit btw, if that helps. Please tell me I can load my wallet somehow.

This was a bug that was fixed in v0.4.1 (26 June 2012) so I presume you are running an earlier version. If you download the latest version from multibit.org your wallet should load ok.

Sorry for the inconvenience.


Is mining hardware particular to specific mining algorithm(s)? In particular, I was pool-mining with scrypt algorithm, using my GPU (was not bitcoin, but another coin named gamecredits, at gmc.acidpool.com).

I would like to purchase cheap mining hawdware (which would be useless with bitcoin but perhaps good with relatively "new" coins). Should I care whether a hardware supports "scrypt" in this case? Or does hardware care about a more "primitive" level without caring about the algorithm?

Different currencies have different mining algorithms. What you should do is to use coinwarz.com to calculate the most profitable one, by filling in the details of the mining hardware's specs of the miners you're thinking about buying.

Be sure to put cryptocurrencies' future values (predict them!) and when the next miner may be released (predict!) into account (which coinwarz can't)


Is there any way to access my btc without my bitcoin core wallet? I recently bought some bitcoins and got them transferred to my bitcoin core wallet. My fault is that I did not do any research on bitcoin core and found out that it synchronizes with the bitcoin network first before you can actually use your wallet. The synchronization is taking a lot of time. Is there any other way I can access my coins? Thanks!

To do this, you'd have to parse the .bitcoin/wallet.dat file (possibly using a script like this python script) to recover the private keys, convert them to a WIF (Wallet Import Format) and find another application that will let you import private keys. You might be better off just waiting for it to sync.


Can legacy wallets with 1xxx addresses send to segwit 3xxx and bc1xxx addresses like mycellium that only does 1xxx addresses? I have mycellium for android and currently they dont support any segwit addresses that has 3xxx or bc1xxx. Can I send out from my mycellium 1xxx address to my segwit 3xxx or bc1xxx address that I generated from a paper wallet?

Can I send out from my mycellium 1xxx address to my segwit 3xxx or bc1xxx address that I generated from a paper wallet?

The 3xxx addresses are P2SH addresses, and they have been around since 2012. They're usually for multisig policies, and only recently can also be used for segwit outputs. However, as the sender doesn't know or care what kind of script the hash is for, any wallet that can send to P2SH will support sending to such segwit address. This is the reason why segwit can be encapsulated in P2SH in the first place: to be compatible with old wallets.

bc1xxx addresses are new, specific to segwit, and likely only available in software designed to be compatible with segwit.

The best way to know what software supports what style addresses is to try, of course.


Why are transactions separate in a block? I'm just getting started looking at bitcoin and it's protocol, so this might be an incredibly stupid question. Why does bitcoin have a separate concept of transactions? Wouldn't it be better for each block to have a bunch of inputs and a bunch of outputs without separating them as individual transactions? This way it's more anonymous and private, since anyone trying to track an public key is stopped since their transactions are mixed with hundreds of others?

I guess technically, you could do that right now, by making one transaction with hundreds of inputs and outputs and mining that. I'm not asking why transactions are propagated by the nodes, I'm asking why are they stored separately in the final blocks?

An interesting idea, but I don't think it technically works out.

Transactions include a digital signature of the set of inputs and outputs in a transaction. This signature could not be validated if the inputs and outputs where not linked.
Since signatures wouldn't be tied to specific outputs/inputs, what would stop a greedy miner from including your inputs but not your outputs?
Outputs can be created and spent in the same block. So you can't list all inputs, and then list all outputs, because some of those inputs depends on those outputs being known first. (There may be a work around for this, but it complicates things)


What is the order in which UTXOs are sorted in a block? Let's say, I am trying to do a double spend by creating two transactions almost immediately, is it possible that both the transactions are added in one block ? If yes, then which transaction is valid and which is invalid ? Also is there any specific order in which miners gather transactions in a block before starting to find proof of work ?

Addition to Bolton's answer: Transactions in a block can be in any order, given that if a transaction spends another's output, the parent transaction must come before the child tx and the coinbase transaction (collecting the block reward) comes first.


In which circumstances is the identity of a miner known? I started playing with the Blockchain real-time API and noticed that when new blocks were created, they often (systematically?) included a foundBy field. For instance, block with height 446731 (index 1442483) has the following foundBy information:

{
    "ip": "0.0.0.0",
    "link": "http://bitfury.com/",
    "description": "BitFury",
    "time": 1483612060
}

I have never mined bitcoins; do all miners have to disclose their identity? Obviously, the identity of the miner of block with height 0 is unknown. Is the foundBy field a new feature of recently-mined blocks?

No, it's not necessary to disclose the identity. As Pieter commented below, "foundBy is a feature of blockchain.info, a privately operated website, which gives a guess about the creator of a block. It is by no means something that's part of the protocol".

If you look at the receiving address of the block's coinbase, you'll see that BitFury sends all their block rewards to that address, so that's probably how blockchain.info arrived at their conclusion.


Having issues broadcasting BitcoinJS transaction. I'm trying to send testnet with bitcoinjs, but when I go to broadcast the hex, it gives me an error code that says "fee is too high: 12372928". Now, from my understanding, the fee is the input - output. However, even if I increase the output to match the wallet's balance, I get the same exact error message. Here's my code:

        this.setState({
            address: 'mphWVWbPgGKuaMpSpGNA3Ffrpva5cRChqP',
            privateKey: 'cW6dLEqkk2HAbQTSJaHnn4w3kd2iJfhBREccEE3vzrq8kcVE5TqS',
        });
}

createTransaction = (e) => {
    e.preventDefault()
    const {address, privateKey} = this.state;
    var hashURL = `https://api.blockcypher.com/v1/btc/test3/addrs/${address}`

        axios.get(hashURL).then((response) => {
            this.setState({
                hash: response.data.txrefs[0].tx_hash
            })
        }).then((result) => {

        var tx = new bitcoin.TransactionBuilder(testnet);

        var txId = this.state.hash;

        console.log(txId);

        tx.addInput(txId, 0)

        tx.addOutput(this.state.add, 1000000)

        var keyPair2 = bitcoin.ECPair.fromWIF(privateKey, testnet);

        tx.sign(0, keyPair2);
        console.log(tx.build().toHex());
        }
    )

}

Would there be a way to manually set the fee to always be something like .0001?

The miner fee will, by default, equal the inputs - outputs of your transaction.
I notice some problems with your code. You do not specify a change address to send the left-over amount. If I have an unspent output of 100 BTC and I want to send 10 BTC to someone else, I should have 1 input (the unspent output from the previous transaction) and 2 outputs (the receiver address and the change address). The inputs and outputs will look like this:

Inputs

Unspent output of 100 BTC

Outputs

Receiver address with 10 BTC
Change address (your BTC address) with 89.999 BTC

The fee will be 0.001 BTC since (in)(100) - (out)(10 + 89.999) = 0.001.
Hope I was able to help.


When Bitcoin Segwit fork will completely over? I'm wondering for how much time it will takes for The Bitcoin Network to complete Segwit Forking?

Thanks

August 3rd 12:45 CET:

    "segwit": {
      "status": "started",
      "bit": 1,
      "startTime": 1479168000,
      "timeout": 1510704000,
      "since": 439488,
      "statistics": {
        "period": 2016,
        "threshold": 1916,
        "elapsed": 1053,
        "count": 1053,
        "possible": true
      }
    }

Another 864 BIP141 segwit singling blocks are required to activate.
This will roughly take 864 * 10 minutes == ~6 days (IF each block signal BIP141/bit 1).

As you may see, there are certain variables you can't know for sure (singling, block times)


Who runs the Bitcoin wiki? Who runs the Bitcoin Wiki? What is their Twitter account?

I am looking for the community, group or person who runs this site.
Does this being have a Twitter account? The account @bitcoin_wiki exists, but they have only 30 followers, which makes me think they aren’t the real people: so small a follower count doesn’t feel right.

I ask because the site is down and Twitter is a very easy way tell the site administrators. I suppose another method of contact would be fine too.

It's down because it's hosted on the same server as bitcointalk.org (in a separate VM), and the bitcointalk.org server is down. Having them both on the same server has been convenient, but it's unnecessarily disruptive for both sites to go down at once when there are troubles with the host machine/OS/network, so the wiki is going to be moved elsewhere in the near future.

I own the domain name and handle some technical aspects of the wiki's operation, but I am not the best person to contact for most technical problems, and I am not responsible for dictating wiki policy. For both of these things, it's best to join #bitcoin-wiki on Freenode or post in the Wiki section of the forum.


Why do miners choose low fee rate transactions sometimes? Miners prefer high fee rate transactions to low fee rate ones, but the part which I don't understand is why miners pick a low fee rate transaction that has been waiting for hours in the mempool into their blocks, while they can find higher fee rate transactions in the mempool.
Is this some kind of moral thing to help those transactions to get confirmed or what?

For miners lower transaction fee doesn't matters but fee rate does.
There are three cases where the miner chooses transactions with low fee rates.

1) When the mempool has three sets of transactions {A}:High fee rate , {B}:Average fee rate and {C}:Low fee rate. If there are few transactions of set A and B the miner will select transactions from C as well.

2) In a child-pay-for-parent scenario, where A is the parent transaction and B is the child transaction.

A: { size: 200 vB, fee: 200 satoshi } ⇒ fee rate: 1 sats/vB
B: { size: 100 vB, fee: 2800 satoshi } ⇒ fee rate: 28 sats/vB

The miner really wants to collect the fee of B, but B spends an output of A, and the miner has to add both A and B in order to get the transaction fee.
You can see this in full detail here.

3) The miner has some personal interest to add a certain lower fee rate transaction.

Hope it helps.


bitcoin paper wallet--multiple addresses Is it is true that a paper wallet has only one address and can only have one address maximum?

I want to be 100% sure when I check my balance on blockchain.info that the money is there. If someone were to take my private key, could they generate a new address and transfer money without me seeing it (since I only check the address WRITTEN on the paper wallet)?

The bitcoin's wallet is made up of two keys, a public key and a private one. The general title of the wallet, where you can receive money from others, is exactly the opposite: it allows you to send your coins to others.
And of course your key, no one should know, so you do not steal easily, do not disclose this number to anyone.
Create a paper bitcoin wallet step-by-step.

here you can find in MY SITE more information regarding How to create paper bitcoin wallet


Transaction overriding in lightning network I'm reading the lightning network whitepaper, and at some point it states this:

  Therefore, it is possible in bitcoin to devise a bitcoin script
  whereby all old transactions are invalidated, and only the new
  transaction is valid.

I would like to know the specifics of how this can be done. Seems to me that what they are describing here is some kind of transaction overriding? It is somewhat different from the mechanism I understood a micro payment channel works.

Lightning payment channels are established by two parties Alice and Bob paying into a 2-of-2 multisignature address. Concurrently, they create two "exit-transactions", one for each participant which pay out the current allotment of the payment channel, txAliceExit_1 and txBobExit_1. These exit transactions lock the fund of the executing party for some blocks.

When a payment is performed between Alice and Bob, they update the balance, create two new "exit-transactions", txAliceExit_2 and txBobExit_2.

To invalidate the previous "exit-transactions" each party gives the counterparty another transaction that builds on the previous exit transaction by spending the party's output to the counterparty if the old "exit-transaction" were broadcast to the network, txAliceExit_1-TakeAll and txBobExit_1-TakeAll. I.e. if Bob executes txBobExit_1 the funds are time-locked for a little bit, meanwhile txAliceExit_1-TakeAll would become valid and Alice could take them before he can spend them.


I downloaded an Armory .msi and the checksum failed. What should I do? (Windows) I downloaded Armory from here and the checksum file from here using the links from the main installation page. I downloaded the Win64 .msi installer.

From there, I used a Cygwin prompt and fciv to verify the download. I didn't feel like downloading keys, etc., so I just looked at the checksum in the .txt.asc file, and compared the first few characters to the fciv output. As you can see, there's a mismatch.

Alex Jordan@ajordan /cygdrive/c/Users/SAAS Student/Downloads
$ cat armory_0.88.1-beta_sha256.txt.asc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

3d7f620c028940540dc48d41a9cf6127f7f42b920664de4a957fc407b3f59abf  armory_0.88.1-beta_amd64.deb
670b74ade48b041bd376512f5e2db78075d794495ef347bf0b792156c9a90048  armory_0.88.1-beta_i386.deb
087fc8a49de3f32fb140151d9c277f9810919f751bf754f0823da084cb67810f  armory_0.88.1-beta_OfflineBundle_Ubuntu-10.04-32bit.tar.gz
3a86a57208c015adce086e9c300beb56592979b908ec2731bd2f267efa7aaf28  armory_0.88.1-beta_OfflineBundle_Ubuntu-10.04-64bit.tar.gz
a730df751c753bdd2664d1e0b32a3ff138494900040c742b0ebfced3b516fad6  armory_0.88.1-beta_OSX.dmg
4d14b43ed75194a753dc202d70f9650a92d7b8756c917fe82a7f46ecd3466aa1  armory_0.88.1-beta_win32.msi
26735a99948ac1402242e83f0c18aed4477b132654d1a94d7968caa0e72790df  armory_0.88.1-beta_win64.msi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBAgAGBQJRc0xHAAoJEEqxauqYgyIjreAP/ifZcfni32nhwc5JUkK9MwI+
LxvrRObp0AQzdUNYMd5NJ8PivuGGITpSRDi7BgXJH8f49p+jepAPmUb8FgAdWtPo
odaVoAyKZBDCqCCkSPbLDvMVc/vqIkUCjH2XyplvCYDrTsC8WK7oJi+9IS7upX8J
yP3tB8Rf530zadgXMidKOvPHBRTO8TKPj4OH3cE8ngM+Ld5QBLXQqHhj1dbs2BVg
bKO/ypZQWrWIakkoYanplw4/PegbYLl9x9buIQTF2l0aYDCpoW3rh390Zxo+jSgT
J9pkxf3QLFRNbAhSRDq323UZUI1KZkAp2tCqDyHmDDbr+FqLr4ibnza8hmrbBhKO
vH8zzL0Hi6KdqKeP2dB1gh9etDy8RNxmOz4ygpLT+PIh/fNqGstXUVXYaitTEsI6
HHnlBJRlo6xpXMatxMELbhsCNZZO4/L43eZ50BhldxUPd4e9iMO9JUB7h4v0oai+
ZESAZzRVOVnEzmpoS6djl7XhmGh8CSk8FqyGJNirCvfjNWQaLQZgUNh/N4yyd/Ue
zz03sZR7xRGZv1sSysXLi9WIZV6YGyQ6FrVeizojgp5WQj1vtP7UubsxKaOvNdX+
8Jr1NR4kdOppf7/LpvIXnJ23E9sDTVm9IA8zhYIdh52T8q4Pst2HL+CpZOwDs6YR
eeiAsWB8eKC3TWpL9sf/
=mOdM
-----END PGP SIGNATURE-----

Alex Jordan@ajordan /cygdrive/c/Users/SAAS Student/Downloads
$ fciv -sha1 armory_0.88.1-beta_win64.msi
//
// File Checksum Integrity Verifier version 2.05.
//
d86ccbf4d709c04ba6250a94782ea620ab0c26fd armory_0.88.1-beta_win64.msi

Alex Jordan@ajordan /cygdrive/c/Users/SAAS Student/Downloads
$

How should I proceed? Is it safe to install anyway, probably because I'm doing something wrong?

Looks like a SHA256 hash. Try fciv -sha256 or sha256sum.


White paper text is not clear to me Is there any intention by the respective author or by Bitcoin.org to edit, improve or re-write the white paper for absolute clarity?

Among others I do not understand the value of repetitive manipulation of the message, until a hard-to-find number can be added to the message, that then forces the digest into an arbitrary format to show a given number of starting zeros.

Is there any intention by the respective author or by Bitcoin.org to edit, improve or re-write the white paper for absolute clarity?

The pseudonymous author (Satoshi Nakamoto) has not been present online for many years; I suspect we will not see Satoshi return for a whitepaper update.

You can learn more about the contributors of bitcoin.org on this page.

Updating the whitepaper is not a priority in any sense. It is a technical paper that lays out the fundamentals of the Bitcoin Network, and it does that job well. Further, I don't believe any person or party would be capable of doing so in a way that everyone can agree on. Bitcoin has no leader, and the whitepaper is an artifact of Bitcoin's history- which is not to say it is irrelevant, just that it had its place in time. It is a great resource and starting point to learning about the Bitcoin protocol, but the modern Bitcoin network has advanced beyond what is laid out in the whitepaper, and as such there are now many other additional resources available to learn from. This website is one such resource, if you search through the history of questions you'll find there is a lot of good information available here.

With so many other resources available online, there really isn't a need to rewrite the whitepaper, at least not in any 'official capacity', even if such a thing were to exist.

  Among others I do not understand the value of repetitive manipulation of the message, until a hard-to-find number can be added to the message, that then forces the digest into an arbitrary format to show a given number of starting zeros.

You may be interested to read the answer I wrote here, I think it may answer your question.


How do I determine an optimal or above average fee to gain priority in the network during a transaction? I am using the blockchain.info API to send btc from my blockchain wallet to about 3000 addresses. I'm using their send to many API/Service to do this.

My problem is that I need to make sure the send doesn't get stuck or go to limbo. The amounts I'm sending are about 150USD to each of the 3000 addresses.

The API call lets you set a custom fee to pay. What fee should I pay to gain priority in the network and ensure the transaction goes through fast and easy as possible?

The amount you should pay is constantly changing, so you'll have to check at the time you send the transaction. 21 has an API that provides recommendations on mining prices.

They are only recommendations though, there isn't really a definitive answer. The network could get flooded with higher fee transactions at any time, and your fee would then appear relatively low to miners. If you need to be absolutely certain you may want to raise the fee even further, but I believe they've taken some amount of that into account.


CreateRawTransaction and SendRawTransaction how to specify transaction fee? I am able to createrawtransaction and sendrawtransaction but how am I able to specify a transaction fee for the miners?

I am looking at possibly large transaction sizes due to multiple inputs (around 100) and I have had a few of them never show up to their destinations and some of them do show up. I am assuming this might be due to the lack of transaction fees since I am using the exact same code to send both raw transactions.

So again, how can I specify a transaction fee in Bitcoind with creating a raw transaction.

And by the way, I am spending the funds from a multisignature address, in which 2 of the private keys are not controlled locally, so settxfee will not suffice. I want to write it into the transaction itself.

The transaction fee is specified by the difference of the sum of inputs and the sum of outputs, i.e.

transaction fee = Σ(inputs) - Σ(outputs)

In other words, you set a transaction fee by sending more than you assign to the recipient.


Encrypted bitcoin private key from bitcoin-cli Hi I need to know the command which is used to generate encrypted bitcoin private key from bitcoin-cli (for a bitcoin address) so in future when that private key is used for import address in any application it ask for password also ?

There is no such way to do that. Bitcoin Core does not support BIP 38 for private key encryption so you cannot export nor import an encrypted private key.


Original bitcoin core has one script.cpp.where is interepreter for it?I want to write hello world compiler to understand this.? How to understand script.cpp and its interpreter.I understand register and postfix operation.
I want to understand how script is parsed into machine code.Can i write hello world such as only pushing value into the stack.

I want to understand how script is parsed into machine code.

Unlike Ethereum, Script isn't compiled. It's interpreted, like Javascript. The opcodes are evaluated on-the-fly.

  Can I write hello world such as only pushing value into the stack?

Maybe try entering

0x0c 0x48656c6c6f20776f726c6421

to https://matiu.github.io/opcodes-playground/? (0x0c is the length of the text, as a push operation)


How to setup pushpool? How can I setup pushpool on my ubuntu dedi?

I have bitcoind up and running with latest blocks, what's next?

This guide will set up everything you need on a single machine.

Let's get started by setting up the environment:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install automake gcc
sudo apt-get install libevent-dev libmemcached-dev libcurl4-openssl-dev zlib1g-dev libjansson-dev curl memcached

Depending on your distro some of these may not be available (libjansson-dev for example is not available on Lucid), and you may have to download and compile the sources.

Pushpool requires a database to work so we have to install either SQLite3 or MySQL. MySQL probably is the better choice, but SQLite3 suffices to just test pushpool:

sudo apt-get install libsqlite3-dev sqlite3

To get MySQL you'd instead install libmysql++-dev.

Next we download the pushpool source and extract it to /tmp/:

cd /tmp/
curl -s http://yyz.us/bitcoin/pushpool-0.5.1.tar.gz | tar -xvz
cd pushpool-0.5.1

Now let's get on with it by configuring, compiling and installing it into /opt/pushpool:

./configure --prefix=/opt/pushpool/
make
sudo make install
cd /opt/pushpool/

At this point we can quickly check that everything worked:

$ sbin/pushpoold -E -F
[2013-01-04 16:00:40.682356] config file(server.json): No such file or directory

All we need to do now is to configure the pushpool server.

sudo cp /tmp/pushpool-0.5.1/example-cfg.json /opt/pushpool/server.json
sudo nano /opt/pushpool/server.json

Here's mine for example:

{
        # network ports
        "listen" : [
                # binary protocol (default), port 8336
                { "port" : 8336 },

                # HTTP JSON-RPC protocol, port 8337
                { "port" : 8337, "protocol" : "http-json" }

        ],

        # database settings
        "database" : {
                "engine" : "sqlite3",
                "name" : "/tmp/data.sqlite",
                "stmt.pwdb" :
                  "SELECT password FROM pool_worker WHERE username = ?"

        },

        # cache settings
        "memcached" : {
                "servers" : [
                        { "host" : "127.0.0.1", "port" : 11211 }
                ]
        },

        "pid" : "/tmp/pushpoold.pid",

        # overrides local hostname detection
        "forcehost" : "localhost.localdomain",

        "log.requests" : "/tmp/request.log",
        "log.shares" : "/tmp/shares.log",

        # the server assumes longpolling (w/ SIGUSR1 called for each blk)
        "longpoll.disable" : false,

        # length of time to cache username/password credentials, in seconds
        "auth.cred_cache.expire" : 75,

        # RPC settings
        "rpc.url" : "http://127.0.0.1:8332/",
        "rpc.user" : "bitcoinrpc",
        "rpc.pass" : "bitcoinpassword",

        # rewrite returned 'target' to difficulty-1?
        "rpc.target.rewrite" : true,

        # allow clients to update the ntime field of their work
        "roll.ntime.disable" : false
}

And finally we get to the database setup:

sqlite3 /tmp/data.sqlite "CREATE TABLE pool_worker (username VARCHAR(32), password VARCHAR(32))"
sqlite3 /tmp/data.sqlite "INSERT INTO pool_worker VALUES ('username', 'password');

At this point we have created the database and inserted a new user called username and password password. Running sbin/pushpoold -E -F again will start the daemon.

Pointing your miner to http://username:password@127.0.0.1:8336/ should get you mining.


Mining generates block and the generation of block is rewarded with 25 bit-coins? So from where bit- coin is mined? I read that Mining of bit coins generate blocks and each block is rewarded with certain bit coins. So, from where bit coins are generated?

The new bitcoins are generated as a special transaction called a Coinbase transaction, which is the very first transaction in a block. That transaction has special inputs that don't spend previous transactions, so the bitcoins are completely new. The miners create this transaction when they create a block to be mined, paying the block reward to themselves. Thus if they are the successful miners of the block, the transaction pays them and they receive the block reward.

Note that the block reward is currently 12.5 BTC per block not 25, as of the reward halving on 2016-07-09.


What happens to a coinbase transaction when no address is given? The transaction block
This coin base transaction has no valid address for reward. Did we lose that reward bitcoin forever?

In the event that the Coinbase transaction produces outputs that total less than the eligible block reward, any unclaimed coins are permanently lost.
In this specific case, the entire block reward of 12.5 BTC was permanently lost.
There have been other instances where miners only partially claimed the full amount they were able to claim, also leading to a permanent loss.
Note that in scenarios like this, it leads to a reduction of the total supply of bitcoin. There are other types of losses, such as sending coins to an address with no known private key, which don't reduce the total supply.


Hacked bitcoin account. I believe that my account was hacked: a "send" transaction occurred on my account an hour ago and I lost $62 without my raising any transaction. The transaction is still unconfirmed, how do reverse it and get my money back ? Standing by.
Recipient address-https://blockchain.info/address/18VhGJQgvYVpGLfZPJ1wu85JDAJ8UU6A62
Transaction hash code - https://blockchain.info/tx/ae97308ffd3e460ec4d928d5309479351220b30811d7e02f2a571e23d38e48d2

Once more, I did not make this transaction,and $62 disappeared from my account. Please help.

Bitcoin transactions cannot be reversed - unless you are sending coins to someone you know by mistake and they are willing to send it back - which in itself is also relatively unlikely.

If someone has sent money from your account without your knowledge, then they have got hold of your private keys. What wallet did you use? Is it local on your machine? Is it online - in which case you may have not set a complicated enough password.

Sorry about your loss but you need to make sure your wallet is secure in order to prevent this from happening again.