Is it possible to identify a wallet from an address? I want to know is there anyway to identify a particular wallet (its username or email address) on the basis of a Bitcoin receiving address which is generated from that wallet. I am posting that address below:

1F5b254fXvpVqCKPMwF3tL1aKzCQSf4koe

No, there is not.

Bitcoin is what is called "pseudonymous", meaning that a bitcoin address does not reveal information about the owner of that address.  Bitcoin addresses (like the one you posted) are derived by using two types of cryptographic operations, elliptic curves and hash functions...both of which only operate in one direction.  Even if you could reverse this process for a given address, all you have is a private key.  That private key does not contain any information about who generated the key, nor which other keys/addresses are associated with it.

There are blockchain analysis techniques that can be performed to attempt to associate a bitcoin address with other addresses (with a variable degree of certainty), but even that will not give you what you are looking for unless you can associate one of those addresses with someone's identity.  This would require your query to be supplemented with additional information not found on the Bitcoin blockchain.  If you do not possess that additional information, you cannot associate an address with an identity.


Why do some blocks not have Miner's name/identity? I was going through blocks on Block explorer and I saw that some of the blocks were containing the miner's name and some were not. What is the reason behind this?

See this sample block for an example.

Blockchain.info has an interesting pie-chart showing the origin of blocks.  On that page, they specifically note:

  A large portion of Unknown blocks does not mean an attack on the network, it simply means we have been unable to determine the origin.

Blocks do not need to contain any identifying factors.  The miner can choose to provide a script in the coinbase of a new block that can be used to identify the source of the block, however they are not required to do so.  Another method that can be used to identify the source of a new block would be the target address for outputs of the new coins included in the block; if the address is well-known, then you can be almost certain the owner of that address mined the block in question.

"Anonymous" blocks are simply that, anonymous, in that they have no identifying characteristics.

This question and the answers have some interesting details as a side-effect of trying to identify who mined a specific block.


Installation troubles... Compiling from source code on a mac book pro So, I've tried to follow the instructions in /doc/build-osx.md

I installed the dependencies using Homebrew

brew install autoconf automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf qt5

Just to verify if I run this command again, I get the following:

Warning: autoconf-2.69 already installed
Warning: automake-1.15 already installed
Warning: berkeley-db4-4.8.30 already installed
Warning: libtool-2.4.6 already installed
Warning: boost-1.60.0_1 already installed
Warning: miniupnpc-1.9.20151008 already installed
Warning: openssl-1.0.2e_1 already installed
Warning: pkg-config-0.29 already installed
Warning: protobuf-2.6.1 already installed
Warning: qt5-5.5.1_2 already installed

I then run :

 ./autogen.sh

which is fine,

Then I run:

./configure --with-gui=qt5

And after a lot of lines of checking... I get, the following

...
checking miniupnpc/upnperrors.h presence... yes
checking for miniupnpc/upnperrors.h... yes
checking for main in -lminiupnpc... (cached) yes
**configure: error: Qt dependencies not found**

Any ideas what I could to fix this?

Thanks in advance.

I ran the ./configure without the -with-gui=qt5 option and the installation went through fine.

btw, this was on MAC OS X Yosemite (Version 10.10.5).


Why can't lightning network channels increase balances？ If A and B have a Lightning Network channel，it was opened with a funding transaction (say, 1BTC from both sides for 2BTC total).  After A has spent some time transacting with B, the balance of the balance of the channel will be spent and then the channel will be closed with a confirmation transaction. Why doesn't the Lightning Network support additional funding transactions within this existing channel so that A and B can continue use this channel for transactions?

Any additional funding transactions would not be covered by older commitment transactions which can result in the loss of funds. Older commitment transactions will not contain inputs that spend from the new funding transaction. The funds sent in the second funding transaction require B to sign a spending transaction, and if B refuses, then A has no way to get those funds back should an older commitment transaction be broadcast.


Debugging Bitcoin Core with gdb - how to turn off compiler optimizations I ran the configure script with the --enable-debug flag, then ran make. I am running unit tests:

gdb --args src/test/test_bitcoin --log_level=all --run_test=script_standard_tests

I'm trying to step through the execution of the source files using gdb, but I am still getting <optimized out> for many variables, and it skips lines here and there. I thought that the --enable-debug flag would turn off optimization, but am I mistaken? I'm wondering if the optimization is always on for the tests or if there is a way to turn them off.

Bitcoin Core disables -O2 and enables -Og when --enable-debug is set. -Og is intended for debugging; however, it removes some of the debugging information and is buggy. To disable it and to improve debugging experience, I suggest changing between L256 and L278 to:

CXXFLAGS="-ggdb3 -ftrapv"

-ggdb3 is more powerful than -g3, it uses a GDB-only, LLDB-incompatible dialect for debugging. This will also get rid of -O2, except in libsecp256k1.

Edit: Sipa suggests a more elegant way without altering autoconf files, which is adding args for configuring.

./configure CXXFLAGS="-O0 -ggdb3"

O0 is needed in this case.


Bash BTC and LTC address generator Do you know any bash script or C simple program to generate btc and ltc addresses? I need to generate address while in recovery mode on osx or on a linux onthefly. But I cannot find such a thing on github: they're in python or never compiles or just do btc or ltc.

Sure, you can do this with CryptoCoinJS.

First download Node.js. Then do the following:

Make a new directory:

mkdir /tmp/myapp
cd /tmp/myapp

Initialize your app:

npm init

Then run:

npm install --save coinkey@1.1.0

Then run:

npm install --save coininfo@0.2.0

Create your js file:

touch app.js

Put the following:

var CoinKey = require('coinkey')
var ci = require('coininfo')

var amount = 10
//generate a bunch of Litecoin addresses
for (var i = 0; i < amount; ++i) {
  var ck = CoinKey.createRandom(ci('LTC').versions) //change LTC to BTC if you want Bitcoin
  console.log(ck.privateWif + ': ' + ck.publicAddress)
}

Run your script:

node app.js

Documentation for coinkey
Documentation for coininfo.

Hope this helps. If something doesn't work, let me know.


Can we shutdown the Bitcoin blockchain? I maybe wrong but what I think is the blockchain ledger exists as long as there are active nodes in the network. So can the Bitcoin blockchain be shutdown by shutting down power supply across the globe? What would happen in such a case?

I think the transactions that were not added to the ledger would definitely be lost and they would have to be re initiated. I think power shutdown would create inconsistency between different instances of the ledger at different nodes and even if the power is back we wouldn't be able to pick a safe state of the ledger.

What are the possible ways to shutdown the blockchain without having to go to each and every node and taking it down?

So can a blockchain can be shutdown by shutting down power supply across the globe? What would happen in such a case?

If the world's power supply was suddenly cut off, then everything electronic would stop working. The blockchain would be 'frozen', each node would retain its local copy, but be unable to communicate with other nodes, and miners would be unable to mine and add new blocks.

  I think the transactions that were not added to the ledger would definitely be lost and they would have to be reinitiated.

This depends on what happens to the mempool of each node. If any nodes remembered any unconfirmed transactions from before the power loss, they could simply broadcast those transactions to the network once things went back online.

  I think power shutdown would create inconsistency between different instances of the ledger at different nodes and even if the power is back we wouldn't be able to pick a safe state of the ledger.

Each individual node, once it came back online, would reconnect to some peers in the network, and listen for information about new blocks, just like normal. The decision about which chain to follow would also be made as per normal: which chain has the most work? Follow that one. If there are multiple choices for a most-work chain, then the decision about which one to follow will be made when the node hears about a new block, which extends one of those chains (the other chain will become 'stale', and will not be a part of the blockchain history).

  What are the possible ways to shutdown a blockchain without having to go to each and every node and taking it down?

This is a strength of the bitcoin network: it is a decentralized network of computers, without any real hierarchy or centralized control. You would have to attack every node, otherwise the un-attacked nodes will be able to maintain the network. Given the highly distributed and anonymous nature of the network, this seems to be an extremely difficult task.


How does Coinmarketcap calculate the USD price for Bitcoin? I'm doing a school project in which I'm building my own bitcoin price index similar to coinmarketcap. I want to calculate the USD price for bitcoin by using volume weight averaging from multiple exchanges. Some of the exchanges don't offer USD or any foreign currency (EUR, GBP, etc) trading pairs.

I thought I understood how coinmarketcap calculated the price, until I looked at their BTC markets page. I see they're averaging in USD prices of altcoin pairs like TRX/BTC, XRP/BTC, etc as well.

So can someone explain how they determine the USD price (on the BTC markets page) of, for example, TRX/BTC on the Bit-Z exchange without first knowing the actual USD price of BTC? I don't understand where they're getting the USD price of TRX/BTC if its also being factored into the final USD price of BTC as well.

And when I add up the volume percentages in the "Volume (%)" column, it doesn't add up to 100%. More like 94%. Anyone know why that is?

I'm not a mathematician, so maybe there's a simple answer to this.

CoinMarketCap takes necessary information like volume and price changes from exchanges and calculates their average.
That's why they delisted some of the Korean exchanges earlier, as you may have seen that their prices are too high when you compare it to other exchanges around the world, which causes price jump and misleading for investors.


How are transaction fees calculated in raw-transactions? So, after understanding how to create and send raw transactions on the basis of 'How to send from many bitcoin addresses to one bitcoin address?', in practice I still struggle with transaction fees. For example, I do the following in order to calculate the size of an hex-encoded transaction:

hex_raw_transaction = createrawtransaction(...)
hex_raw_transaction = signrawtransaction(hex_raw_transaction)
byte[] size = HexStringToByteArray(hex_raw_transaction)
int transaction_size = size.Length

