ncdns uses the wrong nameserver to resolve .bit domain Basically, I'm setting up a .bit domain for my blog.  I have registered a domain using namecoin, and given it a nameserver entry on the blockchain:

$ namecoin-cli name_show d/aoeu2code
{
  "name": "d/aoeu2code",
  "value": "{\"ns\": [\"ns.aoeu2code.com\"]}",
  "txid": "a49ad527f36fc41c47b8d743d376c3b011c7999dbf4d9da64afbdb3ccbdd8934",
  "vout": 1,
  "address": "NHE7a7xJF2XMQzCwg5PLggeTdZ3yQDvqmS",
  "height": 370929,
  "expires_in": 35991,
  "expired": false
}

The nameserver itself appears to be set up correctly.  When I dig for my .bit domain, the IP shows up as expected:

$ dig aoeu2code.bit @ns.aoeu2code.com

; <<>> DiG 9.10.3-P4-Debian <<>> aoeu2code.bit @ns.aoeu2code.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17650
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;aoeu2code.bit.                 IN      A

;; ANSWER SECTION:
aoeu2code.bit.          604800  IN      A       69.180.151.171

;; AUTHORITY SECTION:
aoeu2code.bit.          604800  IN      NS      ns.aoeu2code.com.

;; Query time: 1 msec
;; SERVER: 69.180.151.171#53(69.180.151.171)
;; WHEN: Sat Nov 18 01:30:58 CST 2017
;; MSG SIZE  rcvd: 88

However, when I try to resolve my .bit domain via ncdns, it does not try to use my nameserver, it uses a different one, ns.mydomain.com.mydomain.bit instead of ns.mydomain.com:

$ dig aoeu2code.bit @localhost -p 5300

; <<>> DiG 9.10.3-P4-Debian <<>> aoeu2code.bit @localhost -p 5300
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25963
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;aoeu2code.bit.                 IN      A

;; AUTHORITY SECTION:
aoeu2code.bit.          600     IN      NS      ns.aoeu2code.com.aoeu2code.bit.

;; Query time: 0 msec
;; SERVER: ::1#5300(::1)
;; WHEN: Sat Nov 18 01:24:44 CST 2017
;; MSG SIZE  rcvd: 73

BTW, I'd also like to be able to give myself coins on the testnet chain and run tests there, since I have been having a little bit of trouble obtaining namecoins.  I can run namecoind -testnet and namecoin-cli -getinfo shows my balance is 0, but other than that I have no clue how to use the testnet chain.

I needed to put a trailing period into the "ns" record in the blockchain.  Then the correct nameserver was used.

Also, ncdns is NOT a recursive nameserver, so it returned the correct NS record but did not reach out to the nameserver for the IP.  I had to set up Unbound as described in the ncdns readme in order to actually resolve my .bit domain to an IP.


how do I transfer from watch only wallet to my other wallets I have a watch only wallet with BTC in there how do I transfer to another wallet. I don't seem to have a key is that possible? I can find it on blockchain but can't seem to do any transfers.

That's what "watch-only" means. You are only watching the balance and can't spend it. You've likely added only the address to the wallet—which anybody else could have done as well since the address is public information.

If the address is your own, check the wallet that you created the address with. That's the one that can spend it. To spend the coins, you have to have the private key.

If you actually don't have the private key, you don't have the ability to spend the coins. If nobody else has it either, the coins are lost.


How to use bitcoinjs with TestNet? One of my colleagues is trying to use bitcoinjs with TestNet, but apparently it doesn't like TestNet headers, so it doesn't work. Is there any way to make to use bitcoinjs with TestNet? Is there some specific configuration needed?

You need to run your bitcoinjs-server exit with --testnet.

bitcoinjs run --testnet

Source

Are there any existing public bitcoinjs exits running in testnet mode? I don't know.


Is it normal all testnet p2wsh cosigners have same master public key? Created a testnet p2wsh Electrum multisig 2 of 3 wallet.

When I click on the radio buttons in Wallet/Information, all cosigners have same Vpub master public key. Normal?

Asking because I am trying out Electrum Personal Server and getting the following error.

  WARNING:2019-06-28 08:15:00,335: Address not known to server,
  hash(address) =
  d***********. This
  means Electrum is requesting information about addresses that are
  missing from Electrum Personal Server's configuration file.

The EPS config.ini comments mention the following format for 2 or 3 wallets but when I use 2 Vpub Vpub Vpub the first 3 addresses of each master public key don’t match the ones I see in Electrum. Help!

  multisig_wallet = 2 xpub661MyMwAqRbcFseXCwRdRVkhVuzEiskg4QUp5XpUdNf2uGXvQmnD4zcofZ1MN6Fo8PjqQ5cemJQ39f7RTwDVVputHMFjPUn8VRp2pJQMgEF xpub661MyMwAqRbcFseXCwRdRVkhVuzEiskg4QUp5XpUdNf2uGXvQmnD4zcofZ1MN6Fo8PjqQ5cemJQ39f7RTwDVVputHMFjPUn8VRp2pJQMgEF xpub661MyMwAqRbcFseXCwRdRVkhVuzEiskg4QUp5XpUdNf2uGXvQmnD4zcofZ1MN6Fo8PjqQ5cemJQ39f7RTwDVVputHMFjPUn8VRp2pJQMgEF

Not normal, each cosigner should have a unique master public key.

There is a reported bug in Electrum 3.3.6 that causes the issue on macOS.

Until a fix is pushed to production, it’s possible to get master public keys using the Electrum console (View/Show Console).

[k.xpub for k in wallet.get_keystores()]


Change currencies through BitCoin or other Cryptocurrency I'm from Brazil and I'm going to USA in January, so I need to buy dollars.
Here in Brazil every currency exchange done have to pay a tax that is usually 7%.
But we don't have to pay that tax in cryptocurrency.
So i was wondering if I can do it through Bitcoin or other cryptocurrency.

First I would buy Bitcoin in Brazilian currency to my wallet through any exchange (Real to Bitcoin)
Second I shall sell this Bitcoin in any exchange that accept USA Dollars. (Bitcoin to Dollar)

But I don't have anywhere to keep this money.

Have anyone already done this in any currency?
Would you describe how you've done it?

With no bank account: You can buy Bitcoin in your home country then sell them for cash in person in the US through sites like Local Bitcoins once you get to the states.

With large sums of money its good practice to wait for six blocks on the blockchain before considering the transaction confirmed.

With a bank account: Non-U.S. citizens are allowed to open a bank account in the United States. You can wait to open a bank account in person when you arrive or try opening a bank account in your home country at a bank that operates in both your home county and the US. (In Brazil HSBC is one example of a bank that operates in both counties).

To sell your Bitcoins get an account at an exchange like Coinbase or Circle, trade your Bitcoins for USD there and connect that with your US functional bank account to withdraw the funds.


Do I have to pay Fees on the Lightning Network if there is a Payment Failure? Lightning nodes are talking fees for routing a payment. Will fees be charged anyway if a payment fails?

Short answer: No.

Explanation: The fees are part of the onion routing package within the HTLCs. So a routing node accepts an incoming HTLCs and forwards it if there is a difference in value that can be collected as fees. The HTLCs are conditional payments on the condition that the preimage is delivered in return. This will only happen after a path of HTLCs is successfully established. If a payment fails some node can't forward the HTLC which means that noone along the path will be able to settle the HTLCs. This in turn means no fees are being paid.


What's needed to host a competitive game site Let's say I wanted to host a site in which

users create their own accounts
they deposit bitcoins in said accounts
a commission of, say, 0.05% is kept of all the bitcoins that are deposited in the site
users play a competitive game with each other (e.g. chess, or others for more players) for a bet
the winner gets the full bet
each user can withdraw their bitcoins any time they want

This, I figure, would be quite hard to get right due to all of the different aspects involved, such as user trust, security and technicalities.

My questions are:

How do current betting sites handle the deposits/withdrawals of bitcoins, and how do they keep a commission out of it?
Any small site could rely on trust and do this in a manual fashion, but I'd assume any professional site does not handle this manually. So, is there an existing library (I'll use Node.js, in case it matters) or third-party service for this? And should the bitcoins be stored in a conventional offline wallet(s)?
And last, is there a way to "prove" that the games are fair in order to establish trust? Are there any legal requirements regarding to this?

How do current betting sites handle the deposits/withdrawals of bitcoins, and how do they keep a comission out of it?

Just like any other payment: you track the blockchain and keep balances in your server database.

You can charge the commission on deposit (e.g. 0.5% fee, when depositing 10BTC just credit 9.95BTC)
You can charge per game (e.g. when each player bets 5BTC in a 2 player game = 10BTC, only pay the winner 4.95 from their rival) and keep 0.05 (0.5%).
In betting games you can also schew the long-term statistics against you so the house has an edge (just like casino roulettes have 0, and some even 00).

  Any small site could rely on trust and do this in a manual fashion, but I'd assume any professional site does not handle this manually. So, is there an existing library (I'll use Node.js, in case it matters) or third-party service for this? And should the bitcoins be stored in a conventional offline wallet(s)?

This would work just like any other business, just browse this site. You can rely on external businesses to do this for you, or create the system yourself (leveraging libraries or not, you must listen to the blockchain events and act accordingly).

  And last, is there a way to "prove" that the games are fair in order to establish trust?

If games are deterministic (like chess) the issue boils down to trust between users (is this guy going to cheat me using a chess engine?) since you couldn't influence the outcome anyways.

If games are based on chance, either the users must have faith in you or you have to provide a way for the user to verify you're not cheating him. How such a scheme could be implemented depends on the detailed mechanics of the game (you could even leverage Bitcoin's blockchain for this).

  Are there any legal requirements regarding to this?

Dealing with the legal system is the hard part here. Just like any other legal matter... it depends on your jurisdiction! In my country you have to be audited before running a betting business.


How is the target section of a block header calculated? I've been poking around https://en.bitcoin.it/wiki/Target and I've found the current target, but I can't seem to find how it's generated. It's supposedly generated when the difficulty is adjusted, as stated here: https://en.bitcoin.it/wiki/Block_hashing_algorithm, but what exactly is the algorithm for generating the target? If someone could show me some psuedocode that would be great.

The target section of the block header is called nBits in the code.  nBits is a 32-bit compact encoding of a 256-bit target threshold.  It works like scientific notation, except that it uses base-256 instead of base-10.  For example, if nBits is equal to 0x181b8330, you would calculate it like this:

Or, more simply, you'd use the same shorthand you use with regular scientific notation:

At a re-target point (every 2,016th block), Bitcoin Core adjusts nBits according to the rules described in this answer except that it is important to note that when difficulty changes by p percent, nBits is adjusted by the inverse (-p percent).  That's because a lower target is harder to reach the way Bitcoin is implemented.
It's also important to note that you can't just adjust the exponent part of nBits in the obvious way because when Satoshi first wrote the code, he inherited from a signed type---so extra care must be taken not to create a negative nBits value.  The Bitcoin.org Developer Reference has more details (but be careful, I haven't yet had an expert review that section).


Is it possible for someone to verify that a wallet is theirs wallet, without providing their private key? I need to know with 100% certainty that someone can tell me "this is my wallet" and prove it to me.  I could of course simply get their private key/brainwallet phrase, is there any other way to do it?

Yes, you can use "Message Signing", available in most Bitcoin clients, including Bitcoin core. If I sign with my address the message "I am Meni Rosenfeld and I am proving to user127317 that this is my address", you can be sure it's mine.


Visualize Bitcoin Hashing According to https://en.bitcoin.it/wiki/Hash,

  BitCoin uses the SHA-256 hash algorithm to generate verifiably
  "random" numbers in a way that requires a predictable amount of CPU
  effort. Generating a SHA-256 hash with a value less than the current
  target solves a block and wins you some coins.

Here is an example for web logs; https://code.google.com/p/logstalgia/

Obviously solving the hash takes many iterations. I'm curious if there anything that currently lets you visualize a miner hashing?

I got linked this question.

I made a tool which includes a component that allows one to simulate mining:

http://yogh.io/#mine:last

It's not entirely accurate; it doesn't support BIP 34, so the block height is not reflected in the coinbase tx, and it's still got some bugs. Currently in alpha. But it can give you some pointers.

It'll construct a block on top of the tip of the current best chain, with a coinbase transaction and nothing else, then start hashing at 4 hashes/sec, showing every failed attempt (which at this hashrate, is likely to be all of them).


Do bitcoin pay accelerators actually work? I am asking because I have a bitcoin transaction that has been stuck for about a week. I put the one too many zeroes somewhere and the transaction only charges about 23 satoshis per byte. Also, if anyone knows some miners who could help me out, I would send them some extra bitcoin. The transaction is: 0b430ad7be7e1ce39eaaa5e8f92adb764820a8fbb8da89acd96b84f234ad0675

Some transaction accelerators work, while others are probably scam .

You can check out Bitcointalk.org->Economy->Marketplace->Sevices.
Some members there offer FREE acceleration services, and have access to a variety of pools.
However, be aware if you decide to go for the PAID services, don't fall for the scammy ones.


Where does "Included in Block" value comes from? I was exploring transactions inside of a blockchain using  this site, and inside of a transaction I noticed there is attribute called Included in Block and its description is: block this transaction is mined and confirmed in.
(I don't know does it matter but, transaction I was looking is this one)

I was wondering, how is this attribute populated? The reason of my question is that I was exploring how can you, by looking at transaction inside of your UTXO, check in which block transaction was included (and then I found this attribute). Is this the right way?
Thank you!

I was wondering, how is this attribute populated?

The site uses an index that simply remembers this information. If a block B is seen that contains a transaction T, an entry is stored in the database that signifies "transaction T is in block B".

by looking at transaction inside of your UTXO, check in which block transaction was included (and then I found this attribute)

The UTXO set does not contain this information, nor can it be efficiently requested from arbitrary nodes in the network.


Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT) Why are the substring opcodes disabled?
I understand that OP_CAT is disabled because it can blow up the stack easily (in combination with OP_DUP).
But the substring opcodes reduce the stack size.

Context:

  I'd like to use OP_LEFT to implement a proof of work requirement to
  spend a transaction. A substring operation is needed because OP_ADD
  (for salting) and OP_GREATERTHAN only work on 32bit values.

I'm afraid that my answer here can't be better than "Ask Satoshi".

There was a series of bugs found in Bitcoin's early life, and the response by its creator was to disable a number of scripting opcodes. Some of these may have been bad choices (or very wise ones...), but we don't know, and it does not matter. For all intents and purposes, these opcodes do not exist, as "reenabling" them would be just as hard as introducing them as new operations in the first place (i.e. a hard fork).


Transaction Malleability, How can I change signature? I'm kind of desperate as I can't follow some ideas that I don't understand. I hope you can help me. Thank you in advance

It's all about Segwit

Question 1) It says that when bob makes a transaction to alice, that transaction goes to bob's malicious node. then bob changes signature so that It still stays valid transaction. and After that, there's a chance that this transaction will take place quicker than the original transaction that some other nodes have in mempool. and BOb has a chance of getting double * amount that alice is intended to transfer. I'm curious what bob's malicious node change in a signature part that it still stays alice's signature and still valid? how is it possible?

QUestion 2) How does segwit work? I know scriptSig is deleted from transaction, but where is it saved?

QUestion 3) if it's saved in blockchain still, then how is it a less size and how can block have more transactions than now?

Question 4) They say signature part is saved as the merkle root hash. but how can a node check that specific signature is related to specific transaction?

THank you guys.I hope your explanation will make sense

Question 1) It says that when bob makes a transaction to alice, that transaction goes to bob's malicious node. then bob changes signature so that It still stays valid transaction. and After that, there's a chance that this transaction will take place quicker than the original transaction that some other nodes have in mempool. and BOb has a chance of getting double * amount that alice is intended to transfer.

No, Bob will not get double. He will see two transactions that conflict with each other. No additional coins are created or spent. It is just annoying and wallets do not handle these conflicting transactions very well.

  I'm curious what bob's malicious node change in a signature part that it still stays alice's signature and still valid? how is it possible?

The signature is malleable. An ECDSA signature is composed of two values, R and s. Due to how the signature verification algorithm works, it is possible to replace the s with it's negation (-s). -s is easily computable by a third party, so an attacker can compute -s, replace the s value with the inverse, and send the new transaction. Because the contents of the transaction are now different due to the replacement of s with -s, the transaction has a different id so is considered different. But it is still completely valid.

  QUestion 2) How does segwit work? I know scriptSig is deleted from transaction, but where is it saved?

Segwit defines a new transaction format which is an extension of the original transaction format. In this format, a new field is added that is known as scriptWitness. The scriptWitness is where the signatures go. For nodes that do not have segwit, they only receive transactions in the old format. They won't see the scriptWitness.

The signatures are not deleted from the transaction. They are just moved elsewhere.

  QUestion 3) if it's saved in blockchain still, then how is it a less size and how can block have more transactions than now?

Blocks are not actually physically smaller. The block size has increased without a hard fork.

What segwit also did was redefine the metric of block size from bytes to a new unit called weight. To calculate the weight of a block, you have to look at the transactions. Each byte of a transaction that is part of the original transaction format is counted as 4 weight units. Each byte that is part of the new segwit transaction format is 1 weight unit. The maximum number of weight units in a block is 4000000. The math works out such that an old node will not see a block with more than 1 MB of data (since they do not receive transaction in the new format).

So with this new definition of a weight unit, transactions without segwit have more weight units than transactions that use segwit. Thus transactions are "smaller" so more transactions can fit in a block.

  Question 4) They say signature part is saved as the merkle root hash. but how can a node check that specific signature is related to specific transaction?

The signature is not saved in the merkle root hash. You cannot save any data in a hash. The signatures are committed to in the merkle root hash. What that means is that the data that went into the merkle root hash includes the signatures. This makes it so that the signatures cannot be once the transactions are in a block. The reason that this needs to be done is because the merkle root is only over the txids, which the scriptWitnesses are not part of (they are ignored in the txid calculation). So the full transaction hash (known as the wtxid) is used in a witness merkle root which is included in the coinbase transaction. This results in that hash being part of the coinbase transaction's txid which goes into the merkle root of the block.


why verification of transaction after proof of work? I have question about bitcoin protocol. In Satoshi's paper it is mentioned that:

New transactions are broadcast to all nodes.
Each node collects new transactions into a block.
Each node works on finding a difficult proof-of-work for its block.
When a node finds a proof-of-work, it broadcasts the block to all nodes.
Nodes accept the block only if all transactions in it are valid and not already spent.
Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

My question is, in step 5 nodes accepts the transactions if they are valid, so if a transaction is detected as "not valid" by a node after proof of work (i.e. step 4) it will not be accepted. I think if it is true, the power that is used for proof of work is wasted and it is not acceptable. I wanted to know am I understand this process well and is my assumption correct?

I will appreciate any guide and help.

Thank you

I'm not sure how exactly it was described in the whitepaper, but obviously every node checks new transactions for validity before adding them into their block template. i.e. between step 1 and step 2. As you stated, it would not make sense to waste energy on finding a proof-of-work without checking validity in beforehand.

However, each node needs to still check the validity of a block after it's been found. Otherwise they would be trusting the block author to have adhered to the rules. Why trust, when it's cheap to verify? ;)


How to calculate the size of multisig transaction? Can you help or suggest the formula for calculation of simple multi-sig transactions?

I have an issue to calculate the size of multi signature  2-2 transaction.

I tried to follow this:
Predict multi signature transaction size answer, however it is vague and unclear.
Here are my calculations:

 pubKeySize = 33;
 sigSize = 72;
 n = (m = 2);
 sizeOfRedeemScript = 1 + n * pubKeySize + 2;
 sizeOfScriptSig = 1 + m * (1 + sigSize) + 2 + sizeOfRedeemScript;
 sizeOfInput = 32 + 4 + 2 + sizeOfScriptSig + 4;
 sizeOfScriptPubKey = 2 + /** what is the length of script??  */ len(script);
 sizeOfOutput = 8 + sizeOfScriptPubKey;
 sizeOfTx = 4 + 2 + sizeOfInput + sizeOfOutput + 4;

If to be more precise I didn't get what is SizeOfVarIntFor(lengthOfScript) and what is the  len(script) (how to calculate it?)

Let's re-write and calculate from scratch as the calculations that you have posted might not be self-explanatory in itself and some of them are not entirely accurate. From the question, I presume you are trying to find the size of transaction for spending bitcoins from a multi-sig address.

Redeem Script Size

I think there is an error in the size of redeem script that you posted. You need to include the size of OP_DATA as well which comes prior to each public key. It tells the program how many bytes needs to be pushed to the stack. Let's assume we use compressed public keys which are 33 bytes in size. So the total size of redeem_script is 1 + N + 33*N + 1 + 1 = 3+34*N

