CVarint serialization format Recently I started analyzing the UTXO set data that every full node stores in chainstate folder (a LevelDB database).

By looking into the code you can learn more or less how the data entries are formatted. However, to save as much space as possible, some of the data is compressed and encoded as a varint.

How data is compressed can be found and also analyzed in the code. However, I'm struggling with understanding how the varint encoding/decoding is performed. According to the developers guide, the class responsible to do so is CVarint, and I've been able to trace down the method that I think is doing so. However, since I don't know the format the data is encoded I'm not able to understand what it is doing.

Does someone have a clue about how the stored data is formatted?

Clarification: I'm referring to the CVarint format that is used in UTXOs along the Bitcoin Core, not to the varint format that is used to encode information in txs scripts.

The CVarInt format is implemented in serialize.h

As the comment is extensive, I'll just quote it here:

  Variable-length integers: bytes are a MSB base-128 encoding of the number. The high bit in each byte signifies whether another digit follows. To make  sure the encoding is one-to-one, one is subtracted from all but the last digit. Thus, the byte sequence a[] with length len, where all but the last byte has bit 128 set, encodes the number:

  (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1))

  Properties:

  Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes)
  Every integer has exactly one encoding
  Encoding does not depend on size of original integer type
  No redundancy: every (infinite) byte sequence corresponds to a list of encoded integers.

  Examples:

  0: [0x00]
  1: [0x01]
  127: [0x7F]
  128: [0x80 0x00]
  255: [0x80 0x7F]
  256: [0x81 0x00]
  16383: [0xFE 0x7F]
  16384: [0xFF 0x00]
  16511: [0xFF 0x7F]
  65535: [0x82 0xFE 0x7F]
  2^32: [0x8E 0xFE 0xFE 0xFF 0x00]

To store CAmount values (integers representing numbers of satoshis), a transformation is applied beforehand that turns more common numbers (multiples of powers of 10) into smaller numbers first:

If the amount is 0, output 0.
Otherwise, divide the amount (in base units) by the largest power of 10 possible; call the exponent e (e is max 9)
If e<9, the last digit of the resulting number cannot be 0; store it as d, and drop it (divide by 10), calling the result n. Then, output 1 + 10*(9*n + d - 1) + e
If e==9, we only know the resulting number is not zero, so output 1 + 10*(n - 1) + 9


Abandoned transaction with low fee and now can't get any transactions to confirm thanks for taking the time to help.

I tried to move btc from my Bitcoin Core wallet to my Electrum wallet and thinking that I was in no hurry tried sending it with the minimum transaction fee. After several days with no confirmations, I found out that was a stupid idea as the transaction is sitting in purgatory while all others with higher fees are moving ahead of mine. Lesson learned.

I tried using abandontransaction to clear it and didn't have any success. Then I tried loading Bitcoin Core using zapwallettxes command and got it to clear and the coins were back in my wallet. I attempted to transfer to my Electrum wallet about 1 hour later only to find the transaction back in the history but still 0 confirmations.
I tried using zapwallettxes and reloading with the same results but created a transfer to my Electrum wallet as soon as it was finished loading, this time making the transaction fee the fastest available. It has now been over 24 hours and still I have 0 confirmations on the new transaction.
What am I missing here? I'm far from an expert at this, but do have some basic knowledge and can follow any directions given. Any help is much appreciated.

I'm not an expert, but have you tried setting the transaction to "abandoned" ?
Also disabling the wallet broadcasting in the meanwhile?

You can check this two links on how to recover a wrong transaction and how to do a proper full rbf

https://en.bitcoin.it/wiki/Fee_bumping#I_sent_the_stuck_transaction

https://bitcointalk.org/index.php?topic=1802212.0

