How can you tell if a Ardor / NXT public node is an archival node? I'm looking to build a chrome app that queries the ardor / nxt decentralized data cloud using peerexplorers api public ip addresses here: http://www.peerexplorer.com/peerexplorer-api

The question I have is how do I tell if an IP address is an archival node? What can one query to find this out?

Let's say I wanted to aggregate all the torrent files that were ever uploaded to the ardor / nxt data cloud. How can I find archival nodes to query this?

There are a few ways to do this, but I'll describe the most straight forward one. Find an archival node from http://www.peerexplorer.com/api_openapi_archival.

If you pick any one of the ip addresses in that list you can then query that node to verify if it is a archival node by calling its getBlockchainStatus function, for example: http://23.94.134.161:7876/nxt?requestType=getBlockchainStatus

In the reply you will se a list of services, where 'PRUNABLE' is the one you are after. Any node that has PRUNABLE in their services list is an archival node.

On a side note, you don't need to query a archival node in order to get the actual data. Any node with open API will do, as long as you specify the retrieve=true parameter which is added to most relevant API functions. By doing that on a non archival node, it will locate the data from an archival node and return it in the query. With a bit higher latency of course, since there are multiple network calls that needs to be done.


In compressed public keys, is the 2 or 3 the parity or the sign? In different places I've read that the 2 or 3 is the sign or is the parity of the elided Y coordinate?
Which of these is it, or are the sign and parity equivalent in some way?

According to https://www.secg.org/sec1-v2.pdf, points are encoded in compressed format as:

0x02 + X coordinate: implicit Y coordinate is even
0x03 + X coordinate: implicit Y coordinate is odd

You can call this parity or sign - it doesn't matter; they're the same thing in a finite field (and arguably, both are inaccurate). As the coordinates are numbers modulo an odd prime p (the field size; p = 2256 - 232 - 977 for the secp256k1 curve used in Bitcoin), -x and p-x are the same coordinate. One of these will always be odd, and the other will be even. One of them will be negative and the other will be positive.
The convention is that "even" refers to the coordinate which manifests as an even number when seen as an integer in the range [0..p-1], and "odd" the opposite. This is an arbitrary choice, as another range could be chosen (such as [-(p-1)/2..(p-1)/2]) in which different coordinates would be seen as even or odd.
Yet, it helps distinguish. If (x,y) satisfies y2 = x3 + 7 mod p, so does (x,y) = (x,p-y). To identify the solution, the criterion of "even/odd when restricted to [0..x-1]" is used in practice.


What exactly happens when a node detects a double spend? Does the node drop both transactions? Does the node choose which one to keep? What exactly happens? Will both transactions be rejected by the network or will one of them be eventually accepted?

When a node hears about a new transaction, they try to accept it to their in-memory pool of transactions. If a node hears about a transaction that conflicts with one of the transactions that is already in their mem-pool, then they simply won't accept it to their mem-pool. The default client also won't forward the transaction on to any other nodes, either.

  The node drops the two transactions? The node choose one to keep?

So, essentially, if a node sees a double spend (two transactions trying to spend the same output) they keep the transaction that they saw first.

  Both transactions will be rejected by the network or one of them will be eventually accepted?

Assuming they pay the standard fee to get confirmed, a miner would likely include whichever transaction they saw first. So, if more miners see one transaction, it is more likely that one will get confirmed. It's possible miners will solve two blocks at the same time, with conflicting spends of a previous output. In the long run, though, only one spend of an output will stay in the main chain.


Limit tx to SegWit1x or 2x chain Given the lack of replay protection when the SegWit2x fork splits off a different chain is there a safe mechanism to broadcast a tx so that it will only be accepted by the 1x or 2x chain nodes?

If the answer is no would an option be to run both a bitcoin-core and btc1 full node and send coins to myself on the btc1 node. Once that tx is accepted into the SegWit2x block and NOT the 1x block I'd have safely split my coins? If the tx got replayed onto the 1x chain I could try again, hopefully not too many times to avoid fees.

All transactions would be replayable on both chains even after one was confirmed in a block on one chain, because since both chains start with the same UTXO set, the transactions spending those UTXOs are valid on both chains. The only exception is coins mined on each chain after the fork, because those coins will not be valid on the other chain. So that is how you can split your coins, you would need to mix your coins in transactions which use coins mined after the fork, so they are only valid on one chain. In the case of such a split I assume there would be some sort of service launched by the miners on both chains to start mixing people's coins and splitting them

EDIT: Ledger have announced they'll offer a tool to do that, its likely others will too: https://twitter.com/LedgerHQ/status/921730827117096960


How to get bitcoin P2SH (3*) address balance with bitcoind i'm trying to understand how to calculate/obtain balance of a P2SH address added to my running bitcoind with "addmultisigaddress..." and that is properly displayed by the command "getaddressesbyaccount" (it starts with 3* instead of 1*).

Now, i've created and spent a raw transaction to transfer some funds to that P2SH address, after a while I was able to find this transaction on blockexplorer.com and blockchain.info, so I can assume that funds are regularry transferred.

The problem is that I can't see those coins in my balance, also having more then 100 confirms (i'm using bitcoind v0.8.6). So I can imagine that bitcoind not recognize this transaction directly as mine via the blockchain (10GB+). Is there an alternative way not involving external services?

Thank you

The Core client will only update its balance when it registers transaction outputs that it is able to fully spend. So, if you don't have all of the multisig keys in your wallet, it won't keep track of the balance. What you're looking for is support for watch-only addresses, which should be coming soon (https://github.com/bitcoin/bitcoin/pull/4045/commits), but is definitely not available in 0.8.6.

In short, without writing some custom scripting, there is no way to do this with the current Core client.


child keys generated addresses reflect in wallet? I am confused about child HD public keys. Is this scenario correct?

I am using bx (libbitcoin) for all action below.
Generate a seed (bx seed).
create master private key using seed (bx hd-new)
create master public key from private key (bx hd-to-public)
generate several child BIP32 public key using random indexes (bx hd-public)
use generated child keys and generate several addresses
now using generated addresses

will all addresses connected to master private key? or because I used random indexes (step 5), it is disconnected from master private and public key?
In simple word, is it enough to use private key (step 3) in bitcoin clients such as electrum to access to all addresses that generated using child pub keys (not master key)?

Use incremental indexes instead of random

First of all, you should generate child addressess incrementally instead of randomly, as wallets will re-generate them starting from the index 0, incrementing the indexes until they start finding empty addresses.

From the BIP44 Account Discovery chapter:

  When the master seed is imported from an external source the software should start to discover the accounts in the following manner:

  derive the first account's node (index = 0)
  derive the external chain node of this account
  scan addresses of the external chain; respect the gap limit described below
  if no transactions are found on the external chain, stop discovery
  if there are some transactions, increase the account index and go to step 1

  Address gap limit

  Address gap limit is currently set to 20. If the software hits 20 unused addresses in a row, it expects there are no used addresses beyond this point and stops searching the address chain. We scan just the external chains, because internal chains receive only coins that come from the associated external chains.
  Wallet software should warn when the user is trying to exceed the gap limit on an external chain by generating a new address.

If you generate your child keys at random indexes, most likely the first 20 indexes will be empty, so the wallet will stop the discovery and show you an empty wallet.

Standard derivation paths

The standard derivation path (defined in the aforementioned BIP44 standard) is the following (M denotes the master private key):

  m / purpose' / coin_type' / account' / change / address_index

Most wallet implementations (Electrum being a notable exception) follow this standard. That means for a given receiving address, you should use a derivation path like this:

m / 44' / 0' / 0' / 0 / 0

Which translates to bx commands like this:

cat m | bx hd-private --index 44 --hard \
       | bx hd-private --index 0 --hard \
       | bx hd-private --index 0 --hard \
       | bx hd-private --index 0 \
       | bx hd-private --index 0

Since the first three levels involve hardened derivation, you have to use the master private key. The master public key can only be used for non-hardened derivation paths.

Electrum doesn't implement the full BIP44 standard as it only supports single-account wallets. In Electrum, the derivation path looks like the following:

m / change / address_index

Since there is no hardened derivation on the account level, you can also import the master public key into Electrum. This is similar to the chain you described but there is an extra "change" level still.