Is that a correct way to determinate the transaction size? (Regarding to https://en.bitcoin.it/wiki/Transaction_fees)?

Is it correct that the transaction fee is set by the unassigned amount in the outputs?

For example, if I have 1 BTC in one address and send the 0.65 BTC to a second address and 0.3495 BTC as change to the first

//The fee will be:
fee = 1 - (0.65 + 0.3495)  //= 0.0005 btc

is it correct that the fee will be 0.0005 BTC?

Here is a great answer on how to calculate the transaction size before sending. (Make sure to read the final edit.)

As for the fee, you've got it right: whatever amount from the inputs is NOT sent to other addresses, becomes the transaction fee for the miners.


How can I list my mined coins using RPC? And spend them? I've mined a few blocks on a blockchain, and I'm trying to figure how to actually see them. What is the correct RPC command ? I've managed to see all the coinbase transactions thanks to listtransactions, and my getbalance output seems ok, but they don't show up in listreceivedbyaddress nor listreceivedbyaccount.

You can use the listsinceblock command to filter out the mined coins. listsinceblock contains a category field. The values you're looking for are:

generate: for coins mined locally that are available for spending
immature: same as above but coins cannot be spent yet


Litecoin daemon is not responding to API calls Just before few hour I have setup bitcoin daemon on my ubuntu server and tested it with API and it is responding very well. Now I have installed litecoin daemon on the same server and used copied the same php files with a little sytax changes like change in username and password and port number but it is not responding to any API calls.

Content of litecoin.conf are :

server=1
daemon=1
rpcuser=my_username
rpcpassword=mypassword
rpcport=9332

Content of litecoin.php

<?php
include_once('jsonRPCClient.php');
$variable = $_GET['variable'];
$litecoin = new jsonRPCClient('http://my_user:my_password@127.0.0.1:9332/');
if($variable=='getnewaddress')
{
echo $litecoin->getnewaddress();
}
else if($variable=='getinfo')
{
print_r($litecoin->getinfo());
}
else
{
echo "hello";
}
?>

Any help of what I am doing wrong here ?

I was trying to figure out why php file is not throwing any error if there is any then I discovered that error_reporting in php.ini file is turned off after turning it on I got following error while executing litecoin.php on the browser :

Warning: fopen(http://...@myserveraddress.com:9332/): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /var/www/jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://myuser:mypassword@myserveraddress.com:9332/' in /var/www/jsonRPCClient.php:140 Stack trace: #0 /var/www/litecoin.php(12): jsonRPCClient->__call('getinfo', Array) #1 /var/www/litecoin.php(12): jsonRPCClient->getinfo() #2 {main} thrown in /var/www/jsonRPCClient.php on line 140

First add this line to litecoin.conf

rpcallowip=127.0.0.1

Then make sure you've added the litecoin command to your path

sudo cp litecoind /usr/bin/litecoind

and that your starting the litecoin daemon

litecoind -daemon

and test with

litecoind getinfo

if all that works then JSON RPC should work fine.

If none of that works try setting up the client by following this guide.

Also make sure your username and password are consistent across your PHP and litecoin.conf because they aren't in your example.


How to increase the speed of synchronisation? What ways are there to increase the speed of synchronisation of the network, assuming the use of the main Bitcoin client?

Pass -dbcache=N as a command line option. N is a number in megabytes, and setting it higher significantly improves verification speed. The default is 450, but up to 6000 or so you can notice improvements.

This is superior to using a RAM drive.


Running Bitcoin on command-line-only system I want to run a Bitcoin client on a command-line-only system (Amazon EC2). Is there some specific command-line parameters I should use in order to run the main client without the GUI, or will it run properly without any parameters? How do I later check the status of the client (check number of connections, balance, etc)?

To run it as a daemon type:

$ bitcoind -daemon
bitcoin server starting
$

You can then use the API calls to do whatever you want:

$ bitcoind getblockcount
153407
$ bitcoind getconnectioncount
20


Confusion about `unloadwallet` It's not clear to me how unloaded wallets behave in Bitcoin Core v0.17.0.1.

If I create a new wallet with createwallet, add a receiving address to it using importmulti, then unload it using unloadwallet:

Will bitcoind still detect payments to this wallet’s address(es)? (seems yes)
If yes, will that detection happen only when I use loadwallet again? (seems yes)
If yes, will that require a rescan of (recent) blocks? (I'm worried about how long this might take, if it's been months or years since I last loaded this wallet.)
If yes, will that be a problem on a pruned node?
If yes, should I avoid this multi-wallet feature on a pruned node, or is there a safe way to use it without risking large re-downloads? (e.g. never unload it)

Yes
Yes
Yes
Possibly
By making sure the node does not prune beyond the point the wallet was last loaded. You can either set the prune size large enough that enough blocks remain, or use manual pruning. With manual pruning you can determine how much to prune and when, using the pruneblockchain RPC command.


Ok, I've found the problem.

Input has 52 5-bit groups. 260 bits. Remember that every encode calls convertBits to convert from 8 bit groups to 5-bit groups. But 260 bits made of bytes is impossible! So there were 264 bits originally, = 33bytes. 264 bits need to be padded by convertBits (convertBits can/will pad when encoding but won't while decoding). So we have 265 bits. 53 5-bit groups. So you need to add a zero at the end of your input to achieve the intended result.

While decoding, convertBits will, until the number of bits is a multiple of 8, check that the last bit is 0, drop it. In your case, the last bit is not zero, so the only way not to discard it is to pad it, which it's not allowed to do while decoding.

TLDR all 5-bit groups as input are converted from 8-bit groups (addresses are designed for hash outputs and hashes output full bytes). If decoding can't decode to 8-bit groups without padding, the address is considered invalid.

Let's try to do what convertBits does to decode!

First, to simplify ignore first few multiples of 40 bits in the input. The last few bits remaining are:

10000 00110 01001 10001

Convertbits, while decoding converts from 5 to 8:

10000001 10010011 0001

Does the last group have exactly 8 bits? (In that case no further action would be needed) No.
Does the last group have zeros only? (In that case we can just erase the last group) No.
Throw an error. We either need to discard bits or pad, which is not allowed while decoding.

This is why the address you generated is can't be decoded. (Try it)


Is there a difference in buying coins with bitcoin or etherum? So today I decided to throw my hat into the ring and bought some stellar lumen coins.  Since bittrex is not currently accepting new accounts I decided to go with poloniex.

Poloniex doesnt offer lumen in their etherum market so I had to buy it with bitcoin, is there a difference when buying (any currency/token) with bitcoin or etherum?

I am still very new to the Cryptocurrency scene so any information would be greatful

The only difference could be with rounding depending on precision of coins with relation to value to each other. I think most exchanges are governed by law to not steal fractions of pennies but it's always an uncertain point sometimes and so I can not say you aren't in some cases losing fractions of coins.

Also some times on inefficient markets crypto currencies may differ in prices across different currencies. This is an opportunity for arbitrage and typically doesn't exist. This may be caused by sudden changes in the market and usually temporary barriers. Like for example etc goes up rapidly, and LTC had been struggling, there may be a shortage of LTC and so there might be a temporary profit margin through LTC to etc then to btc. But usually the market players will balance things out quickly. It basically the speed of crypto currencies type thing like a ripple in a pond and probably a better topic for forex trading on economics or finance se.

from a math point of view crypto currencies maybe analyzed with linear algebra where your portfolio is a coordinates of vector and basis is the currency to base currency exchange rate. Then redistributing the portfolio amounts to a linear transformation.


Does the fact that bitcoins are limited prove that the system is a scam? As we all know the total amount of bitcoins which can be available at any time are capped at 21 Million. This was done by design by its creator/creators (he/she/they say that it is intended to make the coin "scarce").

But if I think about it, this fact is completely destroying the intent of creating a currency for people to buy things with. Nobody who has even the smallest understanding of economy would spend bitcoin to buy things with because it is guaranteed that it will be, sooner or later more valuable over time.

For me, it seems that the only reason this technology was created was just to trap people into buying it, believing that it will become more valuable, but in the end, the only people who do really make real (fiat) money from this are the "early adopters" and the creator himself who got the bitcoins when they were very cheap. Also, take into account that the creator is still anonymous to this day et voila - you got a lot of evidence to why this whole system is just a kind of ponzi scheme designed to distribute wealth from late adopters to early adopters.

Please prove me wrong because until now I was very fascinated by bitcoin and altoins.

You make a lot of interesting claims. The ethos behind bitcoin is similar to that of gold, hence 'mining'. Gold is also limited supply and I am certain that people who first found gold a long time ago are rich beyond their wildest dreams. That does not stop anybody trading gold for something of value.

  ... a kind of ponzi scheme ...

Ponzi scheme is a particular arrangement which Bitcoin certainly is not.


Having problem implementing Electrum's BIP32 Key deriviation path I'm trying to create a BIP32 storefront that uses Electrum's key derivation path. The user passes me their MPK, and with every order I generate a new address based on the MPK. I'm able to generate addresses, but they don't match the one's created by Electrum. I'm using Electrum 2.2.

This is my code (I'm using pybitcointools command line). To keep thinks legible, I'm swapping out the actual values for $variables.

> Using $xpub which is the MPK I copied from Electrum:
./pybtctools bip32_ckd $xpub 0
> $xpub0

./pybtctools bip32_ckd $xpub0 0
> $xpub00

./pybtctools pubtoaddr $xpub00
> $addr

My expectation is that the$addr I end up with should match the the first address of my "receiving" addresses in Electrum. However, they don't match. Any thoughts on why that might be?

For reference the xpub I start with xpub661MyMwAqRbcGK5eE2eSWmnU4Pg6knZZqZEmREAgZ4vj6z3B5soecps7UJj37NF9aWhjEMQoyH9xgcC14KUgEGX9avagrdv9rcN56wjwXR2 and I get an address of 17VzXFqo6Kg7vMxNLWD5hhwgsdCV6XL9RT (which is not in my Receiving addresses list).

You're very close.

bip32_ckd returns a BIP-32 extended public key, however pubtoaddr expects as input a "normal" non-extended public key in either raw or hex-encoded form (and it doesn't check if the public key appears valid). Here's what you want:

./pybtctools bip32_ckd $xpub 0
> $xpub0

./pybtctools bip32_ckd $xpub0 0
> $xpub00

./pybtctools bip32_extract_key $xpub00
> $pub00

./pybtctools pubtoaddr $pub00
> $addr


Is one quad GPU rig better than two dual GPU rigs for Scrypt mining? I want to buy four r9 280x cards for Scrypt mining. I already have all other hardware components to create two dual rigs. Would one mining rig that uses all four GPUs instead be significantly better?

I would have to buy a motherboard or riser cards to create the quad rig. I am indifferent to power consumption.

Theoretically you should see a net saving in electricity consumption for there ought to be some economies of scale in having a single motherboard with the 4 cards vs. 2 separate motherbs. each with 2 cards each.

The CPUs controlling such cards are consuming power themselves but such consumption doesn't get much bigger if you have 1, 2 or 4 cards in the same motherboard. Plus the inefficiencies in AC/DC conversion within the power supplies would double, so yes - you should definitely see some savings with that arrangement.

But then, such a machine would consume tons of power, which not a lot of power supplies would be able to yield - 500 Watts, 800 W? Plus all the heat they'd generate, which of course needs to be dissipated somehow - which means not just some big fans, but probably some heatsinks, Peltiers or just submerging the whole arrangement in a bath of mineral oil -- fluorinert would be even better, if you can afford it.

Such big initial investment costs could offset part of the savings, so I believe it would be barely more profitable than the 2 machines way.


How are change addresses treated differently by Bitcoin Core? I understand the reasons for wanting to use new change address for each transaction, but am unsure as to how they are treated by the Bitcoin core client.

Is the address deleted as soon as the funds it received as change are spent?
The client probably doesn't watch for any further sends to these addresses, right?

Is the address deleted as soon as the funds it received as change are spent?

No, the change address is not deleted but it is stored as another of your key pairs of your wallet. Bassically when you make a transaction with 1 BTC spending only 0.7 the remaining 0.3 BTC is send to new address that is stored inside the client (current account) waiting for new transaction from operating "main" address to occur.

Try yourself list your addresses (after you spend input on one of your change addreses) with command: listaddressgroupings

The client probably doesn't watch for any further sends to these addresses, right?

No, the client updates the balance on all keys inside the client. The change address can receive and sends BTC. The remaining funds will be updated as part of the main bitcoin address.

For more information see: Change on Bitcoin wiki


How to reduce Bitcoin loaded wallet memory? The server has 2GB of RAM memory. It takes up a lot of memory when I create or load a wallet. When I create about 50 wallets, the server is very slow because the memory is full. Is there a way to reduce the memory of a loaded wallet?

There is different way to optimize, configure or reduce the memory usage of bitcoind, I invite you to see this page from the bitcoind github who talk about it: https://github.com/bitcoin/bitcoin/blob/master/doc/reduce-memory.md


What does Bitpay's {"error": "Invalid token"} mean? I'm creating a web app that uses Bitpay for payments. I'm writing it in ruby (but that shouldn't matter), and have a class method bitpay_client with the body BitPay::Client.new('mYs3cretAPIkey').

Anytime I do BitcoinInvoice.bitpay_client.get("invoice/#{invoice_id}") I get the JSON {"error": "Invalid token"} back from the server. In Bitpay's documentation there's no mention of this message. I'm using the right api key, and I'm sure this is a real invoice. What does this message mean?

The error was my client connected to the wrong endpoint. This feature was undocumented at the time, but is now clearly documented. Kudos to Bitpay!


How do I sign and send a raw transaction using BitcoinJ? Transaction transaction = new Transaction(params);
    // 遍历未花费列表，组装合适的item

    double sum = 0;
    String address = null;
    List<Unspent> unspents = new ArrayList<>();
    Map<String, AddrDTO> keysMap = new HashMap<>();
    for (Unspent utxo : unSpentBTCList) {
        /*
         * if(!script.isSentToRawPubKey() && !script.isSentToAddress()) {
         * logger.info("格式不對:" + utxo.address()); continue; }
         */
        AddrDTO addrDto = this.getAddrDTO(utxo.address());
        if (addrDto == null) {
            logger.info("address 找不到:" + utxo.address());
            continue;
        }
        keysMap.put(utxo.address(), addrDto);
        unspents.add(utxo);
        sum += utxo.amount();
        address = utxo.address();
        if (sum >= amount) {
            break;// 停止。
        }
    }
    if (sum < amount) {
        logger.error("余额不足");
        throw new RuntimeException("余额不足！");
    }

    long value = btc2Satoshi(amount);
    transaction.addOutput(Coin.valueOf(value), Address.fromBase58(params, to));
    // transaction.

    // 消费列表总金额 - 已经转账的金额 - 手续费 就等于需要返回给自己的金额了
    long longFee = btc2Satoshi(fee);
    long balance = btc2Satoshi(sum) - value - longFee;
    // 输出-转给自己
    if (balance > 0) {
        transaction.addOutput(Coin.valueOf(balance), Address.fromBase58(params, address));
    }
    int i = 0;
    for (Unspent utxo : unspents) {
        AddrDTO addrDto = keysMap.get(utxo.address());
        logger.info("xxxxxxxxxx:" + utxo.txid() + ":" + addrDto.getAddress());
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, addrDto.getPrivateKey());
        Script s = new Script(Hex.decode(utxo.scriptPubKey()));
        TransactionOutPoint outPoint = new TransactionOutPoint(params, i++, Sha256Hash.wrap(utxo.txid()));
        ECKey ecKey = dumpedPrivateKey.getKey();
        transaction.addSignedInput(outPoint, s, ecKey, Transaction.SigHash.ALL, true);
        logger.info("xxxxxxxxxx:" + utxo.amount());
    }
    String hex = Hex.toHexString(transaction.bitcoinSerialize());
    logger.info("bitcoinj hex = " + hex);

Error:

Exception in thread "main" org.bitcoinj.core.ScriptException: Don't know how to sign for this kind of scriptPubKey: HASH160 PUSHDATA(20)[1a0a82f0669c14c6739e4cf1a5a3f221f657e28f] EQUAL
    at org.bitcoinj.core.Transaction.addSignedInput(Transaction.java:823)
    at com.idasex.bitcoin.BitcoinClient.signBTCTransactionData(BitcoinClient.java:337)
    at com.idasex.bitcoin.BitcoinClient.sendRawTx(BitcoinClient.java:274)
    at com.idasex.bitcoin.BitcoinClient.main(BitcoinClient.java:409)

I'm not an expert in this field by any means (and my error message was different), but I spent last week trying to make Bitcoinj sign a transaction and send in raw form (i.e. without using transport protocol which Bitcoinj provides) and here's what I've learned (the hard way): You can't sign transactions like that. If you call tx.addSignedInput in a loop, you'll corrupt transaction's signature and it's gonna to be invalid. The solution (after brainstorming with my team and trying a few recipes here (this one didn't work), at Bitcoin Stack Exchange) was add all Inputs to the transaction and then sign them manually.

Transaction tx = new Transaction(networkParams);
tx.addOutput(Coin.valueOf(amount), targetAddress);
addInputsToTransaction(sourceAddress, tx, unspents, amount);
signInputsOfTransaction(sourceAddress, tx, key);

tx.verify();
tx.getConfidence().setSource(TransactionConfidence.Source.SELF);
tx.setPurpose(Transaction.Purpose.USER_PAYMENT);
String valueToSend = byteArrayToHexString(tx.bitcoinSerialize());

and the methods:

private void addInputsToTransaction(Address sourceAddress, Transaction tx, @NonNull BalanceResponse.Unspents[] unspents, Long amount) {
    long gatheredAmount = 0L;
    long requiredAmount = amount + TX_FEE;
    for (BalanceResponse.Unspents unspent : unspents) {
        gatheredAmount += unspent.getAmount();
        TransactionOutPoint outPoint = new TransactionOutPoint(networkParams, unspent.getvOut(), Sha256Hash.wrap(unspent.getTxId()));
        TransactionInput transactionInput = new TransactionInput(networkParams, tx, hexStringToByteArray(unspent.getScriptPubKey()),
                outPoint, Coin.valueOf(unspent.getAmount());
        tx.addInput(transactionInput);

        if (gatheredAmount >= requiredAmount) {
            break;
        }
    }
    if (gatheredAmount > requiredAmount) {
        //return change to sender, in real life it should use different address
        tx.addOutput(Coin.valueOf((gatheredAmount - requiredAmount)), sourceAddress);
    }
}

private void signInputsOfTransaction(Address sourceAddress, @NonNull Transaction tx, ECKey key) {
    for (int i = 0; i < tx.getInputs().size(); i++) {
        Script scriptPubKey = ScriptBuilder.createOutputScript(sourceAddress);
        Sha256Hash hash = tx.hashForSignature(i, scriptPubKey, Transaction.SigHash.ALL, true);
        ECKey.ECDSASignature ecdsaSignature = key.sign(hash);
        TransactionSignature txSignature = new TransactionSignature(ecdsaSignature, Transaction.SigHash.ALL, true);

        if (ScriptPattern.isP2PK(scriptPubKey)) {
            tx.getInput(i).setScriptSig(ScriptBuilder.createInputScript(txSignature));
        } else {
            if (!ScriptPattern.isP2PKH(scriptPubKey)) {
                throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Unable to sign this scrptPubKey: " + scriptPubKey);
            }
            tx.getInput(i).setScriptSig(ScriptBuilder.createInputScript(txSignature, key));
        }
    }
}

I hope, it will help you.


Bitcoin Address can't be found of client? So, I'm a total noob to Bitcoin and have just finished installing it and have looked under all of the settings and cannot find the address. This is a little concerning. If I am missing something PLEASE correct/help me. I have seen in older versions that the address is right there on the GUI but I still can't find mine. I'm on version 0.7.2 if that helps.

Under the tab 'Receive Coins', click 'New Address'


autogen.sh not working on Ubuntu on Windows I installed Ubuntu on Windows, then cloned https://github.com/bitcoin/bitcoin in.

cd bitcoin
./autogen.sh

Which returned this:

: not foundh: 5: ./autogen.sh:
./autogen.sh: 6: set: Illegal option -

What am I doing wrong here? Have I missed something, or do I need to raise it as an issue on GitHub?

Thanks!

EDIT: Here is a screenshot:

This means your file has DOS newlines thus, hidden CR characters at the end.
Thus, set -e becomes set -e$'\r' (using bash-specific syntax to represent the CR character), which isn't a valid option.

To fix this, if you have dos2unix installed, you can run:
    dos2unix autogen.sh


Transactions in a shorter blockchain branch As I understand it, in a situation where two miners solve a block at the same time, a branch is created on the blockchain which is resolved when one branch is built upon, and thus becomes longer than the other branch.  The longer blockchain is then regarded as the de facto blockchain.

But what happens to the confirmed transactions in the shorter branch?  If this shorter branch is now disregarded, are the transactions lost?  If so, are bitcoins lost as a result?  Are the transaction sent back to the miners' mempool?  If so, is there a risk of double-spending?

The transactions on the sort - or orphaned - branch are not considered confirmed. They are considered never having happened at all and are returned to the mempool, unless they were also included on the other, de facto branch.

Any bitcoins mined in an orphan block is never considered to having existed in the first place, to be able to be considered 'lost'. All the effort and electricity spent mining an orphan block is literally wasted.

There's a risk of double spend for every merchant or recipient of a transaction who didn't wait enough time to see the transaction confirmed in a block and several successive blocks. If he or she accepts a transaction in a block A, then delivers the product sold, the another transaction with the same input but other output is included in block B, then block A get orphaned, the merchant delivered the product and didn't receive the money. He or she can contact the buyer to settle this somehow, but that's the definition of a double spend.


what programming languages are used to built bitcoin? I have one very basic question,

I would like to know:

what programming languages are used to built bitcoin?

The reference implementation, Bitcoin Core, is written primarily in C++, with various resource files and scripts in other languages.

Another implementation, mainly used in lightweight clients like MultiBit and Bitcoin Wallet (Android), is bitcoinj. It is written in Java.


Is the "Finite Blockchain" idea secure? http://www.bitfreak.info/files/pp2p-ccmbc-rev1.pdf

  This paper will describe the way in which these three mechanisms can
  work together to form a system which provides a high level of
  integrity and security, yet is much slimmer than all other purely P2P
  currencies. It also offers other potential benefits such as faster
  transactions and lower fees, quicker network synchronization, support
  for high levels of traffic, more  block space for custom messages, and
  increased anonymity

Has anyone analyzed the design and found it to be secure? My own primitive analysis didn't find any weaknesses, but I'm no cryptographer or security expert.

The most apparent weakness is the following: If an attacker has enough hashpower to build an alternative branch starting with the current block, and to be ahead of the network once that block is pruned; he can rewrite the entire history completely, assigning bitcoins arbitrarily among the addresses he chooses.

This can be alleviated with archive nodes which are consulted in times of emergency.


How do I switch from MultiBit to Bitcoin-QT? Okay, so I have seen the questions on how to go from Bitcoin Core to MultiBit, but I want to go the other way.

Really, I downloaded and started using the wrong wallet.  I wouldn't even mind MultiBit if it wasn't for that the default folder can't be moved (I dislike having a cluttered home folder) - I asked, and the location is hardcoded.  Considering I use the default clients for the altcoins, I'd rather go with Core.

I'd transfer my little funds to Bitcoin Core and suffer the fee, but I have less than the threshold (0.006 something).

Is there a way to make my wallet active in Bitcoin Core, preferably without tearing my hair out?  Or should I (groan) keep mining altcoins next winter (too hot out right now for my poor PC cranked up), build up my Bitcoin balance by exchange, then transfer wallets the easy way?

Details are appreciated.  Thanks.

As far as I can tell, BTC 0.006 is not below any relevant transaction limit. A couple weeks ago I bought a cup of coffee for BTC 0.0033 and it went through without problems.

You would probably pay a fee of BTC 0.0001 - less than 2% of your holdings, and about US $0.05 at today's prices. At US minimum wage that buys roughly 20 seconds of your time. You'll spend more time (= money) than that just reading any other answer, much less implementing it.

Short version - just pay the fee!

(Future generations reading this will no doubt, one way or the other, find it hilarious that someone could/would pay BTC 0.0033 for a cup of coffee!)


What open source miner applications are there? What open source miner applications are there? Especially to see how the mining process works.

The official list is on The Wiki and is constantly being modified since new software shows up fairly often, but here's the quick breakdown:

Poclbm - Python/OpenCL GPU miner (GUI)
DiabloMiner - Java/OpenCL GPU miner (MAC OS X GUI)
RPC Miner - remote RPC miner (MAC OS X GUI)
Phoenix miner - miner
Cpu Miner - miner
Ufasoft miner - miner
Pyminer - Python miner, reference implementation
Remote miner - mining pool software
Open Source FGPA Bitcoin Miner - a miner that makes use of an FPGA Board

Poclbm and Phoenix are probably the most popular (links go to the sources) though that's based more on my opinion than any facts or studies. In either case, both should shed some light on the mining process.


How to set up for merged mining I plan to eventually add litecoin, Dogecoin, and possibly some other scrypt merged-minable coins to my pool. Are there any tutorials or other information available that would show me how to set my pool up for merged mining?

You may want to take a look at this GitHub repo, which supports merged mining.


How do miners choose transactions? I am a little puzzled about how miners choose transactions, are the people who want to transfer Bitcoin sending their transaction to miners asking them to validate them, or are they put somewhere and then the individual miners can aggregate the ones they like?
I tried to find some information on google about this but it didn't really illuminate the problem well enough for me.

https://www.coindesk.com/information/how-do-bitcoin-transactions-work/

  She then sends them from her bitcoin wallet out to the wider bitcoin
  network. From there, bitcoin miners verify the transaction, putting it
  into a transaction block and eventually solving it.

Transactions are broadcast over the P2P network, which miners are also a part of, so they receive the transactions from their peers.

Miners are completely free to do choose which transactions to include in the blocks they mine, but generally prefer to maximize revenue by collecting fees from transactions.


How to generate html with coverage data? I built bitcoin as:

./autogen.sh
./configure --without-gui --enable-lcov
make -j4
./src/test/test_bitcoin

I see bunch of *.gcno files. How do I generate html?

Okay, I figured that out.

After you run tests, you will see a bunch of *.gcno files. Then, do:

# better to work in a separate dir
mkdir cov && cd cov
lcov -c -d ../src -o cov.info
genhtml cov.info

And open index.html cov dir.


A list of trusted Bitcoin websites? Is there some trusted website that maintains a list of Bitcoin-related websites and their reputation? For example, if I wanted to check if betsofbitco.in is a legitimate websites (it pays rewards fairly, etc.), where should I turn, asides digging through the forum?

there is no list of bitcoin trusted websites, but you can check some things  to have a good idea of the trust you can give to a website :

check the whois :

anonymous whois ( domainsbyproxy or other ) : -1
recent website ( created 1 or 2 months ago ) : -1
old and known website : +1

check the bitcoinpolice website ( bitcoin.crimeunit.net/wiki/index.php ) there could be a report here ( bitcoin.crimeunit.net/wiki/index.php/MyBitcoin as an example )
if you can use IRC, come ask on #bitcoin-otc and #bitcoin-police IRC channels on freenode IRC server
bitcoin-otc is a p2p bitcoin exchange, building a reputation system ( wiki.bitcoin-otc.com/wiki/OTC_Rating_System ) , if a website is operated by an old and trusted otc member ( example of old trusted user :  bitcoin-otc.com/viewratingdetail.php?nick=ne0futur ) you can probably trust the website.
help us making it better, report any problem to the bitcoin-police


List transactions after losing wallet and private key? I have made various transactions with my wallet using bitcoind. If I lose my wallet (and private key) and somebody else somehow knows my private key and does some transactions, is it possible for me to somehow get a list of those new transactions?

If you have your wallet.dat in the Bitcoin core and someone else for some reason knows a private key that is associated with this wallet.dat, this person can spend the Bitcoins of that private key in basically, any other wallet, if this person does that, you will see this transaction in your Bitcoin core as the type "Sent to".
If you like to test it you can type listunspent in your Bitcoin core, then you will see the addresses with an amount to be spendable, then you can copy any of these addresses and take the private key for that address using the command dumpprivkey address, take this private key and import in any other wallet then send the Bitcoin to some other wallet.


Are private keys published to the blockchain after spending coins from a wallet? Always I spend coins the final balance of the address that is used for transaction will go to zero. The remaining coins comes back as a change to a new address. Will this indicate that the private key of the spending address is published now to the block chain for validation? Is it a risk to use this address furthermore for receiving and storing coins?

The answer is no. Your private key is never transmitted to the network for any reason.  You may wonder how the network can validate that a transaction is "yours".

This is possible because Bitcoin uses Public Key Cryptography (also know as asymetric cryptopgraphy).

Your addresses consist of a pair of keys which are mathematically linked.  It is easy to determine the public key from the private key but impossible to determine the private key from the public key.  It is more accurate to say it is computationally infeasible to determine the private key from the public key unless there is some cryptographic flaw.

Your public key is included in the transaction (along with destination and amount).  The entire transaction is then signed with your private key.  The signature is unique based on your private key and the contents of the transaction.  Someone can't re-use a signature because it is only valid for a unique transaction.

When the network detects a transaction it will verify it by comparing the signature and public key to the transaction.  While an attacker knows the public key he would need to know the private key to generate a valid signature.

Forgery/counterfiting is prevented because it is computationally infeasible (millions of years) to determine the correct signature without the private key.  It is not possible for an attacker to change part of the transaction (like changing amount in fiat check fraud) as that would require  different signature to be valid. The network can safely assume that if the signature is valid it must have been signed by the owner (presuambly with owners consent) and thus the transaction is valid.

This is why you must keep your wallet.dat secure.  If someone gains access to your private keys they can sign transactions as you.  Once an attacker can sign any transaction as you the best transaction is to transfer of all funds into account they control.


Can you run a bitcoin lightning node on a raspberry pi zero? Will a bitcoin lightning node run on a raspberry pi zero? Does it have to have the full Bitcoin blockchain synced or can it connect to a remote node? Also what are the minimum requirements to get a lightning node up?

Will a bitcoin lightning node run on a raspberry pi zero?

This probably depends on what you are doing on the node, how much traffic it gets, etc. I have one running on a Raspberry Pi 3B with basically no traffic and its currently utilizing virtually no CPU and 0.8% memory.

  Does it have to have the full Bitcoin blockchain synced or can it
  connect to a remote node?

No, it can connect to a remote node. For example, see https://github.com/ElementsProject/lightning#getting-started.

  Also what are the minimum requirements to get a lightning node up?

I would recommend setting up C-Lighting, it currently works on Linux, and the dependencies are listed in the Installation section. You also need to fund a channel in order to be able to do any transactions.


Should I include the fee in the sent bitcoin amount? I'm using Electrum and want to purchase something with Bitcoins. When I get to the bitpay screen with all the details (And the timer) I input the information into the electrum client, which then generates a Fee for the transaction.

My question is: I need to send an exact amount, will the fee take the amount straight out of the amount being sent (And therefore send too low an amount) or do I need to add the fee to the amount being sent?

i.e Let's say the site requests exactly 0.05 bitcoins, fee is 0.02. Do I send 0.07 and let it take the fee, or do I send 0.05 and it takes the fee out of the wallet another way?

Thanks.

The fee is going to be separate from the amount.

Using your exmaple:
If you need to send bitpay 0.05 btc, you enter 0.05 for the amount field and 0.02 for the fee field. Do not send bitpay 0.07 btc

If you specify a fee of 0.02 btc and you only have 0.06 btc combined in all of your addresses, electrum will alert you that you don't have enough.

Please note that the fee is something that you decide you want to include. It is not a fixed value, but there is a minimum if you want to get your transaction included into a block in a reasonable amount of time. Looking at the current block, 402557, transaction fees look like they are around 0.001 btc. The fee can depend on a couple of things like age of coins, size of transaction, and/or how fast you want your transaction included. You may also want to increase the fee since more and more blocks are reaching the size limit and miners will favor a more profitable transaction.


Since blockchain is public.. can someone tell how Since blockchain is public.. can it be found how many bitcoin you own by having your bitcoin public address?

Yes. Simply paste your bitcoin adress into a block explorer such as http://blockchain.info

For example, this adress has 200$ pending -> https://blockchain.info/address/1Lx4aebbGAUA2ASuYBoiAC2akutzpZQMzb Or, 0.025631 BTC

You can also add a watch-only adress in bitcoin-core / electrum to keep track of balances from certain adresses.


Can the change address be in a different account after using sendfrom ? I made a sendfrom call specifying the fromaccount parameter. The resulting transaction created a change address which was not assigned to the account I specified. The address was not assigned to any account.

Why do you think this might have happened?

Also, do you think I can spend the amount on the change address by sending using sendfrom by specifying the same account?

You misunderstand how accounts work.

All coins in a wallet are always shared between all accounts. When creating a new transaction, the coins are taken from the entire set a wallet has access to - independent from how these were obtained.

Accounts are just bean counters - virtual balances. When a transaction is received that spends to address X, and address X has label L in your wallet, account L is credited with this receive. If you use sendmany or sendfrom and specify a from account, that accounts' balance is decreased by the amount of value that leaves your wallet through that transaction.

Change does not exist in this high level view. It is not money that is entering or leaving your wallet, and thus cannot affect any balance.

Accounts are a confusing feature, its use cases are limited, and have several implementation problem. In many cases, people assume they behave as independent wallets, which is not the case. They may be removed in some later version.


Why does this transaction give me an error? I am trying to script automatic payments without hosting a full node (my server doesn't have enough harddrive space). To do this I'm using electrum's python interface, and I have created a transaction, but when I try to send it, I get the error message: "TX rejected", "code: -22". Looking that up here, it appears that's an error either parsing or validating the transaction. It appears the error was thrown here.

But I cannot determine why. The transaction contains 2 inputs, 2 outputs, and the outputs + fee of 0.0001 = the size of the inputs (as of now) as verified via blockchain.info. The size of the transaction is under 1kb, so the fee is as I understand .0001. I sent an earlier transaction of .0001 with a .0001 fee through the electrum UI and it went through fine. So why is this transaction failing?

The raw transaction is:

01000000029802316bd53cdef6741b40b0a75cbffdfab270b0804f32096dda42594e19d179010000008b483045022100bd8bebb8491689604203806b66dc8c785cfb2362f2af630550bcd08d8789311c0220762ed5f310a15294e4fa9a5da9c4baff19e0f7c74a37430676fa3f7af3b50bb6014104f58c3d2d51eebf504ce13e1f5d3bb6f80c3df2e60212fef826dc2ce5bbe5f833b7ef684005fc6c28f80d7f27f70333471099edd4d41f4176261ae345a4128c46ffffffffd133f259c5e4bc4213136acb2fc4dbe5234732cfbfcc6a2845b83a744ea90e000e0000008b483045022100ec66b8827e4827b63a66840b1976cfc244a5ab20a047dd0d23e33285f63d7967022030c8f4b78277747dce2b085cf84acdd990704b0568c4d6e130a2361892b58e8d014104f58c3d2d51eebf504ce13e1f5d3bb6f80c3df2e60212fef826dc2ce5bbe5f833b7ef684005fc6c28f80d7f27f70333471099edd4d41f4176261ae345a4128c46ffffffff02a00f0000000000001976a9147d7cc528123aca5b820013445abbdff7530db71488ace01f0000000000001976a914742415bbd2c023df6f47e1fb6f5dac5316dc437588ac00000000

and I uploaded the decoded version (using electrum decoderawtransaction ... or https://coinb.in/decode-raw-transaction.html - both give the same output) here

The transaction wasn't going through because of the newly implemented "dust transaction" policy that makes it so that no output of a transaction may total less than 54.3 micro-bitcoins. One of my outputs was below this threshold. So I fixed that, but then the output to the "change" address was pulled below 54.3 uBTC and it still failed. I haven't found a way to ensure electrum doesn't try to deposit less than 54.3 uBTC into the change address, so for now I'm sticking with a single, large input to avoid small amounts of change.


What happens if I spend a bitcoin that has 1 confirmation? Take these two transactions that happen one after the other:

Transactions:

1) Exchange A -> (1 confirmation) My Wallet

2) My Wallet (With a high fee) -> Exchange B (needs 20 confirmations)

Will the Exchange B wait for the 20 confirmations on transaction #1 as well, or am I able to speed the process up by sending it to my wallet and paying higher fees than the Exchange A does?

When a transaction gets its first confirmation it is included in the blockchain. Barred unusual circumstances, the block that confirms it will become part of the longest valid chain and thus the transaction ever more reliably irreversible.

If you send a transaction to an exchange that waits for 20 confirmations, the previous transaction will have at least 21 confirmations when they accept the deposit. There is nothing you need to do with the first transaction.


How to get Bitcoin historical data from Bitcoin-Core? I installed Bitcoin-Core Wallet and downloaded the whole 130gigs BlockChain. Now I'd like to read the BlockChain Data to know all bitcoin values since the beginning. Not sure how to start. I need that data for making my own graphs in Excel

How can I read data from the whole BlockChain? Thanks.

It sounds like you are asking how to build a block explorer. Basically you would activate the full transaction index by adding txindex=1 to your bitcoin.conf. Parse all the history data and dump it into a database. Then keep track of all the new transaction data on your own database as blocks come in with blocknotify or real-time with ZMQ notifications.

https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md#usage

There's also options like bitpay's bitcore that pretty much does the work for you. It does require a lot more HD space though.


How do the people who work on Bitcoin Core get paid? I'm wondering how the people who work on or manage Bitcoin Core get paid, e.g.  Wladimir J. van der Laan.

Do they do the work just... as volunteers?

The majority of Bitcoin Core developers are volunteers or started as volunteers. They worked on Bitcoin Core in their free time and contributed without anyone paying them.

Later, when a developer becomes more prominent and devotes more time to the project, they may seek out someone (a person or company) to sponsor them to continue to work on the project. Alternatively a person or company may wish to sponsor or hire an active and prominent Bitcoin Core developer so that they may contribute to Bitcoin Core's development and help to keep the software maintained and growing. Some are paid to work on Bitcoin Core full time, others to work on it part time.

Currently many of the most active contributors are either sponsored or employed to work on Bitcoin Core specifically. However many others contribute as volunteers in their free time and are not paid to work on Bitcoin Core.


Taproot, potential quantum bug, and general clarification Here seeking information. I have 2 questions marked with parens
Would like some clarification pertaining to the Mark Friedenbach article:

Why I'm Against Taproot

The point of contention with Mark seems to be with the space savings for the N-N Musig2 everyone signs/happy path, being embedded into the the root of the MAST/Taproot, thus exposing a pubkey in an output that sits on the blockchain.
(1) please correct if I'm wrong about the way I'm describing this.
I did see Pieter's presentation at Bitdevs from a while back reference, "plain pubkey security model in mind" for taproot. But, it wasn't apparent that this would hypothetically make it quantum vulnerable,.. as Mark's article says, "a naked secp256k1 pubkey on chain at the time the output is created which has absolute spend authority for the underlying bitcoins".
(2) Would love for someone to rebut or verify this claim.

See Pieter's responses.
(1) seems ok
(2) Mark's concern is real, but worry about exposing the tweaked pubkey doesn't seem to be of a high concern to people supporting Taproot. In ref to Taproot exposing pubkey, "numerous advantages (it's smaller, cheaper, and makes a number of more advanced protocols on top a lot easier)."
"TL;DR: public keys should be public."
Quotes from:
What are the potential attacks against ECDSA that would be possible if we used raw public keys as addresses?


Do you start from the LAST NONCE to find the correct HASH to solve Hash Puzzle in Bitcoin Mining? I'm reading the example of the simple proof of work algorithm from here: https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch08.html#pow_example_outputs

In that example, the nonce always starts from ZERO and incrementally going to the max_nonce:

for nonce in xrange(max_nonce):
    hash_result = hashlib.sha256(str(header)+str(nonce)).hexdigest()

    # check if this is a valid result, below the target
    if long(hash_result, 16) < target:
        print "Success with nonce %d" % nonce
        print "Hash is %s" % hash_result
        return (hash_result,nonce)

In the real world of bitcoin mining, do you always start from the LAST NONCE and incrementally go up to find the correct HASH?

Because I don't see it makes sense if you start from ZERO again to solve the next math puzzle

The for-loop you describe is for a given block only.

So yes, when mining the next block at the next block-height, the nonce can be reset to zero, because the the header hash pre-image is now a new block template (new transactions, new header, potentially new difficulty). A zero nonce will not hash to the same header hash as the previous block with the same nonce, since the rest of the pre-image has changed.

Also, note that the nonce field no longer provides sufficient range for the difficulty on mainnet, meaning the for-loop can potentially complete without ever finding a valid header hash. In this case coinbase input script data can be iterated to "expand" the nonce-range.


Can anyone shed any light on this error? Bitcore Multisig - bad-txns-in-belowout Code:

var utxo = new bitcore.Transaction.UnspentOutput({
  "txid" : "e0c6b736e86e8dccd63bbc27f35142b413bd991a410ef50f14cd56fa1a783a1e",
  "vout" : 0,
  "address" : "2NCAeo5p1Pg8VVupFFumCd3PYz551VAZWLJ",
  "scriptPubKey" : "OP_HASH160 20 0xcf8d0490cba6d7ca817323cf0c337fbd0a3de539 OP_EQUAL",
  "amount" : 10000000
});

var multiSigTx = new bitcore.Transaction()
    .from(utxo, pubKeys, 2)
    .to("mwFLeaw5LMAPvoz1hP6qQhHbHkHq8WxM2t", 90000)
    .fee(9000)
    .change("mwFLeaw5LMAPvoz1hP6qQhHbHkHq8WxM2t")
    .sign(privKeys);

var txSerialized = multiSigTx.serialize(true);
insight.broadcast(txSerialized, function(err, returnedTxId) {
  if (err) {
    console.log(err);
  } else {
    console.log("Sent coins, tx id is: ");
    console.log(returnedTxId);
  }
});

Result:

Transaction rejected by network (code -26). Reason: 16: bad-txns-in-belowout

That error happens when the transaction attempts to send more Satoshis than it spends. You might have your units mixed up (using Satoshis instead of BTC, or vice versa).

The code that throws the error can be sheen here: https://github.com/bitcoin/bitcoin/blob/v0.10.2/src/main.cpp#L1462-L1465


Mining with only 1 GPU I have a GTX Ttan and plan on getting a GTX 1060. I want to only mine with the 1060. How would I do that. Im using sgminer v5.3.1

Mining almost any crypto-currency, including Ethereum, with just one GPU is not recommended if you are wanting to actually make profit. This segment of miners are viewed as enthusiast with the goal of just contributing to the security of the network. If you do not have these goals, it is advised to avoid mining at large.

Mining requires large amounts of electricity, GPUS, and multiple rigs (aka mining farms). Most residential home-miners will generate some amounts but will never generate enough to even break even, resulting in a negative ROI (return on investment).


Can I get my BTC back from a scam site? I invested Bitcoin in a fake site that was named as mega bit chain on the 6th of December. After that, I opened the site on the 12th of December; there was written: site is in maintenance. After two days the site was gone. Can I get my Bitcoin back?

If the website does not send them back to you, there is no way of getting your Bitcoins back. You may be able to sue them, but I am no legal advice. There is no authority that can reimburse you or transfer them to the scam website back to you.


How to protect the latest block in block chain be tampered? We know for each block in block chain, it has the previous block header hash which make the block be tampered become difficult. If the block is tampered, then all blocks after this tampered block need to be tampered too.

However, how can we prevent latest block (last block in the chain) be tampered ? There is no next block follow it which means there is no header hash in next block.

Thanks in advance.

Recall that in order to be a valid block, it has to have a valid proof of work: the hash of the header has to be below the current target value (i.e. start with a sufficient number of zeros).  If you just alter something in the block (e.g. the destination of the coinbase transaction), its hash will change and almost certainly will no longer meet the proof-of-work target.  So you'll have to also find a nonce value which does result in a hash that meets the target.  This is just as much work as mining a new block from scratch and carries no particular benefit compared to regular mining.

If you succeed in doing so, then there will simply be two candidate blocks for the head of the block chain: the original one, and your new "tampered" version (whose hash will necessarily be different from that of the original one).  Miners will be free to choose either one to build their blocks on top of.  Soon, a consensus will be reached as to which one is part of the block chain and which one is an orphan.


Why are transactions not used for signalling? Currently miners can signal for certain BIP proposals. But users cannot signal, that's why they need to indirectly force miners to vote for them, using UASF's.

But why are transactions not used for signalling? For example 1 transaction = 1 vote. That would allow a very large userbase to signal directly without the miners, and seems pretty foolproof, since both censoring or creating them (just for the purpose of influencing the vote) will be very expensive to an attacker.

It feels like a much nicer solution than a UASF, so what am I overlooking here?

Such a system could be easily gamed by people who simply spam the network with transactions and by miners who choose what transactions to include in their blocks. The penalty which they incur is still very small as compared to income of major economic players.

It does not take into account the amount of coins and also does not consider the vote of people who are simply holding bitcoins.
Such a metric would only be misleading.

There was a dicussion on this and a way for wallets to implement this on bitcoin-dev mailing list under the title
[bitcoin-dev] Transaction signalling through output address hashing
https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-February/013532.html


How can Blockchain.info wallet send unconfirmed bitcoins? So i just opened a Blockchain.info wallet after years of using Bitcoin-qt.

My Blockchain.info wallet had an empty wallet, i sent some bitcoins to it and right after that without waiting for confirmations i sent some bitcoins to satoshidice just to test. To my surprise the transaction went through, how is this possible if my bitcoins didn't even have 1 confirmation?

If Blockchain.info "lends" me bitcoin, how can it do it?

No, it does not lend you bitcoins but rather it spends the very same TX outputs that you have sent there. Thus, if your transaction turns out to be surpassed by another one (double spend), then also the transaction spending its output will be considered invalid.

It's like cutting a branch on a tree: all sub-branches will go down with the root one.


Large pool of addresses means more anonymous? how? For an average end-user, if bitcoin-qt is configured with a large pool (1 billion) of Bitcoin addresses, then will it increase user / transaction anonimity?

The pool of addresses is meant for consistency among offline backups. Not for anonymity. See: https://en.bitcoin.it/wiki/Key_pool

Generating and using a new address on-the-fly vs generating thousands in advance doesn't really make any difference in terms of anonymity. Just would create a lot of overhead.  What might help more is using a new address for each new transaction. Maybe.


Private key generation method How was bitcoin private/public key created in 2009, I observed in the blockchain some bitcoin transaction took place early 2009 Feb - April.
In the original bitcoin core in github the first bitcoin core was released September 2009.
My confusion how were the users able to generate the address ?

Prior to BIP32, most wallets simply generated keys from random data provided by the operating system (or some other entropy source).

A handful of wallets implemented a brainwallet system, in which keys were derived from some kind of password, but they quickly fell out of use after it was discovered that most people selected easily guessable passwords which resulted in excessive loss of funds to theft.


P2SH to LTC address with M Are there anyone know how to convert P2SH address (like 34A5PyCvPJKYtHmj9jmKhGzBBwpGuAkZog) to MANDhrctLRAygo3dFckfWvEaWeQizSwWNK?

I tried to decode with Base58Check, then removed 05 and added  032, then encode it (Base58Check), however I got wrong result MANDhrctLRAygo3dFckfWvEaWeQiti143C

The reason you are getting a different address is because you are appending the same checksum that you got from using the 03 prefix to the new prefix + payload. You need to double hash the new prefix + payload and then append the first four bytes and then encode it in base58.

If I decode your result MANDhrctLRAygo3dFckfWvEaWeQiti143C to hexadecimal, I get 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5020cb31b. In this hexadecimal string, your prefix is 32, payload is 1b0e61ac671bde7fb52e2f3d6e2dc213609d9de5, and checksum is 020cb31b.

The checksum that you would get after double hashing the new prefix + payload is e29f4248. So, you should base58 encode 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5e29f4248


Prioritize transaction with low fee [regtest] Tx1:
send '{"bcrt1qgz8qhrqyglh7zu3alssydsfa7wk2auucftfnv3": 0.2}' null "unset" 1.1

{
  "txid": "d040ebe603f80bdf1a92877efeb2b4a27c32766202aeecf3a969b665a0d4c6d8",
  "complete": true
}

Bump fee:
bumpfee d040ebe603f80bdf1a92877efeb2b4a27c32766202aeecf3a969b665a0d4c6d8

Tx2:
{
  "txid": "14f13ad9e757752fce52be3f60a08ff697db646863e68f43e76bd1e70eb4504f",
  "origfee": 0.00000228,
  "fee": 0.00001268,
  "errors": [
  ]
}

Prioritize Tx1:
prioritisetransaction "d040ebe603f80bdf1a92877efeb2b4a27c32766202aeecf3a969b665a0d4c6d8" 0.0 2536

true

Mine a block:
generatetoaddress 1 "bcrt1qh3v7u6qv46q26srjtjux3cg2g35qlyjf8fqgej"

[
  "7901e58c61d7e4ed0a07aaef382b5ca6c2f3ec146ed093f443c5e322d4ba3848"
]

Why does Tx2 get included in the block even though I tried to prioritize Tx1:
getblock "7901e58c61d7e4ed0a07aaef382b5ca6c2f3ec146ed093f443c5e322d4ba3848" 2

https://pastebin.com/raw/kYfTsUUG
If this is related to mempool conflicts and the way they are managed in Bitcoin Core, how can I test below scenario using regtest:

User broadcasts Tx1 which is relayed and now in the mempool of a node used by mining pools.
User replaces it using RBF with Tx2, this transaction is not yet relayed to mempool of nodes used by mining pools.
Next block is mined and Tx1 is included in the block

The issue got resolved. I had to prioritize the transaction before bumping fee, so the correct order of things mentioned in question will be:

Tx1

Prioritize Tx1

Bump fee

Tx2

Mine a block

Reason: Maybe we can't prioritize a transaction that is already replaced with a new transaction. I think prioritisetransaction should have returned some error or at least false in this case. However, I noticed it returns true for almost any transaction id. I copied a transaction id from testnet explorer and even that returns true when I use it with prioritisetransaction on regtest.


What is single member blockchain? I just heard about single member blockchains like quorum and hyperledger-fabric. So what does single member mean? Is this some kind of restriction or what?

The term single member is not correct. Hyperledger blockchains, such as Hyperledger Sawtooth or Hyperledger Fabric, are private blockchains or permissioned blockchains. You need permission to join the blockchain network. They are usually setup by consortiums (an example would be to track fisheries or other marketplace goods as it moves from harvester or producer to wholesaler to market to consumer).

Since the blockchain is permissioned, it does not usually use digital currency to function.


how does bitcoin solve the same chain replay attack? Let's say I send 10BTC to Bob. I have 30 BTC. So after transferring, I should have 20.
Now, after I transfered 10, transaction can be copied and broadcasted to the network again by Bob(he might have somehow get it from pool or something). Which means that replay attack has just taken place on the same chain(I know that replay attacks happen mostly when there's a hard fork, but in this case, I am talking about the same chain replay attacks).
Ethereum solves it by having nonce field in each account.
Question 1) How does bitcoin solve this case without SegWit ?
Question 2) how does bitcoin solve this case with SegWit ?
Question 3) If the replay attack happens for hard fork case, did bitcoin implement the solution or not ? I know that it was BTC cash that created a solution and btc said they wouldn't do it, but i am curious what's the state on this now ?

