bitcond and bitcoin-Qt system configuration and bandwidth requirements What is the best operating system configuration for a computer to run (bitcoind or bitcoin-Qt) and (BFGminer or CGMiner) under Linux, assuming that it will be connected to a 3 Terrahash mining rig on one side and the internet on the other side?

What packages, at minimum, must be installed?

How much bandwidth will I need using the Stratum protocol and how much using the GetBlockTemplate protocol?

EDIT TO ADD:

What I mean by "best configuration" is the minimum configuration that provides the necessary functionality.

I'm willing to bet that 90 percent of what's in a desktop Linux distribution is not needed in this application.

Obviously, a kernel and a shell will be needed.  What else?

Would you be mining by yourself, or in a pool? If you are mining in a pool, you won't need bitcoind or bitcoin-QT running, and you can use a Raspberry PI to run CGMiner. Raspberry PI is very easy to set up, fast and requires much less oversight/administration as compared to a consumer grade laptop/computer.


How to check Bitcoind block chain download progress level I have installed bitcoind on ubuntu server, and when I run screen -x for btc it says error -10 blockchain is downloading.

How do I know the progress level? currently 125600 blocks are downloaded, but how many blocks yet to go? where do i check the blockchain download progress level? does it has capability to resume if the server is powered off?

Do

cd /home/

then

nano block.sh

copy the code below and paste (right click if you use putty) to the script.

#!/bin/bash
while true ; do
    clear
    echo "Press enter to break loop. Script will loop every 3 seconds"
    echo "script by Nixsy 18th august 2013"
    echo "If loop freezes press CTRL+C"
    echo ""
    echo -e "    \033[31mdownloaded\e[0m/\033[32mavailable\e[0m"
    echo -e "    \033[31m"`bitcoin-cli getblockcount 2>&1`"\e[0m"/"\033[32m"`wget -O - http://blockchain.info/q/getblockcount 2>/dev/null`"\e[0m"
    read -t 3 -n 3 && break
done

When you have copied the text to nano hold CTRL+X and then press Y to save.

In terminal type or copy from below followed by the enter key.

chmod +x block.sh

to start the script type.

./block.sh

This is just a little edit of the script from Lohoris, It will clear the screen then loop the script every 3 seconds until a key press.

Credit to Lohoris for the original script.


How to generate 107 th/s I was recently looking over some bitcoin specs for a friend who wants to create a miner and would like to get no less than 1 Bitcoin per month.

According to:

https://www.cryptocompare.com/mining/calculator/btc?HashingPower=107&HashingUnit=TH%2Fs&PowerConsumption=1250&CostPerkWh=0.0

I would need to generate 107Th/s googleing I have not found out what kind of hardware can generate that number.

Am I looking in the wrong place?

I'm not sure if the term "hardware" properly describes the scope you are asking about. To reach a hashrate of 107 TH/s, you'd need at least 9-10 ASIC miners at a total purchasing price of more than $20k.

Meanwhile the following image gives an impression of what you're competing with:


Bought a used ledger nano s from Amazon / Ebay. How do you factory reset the Ledger Nano S? I just bought a used ledger nano s from amazon and ebay. What is the best method of wiping this device and factory reset it? What are some other precautions before using this used device?

From the Nano S Configuration Guide:

How to erase or reset your Ledger Nano S?
If you acquired a second-hand Ledger Nano S, or if you want to create
a second wallet, follow this tutorial to learn how to reset your
device first.

Connect your Ledger Nano S
Enter a wrong PIN code and validate by
pressing both buttons
Repeat the 2nd step two more times
Once your Nano S displays the message "Your device has been reset", press both buttons until the "Welcome" message is displayed, or disconnect and reconnect your device.

Then you will be able to restore a wallet or create a new one.

Also keep in mind that your device may have been tampered with and does not contain genuine hardware. You will want to read this guide to ensure that your hardware is genuine.


What is the canonical way of creating merkle tree branches? I'm currently looking into creating some compact merkle tree branches to prove that a given hash was included in a given merkle root. My initial thought was to list the leaf, the merkle root and all of the hashes that the given leaf was combined with to make the merkle root.

So in this example:

I would state

Leaf: 12c5
Root: 2f9c
Nodes: [d187, a8b5, 1328, d063]

However, since the order of nodes matter for creating the merkle root, I would also need to list whether the node was on the left or right side.

I'm wondering - is there a canonical way of listing this information to create the merkle branches?

Edit: Have a look at MSG_MERKLEBLOCK. Included information is: Block Header, Transaction Count, Hash Count, hashes, flag byte count, and flags.

hashes include everything from the leaf to root, and flags
gives the positions of the leaf in the Merkle tree.

Since the index of the transaction gives it’s position from the left among the leaves in the Merkle Tree, in addition to the transaction count it is sufficient to deduce whether it is the left or right partner in each concatenation.

(Old answer below.)

The leaves of the Merkle tree are left to right in the same order as the transaction list of the block. Each layer above is formed by concatenating the children and then performing ad double SHA-256. When only a single entry is left in a layer, we call that the Merkle root.

If a transaction does not have a partner, it is paired with itself instead.

    HASH(Hash(AB)Hash(CC))
       /              \
Hash(AB)              HASH(CC)
 /    \                /    \
A      B              C      -

Legend: A,B,C are txid; Hash is short for SHA-256d.

This means that each transaction’s position in the tree is completely defined just by it’s index in the transaction list. Therefore, the position of its partners on each layer is deductible from that alone: If you write the transaction indices (starting to count with 0) out in Binary, you get the following:

A: 00
B: 01
C: 10

Reading from back to front, each 1 stands for "right position" and each 0 stands for "left position".

Example: B(01), B’s last position is 1 and B is the right partner to A. B’s second to last position is 0 and HASH(AB) is the left partner to HASH(CC).

Therefore it is sufficient to add the index in the transaction list and the number of transactions in the block to your proposed "Leaf, Root, Nodes".

Unfortunately, I don’t know what standard is being used to transfer this information. Maybe you can find it in the Bitcoin Core code catering to the requests of the SPV clients polling nodes for information.


Is it considered bad practice to have a wallet "cloned" on both a smartphone and a desktop PC? I already checked questions as:

Can I use my wallet on different computers?

Can wallets be shared by different machines?

...but what I'm asking regards popular wallets as BitPay and Electrum, that have both the desktop and mobile app, permitting to export and import a wallet. Nothing that takes into account messing with any wallet.dat file.

I'm currently doing this with a BitPay wallet, and it seems it works good. When a transaction occurs (i.e. I receive funds) this is notified on both platforms (I think it's related to how those wallets works; I'm referring to the Bitcore Wallet Service).

I also read about the notorious quote "not a good idea", but I'm not sure of this refers to different type of wallets or what else...

Any clarification on this is more than welcome.

It is merely a question of security. If your copy of the private key in wallet A (phone) is compromised, you can lose your coins. If your copy of the private key in wallet B (PC) is compromised, you can lose your coins.

Assuming both copies are secure, you basically just have a backup of your private key.

As for whether or not having two copies like that is secure or "best practice", that depends a lot on how you handle your computers, and there are better experts out there that can answer that.

One thing you cannot do is double spend. If they use the same private key, one wallet is the same as the other, and trying to spend out of both will result in an unconfirmed transaction on one of them.


Why include the Segregated Witness Merkle Root in the input field of the coinbase transaction? I just read this article to understand SegWit better: https://bitcoinmagazine.com/articles/segregated-witness-part-how-a-clever-hack-could-significantly-increase-bitcoin-s-potential-1450553618/ There's a part that doesn't quite make sense to me:

But there is one problem: If signatures have no effect on the makeup of the blockchain, the blockchain no longer serves as proof that the correct signatures were included in transactions.
To make sure that signatures are embedded in the blockchain regardless, a Segregated Witness-enabled miner adds a trick, too. Rather than creating only a Merkle Tree out of all of the transactions, it also creates a Merkle Tree out of all Segregated Witnesses, to mirror the transaction tree. The Segregated Witness Merkle Root, then, is included in the input field of the coinbase transaction. As such the Segregated Witness Merkle Root changes the transaction data of the coinbase transaction, its transaction ID, therefore influences the block header and, ultimately, the makeup of the blockchain.

Is this accurate? If so, what exactly does it achieve?
Including the merkle root of the transactions in the block header prevents tampering with the transaction list, but I don't see any value in tampering with the signatures.

Why a witness commitment is necessary at all: Enabling DoS prevention for validating nodes

Block validation is expensive. It requires hashing all data in a block, building Merkle trees, looking up all inputs from the UTXO database, running script and ECDSA validation, do various consistency checks, and updating the UTXO database. If random peers could make us do that amount of work, we'd be exposing ourselves to denial-of-service attacks.

Thankfully, producing blocks is expensive - it requires spending hash power. An attacker could take a valid block, and modify it before relay to turn it invalid. However, since all data relevant for validation directly or indirectly affects the block hash, doing such an attack will invalidate the proof of work. Thus, we can simply make sure that a block's proof of work is valid before doing any of the more costly checks, and that way we make sure that every attacker needs to spend new hash power for each block we try to validate.

Segregated Witness adds more data to blocks that is relevant for validation. In order to make sure that the protection outlined above still works, we must make sure that the new witness data affects the block hash. Otherwise, an attacker could simply take a valid block, make a gazillion modified copies, each with a different invalid witness, and broadcast them. Nodes would need to validate every version.

Why the witness commitment uses a Merkle tree: compact witness proofs

Some outputs (e.g. 1-of-2 multisig) can be spent by different combinations of signers. Certain wallet software may be interested in knowing which party/parties signed off on a spend for display or forensics purposes.

Lightweight nodes can currently request a compact proof for the existence of a transaction (see BIP37). As the witness does not contribute to the txid, the normal Merkle structure does not permit creating such a proof for the witness data. While there is currently no available protocol for requesting such witness proofs, using a Merkle tree for the witness commitment enables this.

Why the witness Merkle root is stored in the coinbase: easiest deployment for miners

Lastly, we need a place to embed the witness Merkle root hash that affects the block hash. Using the block header would have been perfect, but there is no way to add data there without breaking every piece of Bitcoin infrastructure.