Electrum can also import a BIP44 master private key (there's a checkbox in the import dialog), by making you select an account index at import time.

I suggest to stick to the BIP44 standard as it will be can be imported by other wallets (like Mycelium) as a HD-wallet, and will also work in Electrum if you remember to import it as a BIP44 key.

However, if you need to work exclusively with master public keys, you can still use the 2-level derivation and import them to Electrum. I'm not sure if other wallets support importing them.


Why are there so many opcodes in Bitcoin Script, but they are not usable In my understanding, miners wont accept non standard scripts. Then why are there several opcodes which cannot be used in custom scripts because they are nonstandard?

Those opcodes can be used in non-standard scripts as part of a Pay-to-Script-Hash address. They can be in the redeemScript of the P2SH address and be standard.

Furthermore, standardness is not something that is set in stone; it is not a consensus rule, rather it is node policy. So in the future, we may create new script types which become standard that use other opcodes. Such scripts may be non-standard now (as P2SH and Segwit were in the past) but can become standard in the future. Those opcodes exist so that we can make scripts which perform smart contract-like things without needing a fork.


How to use NBitcoin for BIP32 wallets I'm using c# NBitcoin to generate master key at an offline server

ExtKey privateKey = new ExtKey("[My seed]");
ExtPubKey pubKey = privateKey.Neuter();

I will need to give the online server the master public key, and it can generate as many addresses it needs, my questions are:

How do I pass the master public key (pubKey) to this code in the online server ?

BitcoinAddress address1 = **pubKey**.Derive([some client data]).PubKey.GetAddress(Network.Main);

What is the best practice to listen for a payment received on this new address ? I'm working with web requests to http://btc.blockr.io/api/v1/address/unconfirmed/[address1]
My language is c# server side.

when you are doing

BitcoinAddress address1 = **pubKey**.Derive([some client data]).PubKey.GetAddress(Network.Main);

You are getting the bitcoin address, but not the master public key. (ExtPubKey)
A HD pub key have more information than just the pubkey.

The correct code is

string wifStr = **pubkey**.Derive([some client data]).ToString(Network.Main)

Then you can reload it

ExtPubKey key = ExtPubKey.Parse(wifStr)

In fact, the string format of an ExtPubKey have the Network to which it belong, that's why you also have the type "BitcoinExtKey" which represent in object oriented form both : the ExtPubKey AND the Network. If you need it :

BitcoinExtPubKey wif = **pubkey**.GetWif(Network.Main)

Take a look at my book, there is other code samples around HD keys.

Concerning the best practices, there is no silver bullet right now. I created an API called RapidBase which permit you to create wallet and add addresses to monitor in this wallet. (You can find it on github)

You can try it if you want, but it is very unstable for now (API wise), so expect things to change in the future. If you are using blockr, I think your best bet is to request each addresses as you are doing.

If you are using bitcoinq RPC, you can add address, but it takes time since bitcoin core will rescan the blockchain for fetching the relevant transactions each time.

I might be wrong, but for now there is no easy to use solution, exception rapidbase I developed, that is not very stable for now.


Bitcoin Core says it's synced but Blocks folder goes to only 985 I just downloaded and synced bitcoin core v0.14.2 (64-bit).  After several days, it is now synced and (the check mark icon) says "up to date processed 483001 blocks of transaction history"  but when I view the blocks in my Bitcoin/blocks directory, it only goes up to block 00985 (rev00985.dat). Are the other blocks somewhere else?

The number 00985 is not the block number.

Bitcoin Core stores its blocks in 128 MiB block files (blk?????.dat), and corresponding undo data in rev?????.dat. Only when one block fills up, a new file is created.


How bitcoin daemon search nodes to connect? How bitcoin daemon search nodes  to connect? What file in github responsible for this? How they often change? How is the veracity of the data of these nodes checked? Bitcoin daemon have function not save blockchain data on device?

How bitcoin daemon search nodes to connect? What file in github
responsible for this? How they often change?

Bitcoin use peer discovery to find nodes to connect to, some are hard coded in the file bitcoin/src/chainparams.cpp of the bitcoin core client available on github.
You can find more information here:
https://stackoverflow.com/a/19956156/1616622

How is the veracity of the data of these nodes checked?

There is no need to check them manually that is the beauty of decentralized blockchain, if someone try to trick other nodes by using wrong data like a wrong blockchain the other nodes will see it because of the bitcoin protocol and ban him


Should i send bitcoins to hash160 or normal address I am a bit confused here.
I know that a public address is generated from the private key which you should keep secret, or else, anyone who has it will be able to spend the coins "in that address".

However, when i was checking this link:
https://blockchain.info/address/dd9c56410b2e734e551fc34331a056b70e939c98
containing the hash160 address, blockchain.info showed me that the address from which this hash160 was made is the following: 1MCmcsjzocP68LyBZznA3tjRMvGd4eQRx1
However, if i navigate to this link:
https://blockchain.info/address/3MtnYRESMWhUDWfch6SkUX6MWSZLcYpRc1
blockchain.info will show me that the hash160 generated from the address : 3MtnYRESMWhUDWfch6SkUX6MWSZLcYpRc1 is the same as the one generated from 1MCmcsjzocP68LyBZznA3tjRMvGd4eQRx1.
I know that hashing is not a one to one function, it 'is' a many-to-one function but in this case,
My sub-questions are the following:

1) is it possible to get the real address (e.g : 1MCmcsjzocP68LyBZznA3tjRMvGd4eQRx1 or 3MtnYRESMWhUDWfch6SkUX6MWSZLcYpRc1) from the hash160 address (dd9c56410b2e734e551fc34331a056b70e939c98)?

2) why is blockchain.info showing me the the address of the hash160 (dd9c56410b2e734e551fc34331a056b70e939c98) is 1MCmcsjzocP68LyBZznA3tjRMvGd4eQRx1 and not 3MtnYRESMWhUDWfch6SkUX6MWSZLcYpRc1?

Both P2SH and P2PKH use HASH_160. That's what the h stands for in them.

Each HASH_160 is valid in both addresses. As to which address you need to send your BTC to depends on if you are using a redeem script or a public key to spend it.

If you send it to an address starting with 1, your output is encoded as OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG. To spend this, you require a private key that leads to the public key to which the hash belongs, and sign the tx using that.

If you send it to an address starting with 3, your output is encoded as OP_HASH160 <RedeemScriptHash> OP_EQUAL. In this case, to spend the output, you need to provide a redeem script for which the HASH_160 equals the one used in the address (along with any information that the redeem script might use, such as the signatures for a multisig address, or witness for a segwit address).

Due to this, each HASH160 can effectively be used to generate two addresses. Blockchain.info defaults to showing the 1-address.

DO NOT send any coins to the 1-address if your original address was a 3-address, and vice-versa. You will not be able to recover them.


Generate and push raw Bitcoin transaction When I try to push a raw Bitcoin transaction via the blockchain.info API I get the following error message:

  Script resulted in a non-true stack: []

Transaction should send 0.001 Bitcoins with a 0.0005 fee from 1CBzN3YW4h7XRwb5sjpmBSEPmVPa9wHPgD to 1KAsr5RcApYG1Rk9uLwsHTXvwsyD1FVyFy.

unsigned transaction:

01000000
01
88802ffe48d0f9d2867495e933b1477094ce017f5d6e4204e40f1040ab805c16
00000000
19
76a9147abd6d64781930ee9abfaa75b0976b45ce9b93ba88ac
ffffffff
01
a086010000000000
19
76a914c75073b564d6ebce3d5d12d59ab20d44bd10f69f88ac
00000000
01000000

signed transaction:

01000000
01
88802ffe48d0f9d2867495e933b1477094ce017f5d6e4204e40f1040ab805c16
00000000
8b
483045022100FA512B36C030BAD0868E2679E1B29E32CCE0099DA086F8FD82010DFFF61B79BA02206C00220683E448C29CCE73FCD7F3CD74E3F76582C07F2F0B436EF247C2D2523F014104a75429241bc8c83e0a1c615155e9b984880f16d39b09b28eef464139fb84d8ff507a5d482e8f41cdb5a762436515d310f16b208bdce4ddfb8a30a7236d36a2da
ffffffff
01
a086010000000000
19
76a914c75073b564d6ebce3d5d12d59ab20d44bd10f69f88ac
00000000

Does anyone has an idea why the transaction is incorrect?

something is wrong in your scriptSig

the publicKey in your script is

04a75429241bc8c83e0a1c615155e9b984880f16d39b09b28eef464139fb84d8ff507a5d482e8f41cdb5a762436515d310f16b208bdce4ddfb8a30a7236d36a2daf

but it does not match the address https://blockchain.info/address/1CBzN3YW4h7XRwb5sjpmBSEPmVPa9wHPgD which is the output of https://blockchain.info/tx/165c80ab40100fe404426e5d7f01ce947047b133e9957486d2f9d048fe2f8088

Are you sure that you are signing with the private key of 1CBzN3YW4h7XRwb5sjpmBSEPmVPa9wHPgD?


Chicken and Egg confusion over Bitcoin generation If Bitcoin is rewarded through mining, and mining is the process of packing some transactions in a block(and adding that block successfully to the blockchain), and on the other hand, a transaction itself is sending Bitcoins to someone else, then isn't this a chicken and egg issue? How could a transaction(say the first one) take place at all when there's no Bitcoin yet? Just getting myself familiar with the basic concepts of Bitcoin.

A valid Bitcoin block has to include a minimum of one transaction, which is the coinbase transaction that pays out the block reward. Most of the early Bitcoin blocks did not include transactions that sent bitcoins from one party to other, but included only the coinbase transaction that paid out the newly minted bitcoins.

In fact, the first transaction wherein an exchange of coins occurred was in block #170, when Satoshi sent 10 BTC to Hal Finney


Why does the txn_count field exists in a block? I was wondering why the txn_count field in a block exists. The count of transactions could be determined by parsing the txns field in tx format, right? Same for 'tx_in count' and 'tx_out count' in a transaction. The tx_in and tx_out can be just parsed and the count can be determined based on that, right? Is this true? And if it's true, why do the txn_count, tx_in count and tx_out count fields exist?

Serialization is certainly not my area of expertise, but I'd guess: one challenge with serialized data is to know how much data to read. Explicitly providing the count of objects (and their length) you're about to parse is likely simpler and safer than having multiple levels of terminators in a hierarchical data structure and may actually require less data overall.


Do keypool keys from an unencrypted wallet backup become unusable once I encrypt my wallet? I'm a little confused by this, which i found in the technical documention:

  When wallet passphrase enrcyption becomes enabled, any unused keys
  from the keypool are flushed (marked as used) and new keys protected
  with encyption are added. For this reason, make a new backup of your
  wallet so that you will be able to recover the keys from the new key
  pool should access to your backups be necessary.

If I were to encrypt my wallet.dat and had a recent backup that was unencrypted do the keypool keys in the unencrypted backup become invalid?

If I hadn't made any new transactions using the new encrypted wallet would I still be able to restore the backup using the unencrypted wallet backup or would this cause problems?

They don't become invalid. When you ask for a new address from the client, it will not choose any that it has already given you. This is for your privacy, because it makes it more difficult to associate those addresses with you.

In this case, we're making them as used for a different reason. To explain why, let's suppose the wallet didn't treat the previously unencrypted addresses differently.

You generate a wallet.
You read about the importance of backups, and make a backup to an external flash drive.
You read about the importance of encrypting your wallet, and do so.
For about 6 months, you use 3 new addresses every week.
You get hacked, and you have the external flash drive plugged into your computer at the time.

Your wallet would be encrypted, but that wouldn't matter, because all of the keys that hold a balance are also sitting unencrypted on your flash drive.

In theory, you could just destroy all unencrypted copies of your wallet, but that seems more difficult than generating new keys and making a new backup, no?

  If I hadn't made any new transactions using the new encrypted wallet would I still be able to restore the backup using the unencrypted wallet backup or would this cause problems?