In all cases what you are describing is a double-spend. Bitcoin uses a UTXO model (not an account based model) which means that there is a set of coins also known as the UTXO set or Unspent Transaction Output set.
Transactions destroy coins and create new coins.
A new transaction attempting to spend a coin that has been destroyed is simply invalid.
Your concept of you and Bob "having x BTC" as a balance is incorrect for Bitcoin. What you have is a set of coins (a subset of the network-wide UTXO set) that you can destroy with a transaction by solving an output script. When you send 10 BTC to Bob what's really happening is you are taking one of your coins (lets say a coin with a 20 BTC value) and destroying it. Your transaction replaces it with two new coins, both for 10 BTC -- one secured by Bob's public key and the other secured by your own public key (this is your "change").
Once that transaction is confirmed the original 20 BTC coin no longer exists. Sending the same transaction a second time would be invalid because it attempts to destroy coins that don't exist.


Are Micropayment channels still subject to malleability after BIP65? After BIP 65, are simple, unidirectional, MPC still subject to transaction malleability?

More specifically:

Is the payee at risk because of malleability? If yes, how? (as far as I understood, the payee is not at risk anymore)

Is the payor at risk because of malleability? If yes, how?  (as far as I understood, the payee is still at risk)

There are a variety of different ways to construct a micropayment channel, but there are two designs that I think are particularly relevant to your question about "simple, one-directional, micropayment channels":