( i am aware that by this time either the transaction is forgotten or confirmed  but there would be more people that needs this answer (in fact that's how i got here))


What do the indicator lights mean on USB Block Erupter ASICs? The lights on USB Block Erupters stay solid when not mining. During mining, there will be frequent tiny flashes, and occasionally longer flashes, lasting a few seconds. What exactly are do the short and long flashes indicate?

A steady light means no connection to the server delivering work, a short blip means the device has found a difficulty one share for submission. At the current time submitting a single difficulty one share is worth about about 0.000000035 BTC.


Why do you need to send a transaction out with NXT to secure your address? When setting up an NXT account, it is recommended to send a transaction out in order to secure your account. I don't quite understand why it's needed. I know that if you don't send one out, your account is only 64-bit encrypted and when you send it out, it becomes 256-bit encrypted. I don't see how that makes a difference as you can still brute-force it regardless given an amount of time.

Why is it necessary to encrypt it when sending an outgoing transaction compared to just receiving one?

NXT addresses are only 64 bits long. So to find a passphrase that matches it should only take on average 2^63 times.

But once you send a transaction from the address, the address gets permanently locked to the public key you used to make the transaction. The public key is 256 bits. So now even if someone cracks the address, they can't do anything at all until they crack the public key.


Bitcoin transfer through QR codes Ok, so let's say I have a wallet with 1 BTC in it. Is it possible to transfer that balance to a QR code or some type of barcode?

I want to know if it's possible to basically print out a piece of paper with a barcode or QR on it and physically hand it to someone else so they can scan the code and receive the coin the same way a giftcard works.

Furthermore, is there a way to encode a giftcard with a specific amount of bitcoin so someone could then scan it and the BTC would be transferred to their wallet?

That's a paper wallet. Search for that. bitaddress.org or paperwallet.com are examples.

The way you intend to use it basically comes down to printing the private key part of a bitcoin wallet and giving that to someone else. Another use would be putting it in a safe so you can't get hacked.


Please help. BTC has left Armory wallet and shows as gray, but says "Not in the blockchain yet" I sent 1.5BTC in the usual way from my Armory wallet, but the transaction shows in gray as if it is still pending. When I click more details it says "Not in the blockchain yet".  If I search for the transaction on blockchain.info, there is no transaction recorded against the wallet ID I was sending to. I've also tried to send another small transaction a few times for 0.01 and 0.1 BTC to see if that works, but now I just keep getting an error.

  The transaction that you just executed, does not appear to have been accepted by the Bitcoin network yet. This can happen for a variety of reasons.

  On some occasions the transaction actually will succeed and this message is displayed prematurely. To confirm whether the the transaction actually succeeded, you can try this direct link to blockchain.info:

  https://blockchain.info/tx/e7c8737734ddba96337f...

  If you do not see the transaction on that webpage within one minute, it failed and you should attempt to re-send it. If it does show up, then you do not need to do anything else -- it will show up in Armory as soon as it receives one confirmation.

  If the transaction did fail, it is likely because the fee is too low. Try again with a higher fee. If the problem persists, go to "Help" and select "Submit Bug Report". Or use "File" -> "Export Log File" and then attach it to a support ticket at https://bitcoinarmory.com/support

However, the link to the armory support page is no longer active.

IN SUMMARY:
• The total amount in my wallet was reduced by 1.5001 BTC
• In the Armory transaction list, the 1.5001 BTC shows in gray as if it is still pending.
• I am unable to send any more bitcoins.

What do I need to do to retrieve the 1.5001 BTC to my wallet? Any help much appreciated.

The original questioner had a comment pointing to the solution, which I will reproduce here for completeness. TL;DR: A bug. Upgrade the software.

Details from https://bitcointalk.org/index.php?topic=1846233.0

  Update: 0.96.0 has been released. Update to that if you are still
  experiencing this problem.

  Many of you may have noticed that with the Armory 0.95.1 and Bitcoin
  Core 0.14.0, Armory tends to fail to broadcast transactions and give
  the "Transaction timed out" and "Transaction broadcast failed" error
  messages.

  The underlying issue that is causing this problem has been fixed for
  Armory 0.96, which will be released soon. However, in the meantime,
  downgrading to Bitcoin Core 0.13.2 will fix the issue. Once 0.96 is
  released, you will be able to use Bitcoin Core 0.14.0 again.

  To downgrade to Bitcoin Core 0.13.2, just download the Bitcoin Core
  0.13.2 binaries from https://bitcoin.org/bin/bitcoin-core-0.13.2/ and install them as you would normally install a new version of Bitcoin
  Core. There is no need to redownload the blockchain nor reindex
  Bitcoin Core's databases nor rebuild Armory's databases.

  Now for the technical details about the problem, for those of you who
  care.

  I first noticed this issue back in December, but only very recently
  have I nailed down why this problem cropped up in the first place.

  Bitcoin Core 0.14.0 merged a change back in December which changed how
  Bitcoin P2P messages were being broadcast. Previously, the p2p message
  header and the message payload were sent all at the same time using
  the same kernel call. However, during their net refactor and cleanup,
  this mechanism was changed to send the message header in one call, and
  then the payload in a separate call. This is more robust and allows
  for better code separation, but it also causes problems for Armory.

  The implementation in Armory 0.95.1 for receiving the p2p messages is
  not able to handle that the two parts of a p2p message are essentially
  sent separately. It interprets the message header as one p2p message,
  and the message payload as another p2p message. This means that it is
  incorrectly parsing the messages. The crux of the issue is that every
  so often Armory will receive a ping message from Bitcoin Core. However
  the payload of the ping message is only 8 bytes, but the message
  header must be 24 bytes. When Armory interprets the ping payload as a
  separate message, it will throw an exception because it thinks the
  message is too short. This exception causes the data processing thread
  to exit and disconnect from Bitcoin Core. Once it disconnects, it will
  typically reconnect, but the reconnect does not always mean that it
  will actually be receiving new blocks and transactions and actually
  remaining up-to-date with the blockchain. Thus, because of this
  disconnect, when you go to send some Bitcoin, it will fail to either
  connect to Bitcoin Core or the reconnected connection is messed up and
  the transaction broadcast times out or just fails entirely.


How is data in a blockchain stored? Structure of block and blockchain I'm trying to build a blockchain-based application and I have a problem with understanding some crucial issues.
What exactly is a block? I mean, I've seen application where blocks were just String structures and a blockchain was an ArrayList of these String structures. But my question is, does it work like that in real blockchains? Are blockchains just ArrayLists or maybe they are stored in some files that are distributed among a P2P network?

How is data in a blockchain stored

So far as I know, the Bitcoin specifications do not mandate any particular structures for storing the Bitcoin transaction-journal (blockchain) in persistent storage (e.g. Hard disk).
Any Bitcoin node is free to store the transaction-journal in whatever form is convenient. For example it might be decomposed as a set of tables in third-normal form in a relational database in "uncooked" storage outside any filesystem. The node might include in the stored data a complex set of indices for fast retrieval of certain types of data (e.g. Bitcoin-addresses).
Bitcoin Core stores the transaction-journal in groups of consecutive blocks in a series of large files whose format I believe closely matches the form used in the Bitcoin network protocols. But there is no prohibition on other software products doing something quite different.

Are blockchains just ArrayLists

That is just one way of representing the data. Note that the ArrayList is a feature of specific programming languages. It may not exist in some languages and quite different data structures may be more appropriate in that case.
The data itself needs to keep track of blocks and those blocks contain data that references data within other blocks. Hence the name. But there are many different ways of implementing these ideas which could all work in a Bitcoin node.

maybe they are stored in some files that are distributed among a P2P network?

Normally, in my field of work, the term "distributed" implies that not all nodes hold all the data. It implies that there is some planned and coordinated division of data among nodes so that specific nodes are designated to be responsible for specific subsets. This isn't really a fundamental design feature of Bitcoin.
I believe that initially Bitcoin used a model that I would more strongly associate with the word "replicated" than "distributed". Initially all nodes each had a full and complete copy of the entire data-set. There was no system to coordinate the intentional distribution of subsets of data among cooperating storage nodes.
Currently nodes, even full nodes, can discard blocks that are no longer of interest to them. This means that many nodes do not contain a complete set of data. Importantly however, any distribution of the data between nodes is essentially unplanned and uncoordinated.
You could argue that there is distribution of data between SPV clients and the servers they rely on for transaction-journal data. However I'm moderately sure this isn't really the sort of distribution of data that database engineers generally mean when they use the term "distributed".

See also descriptions of Bitcoin Core's storage format in these answers:

What is the database for?
What are the keys used in the blockchain levelDB


Deriving hex private key from a HD wallet I have the following test Mnemonic:

stable primary already collect buffalo bike into robust fury cement proof agree neither blouse course

From this I can generate a BIP39 Wallet:
https://iancoleman.io/bip39/

From this I can get all the private keys of the derived addresses (if you scroll down to the bottom).

But I'm not sure what format they're in.

The library, bitconjs-lib does the following:

const ONE = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
keyPair = ECPair.fromPrivateKey(ONE)

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/ecpair.js#L29

But the private keys generated by https://iancoleman.io/bip39/ do not match the length required by bitcoinjs-lib

The mnemonic represents a BIP32 extended private key: xprv9s21ZrQH143K4BbpSvRBDykoXLhwtznbp7qAfKVLw1QdJtJsmgS5rZJfSgZNtgk7e39uRNiYHbcRQnYvruqfftfG6WFmuiCspehEz1VS3YM

The function you are calling accepts a regular private key.

You can derive child private keys from the extended private key and use these to generate addresses.

It it be possible to derive the corresponding private key of either the children of this extended private key or the corresponding private key itself using the toWIF method in the bip32 JS library. See https://github.com/bitcoinjs/bip32/blob/master/index.js

You can see some examples of the use of BIP32 here:
https://github.com/bitcoinjs/bitcoinjs-lib/blob/a6f2cc2924df170537f0b588254178f5445d7dc8/test/integration/bip32.js


Energy cost of bitcoin vs physical currency? The bitcoin mining infrastructure uses a certain amount of energy and processing power to operate.
The resource usage is often cited as part of arguments critical of bitcoin.
But relatively speaking how much more resources does bitcoin mining take compared to physical currency?
No body really talks about all the resources that it takes to use physical currency.

The money first has to be produced in a mint.  That mint and the machines in it had to be built.  These are all of course specialty machines and are probably very expensive.  The building and machines require energy to operate.  They all need to be maintained.  And people need to be employed to do all those things.

Money is typically stored in banks.  There are thousands of bank locations in the world.  They all needed to be constructed.  And those buildings all require resources and people to operate.

Physical currency must actually be moved.  Moving any significant amount of physical currency requires security.  A large store typically has to hire an armored car to transport money from their safe to the bank.  An entire niche industry needs to exist to produce those vehicles.  Security workers need to be employed to operate them and protect the money.

Money must be stored.  Millions of safes/vaults were built so individuals, businesses, and banks can store their money.  In general there is a lot of resources spent on securing physical currency.

The most extensive research on this topic is:"An Order-of-Magnitude Estimate of the Relative Sustainability of the Bitcoin Network" by Hass McCook
among others, it cover specific topic as the economic and environmental cost of cash printing & coin minting, banking system, gold mining & recycling etc ...
The results of the research are summarized in the tables below.

take in mind that these data are from 2014, so Bitcoin cost of production and consumption are actually much higher.

These are the estimation about miners efficiency at the time, when the network hashrate was 130 Phash/s and the most efficient miner was Antminer S3 with 0.766 w/Ghash:

I redid the calculations using current hashrate of 186 Ehash/s, an efficiency of miners ranging from 0.1 w/Gh of Antminer S9 to S19 0.03 w/Gh and keeping all other assumptions the same, these are the results:

About 70/80 times more consumption than was in 2014 (depending on which energy efficiency you pick as network average). Certainly the costs of the other activities (banking, mining, minting) have also increased, but not in this size.
Although the research in question is detailed, the author was honest in saying that the data is not an accurate representation of reality, but an estimate of its order of magnitude.


Strange BTC rate behavior when buying bitcoins I have decided to buy some bitcoins using the Bitcoin.com wallet app and I have just received the invoice for my transaction of 1000 EUR to BTC.

The rate of the BTC for the last days is always around 5850 EUR. But in my receipe I see that they have used a rate of 6032 EUR.

I do not understand that gap... Would it be a magic trick in order to get more money on customers ?

Thank you for your help.

I can't say for sure, but two options come to mind:  a)  the "price" of financial assets are the current bid/ask and general average of closed transactions.   You might have been on the high end of the average. You should verify the deal details before purchase/sale.  b) some exchanges charge a premium to the parties, again, know the details before you commit


bitcoind is refusing to connect to my other server bitcoind is refusing to connect to my other server

By default bitcoind only binds RPC to the loopback interface, so you can only connect to it from localhost.  This is for security.

You can allow connections from a specific other machine with -rpcallowip, or in general with -rpcbind, but beware that this substantially increases the attack surface.  Moreover, the data sent and received is not encrypted, see Why is JSON-RPC over SSL "strongly discouraged"?.

It's recommended instead to use VPN software to set up a tunnel between the two machines.  In such a setup, bitcoind will see the RPC connection as coming from localhost.


Who approves my public key in Bitcoin network? In a PKI approach a public key is approved by a Certificate Authority (CA) with a centralized manner. However, since Bitcoin network is a decentralized network, how my public key validity is approved? Or in general is there an approving process of public keys? And if not, it does not cause any security issues? And how a public/private key is generated in the Bitcoin network? And is there a way to prevent a user to generate too many public key in the Bitcoin network?

Thanks

Public keys do not need approval.

In the regular PKI setup, such as for SSL, trust is granted by Certificate Authorities. The implicit understanding is that if you have been endorsed by a known CA, they have verified you within certain parameters to be worthy of that endorsement. Similarly, in PGP's web of trust, the endorsements come from people, who have in turn been endorsed by other people.

In Bitcoin, such kinds of endorsements are not required. Bitcoin only uses public keys to lock coins, and to verify that they are being spent by the entity or person they were locked to. Thus, as long as you are able to prove you hold the private key corresponding to the public key, you can participate in the network.

There is little harm to a user generating multiple keys, so there are no controls to prevent it. It is simply not required.

Keys are generated over the secp256k1 curve using elliptic curve operations.


Anyone else having this 'disappearing' BitcoinCash issue with BitcoinABC wallet? Today I was in claim BitcoinCash mode, which I completed successfully with my Ledger Nano S and also with my Trezor. Then it was time to for the Bitcoins I held only in my Electrum wallet. I retrieved the private keys and set out to import one into a new BitcoinCash wallet. All bitcoins were first moved off Electrum to a different wallet on a different computer. I then installed the BitcoinABC.org wallet. When that was done I encrypted it immediately. I then used importprivkey to import a private Bitcoin key that had previously held .1 bitcoin.

The blockchain scan started. I let it run and went to lunch. When I got back, the .1 bitcoin cash had been received, but there was also a send transaction 39 minutes later to a BCC address (36uzTBVeWN2pvUu3YX22gCutovGwQg1eeS) I don't know. I didn't make the send transaction and there are no other people that could have and no computer issues, malware or otherwise on my end. Also, I had a list of other private keys open on the same computer and only issue is with the one key I imported to BitcoinABC wallet.

How was BCC sent from my encrypted wallet, where only I (and BitcoinABC wallet after importing) have the private key, if there isn't a vulnerability in the BitcoinABC wallet?

Has anyone else had this issue with BitcoinABC wallet?

Is there a BitcoinABC wallet rep on this site that can address this issue?

That send is from before the fork on 3/31/2017. That means that you sent Bitcoin on 3/31/2017 to 36uzTBVeWN2pvUu3YX22gCutovGwQg1eeS, and because Bitcoin Cash shares the same history as Bitcoin, you will see this send in your wallet.


ScriptSig does not validate with seemingly valid signature I am trying to build raw transactions from scratch to improve my understanding. For comparison I am using the hexoutput from https://coinb.in/ as I can choose Testnet on there.

I am trying to construct a P2PKH transaction without Segwit (for now) which should use this tx 577735da1fccf6df79eac9ff42049a7729703ec5506efeb1602bca99df3bafd2 (index 0) and send 6889990 satoshi to mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB, the raw public key of the input address is 034323ee9ac23504779b40c1b02578d27f70c12c22b7fc4f452dbbde681e45073d

So for the unsigned transaction my library produces 0100000001d2af3bdf99ca2b60b1fe6e50c53e7029779a0442ffc9ea79dff6cc1fda357757000000002221034323ee9ac23504779b40c1b02578d27f70c12c22b7fc4f452dbbde681e45073dffffffff0106226900000000001976a9149f9a7abd600c0caa03983a77c8c3df8e062cb2fa88ac00000000 which matches what is produced by coinb.

So to generate the signature for the sigscript I use the following code:

def sign_transaction(self, secrets):
    """
    Sign all inputs of the transaction with
    a secret key.
    :param ECPrivKey[] secrets: a list of private keys corresponding to the inputs
    :return: Transaction Signed version of the transaction ready to be published
    """
    unsigned = bytes.fromhex(self.serialize_to_hex())
    message = sha256(sha256(unsigned))
    copy = deepcopy(self)
    inputs = self.__inputs
    for i in range(0, len(secrets)):
        sk = secrets[i]
        inp = inputs[i]
        sig = SignatureFactory.gen_ecdsa_signature_bytes(message, sk)
        copy.set_signature(sig)
        sigscript = sig.get_asn1_encoded() + OP_SIGHASH_ALL
        l = len(bytes.fromhex(sigscript))
        script = compact_size_int(l) + sigscript + inp.get_sig_script()
        copy.__inputs[i].set_sig_script(script)
    return copy

Informally I use the hexoutput from the unsigned transaction, convert it to bytes, run two sha256 hash functions on it and append the SIGHASH ('01') byte

I validated the produced signature and it is valid so I feel like there is something wrong with the serialization. Here is my transaction after signing it:

0100000001d2af3bdf99ca2b60b1fe6e50c53e7029779a0442ffc9ea79dff6cc1fda357757000000006a47304402207da5c1e2d7db828e415db1ae060d65e4a44de2b13b71c50be61d6c52da82425b022010da9abb70c7b6047b559c5c572f68e078d6ae78ba03dfd6aa1890e512e376760121034323ee9ac23504779b40c1b02578d27f70c12c22b7fc4f452dbbde681e45073dffffffff0106226900000000001976a9149f9a7abd600c0caa03983a77c8c3df8e062cb2fa88ac00000000

{"version": "01000000", "flag": "", "inputLen": "01", "inputs": [{"prevOutHash": "d2af3bdf99ca2b60b1fe6e50c53e7029779a0442ffc9ea79dff6cc1fda357757", "prevOutIx": "00000000", "sigScriptLen": "6a", "sigScript": "47304402207da5c1e2d7db828e415db1ae060d65e4a44de2b13b71c50be61d6c52da82425b022010da9abb70c7b6047b559c5c572f68e078d6ae78ba03dfd6aa1890e512e376760121034323ee9ac23504779b40c1b02578d27f70c12c22b7fc4f452dbbde681e45073d", "sequence": "ffffffff"}], "outputLen": "01", "outputs": [{"value": "0622690000000000", "pubKeyScriptLength": "19", "pubKeyScript": "76a9149f9a7abd600c0caa03983a77c8c3df8e062cb2fa88ac"}], "locktime": "00000000"}

In more detail the value of sigscript:

47 Script length
30 DER signature marker
44 Signature length
02 r value marker
20 r value length
7da5c1e2d7db828e415db1ae060d65e4a44de2b13b71c50be61d6c52da82425b r value
02 s value marker
2010da9abb70c7b6047b559c5c572f68e078d6ae78ba03dfd6aa1890e512e37676 s value
01 Opcode SIGHASH
21 pubkey length
034323ee9ac23504779b40c1b02578d27f70c12c22b7fc4f452dbbde681e45073d pubkey value

If I try to broadcast the transaction on https://live.blockcypher.com/btc-testnet/pushtx/ I get Error validating transaction: Error running script for input 0 referencing 577735da1fccf6df79eac9ff42049a7729703ec5506efeb1602bca99df3bafd2 at 0: Script was NOT verified successfully..

Does anybody have an idea what could be wrong? Also the r and s value of the signature I did not encode in little endian and I am not sure if maybe this could be the problem?

Signing transaction is a bit more complicated than just signing the hash of unsigned transaction

Look at the explanations here:

Redeeming a raw transaction step by step example required
How to redeem a basic Tx?


Can a wallet deny payments to it? Once my public wallet address is known, is there anyway to deny payments to that wallet?

For example, if I want an external authority to regulate who can pay into a wallet, is that possible?

I guess a related question is can I turn a wallet 'off' once it is in the block chain and known.

No, you can't prevent people from paying any particular address even if you control that address.  This is a known problem: it would be very nice to have an address that can only be paid once.

Something like P2SH^2 could help with this, although it would not provide a perfect one-time-only property.


Will Bitcoin suffer from a mining Tragedy of the Commons when mining fees drop to zero? One issue that I haven't seen clearly addressed is the possible Tragedy of the Commons in Bitcoin's future (see this answer). 40 years into the future, the only significant direct benefit for honest miners is transaction fees, as the block reward is almost zero.

The potential problem here is Tragedy of the Commons - it is possible that while the entire network will benefit from miners, the financial incentive for any individual honest miner to mine will be too small, so fewer miners "than necessary" will mine, leaving the network open to 51% attacks. In this scenario, the Bitcoin network will fall pray to frequent attacks and will effectively disintegrate. Also consider extensions like Open Transactions, that might make conducting transactions on the real Bitcoin network unnecessary for most users, who will flock to 2nd level networks and reduce the miner's rewards from TX fees even more.

As Bitcoin is being designed and promoted as a Future Proof system, people have tried to analyse the system's economic behavior in this future.

What analysis has been done on this problem? Is the problem likely to happen (speculative question, I know ... but back up your arguments)? If there is a likely problem in the current implementation, what are some possible way to adjust the protocol in the future to combat this problem?

Update - please see here, I described a possible scenario that leads to network insecurity because of this issue.

Update 2 - linking to a recent thread I created on the forum about this.

Update 3 - Added a wiki entry.

There will definitely be a tragedy of the commons problem if things stand as they are now. This was discussed at some length here and elsewhere.

There are some proposed ways to address this and make transaction fees nonzero (block size limit, hardcoded fees, insurance entities, mining cartel, gentleman's agreements which are maintained for fear defection would beget more defection, etc.), but I don't think either results in the combination of competitive transaction fees and a level of hashrate which is enough to offer reasonable security.

This means that there must be some way to improve the network's security at a given hashrate. The only way I know to do that is by augmenting proof-of-work with proof-of-stake, discussed for example here. This is based on the observation that obtaining a majority of the bitcoins in existence is orders of magnitude more difficult than obtaining a majority of the hashrate.


How can we prevent distortion of the bitcoin exchange rate? Is there anything within the structure of bitcoin exchanges to prevent bitcoin price distortion with multiple accounts controlled by one person?

I have seen stocks with similar levels of liquidity be manipulated in price with about five accounts. Each buying and selling to and from each other, to get the price to the most favorable place so that one account with much more capital can take advantage of the price distortion, and buy or sell into the new optimism (more volume when price is high because of new market participants). You can read great detail about this in SEC emergency injunction orders, as they go after people that do this (after the fact though). Some stock promoters are the main perpetrators.

The advantage with bitcoins is that it is not regulated by the Securities Act, with the transparency about how to do this detailed by judicial remedies against those that were under the jurisdiction of the Securities Act.

Given that there are so many bitcoin exchanges, would anything such as the technical structure of bitcoin, the exchanges or bitcoin specific market forces prevent someone from doing this with a series of trading accounts, especially across the more illiquid exchanges?

There is no single price for a Bitcoin.  There are prices at various exchange markets at any point in time.

Since some exchanges have no requirement that every account has identity verified then there is no way for the exchange to know an account is controlled by another party.

Today's exchanges have no mechnism to prevent what you describe.


which cloud backup files do I need to keep I just installed Multibit HD, did a few transactions, and I already have 15 .zip.aes backup files?  Do I have to keep all of these forever, or only the most recent one?

I think you want to take a look at the Backups help page on multibit.org.

I can't say for certain (as the wording is a tiny bit vague here), but I am pretty sure that each of these are what they're referring to as "rolling backups" which "encrypt a snapshot of the current wallet".

If that's true, then each one of these contains the previous ones, so you would only need to keep the most recent one.

Either way, if MultiBit is doing it's job right (and I suspect it is), your seed phrase (what MB calls "wallet words") should be enough to recover your wallet no matter what. To quote them, "You can always recover your bitcoin through your wallet words (seed phrase)."


How to get a history of incoming and outgoing transactions for a certain address? Along with the history of incoming and outgoing transactions, how would I find the first block that that address appeared in (to find when the wallet was created)?
I want to do this by parsing with bitcoin abe or something along those lines.
I'm not the programmer, but I need to know how to tell the developer what I'm looking to create.

To get the history of incoming and outgoing transactions all you need to do is send "listreceivedbyaddress" command to the bitcoind rpc interface. For more detail see here.
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

To see where the address first appeared is more intense, you will need to run a search query on a block chain and analyze each block up until you find an appearance.


How could a lightweight wallet determine the validity of 0-conf transaction? I found that a lot of people are interested about security of 0-confirmation payments. But, it seems that most discussions focused on double-spending (like broadcasting two or more conflicting-but-valid transactions, or Finney attack), instead of the validity of the transaction. Does a merchant accepting 0-conf have to run his own full node, or trust someone else (like a public block explorer service), to validate the transaction? Does a lightweight wallet have the same security as a full node under this 0-conf scenario?

Zero-confirmation transactions can easily be double-spent by another signed transaction spending the same UTXO, but with an arbitrarily higher fee, thereby achieving a higher likelihood of being mined first, rendering the original transaction invalid.

A merchant still needs a full-node to accept new transactions to the mem-pool, because it needs to validate each new transaction it sees.

A lightweight wallet does not have the same security as a full-node, because it relies on verifying the accumulated POW, and not the actual transaction validity. The assumption is that the chain with the most accumulated POW must be valid.


Does cancelling an order in BTC-E carry a fee? I want to know when BTC-E charges it's 0.2% fee on a cancelled buy/sell order...

When placed but 0% completed
When placed but partially completed

How much are you billed in each case?

A fee is charged over the filled portion. Either the whole order or partial.
If an order was cancelled before a trade took place (0% filled), no fee is charged.
If an order was cancelled after a portion was already filled, the remaining part is cancelled and no fee is charged over the remaining.


How long would it take for me to mine a bitcoin with a TItan XP nvidia How long would it take me to mine 1 bitcoin with an nvidia titan xp graphics card?
ty for helping if u do.

In short: don't.

The hardware comparison page on the (mostly outdated) Bitcoin wiki does not have information on the Titan XP card, but lists around 200 Mhash/s for the GTX 590. A GTX 590 has 1024 CUDA cores, while the Titan XP has 3840. Extrapolating using this, we can estimate the performance at around 750 Mhash/s.

At the current difficulty, that amount of hashrate will let you mine a block on average once per 135000 years. If you use pooled mining, you can get incremental payouts for shares (partial proof of work). You may earn 1 BTC around once per 10000 years, while paying around $2000000 in electricity costs during that time (at 10c/kWh).

So don't. GPU mining has been superseded by FPGA and ASIC mining since around 2013.


How can I transfer a Bitcoin-qt wallet to Electrum? I am switching from bitcoin-qt to Electrum, and it seems as if I will need to download the blockchain again. Can I copy and paste my wallet.dat into Electrum's files?

According to this FAQ:

In Electrum 2.0, you cannot import private keys in a wallet that has a seed. You should sweep them instead.
If you want to import private keys and not sweep them you need to create a special wallet that does not have a seed. For this, create a new wallet, select “restore”, and instead of typing your seed, type a list of private keys, or a list of addresses if you want to create a watching-only wallet.

You can get the private keys from Bitcoin Core using dumpprivkey as described in Using dumpprivkey to make a paper backup.


Where is a tx located before finalized with the sequence number or locktime? My understand, for a tx, before it finalized with the locktime, it can not go into mempool. But, which specified location is the tx to stay for waiting the locktime come. Similiar, for before the sequence number, where is the tx to stay for waiting?
Thanks.

The tx is located with the person who created it. Nodes will not hold onto the transaction because it is not ready for the mempool. The only places a node will hold someone else's transaction is in the mempool or in the blockchain so a node will not store a non-final transaction anywhere.

It is up to the transaction creator to hold onto the transaction and not lose it until they can broadcast it after the lock time has passed.


Buying Bitcoins from different brokers I am trying to buy bitcoins from Coinbase. However since there is a limit I am going to purchase from another broker.

How I can move those different bitcoins into one wallet? or shall I use different wallet? How would the process happen and does this introduce any conflicts?

It works fine.  Your wallet will have the option to create receive addresses.  When you withdraw coins from your broker, you give them this address, and they send coins there; after the transaction confirms, you can spend those coins any time you want, by sending them out to someone else's address.

You could give both brokers the same receive address if you want, but it is better to use different ones, as this makes it harder for people to track your activities.  Any decent wallet should be able to create as many receive addresses as you want, with no practical limit, and they will all work equally well.  When you spend coins, the wallet will automatically select coins residing in one or more of your addresses; so even if you receive coins from different parties via different addresses, you can still spend them all in one shot if you need to.


Are there any risks of publicizing a Lightning network invoice? What are the perils of publicizing a LN invoice either before or after its payment?
From what I understand, after its payment the second payment of the invoice cannot be done. Other than the fact that the invoice was already paid, what could the third parties learn from a lightning invoice?
Keeping aside social-engineering impersonations:

Can the safety of the funds by affected any any information published in the invoice?
In what way publishing such an invoice may affect privacy of the transacting parties?
Could the payer prove (cryptographically) that they were the one that paid the invoice?

Does it affect -most importantly- the safety of the funds?

It does not. Funds are not affected by publishing a LN invoice.

  Does it negatively affect the privacy or something else?

If a lightning invoice is published, 3rd parties may learn some semi-private information about the payer and payee. First and foremost, they learn the amount that was paid and to which node that amount was paid. Since an invoice can contain a short description, they may also learn what the payment was for by reading the description.

LN invoices also may contain specific routing information, particularly for private nodes. Revealing a LN invoice may also reveal a private node's existence, public key, and a channel id of that node.

  Could the actual payer prove (cryptographically) that they were the one that paid the invoice?

Anyone in the route (including the payer) can prove that they were in the route by revealing the payment preimage. I'm not sure whether the payer can prove that he was the payer, but he can prove that he was involved in the payment as either a forwarder or as the payer.

However if the payer is involved in a dispute with the payee, he can prove that he paid by presenting the payment preimage.


Off chain transactions How can you create an off chain transaction and broadcast it?  Is it the same as creating a non standard transaction or different?

An off chain transaction is a change in BTC ownership (a payment) that is not a Bitcoin transaction (not just an invalid or non-standard one; it's something unrelated entirely).

If I hand you a private key, or a wallet file, or a physical coin, that is an off chain transaction.

If you and I both have accounts on a USDBTC exchange, and you're buying BTC and I'm selling BTC, the exchange engine may match up our trades, and deduct my BTC balance (and increase my USD balance) while simultaneously incrementing your BTC balance (while decreasing your USD balance). Your total BTC ownership increased, but not transaction was visible on the chain (it's all internally inside the exchange's account database). This is an off chain transaction.

Layer 2 payment channel systems like Lightning work by having a pre-negotiated but unbroadcast Bitcoin transaction that pays two participants. These two participants can choose to renegotiate how much goes to each, which mechanisms built in to prevent either from broadcasting an old version. The updating of that transaction as an off-chain transaction. The result of many combined payments may end up on the chain as an on-chain transaction, but the individual payments are not. This makes it an off chain transactions.

Arguably, if I hand you a signed piece of paper saying I owe you 0.01 BTC, that too is an off chain transaction.

The name is confusing, as it conflates the word "transaction" (in the sense of blockchain transaction) with "transaction" (in the general financial meaning of a transfer of ownership).


Understanding SPV, pruning and its downsides, as well First of all, sorry by not asking an objective question, it's because I can't resume this one and I didn't find information even in the "mastering bitcoin" book. The large texts in this question are also to help people get in the context of what I'm asking.

Suppose I run a bitcoin client in pruning mode. As I understand, it'll download the entire blockchain, verify that the transactions are well formed, don't spend unexistent outputs, the signatures match, and the hashes of the block match. After that, it'll erase everything and just store the Merkle Trees of each block. I understand how a Merkle Tree works, it's a structure made of hashes of transaction IDs. Given a transaction and its merkle path, I can verify if the transaction is in the block or not.

If I just accept blocks from the network but did not previously verify the blockchain, I could be fooled to verify that a transaction is in the mined block, but I would not be able to verify if the transaction is well formed, if it spends unspent outputs, etc. So that's why the entire blockchain must be downloaded and verified before. (even though, it's unlikely that someone would waste hashpower to mine a block with an invalid input, but of course if we rely on unlikely, it would open a port for this possibility).

So, as I understand, an SPV client just receives the latest merkle root of the latest block and verify if a transaction is in it. It then see that very much hashpower was wasted on that block, and then assumes that it should be a valid block. Am I right?

In pruning mode, however, the entire blockchain is downloaded, verified, and then pruned. Now, the client just downloads new blocks, verifies them, and prunes them. As I've read, however, in pruning mode, the client maintains the latest x blocks for some reason. Why?

Also, if I have the entire blockchain in pruned mode, that is, a blockchain made of only merkle trees, given a new transaction and its merkle path, I can verify that it's in some block and I know that this block is valid because I validated it before pruning. However, how do I know that this transaction spends an unspent input? Do I need to ask for the merkle path of the referenced transaction and keep doing that?

In the current model in my head, I don't see how a pruning node could be fooled. Is the only downside of pruning nodes that they don't help the network very much? Because they can't provide merkle paths for those who ask, etc. But if I receive a transaction and I am a pruning client, can I have the same confidence as a full node that I'm not being fooled?

Is there any other disavantage of pruning that I don't know? I'm asking because I'm verfy intersted in this model and I want to run a pruning client.

So, as I understand, an SPV client just receives the latest merkle root of the latest block and verify if a transaction is in it. It then see that very much hashpower was wasted on that block, and then assumes that it should be a valid block. Am I right?

No. A SPV client submits a bloom filter to a full node providing SPV services. Each time a block header is sent to you, a full node will check against said bloom filter is transactions that you may or may not be interested is in the block.

If yes, then said transactions will be included, including all other transactions required to compute the Merkle Root. Otherwise, you just receive a block header with no transactions whatsoever. For each block header received, your SPV client will check if it contains a proof of work solution that meets the difficulty requirement and if it is linked to the previous block (as usual).

  In pruning mode, however, the entire blockchain is downloaded, verified, and then pruned. Now, the client just downloads new blocks, verifies them, and prunes them. As I've read, however, in pruning mode, the client maintains the latest x blocks for some reason. Why?

I assume you are talking in terms of a full node, since SPV nodes do not download the blockchain at all and there's nothing to prune.

The reason why the last N blocks are kept is so that when a re-organisation takes place, it is possible to systematically undo transactions that led to the current UTXO set which is based off an orphaned chain. You then undo to the point where the new succeeding chain begins and apply transactions recorded in the new chain. Without the last N blocks, there's no way to un-wind when chain re-org takes place, then to re-derive the UTXO independently requires a full download of the blockchain.

  Also, if I have the entire blockchain in pruned mode, that is, a blockchain made of only merkle trees, given a new transaction and its merkle path, I can verify that it's in some block and I know that this block is valid because I validated it before pruning. However, how do I know that this transaction spends an unspent input? Do I need to ask for the merkle path of the referenced transaction and keep doing that?

I think you are confused here. While operating a full node in prune mode, your node will download every block and perform full validation. Each transaction that gets processed will update the UTXO set that is cached on your node. Therefore, you will know if transactions are spending valid UTXOs or not.


Can Darkcoin's Darksend be implemented on top of Bitcoin? Can Darkcoin's Darksend (I think this is called coinjoin, but I am unsure) be implemented on any cryptocurrency (without a fork), or must the feature be present when the coin is first released?

Yes, DarkSend is one specific implementation of CoinJoin, and CoinJoin can implemented directly on top of Bitcoin without a modification of the protocol. So no fork is necessary.

The Darkcoin Whitepaper does not
mention anything that would deviate from the CoinJoin idea and thus require a modification of Bitcoin. (However, the paper is not very detailed and I did not look at the source code, so I cannot provide an answer with 100% certainty.)

CoinJoin has been originally proposed by Gregory Maxwell. The main advantage of CoinJoin to avoid that coins can be stolen while mixing them with other users. It does not change Bitcoin, it runs on top of it, i.e., it only provides a special way to create perfectly valid Bitcoin transactions that can be submitted to the network. Of course, users need a special client to participate in the protocol. For users with normal clients, the created transaction is just a normal Bitcoin transaction that appears in the blockchain.


Can there be double spend between propagation of block chains between 2 set of peers? It shouldn't be as simple to do a double spend. I think I am missing something here. I understand Consensus rules and P2P networking. But since a node is connected only to some limited number of other peers, So a subset of nodes will only know a limited reality of blocks among these peers at least at a given point of time. Wouldn't this allow easy possibility of double spend?

For example sake, let's assume there are only 6 nodes globally and they happen to get following pairing to peers.

**Set 1**
1<-->2
2<-->3
3<-->1
**Set 2**
4<-->5
5<--6>
6<-->4

It leads to kind of two sets of isolated groups of 3 each. Let's assume now Adam's wallet is connected to node 4 and does a transaction. How will this be relayed to nodes 1, 2 and 3? Adam in my example can leverage this to do a double spend by doing transaction by connected to nodes in set 1 now.

Staying well connected is important to bitcoin nodes and miners. Special relay networks such as the Bitcoin Fibre Network exist to ensure new blocks are communicated quickly, and to prevent network fragmentation.

In your example, some subset of nodes have become fragmented from the network. If you sent a tx to those nodes, they would not be aware if it was a double spend, so they may store it in their mempools.

However, transactions need to be confirmed by miners, so if no miners are in the fragmented network, then those nodes would simply wait endlessly to hear about a new block. If the rest of the network knows about the other tx in the double spend, and has confirmed it in a block, then the fragmented nodes would simpy drop the tx they heard about once they reconnect and get the updated blockchain. Any UTXO can only be spent once on the blockchain, a second attempt would be invalid.

It is unlikely a miner would be fragmented, due to the existence of things like the Fibre network I linked to above. Miners are heavily incentivized to ensure they have good connectivity to the network. Anything less than that means they could lose money by mining on the wrong chain.

So, I hope you can see that if a situation arose in which the network became fragmented, then it could be possible to get a double spent tx into the fragmented node's mempools undetected. However getting the doublespent tx confirmed is unlikely, due to good miner connectivity (very low chance of miner fragmentation). So as long as users wait for transaction confirmation (ie not a 0-conf tx), they will be at little risk of being double spent against. Usually 6 confirmations is the recommended waiting period for high value transaction.


How the BTC-e could dive to 102 points (from 700) and the recover back to 700 At around 10.00AM of 10th Feb, BTC-e had hit the low level of 102 USD/BTC from 700 USD half hour before.

How is it possible at all? And even after such a big dip, how did the market recover and survive?

It simply is someone with a lot of coins, who sold on the open market and depressed the price (temporarily).  It was an economically unwise decision, since they missed out on the fair market value as you saw.

This is one example of how the Powerful Elite can Thwart Cryptocurrencies.


Should I verify the Bitcoin Core release signing keys? I have been running Bitcoin Core on an old Macbook for about a year, and I updated to v0.18.0 a couple of months ago which I downloaded from bitcoin.org.

I have recently been delving deeper and I realized that I never checked the keys.

Is it recommendable/indispensable?

Can I still check the keys once it is up and running?

Will I have to reinstall and download the entire blockchain again?

Is it recommendable/indispensable?

Yes, it is a MUST not just recommendable. There are a number of ways in which an attacker could modify the binary that you download from the bitcoin.org website.

Attacker can compromise the Bitcoin.org website, so any information hosted on that page could be modified by the attacker for its own benefit
Attacker can compromise the SSL/TSL connection by compromising a Certificate Authority and issuing fake website certificates
Attacker can launch a man-in-the-middle attack on people visiting the bitcoin.org website and tricking them into believing that they have landed on the original website

Once the attacker has fooled you into downloading a clone of the Bitcoin software with a malicious bug, it could steal all of your coins, use your machine to launch attacks on the Bitcoin network, crash or wipe your computer clean or might place a worm in your machine that acts as a surveillance tool.

In fact, Bitcoin Core developers issued a warning during the release of v0.13.0 binary (in 2016) as they had suspected that the release could be targeted by the state sponsored attackers.

It is also recommended that you verify the signatures and hashes of the binaries from multiple sources and developer signatures. You can use the gitian signature repository to get other signatures and verify multiple signature data through multiple channels.

  Can I still check the keys once it is up and running?

You could possibly check the binary once its up and running by evaluating the SHA-256 of the binary in the /usr/bin/bitcoind. But there might be a chance that a malicious code separated from the actual binary during its first execution and now is located in some place you might never find without a thorough forensic analysis.

  Will I have to reinstall and download the entire blockchain again?

If you reinstall a new binary and verify it with the signatures, you can just sync it with the network. If the blockchain that you had downloaded from the previous release matches the true version of the Bitcoin blockchain (that is it was not tampered), then you need not download it again.


Programming cryptocurrency wallets My understanding is that all cryptocurrencies(including bitcoin) have a public/private key pair that is needed to perform transactions. I am curious how exchanges program these wallets and generate the keypair for all the cryptocurrencies. I assumed there would be a wallet SDK for each cryptocurrency so that developers could program their own wallets, but did not find any such thing. Also, how do they programmatically submit transactions to the network? I assume you need to provide some IP, but since this is a decentralized network what IP would you provide?

I can help to answer about how wallet submits transactions to the network. Bitcoin wallet clients solve this problem with several methods. Several reliable peers are registered in DNS under the name bitseed.xf2.org. By doing a nslookup, a client gets the IP addresses of these peers, and hopefully one of them will work. If that doesn't work, a seed list of peers is hardcoded into the client.

The hardcoded peer list in the Bitcoin client is in chainparams.cpp in the array vSeeds.


Recommended way of printing a cold wallet I'm considering making cold paper wallets (for multiple cryptocurrencies) for offline storage in a safe deposit box.
Before accessing the safe deposit box, my identity is checked and I must show my key, so I consider storing the paper wallets non-encrypted.

They are a lot of tutorials on how to generate a wallet on an offline computer, but I'm searching for an efficient way of transferring the wallets to the paper.

Here are the options I have considered, and I would like your opinion.

Handwriting

In a technical point of view, handwriting the wallet key seems secure but tedious. I'm not very confident about reading my own handwriting in ten years, especially in base56 , not talking about my children reading it.

Low-cost laser printer

Buying a $60 printer that should be supported by the offline computer. I think that kind of offline printer will be unlikely to store my private keys and even more unlikely to transmit them.

typewriter

Buying a second hand typewriter and typing the key on it. Seems pretty secure and relatively easy, if the key can't be extracted from the ribbon.

Label printer

Label printers can probably work without a driver, just by echoing the key through the serial port, but thermal paper won't last enough, thermal transfer can be read on the ribbon and matrix printers are expensive.

Embossing label maker

I'm pretty sure that this one can't be hacked and can be read by anyone in thirty years, but they don't have upper and lowercase required for base56. Writing the key in hexadecimal can be a solution.

You can use BIP 38 encryption to encrypt your private key and then just print out your private key normally. BIP 38 will encrypt the private key using AES with a passphrase of your choice (so make sure that it is a secure one) and encode it using Base58 Check Encoding so you will get a string that is your encrypted private key. Because it is encrypted, you can print it out normally without risking the private key being revealed as the printer and any devices on the network will only see the encrypted string and not the actual private key.

The only caveat is that if you forget your passphrase, you lose the private key. One way around that would be to write your password on the printout.


What prevents rewriting the history of a chain with a different difficulty? It looks like the difficulty is deterministic, but only if the timestamps are trusted.

What's to prevent a large miner from starting back much earlier in the chain (when difficultly was miniscule) and quickly making their own chain with forged timestamps? Wouldn't it be possible to quickly "catch up" and surpass the block height of the real chain, and thus convince clients to switch to a chain built with a non-competitive difficulty?

I think this would be considered a time warp attack.

What prevents this strategy from working is actually quite simple, as explained in https://bitcoin.stackexchange.com/a/37960/26673:

  Bitcoin nodes do not compare chains by their height. (Although they used to do this.) They calculate the total work in each chain (nChainWork), and compare by that. This is calculated by looking at the number of attempts it would take, on average, to find each block, and summing it.

My question assumed that blockchains were compared by height — but they are actually compared by the amount of work encapsulated. So a chain mined with competitive difficulty would clearly represent more work than a forged one "solo mined" with a much lower difficulty reached per block.


What's the best way for someone in Israel to move money in and out of Mt. Gox and/or Tradehill? There is an Israeli bitcoin exchange (BitCoil), but it has been closed some time before and it doesn't currently support limit orders. I want to understand what's the best way, without using BitCoil, to move dollars in and out of Mt. Gox and/or TradeHill from an Israeli bank account.

The "best" way would be cheapest, most secure, convenient, fast and reliable.

For smaller amounts you could buy bitcoins from another who holds ILS on BitMarket.eu.  http://bitmarket.eu/market/ILS or over the counter on the #bitcoin-otc marketplace: http://www.bitcoin-otc.com

TradeHill had been planning on adding ILS, but there was a setback:
 - http://bitcointalk.org/index.php?topic=19537.msg366806#msg366806

For larger amounts, having your bank send USD funds via an International bank wire to an exchange would likely the cheapest and fastest method even though the fees to do so are sizable.
 - http://en.bitcoin.it/wiki/Buying_bitcoins


Please help - Bitcoin Conf file in the wrong directory I am running a full node using Bitcoin Core GUI on Windows 10. The conf file is in my bitcoin data directory, instead of being in the appdata/roaming folder. But Bitcoin-qt points to it by default and seems to work fine.

But bitcoind and bitcoin-cli are looking for the conf file in the appdata/roaming folder, which I guess is the reason the bitcoind server never appears to start. How do I start bitcoind and check if it is running or not? I need bitcoind to run so that I can use json-rpc commands.

If I run bitcoind on cmd, it appears to start downloading the whole blockchain again, which is unnecessary because I already have all of it.

You can use the --datadir parameter to specify the exact location of your blockchain data, and --conf to specify the location of your configuration file.

From the wiki:

  If you want to store the data in D:\BitcoinData then click on "Properties" of a shortcut to bitcoin-qt.exe and add -datadir=D:\BitcoinData at the end as an example:

  "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -datadir=d:\BitcoinData

  Start Bitcoin, now you will see all the files are created in the new data directory.

If you have a custom config, do the same with the added parameter:

  "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -datadir=d:\BitcoinData -conf d:\Bitcoin\bitcoin.conf


Is the generator G of the keypair always the same number for all different tx messages in Bitcoin? If so, what is that number and why can't you divide the public key by G to obtain the private key?

No sufficiently efficient algorithm for division is known. Multiplication over a closed group is a lossy process.

For an imperfect analogy, consider multiplication over the group of 100-digit numbers where you just keep the last 100 digits of the result. Since you don't know what digits were discarded, you can't naively reverse a multiplication.

The corresponding algorithm in DSA is modular exponentiation -- (G^X) mod n, which is also, for practical purposes with large numbers, irreversible even if G and n are known.


Proof of work: average number of tries to create a block First, I'm sorry if I'm asking a stupid question. I'm just trying to understand bitcoin. I'm reading the Ethereum white paper, and I couldn't understand this sentence about proof of work:

  At the current target of ~2^187, the network must make an average of
  ~2^69 tries before a valid block is found

My question: how the 2^69 number of tries is computed?

Updated:

My question: why 2^69 instead of 2^70 or 2^169?

As MeshCollider's comment mentions, it is simply the difference between the total number of bits against the target bits.

As to why it is this way is just a function of probability. If you have a range of 1-100, and your target is <= 20, there are 20 numbers that satisfy your requirement. Thus, 20 * 1/100, or 20 tries out of 100 should result in a valid  number against your target.

It works the same way, although on a much larger scale here. Your target and attempt are both 256 bits numbers, which means they range from 0 to 2^256-1. If your target is 2^179, it means that 256-179, or 2^67 tries will, on average, produce a valid number against the target.


If I lost my public keys, could I recover them from the private key? Possible Duplicate:
  How are public & private keys in an address created?

If I lost my public key, but still have the private key, is it possible to recreate the public keys.

How many public keys can be made from one private key?

Is it a computationally expensive process to create all the public keys from one private key?

Sincerely,

Joe.

Relation is one private key generates one public key and it is possible to recreate the public key. You can't recreate the private key though, so if you lose them, you lose all coins associated with that key.

It is not computationally expensive to generate or recover keypairs, but you need specific programs for that support secp256k1 elliptic curve cryptography.


Bittrex: What Error Do You Receive for Spamming the API? I have a script which queries the Bittrex API pretty frequently (it makes an order after the previous order has filled).

This question asks about the rate limits. Therein, it is mentioned that Bittrex is rather dodgy about the rate limits, and they could change over time.

I want to know what the error/warning response for spamming the API is so I can slow down my requests adaptively (and therefore, not need to edit my script if they change the rate limit in the future).

Does anyone know what the error/warning response for spamming the API is?

It isn't clear from Bittrex what error message is received when you encounter a limit. They just say that the request will fail. According the latest information from Bittrex Accounts can query the API up to 60-times a minute, once per second.

That said, there is a "success" flag returned for every request to the Bittrex API. I would imagine that this would be "false" and there would be some sort of message explaining the error. Maybe just look for false?


Are there any bitcoin banks (online services) and what are the benefits and pitfalls of using them? Possible Duplicate:
  Is there a solid "Bitcoin Bank" yet?

Say that I wish to control my bitcoins from a (for me) single point and I don't have the technical resources to have a single access point with a wallet amongst my own personal computers / devices.

Is there a bitcoin bank or similar service that hosts my bitcoin wallet for me and is there a benefit to such a service beyond likely better backup and being a single point to which I can manage my bitcoins without having to set up my own remote access to a home PC?  What are the reasons against using such a service?

There are such services. But there's a good reason not to use them -- if one day the service is gone, so are all your Bitcoins. This has already happened once and will almost certainly happen again. As of yet, there are no companies I would consider sufficiently reputable in this business.

You can, however, keep both Bitcoins and other currencies in a TradeHill or Mt. Gox account. You can fairly easily transfer Bitcoins into and out of those accounts and they're run by well-financed companies that can reasonably be trusted. And both TradeHill and Mt. Gox have made noises about making their accounts more like online wallets.


Using bitcoin-qt. Address with my funds does not show up. Can I import it? I have bitcoin-qt and was just recently aware that it changes addresses all the time. I am afraid that my last wallet.dat backup was before my last transaction, at which the receiving address was changed.

After that, I had to reinstall my computer. Bitcoin-qt is still 2yrs behind and syncing.

will the other address show up eventually?
I have all my seeds, keys and so on. Is there a way to claim my BTC that are on the address?

You're probably safe. If you were using an old version of Bitcoin Core, it used to keep a key pool of 100 unused addresses around. When you request a new receiving address, one from that pool gets used. So, unless you received numerous transactions between the backup and the last transaction, your last transaction should be covered by the backup containing these 100 unused addresses.

If you're using a new version of Bitcoin Core, its wallet uses a hierarchical determistic key derivation where a single backup will always be enough to regenerate any later generated addresses.

Therefore, you should see our transactions appear when your Bitcoin wallet has synchronized with the current state of the network.


Bither max transaction fee is 1mBTC per kb. I don't want a stalled transaction I've had my BTC with Bither for awhile.  Bither's max transaction fee is 1mBTC per kb.

If i am doing my math right

1mBTC per kb  = 100,000 Satoshis per kb.

(100,000 Satoshis / 1024) = (97.65625 Satoshis /byte)

According to https://bitcoinfees.earn.com/  this is 1/4 what it should be.

Any thoughts?

As of 12/12/2017, there is no updated version, either Android or Windows that allows Bither to go beyond the 1mBTC transaction fee.  At that transaction fee, it might take forever or never for a transaction to go through.

There is NO direct information on Bither on how to do this, but after nearly a full day of work, i figured out how to derive the Bitcoin private Key from the HDaccount wallet from Windows Bither. It took a bit of reading and trial and error but, i had success.

From Bither, I exported the Seed Phrase.  I then utilized the website at https://coinomi.com/recovery-phrase-tool.html.

Instead of trusting the website, even though it's supposedly java client based, i saved the website to an OFF INTERNET computer, and ran the webpage from my offline computer.  I put in the seed phrase which then spit out derived bitcoin addresses and private keys.

I was then able to use that private key to access my bitcoin from another software that has better up to date support including transaction fees.

I hope this helps others.


Market Depth Price on Mt. Gox API? The Mt. Gox streaming API has a market depth channel. What is the "price" value given in that channel, and what does it represent?

Reference: https://en.bitcoin.it/wiki/MtGox/API/Streaming#Depth

It's the price per BTC for the specified order. The "type_str" field specifies the type of order ("ask" or "bid"), the currency specifies the currency in which the price is quoted.

The example listed refers to an "ask" order of 14.43 USD/BTC.


Open-source blockchain explorer for regtest mode I'm trying to find an open-source Bitcoin blockchain explorer that will work in regtest mode, so I can more easily inspect the blockchain, see what transactions are getting processed and included, etc.

I found the following ones, but all of them seem to have issues:

blockcypher is "not easily compatible with running your own version locally, and this is no longer recommended (except for expert users)."
bitcoinchain is not open-source AFAICT.
Bitcore's insight-ui [1], [2], [3] does not work with bitcoind AFAICT.
toshi does not work with bitcoind AFAICT. Not sure how to set it up in regtest mode to connect to another bitcoind full node.
bitcoin-abe does not seem to support regtest mode, though it could be as easy as adding a new Abe/Chain/Regtest.py file.
blockchain.info: can't really tell if the My-Wallet-V3-* repos [1], [2] are for the block explorer website or for the wallet-management side of the website.

So, any suggestions for an easy-to-setup blockchain explorer that works with a local bitcoind node ?

I managed to point Abe to regtest just by using datadir=/home/$USER/.bitcoin/regtest in the config file and following the official instructions.


Why do people say that bitcoin scales according to O(n^2)? In regards to bitcoin, Peter Todd says: "Fundamentally the tech itself does not scale. The whole idea of everyone knowing everything about every transaction, which is inherent to the trust model of bitcoin right now... that's simple: O(n^2) scaling. You just can't get away from that. No matter how much you push and pull that constant k value, you'll never get away from the fact that fundamentally it's O(n^2) scaling.

reference: https://youtu.be/Td6fwuI7F7U?t=4m59s

I assume n represents number of transactions?
What does k represent?

Also, is Peter referring to "Load" scalability?
(wikipedia: The ability for a distributed system to easily expand and contract its resource pool to accommodate heavier or lighter loads or number of inputs. Alternatively, the ease with which a system or component can be modified, added, or removed, to accommodate changing load.)

n is the number of users. It is assumed that the number of transactions is Ө(n), and that the number of full nodes who must know all transactions is also Ө(n), so the total information (that needs to be propagated, verified and stored) is n*Ө(n) = Ө(n^2).

The assumption about the nodes requires clarification according to context, because there is no actual need for the number of nodes to scale with n.

k is the proportionality constant implicit in the Big Theta notation.


bitcoind stops working I have an Ubuntu 14.04 512Mb RAM/100Gb HDD server which I use to host a remote bitcoin node. bitcoind currently catches up and for some reason it just stops working after 10-20 minutes or so every time I re-launch it. Nothing interesting in debug.log:

2015-01-11 04:28:47 UpdateTip: new best=000000000000000027ce5c42b2e4b3e5cc51f441aaf3644a4fe8bf0215abae7c  height=306691  log2_work=79.261277  tx=41024325  date=2014-06-19 19:10:49 progress=0.488913
2015-01-11 04:28:47 ProcessBlock: ACCEPTED
2015-01-11 04:28:47 ProcessBlock: ORPHAN BLOCK 290, prev=00000000000000003de1051078cb951cadb90aad2e1a94019df07d431384934e
// nothing here, bitcoind not working anymore

What's going on and how can I fix it?

UPD here's the bitcoin-cli getinfo output:

{
    "version" : 90300,
    "protocolversion" : 70002,
    "blocks" : 306754,
    "timeoffset" : 0,
    "connections" : 10,
    "proxy" : "",
    "difficulty" : 13462580114.52533913,
    "testnet" : false,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}

I had a similar problem - it turned out that Bitcoin was running out of memory. (This happened when I was using one of DigitalOcean's 512MB VPS's.)

Here's what you can do to check if this is the problem:

Run the command watch free -m

You'll see something like this:

             total       used       free     shared    buffers     cached
Mem:           997        891        106          0        117        640
-/+ buffers/cache:        133        864
Swap:         4095          0       4095

Look at the intersection of -/+ buffers/cache and free. This is how much free memory you have. In this example, it's 864 MB.
If that number drops below 10 MB before the crash, that's probably the issue.

Here's what you can do if this is the problem you're having:

Get a larger VPS from your provider.
Enable swap
Try adding

dbcache=50
maxconnections=4
rpcthreads=2

to your bitcoin.conf file.


Could Blockchain be used for a different currency, leaving bitcoin behind? I’ve seen articles lately that many large banks including, HSBC, Deutsche Bank, Citigroup, and Bank of America are exploring the use of Blockchain. Knowing these banks, they would surely love to use their own currency instead of bitcoin. Given this, could Blockchain used for a different currency, leaving bitcoin behind?

The general idea here is that the blockchain provides some (really cool) new building blocks for us to play with:

Once something is accepted into the chain and has N confirmations (typically 3+, sometimes 6+), it's extraordinarily unlikely to be deemed invalid.

The "policy" for the validity of a block is codified.
It's still determined by people (which is the hullabaloo about BitcoinXT and block size being debated now in Hong Kong) but it's a world of "one-CPU one-vote", meaning if the majority of mining power agrees that these are the rules, then those are the rules and they'll continue mining.

Bitcoin itself is just one particular use of this idea of "a chain of blocks" proving that a certain amount of hard work was done to get to that state.
Altcoins (as mentioned in a comment above) are just modifications of BTC, changing some parameters and the name, which is interesting, but unlikely to be as "mainstream" for the simple fact that most people with money in Bitcoin don't fully understand cryptocurrency in general. Some of these do really novel things (ie, Nu, which splits "currency" into one part used for investing and another used for transacting), but AFAIK they're not mainstream yet.
Back to Bitcoin and banks...
Bitcoin effectively allows everyone to act as their own bank. This is really cool (I was amazed when I could "send transactions" and see them show up on another computer without a central authority...), but it comes with it's own drawbacks like... if your wallet is stolen, there's no one to call and yell at (see https://bitcointalk.org/index.php?topic=83794.0)
Banks want a way to "be their own banks (in the modern way BTC does)" because right now they're centralized and rely on a lot of trust. This means that transactions are slow (ACH is super slow compared to the BTC block time) and can be reversed if enough people make a stink (see https://www.quora.com/If-my-bank-mistakenly-deposits-1-000-000-into-my-account-am-I-legally-allowed-to-spend-it-before-they-realize-their-mistake)
When banks talk about using the concept of a block chain, I don't think they're really thinking about currency in the way we think of USD, but rather a "better way to handle trading in an open and untrusted system".
In other words, banks are saying "We want a way to not trust each other, and still clear trades quickly and efficiently."
For example, I agree to trade you 1 share of GOOG for $700 USD, and I want that to happen quickly, reliably, irrevocably, and without me knowing or trusting you. Sounds kind of like a Bitcoin transaction, right?
Bitcoin is one way to do it, but that would mean the same currency you use to settle trades is the one you use to buy a cup of coffee -- which can cause issues. If banks just create their own currency that's used exclusively for trading, it's just an Altcoin with a very special purpose and very big backers.
That (I believe) is what SETLcoin (Goldman's idea) does (http://www.americanbanker.com/news/bank-technology/goldman-sachs-files-patent-for-cryptocurrency-system-setlcoin-1078153-1.html)


Crypto-currency interoperability My question is about Bitcoin, Litecoin and Ripple, to which other currencies (crypto-currency and regular) they can be exchanged? Are they exchangeable with any currency or can each one be exchanged with specific currencies?

There are services such as ShapeShift that have built whole businesses around exchanging cryptocurrencies for each other.

There are numerous exchanges in many different countries that allow customers to trade national currencies for cryptocurrencies.

There are several payment processors that accept cryptocurrency payments for their customers and reimburse them in national currency.

There are some services that automatically convert your salary into cryptocurrency, allowing you to be indirectly paid in cryptocurrency by regular companies.

There are services that allow you to pay virtually any bill or order from any webshop through them as intermediaries, paying the with cryptocurrency.

By using a combination of the above, you can virtually trade any currency, your labor, any service, produce or physical object for pretty much any cryptocurrency.


How to set up a node on Testnet of Lightning network on the world map I am currently having problems posting my node on the "World Map." I can see my node on the "Force Map" on this site.
Can anyone tell me how to enter the public IP so that it can be seen on the "World Map"?
My node is currently showing the pubkey but not the public IP.

Can anyone help me with steps of how to enter the IP of my node?

You need to start your lightning server with --externalip flag set to your public IP address. The specific command depends on which implementation you are using at the moment one of lnd, c-lightning or acinq.


Is centralization in the Lightning network inevitable? Why (not)? Especially keeping in mind the possibility of single-funded channels (see Tadge's Google Doc Slides), buying from an exchange and concurrently opening a payment channel on the Lightning network would seem a particularly simple entry to the LN.

Exchanges and payment-providers would therefore seem to be in a natural position to become well-connected.

Is it fair to expect emergence of a network topology strongly centered around well-connected nodes such as the aforementioned and other liquidity providers?
What incentives are there for establishing additional connections with less well-connected nodes?
Is it reasonable to expect the network to "flesh out" with alternative connections around the center nodes?

“Centralization” is now a word constantly repeated but is one that, generally speaking,
   no one tries to define accurately.  ---Alexis de Tocqueville, Democracy in America, Vol.1, Part 1, ch.5.

Lightning Network channels will naturally tend to form along the paths of economic
activity.  If you assume (as I do) that most economic activity in
Bitcoin today is from individuals to large Bitcoin businesses (mostly
exchanges), then you should further assume that most channels will be
between users and those very same large businesses.

You can call the centralization if you wish---but it is not a
centralization of Lightning's making; it is a centralization that already
exists for Bitcoin users.

Moreover, even though Bitcoin commerce and trading is dominated by large
businesses, there are quite a few of those large business.  I haven't
looked up figures, but I would suspect that Bitcoin commerce has a much
less centralized distribution than mining at the present time---and with
new businesses offering Bitcoin-payable services all the time, Bitcoin
commerce would seem to be in a steady of progressively becoming more
decentralized.


How can I get the confirmations of a transaction using bitcoind? I installed bitcoind on my linux server. So far, it has downloaded blocks 0-386561 according to bitcoin-cli getinfo.

I went to a random block within that range, and picked up this transaction:

TXID: a3d7b336b5e1024de75c21612bc8af7f4b30e05ccb863a438463fda4034d34db

I want to check how many confirmations this transaction has using my bitcoind through a CLI command.

So I typed bitcoin-cli gettransaction a3d7b336b5e1024de75c21612bc8af7f4b30e05ccb863a438463fda4034d34db.

It gave me this:

Can someone please explain what is wrong??

Like it says, gettransaction can only return info on transactions which are part of your wallet, i.e. those which send coins to or from one of your own addresses.

Normally Bitcoin Core doesn't keep track of any data on non-wallet transactions, but this can be turned on with the -txindex option.  (Building the transaction index for the first time will also require you to reindex the entire blockchain with -reindex, which will take several hours to days and a fair amount of extra disk space.)  With this turned on, you can use getrawtransaction with any past transaction, wallet or not; if you want human-readable output, including number of confirmations, add true after the txid.


What options are there to combine mining over multiple computers? Assuming you have multiple (30+) computers, what options are there available to do a distributed solo-mine?  Can I have them all checking into one bitcoin application over the network, or do I need to create/join a pool?

You can run as few or as many Bitcoin clients as you want. You can have them all pull from the same client, or you can have each miner pull from its own client. Just remember, the mined coins will go to the wallet of the client the miner pulled the work unit from.


Can a Bitcoin node create an outgoing connection to a inbound node? I'm trying to figure out if we can create an outgoing connection to a inbound node (a node which we are already connected to, but the remote peer has initiated the connection). I know that this does not make much sense since we exchange information to inbound and outbound nodes. However, I have looked at the source code and did not find the code that prevents a node from doing that. Is anyone out there more successful?

Nothing prevents this as it is impossible to distinguish whether the node that is connecting to you is the same one that you are already connected to. This is because one machine can run multiple node software or multiple instances of the same software and thus it can be multiple nodes on the network.

There's also no reason to block such a connection.


Sell bitcoin to account So let's say I have multiple bitcoin addresses (some of them already received bitcoins), created a new bitcoin address, received bitcoins on it and would like to use the very same address to send them elsewhere - how can I do that?

Most wallets don't pay attention to which addresses you "send from", and for most purposes it doesn't matter.  When you try to send coins, they will select inputs from among all the transactions paid to all your addresses, hopefully in such a way as to minimize your transaction fees in the long run.

However, some wallets, such as Bitcoin Core, have a "coin control" feature that lets you manually select the inputs for a new outgoing transaction.  You could use this to choose only inputs that come from your desired address.  But in most cases there isn't any need to do this.


different multisig address from the same public keys When I use bitcoin-cli -testnet to generate a 2-of-3 address, the code:

bitcoin-cli -testnet createmultisig 2 '''
 [
   "03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc",
   "039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798",
   "030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf"
 ]'''

the result is

"address": "2MzSwUwBc1xuNHwRotwrdFugLvju8VV9uPT",

But when I use bitcoinjs-lib, the code is:

var pubKeys = [
'03b91ff254ae3bb3861e4a6c16ab356d6c52ccfd2b58bedf0dda84657dfd9d9afc',
'039f1475fb37d91ed65765c897acbdc37da3a7aba19f5b8ad5ff22a994e8350798',
'030ee8793fa2cb93f0cfd475b990cbaa48a28d83bd8f434348607368e52644febf'
].map(function(hex){
return new Buffer(hex, 'hex');
});

var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys); // 2 of 3
var scriptPubkey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript));
var address = bitcoin.address.fromOutputScript(scriptPubkey);

Now the address changed to

38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB

How could this happen? Did I do something wrong?

you run bitcoinjs-lib in main-net mode and it generates the human-readable address for main-net

bitcoin-cli you execute with -testnet parameter and got address for test-net

you can check that these hashes are the same:

https://testnet.smartbit.com.au/tx/8c67e4d3264696d222d5a72c70c8806eb3f12b9a02d1bc80554ab00803be86c0

https://blockchain.info/address/38tjRCFaQWQ269oGDpEkdxh5iPgxh7kvtB

both are 4f0017ef9291b625bec1d7efacc246a37b293682


What if block N were based not on N-1 but on both N-2 and N-3? If the bitcoin protocol were changed so that the merkle root from block N-1 were replaced in block N by the two roots of blocks N-2 and N-3, then it would become possible to mine 2 blocks at a time in parallel and increase the block frequency compared to the time each block took to propagate. Each block would still get confirmed by 6 of the following 7 blocks. The block size variance could be controlled by requiring that transactions with odd hashes go into odd-numbered blocks and vice-versa. What would be the limitations of this variant protocol compared to the existing Bitcoin protocol, assuming nobody considered one confirmation to be much better than zero?

Objections that come to mind initially, I'm sure there are more:

You don't want to split the hashing power into two halves because that would make it easier for an adversary to get 51% of that halve: 25% of the total or even less if the halves are not exactly 50-50.
The idea behind Proof of Work is to concentrate as much work as possible behind one and the same chain and make that the level-to-beat by an attacker.

If you force odd transactions into odd blocks (and vice versa) then you still have 10 minutes block times for all transactions.


How come the fees were higher than the actual amount in the bitcoin transaction? First of all, sorry for the newbie and probably a stupid question, I am so new to the digital currency thing :)

A day ago, I sent $2.5 worth bitcoin from my coinbase account to the copay wallet for testing. It went through OK, but later when I looked at the transaction details (via Blockcypher) I noticed that the fee shows up way higher than the actual amount: It was 0.004084 BTC (~16 US dollar as of yesterday).

I understand that the miner fees changes based on the demand and the block space of a transaction takes, and nowadays they are quite high. But I didn't get why the transaction went through in the first place if the fees that high, and I didn't pay for them (I think). Maybe I am missing something (probably I am)!

So, can someone kindly explain to me what's happening?

Thanks in advance.

PS: I am also adding the transaction information from coinbase. In that, the fee shows as 0.000316764 where as in the transaction details page via Blockcypher shows the fees as 0.004084. That is the part I am confused about. In other words, the fees don't match, and I was wondering what is the big discrepancy all about!

Basic explanation:

Two things are happening here, first, the transaction is quite big (2903 bytes). And second, the inputs of the transaction hold really low value (
27982 Satoshi each). If we put together this two facts, what happens is what you have seen, that the most of the transaction value is spent in fees.

Extended explanation:

When a previous transaction output (utxo) is used to create an input of a new transaction, there is a minimum amount of data that it will add to the transaction. This data can be split in two parts, a fixed_size that will be non-dependant of the input type, and a variable_size,that will depend on the input type (and therefore in the utxo type).

The fixed_size can be defined as follows:

fixed_size = prev_tx_id + prev_out_index + nSequence = 32 + 4 + 4 = 40

In the transaction you are referencing, all inputs are P2PKH, which means that the minimum amount of variable_size data that creating an input will contribute to the transaction can be expressed as follows:

min_variable_size = scriptSig_len + PUSH signature + signature + PUSH public_key + public_key

Signatures can be 71-73 bytes depending on their r and s components, and public keys can be 33/65 bytes, depending whether they are compressed or uncompressed. If we take the minimum signature size, and compressed public keys, the result is as follow:

min_variable_size = 1 + 1 + 71 + 1 + 33 = 107

and therefore:

min_size = fixed_size + min_variable_size = 147

Then, if we check how big was the transaction (2093 bytes) and how much was paid as fees (408400 Satoshi) we get that the fee ratio paid is around 141 sat/b. Now, if we check how much we should pay just for including one of our inputs in the best case we get:

min_size * fee_ratio = 107 * 141 = 20727

So, around the 74% (20727/27982 * 100) of each input value is spent just for paying the fees required to spend itself. If you take into account the rest of the transaction (version, outputs and nLockTime), we got that around the 85% of the inputs value is paid as fee:

total_value = 475694
fee = 408400

perc = fee / total_value * 100 = 85.85


Avoiding currency conversion markup For example, I want to travel from Country A to Country B.
If i exchange money from Currency A to Currency B, i will have to pay conversion fees.

Is it possible to convert my money from Currency A to bitcoins, and then go to country B and convert bitcoins to Currency B?

If you can buy using https://localbitcoins.com/ in both places then you can just buy some bitcoins locally before you leave and sell them locally when to get to where you are going.


Why would apps use Lightning over an on-chain TX? I'm trying to understand software orientated payment use-cases for Lightning payments.

Given a web app that accepted BTC payments charged in Satoshi for a service - watching videos for example; why might it be advantageous to use LN to continually generate new invoices (per second of viewing time), instead of simply timing the overall viewing time and invoicing once at the end via a standard on-chain TX?

The only advantage I see atm is a hedge against on-chain fee prices, by opening a "long running" channel.

I think these are two questions.

1.) Why charge with lightning in real time instead of once? I guess the main reason would be the convenience for the consumer. It is much nicer if I don't continue to watch the video that I don't have to pay the full price.

2.) Why using lightning instead of an on chain transaction? I guess the main reason is that on chain transactions are slow and with the higher adoption of bitcoin also more expensive. This means that it will just be cheeper and faster to accept payments via the lightning network which goes in the direction of the guess you made. There is another advantage which is that your lightning channel can be reused over and over again.