Yes, you could.


How long does it take for Mt Gox withdrawal to Dwolla? I just sold some BTC and transferred money from Mt Gox to Dwolla.  My Mt. Gox account had $150 in it, and now both accounts are zero.

Is it normal for neither account to reflect the new balance after an account transfer?
How long does an account transfer take?

I've taken the matter up with Mt Gox support, but since they are in Japan, I'm not sure when they will get back to me.  I'd appreciate any anecdotal or historical interaction you've had with this type of exchange.

When I've used Mt. Gox, it's taken anywhere from two to seven days for the Dwolla payment to hit my account.


What Hash need for Signature verification? When miners verifies a transaction, they make some calculations to check its Signature by using some Hash.

What Hash is used for Sig verification in Bitcoin Core?

I think that the hash function used is sha256d, a non-standard function obtained by hashing with sha256 twice (first hash the data, obtain 256-byte digest, then re-hash the digest).


RPC security of bitcoind node If I have a fairly default bitcoin.conf file, let's say:
rpcport=8332
txconfirmtarget=6

ie: notably one where I don't specify things like rpcuser, rpcpassword - is this insecure?
As I understand, this lets the node be queried locally without an authentication. However I'm not sure this is any more dangerous than wallet.dat sitting around - local access would mean private key access.
Are default settings of bitcoin insecure?

ie: notably one where I don't specify things like rpcuser, rpcpassword - is this insecure?

No, Bitcoin Core by default creates a RPC cookie file in the data directory on startup which is used in place of static authentication. Specifying a rpcuser and rpcpassword is deprecated, and they can't be blank regardless.


Which country has the most friendly regulatory environment? There has been a lot of discussion of the most oppressive jurisdictions. Which countries have taken notice of these failures and have set up the best regulatory environment to attract Bitcoin related investment rather than chase business away?

Great Britian is a country that many companies moved their bitcoin related business to. One of the the best countries that respect privacy is Switzerland.

There are some tax-heaven type countries that have pro-bitcoin policies.

If you count it toward country Liberland is probably most friendly.

In this article you can find various contries with an explanation.


Understanding Bitcoin wallets I want to make sure I'm understanding a few basic concepts clearly:

A Bitcoin wallet itself is nothing more than a "record" that is stored on the Bitcoin blockchain. It's an identifier that will be used in a person's Bitcoin transactions.
A Bitcoin wallet app is simply a software tool to create transactions that are written on the Bitcoin blockchain
I think some Bitcoin wallet providers -- not sure if "provider" is the right term -- may keep some information about the user's wallet/transaction information on their own system.
The value added by those who provide Bitcoin services are simply providing user-friendly tools to read/write information from the Bitcoin blockchain. They may also be providing a method of converting real currency into cryptocurrency and vice versa (e.g., trading or purchasing of Bitcoin)

Am I getting this right so far?

Not sure if this is helpful, but here's what I think you should think about when you hear "Bitcoin wallet":

A Bitcoin wallet is a set of accounts that you can (a) spend coins from and (b) receive coins into.
An account is one and the same thing as a secret key and its corresponding public key [1].
To spend coins from an account, you need to perform a digital signature using that account's secret key.
Thus, anybody in possession of the account's secret key can spend all coins from that account. In other words, your secret key better stay secret and please don't lose or "forget" it. Or else [2].
To receive coins from Alice, you have to give Alice one of your accounts' public key [1].

Now, armed with this knowledge, I think you can answer your own questions:

  A Bitcoin wallet itself is nothing more than a "record" that is stored
  on Blockchain. It's an identifier that will be used in a person's
  Bitcoin transactions.

Yes and no. A wallet is a bunch of accounts. Each account has a "record" in the blockchain: there will be an entry of the form (_public key_, 10 bitcoins) for that account [3].

  A Bitcoin wallet app is simply a software tool to create transactions
  that are written on BlockChain

Yes. A wallet app is a piece of software that manages all of your accounts' secret keys and enables you to perform those digital signatures that let you spend your coins. Those signatures are over transactions of the form (_my public key_, _recipient public key_, x bitcoins) as I detailed in [3].

  I think some BitCoin wallet providers -- not sure if "provider" is the
  right term -- may keep some information about the user's
  wallet/transaction information on their own system.

I'm assuming you are talking about folks like coinbase.com, which manage your wallet for you? Recall that if they're gonna allow you to spend your bitcoins with a click of a button online, then they need your accounts' secret keys. So yes, they store that. And sometimes they're hacked and you lose your money [2]. On the other hand, if you don't use online wallets like coinbase.com, managing your own secret keys can be dangerous too: I have heard many stories of people losing their hard drives and thus their bitcoins.

  The value added by those who provide BitCoin services are simply
  providing user-friendly tools to read/write information from
  Blockchain. They may also be providing a method of converting real
  currency into cryptocurrency and vice versa e.g. trading or purchasing
  of BitCoin

The value part of this is in "opinion land", but yes, I suppose I agree: it's much more user-friendly not to mange your secret key and worry about losing it or being hacked. Still, you might just be replacing one worry with another: now coinbase.com might be hacked and your bitcoins gone [2].

And yes, some wallet providers like coinbase.com let you convert USDs into bitcoins and viceversa.

I hope this helps.

[1] Sometimes you'll hear the term address, which can be thought of as a "fingerprint" of the public key. To keep things simple, I will not distinguish between the two. Although, in practice, you will give the address, not the public key, to folks who want to send you coins. (This has to do with efficiency reasons and a bit of security.)

[2] Every time you hear about one of these "Bitcoin hacks," it's because someone's secret key got stolen => the victim's coins got sent to the attacker's account using a digital signature via the stolen secret key.

[3] To be more specific, there are actually a bunch of entries recording transfers from some other account into your account: (_public key_ of sender, your account's _public key_, 5 bitcoins sent to you)


I don't have data on my phone, can I still send and receive bitcoin without internet? I dont have internet on my phone at all at the bitcoin ATM and want to know if i can still receive my bitcoin with my phone

Yes, you can receive Bitcoin even if you don't have internet, but you will only see them when you synchronize your wallet (for this you need internet).


What exactly is a block? I am trying to understand the Blockchain algorithm used in Bitcoin.

I do not get the part how blocks are created.

Let’s say transactions occur at some time. Then, if some nodes get these transactions, these verify the transactions are valid and then send it to other nodes.

With this verify-send algorithm, almost every node verifies these newly occurred transactions in few seconds.

Now, it is a time for a miner to do his job, which I do not understand.

He needs to find a nonce which makes a lower value than hash values given in transactions.

Question 1 How many transactions should a miner should verify in a single block? For example, if a miner A finds a nonce which gives a lower value than hash values given in 50 transactions, and if a miner B finds a nonce which gives a lower value than hash values given in 70 transacations, would a reward be given only to the miner B? So should a miner appropriately choose how many transacations he will work for?

Question 2

How is a block created? In some webpages, it is written that if a miner finds an appropriate nonce, a block is created and a miner is rewarded. What exactly is a block? Is it correct that a block is exactly a text file of “transaction lists+ appropriate nonce value corresponding to those transactions”?

Question 3

When is a miner rewarded? Is he rewarded at the time he created a block or at the time after his block is chosen to be a part of the greatest cumulative difficulty chain?

As Pieter said, in future, please limit questions to one at a time :)

  which makes a lower value than hash values given in transactions

I think you're a bit confused here. The block hash has to be less than the difficulty target, but that has nothing to do with transaction hashes. The difficulty is just determined by how quickly the previous blocks were being mined.

  How many transactions should a miner should verify in a single block?

The miner can choose what transactions to put in the block, usually it is most profitable to fill the block up to its size limit with the highest fee transactions so the miner makes the most profit.

  Is it correct that a block is exactly a text file of “transaction lists+ appropriate nonce value corresponding to those transactions”?

It's not a text file, it's just bytes sent around the network. But yes kind of, it's a list of all the transactions in the block plus a block header, which contains a little extra info about the block such as it's timestamp and a nonce.

  Is he rewarded at the time he created a block or at the time after his block is chosen to be a part of the greatest cumulative difficulty chain?

The mining reward is just a transaction which pays the miner. So like any other transaction, it is valid as long as it is in the main chain, yes.

See also: What exactly is Mining?


transactions for future use If bitcoins can be stolen via hacking, what's there to stop these already occurring events and bitcoins from falling right back into the hands of power. I mean bitcoins are capable of being untraceable. So who's to say that its NOT already being utilized as the new, maybe even world, currency for control?

Think about it this way: Bitcoins can get stolen by people with poor private key control being "hacked". But when those people have their Bitcoins stolen, what do they do? They complain about it online, and so other people hear about it.

Then those people who hear about it say to themselves: "well my private key control is pretty bad too, I can easily get hacked!" Then some of them will at least learn to protect themselves, maybe by using a hardware wallet such as Trezor or Ledger.

Those that don't improve their practices will either eventually have their funds stolen, or they will see more examples and their behavior will self-correct.

Also if there was a sudden increase in thefts there would be a LOT of media coverage about it, and even more people would learn about how to protect themselves through these good private key practices.

Because of this, the amount of Bitcoin that is stolen annually will tend towards some small percentage. Of course, if Bitcoin did look like it was going to be the global currency you can imagine that the already-rich-capitalists would just buy a whole lot of Bitcoin, so it wouldn't make that much of a difference to their lives and position.


Validation of a new block A new block is added to blockchain if more than 50% of miners say that it is solved correctly. Does it mean that all other miners also do the same proof of work by including the same transactions as in the broadcasted block, and same nounce, as used by the miner of latest block?

Each full-node checks the validity of blocks. Checking the validity of a block is indeed done by repeating all steps of building that block and checking for adherence to all consensus rules. If a block infringes any rule, a full-node will consider the block invalid, ignore the block, and ban the node that sent it to him from his peers for 24h for sending invalid information.

As each miner should be running a full-node to stay abreast of the current blockchain-tip, either all miners or no miners should consider a block valid (as long as they are in agreement on the consensus rules that apply).