The only place flexible enough for storing that data is in a transaction. A special transaction could have been added which contains the commitment, but transactions bring extra overhead. They need inputs and outputs, which need to come from somewhere and go somewhere.

Because of that, the only choice remaining was to embed the commitment in an existing transaction. The coinbase transaction is the logical choice - it is already created by miners anyway, and adding a dummy output to it has low resource costs (due automatic removal of OP_RETURN outputs from the UTXO set).


Bitcoind transactions in regtest mode always fail with -25 error I have a problem trying to make a transaction using bitcoind/bitcoin-cli in regtest mode (I do not know if it works in other modes).

bitcoin-cli -regtest createrawtransaction '[{"txid" : "e5db3c4fd05d1b8f979de45aca1ebb78b4bd356920cc07b9f374d8c9838d4b5a","vout":0}]' '{"misCfm4sZJDsU3uYHp9NrUZjH3y5rgHrJx":5}'
-> 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe50000000000ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000

bitcoin-cli -regtest signrawtransaction 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe50000000000ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000
-> {
"hex" : "01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe5000000006b483045022100c4c38395683460872f35971fb808a3a28f4d0e16793739760265af6339078a5a02201e5b960e3a97102797282ddb421edca84869ad296da145e55e00dcae747c7c4701210227b858d4f7f75e26ce370e3c0b862e4b9518da6f9cc6d4012008d9b829db9003ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000",
**"complete" : true**
}

bitcoin-cli -regtest sendrawtransaction 01000000015a4b8d83c9d874f3b907cc206935bdb478bb1eca5ae49d978f1b5dd04f3cdbe5000000006b483045022100c4c38395683460872f35971fb808a3a28f4d0e16793739760265af6339078a5a02201e5b960e3a97102797282ddb421edca84869ad296da145e55e00dcae747c7c4701210227b858d4f7f75e26ce370e3c0b862e4b9518da6f9cc6d4012008d9b829db9003ffffffff010065cd1d000000001976a91424bcb21358f61d207207c1cb01921ab602948b9488ac00000000
-> **error: {"code":-25,"message":""}**

I have had a look at the bitcoind source code. From rpcrawtransaction.cpp:

if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {
        if(state.IsInvalid())
            throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
        else
            throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
    }

So the state.IsInvalid() method returns false but the state.getRejectedReason() returns empty string.

More in depth, it seems to be that such problems may arise if:

The tx is already in the memory pool (mah)
Disable replacement feature for now (boh)
I have already the coins
Some inputs do not exist

I am changing the source code to log the reason of my error. Meanwhile, any help would be greatly appreciated.

Thank you.

I have found the solution: the problem was that I was generating an insane fee by specifying an amount which was too small compared to the inputs.

I have discovered it by compiling the last version and not using the precompiled package, which seems to be older...


How to prove legitimacy or that my coin was not used in a recent illicit deal? Let me start by saying that I understand that the money in my wallet may at one time have been used in an illicit transaction.

We have a question that we need help with.

How do we show regulators and other entities that Bob in the following scenario is not laundering funds?

Bob our mild mannered engineer who works from home has done a ton of work for a new website. He has agreed to accept payment in btc- The website pays him the equivalent of 20K USD in btc.  The company bought those coins from a variety of other sources that are not involved in any criminal activity, those people also got their btc from other sources that are non-criminal. Let's say we dive an additional 5 levels deep and these btc are as pure as the driven snow. And maybe some of them were used long ago in sale of endangered birds or drugs or whatever. Just like the 20 dollar bill in my wallet.

7 months later Bob cashes in!! He now has 20K USD that he wants to deposit in to his bank account. In this scenario- mean men with badges show up at Bob's house and accuse him of selling dope and that 20K is via the proceeds of a crime and they want to send Bob to the nearest house of corrections. To make matters worse, Bob's work PC was lost in a boating accident and the web company he worked with is no longer in business. No proof of the work he did.

How can we help Bob quickly show the men with badges that the btc Bob received for payment was not bad money?

And as stated in the scenario maybe some of the btc were used in illicit activity but months later good honest people have these coins and we should consider these coins as pure as the $20 in my wallet that I got from  may have been used to buy cocaine 5 months ago.

I can do analysis of our intake and show the regulators that the exchanges we work with are not buying from criminals and that we are certainly not allowing it. I am hoping to be able to show that people selling directly to exchanges are not not criminals either.

Thank you!

Administratively, there should be plenty of evidence that Bob was working a legitimate job.

If the web firm is a US company and Bob a US worker, then the company is required to file a form 1099-MISC.  Yes ... even if they paid him in non-USD currency.
Some time in that seven-month period, Bob should have paid his quarterly    taxes.  That adds to the legitimacy of his income.
There must be some kind of timekeeping and invoicing process between Bob and the web company, along with specifications, emails, and other evidence of a working relationship.
Bob can point to the stuff he built. (I know from experience that this isn't always possible.  I have worked on a lot of internal projects that people outside a company never have access to.)
If the web company bought their bitcoins on open exchanges, then there is an associated bank account and a bunch of regulatory machinery that has already kicked in at some point.  The company is already being monitored under the usual rules for currency exchanges.

There is a technical side of this too.  Because the entire bitcoin ledger is public knowledge, it should be very clear that Bob has been saving his bitcoins for the past several months.  That is probably not typical behavior for a money launderer.  If, on the other hand, it is clear Bob has been using a mixing service to receive his Bitcoins he may have a problem.

Ultimately all money is fungible.  As you've already intuited, this problem isn't really much different from if Bob was taking his pay in USD instead of Bitcoin.


Bitcoin Cash Multibit HD/Electrum If I had my BTC in a multibit HD wallet prior to the fork, and I exported my wallet to Electrum after the fork, will the BCH still be tied to the multibit HD wallet?

And if so, how can I access the BCH stored in the multibit HD wallet?

Here is what you need to do. Make sure you have the seed from multibit.

Download http://www.electroncash.org/
You create a new wallet, select I already have seed, when you type seed you need to click the "options" button and select BIP39 seed.
It will ask for a derivation path... you need to use: m/0' (note the ' it is important... m/0')
4.Suggest you do research as there are some issues with it not connecting to BCC chain sometimes.

http://reddit.com/r/btc/comments/6qyn18/electroncash_notice_how_to_select_bitcoincash/


Can Phoenix wallet steal my funds? Phoenix wallet is a great UX Lightning Wallet, and they're able to deliver that UX by making a few different tradeoffs. None of those tradeoffs involve them owning your private key, but in their 2019 blogpost they write:

Phoenix only connects to ACINQ nodes. This allows us to modify/enrich the Lightning protocol at the immediate peer level, while staying 100% LN compliant at the network level.

Since I'm only connecting to ACINQ nodes, could ACINQ (the corporation) theoretically use their nodes to say I'm "cheating", thereby forfeiting my LN BTC?
Thanks!

If you can verify that Phoenix is running the code that you expect - the open source eclair implementation of the Lightning Network and Phoenix wallet - then they will not be able to use their node to "say that you're cheating". This is because they do not have signatures for your unique commitment transaction, so there's no chance that they can broadcast your commitment and then claim the penalty for themselves.
More generally, mobile wallets that depend on their channel peer for blocks could theoretically cheat their peers by broadcasting old state and then withholding blocks until the time that your node has to claim the penalty output. Phoenix has an option to connect to your own electrum server, which would protect you against this (unlikely) attack if you chose to enable it.


What does output mean Will my bitcoin be there after syncronising  Am trying to sweep from my syncronising bitcoin core using my private key but its showing no output whats going on

An output is the spending part of a transaction, that establishes ownership of the funds. UTXO is an unspent transaction output. UTXO to your address are counted toward your balance. When you want to send Bitcoin, a UTXO is needed as an input to the transaction.

It is likely that if your node is syncing from scratch it doesnt know about the UTXO related to your address, yet. If it hasn't processed the block that contains the UTXO, it might not know about it, so it doesn't know you have a balance.  If you use the Bitcoin core wallet, there is a wallet database that stores that data.


Are there any publications about deanonymizing Bitcoin? At the Model United Conference I attend, there is a resolution proposed to de-anonymize BTC in order to cull Darknet transactions.

I know it is impossible but how do i prove it to the other delegates?

Scientific peer-reviewed publications would be amazing.

A good resource is http://arxiv.org/. Search bitcoin in the search bar, and then look for "anon" on the page to find articles about anonymization and de-anonymization in bitcoin.

Doing that, I found these examples:

http://arxiv.org/pdf/1510.07782.pdf
http://arxiv.org/pdf/1509.06160.pdf
http://arxiv.org/pdf/1405.7418.pdf
http://arxiv.org/pdf/1107.4524.pdf


Blockchain.com passphrase pattern ? is there any way to know blockchain.com passphrase pattern , I mean they use some words from the dictionary to give someone a passphrase , how would we know the exact wordslist they use ?

Current blockchain.info wallets use the BIP39 wordlist, which you can find for various languages at https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md/

Previous versions have used non-standard implementations with a variety of different wordlists for example v2 and v3.


P2Pool twisted error I need some help to install and configure p2pool.
I run a Debian 7
installed bitcoin and litecoin (getinfo ok)
firewall with open port 3332 3333 8332 8333 9332 9327 9333 9338
installed p2pool and run it with

python run_p2pool.py --net litecoin

I just keep having this error, googled for it but can't seem to find any correct answers for this.

Testing bitcoind RPC connection to 'http://127.0.0.1:3333/' with username 'Litecoinrpc'...
2014-03-16 13:41:47.063358 > Error while checking Bitcoin connection:
2014-03-16 13:41:47.063426 > Traceback (most recent call last):
2014-03-16 13:41:47.063463 > Failure: twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused.

Any help would be greatly appreciated

The default RPC port for bitcoind is 8332. Unless you've changed it with the -rpcport option, you should be connecting to that port instead.


Do we know which mining software Satoshi used? I am trying to figure out why the mining software is not included in the coin wallet you wish to mine and why do we need to find some third party less trustworthy sources to mine

"Bitcoin" currently known as "Bitcoin Core". It used to have a miner, which was removed recently (1-2 years) Of course, he used the software he designed.


Cryptographic "Central Bank" Is it possible to create a bitcoin-like system that has a central authority?

I know that the reason that many people like bitcoin is that it is completely unregulated, but I was thinking that a "central bank" of sorts could make a cryptocurrency more like a real currency (less subject to huge short-term fluctuations) if it were able to create cash.

Would this be possible to do cryptographically (within the algorithm itself), or what would it require?

EDIT: More specifically, what would be the best way to do it?

EDIT2: I still want to keep the P2P transaction system, just have a central regulation system that can create and destroy coins.  I wouldn't want to do something like Arscoin where the server maintenance was less than optimal, to say the least.

It would be pretty easy to implement this using the Bitcoin source:

Have the central bank generate a private key K.  Hardcode the corresponding public key into the source.  Modify  the transaction verification code so that any transaction signed by K is allowed to have outputs that exceed its inputs (or no inputs at all).
Modify the verification code further to reject regular "coinbase" transactions.  Miners can still mine, but rather than getting a block reward, they are rewarded only by transaction fees (a la Bitcoin in 2140).  So you still have the decentralized transaction register confirmed by proof-of-work, but mining doesn't create new money.
Change port numbers and version bytes, mine a new genesis block, all the other stuff that any altcoin needs.

Now the central bank can create money at will, just by signing a transaction that has no inputs but does have outputs (paying the new coins to somebody of their choosing).

The central bank can destroy money that it holds, simply by sending to an eater address with no private key.  This doesn't need any changes as it's already possible for anyone to destroy their own Bitcoins this way.  If you want to give them the ability to destroy money held by someone else, you could add a rule that a transaction signed by the central bank's key may spend any output.

In practice it might be better for the central bank to have a relatively large number of private keys, and a system to revoke specific ones in case they are compromised (perhaps with a special kind of transaction).

Of course, the hard part would be convincing people that this is a good idea, that your central bank is trustworthy, etc, etc.


How to load a peer list file? According to this page,

  The client will automatically read a file named "addr.txt" in the
  bitcoin data directory and will add any addresses it finds in there as
  node addresses.

However, I can't find any point in the source code where this file is actually read, and I don't know how to verify all the peers known by my node.

Is the "addr.txt" file actually read by bitcoind?
How can I check if the addresses are actually loaded?

This feature is no longer present in Bitcoin Core.  It was removed in 2011.

You can get the same effect by adding multiple addnode= lines to your bitcoin.conf.


Trying to transfer BTC from Coinbase to Binance, commission 13 USD? So basically I bought the equivalent of 100EUR in BTC with CoinBase (they took 3 EUR for this operation)

Now I would like to buy other currencies with binance, but if I try to send my BTC to my Binance BTC address it says the network fee are 13 USD.

Are them really so high? Is there something else that i could do?

You can pay a lower fee but this will risk it being stuck in the mempool forever—-not an advisable option.


Does outbound port have to be open to make an Json-RPC call lets say i am making a json-rpc call with the following connection :

 $connect = new jsonRPCClient('http://user:password@ipaddress:9332');

does outbound port 9332 of the sender need to be open as well as that the 9332 inbound port of receiving machine?

if not then which outbound ports need to be open?

the reason i am asking is because i am connecting via json-rpc to a  VPS that hosts bitcoind with a simulated webserver on my PC  (usbwebserver) and it is successful ,  but when i try to do the identical thing from a shared web-server (hosted by a company) i get an error: Unable to connect and they only have specific outbound ports open.

thanks for the help :)