What bitcoin core options can be changed without a restart? I often experiment with new bitcoin core options (like zmq, debug and fee options) and I would like to avoid restarting my node for them to take effect.
If I am not mistaken, changing the RPC password, for example, can be done without restarting the node but most options require a restart.
What are the options that require (and don't require) a restart to take effect?

Debugging print options can be changed without a restart.


How does BitCore work? There are different sets of libraries in  https://github.com/bitpay/bitcore

Node - A full node with extended capabilities using Bitcoin Core (what is the role of this node ? As i can see this code in node js . Is this means that bitpay has implemented the bitcoin core in node js ? )
Insight API - A blockchain explorer HTTP API
Insight UI - A blockchain explorer web user interface
Wallet Service - A multisig HD service for wallets
Wallet Client - A client for the wallet service

How do these different libraries interact with the Bitcoin blockchain?

Anyone explain the flow in steps will be highly appreciated.

Node - This is a node.js implementation of a full node, it is different from the original, Bitcoin Core, which is written in C++. A full node downloads every block and transaction and check them against Bitcoin's consensus rules. The Bitcoin network is made up primarily of nodes and miners, which don't all have to run the same exact software, provided they follow the same consensus rules (such as determine which transactions and blocks are valid).
Insight API - This is a blockchain browser/explorer, which is an application that reads the data from the blocks and prepares it in a searchable database. Usually one of the main features is that you can query any block or transaction by id. You can also query any address, and it will return a balance and transaction history for that address. These features are not very user friendly with most node implementations.
Insight UI - This is just the front end for the block explorer.
Wallet Service - This is an application that exposes an API for wallet operations such as creating and receiving Bitcoin. This will submit transactions to a full node (which could be a Bitcore node).
Wallet Client - A client for the wallet service that consumes the API.


How to collect Dust transactions? Most of my initially received bitcoins were from faucets and therefore, these micro amounts ended up being dust transactions. Since then, I've bought some bitcoins which are not dust.

Now I'm trying to send 0.0005 BTC to test out Blockchain.info's "receive payment API" (http://blockchain.info/api/api_receive) PHP example (https://github.com/blockchain/receive_payment_php_demo).  But Bitcoin-QT is telling me that I must pay 0.0005 BTC transaction fee.

I found out that the fee is due to the dust transactions.  Now, I like to get rid of these dust transactions  by combining their amounts.  Can anyone suggest an easy way to do this?

I was thinking of installing Armory and then transferring all of my bitcoins from my Bitcoin-QT wallet, in one transaction, to my Armory wallet.  Will this eliminate the dust transactions by combining all of my dust amounts together?  Will my new Armory wallet contain just one input transaction, and not over a dozen transactions of small amounts?

If Armory is not the way to collect the dust transactions, can someone explain how to?

I have not tried it myself, but Peter Todd has a python script called dust-b-gone.py

https://github.com/petertodd/dust-b-gone


osx - bitcoin-qt v0.8.6 doesn't starts at osx 10.9 non-developer machine I've compiled a bitcoin-qt v0.8.6 on osx 10.9. It successfully runs on developer machine from 'Finder' (as Bitcoin-Qt.app) and from terminal (as ./Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt). I've copied it to another machine (also osx 10.9). And it doesn't starts from 'Finder', error message is "applications is damaged or does not contain the necessary libraries" (but continues run from terminal).
Any ideas?

Well, I have a bad Executable file value in Info.plist file located in .app/Contents. I've changed it to Bitcoin-Qt and solved my problem.