OP_M: 1 byte
OP_DATA: 1 byte (pub_key length) * N
pub_key: 33 bytes * N
OP_N: 1 byte
OP_CHECKMULTISIG: 1 byte

scriptSig size

I think there is also inaccuracy in the data you posted for this section. ECDSA signatures (including SIGHASH flag) can be 71, 72 or 73 bytes (73 bytes is non-standard as standardness requires low-S value but still flies by consensus). So from a conservative perspective you need to assume 73 bytes for each signature required. Below is the calculation. So you need 1+M+73*M+1+3+34*N = 5 + 74*M + 34*N

nil_length: 1 byte
OP_DATA: 1 byte (len of signature to follow) * M
signature: 73*M
redeem_script_length: 1 byte
redeem_script_size: 3 + 34*N

Input Size Calculation

This section assumes there is only one input that consumes the bitcoins from the multi-sig address. Total input size is 46 + 74*M + 34*N

previous_out_point: 36 bytes
    txid: 32 bytes
    vout_index: 4 bytes
var_int: 1 byte (script_sig length)
script_sig: 5+74*M+34*N bytes
sequence: 4 bytes

Locking Script Size Calculation

P2PKH: 25 bytes
    OP_DUP: 1byte
    OP_HASH160: 1 byte
    OP_DATA (size of scriptPubKey to push): 1 byte
    scriptPubKey: 20 bytes
    OP_EQUALVERIFY: 1 byte
    OP_CHECKSIG: 1 byte

P2SH: 23 bytes
    OP_HASH160: 1 byte
    OP_DATA: 1 byte
    scriptPubKey: 20 byte
    OP_EQUAL: 1 byte

P2WSH: 34 bytes
    - OP_0: 1 byte
    - OP_DATA: 1 byte (witness_script_SHA256 length)
    - witness_script_SHA256: 32 bytes

P2WPKH: 22 bytes
    - OP_0: 1 byte
    - OP_DATA: 1 byte (public_key_HASH160 length)
    - public_key_HASH160: 20 bytes

TX_out_size

value: 8 bytes
len of script: 1 byte
script length: variable as defined in previous section

Total Transaction Size

Let's first calculate the size assuming no SegWit. Then we will look at how SegWit helps in reducing transaction size.

version: 4 bytes
count_tx_in: 1 byte (variable but since we have one input can be represented in 1 byte)
inputsize: 46 +74*M + 34*N
count_tx_out: 1 byte (variable again)
tx_out (assuming one input to P2PKH): 34 bytes
locktime: 4 bytes

So your total size is 90 + 74*M + 34*N. Assuming M=N (as your question dictates) the size is 90+108*N.

Size with SegWit

With the implementation of Segwit, we now count transaction size in weight units and not bytes. Normal transaction size is multiplied by 4 and witness data is multiplied by one. In the previous example our WU will be 360+432*N.

In segwit, we will discount the scriptSig by 4 and add one weight unit that signifies the  number of witness elements. So our transaction size is

traditonal tx: 360 + 432*N WU
- scriptSig: (5 + 108*N)*4 = 20 + 432*N WU
= witness_stripped: = 340 WU
+ number of witness elements: 1WU
+ scriptSig: 5 + 108*N WU
= total: 346 + 108*N WU


Where are statistics data about stolen bitcoins and successful attacks? I am looking for data about stolen bitcoins. Is somewhere statistics about how many bitcoins were stolen etc.? I only know that bitcoins were stolen in Mt.Gox and Flexicoin...

There is no evidence that Mtgox has been hacked, it may be a fraud.
There is only one bitcoin theft that is fully documented. You can find details here


When was the first non-coinbase transaction? What's the block number? Also if it was a test transaction, then what was the first event of real commerce if know?

The first non-coinbase transaction in the chain is in block 170.  Not sure what you would consider a 'real' versus a 'test' transaction, but given that there is an entirely separate blockchain for test transactions I'd consider it as real as any other.


Parse UTXO of a transaction from chainstate I'm doing some analysis on the UTXO set by reading from the chainstate database.

I was following the documents given by https://github.com/bitcoin/bitcoin/blob/d4a42334d447cad48fb3996cad0fd5c945b75571/src/coins.h#L19-L34