The RPC server doesn't care what source port the request comes from, and it doesn't need to make any extra connections back to the client on that port or any other.

However, a possible cause for your trouble is that the shared webserver's firewall blocks outgoing traffic with a destination port that is not on their whitelist.  (That may be what is meant by "having specific outbound ports open".)

The fix would be to change the RPC server configuration to listen on some other port which is allowed  as a destination port by the shared webserver.  The most obvious choice would be port 80, if the RPC server machine isn't also running an HTTP server.  Otherwise, you can try various commonly used ports to find one that is allowed by the firewall and not already in use.


Transaction size limit across a single path in a Lightning Network and fee earned Given MPP is included in the current version of lnd, an arbitrarily large transaction can be processed in the network. What is the transaction size limit across a single path? Is it still bounded to 0.0429 BTC (limited by max_concurrent_htlc)? What is the estimated fee earned (average as well as maximum) by a lightning node per day?

The maximum size for HTLC's are currently defined by max_htlc_value_in_flight_msat and is roughly 42mBTC. The max_concurrent_htlc that you mention seems to be the max_accepted_htlcs and states how many HTLCs can be within a commitment transaction at the same time. This has nothing to do with the maximum payment size (not transaction size) of a single path. Because the single path would only set up 1 HTLC anyway. Thus this is bound by max_htlc_value_in_flight_msat.

As for the fees this is hard to say because it depends on who pays whom and what routes are being chosen. Assuming a uniform distribution of payment pairs and a flow of payments along the cheapest path the expected earned routing fees are proportional to the betweeness centrality of a node computed on the fee graph. Note however due to the fee rate the fees also depend on the payment size thus the betweenness centrality is almost unexpressable.


How to run a litecoin miner behind a proxy server? I've downloaded the Windows 64-bit Litecoin mining software as provided from http://pool-x.eu/gettingstarted

I'm trying to run the miner from behind a firewall. My browser uses an HTTP proxy to get to the internet, and as I understand it I should be able to use a similar method to connect my Litecoin miner to a pool.

So far, I've modified the file start.console.bat from:

@echo off

START /LOW /B minerd.exe --algo scrypt --url http://litecoinpool.org:9332/ --userpass username.1:1 --threads 4 -r -1 -s 5

to:

@echo off
set HTTP_PROXY=http://myproxyserver:myport
START /LOW /B minerd.exe --algo scrypt --url http://litecoinpool.org:9332/ --userpass myusername.1:mypassword --threads 4 -r -1 -s 5

I've substituted my values in to take the place of the following values:
myproxyserver
myport
9332
myusername.1
mypassword

When I try using the port my browser uses for the proxy server (for both port values), I get this output when I run it (and it spits out another error every 30 secs):

[2012-07-07 13:57:48] HTTP request failed: The requested URL returned error: 503

[2012-07-07 13:57:48] json_rpc_call failed, retry after 30 seconds
[2012-07-07 13:57:48] 1 miner threads started, using 'scrypt' algorithm.

Should the port number for the proxy and for the mining script be the same? What settings can I use to get my miner working?

I got it working for pool-x.eu connecting via port 80 (the proxy server name and port is just what my browser uses):

@echo off
set HTTP_PROXY=http://myproxyserver:myport
START /LOW /B minerd.exe --algo scrypt --url http://mine.pool-x.eu:80/ --userpass myusername.1:mypassword --threads 4 -r -1 -s 5

Not all pools allow connections through port 80, so it does limit which pools you can connect to.


current block height How do I figure out the current number of blocks?

You don't need to modify the bitcoin client at all - you can use JSON-RPC and call getblockcount.


Where can I find a wallet for a blind or visually impaired user? Are there any UIs or hard wallets that work well for a BTC user who is blind or visually impaired?

I don't know of any wallet specifically developed with blind users in mind, but I think there is a solution nonetheless: using the daemon (bitcoind) that is a part of bitcoin-core, through a CLI text-to-speech program. Being a command line tool, the daemon is entirely text-based, so it should be usable in this way.
You can use the daemon to synchronize with the bitcoin network, create receiving addresses, and craft outgoing transactions. It is a very full-featured wallet, despite having a clunkier user experience than some other options.
I am not extremely familiar with the options available for text-to-speech accessibility programs, but bear in mind that there are likely some security considerations when choosing which accessibility program you will be using. Ideally, you would use bitcoin-core and this accessibility program on an offline computer (ie, one that never, ever connects to the internet), to ensure that there are no potential data leaks (does the accessibility program communicate on-screen data with a cloud server? etc).
The good news is that if used correctly, you won't have to sacrifice privacy, security, or sovereignty in using this sort of solution, but the bad news is that the solution isn't easy to use. To quote the user Steve Ellis in the question linked in Murch's comment above:

The short of it is Bitcoin already has a subpar reputation for user experience, and it doesn't get better as you dig into accessibility


Problem with receiving bitcoins on my VPS I installed bitcoind v.0.8 on my VPS (with Debian 6 (Squeeze)). Then I generated a wallet for it: 12VWVmNEM1q6N9zMjX9aH3wSfRUbjVkZ21.

Here is my transaction to this wallet, but when I'm looking for this wallet balance with getreceivedbyaddress or getbalance I get 0.00000000. What can cause it? How can I receive my funds?

It looks like the block chain simply hasn't synced up fully for you. It usually takes a few hours to download the whole block chain and during this time the program will have inaccurate balances.

Verify your block count

Check your Bitcoind's block count with the getblockcount command and make sure it matches up with the network's block count. Heres the network block count, maintained by blockchain.info.

Make sure you're downloading blocks

If it doesn't match up, make sure your Bitcoind is atleast in the process of downloading blocks, try the command a minute later and see if it has incremented since then. If the block count stays the same number over a few minutes, it very likely that the following is your problem.

Why a server isn't downloading the block chain

Something that I've seen happen is that Bitcoind may stop downloading blocks at some point in the middle of the full chain. This happens because your server is running out of memory. Downloading the block chain is a heavy procedure because each block needs to be checked. You can remedy this by just manually moving a chain you've downloaded onto the server or get more ram (you need more than .5 gb of ram to run Bitcoind anyways). The community has the block chain available on torrent.


Difficulty in obtaining vanity Bitcoin addresses What is the formula I can use to estimate the difficulty in generating vanity Bitcoin addresses?

The probabilities are detailed here:

https://en.bitcoin.it/wiki/Vanitygen#Difficulty_of_finding_a_vanity

"The difficult of finding a vanity address depends on its exact structure (leading letters and numbers) and how likely such an output is given the algorithms involved, which can consist of several pivots where the difficulty suddenly changes."

Difficulty can be quite easy or quite hard depending on the structure and length of the vanity portion of your address


What stops miners/nodes lying about what time a block was mined? From what I understand, the difficulty required by the proof-of-work in bitcoin is a function of block history, specifically the average time between last ~2000 blocks, with the intention that its hovers around the 10 minute mark.