Why do the creators of ASICs not just keep them for themselves? If ASICs are able to mine BC so fast, why are the creators of these machines even selling them? If they just created them to mine with them themselves, they could get so many BC and in turn make BC worth so much (as BC for the rest of us would be so few in comparison) that they'd theoretically make a hell of a lot more money that way than by actually selling these machines.

What's the hidden agenda with sharing these machines? Do the creators of ASICs think/know that BC is a bubble/fraud and just want to make as much money as possible before people realize that their machines were BS?

I can't really answer this without speculation, since I'm not an ASIC developer myself. Please keep that in mind when you're reading this!

There are a two paths that ASIC miner manufacturers have to make a profit.

Expend fiat to produce mining equipment

Use mining equipment to mine bitcoin

Sell bitcoin for profit

Profit

Accept fiat or bitcoin in exchange for ASIC mining equipment

Profit

The shortest path to profit is to sell the device. Existing bitcoin is worth more than non-existing bitcoin right now, especially when that existing bitcoin can be turned into more mining equipment.

Keep in mind that they can also do some of both. While it may not actually be so, it's fair to believe that employees of an ASIC manufacturer are likely to invest in their own product by purchasing one.


Dogecoin: No wallet has been loaded I downloaded many [X] core software, including Bitcoin, Litecoin and others, and they all worked fine, except for Dogecoin Core. It keeps saying "No wallet has been loaded". There was a wallet.dat file there, but I got the same error when it was there (it's an empty wallet, btw). Now I moved that file somewhere else, and Dogecoin core is not creating a new wallet, and keeps giving the same error. How can I fix this? Please advise.

I think I know the reason now... the problem is that on the official dogecoin website, the version to download is 1.1.0, which is the one I downloaded, but is not the latest. The latest now is 1.8.0 (apparently, according to github). I switched to the new version and the problem was solved.

If the devs of the Dogecoin website are here, please upgrade it.


What happens when the nonce field overflows? The nonce field of a block header is 4 bytes, so the max nonce is: 4,294,967,295. That could be computed in a few seconds with a reasonable rig (solo mining) or much quicker on large pools. What happens at that point? I assume you'd change the timestamp and start over, but on extremely powerful pools, I'm sure it's feasible to compute all 4,294,967,295 nonces for every second of the timestamp, so what happens in that eventuality?

Changing the timestamp is one way, but the more scalable method is to change the "extraNonce" field of the generation transaction, which changes the block header's Merkle root.


What happens if there are no transactions? Could you please explain what would happen without transactions?
Let's say people stop s(p)ending for a while for whatever reason.
What miners would do if there are no transactions? Will they just keep a copy of blockchain and have no reward for approving transactions?

A miner can mine an otherwise completely empty block, and still collect the award of 12.5 BTC for completing a block.


How to restore my old wallet from address and privatekey? Few years ago I created a bitcoin wallet. I did it with some command line util which generated bitcoin address from template. At the bottom of output util tells me to store this in private place. I did it and forgot about bitcoin for few years. I attach util output below this post.

Now I would like to restore my wallet and hope to find some bitcoins on it. How can i do it with official Bitcoin Core wallet?

A step by step process has been explained in the below link

How to import private keys in Bitcoin Core

You need to sync your Bitcoin Core to see your balance.

If you want to access your BTC easily and without downloading the whole blockchain, then go to Blockchain.info

Sign up and after logging in, go to settings. Then in settings, you will see addresses as shown below:

Then click on Import Bitcoin Address as shown:

Then add your private key as it is in the form as shown:

Click import, and you will be able to use your BTC again.

Please follow that and let me know if you were able to retrieve the coins.


Is lightning network limited by the 'size' of channels? Imagine we start with multiple channels which eventually link two individuals, Alice and Rob: (the BTC amounts is the total locked in their multisig address for their channels between each other)

Alice --- 100 BTC ---> David --- 50 BTC ---> Rob

Now - suppose Alice wants to send 100 BTC to Rob. Alice is connected to Rob via David but there's only 50 BTC available to be distributed between David and Rob. Therefore Rob cannot trust a payment of 100 BTC from David.

How does Alice deal with this?

Assuming Alice does not have another 100 BTC sitting around outside of lightning - she has to close out her channel with David; wait for confirmation of this; and then send Rob a traditional transaction to make payment (or open a channel with him). Is this correct? Or is there a better way of dealing with this? Some way of passing value between channels?

If not - is this a problem for lightning network? It would seem that routing across channels is only as useful as the smallest connecting channel. And users have every incentive to keep channels as small as possible to minimise 'committed' BTC. If users have to wait for confirmation to close out a channel, their ability to make fast payments over the original bitcoin network is vastly slowed down by having to wait for confirmation of a channel closure before being able to conduct a transaction on the main network.

In fact, it's worse: payment channels can only transfer the balance that belongs to the sender in it. So, if David and Rob each paid 25BTC into the channel, David can at most send 25 BTC to Rob.— However, there could actually be multiple paths from Alice to Rob which could in parallel allocate 100BTC to Rob.

There's an interesting trade-off here: the Bitcoin blockchain scales easily in the amounts to be settled, but is limited in transaction throughput. Lightning Network on the other hand is practically unlimited in the transaction throughput, however limited in the amounts to be sent. This is why transactions on the blockchain are priced by the cost of including them in the block, i.e. the primary bottleneck, and transactions in the Lightning Network will probably be priced mostly relative to the value they transfer. Obviously, this favors larger value transfers on the blockchain and smaller payments to move to the Lightning Network. However, sending smaller payments requires both a smaller locked-in amount, and will make it easier to find routes.

So, it may actually just work out.— We'll see when it goes live on the Bitcoin blockchain.


How bitcoin exchange wallet system works? I mean if exchange generate new address for each user (getnewaddress)(rpc) ...but trade just goes in database of their not on real blockchain ,so how does exchange deposit address shows 0 balance on block explorer after selling my btc to someone.

If the trade happens in database only then that address should contain balance linked to it

Exchanges will often move funds from the deposit addresses to some other internal storage wallet. This wallet may be a cold storage wallet that is more secure than the wallet that initially holds your deposited coins. This will happen regardless of whether a trade occurred.


How to get transaction fee from raw transaction? I know that we have to calc inputs total minus outputs to get transaction fee, but using getrawtrasnaction RPC call, inputs values are not attached. how is it possible to get transaction fee?

Array
(
    [txid] => 318abc03cfa52c996b01d6ff10faf86447341d78acdf849026dd4c22ebd56cab
    [hash] => 318abc03cfa52c996b01d6ff10faf86447341d78acdf849026dd4c22ebd56cab
    [version] => 2
    [size] => 226
    [vsize] => 226
    [locktime] => 0
    [vin] => Array
        (
            [0] => Array
                (
                    [txid] => 71c6f340ef5f4688136e8b308393ff74a89b4bf780bf0e3c3611fa34dc858c07
                    [vout] => 0
                    [scriptSig] => Array
                        (
                            [asm] => 30450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a88[ALL] 0221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75
                            [hex] => 4830450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a8801210221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75
                        )

                    [sequence] => 4294967295
                )

        )

    [vout] => Array
        (
            [0] => Array
                (
                    [value] => 0.01
                    [n] => 0
                    [scriptPubKey] => Array
                        (
                            [asm] => OP_DUP OP_HASH160 e673381ba3ce7fa72520a09ee4e3ad68cd5d6528 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] => 76a914e673381ba3ce7fa72520a09ee4e3ad68cd5d652888ac
                            [reqSigs] => 1
                            [type] => pubkeyhash
                            [addresses] => Array
                                (
                                    [0] => n2XTjk57QJgjevmYb75tJHy7AJGGeoJv2e
                                )

                        )

                )

            [1] => Array
                (
                    [value] => 0.089981
                    [n] => 1
                    [scriptPubKey] => Array
                        (
                            [asm] => OP_DUP OP_HASH160 108e2c445972c2561d8cff8ee487cfe6e054ab59 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] => 76a914108e2c445972c2561d8cff8ee487cfe6e054ab5988ac
                            [reqSigs] => 1
                            [type] => pubkeyhash
                            [addresses] => Array
                                (
                                    [0] => mh2VRUG7BA8Rutz9tqTuhinqZxRo3QinGi
                                )

                        )

                )

        )

    [hex] => 0200000001078c85dc34fa11363c0ebf80f74b9ba874ff9383308b6e1388465fef40f3c671000000006b4830450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a8801210221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75ffffffff0240420f00000000001976a914e673381ba3ce7fa72520a09ee4e3ad68cd5d652888acd44c8900000000001976a914108e2c445972c2561d8cff8ee487cfe6e054ab5988ac00000000
    [blockhash] => eb31cb0c8de0e8b3219537e9304ee7d09d5dc7092ef17caed470b9a1aed2485e
    [confirmations] => 2269
    [time] => 1522693379
    [blocktime] => 1522693379
)

To get the input values, you need to look up the values of the outputs that they spend from. So call getrawtransaction one each input's txid and then find the output at index vout. The value of that output is the input value. Do that for all of the inputs and sum them. That is the total input value. Sum the values of the outputs to get the total output value. Subtract the total output value from the total input value and you will get the transaction fee paid.


How to deal with a shady exchange? I'm new here and the reason is that I believe I became a victim of a
scam. And hopefully, you may guide me to get out of this shitty situation or at least help me expose the scammers.

I've been stupid and got into contact with a guy called Glen Morley through telegram who supposedly has a very high accuracy signal rate on bitcoin trading, which he did actually, assuming that the exchange had genuine charts. We made a deal to split the profit 80/20. He didn't ask for any private info or whatsoever. He directed me to open up an account on bitfami.com

After the first day, I was almost sure that it was a scam. When I tried to withdraw the next day, the exchange told me that I'm not allowed to withdraw because my account was new and I have to wait for 4 business days to do so. It appeared during that conversation that they are also charging a 15% tax if your profit exceeds 20k USD. I've been also encouraged to continue trading in the meantime and they couldn't give a reasonable explanation of why to do so. When I asked why they have such rules nowhere to be found on their site, they became mute.