/** pruned version of CTransaction: only retains metadata and unspent transaction outputs
 *
 * Serialized format:
 * - VARINT(nVersion)
 * - VARINT(nCode)
 * - unspentness bitvector, for vout[2] and further; least significant byte first
 * - the non-spent CTxOuts (via CTxOutCompressor)
 * - VARINT(nHeight)
 *
 * The nCode value consists of:
 * - bit 1: IsCoinBase()
 * - bit 2: vout[0] is not spent
 * - bit 4: vout[1] is not spent
 * - The higher bits encode N, the number of non-zero bytes in the following bitvector.
 *   - In case both bit 2 and bit 4 are unset, they encode N-1, as there must be at
 *     least one non-spent output).

The parser worked fine when the number of UTXO is small. However for the following tx (which have 2501 outputs), it failed:

2540b961f4a0b231db3bc5a23608307394eae037d8afd0462e9b794e02f00000

For the key 'c' + 2540b961f4a0b231db3bc5a23608307394eae037d8afd0462e9b794e02f00000, the (deobfuscated) value in chainstate looks like this:

01907050e140254150443a0c280004...

Where 01 is the version, 9070 is the nCode which tells if its a coinbase tx, the unspentness of vout[0], vout[1], and the length of the following unspentness bitvector for vout[2:]. By looking at blockchain.info, there are 2501 outputs, so there shall be (2501 - 2)/8 = 312 bytes following. However, parsing 9070 as a varint, removing the last thee bits, and +1 only give me 2288 / 8 + 1 = 287. (I got 2288 by (0x90 - 0x80 + 1) * 0x80 + 0x70, which is the MSB-128 varint used in bitcoin protocol.)

Did I missed something here? How exactly does one parse the varint?

You are right, however you are not interpreting the result correctly. The value is indeed 287, that is (2288 >> 3)  + 1, however this does not mean that the bitvector contains 287 bytes, but that it contains 287 non-zero bytes, so when parsing the bitvector, you should decrease the byte counter only when you find a non-zero value. Here you have a piece of code that deals with this (n is 287 in this case):

# If n is set, the encoded value contains a bitvector. The following bytes are parsed until n non-zero bytes have
# been extracted. (If a 00 is found, the parsing continues but n is not decreased)
if n > 0:
    bitvector = ""
    while n:
        data = utxo[offset:offset+2]
        if data != "00":
            n -= 1
        bitvector += data
        offset += 2

Notice that this is just a fragment of the code. I've coded a full decoder in Python recently, you can check out the code on github.


What is the safest medium on which to store my wallet/private keys? What is the safest medium on which to store my wallet/private keys?

I avoid eWallets like the plague.

I have my wallet on my computer at the moment with the Bitcoin passphrase encryption and I have a few backups on different harddrives/USB drives.

But USB drives don't seem to be the most reliable thing to store wallets on, and I want to move my wallet off my computer for improved safety, so I was looking at paper wallets and they seem good apart from if they deteriorate over time, or from things like water damage etc.

CDs seem okay to use but they can also get scratched and can't be updated once burnt.

I'd also rather avoid cloud file services.

A plastic card that I could print my public/private keys on seemed like a good idea, but this would have to be printed by a third party as card printers are expensive, unless there's somewhere I can go to do it myself.

Any recommendations on the safest medium to store Bitcoins on?

Print out your private keys to a Paper Wallet and print the keys on Archival Quality Paper. Those should last until the year 2211. They are however un-encrypted so you should store them in a bank safety-deposit-box or somewhere just as safe.


Streaming API for confirmed transactions? Is there an API that makes streams transactions as they're confirmed? Everything I can find seems to just be putting out unconfirmed transactions in realtime, rather than waiting for confirmation.

To clarify, I'm looking to stream all transactions, not just one wallet.

You can't really "stream" them. Transactions get confirmed once included in a block. So for 10 minutes you would have nothing and then all of a sudden there would be a 1,000+ transactions with a confirmation. If that's what you're looking for you can just use something like https://blockchain.info/block-index/$block_index?format=json and replace $block_index with the latest block. The json will respond with all transaction id's in an array that were included under "tx":

https://blockchain.info/api/blockchain_api

EDIT:
Blockchain.info has all the info you need.
First get the current block height which you can get from https://blockchain.info/stats?format=json

$bcinfo = json_decode(file_get_contents("https://blockchain.info/stats?format=json"), true);
$latestblock = $bcinfo["n_blocks_total"];

Then plug the current block into https://blockchain.info/block-height/$latestblock?format=json

$getblock = json_decode(file_get_contents("https://blockchain.info/block-height/".$latestblock."?format=json"), true);

Then just count the amount for each array and run a for loop to grab each input(from address) and each output(receiver) along with the time.

Here's one I did quickly in PHP: http://phpfiddle.org/lite/code/k16m-r8fh

<?php
$bcinfo = json_decode(file_get_contents("https://blockchain.info/stats?format=json"), true);
$latestblock = $bcinfo["n_blocks_total"];
$getblock = json_decode(file_get_contents("https://blockchain.info/block-height/".$latestblock."?format=json"), true);
$counttxs = count($getblock["blocks"][0]["tx"]);
for($i=0;$i<$counttxs;$i++){
    //tx time
    $timetx = $getblock["blocks"][0]["tx"][$i]["time"];
    $date = date('Y-m-d, H:i:s', $timetx);
    echo $date."
";
    //count inputs
    $countinputs = count($getblock["blocks"][0]["tx"][$i]["inputs"]);
    for($ii=0;$ii<$countinputs;$ii++){
        //get input address
        $addr = $getblock["blocks"][0]["tx"][$i]["inputs"][$ii]["prev_out"]["addr"];
        echo $addr ? "INPUT: ".$addr."
" : "";
    }
    //count outputs
    $countouts = count($getblock["blocks"][0]["tx"][$i]["out"]);
    for($iii=0;$iii<$countouts;$iii++){
        //get output address
        $outaddr = $getblock["blocks"][0]["tx"][$i]["out"][$iii]["addr"];
        echo $outaddr ? "OUTPUT: ".$outaddr."
" : "";
    }
    echo "

";
}

?>


Shabal256 code explanation Can anyone please explain the code below with comments?

What are pbegin & pend ?

What is ( I believe it is data, where it comes from ?): (pbegin == pend ? pblank : static_cast<const void*>(&pbegin[0]))

What is (I believe it is the size of data 80?) : (pend - pbegin) * sizeof(pbegin[0])

What is : pblank[1]

template<typename T1>
inline uint256 HashShabal(const T1 pbegin, const T1 pend)
{
    sph_shabal256_context ctx_shabal;
    static unsigned char pblank[1];
    uint256 hash[1];
    sph_shabal256_init(&ctx_shabal);
    // ZSHABAL;
    sph_shabal256 (&ctx_shabal, (pbegin == pend ? pblank : static_cast<const void*>(&pbegin[0])), (pend - pbegin) * sizeof(pbegin[0]));
    sph_shabal256_close(&ctx_shabal, static_cast<void*>(&hash[0]));

    return hash[0];
}

What are pbegin & pend ?

Pointers to the beginning of the data and one byte past the end of the data, respectively. The function it's wrapping takes a pointer to the beginning plus the the size, so it needs to do some math with the pointers.

  What is (I believe it is data, where it comes from ?)

Presumably, if you found this code in a Bitcoin derivative, the data is a block header. This function might also be used to build a merkle tree. (Shabal256 appears to be fast enough for that.)

  What is : pblank[1]

A zero-length string. Presumably, sometimes this function gets called as HashShabal(NULL, NULL), so this is for avoiding a null pointer exception.

  Can anyone please explain the code below with comments?

The purpose of this function appears to be to wrap the Shabal256 functions from Projet RNRT SAPHIR to make them easier to use.


What is the alt stack? I noticed in the bitcoin wiki script page (https://en.bitcoin.it/wiki/Script) that there were two opcodes named:

OP_TOALTSTACK
OP_FROMALTSTACK

It looks like there is another stack that can be used separately as a data store, simply pushing and popping data. I've never heard of this before, but it seems like a very useful feature.

Can anyone verify that this is what the alt stack is actually meant to be used for? If not for just pushing and popping data, what is it for? Do any specific use cases come to mind?

Here's where they're defined:

            case OP_TOALTSTACK:
            {
                if (stack.size() < 1)
                    return false;
                altstack.push_back(stacktop(-1));
                popstack(stack);
            }
            break;

            case OP_FROMALTSTACK:
            {
                if (altstack.size() < 1)
                    return false;
                stack.push_back(altstacktop(-1));
                popstack(altstack);
            }
            break;

Example:

Stack:
Alternate Stack:
Script: OP_1 OP_2 OP_TOALTSTACK

.

Stack: 01
Alternate Stack:
Script: OP_2 OP_TOALTSTACK

.

Stack: 01 02
Alternate Stack:
Script: OP_TOALTSTACK

.

Stack: 01
Alternate Stack: 02
Script:

  what is it for? Do any specific use cases come to mind?

It's... use-impaired. 99% of the time, you can avoid using OP_(TO|FROM)ALTSTACK by putting things onto the stack in a different order. There are 18 stack manipulation operators, but only one (OP_DUP) is used with any regularity. I'm of the opinion that Bitcoin scripting is overcomplicated for its intended use.


Bitcoin-Qt wallet shows outgoing transaction as "Offline (0 confirmations)" What is the meaning of a transaction status of "Offline (0 confirmations)" as opposed to "Unconfirmed (0 confirmations)" ?

Does it mean that the transaction has not even been sent to the network yet?
If so, why would that happen, and can I force it to retry?

The wallet is online (13 active connections to the network), but out-of-sync (catching up very slowly, last received block was 1100 days ago).

Offline means that the transaction hasn't been sent to the network, that is, it's not in the memory pool of any other node.

Unconfirmed means that the transaction has been sent to the network and exists in the memory pools of many other nodes.

If the wallet is out-of-sync, that would be the reason it's got 0 confirmations. Even if you did have a confirmation, your node wouldn't know it since the transaction would be in one of the newest blocks.

If the transaction is not on blockchain.info, there's a very good chance that it hasn't been sent. You should probably resend it using the instructions found here.


How to cash out a Bitcoin wallet into fiat anonymously? If bitcoin is converted to fiat money on an exchange, the exchange has irrefutable knowledge of your identity because they require the account name and bank account name to match.
The only way to anonymize a withdrawal of bitcoin-converted fiat would be to first transfer a non-exchange bitcoin wallet to the exchange-based bitcoin wallet using a bitcoin tumbler or mixer so that it looks clean. It would longer matter whether account names match to the withdrawer because the exchange, at least, would no longer know the real source of the funds. However, the fiat is still associated with your name. So the tumbler approach is not really anonymization, but merely anonymization of the source.
How else can bitcoin-sourced fiat be withdrawn anonymously?

If bitcoin is converted to fiat money on an exchange, the exchange has irrefutable knowledge of your identity because they require the account name and bank account name to match.

Use Bisq and other non-KYC Exchanges. Also follow the best practices mentioned in this comment:

Don't reuse addresses.

Use coinjoin and payjoin when required.

Run and use your own full node (with Tor), open source block explorer etc.

Use an open source bitcoin wallet with active development: https://bitcoinwallet.guide

Do not share information about your transactions on social media


Blockchain.info "Too Many Requests" - Alternative solutions that can be hosted by myself I'm trying to build out a Bitcoin service that requires me to query address balances and other data. So far I've been just using blockchain.info to do these request, but lately i'm hitting the too many request error. I've looked into alternatives, but many of these just went belly up over the years. Blockchain.info seems to be best long standing one that is free up to a point. Even blockstream.info has a limit.
Is there some type of locally hosted service I can just use it for the same type of query data like blockchain.info? I understand I'll need to install bitcoind and download the entire blockchain.

You should check https://github.com/janoside/btc-rpc-explorer
BTC RPC Explorer is a simple, database-free self-hosted explorer for the Bitcoin blockchain, driven by RPC calls to your own Bitcoin node. It is easy to run and can be connected to other tools (like ElectrumX) to achieve a full-featured explorer.
Whatever reasons one may have for running a full node (trustlessness, technical curiosity, supporting the network, etc) it's helpful to appreciate the "fullness" of your node. With this explorer, you can explore not just the blockchain database, but also explore the functional capabilities of your own node.
Live demo available at: https://explorer.btc21.org


What and where is the easiest way to convert bitcoin back to cash without showing ID? so im thinking about purchasing a big bitcoin miner, but the question now is how do i convert my BTC back to cash? I don't feel safe giving out my info to mtgox or other exchanges as they require identification. So what is the easiest way without having to go through a bunch of steps to conver it back to USD?

The factors that matter for any cash-out decision are:

Where are you located (country)?
How much are you looking to trade?
What type of cash are you looking to receive?
How soon do you need access to the proceeds?
Is privacy important?

In the U.S., Coinbase might be the simplest -- you can sell up to 100 BTC per day, with a fee of 1% and then from there the USD proceeds are redeemed to your bank.  But that is a cash-out method using the banking system, so it is not anonymous or even close.

Other popular methods include FastCash4Bitcoins.com (now BitSimple.com), which can cash out to your PayPal, Dwolla, ACH (Direct Deposit), Bank Wire, Check, bank wire, or silver bullion.

For privacy, you might consider LocalBitcoins, in which a local cash transaction occurs, face-to-face.

http://www.LocalBitcoins.com

There are dozens of cash-out methods:

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


How to connect to bitcoind from ruby rpc client? I have started bitcoind. It is working fine but how can I connect to it from rails on localhost?

you will communicate over RPC/JSON

There is an example in the official doc :

require 'net/http'
require 'uri'
require 'json'

class BitcoinRPC
  def initialize(service_url)
    @uri = URI.parse(service_url)
  end

  def method_missing(name, *args)
    post_body = { 'method' => name, 'params' => args, 'id' => 'jsonrpc' }.to_json
    resp = JSON.parse( http_post_request(post_body) )
    raise JSONRPCError, resp['error'] if resp['error']
    resp['result']
  end

  def http_post_request(post_body)
    http    = Net::HTTP.new(@uri.host, @uri.port)
    request = Net::HTTP::Post.new(@uri.request_uri)
    request.basic_auth @uri.user, @uri.password
    request.content_type = 'application/json'
    request.body = post_body
    http.request(request).body
  end

  class JSONRPCError < RuntimeError; end
end

if $0 == __FILE__
  h = BitcoinRPC.new('http://user:password@127.0.0.1:8332')
  p h.getbalance
  p h.getinfo
  p h.getnewaddress
  p h.dumpprivkey( h.getnewaddress )
  # also see: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
end


Why do prices of all cryptocurrencies move in sync? For example, when bitcoin moves up/down, most other cryptocurrencies also move for a similar amount. What is the reason behind this? I almost see no point in investing in different cryptocurrencies, when it seems that when Bitcoin falls, Ethereum (or any other crypto) also falls.

Only reason I can figure out myself is because all cryptocurrencies belong into the same group of currencies, but is there something else that affects these same price changes?

The reason is that many altcoins are traded in BTC/ALTcoin pairs, not $$/ALT pairs.

So if an altcoin is trading 0.1 BTC/ALT, and the dollar price of bitcoin falls, then the $ price of the ALT will fall an equal amount.

Some altcoins trade against dollars as well, so their dollar price may be less coupled to the BTC dollar price. But for many of those alts, a large amount of the trading volume will still be from the BTC/ALT pair, and so the influence is still there.


Do any altcoins use a DHT for connecting to peers? Bitcoin doesn't use a DHT for connecting to peers. Are there any altcoins that do?

As far as I know, Both Eth(https://github.com/ethereum/wiki/wiki/Kademlia-Peer-Selection) and Ada(https://cardanodocs.com/technical/protocols/p2p/) use Kademlia DHT.


When downloading the blockchain my application is become unusable, is there an issue with my code or am I using the BitcoinJ library incorrectly? I am building a Bitcoin wallet with the BitcoinJ Library, after looking at the example of fetching a transaction that they have shown on their github it shows that you need to download the blockchain however.

When attempting to download the blockchain to view the balance of my wallet, it begins to lock up and become unusable. I have even tried downloading the blockchain in an async task like so, but still the app becomes completely unusable and the UI doesn't even load. What am I missing? I thought that the download wouldn't be that large as I am attempting to create an SPV wallet which from what I understand doesn't download the entire blockchain, or is this something I need to configure seperately?

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
         DownloadBlockchain().execute()
    }

    inner class DownloadBlockchain : AsyncTask<Void, Int, String>() {
        override fun doInBackground(vararg p0: Void?): String {
            Globals.peerGroup?.startAsync()
            Globals.peerGroup?.downloadBlockChain()
            return "complete"
        }

        override fun onPostExecute(result: String?) {
            super.onPostExecute(result)
            Globals.peerGroup?.stopAsync()
            Globals.wallet?.saveToFile(Globals.walletFile)
        }
     }
 }

The downloadBlockChain() method looks like it downloads the whole blockchain. It looks like the PeerGroup.setFastCatchupTime method might be helpful to prevent it from downloading full blocks before that time. I imagine you'll use a method or change a boolean value to only download block headers for your SPV wallet, but I don't know where that would be.

https://bitcoinj.github.io/speeding-up-chain-sync may be a useful reference.


How can I view all the NXT nodes that I can access publiclly? Where can i find a list of NXT IP nodes that I can connect to publicly? I want to be able to use them as a backup connection to the nxt blockchain if my own nxt server crashes.

See http://www.peerexplorer.com/api for a list of active peers including their public API status


Why does BIP174 take Xpubs but no addresses? I have a few questions on BIP 174:
XPUBs: I am looking at BIP174, and I see that I can define a global XPub. How is this used. How does an updater, signer, or finalizer know what this XPub is for? Doesn't this expose some privacy?

Public Keys: For outputs, do I have to enter the public keys? Is there no option to enter an address instead?

Inputs: An input Non-Witness UTXO seems to require the entire previous transaction, instead of simply the txid and vout. Why is this?

How does an updater, signer, or finalizer know what this XPub is for?

It's not just an xpub. It's an xpub with key origin information. The fingerprint of the master public key and the derivation path to that xpub is provided. This means that a prefix match can be done with the derivation paths given in the input and output maps to find which xpub can be used to derive a particular pubkey.

  Doesn't this expose some privacy?

Yes.

  For outputs, do I have to enter the public keys?

No. You don't have to provide any information for the output maps.

  Is there no option to enter an address instead?

No. Addresses are not useful in PSBTs.

The output fields do not specify the outputs themselves. That is done in the global transaction. Addresses only serve to specify the scriptPubKey to use in an output. The global unsigned transaction already has the output specified with their scriptPubKeys. So providing an address is not useful as it is just duplicate information.

  Inputs: An input Non-Witness UTXO seems to require the entire previous transaction, instead of simply the txid and vout. Why is this?

The txid and vout are already provided by the Global unsigned transaction. Both the Non-witness UTXO and witness UTXO are needed in the inputs in order to sign the transaction. The signing algorithm requires knowing the scriptPubKey for the output being spent, and for segwit, the amount too. The full previous transaction needs to be provided to prevent attacks where users are signing for an output that they don't intend to spend. By providing the full transaction, signers can verify that the txid they compute for it matches the txid that is specified in the global unsigned transaction.


Altcoin - genesis block - TypeError: __init__() takes exactly 2 arguments (3 given) I'm trying to use the genesis script from innova to generate a genesis block of Xevan_hash

https://github.com/innovacoin/GenesisH0/blob/master/genesis.py

I'm using these parameters:
python genesis.py -a xevan_hash -z "a news string" -p "myprivate key"

and I always get this error:

Traceback (most recent call last):
  File "genesis.py", line 224, in <module>
    main()
  File "genesis.py", line 15, in main
    tx = create_transaction(input_script, output_script, options)
  File "genesis.py", line 74, in create_transaction
    Bytes("version", 4),
TypeError: __init__() takes exactly 2 arguments (3 given)

Run the following command in your terminal:

pip install construct==2.5.2

Then try to run the python script again.


Bitcoin POS: payments between seller and buyer My application has sellers with stored (public) Bitcoin addresses - lets say "receiving address".

Also application allows anonymous buyers who can buy goods from these sellers paying by bitcoins.

What I need is that money from the buyer to come to seller as fast as it possible. To do it now I am using https://blockchain.info/api/api_receive service to generate unique  payment address for each payment. So, I can see that payment was done in a second, and using their callbacks I will know when payment is confirmed and redirected to the seller account.

This way works, but I am not comfortable with this. Different reasons - depending on blockchain.info, redirecting money takes from 10 mins to some hours.

I started using this ways 3 years ago but I fill it can be another way to do this properly.
Do some one has another solution for associating payment with order.

Also another questions - is it any way to make payment to Seller address directly and associate this payment with the order.

Thank you in advance.

There is nothing you can do to speed this process up unless you are running a local copy of bitcoind or btcd to be able to query the blockchain yourself using JSON-RPC.

This is not much of an answer, but unless you can give more specifics, I can't really advise further.


Simple GPU miner with long pooling C++ I want to write own GPU miner, but I can't find any simple solution (cgminer and RPC miner are big projects with many useless to me functions). I need the sources of only one GPU miner with long pooling, nothing more.

This is the simplest miner I know of:

  pyminer

  This is a 'getwork' CPU mining client for bitcoin.

  It is pure-python, and therefore very, very slow.  The purpose is to
  provide a reference implementation of a miner, for study.

This doesn't support long polling, but there's a spec for that here.

:)


Should an end-user download the whole blockchain? Or is a “lightweight” client sufficient? The average user normally doesn’t want to host a 3+GB file on his machine and wait for hours for it to download.

What are the security risks of running a lightweight client? And how does this affect my daily transactions?
What features does a “full” client offer a “lightweight” does not?

For the MultiBit client:
(disclaimer: I am the lead dev)

1) as you are not running a full node, you are not helping relay transactions nor mining nor verifying blocks.

2) if an attacker can surround your network they can feed you spurious transactions and a fake but well formed alternate fork. (I guess this is true for bitcoind too).

3) MultiBit does not keep a database of unspent transaction outputs so importing an arbitrary key is slow.

4) you ARE downloading the full blocks and parsing them (though not storing the full blocks) so you can keep up to date with blockchain reorgs and such like.

5) an unconfirmed transaction cannot be verified by checking all the inputs are unspent and thus you cannot rely on it until it is confirmed. A full node can check everything about the transaction. Only when it appears in a block (on the main chain) can you have any confidence in it.

6) not actually related to architecture but important for security: only the beta MultiBit code has encrypted wallets.

7) compared to bitcoind, the lightweight clients have less manpower working on them. If you want to use bitcoin in, say, a company environment then bitcoind would be the safer option.

In summary: there are a few limitations caused by not having access to the full block chain locally but for everyday use they should not hinder you too much. Factors more to do with what the devs have managed to implement (or not) probably make a bigger difference.


How to get litecoin address balance? I have an address :LUiTUnmBLQ6mvCXk2YNxiU7cZQdty1pToV
when I check it on http://block-explorer.com/address/LUiTUnmBLQ6mvCXk2YNxiU7cZQdty1pToV
I get Received: 1,199.9 LTC. is there another way to check it throw API or the wallet RPC ?
keep in mind the address is not on my wallet but is from a wallet that is disconnected from internet.
I've tried to call method :
￼
getreceivedbyaddress LUiTUnmBLQ6mvCXk2YNxiU7cZQdty1pToV 1
on my local wallet
but get zero.

When I do

litecoind getreceivedbyaddress LUiTUnmBLQ6mvCXk2YNxiU7cZQdty1pToV

I get

0.00000000

I think this will always be 0.000 unless the address in your wallet.dat. One way would just be to include that addresses wallet.dat file in your litecoind directory and then just do

litecoind getbalance


When does Bitcoin update the UTXO set? I am kind of confused with something. I hope you can clarify it for me...
Let's say I want to make a transaction. So my exchange wallet does that for me. The way it does this is it first grabs the UTXO list (let's say it has that on disk D), grabs those that can be used, and using those UTXO creates a transaction with the valid inputs. Then, this transaction goes to the node's mempool. Then, when starting to mine a block, the node grabs those transactions, puts them in a block and mining starts.
Question 1) when will the UTXO list be updated on disk D? Before putting a transaction into a mempool, or after a miner solves a block or maybe at that time when the miner grabs transactions from the mempool?
If the answer is: before putting a transaction into a mempool, then, things get complicated because if that node doesn't solve the block, there's a chance that updating UTXO shouldn't have happened, so it means that the node will revert the utxo back to what it was.
If the answer is: after a miner solves a block, then it's possible that my node will let me do the same transaction twice, since before creating a transaction, it checks UTXO list.
If the answer is: when a miner grabs transactions from mempool, then this is pretty wrong, since mempool already contains validated transactions.
What do you think?
UPDATE QUESTION:
Let's say I have 1 BTC and published 1BTC transaction to Bob on nodeA and the same 1BTC transaction to Alice on nodeB.
So, let's say transaction broadcasting didn't happen, so they(nodeA, nodeB)  don't know each other's transaction.
Now, nodeA mined a block first and broadcasted the block. nodeB received this block. Now, nodeB uses lots of different UTXO's as you stated. One check that gets done is nodeB loops through the nodeA's block's transactions and if any of the transaction can be found(compares transaction id's) in its mempool, it removes it. Now, How will nodeB remove the transaction to Alice(which is now a double spend) ? How does it come to this conclusion ?

This is implementation dependent, but in Bitcoin Core there is not just a single UTXO set:

The UTXO set on disk in the chainstate/ directory in a database. It corresponds to the state as of the last flushed block (and does not include the effects of any mempool transaction, or of any block since the last flush).
The in-memory coins cache is a cache on top of the UTXO set on disk (1), with spends/creations from recent unflushed blocks applied. It only physically stores the changed values; querying it for other UTXOs will cause a read from the disk database (1) instead.
The mempool implicitly defines yet another UTXO set on top of (2). This isn't materialized at all: when querying, we just check if either (2) or the mempool has the transaction output asked for AND whether there is no mempool transaction that spends it. The mempool is always kept consistent with the blockchain (e.g. if a transaction is confirmed that conflicts with a mempool transaction, that mempool transaction is deleted).
During processing of a block, a temporary cache of UTXO changes is maintained, as a patch on top of (2). This allows blocks to spend outputs created by themselves, while if a block is invalid for whatever reason, that temporary cache can just be thrown out without doing extra work. Only if the block is actually completely valid are the changes from this temporary cache merged into (2), and the mempool (3) updated to be consistent with the result.
Wallets conceptually also maintain their own set of UTXOs (that are watched and/or spendable by the owner), though they don't use the same interface in the codebase. This is necessary because a wallet may contain transactions that are unconfirmed and aren't in the mempool (e.g. because they were removed due to eviction, but we still want to retry inserting them).

Finally it's important to note that every node has its own UTXO set(s). Your own wallet/node won't be updating anything when a miner (which one?) starts including your transaction in their candidate blocks - you don't even have any way of knowing they're doing so.


How can I mine PeerCoin? I was wondering how I could mine peercoin - I already have experience mining Bitcoins and Litecoins, yet I can't seem to find any software where I can mine them - I would like to be able to mine them on my mac with a GPU, so any applications, or terminal commands would be a great help... I already have my Peercoin wallet and everything set up. I have tried CGMiner except in the recent update they completely dumped support for GPU mining.

You can use this simple guide from peercointalk to help you mine on a mac.


In the bitcoin scripting language, how can I access other outputs of the transaction? Or how else can I limit how the coins may be spent? Is there any way to add an opcode to a UTXO that prevents how the coins are spent?

For example, in order to to spend the output, a person must send X number of bitcoin to Y address within the accompanying transaction.

There is no way to enforce a rule regarding the nature of an output when an input is spent. You will have to enforce this off chain in some manner, perhaps through multisig schemes where one key is held by a rule engine that will only sign the tx if your requirements are met.


How much memory(RAM) is used by the mem pool and UTXO pool I know I can set -dbcache=<MB> when starting bitcoind.
Does this effect how much RAM is allocated for the UTXOPool or UTXOPool + mempool?
How can I know how much RAM does each database take in RAM?

If the UTXO pool is 2.7GB, and I set -dbcache=4096, what happens to the rest of the alloated memory?

In Bitcoin Core, there are two settings, -dbcache and -maxmempool, defaulting to 450 and 300, respectively.

The mempool can only occupy as much as is configured through -maxmempool.

The UTXO set cache can occupy as much as is configured through -dbcache plus the amount of configured mempool space that is currently unused. The memory usage is however much higher than the equivalent representation on disk - loading the entire UTXO set would require 6-7 GiB at the time of speaking.

The in-memory representations are always larger. On disk they're just packed sequences of bytes. In memory, there are indexes and pointers, and memory allocation overhead - all to speed up access. The blowup factor for UTXO data is larger than for memory.

Since 0.14, the mempool is also saved to disk at shutdown (but not continuously).

So far, there is no prioritization done on the UTXO cache. We just keep all accessed entries around, and when it grows too large, all the modified entries are written to disk. One (very) significant optimization is that when a UTXO is created and then spent, without being written to disk in between, we just remove it from memory.


How can I read information from the blockchain? I don't want to use an existing service, like Blockchain.info or BlockExplorer.com. Is there some library out there that will let me read the blockchain programatically?

This can be done with some degree of effort using the Bitcoin API.

v0.7 getrawtransaction gives you access to transactions even those not in your wallet.

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

There are other tools that you can use to build this capability as well.

libBitcoin
Armory (see Extras)
Bitcoin ABE
BitsOfProof supernode [pre-release]


Is there a list of all cryptocoin currencies? Apart from bitcoin, I know few other crypto currencies (by this I mean currency which works in a similar way to bitcon). They are:

namecoin
lightcoin
ripple

I also heard about SolidCoin, but as far as I understood it is already dead.

Is this everything or am I missing something

The bitcoin wiki has a list:

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

There is a forum dedicated to alternative coins at bitcointalk:

https://bitcointalk.org/index.php?board=67.0


How can I generate the qrcode client-side that would be compatible with the Ardor Wallet qrcode I'd like to generate a qrcode the same way the Ardor Wallet generates it, such that it would be compatible.

I found qrcode related javascript shipped with the Ardor node download in ardor/html/www/js/util and ardor/html/www/js/3rdparty, however I wasn't able to find any documentation.

Thanks for any hints or pointers.

The Ardor wallet uses the NRS.generateQRCode() function from nrs.server.js to generate a QR code based on string data into a target div. Both the data and the div reference are provided as parameters.
This function relies on the qrcode.js library from the 3rdparty folder.


I had bitcoin via Changetip but it closed and I transferred coin to a wallet which I don't remember. I have bitcoin via Changetip but Changetip website closed and I transferred coin to a wallet which I don't remember. My question is how do I retrieve my bitcoin? Any help is appreciated, thank you in advance.

You'll need to remember what wallet you used to clear out your change tip account. Without that wallet, you'll be unable to recover/spend those bitcoins. Try searching your email, browsing history, etc, for clues as to what wallet you used. Best of luck.


Is Bitcoin suitable for fast transactions, eg in shops? Let's say all usability problems were solved. I'm imagining something like shops with tills that present QR codes for the amount and payment address for a transaction, and mobile clients exist that can scan them and present and easy Pay / Do Not Pay choice. So paying in a shop by Bitcoin would be no harder than credit/debit card, or even cash.

What limitations inherent in the Bitcoin protocol and network might prevent this from working? I'm thinking of things like:

Network latency (transaction being received by the shop) holding up queues
Poor mobile reception meaning shoppers find they unpredictably can't send money
Lack of confirmations before the customer leaves meaning shops may sometimes lose payment

I can see this being less of an issue in slower transactions, eg pubs, bars, restaurants. Are the above problems likely to materialise, and if so, are there any other types of transaction that might be affected?

The time for when a block has been confirmed is the main issue that seems to arrise. The coffee shop problem (I want my coffee now but this may take 10 minutes to confirm payment)

The mobile reception issue could be resolved by allowing restricted open access with on-site wifi service

There are third party services which may help this very effectively (www.flexcoin.com)

Also SolidCoin offers 3 minute blocks and may be substantially more elegant if a third party service was chosen not to be used for small transactions.


How do I use the blockchain file bootstrap.dat? Once I have the 9+ Gb bootstrap.dat file downloaded, how do I use it? I'd like to attempt mining without joining a pool; do I have the right file for a solo effort? I can use Windows or Linux so either one in the answer will be fine.

When you run bitcoin-qt or bitcoind in command line, pass that argument. This way, the client indexes transactions from a file, not from the internet.

bitcoin-qt -loadblock=/path/to/bootstrap.dat

Source: http://eu2.bitcoincharts.com/blockchain/
 Version 0.7 or later will also import this file by passing the command line argument "-loadblock=/path/to/bootstrap.dat" to bitcoin-qt or bitcoind.


debug window of wallets For all noobs and cryptocurrencies, is there anywhere a tutorial on how to use the wallet?

I've noticed several wallets that are just the same thing with a different name, but so far the only thing i get to know is that they give an address.

They all have an overview with the balance on the account at 0 coins, that's fine.
Then a tag of sending and asking coins, I can also get to understand what that does, even when it's empty and the only way to find other addresses is person to person. Now the crazy stuff that makes me wonder do i have to be a programmer to use these things?

What is that thing (Out of Sync) next to the wallet in red letters? How do I fix that? How can I "Sync" what exactly? Since when I install primecoin wallet for example, it starts downloading a bunch of crazy stuffs updating a bunch of weeks and after is finally done, it just tells me that the wallet is out of sync, and there's nothing i can do about it and I googled.

And people just mention but never explain a scary debug window with a console that i have no idea what it does or what should I do with that, and they only post code stuffs that if I copy paste won't work, at least not in all wallets and in those that accepted that code, it does absolutely nothing that I can know of....

Is there a newbie guide on how to get to use a wallet? primecoin, dogecoin, rainbowcoin, aimcoin... they all look just the same, and people talk about mining some few coins just by keeping them open.

Can someone help me? Please explain in baby steps I know nothing about scripts or pools or codes, or encryption, and is really frustrating me because I want to learn.

I've notices several wallets that are just the same thing with a
  different name, but so far the only thing i get to know is that they
  give an address

They do much more than just giving you an address. They also download and store the Blockchain which contains all transactions ever made. Those data are needed to check, if one of your addresses received a payment. Those data are also needed to send data to a different address.

  they all have an overview with the balance on the account at 0 coins, that's fine then a tag of sending and asking coins, I can also get to understand what that does even when is empty and the only thing i guess i have to find other addresses is person to person, now the crazy stuff that makes me wonder do i have to be a programmer to use these things?

You're right, you will get addresses from other persons or from the internet. You do not need to be a programmer. With a wallet it's like sending an e-mail, but instead of sending text, you send bitcoin. For sending bitcoin, you need to receive some first. That can be done by buying them in online trades or at an ATMs.

  what is that thing (Out of Sync) next to the wallet in red letters? how do I fix that? How can I "Sync" what exactly? since when i install primecoin wallet for example, it starts downloading a bunch of crazy stuffs updating a bunch of weeks and after is finally done, it just tells me that the wallet is out of sync, and there's nothing i can do about it and i google

As I said before, the crazy stuff which is downloaded is the blockchain. For Bitcoin it can take really long, because currently its size is about 20 GB. There are different types of wallet. The full node, for example Bitcoin-Core, which I guess is the one you downloaded, is mostly for the professional user. It contains the complete blockchain, and needs very long to sync.  An other type is the SPV (Simplified Payment Verification) for example Electrum. This one dont need to download the complete blockchain, it will only download the headers, which save a lot of traffic and storage. Those are also available for smartphones and are often used by the average users. A third type is the web-wallet, like blockchain.info for those you wont need to download any data, you can access them through you browser.

  and people just mention but never explain a scary debug window with a
  console that i have no idea what it does or what should i do with
  that, and they only post code stuffs that if i copy paste won't work,
  at least not in all wallets and in those that accepted that code, does
  absolutely nothing that i can know of....

This is only for developers and those post a mostly related to the bitcoin-core wallet and its JSON-RPC interface. You don't need those for normal usage.

  is there a newbie guide on how to get to use a wallet? primecoin, dogecoin, rainbowcoin, aimcoin... they all look just the same, and people talk about mining some few coins just by keeping them open :S

All those wallets have the same appearance and mostly the same functionality. There are some guides around. Coindesk offers a very good beginner guide which contains many of your questions and explaining all the important stuff.


NXT single address per user vs bitcoin single address per transaction In bitcoin, the anonymity is ensured by creating a new address for each transaction and by associating this address with a wallet. As far as I understand, with NXT, you use your account (calculated by the system from your passphrase) for every transaction, so it is simple by browsing the blockchain to trace all exchanges behind an account and a person. Is there any plan to address that ?

It's not hard to use Bitcoin approach in client software. NRS (Nxt Reference Software) doesn't support this because anonymity is not ensured this way, it only creates a delusion of anonymity (http://people.csail.mit.edu/spillai/data/papers/bitcoin-transaction-graph-analysis.pdf). CoinShuffle (http://crypsys.mmci.uni-saarland.de/projects/CoinShuffle/coinshuffle.pdf) will be added to Nxt soon to provide a better protection against deanonymization.


Can hardware wallets actually display the amount of funds leaving your control? It would seem the answer is no, because the hardware wallet is not a full node and cannot know the total value represented by the input transactions. It must trust the host software for this. Am I correct, or did I miss something?

Basically, the concern is that a malicious host software could trick the user+wallet into signing a transaction that has a low amount of output value but a high total amount of input value. This would convert the user's Bitcoins into a miner reward. Though admittedly the motivation behind such an attack would be low because the attacker can't profit from it.

That is correct, a hardware wallet does not have access to any information from the blockchain except that provided by the host computer. So it does not know anything about the amounts unless the host provides it to them.

Because of this, hardware wallets have some extra requirements for signing. Many devices, for non-segwit inputs, require the entire previous transaction to be sent to the device. This way they can compute its txid and compare that to the txid specified for that input. In this way they can be sure of the amounts being sent as they can look at the output amount(s) in the previous transaction.

However Segwit actually fixes this issue for them. In Segwit, the amount for the input being signed is part of the data that is signed. So it directly commits to the amount being sent and therefore the host cannot lie about that amount or it will receive an invalid signature.


Bitcoin mining - is it a race and how to not waste resources? My question term race is not about race attack term.

I've read https://en.wikipedia.org/wiki/Bitcoin and want to get practice using Bitcoin, no need to recover electricity bills and get profit now.

One of things not clear to me - is creating new block a race? That is, whichever mining pool first solves puzzle will get the reward, others just wasted processing efforts for that block? If yes, how do small pools compete with the largest one?

If I install say p2p mining software on ordinary PC, can I expect to gain some micro-microbitcoins in several hours (as block is added each 10 minites)? If I join largest pool?

Does mining always means gaining both new bitcoins issued and transaction fees?

Yes and no:
Yes, the first one to find a block gets the whole reward and the others have wasted their effort. But there is no progress in mining, so every attempt to build a block has the same chance at success. Therefore, your chance at finding the next block is equal to the percentage of mining power you contribute to the network.

Also see:

How is it that concurrent miners do not subvert each other's work?
What exactly is Mining?
In the ASIC-age, is it worth starting mining Bitcoin at home?


Is the word "coin" a proper bitcoin term? I have noticed that some people speak of "coins".  As far as I can tell, by "coin" they mean a transaction output.  Is this a correct understanding?  Is it helpful to use the word "coin"?

Right.  The statement "Alice has 5 coins" could be more precisely phrased "Alice controls the private keys for some set of addresses, to which are directed some set of transaction outputs with a total value of 5".  But that's a lot more cumbersome.


How to store data on blockchain? I want to store the data on blockchain so that people can see and verify the data. The data format will be a simple JSON like the user details.

{'user_id': userid, 'amount': amount, 'product_id': productId, 'place_id':place'}

Is there any way to store the above data in blockchain so that people can verify their details that are not manipulated?

The traditional way to store data is via an OP_RETURN. On Bitcoin, this is limited to 40 bytes of data. Bitcoin Cash increased this limit to 220 bytes just yesterday.

You can also store arbitrary data (more or less) on ethereum via a smart contract.

Traditionally, for this kind of use case, people opt to store the hash of the data instead of the raw data itself. They can then provide the raw data to someone, who can hash it and verify that it matches the hash that was stored on the blockchain.


Which full node implementation(s) supports SegWit2x? I'm running a full node, because I want to support the Bitcoin network, and because I'm interested in the backend mechanisms in Bitcoin.

Now, SegWit2x is approaching. I believe it's important for Bitcoin to increase the block size, so I would like to somehow support the doubling of the block size. Can I somehow support SegWit2x through my choice of full node software? If I can choose between Bitcoin Core, Bitcoin ABC, Bitcoin XT, and Bitcoin Classic: Are there any feature differences that would make those more or less supportive of the block size doubling?

If I can choose between Bitcoin Core, Bitcoin ABC, Bitcoin XT, and Bitcoin Classic

None of these software support Segwit2x. Currently your only choice of Full node software for Segwit2x is btc1.


Why is the bytestring 0xaa21a9ed used as the witness commitment header in SegWit? As per BIP 141, the witness Merkle root hash is stored in a scriptPubkey field of a coinbase transaction output with a header consisting of the 4-byte string 0xaa21a9ed. What is the reasoning behind choosing this string?

Googling only yielded a reference to namecoin on a bitcoin-dev IRC log.

It's random.

The intent was choosing something long enough to avoid having someone accidentally create an output that matches, but short enough that it doesn't unnecessarily makes SegWit blocks larger.


coinbase, where is my btc and will i get bch so I wasn't sure what would happen in the forking fork, bright spark that i am i sent my btc to coinbase from a multi bit wallet on 31st july, so far seen only by 1 peer, hasnt turned up in coinbase, will it? has the fork swallowed my btc? has coinbase swallowed any bch attached? can it be cancelled as it isn't showing on the chain  at present, would i still get any bch attached if returned to an old multi bit wallet only set up for btc? questions questions..please help

There was an announcement sent out by Coinbase on the 27th explaining that they would not be honoring BCH. Coinbase effectively swallowed your attached BCH but should honor your BTC.
Your transaction cannot be cancelled just because the chain hasn't finished verifying it. Additionally, because of the replay security in the BCH blockchain your transfer already happened and the BCH will be created for the account that the BTC was transferred to, namely Coinbase's account, which again does not recognize BCH.


Probability of block rewards Assume that there are only three mining pools, all with the same hashing power, mining for bitcoins in the bitcoin network. Which mining pool is most likely to get the block reward? Do you all think that it will be equally likely? Since they have the same hashing power and working on the same candidate block.

Yes, the same hash power means the same probability of mining a block.

But there can be other factors like connectivity: if a mining pool is facing internet connection problems between it and its members, it may fail to use that hash power effectively. P2Pool FAQ talks to its members about the importance of a good connection: http://p2pool.in/

Also, if there is an internet outage soon after it mines a block and it fails to broadcast it, the block risks been orphanated.

But it's not possible to 3 miners to work on a same candidate block, each block they are trying to mine will be necessarily different. I think you mean 'on top of the same block'.


bitcoin payment accidentally sent to Bitcoin-Qt application's sending address My father accidentally sent a bitcoin payment to his Bitcoin-Qt application's "sending address". Are the bitcoins lost? or is it possible to recover them somehow? When checking on blockchain.info, the funds are visible but I have no idea how to recover them into the Bitcoin-Qt wallet.

I thought it would be visible after his Bitcoin-Qt wallet synchronized but no luck. When referring to "sending address", when you go to sending address in the Bitcoin-Qt client it has one address (you can have multiple) but this was the address he sent the funds to. Unfortunately the bitcoins did not come back to his wallet. This was done 2 days ago. If I look up the same address on blockchain, the exact amount is just sitting there.

Does anyone have a suggestion? Thanks!

There is no difference between sending and receiving addresses. If the address is his, the payment will become visible once his Bitcoin-Qt has synchronized with the network. (Unless with "sending address" you mean an address held by someone else that sent money to him.)


I mistakely Deposit my BTC to my Yobit.net BCC Address, How can i Get it Back Help me,
I am not able to Contact Yobit for help, Can anyone give me there email
I By Mistake sent my BTC to my BCC Address of Yobit, Can I get it recovered
I heard That BTC and BCC have same Structure Thus BTC and BCC have same address and Private key, Thus I Think Yobit has BCC address and Private Key thus They also Can Get my BTC Using That, I need help

I am new to It, I need to get my BTC, Hope Someone Hears me and Reply with Help and Help me resolving it with Yobit...

Thanks for help

Sorry man but you are not able to get your money back unless someone from Yobit sends it back. Try to get in touch with their support team.


What are the chances of hitting VALID mnemonic phrase out of bip39, if someone picks 12, 18, or 24 words from the word list randomly by himself? So, here is the statement: "Not every combination of words from bip39 wordlist is valid."
What are the chances of hitting a VALID mnemonic phrase out of bip39, if someone picks 12, 18 and 24 words from the word list randomly by himself?

If you mean "valid" being the valid checksum word at the end of the phrase,
A valid pneumonic is defined as:

The checksum is then the first n / 32 bits of the SHA256 hash of the entropy. This is just concatenated to the end of the entropy. The mnemonic is then encoded by dividing the entropy into groups of 11 bits and using the resulting 11 bit number as an index into a list of 2048 words

So I would think getting a valid checksum for any arbitrary input would be 1/2048


Transfering Money From My Bank Account To Bitcoin? Im quite confused about this bitcoin software/system.

I have successfully sync'd to the network (took hours) and have recieved my address. Now, if someone is selling something for 5Bitcoins. What is the process that i have to do to remove money from my Barclays UK account and convert it bitcoins and send it to my wallet.

I really do not understand the process.

Thanks for anyone who can clear up this confusion i have.

If you don't want to deal with the hassle of an exchange you could try our new service for UK users:

https://blockchain.info/wallet/deposit-pingit

The fee is slightly higher at 3.49%


Create transaction with bitcoin core Currently i'm working with bitcoin-qt for a while and now i have some issue that i wanna ask.

-Is there a way to create transaction then submit it to network from wallet that NOT inside this bitcoin core. Currently i only know that we only can create transaction for only account/address in our node.
So can anyone have any idea ?

Certainly. Bitcoin Core has various utility RPCs which are separate from the wallet. You can use createrawtransaction to create a transaction. Of course, without the wallet, you will need to specify the inputs and outputs for the transaction manually. You can sign that transaction with a private key not in the wallet by using signrawtransactionwithkey. You can then broadcast that transaction using sendrawtransaction.

To get the outputs for an address that you can use in createrawtransaction, you can use scantxoutset to scan the UTXO set for UTXOs pertaining to a particular address.

All of these can be done without the internal wallet and separate from the internal wallet.


Can wallets be shared by different machines? I have a bitcoin client installed on machine one. Let's say it has 5 coins in there. I then have another machine, with another client on it. Can both machines see the same wallet?

Do I have to have a per machine wallet? What if I want to pool my coins in one place?

It is a bad idea to have multiple copies of your wallet.dat running from multiple computers if both will be spending.  You risk getting double spend attempts that will never confirm and cannot be cleared without performing wallet surgery.

BlockChain.info/wallet has a "desktop sync" feature that will let their hybrid EWallet sync with your Bitcoin.org client (through RPC), but since BlockChain.info/wallet can be used on multiple machines why not just use BlockChain.info/wallet from everywhere instead?  You get to use the mobile app with it as well.


The initial block file parsing can take a lot of time. From the readme:

  Reading the block files takes much too long, several days or more for the main BTC block chain as of 2013. However, if you use a persistent database, Abe remembers where it stopped reading and starts more quickly the second time.

It depends on the hardware you have, besides a good CPU it probably benefits from a fast hard drive (SSD at best).
On my Macbook Air (2013, 8GB RAM, i7, SSD) it took a few days.


Can I have multiple OP_RETURN outputs in one transaction? I am wondering if I can inject multiple OP_RETURN outputs in one transaction?

Can inject multiple OP_RETURN outputs in one transaction?

At the protocol level, absolutely nothing prevents you from doing this. However, such a transaction would not be considered a 'standard' transaction and would not be relayed (propagated) through the network.

Let's say, though, you were a miner yourself. Then you could mine a transaction with 100 OP_RETURN outputs in it, and no one would reject your block because of it.


What counts as verification or validation of a transaction? I understand the general ideas and properties of the block chain, but have not been able to understand how a transaction is created and gets to be verified or validated.

A transaction is a output generated from a end-user's wallet software. It contains their address, the recipients address, and the amount to be transferred (among other things). After the wallet creates the transaction it then broadcasts it to the peers you are connected to and is added to a queue to be confirmed. The world will know, semi-immediately, that you have broadcasted this transaction, with a current status of unconfirmed. The transaction can now be viewed on a blockchain explorer with the txhash that was generated (a unique identifier of that transaction).

Miners confirm transactions in the queue by expending electrical power and processing power. After a transaction has been confirmed it is then added to a block. Once the entire block has been generated and confirmed, the transaction then stands at one confirmation.

Different sites and services require a varying amount of confirmations before doing certain actions.


Does bitcoind accept batch RPC calls? Am currently sending RPC calls to bitcoind in Python3 in series using JSON:

import json, requests

def pull(command, foo):
    headers = {'content-type': 'application/json'}
    payload = json.dumps({"method": command, "params": [foo], "jsonrpc": "2.0"})
    response = requests.get(serverURL, headers=headers, data=payload)

    return(response.json()['result'])

Ex:

pull('getblock', BLOCKHASH)

and hope to improve call speeds by doing batch RPC calls.

Is this possible and how so?

Yes, this is supported. As specified by JSON-RPC 2.0, you can send in an array of requests, and receive an array of solutions.


Trying to use Block Erupters with Ubuntu 13.04 I'm trying to Mine with ASICMiner's Block Erupters on Ubuntu 13.04. I've installed everything (bitcoin-qt, cgminer, bfgminer, I've got the block erupters in usb hubs hooked up to my ubuntu box).

But neither CGMiner, nor BFGMiner detect the block erupters...

When I go to /dev I see 18 ttyUSB[0-17] devices, I guess that's probably them, but I don't really know how to tell if my system can even see them.

I have the hubs they're plugged into hooked up to another usb hub so that you've got the first hub coming out of one usb port from the box and the ANKER hubs that hold the block erupters are both hooked up to that. I don't know if that's messing it up.

to determine if they're being detected properly, use the 'lsusb' command.

Here's what they should look like if your system is detecting them properly (I run mine in a VM running Ubuntu:

$ sudo lsusb
[sudo] password for majorminer:
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
Bus 002 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 002 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 002 Device 007: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 002 Device 008: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 002 Device 009: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light

Make sure they're detected by the miner by using sudo bfgminer -S all -d? -- I found this to be a lot better on linux than cgminer.

Then start your miner with sudo bfgminer -o $pool.goes.here -u $USER -p $PASSWORD -S all


Where can I find more resources that explain Bitcoin simply? I have been learning crypto for a little bit now and have been helped a lot by pebwindkraft, Andrew Chow and Adam in particular.

I would like to ask about resources that help beginners like me to understand the crypto space, I have been following a guy on youtube and I believe that he deserves some credit for the github book he did and the youtube videos that explain bitcoin in a way that I can sort of understand.

If you have any other resources then please feel free to put them down below.

Edit:

The channel I was referring was : https://www.youtube.com/channel/UCHBWzcGSrtoLYcasLwGvsow

I would suggest you reading Mastering bitcoin book first and second editions. It's exactly what you are looking for.

https://github.com/bitcoinbook/bitcoinbook

if you like watching more than reading this youtube videos are amazing


How to get Order status in Bittrex API How to know what is the order status when using getOrder API?

request:

https://bittrex.com/api/v1.1/account/getorder&uuid=<uuid>

Example response:

{
"success" : true,
"message" : "",
"result" : {
    "AccountId" : null,
    "OrderUuid" : "0cb4c4e4-bdc7-4e13-8c13-430e587d2cc1",
    "Exchange" : "BTC-SHLD",
    "Type" : "LIMIT_BUY",
    "Quantity" : 1000.00000000,
    "QuantityRemaining" : 1000.00000000,
    "Limit" : 0.00000001,
    "Reserved" : 0.00001000,
    "ReserveRemaining" : 0.00001000,
    "CommissionReserved" : 0.00000002,
    "CommissionReserveRemaining" : 0.00000002,
    "CommissionPaid" : 0.00000000,
    "Price" : 0.00000000,
    "PricePerUnit" : null,
    "Opened" : "2014-07-13T07:45:46.27",
    "Closed" : null,
    "IsOpen" : true,
    "Sentinel" : "6c454604-22e2-4fb4-892e-179eede20972",
    "CancelInitiated" : false,
    "ImmediateOrCancel" : false,
    "IsConditional" : false,
    "Condition" : "NONE",
    "ConditionTarget" : null
}}

You can use this field from response json to know if order is filled

QuantityRemaining

And this filed tells if order is open or close

IsOpen

Its pretty self-explanatory. Comment if you wish to know more things.


Why does Bitcoin send the "change" to a different address? For example I have an address (A) with 20 BTC and send 9 BTC to address (B).  Bitcoin will create a "change" portion of the transaction where the remaining 11 BTC goes to address (C).

Why not send the change back to A?

Instead of:

Initial balance:
A: 20 BTC
B: 0 BTC
C: 0 BTC

Transaction Pair:
A -> B 9 BTC
A -> C 11 BTC

End result
A: 0 BTC
B: 9 BTC
C: 11 BTC

Why not?

Initial balance:
A: 20 BTC
B: 0 BTC

Transaction Pair:
A -> B 9 BTC
A -> A 11 BTC

End result
A: 11 BTC
B: 9 BTC

Two reasons:

So whoever sent to your "A" address can't claim to have sent you 31 bitcoins ("See!  Look on block explorer, there are two transactions sending to "A", one for 20 bitcoins and one for 11-- send me back the extra 11!")
Using a new change address makes it more difficult for other people to track of how many bitcoins you have or where you're spending them.


What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency? For instance, Bitcoin has a proof of work based consensus algorithm, it's how Bitcoin chooses a node to create the next block in Bitcoin's blockchain. In this way the network is in consensus about the creation of the next block. Part of this block creation process is issuing the next proof of work to the network, and the consensus node, based off of the algorithm in question, may set a new difficulty on the proof of work. Bitcoin tries to keep this proof of work difficult enough but easy enough so that block creation times are around 10 minutes.

What is the algorithm that sets this difficulty?

The difficulty is a function of block creation speed.
The goal is to, on average, create blocks every 10 mins.
It is recalculated every two weeks (link)
You can look up the calculation of difficulty in the open source code of Bitcoin
https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49


lost wallet PLEASE HELP Back when the article came out about the Silk Road.  I followed the instructions in the article to get into the Silk Road.  I just wanted to see it. I was prompted to buy bitcoin so I purchased a small amount.  I don't do drugs and felt guilty about it being on my desktop so I put it in the trash.  I have a Mac.  6 years later someone emptied my trash.  I wrote down the username and password.  Can anybody help me find my old wallet?

What do you mean by username and password? Was it the Silk Road username and password? Wallets that are stored locally on your computer are stored with a public key and a private key.

If the username and password that you have is for Silk Road, then your money is not recoverable. This is because they own your private keys on their site and now that they have been shutdown, you won't be able to interact with your wallet.

If you have a username and password not from Silk Road, it is more likely that you had an online wallet which means that it might still be recoverable.

Best of luck!


bitcoin debug withe clion I got this error when I have tried to compile on lubuntu 16.04

34: error: expected ‘)’ before ‘host_16bits’
inline uint16_t htole16(uint16_t host_16bits)

using clion, is there any guide on how to debug on linux using clion?

CLion only supports using the CMake build system. However Bitcoin Core uses the autotools build system. Without some special configuring, it is unlikely that you will be able to build Bitcoin Core using CLion as the default CMake config will need to be modified to work with Bitcoin Core.

Instead of using CLion to build and debug it, you should be able to build Bitcoin Core in a terminal and then execute the resulting binary in CLion's debugger.


Is there a way that we can report a Bitcoin scam? Good day

Is there a way that we can report a Bitcoin scam? I was recently scammed over R200000 therefore I would like to report the person and the platform to alert people of her fraudulent platform.

The primary way to report scams is to contact your local police.

Since Bitcoin is a peer to peer payment system, there is no hierarchy of control, no Bitcoin central authority to whom you can report scams or who can act or coordinate actions against scammers.

There are some social media and other websites that collect lists of scams, so you could report your problem to those. For example, search for bitcoin scam blacklist. I doubt that this is very effective though. It might alert a few of the more diligent people but many people who fall for scams don't seem to have done much research of this sort beforehand.

Scams that exploit weaknesses in, for example, wallet implementations can be reported to the developers of the software concerned (see recent phishing attack on Electrum by malicious servers issuing false update warning dialogues).

I don't know of scams that exploit weaknesses in the underlying network protocols - but those tend to get noticed by developers and result in Bitcoin Improvement Proposals (BIPs).

  People wishing to submit BIPs, first should propose their idea or document to the bitcoin-dev@lists.linuxfoundation.org mailing list.


Are there any services hosting Bitcoin-related ads for websites? Say one owns a Bitcoin-specific website and they want to get some ad revenue for Bitcoin-related ads. Are there any websites that host such ads and provide the necessary code for displaying and monetizing them, just like AdSense would, or does one have to contact individual Bitcoin websites and strike deals with them?

There is not anything like adsense yet, but there are smaller ad platform. Here are a few:

http://dailybitcoins.org/ they offer both ads by number of impression and per click.
http://www.bitcoinadvertisers.com/ they claim to be the biggest, I do not know how true that is.
http://anonymousads.com/ They have a significant presence in the Bitcoin community.
http://puppytwist.com/ they are pretty simple to get started with, high payout too