The function relies on the timestamp of when the block was created. It occurs to me that when nodes are calculating blocks, they have an incentive to overstate the timestamp (because the difficulty would then be recalculated to allow for quicker mining of new blocks, which would lead to a higher rate at which that node receives rewarded bitcoins).

The protocol states nodes should reject blocks that have timestamps that look invalid (e.g. too far into the future), but again it relies on nodes being honest.

In short, what is the incentive for miners to not overstate timestamps? Am I right in thinking that if a majority of miners/nodes colluded in overstating + not rejecting invalid timestamps, then the entire bitcoin network would start generating bitcoins faster?

Note: It occurs to me that as the total pool of bitcoins increases + rate of reward halves every 4 years, this 'speeding up' of the bitcoin block generation has less and less impact.

A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours. "Network-adjusted time" is the median of the timestamps returned by all nodes connected to you.
Whenever a node connects to another node, it gets a UTC timestamp from it, and stores its offset from node-local UTC. The network-adjusted time is then the node-local UTC plus the median offset from all connected nodes. Network time is never adjusted more than 70 minutes from local system time, however.

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

So, if you want your block accepted by other nodes, you won't mess with anything close to deviating from the current time by two hours.
But the protocol doesn't care how many blocks are being mined, it only will use those durations of the past 2,016 blocks to adjust difficulty when that periodic event occurs.


Create a transaction which sends bitcoin to the address it's being sent from? Let's say address X has 1 btc. Can you create a transaction which would send the 1 btc from X back to X and broadcast it without having to sign it, since the 1 btc is going back into the address it is being sent from?

Transactions don't send from address to address.

Transactions spend specific coins ("transaction outputs") and create new coins as a result. Every coin has an amount and an owner (identified by its address).

While it's possible to define the "balance" of an address as the sum of the values of all coins with that address as owner, this is not how the system works internally. Addresses are just an authentication mechanism to make sure coins can't be spent without proving ownership. In particular, a transaction that sends coins "back to the same address" is in no way different from one that doesn't. It's still spending a coin and creating a new one - just one that happens to have the same owner. In order to spend a coin you need to prove you own it.


How will a bitcoin ETF be any different from a bitcoin exchange? The W.Twins bitcoin ETF/trust stock can be converted to real bitcoins. This means that we can buy $100 worth of stock and convert it to maybe 0.5 BTC depending on the current rate. And we can buy 0.5 BTC and convert it to maybe $100 worth of stock depending on the current rate.

Doesn't that make the bitcoin ETF yet another bitcoin exchange like MtGox, BitStamp, etc?

What is the difference between a bitcoin ETF and a bitcoin exchange then?

W.Twins claimed that the ETF shares will reflect the performance of a weighted average price of Bitcoins in the other markets.

Now we all know that's not going to happen. Being yet another exchange, it is subject to supply and demand, which in turn is dependent on the popularity and the ease of deposit / withdrawal of USD among other factors.

We can't say that BitStamp (or MtGox or BTC-e) rate is the weighted average of all the other exchanges can we? It simply has it's own unique rate, due to it's own unique supply and it's own unique demand. Similarly, the bitcoin ETF/trust will have it's own unique rate, due to it's own unique supply and it's own unique demand.

In fact, if we imagine that MtGox has a subsidiary called "MtGox-Trust", and each of our bitcoin in our MtGox account is a "MtGox-Trust" stock that we can sell and buy, then MtGox is effectively now a bitcoin ETF isn't it?

Can someone explain how will a bitcoin ETF be any different from a bitcoin exchange?

You don't get the bitcoins themselves.  Your investment fluctuates in response to the exchange rate.  From the brothers W:

  The investment objective of the Trust is for the Shares to reflect the
  *performance* of a weighted average price of Bitcoins, less the Trust’s
  expenses.

In other words, if the average exchange rate USD/BTC is $230, and you buy $230 worth of the ETF, when the average rate goes to $250, you could sell the ETF shares for around $250 ("less the Trust's expenses").  All of your transactions would have taken place on a US stock exchange, using US dollars.

You could do this yourself, by buying and selling BTC on a variety of exchanges, but your profits would be more than eaten up with the commissions for buying and selling.

The ETF, on the other hand, would presumably have the benefit of volume, and may not even have to invest all incoming funds when there are outgoing funds (from redemptions) at the same time.


How is the previous transaction hash calculated? Can anyone provide a clear example on how to calculate a previous transaction hash?

Say I want to create a new transaction, I get that the hash is calculated by doubling sha256 a message m, but I'm having a hard time understanding the structure of m.

You do not need to calculate previous transaction hash, because it is already known.
To spend the previous output you just have to know

tx hash
output index in this tx
output value
output script

plus you should choose

fee
new address

then create some byte data and sign it with appropriate private key

Good manual you can find here: How to redeem a basic Tx?


Bitcoinj How to create multi-signature address using bitcoinj Can somebody help me with step-by-step list of how to create a multi signature 2-of-3 transaction using bitcoinj api?

ECKey keyA = <something>
ECKey keyB = <something>
ECKey keyC = <something>

Transaction aTransaction = new Transaction(params);
List<ECKey> keyList = ImmutableList.of(keyA, keyB, keyC);

Script script = ScriptBuilder.createMultiSigOutputScript(2, keyList); //2 of 3 multisig
Coin value = Coin.valueOf(0,10); // 0.1 btc
aTransaction.addOutput(value, script);
Wallet.SendRequest request = Wallet.SendRequest.forTx(aTransaction.addOutput);
wallet.completeTx(request); // fill in coins

See mikes documentation


How can I specify multiple txids in createrawtransaction function? I saw we can specify multiple txids, but I've never seen such a case.
So I wanna make it sure.
Thanks

Send the command as following:

bitcoin-cli createrawtransaction
[{"txid":"FIRST_INPUT_TXID","vout":2},
{"txid":"SECOND_INPUT_TXID", "vout":3}]
{"FIRST_OUTPUT_ADDRESS":0.006, "SECOND_OUTPUT_ADDRESS":0.004}

if it didn't work try to skip quotation (") by adding backslash before it \"


Which public extended key should I use? I'm trying to make sense of the information shown here and how the extended public keys work.
The web wallet I'm using only supports this derivation path m/44'/242'/0'/i', so if I understood correctly:
(1) It doesn't matter what the index for the coin is, the extended private and public keys should be the same for all coins, that's why the same seed words can be used for all coins in the HD wallet.
(2) Since the derivation path used on the web wallet has hardened derivation in some indices, the extended public key won't be able to generate the same addresses available on the web wallet.
Imagine I want to share a key with someone that would allow them to generate the same addresses available for my seed words on the web wallet, but without allowing them to send any transactions. Is that posible? Which derivation path and extended public key should I use? Say for instance for this random 24-word nemonic phrase:
guitar letter tuna oppose
mushroom affair sock adjust
couch plunge angry ladder
evolve dial only maximum
stereo drama final public
become manual pelican glue

Imagine I want to share a key with someone that would allow them to generate the same addresses available for my seed words on the web wallet, but without allowing them to send any transactions.

I'm pretty sure what you suggest is not possible.
The only single datum of information from which you can produce all the addresses is the one that also allows you to spend money.


How is Scrypt ASIC-resistant? I just started reading about Litecoin's Scrypt algorithm and all the explanations are quite complex. I have understood that Scrypt uses more memory than Bitcoin's SHA-256 which makes it ASIC-resistant and prevents centralization.

But, from what I understand we still require powerful GPUs to mine Litecoins because operations on larger data sets (more memory) will be faster and more efficient in GPU than in CPU.

Also, why is it not possible to build an ASIC machine for Scrypt. Is it due to the complexity involved in the algorithm? I just want to know if it's impossible or just difficult. In the future, can we expect ASIC machines for Scrypt as well?

The Scrypt algorithm started out as an "ASIC-resistant" algorithm, but it isn't anymore.

Because it is highly memory-intensive, it was thought to be prohibitive to design and use ASICs for it. Initially it kind of was. With cost of memory decreasing and the necessary research put in -- in order to unlock the profit potential attainable using Scrypt-capable ASICS -- that ASIC-resistance has largely vanished.

A great many ASIC hardware projects for Scrypt started out with great fanfare, but only rather few have succeeded and ever been delivered. A rather large part failed along the way or were scams from the beginning, with developers pocketing money for pre-orders and never delivering any product. Despite these numerous frauds, a number of ASIC development projects have actually been completed and mining hardware has been delivered. As soon as a successfully completed machine was deployed and hit the market, this was always visible in a significant increase in mining difficulty for Scrypt coins whose profitability has, as a result, steadily decreased with every new ASIC model delivered.

The only residues of Scrypt being ASIC-resistant these days are the lower hash rates you see with Scrypt-based Crypto coins as opposed to SHA-256 ones.


"request coins" address is different to top right qr code Bitcoin wallet app (android app).

I'm familiar with how an Hierarchical Deterministic wallet generates addresses, but I'm confused by the ever changing address of "receive coins" button in the bottom left.

Literally every time I click I'm given a different address, but the qr code in top right is always the same (and informs me it will update to new address after a transaction), but the bottom left doesn't show the actual address, only qr code, and I like to save the address each time it changes so I know which wallet it's from (so later I can confirm which of my multiple wallets will receive the payment) and also go back and check I've copied it correctly etc etc.

What's going on with "receive coins" option?

On the main screen (not the request coins page), you should see a little Tag symbol up the top in the menu bar. That opens up your address book. Swipe over to the 'Your addresses' tab, and you'll see a list of all the addresses generated by the request coins page. You can give each one a label on this page too so you remember what they are for.

The app generates a new address for each payment for privacy reasons.


What additional considerations are there for dual-funded payment channels? Naively, it seems like a dual-funded channel should not be much more complicated than a single funded channel; You'd just have an extra input from Bob and it would be reflected in the balances of the first commitment tx.

I'm guessing dual-funded channels are more complicated though, since it's not currently specified in the BOLTS.

Is it because for a dual-funded channel there is the additional risk of one peer not sending over their signature for their input to the funding tx? Presumably this would force Alice to either wait, or consume their input in another tx in order to invalidate Bob's dual-funded funding tx. Is that an issue? And if so is there a solution for it?

