When should proof-of-work be done? Does it involve in mining a coin? Can it be done without real transactions to be recorded? I am trying to understand about what bitcoin is. I conceptualize bitcoin as a proof of work required when a new block (or new coin) is created. I also understand that a proof of work involves finding a value (nonce) that would meet a zero bits requirement when hashed. (please correct me if my understanding is wrong).
Am I right saying that bitcoin mining is to find such a value that would satisfy the zero bit requirements when itself only is hashed, or one that results in the required zero bits when the value itself and the transactions chosen, the previous hash, and other relevant items are hashed all together? If the latter is right, would finding a coin to create a block be only possible once there is a real transaction occurred? If this is true, what is it people mining bitcoins are doing? Are they actually creating and circulating a block in a peer-to-peer network with real transactions? If not, am I correct to think that they can be random people who use available computing power to find nonce values that meet the zero bit requirements and sell them to real owners of the nodes in a peer-to-peer network who use them to create blocks from their nodes. I am sorry for the dumb questions, but please help me to understand these fundamentals right. Thank you very much!

I also understand that a proof of work involves finding a value (nonce) that would meet a zero bits requirement when hashed.

The nonce is a value that a miner can change. It is one part of a block. The other parts are block headers and transaction details. The hash is of most of this, not just the nonce. The hash must be less than the current target "difficulty".

Am I right saying that bitcoin mining is to find such a value that would satisfy the zero bit requirements when itself only is hashed, or one that results in the required zero bits when the value itself and the transactions chosen, the previous hash, and other relevant items are hashed all together?

The latter.
As I mentioned, the comparison is not the number of leading zero bits but a normal numeric comparison. The hash must be numerically less than the target.

If the latter is right, would finding a coin to create a block be only possible once there is a real transaction occurred?

A block can contain no real transactions other than the so-called "coinbase" transaction which pays the miner a mining reward.
Including other people's transactions allows the miner to collect and claim the transaction fees. SO there is a financial incentive for the miner to include transactions.

If this is true, what is it people mining bitcoins are doing? Are they actually creating and circulating a block in a peer-to-peer network with real transactions?

Yes.

If not, am I correct to think that they can be random people who use available computing power to find nonce values that meet the zero bit requirements and sell them to real owners of the nodes in a peer-to-peer network who use them to create blocks from their nodes.

No.


Get input address using VIN txid? I have written following script to get Vin address from Vin txids.

#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests,json
url="http://asd:asdf@localhost:2332"
payload={}
payload = {"jsonrpc":1,"id":"curltext"}
 txid= "10ff6ff5bdc73d7bb6d711c6896618a05479d061e67f576a0950328c1389035f"
addresses = []

payload["method"]="getrawtransaction"
payload["params"]=[txid,1]
response = requests.post(url,json.dumps(payload))
response =response.json()
response= response["result"]["vin"]

for data in response:
    raw_tx1=data["txid"]
    vout_int=data["vout"]
    payload["params"]=[raw_tx1,1]
    response_ = requests.post(url,json.dumps(payload))
    response_= response_.json()
    data_ =response_["result"]["vout"]
    for item in data_:
        if item["n"] == vout_int:
            json_data ={}
            json_data[item["scriptPubKey"]["addresses"][0]] = item["value"]
            addresses.append(json_data)

print addresses

for some txids i get proper o/p for example:

[{u'MKHWXiX9Xm37jdCM8EzWMWNRJPhuwUxWiN': 50.0},{u'MVTpa2h3DGFWxkcmEkYLv4cYGggVprjjDZ': 300.0}]

but for other its says

    response= response["result"]["vin"]
TypeError: 'NoneType' object has no attribute '__getitem__'

Why is it behaving like this? Isnt it supposed to have uniform output irrespective of txids? If my approach is wrong then how was i getting correct for some tx ids again?

That error means that either response or response['result'] is None which means that getrawtransaction is probably unable to find the transaction id that you are providing.

Before you try to read data from the response, make sure it isn't None and actually has a result.


Consider Bitcoin Price goes down to $3000, what will be the effect on miners (will they stop mining) and the affect on difficulty to mine a Bitcoin? Over a set period of time (around 10 mins for BTC), a number of transactions are compiled into a block by a miner, and then the block is verified on the general ledger and added to the list of blocks which make up the blockchain.

Consider the price of Bitcoin goes down to $3000, will this effect Mining operation go on?

What actually going to happen to the difficulty of solving problems in mining?

Thank you in advance.

Regards,

Raghu Ariga

More than a question it seems like you are asking for a prediction of behavior. What miners will do eventually, and how getdifficulty will be affected, has been central to many conversations around Bitcoin.

In my honest opinion, even at 3000 USD per BTC it is still highly profitable for miners. The key factor is if miners need to move their generated Bitcoins to fiat money to pay bills.

If a miner or mining pool manages to avoid these payments based on future price -something they should aim at-, they will be doing quite good with even 1000 USD per Bitcoin.

Remember that we are creating the Bitcoin/Frame/Economy. Trading for fiat currency is just not the main idea behind cryptocurrencies.


GPU mining with Intel HD Graphics 4000 I am running Mac OS X 10.7 on a MBP and OS X 10.8 on a Mac Mini.  The Mini has a Intel HD Graphics 4000 GPU and the MBP has a 3000.

I know that I cannot mine with the MBP as the GPU does not support OpenCL.  The Mac Mini should be able to as the Intel HD 4000 supports OpenCL 1.2.

However when I run:

bfgminer -n
 [2013-12-04 15:35:22] 0 GPU devices max detected

My GPU is not detected.  I have the latest XCode installed as the well as command line tools and compiled bfgminer with the latest install of brew.

I just want to play around with mining and am not interested in buying an ASIC set up.

How can I get my GPU to be detected by bfgminer or cgminer?

Update:

When I run 'bfgminer --verbose' I get the following error:

  [2013-12-04 17:30:57] JSON-RPC call failed: {    "code": -1,
  "message": "Unsupported method 'getblocktemplate'" }

The following program will show you the OpenCL-capable devices on a given Macintosh:

// clang -framework OpenCL dumpcl.c -o dumpcl && ./dumpcl

# include <stdio.h>
# include <stdlib.h>
# include <OpenCL/opencl.h>

int main(int argc, char* const argv[]) {
    cl_uint num_devices, i;
    clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);

    cl_device_id* devices = calloc(sizeof(cl_device_id), num_devices);
    clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, num_devices, devices, NULL);

    char buf[128];
    for (i = 0; i < num_devices; i++) {
        clGetDeviceInfo(devices[i], CL_DEVICE_NAME, 128, buf, NULL);
        fprintf(stdout, "Device %s supports ", buf);

        clGetDeviceInfo(devices[i], CL_DEVICE_VERSION, 128, buf, NULL);
        fprintf(stdout, "%s\n", buf);
    }

    free(devices);
}

If it fails to show you your GPU then its a driver issue.If it succeeds then its some kind of a configuration error.


Dump results from bitcoin-qt debug console to file I would like to issue some commands in the Bitcoin-qt console and save their output to a text file (ideally, filter it before saving). Is there a way to do that, similar to how I would use grep and > in a regular Linux terminal?

You can install bitcoin-cli, and update your bitcoin.conf to enable the RPC server. bitcoin-cli will let you pipe the output from the commands through to any shell commands you want, or redirect to a file.


Is it possible to use bitcoin core on Mac OS Sierra saving the data on the network drive? I got Mac Book Pro 2015 with Mac OS Sierra 10.12.6 (16G29) and 3 TB WD MyCloud network drive. I need to run bitcoin core client saving the blockchain data on this network drive, located on my home network. I created a symlink:

admins-MacBook-Pro:~ admin$ ln -s /Volumes/User/Bitcoin ~/Bitcoin

This worked fine, then tried to run the Bitcoin-qt client:

/Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -datadir=/Users/admin/Bitcoin/

But got this result:

Deleting the .lock file does not help. No files are created in the directory except the  .lock file.

What is the reason and how to make it work?

Update: strange enough, but using the same machine on the same network, but different OS (Windows 10 via Bootcamp) the Bitcoin-Qt application works just fine with the data directory on the network drive. It started syncing.

Core (more specific levelDB, the database library used) does not support network drives.
Also, the UTXO access (chainstate) must be as fast as possible and should run on an internal drive, ideally an SSD.

If you need to reduce/transfer disk usage, there are two main possibilities:

Pruning

Add prune=550 to you bitcoin.conf (or startup with -prune=550) to reduce the kept block data to a minimum. Your node will still do full validation but does not server old historical blocks to other peers.

Symlinks

Symlink the blocks directory is possible. Check https://en.bitcoin.it/wiki/Data_directory#Transferability


Does the Prospero X-1 have an USB port? I have looked everywhere but cannot find out whether the Black Arrow Prospero X-1 has a USB port for connecting to a computer (and interfacing with miner to start mining). Does it have one?

You use the explorer and typing the ip adresse for the prospero, and then you get a web interface for setup.


How do I get my private key? Background

I saw this on the internet

I didn't think signing / verifying was possible with P2SH addresses, so I guess this wallet must be using something like signmessagewithprivkey
     ¯\_(ツ)_/¯

Anyway, with signmessagewithprivkey "privkey" "message", privkey is required and doesn't provide a default.

Actual Question

How do I get (see) my private key?

That depends on what type of P2SH address it is. Only some P2SH script types actually have a one-to-one relationship with a private key. The most common case is probably embedded segwit. If its a P2SH-P2WPKH address, you can retrieve the public key from the embedded P2WPKH script using the dumpprivkey RPC command.


Lightning Network node without opened channels If I have a LN node without open channels, does that improve the robustness of the network? I have a BTC and LN node running 24/7 on a Raspberry Pi 3, and no BTC at the moment to open a channel.

Running a Lightning Network node without any open channels doesn't really make the Lightning Network more robust. Unlike the main Bitcoin layer, the Lightning Network does not rely on or require other nodes to verify transactions. Thus a Lightning Network node without any open channels is simply a data relayer which there are many (all of the other LN nodes). There really isn't much data to relay anyways, and you relayhing it does not ultimately help LN that much.