As I wasn't allowed to withdraw, I decided to go on to see the outcome of this story assuming that I've most probably lost my initial investment. Glen sent me signals to trade and I ended up with 5,9 btc from 0,25 btc in a week, just by 5 trades a day. In the meantime, I kept on thinking about possible scenarios but couldn't make much sense of the situation.

After a week, today, I made my last trade today to figure out the whole setup. It appeared that the 15% tax of the total profit made that they were mentioning was supposed to be deposited in order to withdraw which is something they don't mention. It's not even written anywhere on their site. In my case, it's around 6,400$. I don't have that money. Even if I had there's no way I'll deposit again to a shady exchange that comes up with last-minute surprises. When I told Glen about this, he encouraged me to pay it by getting a loan! I believe that the guy so-called Glen and this exchange are operating together. At first to convince people to deposit, then to make them believe they're making fast profits and at the end to make them deposit ridiculous amounts to withdraw which would probably never happen.

Sorry for taking your time with this but I feel like it is my duty to spread the news and ask for guidance if possible.

I have screenshots of every conversation I had with the exchange support and with Glen in case it would help.

Any help is appreciated, thanks in advance.

This is either a scam or it's not. It's very easy to tell which:

Case 1: There are no actual signals that make a profit. In this case, it's a scam. Case closed.

Case 2: There are actual signals that make a profit. In this case, who cares whether it's a shady exchange or not? You have the signals -- trade larger amounts on a legitimate exchange, never try to withdraw from the shady exchange, and outsmart the scammers. You still make money.

But I'll bet dollars to donuts it's case 1. That means there are no signals that makes a profit. That means there is no profit. That means there's nothing to withdraw. The means you're wasting your time trying to withdraw funds that don't exist.

It's your exchange account, right? That means you can see what trades it's making. You can check on other charts whether those trades will or won't make a profit. Either you have profitable signals or you don't. In the former case, you're going to make money. In the latter, you can't possibly make money. You have everything you need to tell with.

But we all know which one it is. The signals don't exist.


Breaking Bitcoin Private Key Suppose my private key is properly generated. My public key is known to everybody.
I don't care about privacy.
How many times can I reuse my bitcoin address until someone has enough information from all my transaction data to break my private key?
Assume I operate as an eBay seller who sells USDT (zero loses purchases where anybody can resell later at the same price), where adversaries can freely transact with me to get the transaction data, signature etc.
What is the term for this case/matter? is it "chosen cipher text attack", "plain text attack" etc.

How many times can I reuse my bitcoin address until someone has enough information from all my transaction data to break my private key?

An arbitrary number of times.
Assuming the discrete logarithm problem for secp256k1 is hard (the basic security assumption underlying Bitcoin's digital signatures), it does not matter at all how many signatures an attacker sees. He will not be able to find the private key, or be able to forge a signature.
There are two contexts in which the advice for not reusing keys appears:

Privacy. Reusing addresses increases the linkability of your transactions, which reduces your privacy as well as everyone else that you interact with through that address.
Post-quantum security. As soon as you've spent an output assigned to a given address once, its public key becomes public knowledge. Before that point, someone with a hypothetical machine that can compute private keys from public keys cannot even start their search. I personally think this is not a particularly strong reason not to reuse addresses though (the real reason not to is privacy); see What are the potential attacks against ECDSA that would be possible if we used raw public keys as addresses? for why.

What is the term for this case/matter? is it "chosen cipher text attack", "plain text attack" etc.

This crypto SE answer is relevant: https://crypto.stackexchange.com/a/32715/72983
What you really want is protection against existential forgery (the ability for an attacker to sign a message he has never seen a signature for). That is a stronger notion of security than what you were talking about (as forgeries do not require the attacker to actually learn your private keys).


Where can I find my 12 Recovery Passphrase Have just lost my blockchain wallet password have tried all kind of password I know now I need to know my recovery passphrase kindly help

You can find it wherever you wrote it down when you first created the wallet... otherwise you're unfortunately SOL.


Power off Antminer D3 (without ssh access) I want to power off an Antminer D3.

I have read online that the best way to do it is by connecting via ssh and executing poweroff.

However, I cannot login from my Mac to the miner with ssh -p 22 root@192.168.0.xxx or ssh root@192.168.0.xxx.

It does not accept the default password "root":

  Permission denied, please try again.

How can I log in and do I really have to shut down the miner this way? It makes sense to not turn off the fans immediately by unplugging the PSU.

Default password admin for user root worked.


How can I print these information using this library? I want to know how through using this library I can print information about the current block that the world mine right now and I mean by that: Version, Previous Block, Merkle Root, Time, Bits, and how many zeros we are looking for for the output of the hash.

With order.

The world mines multiple blocks at once, with only one block chosen by consensus to be kept.

If you want to get some information from bitcoin’s RPC you should consider using your own node.

You can call the RPC method getmininginfo but this command might not return the mining information you are searching for (an example Previous Block is not correct).

With the following information you can have the following problem:

Previous Block: The Previous Block is not equal to all networks at the same moment;
Merkle Root:  Every block can contain different transactions and in a different order

And on your question of how you can use the library python-bitcoinrpc, you can see my Python3 script for one example. you can find the script here


Is it correct to say that continuous transactions are on different blocks most of the time? I'm new to the idea of bitcoin and I'm taking an introduction course about it. Given the following picture from the original bitcoin paper, is it correct to say that continuous transactions are on different blocks most of the time?
If this is true, after a miner receive a broadcast of some transaction, how did he find those predecessor transactions for these to be processed transactions, so he can form his own block containing these transactions? Does he have to browse through all the transactions in the world to find these "predecessors"?

Each bitcoin node keeps an index of 'unspent transaction outputs' (the "UTXO set"), which is updated with each new block received. At the genesis of the network, the UTXO set was empty. With each block after the genesis block, the UTXO set was slowly populated, as each new block would contain some number of transactions (that create/destroy UTXOs).
Each bitcoin transaction specifies some number of inputs (other than the coinbase transaction in each block, which is a special transaction that has no inputs), and these inputs must be valid, existing UTXOs in the UTXO set. These UTXOs are 'consumed' entirely as inputs, and thus deleted from the UTXO set that the node keeps track of.
Each bitcoin transaction also specifies some number of newly created outputs, which are added to the UTXO set.
So when checking to see if a transaction is valid, the node will check to ensure that all inputs to the transaction are valid, currently existing UTXOs. Under the hood, each input is specified by the transaction ID, and the outputs index, and it is this data that the node uses to lookup the UTXO, as one step towards determining the validity of said transaction.


syncing no block source Recently synced bitcoinqt fully over around 36 hours or so without problem. I'm now trying to tentatively test it out as a newcomer and when I run it, it says "out of sync" No block source available 37  hours behind and 0 active connections to Bitcoin network. Should it automatically update each time it is run? Should it automatically connect to the network? Can I use only when fully synced? Apologies for the naivety of the questions but would appreciate someone's time with help?

Just restart bitcoin qt and wait a while - for me always work


What prevents a miner to change the locking scripts of an unconfirmed transaction In many cryptocurrencies a TX is composed of an array of TX inputs and TX outputs.

When a TX is submitted to the network, it already has the signature (in the unlocking script).

So my question is, what does prevent a miner or anyone on the network to use the already present unlocking and change the locking scripts of the transactions and then propagate the transaction.

Because in my understanding I may provide a signature to unlock a txo and someone uses my signature to change the locking scripts of those TXs.

Signatures cover inputs and outputs.

If someone changes one of the outputs in a transaction, a new signature is required. Effectively your signature signs "permit using my UTXO X to send A BTC to B, C BTC to D, ...".


Is the contest period really necessary for cross-chain transactions in 2-way-peg sidechains? According to the first sidechain article (Link), the cross chain transaction process can be briefly describe as follows:

Alice has a wallet on sidechain S1. She wants to send some coins to sidechain S2. So she makes a transaction containing some coins, send it to a certain locked-output on S1.
Wait for confirmation period to end.
After the transaction is confirmed, she submits a SPV proof to S2.
Again, she has to wait for a contest period.
After the contest period ends, an equivalent amount of coins is created and sent to her wallet on S2.

I assume that both the sidechains are secure, otherwise there is not much left to discuss. If they are secure,  then after the confirmation period in step 2 above, the sidechain S2 already knows that the transaction is confirmed on sidechain S1. For example, if Alice purchases something using Bitcoins, step 3 is where she can get the product she purchased from a normal store.

In my opinion, after the confirmation period, the transaction is already in a stable part of S1. Thus, there cannot be any valid SPV proof that contradicts the SPV proof Alice sent, unless S1 does not satisfy the persistence property.

Therfore, I would like to ask, why is the contest period necessary? Is there something I am missing in my argument? Thank you.

she submits a SPV proof to S2.

The way this worked in the first implementation of the sidechains paper by the same authors (called Elements Alpha, now elements) is as follows: The genesis block of the sidechain S2 creates a bunch of outputs with a new opcode OP_WPV that can be spent with an SPV proof showing that some amount on S1 has been "sent to a certain-locked output". Note that S2 follows the UTXO model of Bitcoin and there's no global state that OP_WPV could look up. That means that it's possible to provide exactly the same SPV proof to another OP_WPV locked output and effectively transfer your coins from S1 twice. That's why there needs to be a contest period where honest nodes have the opportunity to provide a fraud proof and lock the coins back into the OP_WPV.

Now if there needs to be a contest period anyway, we can make the confirmation period shorter than what we would assume to be secure against reorgs. Instead, the contest period is used to provide a window for reorganization proofs.

You can find more information about how this mechanism worked in this article: https://github.com/jonasnick/elementsproject.github.io/blob/master/source/_posts/The-Federated-Peg-in-Elements-Alpha.md.


bitcoind getnewaddress: Why I can see the generated address on Blockchain.info without broadcast? I have a question about bitcoind's getnewaddress command. After I generated by using the command, I can search the address on Blockchain.info. As far as I checked bitcoind's log, bitcoind did not inform about the generating new address to Bitcoin network. So I'm wondering why I can see the information on Blockchain.info. Any help will be appropriated. Thanks.

My address is this.

https://blockchain.info/address/1BKasyZAsA5F6nt7hrNTJq7KQb8rwjhVAv

(update)

I found this log. Is it broadcasting log..?

2014-12-23 16:56:58 keypool added key 111, size=101
2014-12-23 16:56:58 keypool reserve 11
2014-12-23 16:56:58 keypool keep 11

If you notice the message on the page:

  "No transactions found for this address, it has probably not been used on the network yet."

So blockchain.info just verified that the address you searched is a valid address and gave you a message telling you that it doesn't have any record of the address being used anywhere yet. If you look into what addresses really are (https://en.bitcoin.it/wiki/Address), then you will see what I mean by "validating" the address. Essentially, there are some checksum (not exactly, but close enough to convey the point) digits put on the end to make sure everything was transposed correctly.

The log you posted is not a broadcasting log, it's just debug info recording that there was a request for a new address. You're address is not known to anyone, except to everyone since it's posted on here now. :P


How do I communicate with the BTC network? Some background: I'm looking into making my own miner. Even though there's some documentation out there, I find it hard to do without looking into loads of existing code, and while I do that, I prefer to look into some actual reference to learn from.

And here's my question: using the following JSON for GBT (the JSON copied from here), I'm trying to send it to some P2Pool IP and port, using my wallet ID as a user and a random password, as instructed. Here's the curl I'm using:

  curl -u [ID:gibbrish] -d '{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}' http://[P2Pool Node IP:Port]

However, that yields:

  {"error": {"message": "Parse error", "code": -32700, "data": null}, "jsonrpc": "2.0", "id": null, "result": null}

What am I doing wrong?

Thanks ahead!

I think I figured it out. "curl" doesn't add the "Content-Type" header, which seems important to the pool when parsing the JSON body. Adding that header fixed it.

So, a working curl command would be:

  curl -H "Content-Type: application/json" -u [Wallet ID:gibbrish] -d '{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}' http://[Pool IP:Port]


How do miners select which transactions to include in a block? Where and how do you view and select which transactions to include in the block you are trying to create?

Do you look on the blockchain?

Is there some tool that you can use that allows you to see the fees as well?

A bitcoin node's (bitcoin's standard client acts as one) first function is to relay transactions on a best effort basis, it only relays valid transaction. The miner which also is a node will try to solve a block on the transaction it received, but in the end the miner has last word he can decide to arbitrarily discard some transaction (like one with no miner's fee)


What is the probability of different public key hash that produce the same checksum value checksum = 1st4byte(sha256(sha256(PubKeyHash)))
checksum1 = 1st4byte(sha256(sha256(PubKeyHash1)))
What is the P(checksum == checksum1)? where PubKeyHash != PubKeyHash1
Is it 1/(2^^32)?

Yes, exactly 1/2^32.
There isn't much more to say about it. Hashes of distinct values are uniformly randomly distributed. The chance for two independently uniformly randomly distributed hash to match in 32 bits is 1/2^32.


Unconfirmated bitcoin transaction, 1 day ago. Need Help A friend have sent me money trough bitcoin.
My transaction address is the next:https://blockchain.info/fr/tx/0e1d1862c344c6ea6c2036bdc85f1dd1a6e366b7ba1db2716d063b96d7290fb0

I don't understand why I have 0 confirmation. If someone can help I can send 10$ free. Thanks

your transaction will be confirmed soon. trust me :)