Are there any other complicating factors for dual-funded compared to single-funded payment channels?

The issue of waiting for signatures also holds true in the single funded channel.
Let us assume Alice wants to open a single funded channel. As long as she has not gotten signatures for the commitment transaction via commitment_signed message she cannot publish the funding tx.
In the dual funded case there need to be two rounds of signature exchanges (one for the input of the funding tx and one for the commitment tx) but from a risk perspective of an unresponsive peer this is not worse than the situation we already have in single funded channels.

The real difficulties emerge since in the case of dual funded channels it is not so clear who should pay the onchain fees and why (also there is some additional communication overhead (see below))? Remember in the case of single funded channels all fees are paid by the initiator in every case as it was the initiator who had the interest of opening the channel.

Let us look at dual funded channels: Some might argue that this is a service to the purchase inbound liquidity and there should be a service fee. This is discussed in this thread: https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001631.html along this line goes the question and discussion of how to make sure that the channel is not closed again right away: https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001532.html

In general there was a nice post on the ML about the initial dual funded protocol. I can't sum this up to quickly but I guess you will find some of the challanges in the thread: https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001682.html


Do any pools discriminate against some transactions? Are there any pools that openly discriminate against some transactions? For example, they only put transactions with a fee in their blocks, thus ignoring all "free" transactions?

Yes; many pools only include transactions based on fees and/or whether the transactions have standard forms. Most pool operators require that transactions have certain fees based on the size (in bytes, not BTC) of the transaction, and I believe that most require the transactions to be in a standard "Pay to address(es)" or "Pay to IP(s)" form. Eligius, for example, generally includes transactions if they have 40.96 µBTC of fees per 512 bytes of transaction, but it could be more or less if they think the transaction seems like "spam" or you make arrangements with the pool operator.


How to set the language/localization in the standard client? Version 0.6 introduced automatic client localizations. Personally, I hate using programs in Hebrew, and prefer English, but the client didn't ask for my preferences on this matter and just switched to Hebrew.

How can I change the interface language back to English?

EDIT: The correct solution was provided by Matt Corallo but was somewhy deleted. Use the command line argument -lang=en_US.

As far as I know, QT chooses which language to use based on the OS settings. So I think the first thing to try is to configure your OS not to use a Hebrew interface.

If that fails, you should try to figure out how to disable localization in QT circles, since bitcoin-qt's localization inherits completely from QT.

If all else fails, you can recompile without the language in question.


How is bitcoin (blockchain) secure? I see a few different levels here and I want to clarify
There's various levels where your password could be potentially exposed... at least from my mind

Storage (paper wallet, metal wallet, cold storage wallet)
Device (Phone, Computer etc.) i.e. Apple, Microsoft, Google (device makers)
Interface (Mobile App, Desktop App) (how do we know which are safe?)
Internet provider? (if it's https secure do we need to worry here?)
Miner? (is it at all possible for miners to manipulate your transaction?)

On what levels are we the most vulnerable?

The question is a little confusing, but:
1 and 2 are more to do with your own personal security practices. Of course, your own bitcoins are only as safe as the measures you take to secure them.
#3 - It is recommended to stick to wallet software that is open source, such that its code can be audited and verified to be safe. If you can read code, you are encouraged to read through the code of the wallet software you use and compile it yourself.
#4 - Traffic on the Bitcoin network isn't encrypted at all. If you run a Bitcoin node, your ISP will be able to see that you're running a Bitcoin node, and if you relay transactions from your node, your ISP will be able to assume those are your transactions. However, they won't be able to modify them, as any modification would require a new signature with your private key.
#5 - At worst, a miner launching a 51% attack can prevent your transactions from confirming. While harmful, they won't be able to actually manipulate your transaction, as your transaction still must have a valid signature from your private key.


Witness data storage localisation in the blockchain Since segregated witness is in place inside Bitcoin blockchain, my understanding is that witness data are no longer stored inside the blocks, so if blocks are linked to each other where theirs corresponding witness data are stored ? There is a parallel block chain ?

If the client is SegWit enabled, the full transaction including witness data can be stored in the same format as the transaction is received over the wire. There is no need for separate storage - it can all be included in the block.

If the client is not SegWit enabled, SegWit transactions are stripped of their witness and the witness marker/flag before sending/receiving, so these clients will not receive witness data, and therefore will not store it at all and will only use the legacy format.

This means the block storage between the two clients is different, but they are still sharing the same blockchain and transaction history.

Compatibility is made possible because even when SegWit is used and the witness is present, the SegWit client will calculate a txid by stripping the transaction back to its legacy format (removing the witness parts) before hashing. The txid is common between the SegWit and non-SegWit clients as a means to identify which transaction is being referred to. SegWit clients can identify data by a wtxid too, which is the hash of the serialized transaction with witness format - but this wtxid is not used as part of a txOutPoint to refer to a previous transaction - the txid is always used.

SegWit transactions are forward compatible with non-supporting software clients because the transaction with its witness data stripped from it appears as though it is an ANYONECANSPEND transaction - the stack is left with a non-zero value on top after evaluating the scriptPubKey, which is indicates successful evaluation.


How do I backup my Ripple wallet? Ripple uses a Blob Vault structure to hold the wallet, but it currently resides on one centralized endpoint. It might be prudent to back up your wallet.

How is it done?

There are two things to backup/save, both can be found in the client under "Wallet -> Security".

The first and most important is your "secret key". Your public key is your ripple address that is r0123456789ABCDEabcde, your secret key is in a similar format but starts with 's', something like s0123456789ABCDEabcde. Write this down or save it somewhere safe. With just this your funds and trust lines can be recovered into a new wallet.

The other thing to save is your wallet. It's stored encrypted and contains your contacts as well as your secret key. The client will let you make an explicit copy into a local file that you can save as you wish. As with the secret key you do this via "Wallet->Security" in the client.

On account creation (and whenever you login) you can set the "Fetch wallet from" option to one of "Payward", "Payward and Local Browser" or "Local Browser". The middle option, both, is the default. It means that an encrypted copy of your wallet is stored at https://blobvault.payward.com (seen/set on the Advanced->Options page) and somewhere in your browser (?where?). The payward option allows you to access your wallet from any device and the local copy makes you not depend on payward being up/accessible at all times.


What is wrong with my ScriptSig? I get 64: scriptsig-not-pushonly I currently try to create and sign transaction from scratch. I made it to construct and sign a transaction. If I verify it manually it looks good but using a "proper" wallet my transaction is refused:

error code: -26
error message:
64: scriptsig-not-pushonly

That's what I get from bitcoin-cli

My ScriptSig is: 4a304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f9801410442718de90a0a10f0cd10054ff4ab6037fd230c5d4b50c07eed0bc247e1e3dbd9ad3f4c65680396813bd96b0c2db5647e355082db34c7106a74337d51e5730f45

I would decode it as follows:

4a => length of signature, 74 byte

304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f98 DER signature

01 opcode SIGHASH_ALL

41 public key length, 65 byte

0442718de90a0a10f0cd10054ff4ab6037fd230c5d4b50c07eed0bc247e1e3dbd9ad3f4c65680396813bd96b0c2db5647e355082db34c7106a74337d51e5730f45 public key

Can you spot a problem with this ScriptSig?

Your signature is not correct. First of all, its length can't be 74 bytes long. According to the Bitcoin wiki:

  Signatures are either 73, 72, or 71 bytes long, with probabilities approximately 25%, 50% and 25% respectively, although sizes even smaller than that are possible with exponentially decreasing probability.

Having said that, it seems that you have computed the length of the signature wrong twice. First, what you decoded as the DER signature is not 74-byte long, but 72:

sig = "304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f98"

len(sig/2) = 72

Moreover, you didn't count the hash flag as part of the signature length, and you should. That will add an extra byte, making the signature 73-byte long.

Putting all together, the script should be:

ScriptSig = 49304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f9801410442718de90a0a10f0cd10054ff4ab6037fd230c5d4b50c07eed0bc247e1e3dbd9ad3f4c65680396813bd96b0c2db5647e355082db34c7106a74337d51e5730f45

Finally, notice that, according to what @pebwindkraft told you in his answer, you are producing high-S signatures, so you should also work around that.


Multisig Wallet Question I think I understand multisig wallets: X out of Y signatures are required for a transaction to be made.

My question is: is there such a thing as a multisig wallet where any ONE of the allowed signatures can complete the transaction? So we have a ring of 5 people, and any one of the five can take any action with their unique on the wallet, essentially sharing it.

Yes, just set X=1, and Y=number of people.


How to store Bitcoin values in a MySQL database? floats are bad.... right? What should I be using to store the values of a wallet in a MySQL database?

Apparently floats are too imprecise to be storing Bitcoins, especially down to the satoshi.

So what should I be using? Decimal ?

What you want is a MySQL Decimal field.

Specifically you want a DECIMAL(16,8)

That will give you 8 digits before the decimal and 8 after the decimal

See http://dev.mysql.com/doc/refman/5.1/en/precision-math-decimal-changes.html for details.


Why does Bitcoin not have faster downward difficulty adjustments? The BCash fork seems to have correctly anticipated the need to adjust difficulty downwards in the case of very slow blocks. This means it's much less likely for the chain to be orphaned when it was nowhere near as profitable to mine as the BTC chain (the first period was very unprofitable). All you need is one miner to continue mining to produce an adjustment downward fairly rapidly. However, now we're at the point where it may be more profitable to mine BCH and this may strip mining capacity away from BTC - the profitability will see-saw between both chains.

Why does the BTC chain not have faster downward adjustments? I'm guessing there is some important security reason for this. It certainly saved BCH in the beginning so superficially it seems like a good idea. If BTC loses a lot of mining power and has slow adjustments you could have really long periods of slow confirmation times on the legacy chain.

I expect this issue will become even more important with the 2x fork when BTC (presumably) loses much more hashing power. Perhaps there is no easy solution because it would require a hard fork in itself, defeating the purpose of not forking the legacy chain.

So to summarize:

Why is downward adjustment so slow on the legacy chain? There must be some real benefit to this.
Will an equilibrium in mining be found, assuming short-term profit seeking miners? How will that equilibrium be arrived at?

Peter Todd has an in-depth answer to this question here:

https://petertodd.org/assets/commitments/52ccc4802bd563076cbd25ec4c1ba88152098cb6aa356ba644c9e79a24182da5.txt

What attack does the difficulty drop rate limiter prevent?

The Bitcoin protocol limits the rate at which the difficulty can decrease to no
less than 1/4th of the prior period's difficulty per adjustment period.
Specifically, in the difficulty calculation the variable containing the actual
time it took to generate 2016 blocks is capped at 4x the expected time.

// Limit adjustment step
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
if (nActualTimespan > params.nPowTargetTimespan*4)
    nActualTimespan = params.nPowTargetTimespan*4;

So why did Satoshi do this? What attack does this rate limiter prevent?

Suppose I want to trick you into accepting a chain that I've mined with less
work than the valid chain with the most work in existence. If I can
successfully sybil attack you, I can prevent you from learning about the
most-work chain.

Let's suppose I start the sybil attack when you know of the existance of block
n=(k*2016 - 1), which happens to be one block prior to the end of the difficulty
adjustment period, and has timestamp t.

I now mine block n+1 with the largest timestamp you'll accept (your local clock
plus 2hrs). Without the rate limiter, the amount that the difficulty would drop
is limited only by the difference between time t and now - that may be very
large if your node has been off for awhile, you're in initial sync, or I manage
to get you to reset your chainstate (e.g. by social engineering, or with a
chainstate corruption exploit). For example, if I manage to roll you back a
year, the difficulty would drop to 1/26th of the last block you know about.