Spillman-style micropayment channels: this was a commonly-described micropayment channel design prior to BIP65 (OP_CHECKLOCKTIMEVERIFY, CLTV).  Spillman-style channels were first described by Jeremy Spillman in April 2013 and implemented in the BitcoinJ library in 2013.
CLTV-style micropayment channels: this is a new way to construct a payment channel that became possible when CLTV became enforced in mid-December 2015.  CLTV-style channels were described by BIP65 author Peter Todd as part of that BIP and implemented in two1-python in February 2016.

The following two sections describe how malleability relates to those two different types of micropayment channels.

Malleability in Spillman-style micropayment channels

BIP65 does not change how malleability affects Spillman-style micropayment channels, so the following description was true before BIP65 became enforced as well as now (at least for transactions which do not use segwit).

A Spillman-style micropayment channel is constructed using the following sequence of events between the Merchant (who is receiving the funds) and the Customer (who is spending the funds):

The Merchant gives his public key to the customer.
The Customer uses his public key and the Merchant's public key to construct a multisig P2SH address[1] that will require signatures from both the Merchant and the Customer to spend any funds paid to that address.
The Customer generates (but does not transmit) a transaction that pays the multisig P2SH address.
The Customer generates a second transaction that spends the first transaction back to one of the Customer's addresses, gives this transaction a locktime (so it can't be added to the blockchain until a certain time), and signs this transaction.
The Customer gives this second transaction to the Merchant (without giving him the first transaction), and the Merchant signs it and returns the signed transaction to the Customer.
Now the Customer will be able to use this second transaction, called the refund transaction, to claim a refund if the Merchant doesn't do anything by the time the locktime is reached.
With a backup refund assured, the Customer broadcasts the first transaction (called the deposit transaction) so it gets added to the blockchain.
Now the Customer can sign alternatives (called payment transactions) to the refund transaction which have no locktime, and so can be added to the blockchain immediately except for the fact that they also require the merchant's signature.  By giving those to the Merchant, who can co-sign them (without returning them to the Customer), the Merchant can be assured that he can add them to the blockchain at a point earlier than when the refund transaction becomes valid.

