Why have proof of work? As far as I can tell, PoW allows multiple parties who don't trust each other to agree on an order of transactions. The fact that every transaction has a hash of the previous block means that you can always verify that the ledger hasn't been tampered with.

My question is twofold:

1) If there is a 51% attack, and a party forks the blockchain after 6 blocks after a merchant confirmed his money, then there will automatically be realised by the nodes, since suddenly they will have to replace 6 blocks in their chain.

2) Given this, why not just have one miner who publishes blocks, then every node can detect whether this miner has forked the blockchain (since the database is untamperable, he/she has to remove the top blocks on the chain). The miner would never lie since if she did, it would be detected and everyone would lose trust in the network.

Presumably, I misunderstood something quite fundamental.

You have the right idea when you wrote:

  allows multiple parties who don't trust each other

Then you proposed:

  just have one miner who publishes...

That would mean that everyone has to trust and rely on that one miner to publish accurately and correctly.

But the whole point of the system is to not trust anyone.

Proof of Work (POW) is the mechanism that creates a trustless system without any central node.

P.S.  There are potentially lots of ways to tamper with a block chain other than forking.   There are double-spends, re-writing old transactions, forging new transactions, and denial of service attacks.  So far, the POW scheme seems to be an effective defense against all of these attacks.


Conditions for recovering a p2pkh bitcoin private key Apart from Re-using same R value, What are the necessarily ecdsa values needed or method to recover the private key of a p2pkh address.

When same address is reused numerous times to receive bitcoin what threat does it pose?

What are the necessarily ecdsa values needed to recover the private key of a p2pkh address.

A key is recoverable if two signatures are created with the same R value.

  When same address is reused numerous times to receive bitcoin what threat does it pose?

It leads to some loss of privacy, allowing different payments to be linked together.


Possible race condition(double spend) on HTLC-Timeout in the lightning network? From the offered HTLC Outputs,

# To remote node with revocation key
OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
OP_IF
    OP_CHECKSIG
OP_ELSE
    <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    OP_NOTIF
        # To local node via HTLC-timeout transaction (timelocked).
        OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    OP_ELSE
        # To remote node with preimage.
        OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
        OP_CHECKSIG
    OP_ENDIF
OP_ENDIF

With the following conditions,

a locktime is set to be 600900 in the HTLC-Timeout transaction.
the remote node has the payment_secret.
the local node wants to timeout the latest commitment transaction.

From my understanding, to timeout the latest commitment transaction, the local node has to,

broadcast the commitment transaction at blockheight 600900;
immediately broadcast the HTLC-Timeout transaction;
wait a few days to spend the HTLC-Timeout transaction once the specified timelock value has passed.

Meanwhile, the remote node with the payment_secret can spend the commitment transaction too. Will this cause a race condition/double spend in the Bitcoin network? If so, how can it be resolve?

First of all I think there seems to be a small confusion about the notation. One does not spend a transaction but transaction outputs. In the case of offered htlcs the output is only one (of potentially many others) output.

Also I understand the timelock slightly different. If you publish the commitment transaction it can be mined and verified directly. It is the time locked output e.g. the htlc that can only be spend after the timelock.

Regarding the racecondition / double spend. First of all double spends in Bitcoin are impossible by design (unless we have an unknown exploit) so we can boil it down to the question of a race condition. Here we have to distinguish two cases:

Before the timelock: in that case you cannot spend the htlc output and only the remote side can do so with the preimage. It is the safty Period for the remote side to get the funds if the htlc was supposed to be forwarded.
After the timelock: in that case in deed a race condition can emerge. At that time the remote side should not get the preimage but abort routing anyway but if you don't sweep the output and the remote side gets hold of the preimage then in deed it comes to which spend will be included to a block first.


Can a miner remain anonymous? Can you differentiate the miners from the normal clients, by doing some frequency analysis on ip-addresses that announce new blocks? Or will the new block propagate so fast around the network by normal clients that it's impossible.

I don't know what this frequency analysis technique would do, so this answer corresponds to the second question you asked:

Blockchain.info connects to hundreds of nodes:

http://www.blockchain.info/connected-nodes

The IP address Blockchain.info shows is the address of one of those nodes that they happened to be connected to which first saw that transaction.  A node where privacy is desired does not allow incoming connections and only connects to trusted nodes that won't violate privacy expectations.


Random Number In R Value , what is it actually, is it the same as Nonce in the blocks I wonder about the random number in R value ...
if i am right , the R value is First part of the script signature which is combined of two parts (r,s)
r = Gk  (elliptic curve scalar multiplication) Or does the whole signature is the Gk ??
So r , is a multiplication of random number ( k ) times G (elliptic curve scalar multiplication )
while
r = xcoordinate(R) , is just the first part of the ( r,s )
I read an article the most repeated R values in transactions is
0x00000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63
while G is the Double of this point means that the random number is (1/2)
so R value Is simply is simply calculated by multiplying any number by G ???
and they do call it nonce , so is it the same nonce shown in blocks ? that is already public ?
or it is another nonce ?

The nonce in a signature is different from the nonce used in the block header. These are unrelated to each other. They only share a name because the term nonce is a generic word that means "a number used only once."
A signature is composed of two numbers: R and s. R is the X coordinate of a random nonce k multiplied by the generator point G. It is the result of elliptic curve scalar multiplication with a point. k is a scalar, which means it is just a random integer modulo the n, the order of  G.
The nonce k must be kept private. If it is known, then anyone can compute the private key used in the signature. Additionally, reusing the same k (which results in R being the same) with the same private key will allow the private key to be computed.


Can you switch the method of blockchain download? I torrented bootstrap.dat and used am using it to populate the blockchain. It is close to being complete, but my server has ran out of room. There is room for one copy but not enough for two. Is it possible to switch from using bootstrap.dat to using the standard download method of Bitcoind?

Yes, it is possible to delete boostrap.dat mid sync.

Next time you start the Bitcoin client it will continue to sync from the network.


How accurate is 'estimatesmartfee' in bitcoin-core? Method of estimatesmartfee is very simple and easy to use and understand. But I want to know how accurate this function really is? It would be great help if you can provide a link to article or Research paper.

I have found this article https://bitcointechtalk.com/an-introduction-to-bitcoin-core-fee-estimation-27920880ad0 which give you a pretty good summary of this bitcoin function.
Notice that estimatesmartfee return is based on the data of what happened in the past in the blockchain, it is not trying to predict what will happen in the future but what should happen based on what happened before, maybe you will find a better algorithm if you think that there will be something new that will disturb the market.
From the article:

A more sophisticated algorithm may attempt to be more forward-looking.
However, the more complex the algorithm, the more difficult it becomes
to describe its operation and results, and the more difficult it is to
argue that the algorithm is safe against manipulation.


How to set up ASIC properly? Okay so butterfly labs has these ASIC chips available yet I am very confused on how to implement these. I have never seen these type of things and googling has gotten me nowhere.

The documentation to these chips has not been released yet, as you can see on the page:

  Reference documentation:  Butterfly Labs is releasing it's PCB schematics & MCU code to open source.  Links to this documentation will follow shortly.

Be aware that by ordering these you are not purchasing a finished product, you are just purchasing the chips to build one.


Why does the standard Bitcoin message signature include a "magic prefix?" The standard Bitcoin message signature works as follows:

sign(sha256(magicPrefix . length(message) . message))

The "magic prefix" is simply the string '\x18Bitcoin Signed Message:\n', where 0x18 is the length of the prefix text.

In other words, it's this:

sign(sha256(length(prefix) . prefix . length(message) . message))

My question is:

Why does it use a magic prefix?
Why does it include the lengths of the two components?

I'm asking mainly from a security point of view. Does adding a prefix or including the length(s) have any security benefits? If not, I'd like to drop it from my signatures.

RFC4880 apparently standardises the way signatures work, so it could be referring to:

  0x18: Subkey Binding Signature
         This signature is a statement by the top-level signing key that
         indicates that it owns the subkey.  This signature is calculated
         directly on the primary key and subkey, and not on any User ID or
         other packets.  A signature that binds a signing subkey MUST have
         an Embedded Signature subpacket in this binding signature that
         contains a 0x19 signature made by the signing subkey on the
         primary key and subkey.