Initial setup Antminer S7 I have a worker on slush's pool, I have my BFGminer running (Pool 0 is hiding block contents unsure if that's important) and my Antminer S7, but I can't  seem to get it to see it as a device. It ask for a target which is a serial port to probe for mining devices but I'm unsure what it's asking.

The Antminer S7 runs standalone. It has a micro-controler that runs CGminer, and a web interface where you can point it to any pool you want. You just need to figure out the IP address of the miner, then type it in a web browser. The default password is root/root, if my memory serves me well.

In any case, you should read the manual.


View bitcoins per address in MultiBit I have a wallet with 100 addresses in MultiBit. From what I've gathered, bitcoins are linked to a specific address. Is there a way to see in MultiBit how much of my balance belongs to each address?

It seems that this functionality has not been implemented yet in Multibit. The only way to check individual balances is to via blockchain.info.  A real pain if you have 100 addresses.

Also it's not possible to specify which addresses to spend from when making a transaction from a wallet that has multiple addresses.  So need to have multiple wallets with loads of passwords - torture.

It is supposed to be possible with Bitcoin to use addresses once and then discard them.  But with multibit this isn't feasible yet in practice.

These features will come soon either to Multibit or another wallet.  They are badly needed.


How can I recover bitcoins sent to derived addresses in Electrum? I am using the Electrum wallet. Recently, I used my Public master key on the Mycelium Gear site to create a widget. This widget generates Bitcoin addresses, which I want to manage with my Electrum wallet. I received some bitcoins to these generated addresses but I cannot see the generated address in my Electrum wallet! I also cannot see my generated address in Xpub blockchain.info.

I already have my generated Bitcoin addresses, so now I need private keys for them. When I used the command to get the private key I received this error:

wallet.get_master_private_key('x/', gui.password_dialog())
Traceback (most recent call last):
NameError: name 'gui' is not defined

Electrum and Mycelium Gear both use BIP32 for address derivation from a master seed, but Electrum is not BIP39 compatible. Thus you need to take the master seed (BIP32 Extended Key, iirc) and restore it in a new Electrum wallet, and that should work.

Alternatively, if you want to get individual address private keys you can use http://bip32.org - my suggestion is to use the "Download ZIP" function at the bottom right of the page, and work with the keys offline, otherwise there is a chance that compromised code could expose your private keys.


Proving to a title agency a bitcoin transaction occurred? What is the best way to prove to a title agency that a particular bitcoin transaction has occurred and that the addresses do indeed belong to the parties exchanging the title?

Things to prove:

Ownership

Address A belongs to Person 1

Person 1 controls the private key allowing spending from Address A

Address B belongs to Person 2

Person 2 controls the private key allowing spending from Address B

Transaction T transferring an amount from Address A to Address B

occurred

was transmitted
was accepted
was confirmed
was included in a block

the block is a part of the longest chain, the blockchain.

Proving ownership of an address

Ownership is significantly easier to prove, provided that judge (to whom all this is proven), accepts either: economic activity or digital signature as proof of control of a private key.

Economic activity

Unfortunately, there is time and/or value cost to proving economic activity.

The judge could

ask each prover to reproduce the transaction at a given time, but at a negligible amount: 1 satoshi plus a sufficient transaction fee. That the original transaction could be reproduced with only the amount changing, and a reverse of the transaction executed as well, should suffice to demonstrate that each Person controls the private key sufficiently to engage in economic activity.
ask each prover to send 2 satoshi plus double the sufficient transaction fee to the same address: an address supplied by the judge, who then returns half of what was sent to demonstrate their own control of the address to which the 2 satoshi transaction was sent. This demonstrates that Person 1, Person 2, and the judge all control the addresses they say they do sufficient to engage in economic activity.

The costs of either of these are obvious, but generally sufficiently negligible as not to be a significant burden on any party involved. The transaction fees could be omitted, provided the transferred amount is sufficiently large to be both processed without transaction fee and trusted to be returned by the recipient.

The trust of these transactions could be increased by the judge assigning a random two-digit amount of satoshis to each transaction, or basing that random amount on an agreed-upon, yet-to-happen event with an expected time period within which the proving transactions must be transmitted to the judge. An example of a yet-to-happen event would be a newspaper headline or simply the leftmost two numbers in the 10th oldest block at a certain date and time.

Another, more convoluted yet more humanly trustworthy way would be for the judge to provide a private key to each prover. The prover then transmits an amount to an address controllable by that private key, then immediately returns that same amount using the provided private key. The judge has temporary control, though, so trust in the judge is necessary.

This method is infeasible if the parties are unable to broadcast the transactions to the network or the time necessary for transaction confirmation is too long.

Digital signatures

If the judge is familiar with how digital signatures work, or can be convinced of their validity, then this is an option. Some effort might be worth it, as this option is without economic expenditure and does not require the time necessary for the proving transactions described above to be confirmed by the network.

The judge provides a unique text to each prover. This phrase can be something sensible or randomly generated. Random is probably better, largely because it would take less time to generate. Alternatively, basing that text on an agreed-upon, yet-to-happen event with an expected time period within which the signature must be transmitted to the judge. An example of a yet-to-happen event would be a newspaper headline or simply the leftmost two numbers in the 10th oldest block at a certain date and time.

The signatures should be sent among all parties, so that all adversarial parties can verify the signature.

Remember that the point of this exercise is to demonstrate control of the private key. A downside of this is that not all wallet softwares support signing data, most commonly because the private keys backing the wallet are not exposed to the user in anyway except for the purposes of signing transactions. If a prover claims that their software does not have this functionality, this method is infeasible. The prover could be convinced to use another software, but that could compromise their position if they could be tricked into using malicious software, if a false positive proof of control is undesirable.

A combination of the two

Each of these methods has strengths and weaknesses, so a combination of the two would likely provide the most confidence proving control of a private key, and thus control of an address.

Proving that a transaction occurred

The easiest way for a judge to verify that any given transaction occurred is to use a trusted blockchain explorer program, since few wallet programs expose functionality enabling the user to search the blockchain by address, transaction, or block.

The judge can use the explorer verify the activity of each address in question, as well as the transaction itself. It is up to the judge to verify that the transaction has been a part of the longest chain for a permissible number of blocks. One block depth is sufficiently secure against most attacks that would cancel the transaction, but each additional block depth further solidifies the transaction.

This does not necessarily require network connectivity if the transaction occurred sufficiently far in the past that the judge's own copy of the blockchain can be explored.

If the judge does not have access to a copy of the blockchain, the desired proof cannot be surely obtained. Given the raw transaction, the judge can use the digital signature method to verify that Person 1 has control of Address A, as the raw transaction will contain a verifiable signature. However, the raw transaction itself contains nothing that would enable to the judge to verify Person 2's control of Address B.