With the difficulty dropped, I can then mine blocks quite cheaply to make you
think the transaction you're accepting has a significant number of
confirmations.

By limiting the rate at which difficulty can drop we make this attack
significantly more expensive: my cost-per-block is now only 1/4th of what it
should be, a significant increase compared to the situation without the drop
rate limit.

Synchrony/Latency

Of course, all consensus systems have a network synchrony assumption of some
kind - if the participants can't communicate in a sufficiently timely manner
it's impossible to come to consensus; the infinite latency case being an
obvious example. But even if the system isn't functioning properly, we still
want to limit what an attacker can do: in combination with PoW, the difficulty
drop limit ensures that even if latency is infinite, attacks against
participants are still expensive, turning a potentially disastrous
double-spend attack into a much less harmful DoS attack.

PoW vs PoS

Finally, note how important PoW was here: PoW guarantees that this attack will
be expensive, by virtue of the fact that the attacker has no way of avoiding
the need to spend funds to destroy energy - or in the case of stolen hash
power, give up the opportunity to mine blocks extending the most-work chain.

Meanwhile in a PoS system this attack can be done for free: even in a "slasher"
style PoS system, since we've sybil attacked the target we can prevent the
slasher mechanism from working. The proof of our fraud will never reach the
outside world, and thus has no impact on the value of our staked coins.


P2SH in Hardware wallet? I am designing a hardware wallet and the software that will work with it.

I plan to provide P2PKH transactions support in the software for hardware wallet to sign.

Is it mandatory to support P2SH transactions ?

In my learning and use of bitcoin I have not come across P2SH transactions.

If its mandatory how does Ledger nano/ Trezor do it?

Im a little lost with how to support P2SH transactions from UI/UX point of view too.

P2PKH are simple one-one transaction to receiver Pubkey. Any help on P2SH would be really great. Thanks in advance. Sorry if this question sounds novice, Im in learning curve.

If you have a look at https://github.com/bitcoin/bips you can find all BIP's. Scrolling down to the README, you will find the list number and title of every BIP and the current status. The BIP process with definitions for the status codes and other aspects is in BIP0002. At the top of the page you can search for P2SH or Pay to Script Hash and find many matches. BIP0016 seems to be particularly relevant but is certainly not the only source.

There are several BIP's dealing with aspects of P2SH and I would suggest that you should support P2SH transactions as they are a standard type of transaction that your end users may receive, although, being able to create P2SH transactions is probably not necessary. Check the BIP's.

You may also be interested in the [bitcoin-dev] mailing list.


Where can I find an overview of Bitcoin exchange APIs? Where can I find information on a large number of "exchange" or "trading platform" APIs showing which currencies (digital and fiat) they convert between?

Since you originally stated that you wanted to write a trading bot, perhaps you will find the following library useful:

"XChange is a Java library providing a simple and consistent API for interacting with over a dozen Bitcoin exchanges providing a consistent interface for trading and accessing market data" (according to their GitHub page)

Unfortunately, I cannot tell you more about it, as I just stumbled upon it by accident.


Where can I sell Amazon.com Gift Code for Bitcoins? Where can I sell Amazon.com Gift Code for Bitcoins ? I want a list of services, not exchange sites/forums.

bitmit.net has quite a few gift cards already listed for sale, therefore with the right price you will be able to sell yours with no problem.


How does BIP 39 mnemonic work? As I already understood the mnemonics are the private key separated in 12 words which joined together in the very same order produces the private key.

How are mnemonics generated?
Why Ledger mnemonics have 24 words?
How those words are converted to private keys?

Mnemonics are the private key separated in 12 words which joined together in the very same order produces the private key

That is incorrect. A mnemonic represents an entropy that is passed to a PBKDF2 key-stretching function with 2048 rounds of hashing to generate a 512 bits seed. This seed then acts like a keychain that is used to generate different keys. Check the last section of the answer to see how private keys are generated from seed.

  How are mnemonics generated?

As said above, mnemonics are representation of entropy along with a checksum. First step involves making a decision as to how much entropy you consider safe for your operations. Assume, for now that you have decided on 128 bits of entropy. Below are the steps that you will follow to convert this entropy to mnemonic.

Use some cryptographically secure entropy generator to generate 128 bits of entropy.
Calculate the SHA256 of the entropy.
Append the first entropy_length/32 bits of the SHA256 of the entropy at the end of the entropy. For example, in our case we will append the first 4 bits of the SHA256(entropy) to the entropy since our entropy is 128 bits.
Each word of the mnemonic represents 11 bits. Hence, if you check the wordlist you will find 2048 unique words. Now, divide the entropy + checksum into parts of 11 bits each.
Match this 11 bit fragments to the words in the lookup table in the wordlist. Since we used 128 bits of entropy our checksum was 4 bits. So our entropy along with checksum represented a total of 132 bits. Thus our mnemonic will be 12 words.

If you had used 256 bits of entropy, your checksum would have been (256/32 =) 8 bits. That would represent (264/11) = 24 words.

One thing to note is that any 12/24 words cannot be used as a mnemonic. Some 'portion' of the last word generally contains the checksum of the words chosen and hence has to be calculated. It is also discouraged to generate words directly from thought and use a secure cryptographic function to do so.

  Why Ledger Mnemonics have 24 words?

That is a design choice of security. More the number of words higher the entropy. 24 words will provide 256 bits of entropy. It is also important to note that a mnemonic phrase cannot be used back and forth between different number of words. For example you cannot convert a 24 word representation to 12 words and vice versa.

  How those words are converted to a private key?

The mnemonic is passed to key-stretching function PBKDF2 with 2048 rounds of hashing. The PBKDF2 function also has the ability to take a 'salt' that can be an optional passphrase. This passphrase provides an additional layer of security and prevents brute-force attack with look-up tables. The output of this function is a 512 bit seed.

This seed is then passed to HMAC-SHA512 with key "Bitcoin seed". The resulting hash is used to create the master private key (m) and master chain code (c). The left 256 bits of that resulting hash represents m while the right 256 bits represents c. The master private key m is then used to generate master public key M (M = m*G).

From here a number of derivation paths existing for different wallets. The most common one is a hardened derivation method as specified in BIP 44. Essentially, hardened keys use the parent private key in the hash function to generate child private key, while non-hardened uses parent public key in the hash function. This improves the security in the generation of child keys. In the below derivation, k and K represents private key and the associated public key respectively.

We would first need to show that we have used BIP 44 derivation path. That can be done with an index number and generate a private key one level deeper from the master private key. The child private key one level deeper is generated by: kchild = kpar + hash(kpar, cpar, i) where i is the index number. For hardened derivation of BIP 44, i will be 0x80000044 (we use the latter 231 half of the index number for hardened derivation). This result will give us a 512 bit number. The left 256 bits will represent the child private key and the right 256 bits will represent the child chain code.

The next level represents the coin. For Bitcoin, that is 0 or 0x80000000 in hardened derivation. You then calculate the child private key and child chain code  one level deeper using the formula above.

The next level represents account. You can use multiple accounts to represent different functions and help manage your funds better. You can use the above logic to generate the account private key and chain code. Again, this is hardened derivation so the first account will have index number as 0x80000000.

From here onward we do not use the hardened derivation. The next level represents receiving address vs change. This allows you to have different bunch for receiving private keys and different key bunch for change private keys. The function we will use to generate the child private from parent will be: kchild = kpar + hash(Kpar, cpar, i). Now i will be 0x00000000 for receiving and 0x00000001 for change. Also note, now we have public key in the hash function rather than private key which shows this is not hardened derivation.

Now, at the next level we use these receiving and change key bunch to generate individual private keys. Use the above generate private keys and chain code and pass them to the above mentioned function kchild = kpar + hash(Kpar, cpar, i) to generate individual keys. Every increment of i will give you a different private key.

Now use these private keys to generate bitcoin addresses.


How do I concatenate two hashes in Python? Concatenating and double SHA-256 hashing

"a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"

with itself

"a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"

should output
15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3

      import hashlib
      header_hex = "a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43a751efbeabe73bdf9d08df5760104feff915d9d807d4c62178cdeb98d8c25f43"

      header_bin = header_hex.decode('hex')

      hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()

      hash.encode('hex_codec')
      '2b4a9fdb97e89e73c4647791e476090eaad04f43c93a3de21a95d2c4fc8e8e0c'

I'm getting the wrong answer :/?

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

      import hashlib
      header_hex = "435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7435fc2d898ebcd7821c6d407d8d915f9ef4f106057df089ddf3be7abbeef51a7"

      header_bin = header_hex.decode('hex')
      hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
      hash.encode('hex_codec') 'b3b366122163d146f56ecdcd0f5029f387da1d9f62e0fbb4b9c22c3eaaa0ec15' >>>

      hash[::-1].encode('hex_codec') '15eca0aa3e2cc2b9b4fbe0629f1dda87f329500fcdcd6ef546d163211266b3b3'