But it seems much more likely BIP70 extension proposal is the reason for standardising signatures, as outlined by their BitID wallet implementation requirements:

  To be compatible with the BitID protocol, a wallet must implement the following:

  register the bitid scheme
  throw a bitid intent when scanning a BitID QR code (if applicable)
  decode the URI and verify its format
  display a request for authentication showing the domain name callback and > - ask for validation
  ask the user to pick up or create a Bitcoin address for the authentication (show the last Bitcoin address used if this is a known callback address)
  sign the BitID URI with the private key (using the \x18Bitcoin Signed Message:\n#{message.size.chr}#{message} convention)
  POST the signature and the public key to the callback URL
  completion dialog : success/retry/cancel


How is a transaction broadcasted? Let's say UserA uses electrum, connected to ServerB, and hits the "Send" button to do a transaction.

What happens?

The transaction is sent to ServerB only

or

The transaction is sent from UserA to ServerB but also to 2 (or 10 or 100?) other servers (UserA's electrum has a list of 100 servers to connect, one after another, when he does a transaction)

or

The transaction is sent from UserA to ServerB only, but ServerB broadcasts it immediately to 2 (or 10 or 100?) other servers

Especially if ServerB is late of 1 or 2 blocks from the rest of the network, what happens? Is the transaction lost? Broadcasted anyway?

Where are these rules specified in the official implementation?

it is more like 3.
The client would send the tx to a full node (let aside the complexities of SPV clients), and this full node would verify the tx by some pre defined rules. If ok, this full node transmits to other full nodes.
The transaction only gets valid, if it was mined into a block. So the server you mention can be several blocks behind, but still can transmit the tx to other nodes. A very good overview of the way this happens is here:

  http://chimera.labs.oreilly.com/books/1234000001802/ch06.html

also the chapter on transactions will help to clarify the picture.


What new transactions are possible with 15 operations? Today Gavin tweeted that he's relaxing the IsStandard rules for pay-to-script-hash transactions to allow any transaction with 15 or less operations. (Full git commit here)

When this is merged and widely used, what new types of transactions become possible?

It's not exactly "15 operations"...

The Bitcoin address is not really a public key, but a special script that is built from special commands. From those commands you could build really weird transactions, for example the ones mentioned here, that lock funds on an address that can be accessed only if someone manages to break SHA2.

Up until now the miners treated anything besides the basic four or so script kinds as non-standard. It meant that you could add them to the blockchain (because they are valid), but only if you mine them yourself, or convince one of the pools to add them to the block.

Thanks to the relaxed rules, you will be able to create transactions that are redeemable by almost any script built from commands listed here: https://en.bitcoin.it/wiki/Script . As long as they don't contain more than 15 signature checks.

The biggest potential use case for this is probably in oracles / smart contracts, as explained in Gavin's bit-thereum post. Our project - Orisi / Distributed Oracles is right now the only practical implementation of this concept, and it's described in detail in our white paper ( https://github.com/orisi/wiki/wiki/Orisi-White-Paper ). We may be using the extended scripts to perform a 1+M of N multisig check - that is to require a signature of both the transaction sender, and M of N oracles protecting the transaciton. If this explaination is not clear enough, you might want to check our website.

Finally, as for this functionality's ETA - it might appear in the next minor update, but that will happen probably in a few months time.


Why does a thin node need to know if a transaction is present in specific block's merkle tree? I understand what a merkle root is and how merkle proofs work.
It's all about thin nodes checking whether a specific transaction ID is in a specific block. So, thin node says: I have a transaction ID - 12345 and I want to know if this transaction is present in  259,291th block.
Why would a thin node want to know information like this ?

Why would a thin node want to know information like this ?

They quite possibly don't care about exactly which block the transaction was included in, but they most certainly care about knowing the transaction was included in the blockchain at all. It just so happens that there is no easy way to prove the latter without proving which block it is included in.
To illustrate a more concrete interaction (as used in BIP37, but other protocols like Electrum's client-server protocol are similar). F = full node (the server), L = light client. This is obviously not an actual protocol dump, but conceptually it's close.

L: Hi F, I'm a light client and am interested in transactions involving addresses A, B, and C. [filteradd]
F: Okay. [nothing]
L: I have synchronized blocks up to block hash H. [getheaders]
F: Oh dear, you're behind, there is also block I and J. Here are their headers! [headers]
L: Those headers look great, and their proof of work is valid. So eh... does I contain any transactions I care about? [getdata with MSG_FILTERED_BLOCK]
F: Nope. [empty merkleblock]
L: Okay... what about block J [getdata with MSG_FILTERED_BLOCK]
F: Oh yes, here is transaction T that involves one of your addresses! [merkleblock]
L: That looks like a transaction that indeed pays me... but can you prove it's actually been included in the chain? You know, I don't trust you really and you could be giving me an invalid transaction, or one that spends money that has already moved in the chain. [nothing]
F: Fine, here is a Merkle path that proves T is in fact included in block J. [part of the earlier merkleblock message, actually].

So the point is that without the proof, F could be claiming that L got paid, while the transaction is invalid. Having it included in the chain makes that very expensive, assuming other nodes in the network actually enforce validity of transactions in the chain.
There is a caveat of course. There is no way that F can prove to L that block I didn't include any interesting transactions. The solution to that is either trusting the server, or trying multiple - neither is very satisfying.


How to interpret the Descriptor field? These are my UTXO in Tesnet environment:

  {
    "txid": "93ae7787fe8203e9f13534205ca0310baf8bf5e2b55b2faa1f8b09134f475208",
    "vout": 1,
    "address": "2N4VywDy3DnkCmCM8yvfMSFHiEt2ePxzLXu",
    "label": "",
    "redeemScript": "0014e700e862aa81cba9b43ede7bf446bebe91a5b147",
    "scriptPubKey": "a9147b73e47479d05d755dbaee6bdedf430df05ca34587",
    "amount": 0.01593294,
    "confirmations": 116,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([7de694b7/0'/0'/8']030268ac0849999b04d572ddcf4202dbc8399e680df2afe4a577c1ed8e048d06f5))#zy9vsk5a",
    "safe": true
  },
  {
    "txid": "aaec2330d2d8a19e036cf2cde6575cfae299e303a4140451f2f88142491c9439",
    "vout": 0,
    "address": "2N7MaihNErbNH8XTkuZWtJYPzMQAWMPVKHd",
    "label": "",
    "redeemScript": "0014778daf651b21684b572644b47d551fce0ff71c74",
    "scriptPubKey": "a9149ac58ff47e27214b158b38da04bc8cbf72def14387",
    "amount": 0.01643138,
    "confirmations": 343,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([7de694b7/0'/0'/7']032c27921f2d15e7eca768c0e8a8b1aeb863328c74d6c194d41dde2888d4b0e75b))#6z7uwusp",
    "safe": true
  },
  {
    "txid": "dbf77cfb45314d925ae99d40267419ba23d03200ae2ffdd5a54c06661c934242",
    "vout": 1,
    "address": "2NGS7agzTfk9LEKXkm89QvgbCC7rHWHBD4K",
    "label": "",
    "redeemScript": "00141212e2e581101ca9d211cef24ffe04196887aa8f",
    "scriptPubKey": "a914fe5a1ed871c6bd7fa9bb2dffbdcc77da4cd2b40e87",
    "amount": 0.00010000,
    "confirmations": 52732,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([7de694b7/0'/0'/3']02902a17c3010900ddee53be420c7660f016c2a36cf169b45afc6747ea1a81e3a2))#ckzssh4n",
    "safe": true
  },

From the documentation found the descriptor field sh (wpkh)describes a P2SH-P2WPKH output with the specified public key. Within wpkh and wsh, only compressed public keys are allowed.
How can I check the link between this key and the address? Why the fingerprint 7de694b7 is the same for all keys?
I tried to perform these steps without getting a result:

SHA256 of the key
RIPEMD160 of the previous result
I added the prefix (trying both 0xc4 and 0x6F)
base58 including checksum

Your key descriptors describe a p2sh-p2wpkh address. The descriptor can be decoded as:

sh # p2sh script
(
wpkh # p2pkh script
([
7de694b7 # BIP32 root key fingerprint
/0' # perform one hardened derivation at index 0 on the root key
/0' # perform one hardened derivation at index 0 on the previous derivation's output
/7' # perform one hardened derivation at index 7 on the previous derivation's output
]
032c27921f2d15e7eca768c0e8a8b1aeb863328c74d6c194d41dde2888d4b0e75b # this should be your resulting public key
))
#6z7uwusp # checksum information for the entire key descriptor

The full key descriptor reference is available here.

To go from the public key to the address, you can perform the steps as outlined here.


I want to start my own exchange I want to start my own exchange like btc-e.com I have plenty of money to invest please guide me in this. I myself have knowledge of php but dont want to experiment on things I want it to up and running in a week or so.

Because orderbook based exchanges are not exactly trivial to implement with all necessary security what you are asking is unlikely to happen in business-wise. Even with the best software developers of the world you could not achieve what you wish within a week or so.

If you have plenty of money to invest and you want hiqh quality, long-term, results for your project, what you should expect

Lead development time of 2-3 months with 2-3 person team with the following components

Orderbook (open source Buttercoin engine available)
User account management
Deposit and withdrawal

A way to get fiat currency in and out from your exchange (you probably should have a special deal with a bank)
If you are using western world senior software developers, expect cost between 25 k - 100 kUSD

Also I recommend not to use PHP or ASP.NET programming frameworks, pick Ruby, Python or JavaScript instead. PHP systems have historical record of being prone to hacks and that's something you do not want with financial systems like Bitcoin; using PHP would greatly diminish the trustability of your service. Bitcoin users have become aware of shady services and they most likely want to see that the service you deliver can be trusted before they put in their money into it.

Based on how you set the question it seems that you do not have much experience with software development, so my suggestion is that you hire a project manager who would do the planning for you.


Transaction change calculation I'm confused about how exactly I should compute a change for transactions.
Say, for a given address I have 4 unspent outputs containing 2 BTC each and I want to send 5 BTC to other address.

Here's what I do:

Find 3 outputs needed so the total is 6 BTC
Now, what should the change be? 6-5=1 or 8-5=3?

The change is anything that's left over when you take the outputs you'll be spending, subtract the value of the transaction sent, and subtract fees. Since transactions should be as small as possible, as few outputs as needed will be spent. In your case, 3 outputs will be spent, no fee is in place, so the following new outputs will be created:

5 BTC to recipient
1 BTC to a change address.


A short program to mine a block Anyone can give step-by-step explanation about the code below (if possible, with a c/c++ equivalent)?

import hashlib, struct

ver = 2
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
time_ = 0x53058b35 # 2014-02-20 04:57:25
bits = 0x19015f53

# https://en.bitcoin.it/wiki/Difficulty
exp = bits >> 24
mant = bits & 0xffffff
target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3))))
target_str = target_hexstr.decode('hex')

nonce = 0
while nonce < 0x100000000:
    header = ( struct.pack("<L", ver) + prev_block.decode('hex')[::-1] +
          mrkl_root.decode('hex')[::-1] + struct.pack("<LLL", time_, bits, nonce))
    hash = hashlib.sha256(hashlib.sha256(header).digest()).digest()
    print nonce, hash[::-1].encode('hex')
    if hash[::-1] < target_str:
        print 'success'
        break
    nonce += 1

I am trying create my own implementation; I already read the block data with json-rpc and stored in this struct:

struct block {
  unsigned char* hash;
  int confirmations;
  long strippedsize;
  long size;
  long weight;
  long height;
  long version;
  unsigned char* versionHex;
  unsigned char* merkleroot;
  long blocktime;
  long mediantime;
  long nonce;
  unsigned char* bits;
  double difficulty;
  unsigned char* chainwork;
  unsigned char* previousblockhash;
};

Now I want extract the data from this struct and use to execute the same calculations in this code, but I need to understand what the code does with more details.

First we define some information which goes on the block, namely what version the block is, what the previous block hash was (because each block references the previous one to create the chain), what the merkle root of all the transactions in this block is (see Wikipedia if you don't know what this is), the current timestamp, and the current difficulty encoded in the bits variable:

import hashlib, struct

ver = 2
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
time_ = 0x53058b35 # 2014-02-20 04:57:25
bits = 0x19015f53

Then we take the bits value, and convert it into a difficulty target based on the steps listed in the linked wiki page on difficulty. The target is basically a number we want to find a hash below (e.g. if the target was 10, only hashes less than 10 would be valid):

# https://en.bitcoin.it/wiki/Difficulty
exp = bits >> 24
mant = bits & 0xffffff
target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3))))
target_str = target_hexstr.decode('hex')

Now we start a loop, hashing the block many many times with different nonce values until we find a hash less than the target. We start the nonce off at 0, and increase it by 1 each loop so we get a different hash every time:

nonce = 0
while nonce < 0x100000000:

This is just putting the data we defined earlier (including the nonce) together into the serialised block ready to be hashed:

    header = ( struct.pack("<L", ver) + prev_block.decode('hex')[::-1] +
          mrkl_root.decode('hex')[::-1] + struct.pack("<LLL", time_, bits, nonce))

This is where we actually hash the serialised block data, obtaining a hash, which we print out (encoded as a hexadecimal string) with the nonce for logging purposes:

    hash = hashlib.sha256(hashlib.sha256(header).digest()).digest()
    print nonce, hash[::-1].encode('hex')

Finally, we compare the hash value to the target, and if it's lower than the target, we've successfully found a valid block, otherwise try the next nonce:

    if hash[::-1] < target_str:
        print 'success'
        break
    nonce += 1

Note that this is a very simple program, good for understanding, but wouldn't really work in real mining because changing the nonce alone is no longer enough variation to find a block, data is also varies in the coinbase transaction to change the merkle root as well. That's just because the target is so low (difficulty so high) that the chance of hitting it is quite low to combat the massive mining power on the network. The program also doesn't calculate the merkle root itself, which needs to be done if you're starting straight from transactions.


Combined scrypt/SHA256 mining on one GPU Is it possible to mine scrypt and sha256 coins at the same time on one GPU?

Rationale: Hashrate of scrypt mining is limited by memory bandwidth. That means that some of the processor cycles are wasted because the processors are waiting data from RAM. These wasted processor cycles could be used insted for sha256 mining which needs much less bandwidth.

In GPU scrypt mining, the optimized threshold of lookup gap is 2. It means the GPU only saves 0, 2, 4, ..., etc to GDDR (global memory of GPU) and reduce huge amount of time of saving all 128KB data for one scrypt calculation. However, it needs some GPU cycles to re-compute for the elements if the algorithm needs data in the index of 1, 3, 5, ... And remixing those 1024 elements also takes GPU cycles. In the GPU architecture, the hardware scheduler will help to hide the latency of memory read/write. So, the GPU cycles are not wasted.
One of the inefficient part is the parallelized processing with conditional code. For a wave-front or stream processor to compute n-dimension at once, not every core needs and computes the values of odd index of elements. So some cores must be masked as off and they are wasted.

if (j & 1)
    salsa(...);

When GPU computes N elements at once, then every variable j of different thread could be even or odd. So only the thread which has odd number in j needs to run the code salsa first. There is only one shared program counter in the compute unit, so every thread runs the same code. But for those threads that don't need the to do salsa agin, those processors are being masked off like they are not running and compute the code.

So, in the GPU programming manual, it tells you the following is inefficient.

if (A)
    B = 0;
else
    B = 1;

Then the GPU needs to run the code twice. One is for the true condition and another is for the false condition.

It's better to re-write the code as follows.

B = A ? 0 : 1;

However, in scrypt, salsa is not a simple expression can do like this way.


When is a Bitcoin Adress considered even and when odd? When is a Bitcoin Adress considered even or odd?

A bitcoin address is considered odd when the Y value in the public key is odd. This is useful to know because public keys can be compressed by replacing a really long odd Y value such as 23324234324675756756742983749 with a small odd value such as 3, which accomplishes the same thing.


Why can't the genesis block be found I create an altcoin? I have built the bitcoin source code with a new pszTimestamp, hashGenesisBlock and hashMerkleRoot

The code builds fine and does not run into any assert problems when validating these hashes on [line 128 and line 129 of chainparams.cpp]. (Great)

However...

When I run bitcoin-qt I run into the error below:

Error: Incorrect or no genesis block found. Wrong datadir for network?

Potential Cause:

Is the reason I am encountering this error because I have not yet mined the genesis block? If so how do I do that? It seems that in the bitcoin code there is nothing about mining the genesis block. I have heard rumours that this functionality was removed and that I will have to download a separate program for this step. Please confirm.

Thant is correct. You have to mine the genesis block first separately if you are compiling the most recent bitcoin codebase.

Checkout : https://github.com/vlamer/genesis-block-generator


Is it possible to send 0.00000001 BTC? I tried doing it using bitcoin-qt but it wouldn't let me. Is this to avoid blockchain spam?

What clients would allow me to send that amount?

Will I have to pay fee if I send such a small amount?

You can not send transactions that small. The minimum is 0.00005460 BTC, anything smaller is called dust and will not be accepted into the network. You will most likely need to pay a fee with something with this little priority, which will cost you more than the amount you're sending. Bitcoin is not intended for micro transactions. Also bear in mind that collecting a lot of transactions this small will cost you more in fees to spend them again than the value of the coins.


Where could I find Peercoin's documentation? The whitepaper hosted in the official page is pretty lacking in "whys" so, is there anything that resembles https://bitcoin.org/en/developer-guide with Peercoin? Any technical papers?

Peercoin's code is based on Bitcoin's code. We started a Wiki to document the differences. This Wiki can be found at this address: https://wiki.peercointalk.org/index.php?title=Main_Page

You can start with the block structure for example: https://wiki.peercointalk.org/index.php?title=Blocks

We do not have any technical paper apart from this.


Why does won't my bitcoin transaction complete? It has thousands of confirmations My transaction has over 4000 confirmations and has been pending for over 3 weeks in my Coinbase wallet. The money is not available and shows as "pending". What is going on? If it had 0 confirmations I'd understand why but no one seems to have any information on this. I've reached out to coinbase multiple times but have only received the general answers that they have posted on their website for typical reasons that transactions are pending. This transaction that was sent to me has a decent fee attached. I don't know what to do. Has anyone seen something like this before? Here is the tx
https://live.blockcypher.com/btc/tx/60c0b24e664040dc8064b58c949de91d9550d4940ae51cf1eeaeab49f75e051a/

The transaction is indeed confirmed. You should double check to make sure you sent to the correct deposit address. If yes, then you will need to contact the Coinbase customer service to have your account balance updated properly.


How to login into my wallet? I get my bitcoin address from freebitco.in. So how can I login into my wallet to know about my bitcoins? How to convert bitcoins into dollars and send it in to my prepaid debit mastercard?

Your question shows that you're quite new to Bitcoin in general. I would advise you to do a little light reading about it to understand what bitcoin exactly is. Regardless..

  I get my bitcoin address from freebitco.in . So how can I login into my wallet to know about my bitcoins?

If you acquired your wallet from Freebitco.in, you were redirected to Blockchain.info, you can log in there to check your balance. You will only have balance there if you withdrew coins from Freebitco.in in the first place. Otherwise, log into Freebitco.in and withdraw your coins.

Blockchain.info is a web wallet, you'll find all the information you need about it on their website.

  How to convert bitcoins into dollars and send it in to my prepaid debit mastercard?

You will first need to sell your coins for fiat currency. There are literally hundreds of online exchanges, or people you could find locally to sell to on Localbitcoins. Here's a nice guide to get you started.

After you've read the guide, signed up for an exchange, and sold your coins, you can have them transfered to your bank account and use the money with your prepaid card.

Congratulations on starting with Bitcoin, I would recommend you not to cash out, and instead of converting your coins to fiat, try finding places where you can spend your bitcoin instead.


What physical coins of bitcoin exists? Whenever a news article is written about bitcoin, it has this "physical" gold/brass coin with detailed circuitry on it as an article picture.

For examples see here and here.

Does this really exists? Who makes them and where can I buy one? Is it from gold? I am specifically interested in the coin with this "detailed circuitry" like the two on the pictures I linked. I was able to find some sellers of physical coins, but they are not as detailed/precise.

What other physical coins "of bitcoin" exist?

Casascius Coins are the ones that have been the most well known, though according to their website they no longer contain any actual bitcoin as of Nov 27, 2013.

https://www.casascius.com/

I am not familiar with any others, though I did find this article to be informative.

The pictures linked in the question look like they may be the Cryptmint coins in the article.

I also suspect that many of those pictures used in articles are just well-done computer-generated images.


Is sha-1 used in Bitcoin? The Bitcoin scripting language has OP_SHA1 as one of its opcodes. However, I'm not able to find any usage of this opcode (it is not used in any standard scripts nor in any other procedures such as block hashing). So my question is: is sha-1 used anywhere in Bitcoin?

SHA1 was never commonly used in Bitcoin, but it there is at least one notable use of it, a P2SH script created by Peter Todd to allow anyone to pay to an address that could be spent by anyone proving they had found a SHA1 collision.  This bounty was claimed using the published results of several security researchers who generated such a collision.  Additional bounties remain open for other hash functions supported by Bitcoin: SHA256, RIPEMD160, SHA256d, and RIPEMD(SHA256()).

There may be other users of OP_SHA1.  Because of the way P2SH works (as well as segwit witness script hashes), we can't see what opcodes people have paid to until they've spent from those scripts, so we can't be sure whether or not any particular opcode is currently in use.

Outside of the Bitcoin Protocol, software commonly used in relationship to Bitcoin (such as Git and BitTorrent) continue to use SHA1.  Some projects (such as Bitcoin Core) have taken steps to protect their work with more secure hash functions in situations vulnerable to hash collisions.


How can "Lightning Loop Out" help me to receive more payments? In his blogpost, Alex Bosworth describes that “emptying of the channel allows them to receive more payment” (https://blog.lightning.engineering/posts/2019/03/20/loop.html). But how can I allow more inbound payments by withdrawing funds from an active channel? From my understanding, the only way to get inbound capacity is a connected node that provides funds on its side of the channel?

As mentioned in other questions here there is a difference between capacity and balance.

Currently you cannot change the capacity of a channel. So let us assume you have opened a channel with a capacity of 0.1 BTC

This means you can now send up to 0.1BTC but you cannot receive any BTC on that channel.

One you used this channel to pay an invoice for example with 0.04 BTC the capacity of the channel stays the same but now you can receive 0.04 BTC on that channel which we usually call inbound capacity and you can only send 0.06 BTC (not in one payment though since the max payment limit is currently a little above 0.04 BTC) the 0.06 BTC is caked your outbound capacity. Inbound and outbound capacity together reflect the channel balance.

What loop does is that it gives you an invoice (something to pay for) and reimburses you onchain. In this way you have moved some of your outbound capacity to become inbound capacity without the necessity to spend money by actually buying something. (though you technically pay a small fee for the service)

Hope that makes it clear (:


Regarding use of bitcoin mining hardware for generating sha 256 hash, other than bitcoin mining I'm not interested in bitcoin mining , I just want to generate  sha256 hash of all possible input string of 64 characters length , can I use bitcoin mining hardware just to generate just sha256 hash for my personal use?

Most bitcoin ASICs take as input a SHA256 chaining value and a 480-bit block, and they try every possible 32-bit suffix to check if SHA256(SHA256(block + suffix)) begins with sufficiently many zero bits.

So, it won't be easy to do what you want to do (crack a password?).

There are use cases where this limited functionnality is sufficient though, see the 3SUM-pool for instance (disclaimer : it's mine).


Are there any active Bitcoin leveraged trading platforms available? For awhile Bitcoinica was a very popular leveraged trading service, but it got hacked and closed down. Are there any more services like that still functioning in the Bitcoin ecosystem?

https://icbit.se/ offers trading of futures instruments, in particular BTCUSD-12.12 (BUZ2) which enables leveraged BTC trading. However, user orders are matched only against other users (it does not utilize liquidity from larger exchanges such as Mt. Gox), and the way it works is not very intuitive.


Why does bitcoind (0.7.2) give an error when trying to issue getrawtransaction over RPC? I am writing an web application using Python/Flask. I am using

http://laanwj.github.com/bitcoin-python/doc/

to connect to my bitcoind 0.7.2 server as follows:

conn = bitcoinrpc.connect_to_local()
accounts = conn.listaccounts(0)

This is all working well. However, when I attempt to use some of the newer raw transaction calls, I get an error. For example,

raw_transaction = conn.getrawtransaction(txid)

results in the following error:

AttributeError: 'BitcoinConnection' object has no attribute 'getrawtransaction'

It seems (though I am not sure) that the methods that don't work for me are those that are listed here:

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

Thanks to anyone who can help on this.

That particular API client library does not yet implement all calls that are exposed by bitcoind. See the API documentation for a list of calls that are implemented.

The problem is that your Bitcoin client knows about getrawtransaction but the python library you're using to connect to it does not know what to do with it yet.


If Bitcoin addresses are truely random, then why are some more difficult to generate than others? In this post TierNolan explains why 'Bitpoin' is much easier to generate than 'bitpoin', and that mainly has to do with the position (first character). But I remember that certain characters (I believe 'i' and 'o') are much more difficult to generate, independant of their position in the address. How is this possible?

The 160-bit hash that is encoded in addresses is uniformly distributed ("truely random" as you call it), but the base58 encoded form is not. Some characters are more likely to occur at the start, for example.

To illustrate, consided the set of all integers between 0 and 1999. Even though each of those numbers is equally likely to be chosen, this is not true for its decimal representation. There, half of the numbers start with a 1!


Wallets that support payment channels? I know that maybe it's a bit early to start asking Wallets to implement Lightning Network connections even if the majority don't support SegregatedWitness yet.

But how about Payment Channels? In theory they have already been out there since long ago, and as far as I understand, they are not affected by transaction malleability if not combined with other channels forming a (lightning) network. So then, is there any wallet out there that already implements them? I only find libraries (such as BitcoinJ) that have support for them, but not wallets.

There are two major issues when it comes to the adoption of payment channels in Bitcoin. Firstly, we have an interoperability issue, where the implementation of payment channels in one wallet may not necessarily be compatible with the implementation of payment channels in another wallet. Even if interoperability is resolved, there is still an issue with security, how do we safely communicate the parameters required to setup the payment channels between two independent wallets in a trust-less manner?

Secondly, a Jeremy Spillman style payment channel involving one consumer and one producer is still vulnerable to transaction malleability depending on how patient our hypothetical wallet user is. If the usual 6 block confirmation recommendation is adopted, there is a low chance that transaction malleability may affect the service provider of the payment channel. However, if the service provider starts providing services by accepting an unconfirmed commitment transaction to fund the payment channel, the transaction malleability exploit can be used to invalidate all subsequent payment transactions as the consumer of the service can simply mutate her sigScript for the commitment transaction, resulting in a different transaction hash. However, this is only achievable when there's a fork in the blockchain and the mutated transaction has been committed in the winning chain or when the commitment transaction is unconfirmed and the mutated transaction was committed instead of the original transaction.


Looking for raw historical LTC data Something comparable -- though not necessarily as comprehensive -- to the datasets found here: http://api.bitcoincharts.com/v1/csv/

These links are all dead:
Is there a source for historical LTC trades available?

This site apparently had full trade data history: http://ltc.block-explorer.com/charts

...But that's dead as well.

help greatly appreciated!

A bit late, but better late than never.

No guarantee given for accuracy.
From day one to January 8 2016
For the first 262 days the average trading price is used as no closing price available.

Bitcoin price mainly from Bitstamp, Litecoin from BTCe so LTC-BTC is a bit different for BTCe price

No trade first couple of days ltc-dollar price established from ltc-btc and bitcoin dollar
The lowest closing price was on May 29 2012 at $0.0023.
The lowest recorded deal January 23 2012 at  1:36:42   $ 0.001302   4.20697  Litecoins changed hands at that price (did have all volume too, but gone. was just a spreadsheet, but link to it dead too)
Three days did not have any trades at all: 17.March 2012, 6.May 2012, 17.May 2012

LTC-USD

LTC-BTC


colored coin possible with ring signatures and stealth addresses? It is understood that colored coin is possible with stealth addresses, but what about ring signatures such as how they are used in the cryptonote protocol (Monero, Bytecoin)?

I feel like coloring the destination would undermine the obfuscation of the stealth ring

Based on my understanding of Cryptonote's ring signature implementation, no, it cannot be used with colored coins.

With Bitcoin, there is a one-to-one correspondence between inputs and outputs of transactions.  Suppose there is a transaction X with an output X1 that sends 1 satoshi to Alice's address A, and everyone agrees that output X1 is colored so that it grants title to Alice's 1977 Chevy Nova.  If Alice decides to give the car to Bob, she creates a new transaction Y, with an input pointing to X1, and whose sole output Y1 sends 1 satoshi to Bob's address B.  Now Bob can prove, by creating a signature corresponding to his address B, that he is the rightful owner of the car.  If Mallory tries to claim the car by creating a different transaction with input X1, he will be found out, because he can't sign that transaction with Alice's private key, so it won't verify.  If Alice tries to give the car to someone else by creating a second properly signed transaction Z with input X1, it will be detected as a double spend because another transaction spending X1 precedes it in the block chain.

With ring signatures, this correspondence is broken.  When creating a transaction, in addition to the one output (of a previous transaction) that you really want to spend, you can list many others.  You create a signature that proves that you are authorized to spend one of the outputs you listed, but doesn't give any information about which one it was.  However, a linking algorithm ensures that any future attempt to spend that output again will be noticed and rejected.

In the above scenario, if Alice uses a ring signature on her transaction Y, including not only X1 but another output Z1, then her signature will not prove that she is entitled to spend X1 (and therefore is the rightful owner of the car and can give it away); it only proves that she is entitled to either X1 or Z1.

Furthermore, Mallory could create a transaction M that includes X1 and another output K1 that he is entitled to spend.  Since he has the private key corresponding to K1, he can properly sign the transaction M, but it won't be clear whether it is spending X1 (which would convey title to the car) or K1 (which won't).

Now, ring signatures are an optional feature in Cryptonote.  If you want, you can create a transaction with only a single input, which will make it unambiguous which previous output you are spending.  To avoid confusion such as Mallory's transaction above, a colored coin protocol for Cryptonote would probably specify that to convey title, you have to use a transaction with a single input; then Mallory's multiple-input transaction above would still be a legal Cryptonote transaction, but the community would agree it doesn't grant him title to the car.

In short, the whole point of colored coins is to create an unbroken chain of transactions that traces the title of the car, and the whole point of ring signatures is to avoid creating such a chain.  So if you want colored coins, you have to avoid using ring signatures in this way.


How does the daemon get a transaction via a hash I am wondering how the daemon gets the transaction data from just a hash. I'm NOT asking how i can get it, i know i can get it via the rpc, i am asking how the daemon does it behind the scenes. Does it have a db of every transaction that has taken place and the block it was in? or does it just recursively search through every block?
Im stumped how it does this efficiently. Thanks

It depends on how you have configured your bitcoind and what commands you are using.

getrawtransaction first searches the mempool for your txid. The transactions in the mempool are held in memory and can be looked up by txid. If the transaction is not in the mempool. then you need to either provide the hash of the block it can be found in, or you need to have the transaction index enabled (by starting with -txindex or adding txindex=1 to your bitcoin.conf).

If you provide the hash of the block the tx can be found in, then the block's location on disk is looked up in the block index. The block is then deserialized and searched linearly for the tx.

If you have the transaction index enabled, then the txid is looked up in the transaction index. The transaction index maps txids to a location on disk (similar to how the block index maps block hashes to a location on disk). So this database allows for fast lookups too.

The gettransaction RPC is different from getrawtransaction. This is a wallet only RPC. The wallet stores entire transactions. So gettransaction just looks up the txid in the map that stores the transactions.


cloning bitcoin MAX_MONEY not working I have changed the amount of coins to be mined, to be 1000 but looks did not work, I have already 8000 coins mined, can someone explain why it is not working?

main.h

static const int64 MAX_MONEY = 1000 * COIN;  //coin limit

static const int COINBASE_MATURITY = 2;

return dPriority > COIN * 1000 / 250; //after 10 blocks the dificulty will reajust

static const int64 MAX_MONEY = 1000 * COIN;  //coin limit

Maximum amount (in satoshi) allowed anywhere (in the whole network). COIN is equal to 10^8
This is NOT the total amount of coins which your software is going to produce.

static const int COINBASE_MATURITY = 2;

Coinbase transactions cannot be spent before this number of confirms (i.e. 2)


Taproot - Eliminating Key Path I want to struct a transaction output the key-path of which I want to be eliminated, so enforcing only the script path. In order to eliminate key-path, in my opinion, I should set "Internal Public Key" to "0xFFFFFFFFFFF.." making the corresponding "Internal Private Key" unknown so the key-path signature is. By doing so anyone interested in unlocking this output, including me, must follow the script path by fulfilling its conditions. Correct me if I'm wrong. Thanks.

BIP 341 answers this. It is generally important to be able to prove that the internal public key that you choose is a point with an unknown private key. Otherwise a malicious party could hide a key path spend in the P2TR address, pretend not to have the private key for that internal public key but actually possess it.
BIP 341 also provides instructions on how to avoid leaking the fact that the P2TR address had no possible key path spend when it is spent from. If you don't care about this privacy leak you could just take the suggested point H.

Pick as internal key a point with unknown discrete logarithm. One
example of such a point is H =
lift_x(0x0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0)
which is constructed by taking the hash of the standard uncompressed
encoding of the secp256k1 base point G as X coordinate.
In order to avoid leaking the information that key path spending is
not possible it is recommended to pick a fresh integer r in the range
0...n-1 uniformly at random and use H + rG as internal key. It is possible to prove that this internal key does not have a known
discrete logarithm with respect to G by revealing r to a verifier who
can then reconstruct how the internal key was created.

A closely related question is on how to grant access to a key path spend but not a script path spend.


Can you create a valid p2sh transaction with the redeem script in the scriptsig alone? From my understanding, for a p2sh transaction to be valid the redeem script must hash to the same value as the output script being used to fund the transaction.

So can't you just put the redeem script of your address in the scriptsig and the transaction will be valid?

No, the BIP16 rules apply. They require that not only you provide a redeemscript whose hash matches that in the output (the address), but also that valid inputs for that script are provided (which will typically require at least valid signatures).


"Can't detect any devices" I'm trying to start mining using my GPU (ATI Radeon HD 4850) but when I try to run cgminer it cant detect any devices.
I use this to run cgminer: cgminer --scrypt -o stratum+tcp://stratum2.dogechain.info:3333 -u USERNAME -p PASSWORD
Im very nooby so if you can help that would be great!

Its ok I found out what was the problem- I had to update my drivers


How can I get the DateTime of when bitcoind last received a block? Is there a command to get the DateTime of when bitcoind last received a block?

No, there isn't.
getblockcount can only get the number of blocks in the best chain, but not the last received block.

You might need to write a new rpc to get the last received block.

First, add a new data structure in main.cpp and record blocks received order in ProcessBlock().

Second, write a rpc to print out that data structure.


Migrate old Bitcoin Core wallet to Trezor I have an old Bitcoin Core wallet, and recently bought a trezor.
I wanted to use it, but I am unsure how to migrate it. While I can access it with my password, I do not know how to find its 12-word recovery seed (If ever there was one).

Do I have such a recovery seed?
Is there any other way I can migrate my wallet to the trezor? (Other than creating a new wallet and transferring funds from the existing one to this new one)
Can a Trezor hold several bitcoin wallets simultaneously? (Suppose I created a new one, and later discovered I can also access the old one through it)

Do I have such a recovery seed?

No. Bitcoin Core does not use mnemonics nor is the seed exportable.

Is there any other way I can migrate my wallet to the trezor? (Other than creating a new wallet and transferring funds from the existing one to this new one)

No. The only way to migrate is to send a transaction that transfers your Bitcoin to your Trezor.

Can a Trezor hold several bitcoin wallets simultaneously? (Suppose I created a new one, and later discovered I can also access the old one through it)

No.


Do I wait or do I have to do something about it? Nooby question here, I payed/sent an amount and it failed somehow, so I tried again and again.
I checked their website and it´s all "failed" or incomplete. But is has a checkmark(sent) on Electrum. This was saturday, today is monday.

Now my question is, do I just wait and the BTC will comeback, or should I do something so it isn´t floating around?

Thanks in advance,
Alain

PS: Print so you have more details.
https://gyazo.com/41e1f54c1bb11d1739e6a8da3664911b

do I just wait and the BTC will comeback

No, the transaction be13...5f1b is complete and 0.00361861 BTC (about EUR 18.86 at time of writing) has been sent to address 1Exq...qoPf

Nothing is going to come back just by waiting

The transaction, like all confirmed Bitcoin transactions, is final and irreversible.

  should I do something so it isn´t floating around?

It isn't floating around. It has been moved to address 1Exq...qoPf. It can be spent by whoever has the private-keys from which that address was derived.

  I payed/sent an amount and it failed somehow

This is an issue with whatever software/website is showing the "failed" message - you should ask the owner of that website (or developer of that software).


I lost my 12 or 24 words to my bitcoin wallet. I just have my password I lost my 12 or 24 words to my bitcoin wallet. I just have my password. How can I get them back? Is there a software or a website where I can enter my password and get my asset back?

Sadly if you lost your seed phrase (12 or 24 words) you won't be able to regenerate your private key and get your funds control back. Best advice, look harder where you wrote it or stored it.
PS. Never write your seed phrase in any online place or take any picture, just piece of paper very well stored.


How do you install cgminer on ubuntu I have downloaded cgminer for linux and uncompressed it and tried to run it but clicking on the executable file does nothing it is marked as executable and still does not run. Is there something else I should do?

I tried to open this file:

Edit:
Here is a screenshot from the directory cgminer is in from the "ls" command

cgminer is a command-line software.

Open a Terminal and change the working directory to where you have your cgminer executable with the cd command. For example, if you have it on the Desktop you have to use the following command: cd ~/Desktop (where ~ indicates your home directory).

Then, if necessary, mark it as an executable file with the chmod +x cgminer command and finally run it with the ./cgminer command. Note that you will probably need to run it as the root user, so you probably want to run this command instead: sudo cgminer.

You can also specify command line options. For example, if your pool URL is http://foobarpool.net:3333, your username is qwertie.1 and your password is 1234 you can run cgminer with the following command so it is preconfigured and will start working right away: sudo cgminer -o http://foobarpool.net:3333 -u qwertie.1 -p 1234.

You can also specify lots of options for the GPU, fallback mining pools and other things. For a complete list, use this command: cgminer --help.


I paid in bitcoin, now I'm owed a refund. Can I demand it in bitcoin too? This is, I suppose, a legal question so I should point out that I'm most interested in US and European law.

I made a payment to a company for a product more than a year ago in bitcoin. The amount that I paid then was equivalent to $75. Now the company has failed to provide the product and they and I both agree that I'm owed a refund. However, we disagree on the means.

The company wants to refund me - in bitcoin if I wish it - to the value of $75 of today's money. It seems to me though that I should be refunded what I paid: i.e. the same BTC value that I paid. The value of bitcoin has increased substantially since I made my original payment, meaning that the BTC amount I paid then is now worth 5-6 times more.

I happen to know (through their blog posts) that the company in question does keep stocks of bitcoin rather than converting them to a fiat currency, so they have benefited from this. That said, I don't think it should matter either way.

My logic

You can consider bitcoin in one of two ways: a) a currency or b) not a currency. The conclusion is the same either way. Let's explore both:

a) BTC is a currency

If BTC is a currency then this is an easy question. I should be refunded what I paid, in the currency in which I paid it.

b) BTC is not a currency

If a bitcoin is not currency then is it unarguably an asset. Surely in this case I have given a valuable asset to the company as my end of an implied contract for them to provide the goods. Given their failure to provide the goods, they must return the asset: not a fraction of it.

Fairness

I think that, regardless of the legal side, it's fair for me to receive a full refund. Given that bitcoin has increased in value, one of us has to profit from this. It seems very unfair to me that the company should profit from their failure, whilst at the same time preventing me from making that profit myself.

I appreciate that I'm not exactly neutral in this, so I'd like to know what others think. Am I being reasonable? If I am, do I have a legal leg to stand on?

Edit:

Having read through the responses, they seem to have one or both of two themes.

"The price wasn't in BTC, it was in dollars with the option to pay this via bitcoin."
"Being able to claim a refund of the original BTC amount would open the door to risk-free speculation."

For the first, this is open to interpretation. If I was being pernickety, I'd probably say this was down to the wording of the sale. However I agree that - practically - it's pretty obvious that $75 was the price and BTC was a payment method, along with Visa, Paypal etc.

The concept of "legal tender" is one that was raised too. For something to be "legal tender'' means that one may not refuse an offer to pay a debt with that currency. It doesn't talk about refunds though: if I'm owed €1000 by someone in the US then I must accept the dollar equivalent even if I'd rather Euros. This is still €1000 though, not "whatever €1000 was worth when I entered the agreement.''

For the second, that is indisputable and probably represents the biggest flaw in my position. I would point out that the refund is not my doing: I would rather have received my order but the company cancelled it. However, that probably makes no difference ultimately.

Thanks for all the opinions. It looks like the overwhelming consensus is that I am being unreasonable, so I'll give up on my demands and accept the refund.

I am not a lawyer, but...

The Coinage Act of 1965, Section 31 U.S.C. 5103, entitled "Legal tender," states: "United States coins and currency... are legal tender for all debts, public charges, taxes, and dues."

In the USA all monetary debts can be paid in US dollars.

Second, while bitcoin is legally a payment method in the US, it does not have legal status as a currency. In the eyes of the law it's almost certain that the company will only be required to send you the original USD price of the item that you paid, regardless of the method of transfer. Legally speaking, you paid dollars through bitcoin, and the firm will return your USD, using the bitcoin payment method if you so wish. They also won't have to refund any expenses you incurred to get the money to them, like driving money, bid/ask spread you paid to buy BTC, PayPal fees, etc.

Btw, the original price was listed in US dollars, right? Not BTC.

I'd love to hear a small claims judge berate you for trying to, how can we say this,
enjoy risk-free speculative gains through the abuse of company refund policies.

Indeed if this unethical method worked, I could always use BTC to buy something with a money back guarantee, and if BTC went up a lot, just ask for my BTC back and cash in! If BTC didn't rise, I'd just keep the goods I'd originally bought, or maybe ask for my refund in US dollars, Swiss francs, gold bullion, IMF special drawing rights, or maybe even hugs...


Wallet, deposit and withdrawal management system or APIs What are the most popular solutions to create a website where a user can register, deposit crypto (not only bitoin, but all major coins, e.g. ETH, BCH, XRP, XLM, DASH, EOS etc.), receive a mail confirmation on payment confirmed, withdraw etc.?

Do you think the best is to use your own custom solution (and install the relative full nodes of the coins you want to support and use their APIs to manage the wallets) or there are robust and well known software solutions to manage user deposit?

If so, can you list a few solutions one can use to create a website to accept crypto deposits?

Requirement would be, have an address for each customer, or in case of XRP & XLM, have a specific tag associated to the customer. Just like crypto exchanges work.

So far I found coinpayments.net, but from the first sight it doesn't seem to be what I'm looking for....

Although certain coins have a few available API providers (such as BitGo for Bitcoin), any sane and security conscious company should elect to run their own nodes for each supported currency, manage their own keys, and have their own wrapper to handle deposits and withdrawals by interacting with the nodes.

This is especially relevant for coins like Monero and ZCash, where third party API providers may not be able to view transactions related to your business at all due to privacy protocols.

Once you have the infrastructure in place, the flow you described is essentially correct - you assign an address (or address+memo) to a user, and treat all incoming deposits to that address as coins belonging to that user.


Is a privacy preserving coin mixer possible on Liquid? My thoughts:
Liquid uses confidential asset and tx. Therefore the asset type and amount is hiding from chain analysis. However the utxo's still carry history. This history could potentially lead chain analysers to form educated guesses of the assets. This would be far more difficult if a coinjoin mix (batching really) had occured. Coinjoins (batching) with confidential assets and tx would be extremely powerful.

My guestion:
If a 3rd party gathered people's txs and batched them into one single tx. Would this 3rd party be able to see every input and output's asset type and amount? Or is there some fancy crypto where the 3rd can construct the tx without knowing any of that?

In the following I focus on Confidential Transactions (instead of the extension Confidential Assets) for simplicity, but all of what I say is also true for Confidential Assets.

Yes, it's possible to use cryptographic protocols to organize the CoinJoin transaction in a privacy-preserving manner. The ValueShuffle protocol is designed for exactly this purpose.

ValueShuffle indeed makes sure that no third party (e.g., a server facilitating the CoinJoin) learns the involved amounts (or assets). But its privacy guarantees go beyond this requirement: In a nutshell, ValueShuffle makes sure that the amounts of your inputs and output, and the relationship between inputs and output remain private not only to third parties but also to the other the participants of the CoinJoin.

See the ValueShuffle paper for all the details and limitations. Disclaimer: I'm one of the authors.

Your intuition that CoinJoin and Confidential Transactions are a good match is correct.
More concretely, we can exploit two important synergies.

If we have Confidential Transactions, CoinJoins with different output amounts are suddenly possible. This eliminates one of the major restrictions of CoinJoin in practice.
The combination of CoinJoin and Confidential Transaction makes it possible to mix multiple payments instead of merely mixing self-sends (if the payer additionally has a mechanism to get more than one possible address of the payee). As a result, you can mix and pay with your coins in a single transaction. This is much better than CoinJoins without Confidential Transactions, where you first need to perform a mixing transaction and only after mixing you can perform an actual payment in a second transaction. This means that CoinJoining your payments will actually be cheaper (in terms of blockchain space and thus transaction fees) than performing payments individual. This provides a great incentive for doing CoinJoins. This is remarkable because privacy usually comes at a cost -- but in a scenario where Confidential Transactions are already available, CoinJoin comes with a discount.

My talk at Scaling Bitcoin 2017 provides a more detailed explanation on the advantages of combining CoinJoin and Confidential Transactions.


blockchain official documentation I am developing a system of administrative management. The project is migrating from PHP to C ++. With the new requirements we want to work with blockchain. But when looking for more about it, despites generic tutorials, I almost always find links to blockchain implementations like Bitcoin or Eterium. But I need to implement something pure, from scratch.

Where can I find the official documentation of blockchain technology ??

Where can I find the official documentation of blockchain technology

Nowhere. There is no official body in charge of "blockchain technology".

There are many different individuals, groups and organisations all doing their own "blockchain" work more or less independently. They will often base their blockchain partly on older blockchain ideas. Each of these groups may or may not publish a definition of the blockchain they are using.

One example is the Bitcoin Developer Reference written by some ever-changing random group of mostly anonymous/pseudonymous people whose motives and accuracy you have to make your own judgement about. I suspect they are mostly OK but you have no recourse if I or they are wrong misleading or even maliciously deceptive.

The nearest thing to an official definition would probably be Satoshi Nakamoto's white paper published in October 2008. If you read and understand that, you are well-placed to implement your own blockchain. You'll need a grounding in basic cryptographic principles and algorithms (don't write your own cryptographic algorithms).

  we want to work with blockchain.

If this comes from marketing, ignore them and just add the word "blockchain" liberally to product names, documentation etc :-)

Note that The Economist Sept 1st 2018 has a 12-page section on blockchain

Although mostly positive about blockchain, it does have many cautions.

  because of its decentralised nature, a blockchain will always be slower and more cumbersome than a standard database.

Their separate lead article says:

  A few organisations, such as SWIFT, a bank payment network, and Stripe, an online payments firm, have abandonded blockchain projects, concluding that costs outweigh benefits. Most other projects are experimental.

The idea of replicated peer-to-peer databases with strong controls on integrity based on public-key cryptography goes back to at least 1984 when Ray Ozzie et-al formed Iris associates to develop Lotus Notes. Anyone selecting "blockchain" needs to have a deep understanding of which of it's characteristics are vital to their project, what alternatives exist and what the trade-offs are.


Decimal points in bitcoins I would like to know if there are more than one decimal in bitcoin numbers. While playing online slots with Bitcoin, I hit a big win for 100900 x 5 credits totaling 5207.17.The total was displayed as 5,207.17 Please explain to me how this is supposed to exactly read.

Thank you

A Bitcoin is divisible down to 8 decimal places (that is x.xxxxxxxx).


Why are banks and other centralized entities interested in block chains? Apparently banks and other centrialized entities are interested in block chain technology. My question is, why?

The whole point of block chains is for decentralized, trustless, consensus. Bitcoin, for example, uses Blockchain to reach consensus on who has how much money and which transactions have happened. It is trustless, because participants don't need much trust in each other: the system protects against fraud.

My question is, why would centralized entities care? Block chains are rather inefficient way to reach consensus when there is only one participant. It's like attaching wings to a hot air balloon.

Speaking as someone who has worked on a blockchain project for a bank, I can tell you that banks are interested for several reasons.

Banks know they are ripe for disruption

Due to a combination of heavy regulation and incumbency (mixed with a variable level of collusion), banks have remained relatively protected from the technological disruption that has been occurring in every other industry.  This can't last, and banks know it.  They are trying to get out in front of whatever technology might disrupt them, and they have enough money to throw around while investigating.  As a result, banks are spending a lot of time and money exploring the possibilities of blockchain technologies.

Banks want to reduce their transaction fees

Customers of banks are not the only ones who have to pay transaction fees.  Banks, themselves, are charged for moving money around, and are always looking for a way to reduce their costs.  If they can get together and reduce their fees by creating something like the R3 Consortium, then they will do so.  Currently, these banks would all have to transfer money to each other over ACH, Fedwire, SWIFT, or some other legacy network.  This incurs fees and counter-party risk.  If the general public can use a blockchain to remove counter-parties, why shouldn't banks?

Blockchain solutions offer faster transactions than the current infrastructure allows

The project I worked on for a bank was implementing a private blockchain for supply chain financing.  Sending money internationally to pay for manufactured goods and parts has always been a hassle, even for the banks.  There is a lots of risk involved, and delivery of product is often held up by archaic money transfers.  If banks can reduce this time and risk by way of a private blockchain, then factories and suppliers can get paid sooner, and goods can be delivered in a more timely fashion.  This is very appealing to the customers of a bank who are doing business around the world, and even to the bank itself.  Suppliers offer discounts for faster payments, called dynamic discounting.  By using a faster payment solution, banks can lend credit to the purchaser, obtain the goods for the discount, and split the difference with their customer.  The supplier gets paid sooner, the customer gets their goods for cheaper, and the bank gets to charge a larger fee than the otherwise would have.  It's a 3-way win.

Blockchains offer a better solution to traditional bookkeeping and auditing

A bank can be thought of as a big ledger of whom owes how much money to whom.  When money is transferred between banks and other financial institutions, what is really happening is that both institutions update both of their ledgers to show that recipient owes a little more, or the sender owes a little less.  These are two separate ledgers, and banks have entire departments that keep track of them and audit them, making sure they are in sync.  That costs money and takes time.  A blockchain can also be thought of as a big ledger.  Banks are curious if blockchains can replace the large amount of work that has always been done to keep these records updated and correct.

Blockchains offer a reduction in fraud

Probably the number one thing banks have been worried about in recent years is fraud.  Fraud has been the fastest growing crime since the turn of the millennium, and banks are often left picking up the tab.  When Target and Home Depot had their point of sale systems compromised, and millions of customers had their credit and debit cards stolen, it was the banks that had to pay the brunt of it.  They not only had to incur the costs of the fraud, itself (along with the merchants), but also the costs to re-issue cards to millions of customers.  Banks are interested in any technology that promises to reduce fraud, and blockchains get suggested often.  Just how the banks plan to use blockchains to reduce fraud, I don't know, but I can assure you that they are going to try to find a way.

Conclusions

My personal opinion is that private blockchains offer a lot less than a public blockchain such as Bitcoin does.  However, they still have many use cases within the world of traditional banking.  Because the technology, and Bitcoin, have the potential to be very disruptive, banks are becoming acquainted with it as an act of preparation for the future.  Bitcoin suffers from an image problem, as well as having many unanswered questions in the realm of traditional financial regulation.  Private blockchains offer banks the opportunity to "dip their toes in the water" without the risk of running afoul of regulators.


How do you return a specific amount of bitcoin to an address? I am trying to write a program to receive bitcoin, and then after some time, return the same amount of bitcoin to the same address.

How would you do this? Does bitcoin have the ability to send and receive coins through the same address, or would I have to ask for a return address and somehow link the sent amount address to the return address?

You should ask for a return address. Bitcoin transactions don't contain any "from address", it only references another (previous) transaction's output. An output can be a P2PKH (Pay to public key hash), but it can just as well be P2SH (Pay to script hash) and some other may be implemented in the future.

There's also a large possibility of getting a transaction referencing many previous outputs, as happens when someone paying you 1 BTC received many smaller transaction previously.

It would also be unintuitive to your users, as it's bitcoin best practice not to care about where the bitcoins come from and instead to generate a new address for every transaction received.

On top of that, you shouldn't implement any cryptography by yourself if you're not already a top-level expert, there are simply too many things that can go wrong. I would recommend using a proper API.


Moving funds from MultiBit 0.5.18 into new Software (Electrum) Since Multibit support has ended I want to move my funds to a new software. As far as I've seen Electrum is recommended for this purpose. I've followed instructions from the answer of Dr.Bob https://bitcoin.stackexchange.com/a/57325/113828 in this question.
Now I've a Electrum 4.0.9 wallet with status [imported] and it displays the correct amount of credits at the bottom of Electrum.
Can I now leave things as they are and I've switched successfully to Electrum? And I can use it for upocming sendings and receivings? I just want to make sure sure that someday my funds won't be inaccessible since Multibits support has ended.

You can use it. Electrum, nowadays, is as popular as Multibit used to be, so you can assume that you will always be able to recover your coins.
To be safer, you can export the private keys from Electrum and save them in an encrypted archive such as ZIP or 7zip. (But you need to do this every time you make a transaction)
What I would actually do would be to create a new wallet in Electrum, but this time, of type HD wallet. Then you can write down just a few words (12 or 18 ?) and be able to physically backup your coins. This would have the advantage of not having to update the backup as all your private keys would be deterministic childs of your master key (=those words)


Multiple Currency Pairs returned in Single API Call Does anyone know where can I find an API that outputs an array of cryptocurrencies (BTC, ETH, LTC, etc.) converted to USD?

For Example:

www.somesite.com/api/rest/baseCurrency=USD

Returns:

{
    "Data": {
        "BTC": {
            "Id": "1231",
            "Name": "Bitcoin",
            "CurrentAsk": "4481.01"
        },
        "ETH": {
            "Id": "3242",
            "Name": "Etherium",
            "CurrentAsk": "322.09"
        },
        "LTC": {
            "Id": "4354",
            "Name": "Litecoin",
            "CurrentAsk": "73.57"
        }
    }
}

I'm aware that I can make multiple API calls to get this information, but would rather retrieve the information I'm looking for in a single call.

Thank you


How to use blockstream's REST api to retrieve JSON output on an address? I have a bitcoin address and I want to get the JSON format of the balance using blockstreams api service.

It's this one: https://github.com/Blockstream/esplora/blob/master/API.md#transaction-format

It's not clear on what I need to put in the URL. I tried:

  https://blockstream.info/address/:bc1xxxxxxx

and it doesn't work.

As others have said you can use https://blockstream.info/api/address/bc1qgsmfaz22lzy08wqjspd8xtm43hal5tgz4hyac6 for the JSON - the doc is in reference to running a local instance - the exact endpoint is depending on deployment, the default deployment we use has nginx forward /api/ requests to electrs without the api bit https://github.com/Blockstream/esplora/blob/master/contrib/nginx.conf.in#L32 but it depends on how people want to deploy it.

We should probably mention this in the API.md file to avoid confusion


Which function in which file verifies that transactions are the right size Which file(s) are responsible for the procedure which confirms that transactions are well-formed, specifically that "Size in bytes < MAX_BLOCK_SIZE" as described in the Protocol Rules article on the wiki: https://en.bitcoin.it/wiki/Protocol_rules?

The function, which is found in main.cpp is called CheckTransaction():
https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L526


Multibit HD 0.5.1 with Unconfirmed transactions for months now Multibit HD 0.5.1

This is my wallet's transaction list and amount:

I am having the following issues:

I don't understand why do I have 0.07btc ~ 224.59$ unconfirmed for a month by now.
I have three transactions there that are still sending/receiving... What the hell?

These are the transactions in the blockchain:

https://blockchain.info/tx-index/9ca971dfab49b924bde33664505c7f3f19e3480171cc2e4c04b93a07e8ec4305
https://blockchain.info/tx-index/9e3f1b829b13731701a8aa71f97675c4c60881c622712f7a664f0cff63a75044
https://blockchain.info/tx-index/d22eefe0f139a825e725c403f029c907cd6975b8706d4f1e4b47b85025ccf797

I have tried the following solutions that failed:

Wallet repair multiple times
Wallet removal and reinstallation, from the seed words
Wallet recovery on another computer

What I didn't try:

Double spend (how do I do it in Multibit HD?)
Remove transaction from mempool or wtvr (how do I do it in Multibit HD?)

I got help from BTC Portugal (Portuguese slack channel, thank you @riclas, @shutaru and @malmen) and was able to solve this issue.

This is what I did (ETA: 10 minutes):

Close all running Multibit HD wallets you have. I really mean all, no computer in this planet should be running your wallet at this moment.
On a "new", clean computer, or in a Virtual Machine, install Multibit HD, a fresh installation.
When the new Multibit HD installation asks you, instead of creating a new wallet, chose the restore wallet option.
Insert your seed words and date.
Voila! It will now take some minutes to synchronize your wallet with the chain, but it should load only the confirmed transactions.
Go to the other computers, uninstall Multibit HD completely.
Make sure you delete everything in folders such as C:\Users\<user name here>\AppData\Roaming\MultiBitHD (or /Users/<user name here>/Library/Application Support/MultiBitHD/ for OSX) or simply search for MultiBitHD files on your disk and delete them all.
Install the wallet once again in those computers and recover just like you did in steps 3 and 4.
Profit!

If you are really in a rush, just perform steps 6, 7 and 8.

Don't do any of this if you don't know your words and date for recovery!

UPDATE: This doesn't actually solve the issue. In fact the wallet thinks that all your transactions are confirmed, until you try to spend the money. Then you'll get a Low spendable balance detected. some of your bitcoins are tied up with ongoing transactions. error.

The thing is that the wallet refuses (or the network refuses) to double spend that money, because they see the unconfirmed requests already broadcasted.

For what I've read these requests will never timeout from the mempool. This is a known issue of BTC, and is making this coin hard to scale to the rising numbers of transactions (as of now only 3 transactions are processed per minute, which is ridiculous).

The only way I can perceive now to "solve" these unconfirmed transactions, is to use accelerators.

These accelerators are basically mining pools (a huge team of miners), where you ask them "pretty please" to consider adding your transaction to their next created block. This will confirm your transactions. However, this solution is at very least, not accessible.

You can try asking it for free here: https://www.viabtc.com/tools/txaccelerator/

After I get my money back, I'll consider not using Multibit HD anymore, since issues like these made me lose some money so far...


how to evaluate if this (or any) bitcoin public key / private key combination is valid? Let's say some software gave me the following combination:

public key:

13YcHBzsBX8SxHoBftb69cXJkdXLfAVQos

private key:

KwfNqMip1ZdgG2o6wYQUBXv8BqkMQ8VWWeScVU5TLPZp31M5EHeq

And let's say that for whatever reason, I want to test the validity:

that the public key is a valid bitcoin address that can receive payments, and
that the private key is valid for this particular public key

What are my options to evaluate the validity of 1 and 2?

1) A Bitcoin address is between 25 and 34 characters long