BIP44 external and internal accounts Below I may be a bit verbose, so that if my understanding is wrong, it will be glaringly obvious.

Consider two external accounts:

The external accounts are used to receive bitcoin. When we search for new balances, we check only the external accounts. No-one should be sending money to your internal accounts except for you.

m/44'/0'/0'/0/0 : External account 0

m/44'/0'/0'/0/1 : External account 1

If both accounts are used in transaction A, Is there any rule that says the change must go to (Internal account 1) or (Internal account 0)?

If after Transaction A, we receive funds at External account zero and it is the only input in the transaction. Do we send the change to (Internal account 0) or the most updated internal account?

I think that if an address keeps sending change to an address, it can indicate that it is a change address, no?

Change can be sent to any address separately specified in the transaction for the change or, paid as fees to the miner if not.

Looking at the examples, it is clear that where the specification mentions change in the path it might well be intended to read chain with possible options of either change or external.

This leads me to believe that depending on who the change is meant for (whose inputs the change is from) - BTW if you are the receiver and not the sender then the change is not for you - then the change derivation path will be either of:

m / 44' / 0' / 0' / 1 / 0 #Account 1
m / 44' / 0' / 0' / 1 / 1 #Account 2


What's the longest chain of orphan blocks? (How many confirmations have been necessary?) I believe my two title questions are the same (are they?):

Heretofore, what is the longest chain of orphan blocks (of N blocks), such that if someone didn't wait for N+1 confirmations, they may have assumed transactions to be completed when they were not.

For example, on the wiki's blockchain article, it shows orphan chains of two blocks (N=2). In this case, 3 confirmations would have sufficed to confirm transaction with absolute accuracy. https://en.bitcoin.it/wiki/File:Blockchain.png

I ask because it seems 120 confirmations is the gold standard, if you will, as generated bitcoins take that long to confirm. Most other transactions are considered irrevocable at 6 blocks, but what has been the minimum, thus far?

PS. Is this question even answerable!?

The longest orphaned fork was created due the "value overflow" bug occurrence, ranging from block 74638 to 74691 (so 53 blocks). Such a situation is unlikely to ever repeat though.

Other than that, as far as I remember 4 blocks were overwritten by some strange behaving miner (related question), but I might be mistaken.

In general, 6 confirmations is enough in most cases to prevent any double-spend attempts, and 120 confirmations is enough to give the developers time to release a fix for some major bug that might occur before the coin creation transactions are mixed in with everything else, creating a big mess.


When I'm downloading the blockchain for the first time, from whom am I downloading it from? Is it p2p through BitTorrent protocol? Is it through a central server?

Blocks are downloaded from other nodes in Bitcoin's P2P network using a custom wire protocol. For the initial synch you can imagine it as a torrent with 5000 seeders, though the Bitcoin P2P protocol is more specialised and efficient for this task than BitTorrent.

The bottleneck is almost always CPU load on validation, rather than download speed.


Do i need to sign each input in a raw transaction? I've been reading up about raw transactions on bitcoin.org and there are two examples Simple and Complex.

What I can't tell from the information provided is if it necessary to sign each of the inputs separately, or whether you can just sign the entire tx with one.

So two examples:

Input 1 came from address A and input 2 came from address A.
Input 1 came from address B and input 2 came from address C.

For example 1, my assumption is that I could just use

bitcoin-cli signrawtransaction RAW_TX

but for example 2 I would have to use

 bitcoin-cli signrawtransaction RAW_TX [] ["ADDR_B_PRIVATE_KEY"]
 bitcoin-cli signrawtransaction PARTLY_SIGNED_RAW_TX [] ["$ADDR_B_PRIVATE_KEY"]

Do i need to sign each input in a raw transaction?

Technically, yes. But software like Bitcoin Core Client signs all inputs where the private keys are known. And of course, leave unsigned/untouched all other inputs.


What are some of the advantages & disadvantages of the following: Colored Coins and Counterparty Seeing the release of coinprism wallet for colored coins and I'm also playing with counterparty.co

What are the main differences among these two competing decentralized asset managers?

I see that counterparty.co has their own currency XCP, but colored coins does not. Now the question is how many of these XCP coins does the developers control or the first few people that created them?

And couldn't colored coins adopt what counterparty.co is currently doing and make them obsolete? If not, why?

The main difference between these protocols is how they associate and store data about asset ownership. Colored coins at least as implemented by Coinprism, put data in the form of a transaction output that must be retained in later transactions involving the associated standard transaction outputs (spending money). If a colored coin is handled by a wallet which is not colored-coin aware, the output containing data would not be reproduced and the colored coins involved would be lost.

Counterparty takes a different approach in that all of the ownership, issuance, order, betting and other data is stored in the blockchain with no relationship between money spending bitcoin outputs and the existence of such data. Instead, each counterparty transaction adds data to the global counterparty history. If your address has 500 FOO tokens, it will continue to have those tokens until a counterparty transaction is signed by your address that sends them somewhere else.

The model Counterparty uses, makes it possible to do things like locking the issuance of a token so no more can be created in the future.

Another fundamental difference is that colored coins use the 40-bytes available after an OP return whereas Counterparty encodes its data in the form of additional multisig addresses. Each allows spent bitcoins to be reclaimed but Counterparty can store more data in this way as long as Bitcoin's fee structure and mining community allow it.

In regards to how many xcp the developers control, that is unknown but is related directly to how many bitcoins they burned during the 30-day proof-of-burn period. At that time ~2100 bitcoins were destroyed to create 2.6 million xdp.

Colored coins would basically need to restart itself under a new model to copy what Counterparty is doing including its own solution to the initial distribution of a valuable, native XDP-like token.


Bitcoin Core - Go back to a specific block? I have a full node of Bitcoin Core wallet. I would like to know if it's possible to delete data after a certain block. For example Bitcoin is currently at block 504385. There was a fork around block 500000 and I would delete all block data after that so I can use the blockchain data I have with the new fork wallet.

You can't delete the block data themselves, but you can reset the blockchain state to a specific block by using the invalidateblock command. This command will mark a specific block and its descendants as invalid thus setting the chainstate to the block immediately before it. Note that this may not necessarily work to switch to a blockchain fork and may still not be able to use the forked blockchain.

If you want to go back to the 500,000th block, you would invalidate the 500,001st block with the call invalidateblock 0000000000000000005c9959b3216f8640f94ec96edea69fe12ad7dee8b74e92. By invalidating the 500,001st block the chainstate resets to height 500,000.


What is the right method to calculate Relative Strength Index (RSI) for incoming real time data? I am working on a trading bot that computes values for several indicators including the RSI. I subscribe to real time minute-level market data from an exchanges, and as new data arrives, I get the most recent tick, and re-compute indicators.
Let's assume the RSI calculation period is 1 hour.

Average gain is computed as:

05:00 as [Prev Avg Gain x 13 + (Price at 05:00 - Price 04:00)]/14.

06:00 as [Prev Avg Gain x 13 + (Price at 06:00 - Price 05:00)]/14.

What is the right way to compute RSI at a minute level? I generate trade signals (buy/sell) every 5 minutes. What is the right way to update RSI at 05:05 i.e, at a smaller granular period (5 minutes) than the calculation period (1 hour)? I don't want to wait one until 06:00 to get the RSI for the one hour period. I have two options:

Compute Current Gain = (Price at 05:05) - (Price at 05:00).

OR

Compute Current Gain = (Price at 05:05) - (Price at 04:05).
And do this for each of the previous intervals so that average gain also follows this formula - essentially adding a 5 minute shift to each computation.

Any suggestions are welcome.

use Current Gain = (Price at 05:05) - (Price at 05:00)

so at 05:59 it should be almost exactly as the new level at 06:00


Will it be possible to export a key and only allow it to be imported once? When the import/export key be implemented I would like to know if it will be possible to export a key with an option like: The exported file can only be imported one time, or that the exported key was exported with an option that removed the key from the wallet that exported it. I ask this because I would like to receive for example a exported key file from someone but with the certainty that the key is not on this someone wallet anymore (or any other wallet).

Will this be possible?

No, there is no way to keep track of what people do with their private keys. You could easily write down the key before exporting it and you can use it without ever importing it to a wallet. It's possible to construct a transaction from the private key manually or using some 3rd party software and then broadcast that transaction to the network.

It sounds like you want to be able to send money without using the blockchain by simply passing private keys around. You then run into the double-spending problem. This is exactly the problem that the blockchain is solving. So, no, if you want to securely send bitcoins you will have to use the blockchain.


Is there a list of bitcoin block explorers? Right now I mainly use blockchain.info as my main explorer, but is there a list of other bitcoin blockchain explorers as of today (2017 March)?

This may be a good place to start?

https://en.bitcoin.it/wiki/Category:Block_chain_browsers


The transaction you're trying to send spends from an segwit input, but BitPay Insight does not currently support segwit.  On segwit-supporting software, the transaction is valid:

 $ bitcoin-cli testmempoolaccept '["010000000001013920fd5fa5ff9243f96fe11f2ff032dc5842dee09c7992f81441b511ac5584020100000017160014354966a45844090d7152d104326c681ca1075e5effffffff02e8030000000000001976a914e42a54ba2042e889461c7966ac6ba13eeb144a3f88ac905f01000000000017a9148ff360136ee24aa4d5f3ed298947dbc5cfd8ebd58702483045022100c625106241f0b4e90cf4819945d1ff43f2108d9581bbc32f5052c91a28dcc9f5022031760808c4b7ca2b686ef49b9c03d486a2dfea9b85396a7f22914bf3eeeff3800121027a8d1c43339ffddeb722b92189412602720f722ed640a08dcbe7e473e71ca11600000000"]'
 [
   {
     "txid": "e4fdf857b97f1d41c277ffab61dd1367774311303db982d42f7f80e4baa4105a",
     "allowed": true
   }
]

If you just need your transaction broadcast, feel free to reply to this answer in a comment and I'll send it for you.


Get last price from Comkort exchange PHP-JSON Maybe Anybody can tell me why i got no output on my Browser with $mystring ?

http://pastebin.com/W0G4Sy4e

Shell Output : php test.php
0.01341011
0.01341011