The problem with malleability occurs in the seventh step above, when the deposit transaction is broadcast.  If the transaction that gets added to the blockchain isn't byte-for-byte identical to the refund transaction which the Merchant signed in the fifth step, then the refund transaction is no longer valid because it attempts to spend a transaction with at different txid than the deposit transaction.

The Merchant can still voluntarily work with the Customer to return the Customer's money, but this means we don't have the trustless-style micropayment channels that we want.

A note on segregated witness (segwit): because segwit eliminates the type of malleability which would allow someone to change the txid of the deposit transaction without the Customer's permission, transactions that use segwit can safely use Spillman-style micropayment channels without risk of malleability-caused problems.  As of this writing, segwit is not implemented on mainnet, but I expect it will be sooner or later, so I'm describing this here for future readers of this answer.  Note that segwit is an optional feature that the Customer would already have to be using in order to eliminate malleability in this case, so activation of segwit by itself does not automatically eliminate malleability in Spillman-style channels.

[1] Bare multisig (multisig without a P2SH address) may also be used.

Malleability in CLTV-style micropayment channels

A CLTV-style micropayment channel is constructed using the following sequence of events between the Merchant and the Customer.  These steps will be identical both before and after segwit is activated.

The Merchant gives his public key to the Customer.
The Customer uses his public key and the Merchant's public key to construct a P2SH address that will require either of the following sets of conditions to be satisfied:

Both the Merchant and Customer sign any transaction that spends from this P2SH address.
Just the Customer signs any transaction that spends from this P2SH---but those spending transactions must have a locktime greater than the refund time.

The Customer generates and immediately broadcasts the deposit transaction.  The Customer is assured their ability to generate a refund transaction on demand by Condition 2.2 above.
Now the Customer can use Condition 2.1 above to half-sign (sign 1-of-2 required signatures) payment transactions that pay the Merchant.  The Merchant can generate the second signature (without providing it to the Customer) and be assured that he can broadcast the final payment transaction before the Customer can add a refund transaction to the blockchain that was generated under the terms of Condition 2.2.

This process eliminates the concerns with malleability in CLTV-style micropayment channels, although it does not eliminate the malleability itself.  Because the Customer can generate the refund transaction at any time per Condition 2.2 above, he doesn't need to pre-commit to a particular txid; he can wait until the deposit transaction has been added to the blockchain and its txid made nearly immutable before generating the refund transaction.

If, despite waiting for multiple confirmations, malleability happens anyway, the Customer can always generate and sign a new refund transaction using his private key.  That's because all that is necessary, according to Condition 2.2 in the P2SH address, is a signature from the authorized key plus a locktime past a certain date.

The Merchant can be affected by malleability if the deposit transaction txid changes after he has accepted any payments.  For this reason, it is best for the Merchant to wait for the deposit transaction to receive at least one confirmation before the Merchant accepts any payment transactions (waiting for more confirmations will provide more security and is recommended for high values).  Since the Merchant should be waiting for the deposit transaction to receive confirmation any way in order to prevent the Customer from double-spending it (which is also the case in Spillman-style channels), this source of malleability doesn't significantly affect the security model.