The usefulness of a LN node is to provide capacity for routing payments over additional payment channels. Since you do not have any payment channels, your node isn't really helping with that.


Why isn't 'classic' Multi-Paxos Byzantine Consensus used for public Blockchains? Any solution to the Byzantine General's Problem can be used as a consensus method to base a distributed ledger on.

Why then, did Satoshi Nakamoto choose for the super-expensive (in electricity and CPU cycles) Proof-Of-Work?

I can think of these reasons:

Proof of Work takes time, which means that blocks take time. (But nowadays this is actually a drawback?)
Miners are paid out by the PoW. (But couldn't this work in a Multi-Paxos environment as well, where basically all miners would like to become leader for the next round?)
A Proof-of-Work chain will still work if the network netsplits into two pieces. This will create separate blocks in each half of the network, actually being a problem when the two halves are joined again (because then one of the two chains is discarded, which, if the netsplit took multiple minutes before healing, means that people and external systems might have acted based on their now-invalid balances.)

Clearly these reasons are not good enough. So what real reasons are there to use Proof-of-Work over e.g. Multi-Paxos or another 'classical' solution to the Byzantine Generals Problem?

Nakamoto Consensus has some properties that are superior to BFT algorithms. (It also has some properties that are inferior, but that's another story).

First, BFT algorithms assume a central authority picks who the participants are. NC, on the other hand, allows anyone to attempt to win the next round.

Second, BFT algorithms generally require 2/3 + 1 (e.g. 67%) of the participants are honest. NC sets a lower threshold of 1/2 + 1 (e.g. 51%). That's because NC's PoW prevents a node from broadcasting two messages at once.

Finally, NC has the interesting attribute that the moment a miner "wins", they also simultaneously choose the transactions they are going to include on the block. This means there is no window of opportunity for an attacker to attempt to influence the winning miner to break the rules.

Note that Paxos is not a BFT algorithm. Paxos solves for stop-fail failures. The worst a node can do is stop working. Paxos does not solve for "byzantine" failures, where a node can try to say two different things.


Why not implement GHOST in bitcoin? GHOST can provide higher transaction throughput by minimized block interval, but community people seldom mention it. What's wrong with GHOST?

GHOST is outdated, the more relevant protocol based on recent research by Aviv Zohar et al is called "SPECTRE" - https://medium.com/@avivzohar/the-spectre-protocol-7dbbebb707b5, https://eprint.iacr.org/2016/1159.pdf.

It has many advantages over the traditional longest-chain rule of Bitcoin, but:

It requires a hard fork, something which has never been done intentionally in Bitcoin.
It is a huge departure from Bitcoin's protocol, and as such it will require extensive research and testing before it is even considered for inclusion in Bitcoin.

There are alts under development that are trying to implement SPECTRE, if it works well for them it can be a first step towards consideration in Bitcoin. You don't risk untested ideas on a $100B production system.


How to get access to funds on keys that were derived using public key child derivation? BIP 32 If I have a key m/0'/0' and I'm using CKDpub to derive m/0'/0'/0 and then CKDPub to get m/0'/0'/0/0. How do I get access to the funds on the addresses generated by CKDPub?

Can m/0'/0' ->  CKDPriv -> CKDPriv => m/0'/0'/0/0 key use those funds?

Another way: if I take a private/public key pair, use CKDPub on the public and CKDPriv on the private, do they yield the same public keys?

if I take a private/public key pair, use CKDPub on the public and CKDPriv on the private, do they yield the same public keys?

For unhardened childs, yes.


What if someone owns 51% of all bitcoins? Would it be possible to manipulate the exchange rate of Bitcoin, if a single entity controlled the majority of all available currency?

http://en.wikipedia.org/wiki/Currency_intervention
http://www.nber.org/papers/w14600
http://ask.metafilter.com/38377/does-51-sharehold-mean-control

Well, everyone can manipulate the exchange value of a currency by trading large volumes.

Having 51% in particular does not really change that.

Besides, for lowering the price, he will have to sell a lot, probably losing his 51% position.

So basically, you can't manipulate the price just by having > 51% of the bitcoins, but by trading very large volumes. Someone with very much fiat currency can also manipulate the price by buying large volumes.

To see howmuch you will have to sell (buy) to make the price go down (up) a certain amount can be seen in the "market depth" of the exchange. For Bitstamp f.e. the market depth can be found here.
The steeper the market depth curve, the harder it is to move the price in that direction, so currently (see picture below) it is easier to make the price drop by selling bitcoins than it is to raise the price by buying.


Bitcoin-Qt setup: Change block-chain file location, settings? documentation? I am installing Bitcoin-Qt and have been reading about Bitcoin basics, but I found very little information on the client. I have a few questions about the Bitcoin-Qt program (v0.8.1-beta under Windows 7),

Where is the complete Bitcoin-Qt documentation? I can not find it.
How do I change the file locations for the block-chain storage?

Block chain is ~6 GB
The default appears to be MyDocuments\AppData\Roaming\
My C: system drive is small, and I have a second drive for such data.

Is the "Wallet" a separate file/entity from the block-chain?

How do I define the wallet's location?
Can I backup the wallet by simple copy/paste/tar.gz without carrying the entire block-chain?

Does the Bitcoin-Qt client currently have built-in mining/transaction-processing? I do not see the dialog-box to configure. I have a graphics card and ample wasted CPU-cycles.

Thanks for clarification. Links to proper documentation are welcome!

Here:

https://en.bitcoin.it/wiki/Bitcoin-Qt
https://www.google.com/search?q=bitcoin-qt+documentation

Use the -datadir option.
Right-click on your bitcoin-qt shortcut, press properties, and add -datadir=D:\Bitcoin
Go make that directory, then run bitcoin. If a bunch of files show up in there, you've done it correctly.
Yep.

-datadir
File > Backup Wallet

Yes, but not GPU mining. GUI miner is a nice option though.


Looking for unit testing data for Block.Bits to & from a JSON-RPC string I'm trying to convert the JSON-RPC result of a Block's compressed bits property into a C# float with the following constraint

 //3  bytes mantissa, the leading byte as exponent (where only the 5 lowest bits are used) and its base is 256

Is there any sample data I can use to verify my implementation is working?

A JSON-RPC string, and it's corresponding 256-bit output in Big Endian format would be a great help.


What does the term "Longest chain" mean? What does the term "Longest chain" mean, as there is only one 'right' blockchain exists? How another longer chain would make the 'right' chain invalid?

Bitcoin's block chain system is really two quite separate systems, and they are easily confused. The first one is the block tree and the second is the active chain.

The block tree consists of all valid blocks whose entire ancestry is known, up to the genesis block. The rules for validness include no double spending, valid signatures, no introduction of more currency than allowed, ... These are the network rules, and every full Bitcoin node verifies them.

The active chain is one path from genesis block at the top to some leaf node at the bottom of the block tree. Every such path is a valid choice, but nodes are expected to pick the one with the most "work" in it they know about (where work is loosely defined as the sum of the difficulties). Relativity and technological constraints prevent us from doing instant communication across the globe, so two nodes can not be expected to pick the same chain as the active one. This is no problem: the mining mechanism makes sure that the chance two nodes disagree about blocks in the past decreases exponentially as they are older.

So no, there is not one "right chain", there are many. Nodes choose for themselves, but the system is designed to make sure consensus arises quickly.

The rules in practice are this: when a new block arrives, and it extends the previous active chain, we just append it to the active chain. If not, it depends on whether the branch it extends now has more work than the currently active branch. If not, we store the block and stop. If it does have more work, we do a so called "reorganisation": deactivating blocks from the old branch, and activating blocks from the new branch.


Chainstate Bitcoin Core 0.15 Recently updated my LevelDB parser to work with the new LevelDB 0.15 internal structure. However, I'm wondering about two small changes I found:

The prefix for transactions was changed from b'c' to b'C'.
The nVersion field was dropped from the database.

Is there any specific reason for changing the prefix?

On the other hand, and regarding the version field, it was always set to the same value for every entry (can't recall if 1 or 0), so dropping it seems the right thing to do but, why was it included in first place?

The prefix for transactions was changed from b'c' to b'C'.

Is there any specific reason for changing the prefix?

The entry changed to a new data structure. However in order to be able to upgrade previous database versions to the new one, we need to be able to identify which entry corresponds to the old structure and which corresponds to the new structure. So a different prefix is used.

The nVersion field was dropped from the database.

On the other hand, and regarding the version field, it was always set to the same value for every entry (can't recall if 1 or 0), so dropping it seems the right thing to do but, why was it included in first place?

nVersion is the transaction version. It should have been either 1 or 2 as those are the only transaction versions used on the network with version 1 being the most common.


even after 0.0005BTC Fee, My transaction is unconfirmed I made a transaction of approx 1 bTC.
MT transaction id is
https://blockchain.info/tx/44f8a9939776bac1b98dffb4fe72d5ad97f3b2171c3b717677e9ae03b6bcef4d

but it is still unconfirmed even after the 0.0005 Fee.

Don't use fixed fees! Fees are not per transaction, they are per byte (size of the transaction matters).

The size of the transaction is based on how many inputs you use. Mostly, that's not under your control.

You transaction above is 815bytes.
You fee: 0.0005 0BTC.
~= 0.000613 BTC/bytes

The current feerate to get confirmed within the next 10 blocks is 0.00136386/1000bytes (March 8th 2017).

Your fee is way to low to compete with other transactions.


How does the network apply credit for created blocks? First post.  I must say in advance thanks to everyone for all the great conversation and help and software so far.  It's really helped me get familiar with bitcoins and bitcoin mining.

I have a question about functionality of the Bitcoin network and how mining credits are applied to the correct person.

Assume a person is solo mining.  That is, one computer is doing the mining.  IT may be running a pool, but that's not relevant for this question.  So, lets assume a solo miner generates a few blocks and they get accepted.

When the network approves a block that has been created, how is the credit for the block creation (50 bit coins, soon to be 25) applied to the miner's wallet?

Let's say that a GPU miner, like DiabloMiner is running, and getting its work from Bitcoin-QT.  How does Bitcoin-QT, detect the mining credit of 50/25 bitcoins and send it to the correct miner's address?

Thanks.

Miner has to supply the Bitcoin address for block reward. Then, when the block is mined, the special "credit" transaction is permanently stored in found block, creating given amount (25 BTC, was 50 BTC) to given address.

Some pools (Eligius or P2Pool) use this feature and create a lot of credit transactions, so that when block is found, all participants will receive their respective share.


Restore wallet.dat on windows 8 How do I use my wallet.dat on my windows 8 bitcoin qt?

Someone posted this

C:\Documents and Settings\YourUserName\Application data\Bitcoin (XP)

C:\Users\YourUserName\Appdata\Roaming\Bitcoin (Vista and 7)

but I'm on windows 8, so i don't know what to do

Windows 8 is just like Windows 7.

But on a mondern bitcoin-core installation you will be asked where to put your data-directory. So if you changed the default path you need to consider that.

So if you found your data directory, your wallet.dat file is right there. Make a backup or restore it as you wish.

There is also a good tutorial video around for more visual explanation.

For a more detailed explanation on what steps are required to restoring your wallet.dat you can check out this post.


Cannot import python-bitcoinrpc I am unable to import the package bitcoinrpc.
I have installed it in python2 and python3 using python3 -m pip install python-bitcoinrpc/python -m pip install python-bitcoinrpc AND by cloning the repo and editing the python environment in setup.py to my python2 and 3 path. Which returns Requirement already satisfied: python-bitcoinrpc in /home/a/.local/lib/python3.6/site-packages (1.0)
Even after that I get the following errors:
Python2: ImportError: No module named authproxy
Python3: ModuleNotFoundError: No module named 'bitcoinrpc.authproxy'; 'bitcoinrpc' is not a package
Following is my code:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException

# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user = "xxx"
rpc_password = "xxx"
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%(rpc_user, rpc_password))

print(rpc_connection.get_info())

I have searched as much as I could but, cannot find anyting except for this bitcoin stackexchange question without an answer.
ENV: OS: Mint 19.1 with Anaconda where which python(3) return /usr/bin/python(3)
Is the setup broken or am I missing something?
Any help is appreciated. Thank you!

I had named my script bitcoinrpc.py and had the import bitcoinrpc. Naturally it couldn't find the package. Renamed the script and it works.
Lesson: DO NOT have a file of the same name as the package you are trying to import.


Is it possible to know my ip address by simply connecting to the Bitcoin network? It is saying that in order to stay anonymous, it is usefull to use Tor whenever connecting to the Bitcoin network.

How does someone can discover my ip adress if I'm simply connecting
to the bitcoin network through bitcoin-qt without doing any
transaction ? (I assume the IP are display only during bitcoin
transaction)
Let's say the only transaction i'm doing is receiving bitcoin with
bitcoin-qt (not sending) and without using Tor. Does my identity is
also exposed ?

First, it's worth noting that getting your IP won't identify your wallet address. So they can't connect to you and then look you up on the blockchain to see who you've been trading with. Associating an address with a person takes normal investigation, like searching your computer or associating you/your IP with a post on the internet containing your address.

For 1:
Unless someone logging the connections to their bitcoin client and they decide to make it public, there isn't any public record of it.

That said, what most would be worried about isn't that their IP would be publicly published, but that certain organizations may be able to identify them. One way these organizations could identify you is by running their own bitcoin client and logging their internet traffic (TCP on the port BTC uses). This would be very easy to do, so if it is something you're concerned about, you should assume it is being done. (If you want to know how easy, look up wireshark. It can log all traffic on your local network.)

Assuming someone is logging IPs on the bitcoin network, the only hope of not being logged is that a singe node only connects (on average) to around 8 peers (but this is configurable). This small number means you have a somewhat small chance of connecting to them.

But, depending on how peer discovery works, it may also be possible to be found by the logger asking for peers. That is, there has to be some way of finding peers in the btc network. This could possibly be exploited to identify a large number of IPs connecting to the btc network. (To be explicit, I haven't studied the specific way peer discovery works, but from general understanding of programming and networks, it seems very plausible.) If this were the case, then the fact that a node only connects to about 8 peers is pointless, because you wouldn't need to connect directly to the organization to get logged; they could find you by asking others for new peers.

For 2:
If you send them to a paper wallet and never connect to the btc network through a client running on your computer, then no, your IP can't be discovered. But, the only way to retrieve them from the paper wallet is to import it into an digital wallet of some kind, which, when you connect that digital wallet to the network to spend them, will identify you.


Can I retrieve funds in a derived address with a high index? I sent funds to a derived address, but I didn't know about the gap limit and how the addresses should be used incrementally. I've used a huge value for the index but wallets only check the first few values -  is there a way I can retrieve them?

Yes, just use something that lets you generate addresses with a high index. For example, you could use https://iancoleman.io/bip39/ and enter into the starting from index box the index you would like to begin deriving addresses at. Then you can get the private keys and import them into your wallet.

IIRC there is not a wallet software that will let you specify where to start deriving addresses.


How to dump peers.dat file to a plain text file? Is there a simple solution to dump [whole] peers.dat file to a text file?

There are similar questions for example How do I read peers.dat file to get a list of all peers seen or that bitcoind has connected to? but I want to insert this code in Bitcoin Core Client (in fact: forked client) and dump the contents of this database on client start.

bitnodes.earn.com is not an answer for me.

To my knowledge, there is currently no way to do this, so I wrote one.

The details of decoding peers.dat are described in my blog post Demystifying Bitcoin's peers.dat.

The result of that is an open source tool written in go that can read all peer info from peers.dat. As always, one should review the code before running this on any machine that hold a wallet. The tool should be able to work with any Bitcoin-based altcoin as well. I have tested it against Bitcoin, Litecoin, and Dogecoin peers.dats.

Installing bitpeers is quite simple, provided you have go installed, and your GOPATH set up. If not, go has a handy getting started guide which you can use to fix that.

Once go is set up, simply run

go get -u github.com/RaghavSood/bitpeers/cmd/bitpeers

If your go environment is set up properly, you should now have a bitpeers command available. If not, try finding your GOBIN (GOPATH/bin) and adding it to your PATH.

bitpeers to easily dump peers.dat addresses as either human-readable plaintext or JSON. It accepts three flags:

Usage of bitpeers:
      --addressonly       outputs only addresses if specified
      --filepath string   the path to peers.dat
      --format string     the output format {json|text} (default "json")

Running bitpeers --filepath /mnt/doge/.dogecoin/peers.dat --addressonly will produce a JSON array of all the IPs and ports in peers.dat. You can also pass the --format text option to produce a list of all IPs and ports, one IP:port per line.

Running without the --addressonly option will produce the full JSON/text output, which contains the following:

$ bitpeers --filepath ./peers.dat --format text
SerializationVersion: 34fc0100
Time: 1526192792
ServiceFlags: 0x000000000000000d
IP: 42.5.143.180:8333
Source: 8.8.8.8
LastSuccess: 1526746622
Attempts: 0

If you happen to find any inconsistencies or issues with the parser or output, please open an issue on the GitHub repo.


Unverified transaction with 78 confirmations Transaction is here...

8aa341eb0f0fdea739b27bdbe29c47407de342c9debb2093cde16d13fcce05d8

One of the inputs has 93 confirmations but is unverified...

ab56917add395f61da4599cedcfa785274ea81677aefb72a2d4dfd896742504a

Is this going to resolve itself or is there some action I need to take?

Using Electrum wallet.

All the inputs seem to be verified. (At 2017-05-24 13:58:05.)

You cannot have a confirmed transaction with unconfirmed input.

There might be an issue with your Electrum wallet that displays something else, I cannot help you with that, since I don't use Electrum. However, right now, everything seems to be confirmed.


Algorithmic trading python library? I am starting to do Algorithmic trading in cryptocurrencies using Python libraries. Most exchanges have RESTful APIs that make it easy to write you own code and get started.

However, I would like to benefit from the analytical features of established libraries such as zipline and others. However these do not support the trading of cryptocurrencies (yet).

Should I just try to write a backend for my favorite cryptocurrency exchange (currently ANX), or are there off-the-github-shelf solutions out there?

Check out my ccxt library on GitHub: https://github.com/kroitor/ccxt

With it you can access market data and trade bitcoin, ether and altcoins with many crypto currency exchanges. It is used to connect and trade with crypto markets and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, trading strategy backtesting, bot programming, building trading algorithms on top of it, webshop integration and related software engineering.

The code is in JavaScript / Python (2 and 3) / PHP. You can deploy it from PyPI, with npm (for Node.js) or by cloning from GitHub repository.

The ccxt library is under heavy development right now, but already offers a quick-start for trading and technical analysis with many crypto exchange markets out of the box.


How can I tell if bitcoind was compiled with ZeroMQ support? Question

How can I check to see if ZeroMQ is not active due to a config error or due to lack of support at compile time?

Details

I'm seeing a lot of messages like this from the insight logs:

[2017-12-12T12:21:31.695Z] warn: ZMQ connection delay: tcp://127.0.0.1:28332

When I test to see if the port is open and listening with netstat -peanut or netcat -v localhost 28332 I can see that it is not (even though it's in bitcoind.conf).

bitcoind.conf

server=1
whitelist=0.0.0.0/0
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubrawtxlock=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcuser=user321
rpcpassword=local321
rpcport=9998
rpcallowip=0.0.0.0/0
uacomment=bitcore
#debug=1
#testnet=1

bitcore-node.json:

    {
        "network": "mainnet",
        "port": 3001,
        "services": [
            "bitcoind",
            "insight-api-dash",
            "insight-ui-dash",
            "web"
        ],
        "servicesConfig": {
            "bitcoind": {
                "connect": [{
                    "rpchost": "127.0.0.1",
                    "rpcport": 9998,
                    "rpcuser": "user321",
                    "rpcpassword": "local321",
                    "zmqpubrawtx": "tcp://127.0.0.1:28332"
                }]
            }
        }
    }

I'm pretty sure I compiled with zmq support, but since it's not actually listening I'm guessing that it's possible that I did not (i.e. although libzmq was present perhaps it was not in the right path to be detected).

How can I check to see if it's a config error or a compile error?

You should have a file named config.log in your Bitcoin Core working directory. Look in the file for ZMQ related lines. If ZMQ is enabled, you should see things like #define ENABLE_ZMQ 1. If it is not enabled, you should see things like #define ENABLE_ZMQ 0.


bitcoin-cli createwallet electrumpersonal server true I'm a noob following instructions to setup Electrum Personal Server on Linux.

I came to this instruction and I'm stuck.

Got an warning. What is this?

{
  "name": "electrumpersonalserver",
  "warning": ""
}

Thanks

There's no warning there.

The createwallet command will always return a JSON object containing the name of the wallet created, and a warning string. If there was a warning during wallet creation, that warning string would contain text. But it is just an empty string so there is no warning.


Multisig doesn't work unless all keys were generated from the current wallet? I tried to create a multisig in both the Bitcoin network and the Bitcoin testnet. It seems to work only when all public keys are from the current wallet. That means when I call listunspent after I send coin to the multisig address, it didn't show up as a multisig address unless this multisig address was created from the current wallet. I tried it in both real coin and testnet. What is problem?

Note: I use Bitcoin-qt 0.9.2.1

Why "listunspent" dosen't show multisig address ?

How can i check balance of multisig address and get txid and vout and scriptPubKey for multisig address ?

Edit 2:I try to search for software(tool) can be track bitcoin address (balance and transactions) i found bitcoin-abe, but  when i search for it i found i can't search for bitcoin address to retrieve it balance and transaction ? anyone know tool like blockchain when i request about bitcoin address give me balance and transactions ?

The built-in multisig support in the reference client is only a proof-of-concept. As until recently (and still) the wallet did not deal well with coins being spent outside of its control, it was decided to only allow spending multisig coins when you have all keys. Of course that completely defeats the purpose of multisig, but proper support for it requires separate tools anyway (to pass the partially signed transactions around, etc).

However, the planned watch-only wallet support does allow watching multisig addresses too (in fact, any script at all), which will appear in listunspent. Clearly, the regular sendtoaddress & co RPCs cannot spend these coins, but it does give the ability to track them.


How are code changes (e.g. new features) to applications such as Bitcoin deployed and how is compatibility mainted? How does Bitcoin deploy new features and manage different versions compatibility?

For example if a new feature is added to Bitcoin, how is that then deployed and managed? That is, how is everyone on the network not forced to upgrade when a new version is available?

If an upgrade/update is not forced, how does Bitcoin manage different versions of Bitcoin on the network? Is there a minimum required version somehow distributed amongst the network?

Usually the code is written, tested, and merged into the release, and then deployed switched off.  Depending on the change, it can then be activated on a particular date, block, when the network has a consensus (certain %age of people agree to implement it), or when x number of blocks mined support the new change.

Code can be hard, or soft forked, and the developers attempt to make changes backwards compatible as much as possible to avoid client issues.

Occasionally incompatible clients can generate odd blocks (like for example a recent 1.01MB block) that get orphaned, or discarded by the rest of the network. Or even a chain of several blocks that get orphaned, this is one of the reasons you should wait for more than one successful confirmation after transferring money.


deriveChild and signing transactions using Bit-Wasp I'm generating multiple children using one extended key. I have no problem generating public addresses:

$master = HierarchicalKeyFactory::fromExtended(myKey);
$key = $master->deriveChild(1);
$publicAddress = $key->getPublicKey()->getAddress()->getAddress();

In order to sign a transaction, I need the public address' private key. How do I generate / extract the private key of a derived child? I'm assuming I'm not using the extended key for that.

Did a bit of digging and in order to extract the private key, you can use:
$privateKey = $key->getPrivateKey()->toWif(); And then sign the transaction.


What happens to transactions included in extinct or invalid blocks? I have read that a block contains several transactions.

An attacker can forge fake a block.

The blockchain is safe because the system will choose and keep the longest chain.

So the fake block will be lost.

This is great but what happens if my transaction was included in the fake block?
Let's suppose I am buying a car. Should I wait for 6 confirmations to be sure? That would mean that I have to wait one hour!

what happens if my transaction is in the fake block?

It is also in the memory pool (mempool) of pending transactions at other nodes run by more honest people and will be included in a new and valid block in the normal way.

  Let’s suppose I am buying a Tesla car. Should I wait 6 blocks to be generated to be sure? But I have to wait 1 hour!

Yes.

There are faster payment methods for Bitcoin - e.g. Lightning Network (LN) and arguably perhaps escrow services. But they have their own trust model and characteristics you need to understand when using them.


electrum wallet help needed funds missing I have a problem and not sure if it’s a hack or my back up has not worked.

I was sent a laptop replacement and asked to send the old one back on the warranty so I was removing all my stuff across, I first formatted the new replacement laptop put updates and anti-virus on before downloading a new wallet from electrum.org , using my seed (offline) inputted it into the into the downloaded wallet it asked me for my password and started synchronizing.
Stupidly the day after I reformatted the replacement laptop and when I referred back to the old laptops electrum wallet, there are now 2 transactions from the same date as I tried restoring the wallet. I’ve used electrum and it kept my coins safe for over 2 years but now I’m cleaned out 

I’m finding it hard to understand if it would have been possible for me to somehow to have created a new wallet address and somehow imported the funds from the old seed would this be a possibility
I have ran some software and it’s found the file Default_wallet on the formatted laptop, do you think it’s worth getting the software to recover the file or is it a waste of time?

I really appreciate anyone’s help on this matter and more then happy to make a donation to if I can get them back.

I can all so provide the block chain link id if needed as says there was 2 transactions at this time this happened

You must have downloaded electrum from a fake site which served you a backdoored version of the program. If you still have access to your browser history I suggest going through it to find out the exact URL you used to download electrum. The official site is at electrum.org and downloads are served via download.electrum.org.


Full list of RPCs - including hidden RPCs Where can I find a full list of RPCs that are not listed in the output of the help command? (such as invalidateblock etc.)

Found this in the source code which should answer your question: https://github.com/bitcoin/bitcoin/blob/b05a89b2def301704df8f22f05a45ccf891c2b83/src/rpcserver.cpp#L268-380

It's the internal register of RPC commands that bitcoind should serve, and even includes which ought to be hidden from the help command.  invalidateblock is in the hidden section with three others.


getmininginfo vs getblocktemplate I am interested in the difficulty right now. That is, the miners are working a block right now and they have a target. Both of the RPC commands "getmininginfo" (or "getdifficulty") and "getblocktemplate" can be used to get a number that represents a "difficulty".

"getmininginfo" (or "getdifficulty") gives a difficulty value directly. "getblocktemplate" gives the "target" and the "bits", both of which can be used to derive a difficulty value. I understand that miners work according to a "target." But, which target?

I list two possibilities below. Which (if either) is the correct case?

1) "getmininginfo" gives the difficulty right now, and "getblocktemplate" gives the difficulty for the next block under the assumption that this block will be solved within the next second.

2) "getblocktemplate" gives the difficulty right now (through the "bits" or "target"), and "getmininginfo" gives what the difficulty was for the most recently solved block.

If both of these are wrong, what exactly do the difficulties given by the two commands really represent?

1) "getmininginfo" gives the difficulty right now, and "getblocktemplate" gives the difficulty for the next block

That is correct. getmininginfo gives the diffculty of the block at the current blockchain tip, and getblocktemplate gives the target for the block to be mined on top of the current tip, i.e. the next block.

  under the assumption that this block will be solved within the next second.

There is no such assumption. The difficulty doesn't change by the second, it only changes at the end of each difficulty adjustment interval. If you are fully synced, you will always know what the difficulty of the next block will be. The calculation is completely deterministic and any block that has your current tip as its previous block will have the exact same target.


who is the "owner" of a newly mined BTC before its first transaction? When a miner adds a new block to the bitcoin blockchain, effectively 900 new coins come into existence as I understand it.  the miner gets 6 of them as payment, but who 'gets paid" for the other 894?
What I mean by that is if I want to then purchase one of these new BTCs, with whom am I exchanging funds for my BTC as they are not yet "owned" by a single person - who is the "owner" until that first transaction occurs?

The amount for the block reward is what is created, there is no additional created for any reason. If the block reward is 6.25 BTC, that is exactly what the miner is paid, and nobody else.


How does one submit a transaction to the network using the blockchain.info API? I am currently working on a project which makes use of the blockchain.info api (php). Could anybody please tell me how to use this api to submit transactions to the network?

To broadcast Bitcoin transaction using blockchain.info you have to send a post request to https://blockchain.info/pushtx with tx=yourRawTransaction.

I would suggest you run your own node because you may face some rate limit.


What does 889271 represent in the blockchain index leveldb databases? I am opening up the blockchain index databases with leveldb, and I am seeing a repeating number, 889271, at the start of every value entry...

I am attempting to decipher the following key value pair

'b'e2bf047e7e5a191aa4ef34d314979dc9986e0f19251edaba5940fd1fe365a712 = 889271000b010008010000000000000000000000000000000000000000000000000000000000000000000000d9ced4ed1130f7b7faad9be25323ffafa33232a17c3edf6cfd97bee6bafbdd97b9aa8e4ef0ff0f1ecd513f7c

Using

https://bitcoin.org/en/developer-reference#block-headers
https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_2):_Data_Storage

I believe i have everything deciphered properly, except for 889271

Any chance someone can confirm what 889271 represents?

You are thinking of 889271 as a decimal number; it is not. It is a hexadecimal value that just happens to be composed of numeric digits.

That is the Variable Sized Integer serialization of the version number of the Bitcoin Core client that created that database entry.


Bitcoincore listrecievedbyaddress doesn’t work I am trying to run bitcoin full node on testnet. I have downloaded ant started bitcoind with such config:
testnet=1
regtest=0
server=1
listen=0

I'v generated new address tb1qklst9t8rk97zmwqdq4t8s3dazk3h6rps20y32d
with "getnewaddress" command.
I`v made the transaction from Electrum testnet wallet to this address (transaction id: cefe1ca9048f2fcd42c40b1060cdf4183f98f24eca95a9c499006ee39a033d54).
I can see this transaction in Electrum testnet wallet or on tbtc.bitaps.com.
But results of commands "listreceivedbyaddress 0 true true" and "gettransaction cefe1ca9048f2fcd42c40b1060cdf4183f98f24eca95a9c499006ee39a033d54" are:
[
  {
    "address": "tb1qklst9t8rk97zmwqdq4t8s3dazk3h6rps20y32d",
    "amount": 0.00000000,
    "confirmations": 0,
    "label": "",
    "txids": [
    ]
  }
]

and
error code: -5
error message:
Invalid or non-wallet transaction id

The result of "getblockchaininfo" is:
{
  "chain": "test",
  "blocks": 626786,
  "headers": 1774117,
  "bestblockhash": "0000000000007d5ba9c09c8ddfa2cc31195aea3fc6e351969bc6fe454d2c29b8",
  "difficulty": 65536,
  "mediantime": 1450388529,
  "verificationprogress": 0.4003797270985711,
  "initialblockdownload": true,
  "chainwork": "000000000000000000000000000000000000000000000007049211b48a78f895",
  "size_on_disk": 4446006159,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": true,
      "height": 21111
    },
    "bip66": {
      "type": "buried",
      "active": true,
      "height": 330776
    },
    "bip65": {
      "type": "buried",
      "active": true,
      "height": 581885
    },
    "csv": {
      "type": "buried",
      "active": false,
      "height": 770112
    },
    "segwit": {
      "type": "buried",
      "active": false,
      "height": 834624
    }
  },
  "warnings": ""
}

Bitcoin core version is 0.20.0.
What is wrong?

Your transaction was mined in block 1773944.
Your node has only synced up to block 626786.
Once your node has synced block 1773944, you should be able to see the transaction.


Schnorr batch validation speed statistics In this question Schnorr vs ECDSA I see in the Peter Wuille's answer the following comment about Schnorr signature batch validation: "Improving verification speed, by supporting batch validation of all signatures in a block at once (for a fraction of the speed of validating them individually)."

However, looking at the chart in the BIP here https://github.com/sipa/bips/blob/bip-schnorr/bip-schnorr.mediawiki#Batch_verification
it seems that savings are actually close a factor of log(n). In other words, for about 10,000 signatures the time savings are about 2.5X. I know that technically that is a fraction, but it seemed that the implication was that the improvement was more dramatic.
Is there something I am missing? Also, what is the actual time in clock cycles that was a starting point for one Schnorr signature verification?
Thank you.

Speedup in well optimized cryptographic functions are hard to come by. In libsecp256k1 we'll usually celebrate a 4% algorithmic speedup. Figures on the order of 2x are reasonable for the usage in Bitcoin, though larger might be possible in the future during initial block download since much larger batches could be used.

A single validation on a single core of a fast desktop grade cpu takes about 50 microseconds.

Another relevant Q/A is Schnorr's batch validation


How to use litecoin testnet on fully synced litecoin core on amazon ec2 instance I run a synced litecoind on amazon ec2 linux instance.

[ec2-user@ip-xxx-xx-xx-xxx ~]$ litecoind -version
Litecoin Core Daemon version v0.13.2.1

[ec2-user@ip-xxx-xx-xx-xxx ~]$ litecoin-cli getblockcount
1411130

I tried starting daemon with below commands

litecoind -testnet -daemon
litecoind  -daemon , then litecoind -testnet

I want to get litecoin testnet address to test sending LTCT. But when I generate address i get litecoin address. How can I use this core to switch between main net and testnet ?

UPDATE

[ec2-user@ip-xxx-xx-xx-xxx ~]$ litecoind --testnet --daemon
Litecoin server starting
[ec2-user@ip-xxx-xx-xx-xxx ~]$ litecoin-cli getnewaddress
error: couldn't connect to server

  top command shows litecoind running.
   5787 ec2-user  20   0  786m  26m  288 S  1.0  2.6   0:00.63 litecoind

Is it okay if i kill the daemon ??

Please Help!

litecoind --testnet --daemon

Should be all you need to start in testnet and run as a daemon


How are Bitcoin generated in Video Games? There are a lot of video games out there which reward the player in Bitcoins or other cryptocurrencies for winning the game or achieving a specific objective. But from where does those crypto come from?

Do the players act as bitcoin miners while playing the game or is there any other mechanism which generates the bitcoin for the game? How does this work? Is the game itself decentralized or they embed the bitcoin blockchain in it?

These games do not actually generate any Bitcoin. No Bitcoin is being mined in these games; that's not how Bitcoin works.

The Bitcoin comes from the service running the game. They are doing something other than running the game that is earning them Bitcoin. They then use that Bitcoin to give small amounts to their users. The Bitcoin is typically earned thread advertisements that are on the website.


Why most bitcoin wallet apps don't have Replace-by-fee feature? As a bitcoin user, it seems that Replace-by-fee feature is useful to solve the problem of transactions not confirming because of an insufficient fee. However, as far as in know, most bitcoin wallet apps does not have the feature. I found that only Electrum wallet has it. (But it is not default setting on Android app)

I read this reddit. The comments are posted 1 year ago but seems still be controversial.

https://www.reddit.com/r/Bitcoin/comments/3urm8o/optin_rbf_is_misunderstood_ask_questions_about_it/

I have very simple transaction generator tool in my company. The process is the followings:

1. User calls HTTP API to create transaction with some parameters (source, destination, amount, fee, etc).
2. Retrieve utxos and generate raw-transaction in server-side. Returns the raw-tx to user.
3. User signs the raw-tx and calls broadcast HTTP API.

Users want to solve the problem of transactions not confirming. Thus I'm considering if Replace-by-fee is good idea or not.

My concern is whether using Replace-by-fee is agreed(positive) or not in Bitcoin community. If not, I won't use it. If the reason is technical(or cost), I will try to implement it.

I'm very grateful if you could share your opinion or references about it. (sorry this can be opinion based question)

Update 1

I'm sorry the above my question is not clear. What I wanted to ask was what negative aspects Replace-by-fee has.

Electrum Android add shows the following warning before creating transactions.

  Note that some merchants do not accept non-final transactions until they are confirmed.

This case would be a negative aspect. I have concerns if another disadvantages are exits or not.

(Btw, Replace-by-fee can change only fee. I'm not sure why some merchants do not accept replaceable tx.)

I found that the downside of RBF is described in this question.

  The downside is that this represents a significant shift in terms of expected memory pool behavior.

Can someone outline the full pros/cons of the various Replace-By-Fee proposals?

Maybe this answer came a bit too late, but lets give it a try.
Let me start by citing A. Narayanan et alter Bitcoin and Cryptocurrency Technologies book:

Since 2013, there has been interest in changing the default policy to
replace-by-fee (RBF) whereby nodes will replace a pending transaction
in their pool if they hear a conflicting transaction which includes a
higher fee. This is the rational behavior for miners, at least in a
short-term sense, as it gives them a better fee.
However, replace-by-fee would make double-spending against zero-confirmation
attacks far easier in practice. Replace-by-fee has therefore attracted
controversy, both in terms of the technical question of whether it is
possible to prevent or deter double-spending in an RBF world, and the
philosophical question of whether Bitcoin should try to support
zero-confirmation as best it can, or abandon it.

So controversy is set between what can be more profitable for miners (i.e accepting transaction with higher fees), versus what may generate more transactions in the mempool and, moreover, could ease double-spending attacks against zero-confirmation transactions. That's probably why Electrum shows such a warning. Merchants could be unwilling to accept transactions that can be replaced if a greater fee is provided before the transaction has been included in a block.
In my humble opinion, it depends on whether your tool will be used for zero-confirmation transactions or not.
Moreover, if you are concerned about what nodes of the network will do when dealing with such a transaction, here you have a question that talks about the relaying policies of RBF.


No bitcoins in my multibit wallet, but I have some when I look in the blockchain I got an old version of multibit (the one like in my picture)

It says I don't have any funds even when I reset my wallet (multiple times which takes about half an hour each time).

When I look at blockchain.info and search my wallet address it says I still have some bitcoin left.

I got a wallet.dat file somewhere but I don't know how to import it into the new multibit (multibit HD) since they require you to have some mnemonic or something. There is no simple open wallet button like in the old multibit.

What can I do?

I just deleted my original answer now because I realised it was wrong.

If you have a wallet.dat file, then multibit classic is not the Bitcoin wallet you would have used. Chances are, you used the original Bitcoin software.

First you will need Python 2.7:
64 bit version
https://www.python.org/ftp/python/2.7/python-2.7.amd64.msi

Download this private key extraction utility which will display the private keys for your wallet.dat

https://github.com/dlitz/pywallet

Download the zip and unzip.

Open the command line (windows key + r) type cmd then press enter. Change directory to the folder you downloaded ie:

cd c:\Downloads\pywallet-master

Or c:\users\mike\downloads\pywallet-master

then type:

python pywallet.py --dumpwallet

press enter and you should hopefully see a list of bitcoin addresses and private keys (which start with the number 5).

Once you have these private keys, open a wallet with blockchain.info

and once you're in, click on the Import/Export button and click 'Yes I know what I'm doing'.

Click on Import wallet in the left side column.

You can then add the private keys by copying and pasting the output from the command line.


Unable to send bitcoin from bitcoin core wallet Using bitcoin core wallet fully synchronized with the blockchain on ubuntu

I click on "send".  Nothing seems to happen.

You are sending to a bech32 address. The current release of Bitcoin Core does not support bech32 addresses. The address box highlighted in read indicates that the address is invalid to the wallet.

The next release of Bitcoin Core will support sending to bech32 addresse as well as full Segwit wallet support.


How many public keys is there? How many wallets is there in existence(that are unique with bitcoins)?

Is there any page with statistics that can give a bigger perspective other than figuring out the data structure of the blockchain.

Meaning is it possible to get all the public keys for all the transactions ever made?

However it seems like the public keys aren't stored in the blockchain, instead it's the addresses which is a hash of the public key.

Am i correct that's impossible to find out the public keys of all transactions(Unless you bruteforce them which is practically impossible)?

TL;DR: You are not aware of the total number of users, but total number of transactions. In order to speculate the number of wallets (mean the number of users), you can adopt some heuristics, but that's all estimation.

First of all, a user can obtain multiple public keys. In order to get the number of public keys, you should firstly parse and extract the bitcoin transaction network that is publicly available. For example, in this dataset, created on Jan 6 2013, there are 8.864.955 public keys.
That's the easy part.

If you wish to calculate the number of users participating in bitcoin networks, you have to adopt some heuristics, as those data are not publicly available, due to the anonymity that is offered by bitcoin.

The first heuristic could be:

When a single transaction has multiple input addresses, we can assume that those addresses belong to the same wallet, thus to the same user. We should bear in mind that users do not share private keys. In fact many users may use web wallets which have pools, so those services will be treated as a single user.
Secondly, you can exploit the change mechanism in transactions. The entire value of unspent output should be sent back to the user as change. Bitcoin, in order to improve anonymity, produces a shadow address which collects back the change that results from any transaction. So when a single transaction has 2 outputs, you have to predict which one of the output addresses is actually belonging to the same user that initiated the transaction. If one of those two outputs has never appeared before in the blockchain, while the other has, then we can  assume that the one that never appeared before is the shadow address.

You can read this heuristics in more detail in BitIodine paper. In this work, there are 2.175.621 users found, using the above methodologies.


What security threats does blockchain technology solve or present? I am interested in security, identity and authenticity in electronic networks.

What sort of security concerns could blockchain technology help with and what sort does it pose?

Are there entry and exit security concerns?

The problem Bitcoin solves

Bitcoin provides a method for tracking scarce digital assets. This was previously solved by central entities providing an authenticator role and exerting control. Bitcoin solves this problem by creating a truth source from network consensus. Besides for its payment application, this truth source can be employed in a number of different ways, such as proof of existence, identity management, and due to its limited supply perhaps as a digital gold.

By nature, decentral systems are inefficient: For a big entity, i.e. countries or companies, with reasonable grounds to trust their own central truth source, there are more efficient ways of accounting their monetary flows.

Blockchains in general are only as valuable as they are secure, so I think it will be unlikely that there will be numerous competing services based on different blockchains, rather I think that there will be few, and additional services built on top of them, in the fashion of Colored Coins or sidechains.

Blockchain Security Vulnerabilities

As moshaholo already said the only known fundamental vulnerabilities are double-spending and majority attacks. While these are currently reasonably unlikely in Bitcoin, other blockchain projects with less hashpower have turned to implement additional measures to protect their integrity:

Alternative Mining algorithm, e.g. Merged Mining, Scrypt, X11, X13, X15, NIST5, POS, SHA-3, multialgorithm mining
Alternative Difficulty adjustment algorithms, e.g. Kimoto Gravity Well
Extensive Checkpointing

There may be bugs in Bitcoin Core that haven't been discovered yet, however the implementation of alternative client software is helping to uncover unexpected behaviour as the network matures.

Lesser problems include that correct time cannot be enforced on the network, traceability of payments can lead to reduced fungibility and loss of privacy.

Are there entry and exit security concerns?

While interaction on the blockchain is secure and mostly trustless, there are challenges with

wallet security
exchanging currency for bitcoin: counter-party risk, fraud by charge-back, scams
verifying authenticity of business partner's information

Identity on the network

As every user can use as many addresses as they want, identity on the network can be fairly private or as public as one wants. Privacy takes some effort, as one can reveal common ownership of addresses e.g. by using them together as inputs for a transaction, or by creating obvious change outputs.


Bitcoin URLs: how to set a transaction fee? The  Bitcoin URI scheme doesn't appear to provide any mechanism for setting a transaction fee.

Is there a way to get clients to include a transaction fee in a standard payment via a Bitcoin URI?

Great question!!!

Here is a non-authoritative answer based upon prior related experience of many years past. The Bitcoin URI-scheme is very reminiscent of the IETF HTTP and SIP URI protocol grammars.

With the suggested Bitcoin BNF Grammar documented in BIP-21, it is possible that implemented pchar "otherparam" or "reqparam" names to be abused to suggest a transaction fee. The fee is digit, not a pchar. The URI could even be made to suggest specific pool(s) to expedite the processing of the transaction (relates to High level details for bundling transactions for solo mining or pooled GBT mining). I'm guessing the issue is the the meaning of the name-value pair for a transaction fee is left up to the whim of a developer which could lead to downstream turnkey Bitcoin component interoperability issues. So does it would make sense for the BIP-021 to be tweaked to add something like the following to its grammar?

paytxfeeparam = "paytxfee=" *digit [ "." *digit ]

**The wallet application currently establishes the acceptable transaction fee. For now, Bitcoin-Qt "bitcoin.conf" "paytxfee" value is used to statically establish the transaction the client is willing to pay.

I can understand why current pool operators may not care about establishing a paytxfeeparam. However, a roaming customer may want to know what it takes to expedite an adhoc in-person brick and mortar transaction for a product or service.

To support commerce, its not too hard to also envision a need for something like:

paysalestaxparam = "paysalestax=" *digit [ "." *digit ]

BIP-21 needs to be updated with a number of other real world use cases...

From a Cybersecurity perspective, I would be very reluctant to click on a URI from that only God knows is from who that induces a very expensive transaction. I'm glad to BIP-21 talks about always requiring the user's authorization.


Unable to locate bitcoin.conf in linux I am new to bitcoin network but I have spent significant time with ethereum.
For getting started with bitcoin I referred running a full node and Developer documentation- Regtest Mode. After installing bitcoin-qt and bitcoind, I was asked to change the password in bitcoin.conf. But I am unable to locate it in ~/<user>/.bitcoin.

pr.singh@GLTINTERN-W040:~/.bitcoin$ ls
bitcoind.pid  blocks  chainstate  database  db.log  debug.log  regtest  wallet.dat

And so whenever I run any command like bitcoin-cli -regtest generate 101, I get error stating:

  error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/home/pr.singh/.bitcoin/bitcoin.conf)

Am I missing anything? Also if you guys can provide a good tutorial to start development and  testing in restest network, it will be quite helpful.

You showed a directory listig using "ls". Maybe that is the first issue. Try using "ls -la", which would also show hidden folders, beginning with a dot.

Otherwise here is a tutorial:
https://bitcoin.org/en/developer-examples#regtest-mode
and
https://bitcoin.org/en/full-node#linux-instructions

difficult to say, what happened, but if you just create a ".bitcoin" directory, and go ahead to create the bitcoin.conf file, you should be ok.


How do I spend a non-standard P2SH transaction I was sent a P2SH puzzle address. I have solved the puzzle, which is to say I have created a script that matches the hash, and I know what to put on the stack before the script. Sadly, what I am having trouble figuring out is how to actually create a valid transaction with this non-standard script and no signature. All the examples and documentation I've found only talk about creating standard signature-based transactions and not ones with arbitrary scripts.

For example, let's say the encoded script is 955787 and someone actually sent bitcoin to the P2SH address for that script, which is 3PijzLhTnkA9S2HDFLrdwX9SCg69W8ggD4

Now I want to spend that by providing the full redeem script:

1 7 955787

or I guess more accurately

OP_1 OP_7 3 0x955787

How do I actually create that transaction using bitcoind or bcoin? I don't see how to get it to create a transaction with that supplied script or transmit it to the network without a signature. I am looking for a list of command-line commands to run (use placeholders for any required data I did not supply above).

First thing I noticed was the redeemScript, it's using OP_MUL which is disabled and you won't be able to use it in scripts.
But I can show it using OP_ADD.

If you want to play with bcoin and test the scripts, how they validate you can use bcoin.script:

Verify and play with scripts

const scriptSig = new Script();
scriptSig.pushInt(6);
scriptSig.pushInt(1);
scriptSig.compile();

or you can assemble it using just string

const scriptSig = Script.fromString('OP_6 OP_1');

Now pubkeyScript  (redeemScript in P2SH)

const scriptPubkey = Script.fromRaw('935787', 'hex');

Or more verbose

const scriptPubkey = Script.fromString('OP_ADD OP_7 OP_EQUAL');

You can use bcoin.stack to run these scripts

const stack = new Stack();
scriptSig.execute(stack);
scriptPubkey.execute(stack);

// Verify the script was successful in its execution:
assert(stack.length === 1);
assert(stack.getBool(-1) === true);

Redeem transaction

Back to the question:

const redeemScript = Script.fromRaw('935787', 'hex');
const address = Address.fromScripthash(redeemScript.hash160());
const sendto = Address.fromString('sendtoaddress');

// generate script with redeem
const script = new Script();
script.pushInt(6);
script.pushInt(1);
script.push(Opcode.fromPush(redeemScript.toRaw()));
script.compile();

// We received some transaction
// lets say coinbase
const cb = new MTX();

// Add a typical coinbase input
cb.addInput({
  prevout: new Outpoint(),
  script: new Script()
});

cb.addOutput({
  address: address,
  value: Amount.fromBTC('5').toValue()
});

const coin = bcoin.coin.fromTX(cb, 0, -1);

// From here we spend the transaction
const spend = new MTX();

spend.addCoin(coin);
spend.addOutput(sendto, Amount.fromBTC('4.9999').toValue());

spend.inputs[0].script = script;

assert(spend.verify());

// You can broadcast raw transaction
console.log(spend.toRaw().toString('hex'));


How does a merchant ensure sufficient value in light of the price volatility? When a merchant accepts bitcoin payment (for example 10 btc for the purchase), the buyer send the payment of 10 btc and it is settled.

However, the 10 btc value will fluctuate every minute (up to 20% or more sometimes on a daily basis).  Let's say 1 btc = $2000 at the time of the payment and 1 btc = $1900 at the time when the merchant exchanged it for US dollars. The merchant lost $100 in this case and the opposite could happen.

How does a merchant ensure that the btc payment satisfies the cost of the product?

Please help me understand how this works. Otherwise, it does not make sense to me why Merchants need to accept btc payments.

There is no way for the merchant to ensure that he receives full value. This is the nature of digital currencies and why many merchants decide to not accept bitcoin as a payment; it is volatile. However, there is also the chance that the value will increase, thus netting a profit for the merchant. All in all, any merchant who accepts bitcoin not only is hoping for an increase in the price of bitcoin but is also looking to appeal to more customers.


I suspect that the second output is being rejected because it contains an OP_RETURN with two data pushes.  From browsing the code, "Solver" in script.cpp only categorizes output scripts as "standard" if they meet one of a limited set of templates.

All such templates containing OP_RETURN:

OP_RETURN, by itself
OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack.

Since your script is "OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack, followed by another data push operation", it looks like it wouldn't meet either of those templates.


How is the balance of a Bitcoin address quickly calculated? For what I understand, the balance of a Bitcoin address is the total sum of UTXOs of that address in the entire blockchain.
The current size of the blockchain is around 350GB. How is the total sum of UTXOs for a specific address calculated quickly? I imagine looping over every transaction in the entire blockchain and comparing the UTXO with the given address takes a lot of time. Does the calculation of the balance of a Bitcoin address work like that? And do miners repeat this process for every transaction to check if the available balance of that address enough?

At the protocol level, Bitcoin has no concept of "balances" or "addresses", and their common interpretation isn't relevant during verification.
Every transaction spends "coins" and reforges them into new "coins" (called UTXOs). Every UTXO has a value (in number of satoshis) and an locking script. UTXOs are always spent in their entirety. If you only have a 1 BTC UTXO and want to send 0.1 BTC to someone, your wallet will under the hood create a transaction that has one input (your 1 BTC UTXO) and two outputs (one 0.1 BTC UTXO with an locking script created from the receiver's address, and one 0.9 BTC UTXO with an locking script you can unlock yourself). From a protocol perspective, there is nothing special about this UTXO that goes back to yourself (called a "change output") - it's just another UTXO.
Transaction explicitly identify which previous coins they're spending, based on the txid that created them, not based on the locking script. So it doesn't matter what the sum of the values of UTXOs with a particular locking script is; coins are spent when they're mentioned as an input in another transaction. That means the only thing that matters is:

Do the input UTXOs exist?
Is the sum of the input UTXO values (whether they have the same locking script or not) not less than the sum of the values of the newly created UTXOs.

Now, sites like blockexplorers do show balances. They're a higher-level - and misleading - abstraction. They do this by simply maintaining an index per address of all transactions that have the script corresponding to that address as locking script, and all transactions that spends such outputs.
Wallets for privacy reasons construct new addresses all the time (typically one per incoming transaction), as there is no cost to creating more addresses. Looking at it from a per-address perspective is therefore misleading, and has caused people to lose money (when they think "X is my address, I only need its private key" - you need the keys to all addresses, even change addresses, your wallet uses).


Why Are My Gridseed Blades Exploding? What Components Are Exploding? I'm wanting to get into mining not so much for the mining reward but because I support the idea of decentralised currency and the power of peer to peer transactions.

However I have a problem with getting some Gridseed Blades up and running. Something on them is exploding. Please see the below photos.

This is my power supply unit.

I live in the UK so the voltage is set to 220V mode.

This is the front of the PSU wired up. My multimeter reads 12v coming from the output.

I'm in the middle of building a stack of blades but I need to overcome the problem of something in them exploding.

In this photo you can see there are three components that have exploded. What are these components? What would cause them to explode?

This photo is for comparison, this is a good blade where the components haven't exploded.

I've tried to look for a datasheet or a gridseed blade board schematic but I can't find one.

Every time I connect a blade to my power supply these same components explode. What could be causing this to happen and what could I do to stop this from happening?

Also I would like to repair the Gridseed Blades that have already exploded, is there a schematic for this board, or at least what are the components that have been damaged?

So after asking elsewhere I got half of my question answered. The reason the boards exploded was because the polarity of output was backwards. For some reason Gridseed supply power cables with the typical colours of red for live and white for ground reversed!

My solution was to swap the white and red wires over and I got no more explosions.

Does any one know what components have been damaged? And where would I get replacements from?


Why the nonce is difficult to find in Bitcoin? I read many articles explain the Bitcoin POW, but every article seems copy form each other. they just indicate find a nonce start from 1, but I still confused why find a nonce number is so difficult? I know the hash value must lower than the target difficulty.

for example the Block #502500, the nonce is 3965324040, so this block hash value lower than the target when the nonce equal 3965324040.

if I start from 1 increasing the nonce to 3965324040, that is mean computer doing the SHA256 3965324040 times, but almost every mining pool already reached PHash/s, so they just need less 1 second to find the nonce?

after 2016 second would go to next difficulty? because they just took 1 second to find a nonce.

did I miss something there?

Block #502500 from Blockchain.info

Miners try many block candidates per second. Every candidate is different in some way, but the nonce is only one of the ways in which they differ. Other ways include the timestamp, and - most importantly - the selection of transactions. In particular, the first transaction in the block is the coinbase transaction, which includes the miner payout, and the extranonce.

In practice, miners at the lowest level just increase nonces, because that's the easiest way to modify a block. However, as you point out, any modern hardware will run through all 232 nonces in less than a millisecond. So to continue searching, they will modify the extranonce inside the coinbase transaction any time they run out of block header nonces. This requires more work, as it means the Merkle tree has to be recomputed.

At the time of writing (January 2018) only one block candidate in 829 quintillion is valid. This means that all network miners combined, every 10 minutes, go through over 1.9 trilllion sets of 232 nonces.


How does LN solve the liquidity problem? How do nodes in LN manage to provide 100% collateral to all the outgoing channels? I attached an example below that details my confusion about the lack of liquidity.

Whoever made that example doesn't seem to understand how the lightning network works.  I think the creator of this scenario is confusing how the lightning network functions with how traditional deferred net settlement functions.  With the LN, you don't hold accounts with the people you have open channels with.  Instead, you have money tied up in the channel with the other participant.

The lightning network works by chaining together unbroadcast transactions that spend the outputs of a funding transaction on the Bitcoin blockchain.  These transactions are shared between the two parties in a channel, and form a smart contract that allocates how the funds of the original funding transaction are split.  Neither party can violate the smart contract without the other party being able to back out of the contract, or take advantage of the violating party.

In this way, collateral never really enters into it.  All the funds promised to a party in a channel are provably real.  Yes, you have to tie up funds in every channel you have open, but that's the price you pay for having the channel, and which allows you to collect fees for routing transactions between your different channels.  The more money you tie up in a channel, the larger the transaction you can handle.  It's the common tradeoff in finance where you trade liquidity in order to obtain a better investment.


How to Create a Light Wallet and Light Bitcoin Node, and run it on Mobile? For example, instead of using my laptop to run bitcoind...how can I run bitcoind on a smartphone to create a light bitcoin wallet?

I understand hashing may drain battery, but is this possible? If so how?

I read somewhere a client is considered "light" if it doesn't download the whole blockchain, but just communicates by sending headers.

Thanks.

If you're looking to mine on your phone, it's literally useless. The hashing power on these devices is so low that you'd probably need a very large amount of phones (around the thousands) to reach the hashing power of a single ASIC machine.

Also, storage is an issue because a Bitcoin node needs all of the blockchain data (around 17gb as of today), so you'd need a high-end phone that has a large amount of disk space.


I have bitcoins on my smart phone. How can I see and use my bitcoins on e.g. my pc? Or can I only use it from my phone? I downloaded and installed bitcoin core. took a day to get up to date. But wallet? Balance is zero. How do or must I log in? How does it work anyway?

In general, each wallet has its own set of addresses and private key chain. There is no way to log into your Bitcoin wallet, as there is no central service that is providing it to you, rather it is just locally stored on your device.

I would not recommend trying to share the same set of keys between different wallets, as it would increase the attack vectors on your money.

Rather, you might want to just send most of your bitcoins to whichever storage you expect to be most secure, and hold a spending amount on the other devices.

If you just want to see the coins on other devices, you may look up the specific address on a blockchain explorer such as blockchain.info, or read up on "watch only wallet".


Cache the Bitcoin Datadir to Improve Performance? Increase Bitcoin DB Cache Size? Bitcoin is very disk-intensive and that slows it down. It seems to flush data to disk often thus preventing proper caching. With the datadir on a RAMdisk it is much faster.
Is it possible to increase the db cache size or do something else to improve cache performance.
Of course it would be nice to keep the wallet and important data saved but I would not mind the blockchain to be heavily cached.
I'm asking mainly about Windows OS.

The very recently released bitcoin v0.6.0 has modified bdb cache settings (25 megabytes by default), and provides a way to change this via the command-line option -dbcache=N, with N a number in megabytes.

This change caused a very significant speedup for synchronizing the block chain indeed.


How to send coinpot to coinbase Can I send my crytocurrency in coinpot bitcoincore bitcoincash, mooncash, ect to my coinbase wallet?
How is this done?

I have never heard of CoinPot However, if you're referring to the cryptocurrency exchange Coinbase, as of November 2018 it is only possible to store the following coins:

Bitcoin
Bitcoin Cash
Ethereum
Ethereum Classic
Litecoin
USDC
Basic Attention Token
0x

This may be different depending on your location (country), use the chart provided to confirm.

Coinbase makes it fairly easy to receive coins, simply press "Receive" under the preferred coin and submit that address in CoinPot's withdraw implementation (You may need to obtain documentation or contact them for instructions on how to do this).


My Bitcoin Qt is behind 7 years and 32 weeks My Bitcoin Qt is behind 7 years and 32 weeks... I'm new to all this so I wonder:

if I shut down the pc, is the sync gonna continue or will it restart from the beginning?
And.. how can I get my transaction without waiting for 7 years?
and also, does the sync need bigger ssd storage?

If you shut down your PC and then restart, the Bitcoin sync will pick up where it left off.

The latest transaction your Bitcoin currently knows about is 7 years old, but it won't take 7 years to catch up. It should be all caught up in a matter of days.

You will need a lot of storage for Bitcoin Qt. The current size of the blockchain is over 80 GB, and grows at about 4 GB per month. The blockchain is always growing so you will continue to need more space indefinitely.

If you want to use Bitcoin but don't want to store the entire blockchain forever, consider using an SPV client. See the question What is an SPV client? for more information.


How could recurring payments be implemented? I pay for some things on a regular basis. They generally fall into two categories:

Things I pay for or lose, eg a variety of online services (Spotify for example)
Things I'm legally obliged to pay because I've signed a contract (my mobile bill, for example)

In the first case, I suspect recurring payments could be handled relatively easily with upgrades to the original client interface. (Maybe it would be complicated by the desire to have a new address per transaction.)

In the second case, the other party has a stronger vested interest in knowing they will receive the money. Currently, with bank standing orders and direct debits, nothing stops me cancelling regular payments on my end. But companies who receive the payments rely in part on knowing I have to go out of my way to do that. They also rely on knowing that my wages likely go into the same bank account that their payment comes out of.

With Bitcoin, the situation is reversed. I have to go out of my way to make a recurring payment. Even I was using some online service ("Bitcoin bank"?) to make the payments, I'd still have to go out of my way to top up the balance.

With no changes to Bitcoin, if it became a dominant currency, I would predict an increase in the use of debt collection agencies to recover missed contract payments. Good for debt collection agencies, but it would drive up the cost of the services proportionately.

How could recurring payments be implemented in a mutually satisfactory way? Or is the current system inherently impossible to recreate with Bitcoin?

I think the most obvious way, though perhaps not the best way, is precisely the same way as is done with other currencies. If Bitcoins are adopted as a primary currency, they'll probably be used the same way other primary currencies are.

I am paid in dollars, but no actual dollars transfer unless that is absolutely required. Instead, I have a bank account denominated in dollars from which I can withdraw actual dollars any time I need. These same mechanisms could be implemented with Bitcoins. I could have an account denominated in Bitcoins, I could be paid in Bitcoins, I could pay bills in Bitcoins, but no actual Bitcoins need change hands except where the benefits of doing things that way outweigh the costs.


about Bitcoin address I'm studying bitcoin.
I have a question because I was curious about the part of wallet.

Can I send it to the wrong address format?
The address format is correct, but is it possible to send bitcoin if sent to the ownerless address?
If 'A' happens to generate question2 address and use its wallet address, can 'A' use its coin?

Thank you.

Can I send it to the wrong address format?

Addresses have checksums in them to prevent mistakes like these. Typographical errors can be detected because of these checksums. So a well designed wallet will not allow this, but nothing prevents a badly designed program from erroneously accepting an incorrect address format and decoding it into some invalid/impossible output script.

  The address format is correct, but is it possible to send bitcoin if sent to the ownerless address?

Addresses don't have owners. They have keys or other requirements associated with them. If coins are sent to an address for which the key is not known, or to an address with unknown redeem script requirements or impossible redeemscript requirements, then the coins are permanently lost.

  If 'A' happens to generate question2 address and use its wallet address, can 'A' use its coin?

If you miraculously manage to generate the private key of an address that has bitcoins sent to it then, yes, you can spend those coins. However, the likelihood of that happening is infinitesimal.


If the current block mining reward is 12.5 bitcoin, then why don't outputs match? I'm browsing blockchain.info, and I'm trying to understand what I'm seeing. The current block mining reward is 12.5 BTC, but I'm seeing weird outputs like 14.769 BTC coming from newly created bitcoin. For example, this block:

https://blockchain.info/block/00000000000000000129eecf5ca7b9ff2d7c6332ef439e39ae0974c39d209042

Can someone help me understand what's going on here? Browsing the earliest blocks makes more sense, as they all output exactly 50 BTC, which was the initial block mining reward.

The total output of the coinbase transaction of a block is normally the sum of the current block reward (which is newly created bitcoins) and the transaction fees from all the transactions in the block (which are not newly created coins, but are effectively being transferred from the users who made the transactions).

To put it another way, the following constraint is enforced for each block:

  Total of tx outputs <= total of tx inputs + block reward

(normally it will be exactly equal, unless the miner has screwed up)

as well as the following constraint for each non-coinbase transaction:

  Sum of outputs <= sum of inputs

You can see that the first constraint ensures that the number of "newly created" coins is no larger than the block reward (normally equal).  Then, a non-coinbase transaction can grant a transaction fee by having the sum of its outputs strictly less than the sum of its inputs.  The miner can then take the difference and add it to the coinbase transaction without violating constraint 1, thus collecting the transaction fee.


PHP Checking privatekeys I am setting up my site on a hosting (not a server, just a hosting) where i will accept payments of bitcoins and maybe other cryptos later, after a week or so, i want to "sweep" my wallets.

In short:

I have a list with privatekeys and minikeys. That's all.
I want to know if possibly, without quering API (html dom of blockchain.info/q/ would be better) which wallet has balance >0 and saves that key into another file.

So is there any way to check balances without importing? I mean, converting private keys to wallet adress?

Or maybe there is any way to create a wallet with PHP where i can create a wallet, get it's wallet adress and private key.

I don't want to use API, since some apis has limited querries per hour, and if i want to check them all hourly / daily it may hit the limit.

Thanks for help!

You should not store your private keys on a webserver, unless you actually need to spend the bitcoins from that very same server.

Remember, to receive money on an address, check its balance, etc, you only need the address. This is much safer because that way nobody could steal your money, even if they get full access to your server.

One way to do it is to import all private keys in a new, separate wallet (default Bitcoin Core install would do), password-protect the wallet with a long, random, gibberish password and then discard the password (of course make sure you also still have the private keys in the original wallet). This essentially creates a "read only" wallet, which would be safe to put on your webserver, and allows for all functionality on your addresses, except spending the money.

To actually spend the money, you use the original wallet that doesn't need to be on your webserver.


Transaction still unconfirmed after 2 days Last time I tried sending a transaction with the minimum fee it was succesful after 1 day. 2 days ago i tried sending one with a higher fee and double the bitcoin amount but its still unconfirmed.
https://blockchain.info/tx-index/7e3e62569bb24f029ddce8730320bd2dbce10bc6893e4c117f5c49be18c96cf1

An unconfirmed transaction will eventually be accepted into a block by whichever mining pool mines the block, or the transaction will eventually be rejected by the bitcoin network after an estimated one to seven days. If it eventually is rejected, then the funds would remain at the bitcoin address they were sent from. The only thing you can do at this point is to wait and see if the transaction is accepted into a block. Like all wallet providers, Blockchain.info has absolutely no control over this, and cannot expedite transactions. This is always dependent upon the bitcoin network of miners, which we are not a part of.

Blockchain.info wallets utilize dynamic fees. The following link explains how this works - https://blog.blockchain.com/2016/03/16/introducing-dynamic-fees/.


Does having the Bitcoin Client running always use up a lot of the CPU? I have the Bitcoin Client running on my laptop, it is up to date and now fully synchronised, but it is running the CPU at almost 100% and so makes doing anything else extremely slow. Is this normal?

Whilst it was 'synchronising with the network' it was doing the same but I assumed it was because synchronising with the network used up a lot of processing power, but it does the same now - is this likely to always be same or have I done something wrong in the set up?  (my laptop has 2GB memory, has 2.20GHz processor and running on windows vista)

Many thanks in advance

The normal bitcoin client should not use more than a few percentages, if not even zero, from your CPU.

What client are you running? The Bitcoin-Qt client? Did you ever enabled the "generate bitcoins" option? I'm not sure if it's in the Bitcoin-Qt client's settings, but you could've enabled it in your bitcoin.conf file.

Maybe you should post your bitcoin.conf file. Or just make sure it doesn't have generate=true in it.


Are there any Mining OS to be started from USB? Considering my PC as a mining rig I don't want to install anything on HD. Setting up a system with full GUI mining capabilites (proprietary drivers, OpenCL, ...) can take some time. An out of the box solution would be nice.

Are there any preconfigured OS distributions (maybe Linux) containing all you need to boot and mine without further configurations?

LinuxCoin is probably the closest thing to what you're looking for. According to the wiki, Linuxcoin is:

  A lightweight Debian-based OS which includes in the image everything
  that is necessary to run as a Bitcoin client and everything needed to
  get started mining on ATI hardware.

Edit: It may also be worth looking into BAMT if your operation is of significant size

Update: How things change... BAMT is now the de facto mining distro. I'm now having a difficult time even finding a live link to download LinuxCoin from and BAMT has gone from experimental to a full-fledged mining distro usable for nearly any scale. I highly recommend BAMT over LinuxCoin.


Why is the privacy for using watch tower services increased with unpredictable commitment tx ids? In the open channel message in BOLT 02 the following statement is written about the various basepoints.

  The various _basepoint fields are used to derive unique keys as described in BOLT #3 for each commitment transaction. Varying these keys ensures that the transaction ID of each commitment transaction is unpredictable to an external observer, even if one commitment transaction is seen; this property is very useful for preserving privacy when outsourcing penalty transactions to third parties.

I wonder about the last sentence. Why does this in particular help with the privacy of such services? I thought I increase privacy by using several third party watching services and not only one. In case I use one they would know my entire channel state history anyway.

One thing that I guessed was that once I know one commitment tx I could calculate all txids for all possible channelstates. But I thought the signatures depend on the amount of the outputs and the txid depend on the signatures.

Do I have a misconception or is the reason for the increased privacy another one that I don't see?

Actually, the BOLT has been designed with very strong privacy properties with regard to watchtowers. You can give all your commitment tx id first halves to one watchtower and it still doesn't learn anything about the second halves, others txs or anything else about the state of the channel (or which channel it is watching at all), as long as the full commitment tx doesn't show up on the blockchain. Once it does, it still cannot learn anything beyond this one commitment state. That's what this is done for and it is rather remarkable IMHO.


When a transaction is broadcast to the network, what is actually being sent? When a transaction is broadcasted to the network, what is being sent? Is it a hash? if yes, is it going to be the hash of: previous transaction + public key of the receiver?

Client creates a new transaction, adds it to its memory pool
Client broadcasts an inv frame, which indicates that it has something in its memory pool, by giving the hash of the transaction to one or more connected peers
Peer receives inv frame, checks its own memory pool, it's not in there, so it sends a getdata frame back
Client receives a getdata frame for the transaction it just created, so it sends a tx with the entire transaction
Peer receives the tx, hashes it and puts it in the memory pool
Peer now has something new in the memory pool, and broadcasts an inv to all connected peers
Client gets an inv frame, notices that it's already in the memory pool, and ignores it
Another client gets the inv frame as well, getdata's it, stores the tx, sends inv, and repeat that until the entire network has the transaction.

References :

tx frame
inventory vector
getdata