I love using PHP!

Browser Output :
I love using PHP!

kindly regards
Jessy

This is probably due to your web server php configuration that disallow you to open a remote url (see this thread https://stackoverflow.com/q/3488425/2652054 )


Accepting payment for bitcoins online: What types of payment "cards" or epayments are non-refundable? I'd like to sell bitcoins to people online.  My question is this:

What kinds of payments can I accept online that are not refundable, or charge-backable, and can somewhat easily be turned back into a local currency via international bank transfer or other?

I know that PayPal, Credit cards, and Interac transfers can all be reversed. I've heard that things like UCash, are irreversible.... I'm new to this whole scene, and would like some informed input.

If possible, I'd like something that's available in both US and Canadian stores at a minimum, and is a "gift card" like solution that people can buy at Walmart, or their local grocery store, and could use to purchase something with me personally, or on a website. I'm flexible on almost everything except for losing payments due to chargebacks.

Western union online money in minutes. The client pays western union with their credit card, the client send you the mtcn, you pick up the funds. Pretty Much Irreversible.

Have you looked in to Green Dot Money Pak?
While not technically for payment processing, it is possible to send these to a merchant and they are non-refundable. FYI they are tracked by the federal government. Also always get a copy of their receipt and a signed waiver for anyone purchasing anything from you with a money pak.

There's a few companies that offer money pak conversion services or you could get a re-loadable card.

did i answer it thoroughly or do you need more information?


Segwit2x/btc1 block header changes: wipeout protection for SPV nodes? Are there any current plans for segwit2x/btc1 to change the block header in a backward-incompatible way, either permanently or with a signal block (e.g., "hard fork bit"), before it goes live? This is sometimes referred to as "wipeout protection."

AFAIK, btc1 will require a large signaling block. The problem is that SPV nodes won't be able to detect it because by definition they avoid downloading entire blocks. In other words, an SPV node knows nothing about block size (and can know very little about block bodies in general).

I have found nothing about this and want to confirm that the plan is really to leave the block header untouched.

If so, it looks like SPV nodes will have no way to distinguish s2x and Bitcoin chains. They will follow whichever chain has the most proof-of-work - even if that chain contains invalid block bodies. This would have serious implications for the security of funds controlled by SPV wallets.

From following most of what has been going on in the btc1 repository, it is S2x's express plan to take along SPV wallets with their hard fork. Therefore, they are limiting wipeout protection to anything that doesn't break SPV wallet compatibility. Most notably they don't plan on using the proposed hardfork bit. I believe they are going to require a block with a base size greater than one megabyte (srsly!) for the block at fork height: ISSUE/PR


Configuring GPU mining with CGminer I know GPU mining is looked down upon, but I cant afford an ASIC. SO I would like to know how to mine Bitcoin with CGminer using my gpu. Any help would be appreciated. I already am connected to a server, so I don't need help with that.

CGMiner does not support GPU mining anymore because it is too inefficient to mine Bitcoin with. It does not make sense for the authors to continue GPU mining support so they stopped doing so and it is no longer possible to GPU mine with CGMiner.


How to backup seed in lightning and give your channel to watchtower this is followup on question #85475:

I have learned in previous question that there is an automatic refund mechanism in case of force closure of a channel, except for some very rare circumstances. I would like to ask about two of those circumstances:
,

1-how to "back up your channel state" or how to back up your seed in lightning?
(is "channel state" here a synonym for "seed"?)

And why do people say the "seed" works differently in lightning compared to btc - differently how?
,

2-how can you "give your channel to a watchtower" ?  IN practical terms, if you use a current lightning wallet

thanks

For clightning I have created a video that explains how to restore your node with seed and state you can watch it here: https://youtu.be/-S7pQOw36vI

The general idea is that hsm_secret sites your seed in binary and the sqlite3 datebase sites your channel states.

I believe in lnd the process would be similar only that they give you the seed words explicitly instead of hsm_secret. They should also have some database or file in which they site channel state.

As for watchtowers. Currently to the best of my knowledge there are no such services available.


Bitcoin GetBlockWork() function The implementation of GetBlockWork() in the bitcoin v0.9.3 source (https://github.com/bitcoin/bitcoin/blob/v0.9.3/src/main.h#L815-L822) seems strange to me. The code is given below for convenience.

CBigNum GetBlockWork() const
{
    CBigNum bnTarget;
    bnTarget.SetCompact(nBits);
    if (bnTarget <= 0)
        return 0;
    return (CBigNum(1)<<256) / (bnTarget+1);
}

Why the +1 in the denominator?
And shouldn't the numerator be the maximum possible 256 bit integer, instead of 2^256?

I would expect the implementation to be:

CBigNum GetBlockWork() const
{
    CBigNum bnTarget;
    bnTarget.SetCompact(nBits);
    if (bnTarget <= 0)
        return 0;
    CBigNum bnMax;
    bnMax.SetHex("0xFFFFFFFFFFFFFFFF"); // Max 256 bit int
    return (bnMax / bnTarget);
}

This appears to be a function to calculate the average number of hashes needed to generate a particular block. (This is different from difficulty.)

I think this function is correct. To explain why, imagine that Bitcoin used 4 bit hashes instead of 256 bit hashes. This would make the range of possible values 0 to 15.

If the target were 15, that would mean that any hash would be valid. Therefore, it should take 1 hash on average to find a valid proof of work:

= (maximum possible hash + 1) / (target + 1)
= (15 + 1) / (15 + 1)
= 1

If the target were 7, that would mean that half of the hashes would be valid. Therefore, it should take 2 hashes on average to find a valid proof of work:

= (maximum possible hash + 1) / (target + 1)
= (15 + 1) / (7 + 1)
= 2

Remember, a proof of work is valid if it is less than or equal to the target. See also CheckProofOfWork().

I can't tell if this is used anywhere. This function appears to have been removed in the latest version.


BTC for political donations? When I am asked to make donations, I assure the requester that I will donate if they accept BTC.  Initially, that gets a blank look, but I wonder how it might change if more of us took that approach.  Specifically, has anyone had success with making donations, political, religious or otherwise, using BTC?

Yes, there is a number of organizations and projects that accept Bitcoin donations.

The above linked list includes political parties (e.g. Libertarian Party in the US), at least one church (St. John's in Goshen, NY), a score of open-source projects, as well as a number of charities and other causes.


How can I start off-block transaction in LoafWallet? Lightening network promise, basic principle is, transaction not need to add to blockchain but cumulate them and submit all together for a reduced amount of fee. How can I choose such an option in LoafWallet? I have not seen such an option in the app.

Lightning Network is not even live and therefor not supported yet.

Actually the Lightning Network does not quite work as you described.

You create a opening transaction which locks the funds in a multisig with the other participant. It's possible to withdraw the funds only after a specified time or to sign a transaction which pays both participants according to their needs and is spendable earlier.  If both participants agree, they sign the transaction.  The channel can then be closed by broadcasting the transaction or they can continue to keep creating a new version of the transaction with pays them different amounts depending on their needs.

This means you can have nearly unlimited transactions for the cost of one opening and one closing transaction.

However this is not live on mainnet (not for Bitcoin, not for Litecoin) and LoafWallet doesn't support it yet.


Mining software and miners verifications and how accept transactions I'm looking how the mining software works and how miners can verify the transactions and how they can accept transactions or not, and I have some questions:

What software use miners to accept transactions when they find a block, their mining software or the Bitcoin client software?

I'm searching information about Bitcoin and I don't know how miners can verify transactions, but I read here that miners that find a block can accept the transdactions that they want, but if they are "bad" or "malicious" miners, they can accept invalid transactions (double spending transactions). When this "bad" or "malicious" miner accepts the transaction this validation is broadcasted over the network to be confirmated?

Sorry for my english. If someone don't understand something of you need to explain more some questions, please reply me.

Thanks

There are many approaches to mining.

The leading approach nowadays is to use Getblocktemplate.  The wiki page for that includes a relatively easy to understand example.

There is an implementation in Python called python-blkmaker.


BTC Withdrawal from Crypto-Bridge I did a small transaction as a test.  I wanted to convert BTS (BitShares) to LTC (LiteCoin).  Couldn't find any direct exchange, so traded a token amount to BTC on Crypto-Bridge, then tried a withdrawal to Coinbase.

This is the transaction:
https://cryptofresh.com/u/neal-walters-bridge

This is the screenshot of what i entered:

Even though I entered my CoinBase receive address, the above shows I sent to CryptoBridge.  Is just a matter of waiting for it to convert and send, or did I do something wrong.  Obviously I want to verify before doing a larger amount.

The BTC arrived within an hour or so.  A little scary, but it worked. The above link never shows that Crypto-bridge send the funds, so I guess they convert it and generate a new transaction.


What is the exact consensus protocol Ripple uses? Ripple supposedly incorporates transactions into the ledger using a consensus protocol. I have been looking everywhere for a clear, formal, and precise specification of the protocol and could not find one.

Several related questions, e.g.,

What are the pros and cons of Ripple's consensus as compared with Bitcoin's proof-of-work?

and

How does Ripple solve the double-spend problem?

Only provide a vague description. More specifically, I am trying to understand the essence of the consensus: what happens if the Ripple network is split in half (for example if all communication lines between Europe and the US suddenly stop working), and each half of the network approves a ledger with a conflicting transaction. What happens when the network reconnects? How are the conflicting ledgers resolved?

If the Ripple network splits in half, then each half will validate ledgers independently, potentially with conflicting transactions. If all servers are properly configured, they will not accept any of these ledgers as fully validated, since none of them will have sufficient validations. It's possible both sides will think they're in the minority (if the split is close to 50/50).

This reflects a basic Ripple design principle -- don't tell people they can rely on results if the results are unreliable. If conditions make reliable operation impossible, it is preferable not to operate than to give people results they cannot rely on. Ripple is designed to detect these kinds of conditions.

When the network rejoins, servers will see the other ledger chain. They will gradually avalanche to the chain with more validations until one chain or the other has a super-majority of trusted validators. At that time, the network is back in agreement and everyone can again rely on the results of transactions.