Conclusion

BIP65 did not fix malleability for older Spillman-style channels, but it did make possible CLTV-style payment channels that are not adversely affected by transaction malleability.  Segwit will also fix malleability for Spillman-style channels when all inputs in the deposit transaction are spending from segwit outputs.


What is the point of Bitcoins if every transaction has a fee? You can't use them without it costing you money! I am asking because I want to give some of my bitcoins to a friend. It is a gift not a transaction.
I don't think it can be useful as a currency if it costs so much to use.
Please can someone explain this simple point. I am not familiar with any of the intricacies or concepts of Bitcoin and am just looking at its possibility of use as an actual useful currency.

The fees are supposed to be low. The last year, the transactions-per-second rate increased more than the system could handle. A few months ago, "SegWit", a technical advancement was activated. Currently people can use SegWit addresses and pay less fees, (so use a SegWit compatible wallet if you want to pay less fees!), however it's only a temporary solution. We'll have "side-chains" and other Layer-2 technology in a few months (Search for "Lightning Network") (up to a year) which will make fees drop forever.

TL;DR: The fees are temporarily high. Keep on eye on Bitcoin news.


Transactions with a wait time (using nLockTime) I'd like to know if there are transactions that can only take place at some predefined moment. In principle, it should be possible to use the parameter nLockTime to wait for a particular block number:

https://en.bitcoin.it/wiki/Protocol_specification#tx

This could be useful in certain contracts, but replacement is not as yet supported:

Why isn't transaction replacement supported?

In any case, it seems you still can, in principle, create a simple, unreplaceable transaction with a wait time.

Is there any example of such a transaction in the blockchain? If not, would it be accepted by the standard client or would it be necessary to convince one miner to include it in one of his/her blocks.

UPDATE: Opened a discussion in https://bitcointalk.org/index.php?topic=131443.0 to delve further.

Solved. You can prepare transactions with a wait time and the standard client will accept them.

You can check some details in:
https://bitcointalk.org/index.php?topic=131443.0

Essentially, I have been able to create a raw transaction https://en.bitcoin.it/wiki/Raw_Transactions using bitcoind. Then, before signing, I could manually replace the bytes for the sequence number and the locktime. I had some hard time with locktime. First you set the UNIX timestamp you want, then convert to hex, reverse the bytes (little endian) and replace the the last bytes of the hex transaction. https://en.bitcoin.it/wiki/Protocol_specification#tx tells you which are the relevant bytes. You can later sign the new transaction and send it.

I've been using the guide in:
https://people.xiph.org/~greg/signdemo.txt

I did all in the testnet. In my first attempts I wasn't careful with my change and ended up spending all my wallet in fees. You should be careful if you try this with real bitcoins.


How Do I Redeem Bitcoin for USD Currency? What is the step by step process to redeem Bitcoin into USD Currency & what other options do I have?

Is there a so called prepaid credit card I could redeem it for/into so I can use the cash for purchases, goods, services?

As we know bitcoin as an independent currency is traded in open markets (virtual or physical ones). So, you can sell/buy bitcoins for USD or any other cryptocurrency, fiat currency or even goods and services directly. For example, you can use localbitcoins.com to trade your bitcoins with people who are willing to pay cash for it. Another example is to use Bitpay Card (bitpay.com) allows you to accept bitcoin, store and spend bitcoin securely, or turn bitcoin into USD with the BitPay Card. There are many more.

More importantly, bitcoin is a currency that can be used for purchases directly without the need to convert it into Cash. For example, you can use it to buy goods from overstock.com, purse.io, amazon gift cards, etc ...

I hope that helps.


Why isn’t connecting to your own local node a common feature for Bitcoin clients? I come from the Monero community and connecting to my own local node running on my home PC is very simple whether it’s on the GUI, CLI or a mobile wallet.

Why does Bitcoin not have the ability to do this easily? Current using the electrum live server as a workaround but can’t help but feel this could be easier.

This is not an issue related to Bitcoin itself. Rather this is due to the protocols that clients use to communicate and the specific client implementations.

Electrum has defined their own protocol independent of commonly used node software. In order to serve Electrum clients, Electrum servers (nodes with software that can speak the Electrum protocol) have to also maintain more data than just nodes do which requires more computation and storage. Because this information is not readily available to all nodes, Electrum clients can only connect to these special Electrum servers.

You can operate an Electrum server yourself, it is just another piece of software to run. However only people who really know what they're doing and have the hardware necessary to run an Electrum server do so. By running your own Electrum server, you can configure your Electrum client to connect to your own Electrum server (and thus your own node).

The other commonly used protocol is BIP 37. Many clients that use the BIP 37 protocol actually do allow you to connect to your own node. However they typically also connect to many other nodes as well. BIP 37 has various issues and is being phased out in favor of BIP 157/158 Client Side Filtering.

Both BIP 37 and BIP 157/158 allow for clients to configure and connect to users' own nodes. It is just up to the specific clients themselves to allow users to configure this.