Is Z-man's PTLC construction implementable using libsecp256k1-zkp? In a mailing list post Z-man details a PTLC construction which he claims is "is almost entirely a MuSig ritual". My question is whether this MusigTweak is what is called the adaptor (last argument of secp256k1_musig_session_combine_nonces) in secp256k1-zkp? And has in fact been implemented?

How is MusigTweak computed? Is it the per-hop tweaked payment point, which means it will be the payment point for the hop connecting to the payer?

In a way, that wouldn't make sense since MusigTweak takes three arguments, and the payment point is the same for both channel partners. But on the other hand, maybe Z-man is describing how the tweaking works internally in libsecp256k1-zkp, and I can safely just use the tweaked payment point for both peers for the adaptor argument because the implementation will treat the adaptor differently depending in the index of the signer?

My question is whether this MusigTweak is what is called the adaptor (last argument of secp256k1_musig_session_combine_nonces) in secp256k1-zkp?

No, what "Z-man" refers to as MusigTweak is not called the adaptor in secp256k1-zkp. The difference between the normal MuSig ritual and the "almost entirely MuSig" ritual is not the MuSigTweak. The MuSigTweak just determines how keys are aggregated and is called secp256k1_musig_coefficient in the secp256k1-zkp implementation as of commit cad7cc8f34d17166da2dabae20188ea6e747ac69. In the MuSig paper the MuSigTweak is called a_i. The adaptor argument of secp256k1_musig_session_combine_nonces refers to t*G (where G is the base point) in Z-man's description.

  And has in fact been implemented?

Yes, almost. What Z-man is describing here is the original adaptor signature scheme. It's not well suited for multi-hop locks (aka Lightning with payment points), because the creating party must know the t when creating an adaptor signature. Therefore, the implementation in libsecp256k1-zkp uses the adaptor signature variant that was introduced in the original Lightning in Scritpless Script mailing list post and in the Anonymous Multi-Hop Locks for Blockchain Scalability and Interoperability paper. If you want to know more about the multi-hop lock protocol, I suggest to have a look at the diagram in the scriptless script repo.

libsecp256k1-zkp has a unit test for a scriptless script atomic swap using that technique.

  How is MusigTweak computed? Is it the per-hop tweaked payment point, which means it will be the payment point for the hop connecting to the payer?

The adaptor point t*G is the per-hop tweaked payment point, not the MuSigTweak.