2) the address always starts with a 1 (in this case)

3) an address can contain all alphanumeric characters, with the exceptions of 0, O, I, and l.

(ref: https://thomas.vanhoutte.be/tools/validate-bitcoin-address.php)

Now here comes the hard part: The last four bytes of the address are the first four bytes of Sha256(Sha256(2,3,4...21th bytes of the address))

More info: https://bitcoin.stackexchange.com/a/50879/38618


Should I leave the Bitcoin client open? Some people recommended that I leave my Bitcoin client open because it helps the network.

Apart from the security implications, why should I do this? I thought that miners were the ones responsible for validating transactions and including them in the blockchain. What role does the Bitcoin client play in the network?

I would add two points to those already mentioned: First, if you cannot accept inbound connections (because you are behind NAT or have specifically disabled them) you won't really be helping the network. Second, if you are running any version earlier than 0.3.24, you could actually be harming the network, due to a bug in those versions.

For some reason that isn't well-understood, the Bitcoin peer-to-peer network is consistently short of available inbound connection slots. This makes it more difficult for newly-started clients to establish a resilient connection to the Bitcoin network. If you can accept inbound connections, leaving your client running helps reduce this problem.


Why I am not seeing received money in my electrum? The manual said that it will show up on history.

Status: 0/unconfirmed, broadcast through 4 nodes
Date: 10/26/2015 18:21
To: 19pHw8gbRP596CbiDdjNQbBrddAgQJ8pK2
Debit: -0.00956976 BTC
Transaction fee: -0.00043024 BTC
Net amount: -0.01000000 BTC
Transaction ID: e816ada72c9b8940a67779825423bc473e3059fb5f9f5aab9d09ee19c636fa23-000

It didn't show up. Not even pending.

And I think I got the right address

Update: Transaction details changed. Now I got 71 confirmation. Still no money on electrum

e816ada72c9b8940a67779825423bc473e3059fb5f9f5aab9d09ee19c636fa23-000

Is there a refresh button or something? Is my electrum doesn't work.

version 2.0.2 is very old. Before asking for help, please upgrade to the latest version.
if the issue persists, enter wallet.clear_history() in the electrum console, and restart electrum


If bitcoin is decentralized then who keeps track of computers in network I keep hearing that bitcoin is decentralized i.e. no single entity owns it. And each computer which is part of bitcoin network keeps the copy of ledger.

My question is who keeps track of all computers in bitcoin network? For e.g. if a transaction happens, who sends (or broadcasts it) to network so all can keep a copy of it?

Doesn't it make it centralized?

Nobody keeps track of all the computers in the network, or at least not as part of core network functionality.  There are sites that attempt to track nodes (such as https://bitnodes.21.co/), but they are not needed in order for Bitcoin to function, and are not utilized by nodes.  Each node only knows about the nodes it is connected to.

Therefore, to broadcast a transaction, a node simply sends it to the nodes to which it is currently connected.  Those nodes, in turn, relay the transaction to all their connections who all do likewise.  This means a transaction can reasonably be seen by all nodes in a very short amount of time (a few seconds or less).

For information on how nodes find other nodes to connect to in the first place, there's already some great answers here:

How do Bitcoin clients find each other?


Are there any legitimate cloud mining services? Are there any cloud-mining services that you can earn Bitcoin with and aren't Ponzi schemes?

Most of the cloud mining services are scam and doesn't stays in the long run. You can check out this thread to avoid cloud mining: https://bitcointalk.org/index.php?topic=878387.0

Good luck.


GUIMiner not detecting my GPU (AMD Radeon HD 7600M Series)? GUIMiner does not appear to be detecting my GPU. Under available devices, I am only able to see my CPU. I have an AMD Radeon 7670M GPU, that I have the most updated driver for and can confirm that it is enabled and working.

In my Device Manager, the GPU shows up under Display Adapters and there are no errors.

Screenshot of my GUIMiner GUI, as well as the summary of my GPU from GPU-Z:

Why is this GPU not being recognized? For the record, I have been able to use GUIMiner previously using the same graphics card, but have not used it for months and since that time I have upgraded to Windows 8.1 (x64).

The code name 'Turks' is the Fabrication process and transistors name. This means it is the GPU. There are also name such as: Cedar, Caicos, Juniper, Barts and Cayman. Don't ask me why that named them this.


Why are 0.13.1 Core nodes connecting only to Witness (e.g. 0.13.1) nodes? I have my Core 0.13.1 node configured to connect to 16 nodes, and invariably I see it connected only to other 0.13.1 nodes, even though, according to bitnodes leaderboard, these nodes form a minority.

Why is the selection logic this restrictive?

I am also noticing my 0.13.1 node that accepts incoming connecting as relatively overloaded I/O-wise since it upgraded.

I can understand this selection logic being necessary once SegWit activates, but why already, given we don't know yet whether SegWit will activate?

Related: https://github.com/bitcoin/bitcoin/issues/9072

Bitcoin Core 0.13.1 preferentially maintains at least 4 outgoing peers that advertise NODE_WITNESS support to avoid being partitioned. You are not only connecting to these nodes, more than 4 outgoing peers is coincidental or caused by those being other peers you recently connected to.

  even though, according to bitnodes leaderboard, these nodes form a minority.

Bitnodes only shows peers with listening sockets available. There is an unknown, greater number of nodes in existence which do not listen on a public port and will not be part of that leaderboard, but will connect to you. The preferential peering is exacerbating that effect, but is completely necessary.


Implementing a Blockchain at the very basic level? My question may sound a bit confusing so a bit of a background is in order. I am doing my Computer Engineering Final Year Project related to parallel processing and GPGPUs. i'll be working on implementing the Blockchain architecture on GPGPUs.

To find the initial point of my project , my advisor has asked me to 'implement' the block chain.

Now , being an undergraduate and a beginner at all this , it sounded quite confusing to me. However , after some research , i have found that you can 'fork' the bitcoin core for implementing the blockchain.

However , i am not the most prodigious coder and have more affinity with hardware aspects. so i need some help in deciding how to implement the blockchain on a very simple level , as in , what's the most basic coding task/basic operation i have to do to atleast start the implementation or establishment of a blockchain.

kindly do help me out , as i have been handed a very tight deadline by my advisor

Bitcoin Core is a software which maintains the blockchain ledger, You can obviously fork it and go through the entire code and make some changes to the source code to make your own blockchain (This is what every blockchain company is doing nowadays under the pretext of creating blockchain technologies.)

However, the above mentioned task is really time consuming. What you can do is study the workings of the bitcoin blockchain, and simulate them using a more popular database. There have been cases where people have sold their 'blockchain' technology with SQL running at the back. Blockchain is basically a database(highly replicated) and you shouldnt confuse it with anything else.

So trying to make a blockchain from scratch will obviously take a lot of time in learning and then coding. If you are going with the "hidden SQL" blockchain , or for that matter any other db, you would need to make APIs to access the blockchain(just like bitcoin core). You dont need to have all the API's obviously, but the ones which are crucial for the blockchain you'll have to emulate.


Coinbase has the address of a bitcoin stored on a blockchain account. How do I access it? I don't have the login to the Blockchain account that I stored the bitcoin on. I do have proof of the purchase and transaction of the coin and the coins address, as it is stored on Blockchain. How can I retrieve the coin from Blockchain back into my wallet on Coinbase ?
Thanks.

I assume you mean that you have a a blockchain.info/.com wallet.
You will have to log into the wallet and initiate a transaction.
If you cannot do that, and you do not have a wallet backup, then you are likely out of luck, the coins would be effectively lost.
You could attempt to contact their customer service to see if they can somehow let you log into the account.


where is the code about sending command getblocks in bitcoin source code I am reading the protocol part. One silly question. I found the part processing getblocks part, but i did not find when and where to send the getblocks command.Or it is deleted in the new bitcoin edition.  Any idea, I will appreciate it very much.

You're correct: the Bitcoin Core master branch no longer sends the getblocks message because it uses headers-first synchronization to get all the headers (with the getheaders message), allowing it to hash the headers itself, verify their proof-of-work, and request the corresponding blocks in parallel from multiple peers with getdata messages.  I believe the upcoming version 0.10 branch is supposed to be forked off of the master branch later today.  (Will update answer with link when that happens.)

Here are some direct code links:

Bitcoin Core 0.9.3 sends the getblocks message with this line.  That function is defined here.
In the master branch, this is the patch that replaced the line above

Bitcoin Core version 0.10 will continue to process the getblocks message from remote peers, as you note.


Microsoft Azure VM selection for optimized mining I've come across a decent amount of Microsoft Azure credit and want to use it to to mine cryptocurrency.
I am writing to ask:

which computer to run the VM on - Azure provides a number of machines (https://azure.microsoft.com/en-us/pricing/details/virtual-machines/series/#a-series) optimized for various tasks - 'General Purpose Computing', 'Compute Optimized', 'Memory and Storage Optimized', 'GPU enabled', ect. Under each of these categories, customers much choose the number of  cores and amount ram (see https://azure.microsoft.com/en-us/pricing/calculator/?service=virtual-machines) to use.
I would like to know which machine type will mine the most efficiently, and how important are the different characteristics of a machine? (the number of cores, the amount of RAM, GB on disk?)

Which currency to mine - Bitcoin? Litecoin? any other Alt-coin suggestions?

How much money can I expect to earn?

Thanks!

Regardless of the cryptocurrency you choose to mine, you should get the machine with the most GPUs and CPUs as you can get (GPUs are especially important). This is because most, if not all, of the hash functions used in altcoins can be and have been GPU accelerated, so GPUs will be able to mine them far faster than CPUs can. Having more CPUs allows you to get a little extra hash power from the CPU as it can still mine, just less efficiently and less quickly than GPUs.

As for what to mine, I cannot tell you. I can say that you should not mine Bitcoin as the difficulty is too high for GPU and CPU mining to ever be profitable. Bitcoin mining requires special machines called ASICs now in order to actually mine something non-negligible.


Node: How to keep persistent incoming connection? I've written a simple script "node" that will connect to the local node running on my computer.

I can see that it's connected using:

$ bitcoin-cli getpeerinfo

{
    "id": 27,
    "addr": "127.0.0.1:37992",
    "addrlocal": "127.0.0.1:18333",
    "services": "0000000000000001",
    "relaytxes": true,
    "lastsend": 1479746037,
    "lastrecv": 1479746037,
    "bytessent": 325460,
    "bytesrecv": 6007,
    "conntime": 1479745618,
    "timeoffset": 0,
    "pingwait": 419.673504,
    "version": 60002,
    "subver": "",
    "inbound": true,
    "startingheight": 0,
    "banscore": 0,
    "synced_headers": -1,
    "synced_blocks": -1,
    "inflight": [
    ],
    "whitelisted": false,
    "bytessent_per_msg": {
      "block": 236393,
      "getheaders": 1053,
      "inv": 5898,
      "ping": 32,
      "tx": 81934,
      "verack": 24,
      "version": 126
    },
    "bytesrecv_per_msg": {
      "getdata": 5898,
      "version": 109
    }
  }
}

However, the script will eventually lose connection to my local node and stop receiving messages. This usually happens within a space of an hour.

What causes a node to drop a connection to an incoming node?
Is it possible to make my local node to allow a permanent incoming connection (from my local script)?

EDIT: I've tried addnode=127.0.0.1 in my bitcoin.conf, but it doesn't help with reconnecting if the connection is dropped.

Solution: The node has been sending my script ping messages, but my script was not responding with pong messages.

  The ping message is sent primarily to confirm that the TCP/IP connection is still valid. An error in transmission is presumed to be a closed connection and the address is removed as a current peer. https://en.bitcoin.it/wiki/Protocol_documentation#ping

Therefore, my script "node" appeared to be unresponsive, so the local node would drop the connection.

Thanks to Pieter Wuille for pointing me in the right direction.


Import wallet or transfer coins Say if I am changing from CoPay to Bitcoin Core, is it recommended that I try and import my CoPay's private keys to Core, or just send the coins over to my Core account.

It depends on two factors.

One is, how many unspents are your funds spread across in CoPay? Will it be a really large transaction which will need high a transaction fee? Then sending to Core might be easy, but at a financial cost.

Two is, how comfortable do you feel with exporting CoPay's priv keys, safely transferring and importing then into Core? If you are OK with it, then you save the transaction fees.