Exchange-based vs over-the-counter (OTC) I read an article about China ban on exchange, which mentions that

  ... the ban on exchange-based cryptocurrency trades will not extend to over-the-counter (OTC) transactions.

I am confused over the terms exchange-based and OTC. What are the differences between these two?

Exchange-based transactions, ;

  Exchanges bring together brokers and dealers who buy and sell these objects. These various financial instruments can typically be sold either through the exchange, typically with the benefit of a clearinghouse to cover defaults, or over-the-counter (OTC), where there is typically less protection against counter-party risk from clearinghouses,

  This is the case if you for example buy altcoins on Bittrex.com, Or poloniex.com All these transactions Are ""Exchange-based".

This means in the case of cryptocurrencies, that it is done through a third party, and you don't know the seller of the currency.

OTC transactions :

  Over-the-counter (OTC) or off-exchange trading is done directly between two parties, without the supervision of an exchange. It is contrasted with exchange trading, which occurs via exchanges.


Sorry newbie, I dont get the PoS block creation, to much contradiction I am sorry for the repeat question but I cant find a clear answer. Most of the time PoS isnt explained in detail (only explaining the advantage) and a lot of sources contradict each other and now I am confused.

I think I get PoW but I dont get PoS:

1) there seems to be two types of PoS. One where everyone bets on the most likely block to be picked and another where one node is chosen to validates the block based on the amount of coins you hold and some other factors... is that right? In the first case who decides which block to pick?

2) In both cases it was mentioned, that there was no need for miners. So if you only bet or validate, who creates the block in the first place or is creating the hashes? Or does PoS not use hashes anymore? If yes how do they validate with the ledges of the other nodes?

3) If PoS uses hashes and taken there is no competition of who completes the hash first, isnt there a risk that the chosen one cant compute the hash in time because of e.g. insufficient ressources?

4) Isnt the security less then PoW? As far as I see it, if the function only chooses one node isnt it in theory possible to alter the blockchain? Hashes arent bond by mining power anymore and the current node is the sole active one...

POS distributes valid block rewards proportionally to stakers. However, majority stakers cannot be unseated if they do not wish to trade their stake. A 51% staker can control/censor the system indefinitely.

POW always allows for new hashrate to come online. If fees increase, new mining will join, thereby diluting a potential 51% miner. Because external hashrate can always be added, the Power of any miner can always be balanced That is not the case with POS.


Missing transaction in newly installed Bither wallet On bitcoin.org I learned about the Bither wallet.
I installed it, created an HD account, and replenished the wallet sending to the address 19QpMgv2N2hSJNq6Nrkg1rzJ1Fc9s2Pjbf. As can be seen, the transaction is completed according to blockchain.com, but my wallet is still empty after five days!
The address is correct and I already checked it many times.
I know that my money is there, because it can be checked in the Blockchain system.

How do I withdraw my money from this wallet?
It looks like a scam!
Since https://bitcoin.org advertises this wallet, then they also participate in this.

Updated 2020-04-29

  It turns out to be an issue in TLS version of the windows desktop version. We've released a new version of Bither Desktop to resolve this. Head over to bither.net to download the latest version and it will be all fixed.

I'm the developer of Bither. Sorry for the late response.

No need to worry about your money and Bither is not a scam. Bitcoin.org has a restricted review process to list wallets on it. We can never get access to your private keys, thus your bitcoins are safe in Bither.

Bither is a decentralized SPV wallet. It needs to connect to other bitcoin nodes and sync block data to get all your transaction history. But in some network conditions it would be too hard to connect to any nodes. Bither relies on background processing to help you keep up with the blockchain tip. But mobile devices often have limit on background running time.

In your case, I think you are not syncing to the latest blockchain data. Though I'm not sure what caused this, but there is an easy way to fix it.

Update to the latest version, open Bither, swap to the right page, click Advanced Options -> Reload Transaction Data. This will download all your transaction history from 3rd party block explorers. And then you should be able to see your bitcoins. Like @Murch mentioned earlier, you can use Network Monitor to see if you are catching up with the blockchain tip and what's going on.

If you have any further questions, feel free to contact our support crew listed on the website. support@bither.net.


Why does Electrum include seemingly unnecessary inputs in a transaction? I want to make a payment of x BTC.
My Electrum wallet shows two "output points" in the Coins tab (with the same address). Both of these show an amount much larger than x BTC.
If go to the Send tab and start to make a payment to an address, then click "Pay..." and then "Advanced", I can see two inputs, which seem to correspond to the two "output points" in the Coins tab and show the same amounts. The transaction size is 447 bytes. I abandon this transaction.
If I go to the Coins tab, right click on one of the two "output points" and choose "Spend", Electrum shows a green banner saying "Coin control active". If I start to make the same payment, the "Advanced" dialog now only shows one input and the transaction size is 226 bytes.
This looks to me as though I can make the same transaction and incur a smaller fee by using "coin control". Am I missing something? Is there a disadvantage or risk to doing this? I'm thinking there must be, otherwise Electrum would just do it automatically.
I could understand needing two inputs to the transaction if x was more than the amount associated with each one of my two "output points", but it isn't.
Thanks!

Electrum used both UTXO, even if only one was needed, to protect your privacy albeit at the expense of higher fee.
This is from the Electrum source code and explain this choice:
Attempts to better preserve user privacy.
First, if any coin is spent from a user address, all coins are.
Compared to spending from other addresses to make up an amount, this reduces
information leakage about sender holdings.  It also helps to
reduce blockchain UTXO bloat, and reduce future privacy loss that
would come from reusing that address' remaining UTXOs.
Second, it penalizes change that is quite different to the sent amount.
Third, it penalizes change that is too big.

This looks to me as though I can make the same transaction and incur a
smaller fee by using "coin control". Am I missing something?

No, you are right, if you wish focus more on fee minimization instead of privacy, you can achieve better result doing so manually than rely on the Electrum coin control policy.

Is there a disadvantage or risk to doing this? I'm thinking there must
be, otherwise Electrum would just do it automatically

There are multiple goal you may want achieve with a coin selection strategy and there is no one strategy that solves all problems, so wallets adopt different strategies depending on their priorities; but these strategy are meant for unskilled user or user that don't care these things (eg. the Coins tab is hidden by default on Electrum)... If you know how bitcoin transactions works and what UTXO are, probably you prefer do your own coin selection manually based on the needs of a specific transaction.


Is it possible to change private key I would like to know if it's possible to change private key of bitcoin wallet via rpc call to bitcoind.

Thank you for your answers

No, your public key are generated from your private key it cannot be changed.

Private key have one public key and each public key have one adress


Are coinbase.com purchases effectively bitcoin futures? I just purchased 0.1 BTC from coinbase with a bank transfer. Coinbase informed me that the transaction would take 4 business days to complete.

So I don't have any bitcoins yet, but Coinbase promises to deliver 0.1 BTC to me in 4 days.

Coinbase probably didn't purchase the bitcoin now because my payment hasn't cleared, but if they make the purchase in 4 business days from now and the price has gone up from $330 to $500, how will Coinbase cover the difference when the coins need to be purchased?

Or does Coinbase just regularly purchase bitcoin and then just transfer some into my account when my funds clear? Or do they not actually give me the bitcoin until I decide to sell it?

One they credit your account you can transfer your bitcoin out to another wallet, you do not have to sell it through them, but you could at a later time if you wanted to.

Unfortunately Coinbase is also known to just cancel an order if the price sharply rises between you placing it and them delivering the bitcoin, your US dollars are then returned to your bank.


Icarus Detect Failed I have been running raspberry PI with 4 Erupter modules connected to Pi Hub for 5 days with no problems. Yesterday I checked the modules and the idle lights were on and there was no mining. I restarted my raspberry, and now I am getting this error:

 [2014-04-10 20:23:13] Icarus Detect: Test failed at /dev/ttyUSB0: get 00000000,
 should: 000187a2
 [2014-04-10 20:23:13] Icarus Detect: Test failed at /dev/ttyUSB1: get 00000000,
 should: 000187a2
 [2014-04-10 20:23:14] Icarus Detect: Test failed at /dev/ttyUSB3: get 00000000,
 should: 000187a2

I am running the following command:

sudo ./cgminer-3.1.1/cgminer --config /home/pi/cgminer.conf -S /dev/ttyUSB0 -S /dev/ttyUSB1 -S /dev/ttyUSB2 -S /dev/ttyUSB3

If I connect and run the modules one by one there are no issues. When there are 3-4 I get errors. Those errors change each time I run it, so sometimes its 1 failing other times 2 etc. Also, I am getting this error:

[2014-04-10 20:33:04] Most likely you have input the wrong URL, forgotten to ad
d a port, or have not set up workers

Again, there have not been any changes to the configuration (that I am aware of). Any suggestions as to what might be causing this/ how to fix it?

Update

cgminer.conf

"pools" : [
        {
                "url" : "http://api.bitcoin.cz:8332",
                "user" : "worker",
                "pass" : "pass"
        }
]
,
    "api-listen" : true,
    "api-port" : "4028",
    "expiry" : "120",
    "failover-only" : true,
    "log" : "5",
    "no-pool-disable" : true,
    "queue" : "2",
    "scan-time" : "60",
    "worktime" : true,
    "shares" : "0",
    "kernel-path" : "/usr/local/bin",
    "api-allow" : "0/0",
    "icarus-options" : "115200:1:1",
    "icarus-timing" : "3.0=100"
}

Erupters run from powered hub, and rpi is also running from wall charger.

This sounds like a power problem to your erupters most likely. Can you show me the config file or the options you are enabling? In particular, the -scan option.

Further, you might verify you have a powered USB hub and try using a powered USB port if available; it only takes a little power to run them, but a little power to stop them. I also power my rasp pi through a wall charger also, rather than powering it from the usb hub.

I have had much more success running BFGMiner with Erupters and Antminer U1 USB sticks with a Pi and usb hub to control (and using Minepeon on the rasp pi). The command to start BFGMiner and scan for erupters etc and create a log in case you do have problems is:

bfgminer –o [pool] –u [user] –p [password] –scan-serial erupter:all –icarus-options 115200:1:1 –icarus-timing 3.0=100 2>logfile.txt


How do you import an xPub from a Ledger Nano to a watch only Bitcoin Core I am having trouble figuring out how to import my xPub from my Ledger Nano to a watch only Full node (Bitcoin Core 0.17.1) Could someone please explain how to do this? I am reading different things. Some people say its not possible on bitcoin core and others offer confusing explainations.

You can't. Bitcoin Core currently does not support importing extended public keys.