Is there a way to determine the optimal size of a batched transaction to save on fees? I've been looking at other questions about fees and batching, but it seems no one asked if there is some way to determine the optimal size of a transaction to save on fees (assuming all inputs are spending from segwit native UTXOs for simplicity).
To expand a bit on what I have in mind: I need to pay various amounts to different people (let's consider their number can be anywhere between 1 and infinite), and I guess that by making one "big" transaction paying them all at once instead of 1 transaction for each of them I can save on fees. But is it the more people I can add up in the same transaction the better, or would I save less at some point if my transaction keeps getting bigger? Is there some model to calculate the "optimal" size for my batched transaction, or maybe it doesn't make sense?
Here's my best guess for now: adding more people means really adding outputs, which makes the transaction grow linearily (assuming all ouputs are pretty standard and roughly of the same size), so assuming the fees are split between each receivers the more people you can onboard on the same transaction the cheaper it gets for everyone.
But at some point the sum of the amounts of the ouputs will grow bigger than the one input I added at first and I'll need to add another input. If I have relatively big ouputs to spend this is probably ok, but if I only have small outputs and/or I'm adding relatively big amounts in the outputs at some point adding one more output could need to add one or maybe more inputs, making the growth in size transaction not worthing the save in fees, so I'd rather just stop it and send the batch at this point.
[EDIT] I came across this article that seems to confirm what I was thinking, and that all things being equal it will always save fees to add a new output.

But at some point the sum of the amounts of the ouputs will grow bigger than the one input I added at first and I'll need to add another input. If I have relatively big ouputs to spend this is probably ok, but if I only have small outputs and/or I'm adding relatively big amounts in the outputs at some point adding one more output could need to add one or maybe more inputs, making the growth in size transaction not worthing the save in fees, so I'd rather just stop it and send the batch at this point.

The addition of another input does not matter, as it would have to be included in the next transaction too anyway.
In any way, a second stage transaction will always be more costy than a single batching transaction as you would duplicate the (non-witness!) meta bytes (version, n° of input, n° of outputs, locktime, etc..).


Bitcoin wrong address What will happen if someone does not copy and paste the "To" address properly?

For example:
If my address is 1xxxxxxxxxxxxxxxA

and the person tries to send money to 1xxxxxxxxxxxxxxx
(note the missing last alphabet)

will the transaction go through and will the coins be lost?

Thanks!
Ryan

From the bitcoin wiki:

  Several of the characters inside a Bitcoin address are used as a
  checksum so that typographical errors can be automatically found and
  rejected. The checksum also allows Bitcoin software to confirm that a
  33-character (or shorter) address is in fact valid and isn't simply an
  address with a missing character.

In other words, your wallet shouldn't let you sent coins to a bad address, and servers won't accept the transaction.


blockchain.info JSON API problem I'm trying to get the time series for a specific period from Blockchain but the JSON seems to not be there anymore. Does anyone know if the JSON API is not available anymore or it is a temporary issue?

For example when trying to access https://blockchain.info/charts/hash-rate&format=json I get an Unknown Exception.

The JSON export seems indeed to be broken. A quick workaround is to simply get the graph page and extract the needed data from there:

curl -s https://blockchain.info/charts/hash-rate | grep data: | grep -oE '\[[0-9\.,]+\]'

That should give you the JSON array. The array contains a daily sample of the hash-rate starting from timestamp

curl -s https://blockchain.info/charts/hash-rate | grep pointStart | grep -oE '[0-9]+'


What is/Is there the relation between the value of a bitcoin and the prices of video cards? A significant number of Video Cards (significant investment) are required to reduce the possibility of 51% attacks. What would happen to the price of a Bitcoin if the prices of Video Cards suddenly plummeted, or (easier to imagine) their capacity quickly increase 20-fold.

Price comes from ratio of supply and demand. Bitcoin supply rate doesn't change, about 300 bitcoin per hour. So the price changes only when demand changes, and the difficulty to mine bitcoins adjusts to the new price, in another words price change would affect network difficulty, but not the other way around. Therefore video card price would affect difficulty, but it wouldn't change bitcoin market price.


What's the difference between synced_blocks and synced_headers? My P2P is a bit rusty, but as far as I understand; if we're running a full node, other nodes will connect to us to share blocks. So I can see why it would be useful to be able to see how far behind other nodes's blockchains are with the getpeerinfo command.

However, what's the practical difference between synced_headers and synced_blocks?

For example, what does it mean if a peer has synced_headers equal to the height of our own blockchain, but a synced_blocks of -1?

Bitcoin clients can have headers without having blocks. (However, Bitcoin Core never has a block without a header.)

A synced_blocks of -1 means that the best block for the other node is unknown.

synced_blocks is set here:

https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L557

stats.nCommonHeight = state->pindexLastCommonBlock ? state->pindexLastCommonBlock->nHeight : -1;

A synced_headers of -1 means that the best header for the other node is unknown.

synced_headers is set here:

https://github.com/bitcoin/bitcoin/blob/b3e42b6d02e8d19658a9135e427ebceab5367779/src/main.cpp#L556

stats.nSyncHeight = state->pindexBestKnownBlock ? state->pindexBestKnownBlock->nHeight : -1;


Getting GBP back from Bitcoin? I have a handful of BTC that thanks to the recent interest are now worth me trying to get back into GBP that I can spend.  I've done a little research, but the only methods of converting my BTC into GBP that I can spend seem to involve hefty fees.  What's the cheapest way of converting 4-5 BTC into GBP?

If you are in London, you could go to the local meetup group and sell them directly http://www.meetup.com/London-bitcoin-meetup/ and there is also https://localbitcoins.com/ Both ways people can pay you in cash, with no fees.


How do signatures work? Just curious, if I send a transaction from one address to another, how do they verify it without knowing my private key?

Bitcoin uses the Elliptic Curve Digital Signature Algorithm (ECDSA).  Your private key is used to create the signature and your public key is used to verify the signature.  This allows anybody to verify your signature as long as they have your public key.

For more detailed information: Digital Signature Algorithm and Elliptic Curve DSA


How to generate bitcoin addresses on the command line or with python? Is there an easy way to generate bitcoin addresses with a commmand-line tool? I am interested in the following requirements:

Reliable, secure and standards conform, with good entropy
Generates private and public keys for the corresponding bitcoin address
Can BIP38 Encrypt
Can produce in bulk
Runs in linux
Nice to have: python library
Nice to have: can save QR codes as images (png) for private / public keys
Nice to have: fast, and non-interactive (all parameters on command line)

Basically I am looking for a replacement for https://www.bitaddress.org/, for the command line.

Bitcoin Core's bitcoon-cli provides command-line functionality for manipulating a wallet, including creating addresses.  Running a full bitcoin-core node also means you can connect programmatically via Python to it using json-rpc to create addresses.


Will all 21 million units be completely mined one day? It is written that the supply of Bitcoin units is limited to 21 million and that this limit will approximately have been reached around the year 2030.

But is there an actual "last Bitcoin" (or "last Satoshi" for that matter) that will have been mined one day? Or will mining continue forever after producing smaller and smaller fractions?

Theoretically yes, but that moment is so far in the future it is likely that some other events such as new currency technology will surpass bitcoins.

However, mining will not stop.  Mining is the security backbone of bitcoin, and it will continue because it will still be profitable to mine.  Miners will be paid fees from existing bitcoins with every transaction instead of a reward of newly created bitcoins.


Is there any format change in block #498557 I wrote some python code to parse the block data, all the result are fine, until block01095.dat, block #498557.

The code to deal with Transaction is:

class Tx:
  def __init__(self, blockchain):
    start_pos = blockchain.tell()
    self.version = uint4(blockchain)
    check_pos = blockchain.tell()
    # For segwit
    # https://en.bitcoin.it/wiki/Transaction
    dummy1 = uint1(blockchain)
    dummy2 = uint1(blockchain)
    if dummy1 != 0 or dummy2 != 1:
      blockchain.seek(check_pos)
    self.inCount = varint(blockchain)
    self.inputs = []
    self.seq = 1
    for i in range(0, self.inCount):
      self.inputs.append(TxInput(blockchain, i))
    self.outCount = varint(blockchain)
    self.outputs = []
    if self.outCount > 0:
      for i in range(0, self.outCount):
        self.outputs.append(TxOutput(blockchain, i))
    # For segwit
    if dummy1 == 0 and dummy2 == 1:
      for i in range(0, self.inCount):
        num_op = uint1(blockchain)
        for n in range(0, num_op):
          op_code=uint1(blockchain)
          _ = hashStr(blockchain.read(op_code))
    self.lockTime = uint4(blockchain)
    cur_pos = blockchain.tell()
    blockchain.seek(start_pos)
    self.raw_bytes = blockchain.read(cur_pos - start_pos)
    self.tx_hash = hash_tx(self.raw_bytes)
    print(self.tx_hash)

Full code is in:
https://github.com/keviny/bitcoin-block-parser/blob/master/block.py

The last transaction in #498556 is https://www.blockchain.com/btc/tx/0baa42c9852b4edd9437e8c3fd38bd0dd89d977fe80ac7648961cf8ff33a2dbf
which is ok to parse.

But in #498557 I can never create the right tx hash anymore.
The first tx hash I get from block #498557 is
https://www.blockchain.com/btc/tx/2da60422e1de3e8e64742bb16db5d1e3b2a9813f754cff416e549d570b2ad0e8
which is not a valid tx hash in blockchain.info.

Actually, the first three hash I got are:
2da60422e1de3e8e64742bb16db5d1e3b2a9813f754cff416e549d570b2ad0e8
e0a7e07ccb9b126bd20b5b134d41ec5f8b70bdb5408a263619ca3b8b3a90512d
6c695c567d14bce39a8e58359a2a5d26dc2bcbd9a83f043b5dbc1800c56f84c8
None of above can be used in blockchain.info.

I suspect there is some format change from this block.

Does Anyone here know any background about this issue?

From what I can tell, by testing your script, is that it is failing on Segwit transactions. This would make sense, if you haven't accounted for it, because it changes what is used to produce the tx hash. This was introduced with BIP141. Currently, not all transactions are required to be in this format, so you will have to account for both. The txid still uses the entire transaction structure, this is why you might notice bitcoin-core rpc calls will return a different txid than the tx hash (wtxid) for segwit transactions.

  Definition of txid remains unchanged: the double SHA256 of the
  traditional serialization format:

  [nVersion][txins][txouts][nLockTime]

  A new wtxid is defined: the double SHA256 of the new serialization
  with witness data:

  [nVersion][marker][flag][txins][txouts][witness][nLockTime]

see BIP141

What you'll need to do is look for the segwit flag 0x01 in the serialized transaction. It's an optional 2-byte array right after the first version bytes, see https://en.bitcoin.it/wiki/Transaction


Is Bitcoin Days Destroyed a measure of hoarding? Is Bitcoin Days Destroyed a measure of hoarding? Also, is it possible to derive  velocity of money (i.e. bitcoin) from Bitcoin Days Destroyed?

Are Bitcoin Days Destroyed a measure of hoarding?

Sometimes. But just because bitcoins changed addresses doesn't mean they changed hands.

Is it also possible to derive velocity of bitcoin (money) from bitcoin days destroyed?

Not directly. Although velocity of money and BDD are related, they are not entirely the same. velocity of money is based on a legal definition, whereas BDD is based on a technical definition. Also, BDD weighs the movement of old, rarely used coins as more important than frequently traded ones.
Two differences:
First
BDD is based on transactions in the bitcoin network, whereas velocity of money is based on money changing ownership. A transaction doesn't mean that money changed hands. Examples:

Change. I send you 10 BTC, 5 BTC comes back to my address as change. The bitcoin network sees 15 BTC move, but only 10 BTC really changed ownership.
Laundering. The best example. Lots of bitcoins move around, but at the end, you still have the same amount.
I move my bitcoins from Mt Gox to blockchain.info. Again, there was a transaction, but no money changed hands.

Because of this, a velocity of money estimate based on total transaction volume will be wildly inaccurate.
Also, even if no bitcoin transaction has happened, money can still change hands. Lots of e-wallets support the ability to instantly transfer money between accounts.
Second
Because total transaction volume is such a bad measure of how quickly bitcoins change ownership, BDD was created. It's different from velocity of money in that you can't game it by sending money back and forth because it is much more significant to spend 100 BTC that last moved a week ago than it is to spend 1 BTC a thousand times.


How bitcoin gets monetary value This looks like a complex thing but I am trying hard to understand it. Why would any one in the world honor a crypto currency till it is backed by a government with monetary value? How does a crypto currency get its monetary value? Who will back it?

Currencies get value from demand and supply not from governments backing them. Currencies have existed long before government's started stamping them out in their own name. The demand for a currency comes from the utility that it offers as a medium of exchange. Even pre-historic humans went out of their way to create currencies because they were useful.

Bitcoin has value because it is useful as a global, irreversible electronic medium of exchange and store of value. That is why it is in demand.


How do I get my Bit coin balance to restore on my new phone? My phone broke and is unusable and I am new to the whole bit coin service. I switched phones and downloaded the bit coin wallet how do I get my balance back?

If you didn't make a backup, sorry you are out of luck you cannot get your Bitcoin back. It could be possible get to some information out of your old phone (like sd card or some other way of restoring info, but this completely depends on which kind of phone you had or how broken it is)

If you made a backup you have to restore it. This process depends on the used wallet app. I would recommend downloading the same wallet app as you used on your old phone, they are most of the time not compatible. Some apps tell you to write down a set of words when you create a wallet. You could use these words to restore your wallet. Some wallets need a file which you have to have in order to restore the backup.


I just sent bitcoin to my bitcoin cash wallet I just sent bitcoin to my bitcoin cash wallet.  I’m using blockchain and Coinbase and all the reading I’ve been doing it doesn’t appear there is anything I can do about this. I’ve tried getting ahold of Coinbase to see if they can help and I’m just put on hold forever. Can someone please help   Thanks

There may not be a problem... I just asked my son for his bitcoin wallet key (btc) and also for his bitcoin cash wallet key (bch) and also for a few other of his wallet keys (ETH, LTC etc) so that I could send him a small amount of each for his Christmas present... I then noticed that his key for btc was exactly the same as his bch key so I asked him to check, he checked and assured me that they did in fact both have exactly the same key so it seems that one wallet can hold both btc and bch coins... I hope this helps... Best Wishes.


How can I search for transaction text on the blockchain? Is there a google like search engine which can search for any text that is included with a bitcoin transaction? As I understand it each transaction includes 80 characters of text as well.

Update

It is not possible to search the blockchain for text in an easy way

There is funny site http://bitcoinstrings.com/ I am not sure that it is what are you looking for but just in case...


Lost Bitcoin-qt password I have a friend (yes it's actually a friend and not me) who lost his password for their Bitcoin-qt wallet and can't access is Bitcoin.  The wallet is installed on the hard drive of a MacBook and he doesn't know any of the characters   Does anyone know how we can get this coin back without his wallet password?

"Creative solution" would be to forget about his wallet and to join Large Bitcoin Collider project, he might "recover" another lost wallet one day.

Also, if he had 1000 BTC or more in his wallet, some hypnosis-guru might help him to remember his password.


Taking control of the dynamic bitcoind tx fee I'm running bitcoind for a service that works with quite small user withdraws most of the time.
Recently I noticed that instead of the standard 0.0001 tx fee from the recent past, it already charges up to 0.0008 for some transactions which I find expensive for this specific use case. (I read about that update to dynamic fees but then forgot about it)

getinfo gives "paytxfee" : 0.00000000" by the way.
I haven't explicitly set the fee in bitcoin.conf

So, if one doesn't want to take advantage of the dynamic fee but set a fixed one
- How is best to do it? Just "bitcoin-cli settxfee 0.0001" or in the .conf file? Would it actually be enforced or it will still disregard it in some cases?
- if it actually works to set it as fixed, how do you think that would affect the confirmation time? Will 0.0001 be fairly enough for the time being to get in the very next block?

First: remind settxfee is not a absolute fee per transaction. It's a fee per kilobyte.

Example:

Alice sends 1BTC to Bob
Alice has 11 times 0.1 BTC in her wallet (she received 11 times 0.1 BTC from different persons)
Alice transaction will require all 11 x 0.1BTC inputs to create the 1BTC-to-Bob-transaction
Therefore the transaction is bigger (in terms of bytesize) then if she would hold 1 x 1.1BTC in her wallet.

Bitcoin-Core will only accept transaction to it's mempool which contains the minimum fee.


bitcoincore banned all peers and I can't to sync I started downloading the chain and got to 14% and it just stopped and still shows 7% per hour but not moves.

I checked and it banned all the peers and everytime I unban them they just get banned again, what is happening ?

Peers can get blocked for multiple reasons

sending too many invalid blocks
sending too many malformed messages
using too much bandwidth (e.g. your maxuploadtarget setting)

and probably others.

There are logs which may be helpful and you can review available options

-banscore=<n>
Threshold for disconnecting misbehaving peers (default: 100)

-bantime=<n>
Number of seconds to keep misbehaving peers from reconnecting
(default:86400)

-whitelist=<IP address or network>
Whitelist peers connecting from the given IP address (e.g.
1.2.3.4) or CIDR notated network (e.g. 1.2.3.0/24). Can be
specified multiple times. Whitelisted peers cannot be DoS
banned and their transactions are always relayed, even if
they are already in the mempool, useful e.g. for a gateway


Where do transaction fees go in block #163368 The reward of the Coinbase TX  is only 50 BTC not including transaction fees. So who owned  these fees?

As you mentioned this Block and also some other ones in the blockchain as well failed to claim the fees. Some miners missed all fees other only  a few, this can happen for a variety of reasons, almost all of them are bugs in the mining software.

  So who owned these fees?

These coins are lost, the miner failed to claim them and so they are gone.