How to get sending address of MultiSig transaction? Example hash of transaction: 70c15eb4cc3890960dbe1ae0cf13eedaeaef04d8e4820398fb4e991b23528f03
BlockExplorer shows only 1st address of two. One address is sending address and second is signing address? or two addresses are signing addresses and no sending address? If is second case, how resolve sending address?

ok, this looks like a multisig activity. Quickly de-analyzing. To sign the previous transaction, this script was used:

TX_IN[0] Script Sig (uchar[])
483045022100DCD533F206756C83757BD0738905799DD0C7F505C22C567641B1B35573A9B24B02204C3773F60752EA67809AA32EB0A07C0F16BCFE073C99E84C8C30A328FA14874C0121031C9BFFF835236F589BA409B364A9D2C392971C053CDFBBAC9CCDD9F30EABB15B

48: OP_DATA_0x48:     push hex 48 (decimal 72) bytes as data
30: OP_SEQUENCE_0x30: type tag indicating SEQUENCE, begin sigscript
45: OP_LENGTH_0x45:   length of R + S
02: OP_INT_0x02:      type tag indicating INTEGER
21: OP_LENGTH_0x21:   this is SIG R
    00DCD533F206756C:83757BD073890579
    9DD0C7F505C22C56:7641B1B35573A9B2
    4B
02: OP_INT_0x02:      type tag indicating INTEGER
20: OP_LENGTH_0x20:   this is SIG S
    4C3773F60752EA67:809AA32EB0A07C0F
    16BCFE073C99E84C:8C30A328FA14874C
01: OP_SIGHASHALL:    this terminates the ECDSA signature (ASN1-DER structure)
#########################################################
### procedure to strictly check DER-encoded signature ###
#########################################################
Minimum and maximum size constraints                        - ok
scriptsig always starts with 0x30                           - ok
length 138 chars is less than actual sig length (142 chars) - ok
       (hex 0x45, decimal 69, 138 chars)
length of R coordinate (66) >= 0                            - ok
length of S coordinate (64) >= 0                            - ok
S-Value is within scriptsig boundaries                      - ok
Make sure the R & S length covers the entire signature      - ok
S-value must be smaller than N/2                            - ok
strictly check DER-encoded signature                        - ok
#########################################################
21: OP_DATA_0x21:     type tag indicating LENGTH
03: OP_INT_0x03
    1C9BFFF835236F58:9BA409B364A9D2C3
    92971C053CDFBBAC:9CCDD9F30EABB15B

This terminates the Public Key (X9.63 COMPRESSED form), and the corresponding bitcoin address seems to be:    19r8BDjwdmMUYecGX73CAnRCwHoynaeSXi
This address starts with a "1", so no multisig address...

and

TX_OUT COUNT, hex=01, decimal=1
TX_OUT[0]
 TX_OUT[0] Value: hex=404B4C0000000000, --> bitcoin=0.05000000
 TX_OUT[0] PK_Script Length hex=47, dec=71
 TX_OUT[0] pk_script (uchar[])
  51210351EFB6E91A31221652105D032A2508275F374CEA63939AD72F1B1E02F477DA7821004F0331742BBC917BA2056A3B8A857EA47EC088DD10475EA311302112C9D24A7152AE
    51: OP_1, OP_TRUE
    21: OP_Data21 (= decimal 33)
        0351EFB6E91A3122:1652105D032A2508
        275F374CEA63939A:D72F1B1E02F477DA
        78
        bitcoin address:   1NdB761LmTmrJixxp93nz7pEiCx5cKPW44
    21: OP_Data21 (= decimal 33)
        004F0331742BBC91:7BA2056A3B8A857E
        A47EC088DD10475E:A311302112C9D24A
        71
    52: OP_Data52 (= decimal 82)
    AE: OP_CHECKMULTISIG

This is normally the redeem script Hex codes:

It is supposed to be a 1 out of 2 multisig tx, and usually you would ripemd160(sha256()) this, and get a "type 3" bitcoin address.
However: the second part after OP_DATA21 does not start with "02" or "03", instead with "004f..." - so no "real address".
Why the blockchin.info doesn't show correctly is due to the fact, that indeed the redeemscript hash is expected.

Looks like a manually assembled tx, with the redeemscript hex codes, instead of it's ripemd(sha256()) hash.

Follow up question: as it is in the blockchain, it has been a valid tx, then where are the funds? :-) I tried to hexdump it, but doesn' make sense... burnt?


How to get compressed public key with ECKey Here some java code. What i need to change to get compressed public address in getPublicAddress?

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.params.MainNetParams;
import org.spongycastle.crypto.digests.RIPEMD160Digest;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class DigestUtil {

    public static byte[] RIPEMD160(byte[] input) {
        RIPEMD160Digest d = new RIPEMD160Digest();

        d.update(input, 0, input.length);

        byte[] o = new byte[d.getDigestSize()];

        d.doFinal(o, 0);

        return o;
    }

    public static byte[] SHA256(byte[] input) {
        byte[] hash = null;

        try {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            md.update(input);
            hash = md.digest();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }

        return hash;
    }

    public static ECKey createAddress(byte[] secret) {
        byte[] hash = SHA256(secret);

        ECKey key = new ECKey(hash, null);

        return key;
    }

    public static String getPublicAddress(String input) {
        ECKey address = createAddress(input.getBytes());

        byte[] hash160 = RIPEMD160(SHA256(address.getPubKey()));

        Address addr = new Address(MainNetParams.get(), hash160);

        return addr.toString();
    }

}

Address address = new Address(params, dk.decompress().getPubKeyHash());

where dk is the DeterministicKey

or

key.decompress().getPubKey();

where key is the ECKey


Who would benefit from Taproot deployment? In the discussion of activation parameters for Taproot, a Bitcoin Core contributor stated that "Taproot would only benefit 5% of the users" citing that it would especially benefit complex scripts. I've seen that statement immediately picked up to ridicule Bitcoin development as only being for the benefit of Blockstream.
I thought that Taproot would be beneficial to most users. Is it accurate to say that it will only benefit 5% of the users?

Taproot benefits everyone who uses it, but it has the most benefit to those who use complex scripts and multisigs. Since that group is a small portion of users of Bitcoin, that may be why some people are saying it is useful only to that small part of the population. However I would not characterize such statements as meaning Taproot is not useful to anyone else, nor interpret those statements as meaning Taproot is detrimental to anyone else.
The vast majority of users use single key addresses. These are the typical P2PKH and P2WPKH addresses. At this point, we are almost as simple as it gets for single key things - provide a signature and a pubkey and that's it. While Taproot brings improvements to single key things in the form of Schnorr signatures and a pay to pubkey scheme, the vast majority of users are not going to experience a whole lot of difference between P2WPKH and P2TR. The user experience is going to be almost the same - you click on a button to get a new address, people send money to that address, and then you can click on another button to send Bitcoin elsewhere. The only tangible difference is that it will be slightly cheaper to spend P2TR outputs and slightly more expensive to send to P2TR outputs. Even then, the difference is not that big so many users may not even notice it.
However for users who make multisigs or complex scripts, Taproot is a huge boon. All those multisigs and complex scripts can be really compressed down when spending. Instead of having to put large scripts into the blockchain, in the typical "everyone agrees" case, spending a Taproot output will make the transaction way smaller which really saves on fees. It is a significant improvement to those workflows because much less money is spent on transaction fees. There is also the added benefit that such transactions look just like single key transactions which is good for privacy. For those who have very large multisigs or very large scripts, the difference in fees will be noticed.
Even when it comes to using Taproot script paths, only the used parts are revealed in the transaction. This both reduces the transaction size and increases privacy by not revealing unused script paths. This is also a huge improvement.
Thus Taproot provides most of its benefits to users who make multisigs or complex scripts. This is a small part of the users of Bitcoin. It is not incorrect that Taproot is directed towards improving the experience of scripts and multisig. And since not many people use scripts and multisig, it is not incorrect to say that Taproot only affects a small part of the population.
However this does not mean that we shouldn't want Taproot. This doesn't mean that Taproot is bad. And people who state these things are not necessarily being misleading, lying, or don't want Taproot. They are stating what Taproot is going to be used for and the people that it provides the most benefit to.
In the context of the discussions I believe you are referring to, the argument is not that we shouldn't get Taproot, but rather that it isn't so important that we need to have it ASAP. Taproot provides a benefit to all of the people who will use it, but for most users, this benefit is not significant. We don't need it right now so there is no need to have so much urgency in trying to get Taproot. We want Taproot and it would be nice to have it now, but we shouldn't let the feeling of "I want it now" to get in the way of developing a safe way to activate it that can also be used in future soft forks.


Is the index db downloaded from peers or generated locally? When the user start the Bitcoin client for the first time, it will download the whole blockchain.
But what about the block index (blkindex.dat in older versions) ?
Is it downloaded from peers just like the blockchain or generated locally from the downloaded blockchain?
Then, does it depend upon the implementation (or version) or will the answer be the same for Bitcoin, Litecoin, or other random fork?
The version I talk about is an old fork that is still using blkindex.dat.

The only data exchanged over the Bitcoin peer-to-peer network are the raw blocks and transactions.  Everything else has to be generated locally from that data.

Litecoin and other forks work the same, as far as I know.

Of course, there could be some client implementations that get other data from other sources (not via the main peer-to-peer network), such as a dedicated server provided by the vendor.  Bread Wallet has an example of this.  But the Bitcoin Core reference client does not do that.


What is the main difference between " enterprise" blockchain and regular blockchain? We have some blockchain-based cryptocurrencies such as Bitcoin or Ethereum. On the other hand,  we have some blockchain-based frameworks such as hyperledger and R3 that are designed for businesses.

Question: What is an enterprise blockchain?

Is it right those permissioned (and/or private) frameworks (e.g. hyperledger and  R3) are considered as enterprise blockchain?

The line between a blockchain and a distributed database (or ledger) is currently blurred (some would say deliberately so given the hype surrounding "blockchains" at the moment). R3 have recently concluded that it does not make sense to use a blockchain for their enterprise use case as financial institutions do not want to publish data on all their transactions to all nodes on the network. Therefore signed messages are exchanged bilaterally on R3's Corda. I am not an expert on Hyperledger but I think it is focusing predominantly on private or permissioned blockchains. These have a chain of blocks (that each contain a number of transactions) but access (ability to transact and verify transactions) is restricted to a finite number of participants. My personal opinion is that if there are transactions being batched into blocks, cryptographically attached to previous blocks and verified by all (or a subset of) nodes on a network then it should be considered a blockchain. Bitcoin and Ethereum are public blockchains. There are no restrictions in terms of those who can transact on it, view it or verify it.


What should I do about the March 12th 2013 blockchain fork? Reddit/r/bitcoin is flooding with news that the Bitcoin blockchain has forked, in that versions 0.7 and 0.8 are accepting different blockchains. What does this mean for the users?

Gavin Andreson has tweeted this:
https://twitter.com/gavinandresen/status/311290936527298561

The bitcointalk post linked by Gavin is a post by Peter Wuille, which says this:

Hello everyone,

there is an emergency right now: the block chain has split between 0.7+earlier and 0.8 nodes. I'll explain the reasons in a minute, but this is what you need to know now:

After a discussion on #bitcoin-dev, it seems trying to get everyone on the old chain again is the least risky solution.
If you're a miner, please do not mine on 0.8 code. Stop, or switch back to 0.7. BTCGuild is switching to 0.7, so the old chain will get a majority hash rate soon.
If you're a merchant: please stop processing transactions until the chains converge.
If you're on 0.7 or older, the client will likely tell you that you need to upgrade. Do not follow this advise - the warning should go away as soon as the old chain catches up.
If you are not a merchant or a miner, don't worry.

An announcement has also been made at bitcoin.org.


Receiving donations by public Bitcoin wallet ID, where to make transparent deposits? We are a transparent NGO, so we not need secret transactions, we need to expose them...

We created a Bitcoin wallet to receive donator's deposits there (at blockchain.info), and now we have an wallet ID. Can we expose our wallet ID to the public? Donators can use the wallet ID to make donations, or we must to use address?

We need a stable and permanent ID/address to expose our transparent donation reference.

No, do not expose your wallet ID. That is used for logging in to your wallet on the site and is for you only.

Instead, simply expose your bitcoin address. Making that publicly available will mean anyone can send your donations and everyone can see the transactions happening with that address. There is no security risk in exposing your bitcoin address to everyone, if you want transparency.


bitcoin address to Hash 160 public key : not consistantly reversible? When I use blockchain.info tools or bitcointoolkit.info tools

to convert an address, such as 1MCNpVGDY7BGjJyWZL5FJZiaVkQEiuxy8H
to a hash 160 public key : I get dd894dfc0f473c44cc983b5dd462bc1b393f7498

However, if i convert 3MtPk2kf61VepUfwgRjqjC5WeGgxE4rRPS
i get the SAME 160 hash address ie dd894dfc0f473c44cc983b5dd462bc1b393f7498

I am baffled by this. I thought a hash 160 should UNIQUELY convert between it and the Address and back ???

I also found other address that convert back fro hash160 to the wrong address....

thanks for any clarification.....

9a278585c51203bca9f0e5c107814ecef6f2aa12

Both of those are correct decoding, the difference is the base58check version byte.

1MCNpVGDY7BGjJyWZL5FJZiaVkQEiuxy8H has a version byte of 0x01 for P2PKH
3MtPk2kf61VepUfwgRjqjC5WeGgxE4rRPS has a version byte of 0x05 for P2SH

Due to it being a hash, only one of these is typically going to have a valid destination, either a pubkey (P2PKH) or a script (P2SH). If money has been sent to both version bytes of the same hash it is very likely that one amount has been lost.


How to calculate the bitcoin tx fees? How were the transaction fees of 0.00011689 BTC calculated?

price_per_byte is the key that effect transaction cost for user. Generally standard fees for price_per_byte = 206 satoshi per byte which is too costly and higher for user, we can reduce it upto 2 satoshi. it will cost very low.

206 satoshi per byte transaction completes in very next block or in very next transaction means immediately. while 2 satoshi per kb transaction takes upto 2 to 3 hours to complete transaction.

general transaction space will be 224 to 299 kb if user send BTC to single user amount is not the matter here, so transaction cost will be very low based how much satoshi amount user has setup for transaction.


How to convert script hash to base58 address? For example :

take a look at this  37d1d453311ea5682cdb31468826178db15fa731722a5dbb09525ea901f1c41c scripthash.

I need help converting it to base58 address.

Thank you.

Take your choice using bitcoin explorer (bx):

echo 37d1d453311ea5682cdb31468826178db15fa731722a5dbb09525ea901f1c41c | bx ec-to-public | bx sha256 | bx ripemd160 | bx base58check-encode -v 5

32BcK7C6FBCzzyB617gwTQuaLdbQufuAcc

% echo 37d1d453311ea5682cdb31468826178db15fa731722a5dbb09525ea901f1c41c | bx ec-to-public | bx bitcoin160 | bx base58check-encode -v 5

32BcK7C6FBCzzyB617gwTQuaLdbQufuAcc

% echo 37d1d453311ea5682cdb31468826178db15fa731722a5dbb09525ea901f1c41c | bx ec-to-public | bx ec-to-address -v 5

32BcK7C6FBCzzyB617gwTQuaLdbQufuAcc


Remove noisy log messages like AcceptBlockHeader is there a way to suppress outputting those kind of logs?
2019-11-07T00:32:02Z ERROR: AcceptBlockHeader: prev block not found
2019-11-07T01:02:36Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000014219120d5167a4281437fc379129d4ba6f6e956ca1db77f5fa, bad-diffbits, incorrect proof of work
2019-11-07T01:08:55Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000004bfb561102f5f04d4bab0cc70a403da70b82ce33657e10ed46b9000f, bad-diffbits, incorrect proof of work
2019-11-07T04:16:24Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000001daed8bac77bdf571441649e51732e91bec984cf97a39005a1, bad-diffbits, incorrect proof of work
2019-11-07T04:22:01Z ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader: 0fd7ab36246daf61802e10a0316cc2b0f17a1d6404bfdd53878ba34e158b4680, high-hash, proof of work failed
2019-11-07T10:12:22Z ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader: 0fd7ab36246daf61802e10a0316cc2b0f17a1d6404bfdd53878ba34e158b4680, high-hash, proof of work failed
2019-11-07T23:10:53Z ERROR: AcceptBlockHeader: prev block not found

They are kind of noisy and I would like to drop them from my log.
I saw that there was an issue opened in 2019 but it doesn't seem to have been pursued:
https://github.com/bitcoin/bitcoin/issues/17421

According to my understanding, ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader: can be excluded from log file using -debug or -debugexclude mentioned in https://github.com/bitcoin/bitcoin/pull/10123/ because it is assigned a category 'VALIDATION' in: https://github.com/bitcoin/bitcoin/blob/48c1083632687a42ac603d4f241e70616a1d3815/src/validation.cpp#L3643
Other error messages saved in logs are not assigned any category and LogPrintf is used instead of LogPrint in https://github.com/bitcoin/bitcoin/blob/48c1083632687a42ac603d4f241e70616a1d3815/src/validation.cpp#L3622


Why are compressed private keys typically longer than their uncompressed counterpart? From what I understood, compressed private keys are supposed to represent the same secret key, stored more efficiently thus taking up less space. I assume 'more efficiently' has to do with secp256k1 specifics that I'm not aware of, but I'll take that for granted.

However, when I compare a few compressed and uncompressed private keys:

# example private key
hex:
85B7DFAB8D2C695C0EBF013AD50A758FDBC62775391B7CE33282634F7DB47480
uncompressed:
5JqBEaUuYJFA4dQsd62ys13RumxCGu97BRu3LzwaVduD8MQnFwc
compressed:
L1heAvnAu97V11iNSHDjyhBiwwQcmB8nH2thMGjtqPsSXKaZ9VwY

# another example private key
hex:
6190289CEB09ED41776AE27AE81F46C6540C56CF8F3900BCAADE96B4470F23D6
uncompressed:
5JZFhabXLayCMCehpyhdCPZ5LXwvgvu3gX4Png4xYzCWYCXJ3jx
compressed:
KzVMt7HNuSw36ARRCmGJmGYa9DbRyEtiqRfyabSUCBToNRwMrAog

# yet another example private key
hex:
763B1998BF7282A99CA21EB821EB9A204589FFA189E290EE64528854FDA91080
uncompressed:
5JiMdW1Czd3tTuy33wiC5wmrkhZxx2PNcC7NVZoFc7AixTVgmf5
compressed:
L1BY471uwL7k9nnL3zUovpkzbt4Vws7kNL37s5m9TxDvBjnadvMy

# etc

I notice that the compressed version (at least the WIF/base58 representation) of a key always seems to be longer. Why's that?

Because they are not compressed private keys. They are private keys with a marker that indicates that their corresponding public should be compressed. That extra marker takes an extra byte.


How miners with less power win? As I understand, when multiple persons mine blocks, only the first one who  solves block is the winner and gets rewarded.

Basically the winner is the one (solo miner or group in pool) who has the most computing power.
That said, when the next block is being mined, again the same person will win because of his computing power.

My question is, how the other mines with less power get chance to win i.e to find the hash of the block before the most powerful miner (regardless if that is person or group) ?

That said, when the next block is being mined, again the same person will win because of his computing power.

No. Higher mining power means just higher chances to mine a block.

If there are 3 miners:

Miner A with 4 Gigahashes per second
Miner B with 6 Gigahashes per second
Miner C with 1 Gigahash per second

Together, they can hash 11.000.000.000 times per second (4+6+1 gigahashes).
The probability for the first miner to win is 4/11 = 36%, the probability for the second miner to win is 6/11 = 55%, the probability for the third miner to win is 1/11 = 9%.

If miner B hashes the block, the next block can of course also be hashed by miner A, B or C.


How do I figure out the balance of an individual address on Bitcoin for Android? I have just installed the bitcoin wallet for android on my device and created two addresses.
I transferred some BTC to one address and some to the second one.  I thought the wallet will show the individual balance associated with each of those addresses, but I was wrong.  Bitcoin wallet is now showing me one single balance for the BTC associated with these two addresses.

My question is, I assume that since I cannot send BTC out of each address for more than what it owns in the address (for example, address A - 0.5 BTC, address B - 1.5 BTC), I cannot send 1 BTC out of address A.  But now since bitcoin wallet is mixing the two together I am unable to find out how much BTC each of them own...
Or there is some other way that I am not aware of?

You are trying to use addresses for accounting, but they aren't designed for that.

What you actually want is the accounts feature of bitcoind, though I doubt any mobile wallet implements such a thing.

If you say explicitly why do you think you need to do that, someone might have an answer. Meanwhile, just use the whole balance, and create a new address for each incoming payment, without worrying about specific address balances.


What incentivizes non-miner nodes to propagate transactions? I know miners are incentivized to verify and propagate transactions for their own benefit (by hopefully publishing it on their block before other miners do). But when a transaction is initially created, e.g. from a wallet that happens to only share a single (non-miner) peer, what incentive does this node have for propagation of the transaction to the rest of the network? Especially since the majority of the network is composed of non-mining nodes, where does this implied trust that they will reliably flood to all known neighbors come from?

The incentive to propagate a transaction is so that adjacent peers cannot distinguish what transactions actually belong to the origin node.

Since all nodes by default relay all fee-paying transaction, it is not possible for a malicious actor to determine which transaction actually belongs to you as transaction that contain your inputs/outputs of interest will be masqueraded among transactions of interest to anonymous peers. This implicitly grants you more privacy since it makes it harder for a malicious observer to correlate transactions to your peer identity (e.g. ip address).


can someone explain what i did wrong here? (btc transaction with fee not confirming) https://blockchain.info/tx/c782b48bba09dea21896b7c58292abaec81d7ce2db2975f30b77176dddad492c

was the fee not high enough? i have never had an issue with fees using the recommended amount that bitcoin core suggests before but now this one, for some reason is just sitting there unconfirmed.

It looks like the fee is too low.

The fee (the difference between the input amount and output amount) is only 0.00001329 BTC - about an order of magnitude too low at the time of writing.

Most modern wallet software should propose sensible fees by default. Bitcoin Core started calculating fees dynamically in release 0.10. Could you perhaps be using an old version?

Alternatively, this service can be used to estimate required fees: https://bitcoinfees.21.co


What would be the fastest way to query for a certain txid to get its inputs? I am working in an artistic/visualization project that analyses Bitcoin transactions. I have a Bitcore instance with insight API and from a Python script I query through the REST API so the queries are returned in json format. For the project I use a macbook pro and with its internal ssd drive I get around 70 queries per second, using an external NTFS (fuse drivers) driver I get as little as 5 per second.

I would like to know if there is a faster way to query transactions by transaction's hash even if it is more complex to code.

What would be the fastest way to query for a certain txid to get its inputs?

A quick and relatively fast way (probably much faster then Bitcore) is using a recent version of Bitcoin Core and run it with -txindex and -rest.

Then use the REST interface to query for a txid.

Example:
curl localhost:18332/rest/tx/0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098.json

You can even bypass the JSON encoding/decoding if you look for faster processing by using .bin instead of .json in your request URI.

Internally, Bitcoin Core uses levelDB for the txindex which tends to be blazing fast and once the file & disk position has been loaded from the levelDB, the according block file will be opened, then the file pointer seeks to the tx-position and deserialises only the requested tx.

Also don't forget, that Bitcore uses Bitcoin Core under the hood (very likely an outdated version since Bitcore is AFAIK no longer maintained).

Using a blockexplorer (or say web API) will make you trust a third party and will pretty sure be much slower.


Is it safe to email an encrypted wallet to myself? I'd like to setup an automated process to email my encrypted wallet to myself, so that if, for instance, my house burns down, I've got easy access to a recent copy of my wallet stored off-site.

I've seen this mentioned in a couple places as a method for backing up a wallet, but none of the more thorough security guides I've read mention this as either a good or bad thing to do.

So, is this a stupidly insecure thing to do, or a reasonable means of keeping a regular automated off-site backup of a wallet?

You can trust encryption

If you encrypt anything using a strong key and a strong algorithm (e.g. GPG) then you can be sure that it will be beyond economical reach for anyone for a long time.

So, the general procedure would be

Encrypt wallet.dat with your long and complex passphrase (which you keep safe)
Attach the ciphertext output to your email
Enjoy the free offline backup service

Do not just attach wallet.dat to the email since it will reveal your transaction history and bind your public addresses directly to you thereby removing your anonymity.


Building enviornment, libraries, and compiling... What does that mean? I'm an absolute beginner and I am reading the guide on how to build an altcoin (forked from litecoin) here and I am confused on the first steps. I don't want someone else to do it, I want myself to do it. Can someone tell me how to do that using VS Community 2017?

Build environment: the environment in which the source code is compiled and built into a complete binary which you can run. This typically consists of the compiler, linker, OS you are building on, and OS you want the binaries to be built for.

Library: A library is a set of code that your or other's programs use. They are compiled just like any other program but they do not contain main functions so it cannot be run as its own executable. Libraries are used to avoid code duplication for things that can be used across multiple programs.

Compiling: The process of turning source code into an executable binary. You must compile source code in order to actually use it.

  Can someone tell me how to do that using VS Community 2017?

You really shouldn't do that. Bitcoin Core, which most altcoins' primary software (including Litecoin) are based off of, is designed for being build in a Unix environment (primarily Linux and MacOS). It is substantially more difficult to build it in a Windows environment, particularly with the tools that Microsoft provides (e.g. Visual Studio). It is instead recommended that you use the Windows Subsystem for Linux. Instructions for doing that are available here


Energy & performance comparison: GPU mining vs playing HD Video Using the built-in ATI video card on my computer, I can mine at about a 30-50 MHps rate. I'm wondering, how does this amount of work compare to normal video card operation? Or how can it be calculated? Is mining for 6 hours at this rate equivalent to watching Transformers 2 in HD over and over again on my monitor?

There's already plenty of questions about equipment wear when GPU mining, I'm looking for an easy-to-understand comparison to normal GPU taks.

Thanks

Using a GPU to mine Bitcoins would use a lot more power than watching HD video, since while the video decoder would only use the processing power it needed, a Bitcoin mine would use all of the power available to it.

I don't have any real numbers, but I think mining Bitcoins would be equivalent to, say, playing Far Cry 3 on the maximum settings, while watching HD video would be more like playing Fallout 3 on medium settings.


how to get bitcoin off an exchange? As a corollary to asking how to transfer from cold storage, how is bitcoin first put into a paper, or other wallet, when it originates on an exchange?

My primary concern is more getting the coins out of an exchange rather than into a specific type of wallet or storage.

Receiving funds in Bitcoin is an asynchronous and passive process.

A sender creates a transaction which consumes some unspent transaction outputs (UTXO) and assigns the freed-up value to newly created UTXO. A UTXO generally specifies an amount of bitcoin and some spending conditions that must be fulfilled to consume the UTXO. The most common spending condition schemas are represented with addresses.

As users of exchanges give fiat and/or cryptocurrency into custody of the exchange to gain access to the exchanges order book, the user must request a withdrawal to retrieve their funds. In the withdrawal request, the user must specify how to lock the funds which they do by providing an address from their wallet. The sending of a transaction is fully controlled by the sender: they merely sign over some of their funds to a locking script specified by the recipient in advance. The receiver's wallet does not need to sign-off, nor does it have a veto. It is therefore perfectly possible for the recipient wallet to be not connected to the internet and transcribed to a piece of paper as long as the recipient just knows how the corresponding address.


Listen on multiple RPC ports Running Ubuntu 17.10 server

bitcoin.conf contains a setting: rpcport=<port>

Is there any way to cause bitcoind (0.16) to listen on multiple RPC ports at the same time?

example: rpcport=1234,1235,1236

Currently, the wait-timeout prevents new connections to the RPC server until the old one times out. I want to avoid that by having clients use different ports.

If there is another (better) way to reduce/eliminate the wait-timeout, please advise.

Thank you.

Try and use iptables instead! Just forward the port secondary ports to the primary.

https://serverfault.com/questions/320614/how-to-forward-port-80-to-another-port-on-the-samemachine


Does merged mining require clients to download both blockchains? Suppose I want to start an AltCoin, and set it up for merged mining with Bitcoin. Will it require the AltCoin end-users to also download the Bitcoin blockchain to verify the hashes embedded in the blocks, or do only the miners need a copy of both chains?

Those running a miner against a pool don't.  The pool operator would need both.

As stated in the comments below, normal users of the alternate system will not need the bitcoin chain but will need the alternate chain, and normal users of bitcoin will need the bitcoin chain but not the alternate chain. Once the block is mined, nobody cares what other chains may have been involved.


How do I list the addesses in my keypool? I want to list all of the addresses in my wallet, even the ones that aren't being used right now. I know that I can change the number of addresses with -keypool, but I want to list all of the addresses.

Providing that you're referring to BitcoinCore, and that by "not being used right now" you mean there's no transaction associated with them yet, you can use this command to list them:

bitcoin-cli listreceivedbyaddress 0 true

The parameters are:

minconf = 0
includeempty = true


What exactly is the input for the Hash pointer in block k+1? I'm not sure how to ask this question clearly so I will ask it three different ways and hopefully someone understands me.

Is the input for the hash pointer in block k+1 just the transactions in block k or is it the transactions in block k as well as the hash of block k-1?
Does the hash pointer in block k+1 look like this : H(k) or this : H(k||H(k-1))?
In block k+1, there is a bunch of data as well as a hash pointer for the block k. But does block k+1 contain a hash of the entire block k (so, the data and H(k-1))? Because if block k+1 contained a hash of the entire block k then it should contain a hash of the hash already contained in block k right?

I hope I made some sense. Any help is appreciated.

(https://en.bitcoin.it/wiki/Protocol_documentation is a good resource for technical details about the protocol)

At the topmost level, blocks contain three things:

80 byte block header.
VarInt for the number of transactions in the block (N).
N concatenated transactions.

The block header contains:

4 byte version number
Prev block hash pointer.
Merkle hash/root of the N transactions in the block. (See What is the Merkle root?)
Block timestamp
Difficulty to solve the block encoded as an integer.
Nonce - an easy number to change to try different hash values.

I think you are asking: what is the 2nd block header parameter in block k+1?

Each hash pointer in a block to point to the previous block is SHA256(SHA256(80 byte header of block k)).

  Is the input for the hash pointer in block k+1 just the transactions in block k or is it the transactions in block k as well as the hash of block k-1?

It's just the hash of the header. The header contains a hash of the transactions, though, the merkle root.

  Does the hash pointer in block k+1 look like this : H(k) or this : H(k||H(k-1))?

Neither.

  In block k+1, there is a bunch of data as well as a hash pointer for the block k. But does block k+1 contain a hash of the entire block k (so, the data and H(k-1))? Because if block k+1 contained a hash of the entire block k then it should contain a hash of the hash already contained in block k right?

You do need the hash pointer in block k to be able to calculate the hash pointer in block k+1. Verifying the hash pointers and their difficulties is a small part of the work of miners.


How can I locate who took my money? Need help to try locate where my bitcoin went to. Was given a company wallet address to send my money to. I realise now I was scammed. Would you be able to help me locate exchange that my €5700 went to?

It is unlikely that anyone can help.

Anyone wanting to avoid being traced is likely to follow best-practise: Bitcoin addresses are only used once. transfers of money can be forwarded to other addresses owned by the scammer and can be forwarded through bitcoin mixers which make it pretty much impossible to follow where the money went.

You can type the address into a blockchain explorer but this doesn't help identify the person who controls that address.

As you know, Bitcoin is intended to be fairly anonymous. Just as it can be very hard to find out the names of all the people who have handled a $5 bill before or after you, even if you know the serial number printed on it. This is by design, for privacy.

If you are the victim of fraud, you should report it to your local police. Even if they cannot help you recover your money it helps them and politicians to be aware of the level of such crime and helps them decide whether more resources are needed.

Other web-pages that may be of interest (this is not an endorsement)

Where to report Bitcoin Scams

Update:

Oops, I see you asked the same question last year and got a good answer, voting to close as duplicate.


If I set assumevalid=0 after syncing the blockchain will Bitcoin Core go back and validate historical blocks? I originally synced my node using the Bitcoin Core default assumevalid value. If I set -assumevalid=0 in bitcoin.conf and restart my node, will my node go back and validate historical blocks?

No, it won't.

That's also not possible without rebuilding the UTXO set from scratch, as the unspent outputs being spent need to be known to validate spends against.

If you want to force a revalidation from scratch, start with -reindex-chainstate. This will blow away the UTXO set, and recreate it from the blocks on disk, and revalidate everything in the process (including all signatures, if -assumevalid=0 is set).


How to broadcast a transaction I think this question is not only matter of bitcoin but also of every other crypto currency.

My question is if I lets say have an app or wallet or website. And I want to send money to certain address, lets say I will scan QR. Great I know the address but how to actually push the transaction to the blockchain? How I will release such info? Lets say that I would be able to see at https://www.blockchain.com ? Thanks for every answer. I am looking forward your responses.

You need to be running a full bitcoin node like Bitcoin Core, or use a wallet that connects to a bitcoin node. Bitcoin nodes connect to multiple other nodes and distribute the transaction and block data between each other according to the Bitcoin protocol.

Blockchain.com is also running a bitcoin node, and will receive the transaction through the network and display it on their site.


Selling bitcoin for IDR I bought bitcoins but my currency is in Rands but I want to sell it to IDR is it possible to do so

Yes you can use localbitcoins and find your country/city and sell it there. Becareful when selling in person. Always meetup in a public space like starbucks, bank, or police station.


getnewaddress vs. getrawchangeaddress I'm using the Golang btcsuite/btcd library to write a Bitcoin app that creates custom OP_RETURN TXs in the blockchain.

I understand Bitcoin at a high-level (proof-of-work consensus, Merkle trees, membership, signatures, etc.), but I'm getting lost in the (unnecessarily?) complicated details of its RPC interface.

I was writing code in Go for creating a custom transaction with 1 input and 2 outputs (an OP_RETURN output and a change output). Here are my questions:

Is this considered a raw transaction? (If so, what exactly constitutes a raw transaction? Is it all transactions that don't get created via the sendfrom/sendmany/sendtoaddress RPC?)
What's the difference between getnewaddress and getrawchangeaddress at a semantic level? It seems that both generate a key-pair, but why is there a need for two different calls?
If I'm creating a raw transaction as described above, should I send the change to a getnewaddress key or a getrawchangeaddress key?

Thank you,
Alin

The rawtransaction interface accepts and returns "raw" hex encoded p2p compatible transactions. Using the non-rawtransaction methods (like sendtoaddres, will not give you the possibility to inspect or alter the created bytearray.
The getrawchangeaddress method will retrieve a key from the keypool and return its pubkey (encoded into an p2pkh address). Unlike getrawchangeaddress, gewnewaddress will create an address book entry that will allow you better ways to inspect/distinct what funds you have received with that address and therefore increases the chance of a reused address.
You should use getrawchangeaddress if you like to use the given address as a change output for your rawtransaction.


Are there any chart tools out there? Are there any chart tools similar to the ones used in Forex trading available for Bitcoin users? The MtGox Live feed is nice and all, but it doesn't offer the functionality one would expect from a respectable exchange (like a candlestick chart for example).

Slush has made A bridge to feed Bitcoin exchange data to Sierra Chart.

Of course, if all you want is to look at a candlestick chart (and even if you want a bit more than that), there's always http://bitcoincharts.com/charts/.


Where could I post an article about Electrum to get it reviewed? I am writing a short, basic article about Electrum.

I am quite new to bitcoins, and was hoping I could get somebody to have a look at it, to check that I didn't write anything totally stupid (which is likely).

The article is meant to be a very basic guide on how to use Electrum, keeping everything very basic and simple. I want to give just enough hints in terms of theory, without getting too deep into it.

Where could I post it, in order to get it reviewed?

I would try posting it to /r/electrum, /r/bitcoin, or the Electrum section of BitcoinTalk.


How to generate scriptPubKey? My address is 389CLh5Ect2i7U5116gqjBSLykYHRmdcgZ. In request from site i see this
scriptPubKey, how i can generate this scriptPubKey from my Address
{scriptPubKey: "a91446c443cc449d9e9a54a9e07a30dfd2ab1960a18f87", value: 60000} ?

If you have examples in javascript it will be good.

this is the partial answer, on the underlying logic. I cannot help with java script. The critical part would be the base58decoding, but it seems there are solutions already: https://www.npmjs.com/package/base58check

Underlying logic:

the scriptpubkey contains the RipeMD160 Hash, surrounded by some codes:
a9 14  87. This is a P2SH address.

the meaning of the codes is:

a9 -> do a RipeMD160 on the top stack item
14 -> push hex 14 (decimal 20) bytes on stack
87 -> check if the top two stack elements are equal

From your address, you need four steps, to come to this goal:

1.) base58decode the address
2.) remove last 4 bytes (this is a checksum)
3.) remove the first two bytes (the network prefix
4.) surround the codes to it

effectivly the procedure is the revers of the standard "base58check encoding": which answers, how to come from a pubkey in hexformat to
 an address:

0: have a Private ECDSA Key
1: derive the Public ECDSA Key
2: do a SHA-256 of 1
3: RIPEMD-160 Hash of 2
4: add address prefix 0x00 for P2PKH, 0x05 for P2SH
5. sha256
6. another sha256
7. take first four Bytes from step 6 as checksum
8. append checksum from step 7 to the result from step4
9. encode Base58

--> your bitcoin address !

help while testing: http://gobittest.appspot.com/Address
(hint: never put your production private keys into a webpage - you might/will loose the funds on it!)


Transaction I never made I'm a newbie so this might be a stupid question, but on Blockchain, it says I have made two transactions however I only did one transaction and the overall thing does not make sense to me. Could someone please explain where this second transaction is from and what the 10 BTC on the right means?

This is the page: https://blockchain.info/address/12b6BMrGnqm5eHiLGejWuESurbVxwVU4gk

Thanks

I'm going to make a wild stab in the dark, that you are probably moving bitcoins from an exchange, because if you are new to this you are probably not making multi-party payments.

The earlier of the two transactions (green) is showing several previous addresses, paying several others. This would occur for instance when you withdraw from an exchange: ie they will be paying many people who are all making withdrawals, from coins that were deposited at many addresses.

The second payment, I am going to assume is a consolidation payment. As you say you only made one transaction, I can only think that this is either an exchange consolidating your deposit (because your first transaction was from one exchange to another), or else you withdrew to an online wallet service which is doing the same thing - consolidating. (Beware)

There is a third alternative, and that is that your machine has been compromised and you have just lost some bitcoins. I hope not.


Segwit txin. Witness data association I am trying to learn more about the bitcoin protocol and I am writing some python software to make a light wallet. I have advanced quite far and I have come across something that I dont really understand while reading about segregated witness protocol changes in terms of transactions.

https://bitcoincore.org/en/segwit_wallet_dev/

If you go here and read the part with a heading "Transaction Serialization" the text reads like so:

  If a txin is not associated with any witness data, its corresponding witness field is an exact 0x00, indicating that the number of witness stack items is zero.

How do I know if an input I am using in my script is associated with witness data? I have tried using public API's to look at the outputs I am using and I cant understand what it means. I see witness fields associated with the inputs of the transaction that produced the outputs I am trying to include in my transaction but not the other way around..

How do I know if an input I am using in my script is associated with witness data? I have tried using public API's to look at the outputs I am using and I cant understand what it means. I see witness fields associated with the inputs of the transaction that produced the outputs I am trying to include in my transaction but not the other way around.

I believe your confusion is due to this line

  If a txin is not associated with any witness data, its corresponding witness field is an exact 0x00, indicating that the number of witness stack items is zero.

not applying to the serialization format, but to the contents.

A witness is always serialized as:

A variable-length integer indicating the number of witness stack items n.
For each of the n stack items:

A variable-length integer indicating the size of the stack element b
A b-byte array with the contents of that stack element.

A corollary is that an empty witness is always serialized as just a 0x00 byte (indicating that there are zero stack items).

So your serialization and parsing code does not need to know whether a particular txin has associated witness data. It just serializes/parses the witness, which may be empty.

It so happens that the validity rules require that the witness for a non-segwit spend always has to be empty, and as a result, the serialization of such a witness will always be just 0x00.


Locked out of my bitcoin core wallet In 2013 I transferred 5,02 BTC to my Bitcoin Core wallet.
My Bitcoin version v0.8.1.0-g34d62a8-beta QT is version 4.8.4

After the transfer I locked the wallet with a password, wrote the password down and now, after 4 years I wanted to send the bitcoins out but it tells me my password is wrong.

I tried several solutions I found on the internet, none of them worked. Do you know a solution? I use both windows and Linuxmint. The wallet was on a Linuxmint computer installed on an USB-stick.

Actually if he has the password he can use brute Force attack and gain access to the wallet if that didn't slove the problem he should use bip39-standalone input his passphrase get the key and import to another wallet


Getting orphaned Blocks from the Blockchain I'm very interested in doing some analysis of orphaned blocks, but to do so I'd have to have a good way of accessing them. Blockchain.info seems like a good place to start but I don't want to abuse their API by scraping the entire Blockchain. Another attempt was to use ABE but after parsing nearly all the blockchain from my Disk (several days of work) I am unable to find a single orphaned block, and I'm starting to fear that the satoshi client prunes old orphaned blocks, which would be a pity.

Will I be able to find orphaned blocks with ABE, and if not what alternatives are there?

Orphaned blocks are stored in blkxxxx.dat files forever, though each node will know about different orphaned blocks. Bitcoin will print a list of all known blocks, including orphans, to debug.log if you pass it -printblocktree.


Does BitMinter not use CPU's for mining at all? I just started using BitMinter on several computers. They have decent GPU's that are detected and working fine, but I'd like to be able to use my CPU's also and I can't seem to find any method to enable it.

GPUs are obsolete for mining. You won't get any reward worth even close to your electricity and hardware degredation cost. This has been true for over a year at least.

CPUs are 1000x more wasteful.

You're too late to the home-mining game.


Bitcoin-qt on Elementary OS Loki I'm very new to Elementary OS and I used the version Freya a short time. There I got Bitcoin-qt easily out of the repositories.
On Elementary OS isn't that that simple - has anyone experienced the same?

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update

The tags above aren´t working on Loki.
I just want to know - I have no problem to download the .tar.gz and start it from there.

Thanks a alot - I found the solution:

This worked perfectly:

apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update sudo apt-get install bitcoin-qt


can't buy bitcoin eBook using bitcoin? It sounds like a headline from The Onion, but is it really true?  I can't find anywhere I can buy the eBook Mastering Bitcoin using bitcoin, only PayPal or Credit Card.

He suspended sales because the original print run ran out. The merchants that accept paypal/credit cards are only accepting preorders.

He posts availability info on his website:

https://www.bitcoinbook.info/

In the meantime, he's published the book online.


Where in a bitcoin transaction can I store some data? I need to store some data in a transaction to the data can be stored in the blockchain.

In which field of the transaction I can store it?

createrawtransaction can be used to store data:

createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime ) ( replaceable )

Create a transaction spending the given inputs and creating new outputs.
Outputs can be addresses or data.
Returns hex-encoded raw transaction.
Note that the transaction's inputs are not signed, and
it is not stored in the wallet or transmitted to the network.

Arguments:
1. "inputs"                (array, required) A json array of json objects
     [
       {
         "txid":"id",    (string, required) The transaction id
         "vout":n,         (numeric, required) The output number
         "sequence":n      (numeric, optional) The sequence number
       }
       ,...
     ]
2. "outputs"               (object, required) a json object with outputs
    {
      "address": x.xxx,    (numeric or string, required) The key is the bitcoin address, the numeric value (can be string) is the BTC amount
      "data": "hex"      (string, required) The key is "data", the value is hex encoded data
      ,...
    }
3. locktime                  (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs
4. replaceable               (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.
                             Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.

Result:
"transaction"              (string) hex string of the transaction

Examples:
> bitcoin-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "{\"address\":0.01}"
> bitcoin-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "{\"data\":\"00010203\"}"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "{\"address\":0.01}"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "{\"data\":\"00010203\"}"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/


Are there alternatives to Gitian? I like how Bitcoin Core uses Gitian to make their builds deterministic. But Gitian is also a really complicated workaround. Is there any research being done into alternatives for deterministic builds?

So having a deterministic/reproducible build system is more of a software development practice than it is a single piece of software like Gitian. There are a variety of projects that try to implement this practice which are listed below:

https://reproducible-builds.org/who/

Gitian handles the deterministic building through a virtual machine, and then the uploading and comparison of signatures through git. However, deterministic building is impossible to automate for all set of software, due to the wide range of things that can cause the compiled code to be different (for example read https://wiki.debian.org/ReproducibleBuilds/Howto or https://blog.torproject.org/blog/deterministic-builds-part-two-technical-details where they describe specific issues for reproducible builds in their particular projects). So at the end of the day, part of the reproducible build process is manually hunting down all the things that can cause the binaries to be different and fixing it.

So if you have a project like Debian with thousands of software packages and authors, part of the reproducible build system must be education and statistic tracking.

For smaller projects, what you need depends on the software libraries you are working with and what OS's you are distributing for. For example, Debian has their own reproducible build tools. You could use https://diffoscope.org/ to identify specific differences in your binaries.


How to buy Apple products with Bitcoin? How can I buy Apple products? I want to buy the new iPad Mini, and I'd use Gyft to convert BTC to Amazon credit, but the new iPad is not yet on Amazon. Is there any way to buy the new iPad Mini, either directly through Apple or through a 3rd party?

Disregarding anything clever (I am still pretty new to this), you can simply convert your Bitcoins to your local currency through a third party.  There will be a transaction fee (I imagine), but I doubt Apple is going to hop on the BTC wagon anytime soon and their business model, AFAIK, won't allow for the same lever of third-party integration as Amazon does.


Cooling for an XPS 15 (L502x) laptop during Bitcoin Mining I would like to know exactly where I should put my extra cooling fans around my laptop so that I can more efficiently cool while I mine bitcoins.  I realize this is not optimal at the moment, but before I invest in a rig I want to try it out with my laptop (but without overheating anything of course).  Is there a reason why my CPU is getting so hot while my GPU is comfortable even while I'm GPU mining?

Location like top-right, bottom-right, etc (w/r/t looking down on keyboard) is very helpful.

Also, what would be the best way to cool the BitForce Jalapeno?  Could I just use a simple fan in a well ventilated area?

Mining on a GPU, especially on less powerful ones like the ones found in laptops is highly inefficient. You can find out exactly how much you can potentially earn or lose from various Bitcoin calculators, like mine for example.

If you are worried about overheating your laptop and just want to test what mining is all about, you could also lower your hashrate, for example by introducing pauses in the miner. Most mining software should be supporting this feature, so you ought to look at the documentation.

Hardware specific question are probably best asked on different StackExchanges. You could just ask "where is my GPU on my laptop and how best to cool it?"
, which isn't Bitcoin-specific.

And if you want to ask about cooling of BitForce Jalapeno, why not post a separate question with that topic? The more specific question, the better.


How's the blockchain connected to a Bitcoin Wallet I am thinking about buying some bitcoin buy first I want to understand some theoretical aspects of the technology behind it.

The wallet holds my private keys right? But how s me wallet connected to the blockchain?

Thanks,

Blockchain is the state of the bitcoin network. It is unanimously accepted as the correct state.

Each bitcoin full node stores its own copy of the blockchain. These copies can rarely differ in couple of last blocks, so bitcoin full nodes can have slightly different view of the same blockchain (only of couple of last blocks though). By adding new blocks on the end of the blockchain (this happens every 10 minutes) any possible differences in blockchain copies resolve (full nodes come to consensus about the state of the blockchain). Bitcoin full nodes are connected in a network and exchange their copies regularly.

The wallet is either implemented as part of the bitcoin full node application or as a separate small application that is then connected via Internet to some bitcoin full node.

Bitcoin wallet must be able to:

a) Generate public address and respective private key.

b) Calculate the balance of public addresses you control. To do this bitcoin wallet must read one small part of the blockchain, the one that holds unspent transactions (and possibly a pool of unconfirmed transactions - the transactions that are broadcasted but not yet added on the blockchain).

c) make a transacion using coins from your public addresses, sign those coins with private keys related to public addresses used, and broadcast this transaction to the bitcoin node that will spread this transaction to other full nodes in bitcoin network. This transaction will eventually end on the blockchain.

So b) requires reading data stored on the blockchain, and c) requires sending new data on the blockchain. Remember that the blockchain is a copy in a bitcoin full node. So the wallet reads from and writes to the blockchain by either communicating internally when being part of the full node application or communicating through Internet with some full node.

Full nodes communicate between themselves to spread and gather blockchain changes.


farmers quest to exchange goods and services I would like to know whether it is possible for farmers to use Bitcoin to exchange good and services without ever using other money. We are trying to build a network between local farmers and would like to use Bitcoin in exchange for our services.
Looking forward to hearing from you.

this was a nice initiative. What I imagine is a ring of farmers where each and everyone produce different products and/or provide certain services. For instance, one farmer could sell milk and eggs, another one could be an expert at mending barns, and yet another one could be raising chickens and selling those.

Let's say it is a group of 20 farmers, and they want to use bitcoin for trading goods and services among them.

First of all there should be 1 or 2 super enthusiasts that could be the 'go to man' for the others in the event of issues.

There are several things that needs to be considered:

A. Determine what level of IT-strategy is advisable. Most farmers probably have some kind of IT-equipment already, be it smartphones, personal computers, tablets etc. As for accepting BTC, startionary equipment is fine, but when visiting another farmer, then a smart phone would be great to be able to pay. Of course there are several ways to go about this. Bitcoin.org lists many options in regards to wallets, and most wallets have their dedicated thread on bitcointalk.org, where you can learn about the wallet that you chose to use. Unless you deal with trivial amounts of BTC, there should be some backup strategies, this could include using cold wallets (educate yourself about this), and also regular backups regarding hot wallets. Remember hot wallets can most often be encrypted and protected by a passphrase. Backups are very important. If the farmer loses his smart phone in the dirt container, it's gone, and so is the bitcoins, but if he has a backup, he'll be safe in regards to retaining his bitcoins. There are so many ways to backup the bitcoins, so I cannot elaborate on that here, but it's a crucial part of dealing with bitcoins. A wallet with cash is lost when somebody steals it, or if you lose it on the field, bitcoins are safe as long as you have a backup. The bitcoin enthusiast in the group should research different options carefully and select what's best suited for the group of farmers.

B. Get bitcoins in the hands of the farmers in the first place.
- Solutions: Use localbitcoins or similar and do face to face cash trades. Alternatively, use an online service (exchanger or exchange), and deposit money through any method the site accepts. This might be a good starting point in that regard: https://en.bitcoin.it/wiki/Trade

C. Get tradin'. Farmer Joe buys a dozen eggs from Farmer Jane with 0.n bitcoins. How to determine the price? Some price finding service could be made by the enthusiast, or some existing web services could be used. Bitcoin prices are a bit volatile, so they need to be dynamically uptated by converting from USD to BTC. So when Jane drives over to Joe to get some eggs, he says, yupp, that's 10 dollars in bitcoins, and he enters 10 USD in his tablet, and out comes the number 0.03. He then points at his QR-code, and says: "Yupp, that's my payment address, just scan it Jane, and you could pay me directly". Jane scans the QR-code with her phone, and sends 0.03 BTC to Joe. Joe checks at his computers and sees the payment going in to his wallet, saying '0 unconfirmed'. As he trusts Jane, and knows Jane is not the double-spend type of farmer, he happily raised his thumbs and smiles. "Yupp, all done Jane - have a good one!"

The challenge as I see it is to keep the bitcoins safe for non-technical people. Perhaps some kind of bitcoin community union for the farmers would be the way to go?

As I see it, the transaction part of the project is the easiest part, while keeping the bitcoins safe demands that at least 1 person (preferably more) in the group has the technical knowhow to setup secure solutions. Perhaps even dedicated devices for such payments would be advisable.

The advantages would be that you would become independent of the traditional cash system, at least in the farmers trading ring. In addition, if done properly, no money could be confiscated by police if stopped in a control (I've heard cash confiscations are rampant in the US these days..). There could be no counterfeit money, not that it would be an issue with cash either, I would think. And you would not enrich the bankers with fees and so on. Now that bitcoin has become more widespread, the farmer could sell eggs and milk for bitcoins, and then use the bitcoins to buy linen, pillows, computers, tea - virtually anything, so he didn't really need to use cash for all things any more. And if someone breaks into a farmers house and steals his laptop, he's already got a backup stored encrypted on a server run by the IT-enthusiast in the group, or stored on an USB-drive hidden somewhere in the barn, so until the thief cracks the passphrase to the wallet, the bitcoins are already swiped to other addresses, and thus the thief will gain nothing.

When using a normal bank, all transactions are tied to your person and reported to the relevant entities. Now, the blockchain is public knowledge, but it's rather hard to track a single bitcoin address to a certain person.

All of this might sound quite complicated, and it kind of is as well, but using bitcoin to pay is not that difficult, just scan a QR-code, then input how much you should pay, and done with it - so what might be best would be to seek out some kind of solution that's already ready made for scenarios like this. I don't know if it exists, but look and you shall find.

In summary, you need a solution that hides all the complicated parts, and makes it really easy in a day to day usage.

I wish you the best of luck!


Proof of Identity Sidechain Proposals I have seen various Proof of Identity Proposal that all required some degree of trust (to verify the person in physical possession of a Passport is also the owner of it for example).

Have their been any proposals that are completely trustless? Is so what methods have been suggested to cryptographically tie real life identities to identities on a Bitcoin sidechain in a trustless manner?

For example could we use multi sig to require a sufficient percentage of randomly selected scientists to verify that a DNA sample, video recording with face and Passport, certified birth certificate and PGP message received from a specific person matches the person trying to verify their identity on the blockchain?

"randomly selected scientists" - randomly selected by whom? And will you have scientists in every city across the world? And how will they get paid?

Ideas like that are practically impossible, and if you remember how PGP key signing parties ended up you'll understand why nobody is pursuing it.

The way Identifi is doing trust and reputation is one way to solve this. The other way is BIP75, which could be used to present a certificate signed by some certificate authority mutually accepted between you and the other parties. This article goes into some detail about that.


How To connect BItcoin Core with Php i installed a bitcoind core and i access bitcoin-cli command in linux terminal with developer command(getbalance, getaccountaddress etc.) but i want run this command in php file.

my php code is:

chdir('/home/itr/Downloads/bitcoin/bin');
$output = shell_exec("./bitcoin-cli getbalance");
echo var_dump($output);

bitcoin-cli file path:

  /home/itr/Downloads/bitcoin/bin

please tell me what i do?

I would definitely not do it this way and use a RPC client. A very simple one is https://github.com/aceat64/EasyBitcoin-PHP


Calculate Any Address Balance Using Bitcoinn RPC getrawtransaction I'm trying to use getrawtransaction to get transaction details (for any address) from my local blockchain. What I have is an address in readable format, "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" but the input to getrawtransaction is a hexadecimal string. I found the following solution that does not change the string at all.

let address='1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
address=address.toString('hex')
console.log(address);
client.getRawTransaction(address, function(error, o) { console.log(o); });

Any ideas?

Bitcoin Core does not support querying an address balance.

What you can do is import the address as watch-only into your wallet (using the importaddress RPC), and completing a rescan of the blockchain. When you're finished, the wallet will treat that address as one of its own, and track payments to it, and include it in its balance. Of course, you won't be able to spend it without private key.


Bandwidth speed for Bitcoin mining? I think to setup an ASIC Ant Miner in my university apartment.
I am new to Bitcoin mining and since the university network does block any Bitcoin related connections I was thinking to use my smartphone 3G internet for this purpose.
 But now I wonder what bandwidth speed will I need to maintain 24/7 mining process without any bandwidth speed issues.

I think your 3G speeds should work pretty well. They usually do not require fast internet connections.


Why can a wallet not compute the private-key from a public-key? my goal of questions this is why any wallet not able to compute private key created with public key generate?

Your post is a series of questions, each of which I'm having trouble understanding specifically, but in general it seems that you are confused about the role of private and public keys in bitcoin. So, as a high level answer:

Bitcoin uses public key cryptography to verify that users are allowed to spend some bitcoin. A user will create a private/public keypair, and then create a bitcoin address from the public key. Any bitcoin sent to that address is only spendable if the private key signs a transaction spending it (the transaction includes the public key, so that the network can verify the signature).

The way public key cryptography works, it is computationally infeasible to work backwards from the public key, in order to find a private key. So a wallet cannot 'find' the private key for a given public key.

A bitcoin wallet can be thought of as a keychain app, because it stores the user's keypairs. So the wallet will manage your keypairs, create and sign transactions, etc. A private key is not used to sign into the wallet, for that you would use a secure login system (PIN, username, password, 2FA, etc, depending on the type of wallet).

To keep bitcoin safe, it is best to keep your private keys 100% offline, using hardware that never connects to the internet to generate (and potentially store) the keys.

With this setup, there is no reason to specify an 'owner' of an account or wallet, the network only cares about whether or not a signature is valid.

Any good wallet software will generate keys using a proper random number generator, and the keyspace is so large that the chance of ever generating the same private key twice is pretty much zero. The only way to create the same keys in two wallets is to either create the key in one wallet, and then import it to the second wallet, or use an HD wallet architecture and then use the same mnemonic seed phrase to create multiple wallet instances.


Error while syncing with the blockchain on my Raspberry Pi So I already have the node set up on my raspberry pi. This night the transfer of the Blockchain from my laptop to the raspi's hard disk finished. Now I am waiting for the blocks to match the headers

"blocks": 162064, "headers": 613982

The thing is that when I do bitcoin-cli getblockchaininfo to check if it is already complete, I get this error:

error: Could not connect to the server 127.0.0.1:8332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

I check if bitcoind is running with systemctl status bitcoind.service and this shows up:

● bitcoind.service - Bitcoin daemon

Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)

Active: activating (auto-restart) (Result: exit-code) since Wed 2020-01-22 11:59:12 CET; 15s ago

Process: 811 ExecStartPre=/bin/sh -c sleep 30 (code=exited, status=0/SUCCESS)

Process: 814 ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf -pid=/home/bitcoin/.bitcoin/bitcoind.pid (code=exited, status=0/SUCCESS)

Main PID: 815 (code=exited, status=1/FAILURE)

So I try to restart the bitcoin daemon with sudo systemctl stop bitcoind and sudo systemctl start bitcoind. And when I check its status it shows the following (which looks good):

bitcoind.service - Bitcoin daemon

Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)

Active: active (running) since Wed 2020-01-22 12:01:01 CET; 5s ago

Process: 862 ExecStartPre=/bin/sh -c sleep 30 (code=exited, status=0/SUCCESS)

Process: 864 ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf -pid=/home/bitcoin/.bitcoin/bitcoind.pid (code=exited, status=0/SUCCESS)

Main PID: 865 (bitcoind)

Tasks: 12 (limit: 2200)

Memory: 111.0M

CGroup: /system.slice/bitcoind.service

└─865 /usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf -pid=/home/bitcoin/.bitcoin/bitcoind.pid

And when I do bitcoin-cli getblockchaininfo again, it doesn't show me an error, but the number of blocks synchronized is lower than before. And a few minutes later, when I go check again it all repeats itself.

What am I supposed to do here?

Thanks

As @MartinSolie noted, it might be helpful to look into the debug.log file.

Based on what you describe, it sounds like your Bitcoin Core node crashes at some point while synchronizing. You mentioned that you copied the chain from another device. Since you mentioned you are waiting for the blocks to match the headers, I'm not sure the transferred chain is correctly recognized by Bitcoin Core. Your Bitcoin Core is either re-indexing the whole chain or even downloading it. On a Raspberry 3 this can take quite a while (i.e. multiple weeks).

Bitcoin Core probably crashes, because it runs out of memory. One way of solving that would be to add a SWAP file on your HDD (don't do it on the SD Card! Swapping kills the SD card over time).


Accepting Bitcoin payments without the full blockchain or third party APIs? I want to make a basic program/script that utilizes Bitcoin payments, but I don't have the storage space to sync with the entire blockchain, and I don't want to be dependent on a third-party API like those offered by blockchain.info or block.io.

Basically, I need a wallet with these three properies:

Lightweight (i.e. doesn't require the full blockchain)
Has a CLI to generate and return a receiving address on command
Has a CLI to get the total wallet balance

I'm vaguely familiar with thin clients such as Electrum, MultiBit, and MultiBit HD, and I know Electrum even has a CLI, but there doesn't seem to be anything in their documentation about generating new addresses:

https://docs.electrum.org/en/latest/cmdline.html

I've read that Electrum wallets work with a queue of addresses and generate new ones automatically after they have been used, so even if I could just get a list of addresses associated with the wallet I could get something like the functionality I want. But again, the CLI seems really limited.

All in all, I'm frustrated. Surely there is a way to do what I am trying to do, and if there isn't an obvious solution, why not? It seems counterintuitive that I should have to use centralized services and APIs for basic wallet functionality just because I can't afford to rent a server with 90+GB of space to store the blockchain.

If you don't want to run a node or use any 3rd party APIs you can use a library since you only want to accept payments.

Use an extended public key from one of your wallets, and generate new addresses from the HD xpub using a library. When a user pays it will show up in your Phone/PC wallet.

For example with Bitcore library it would be:

var bitcore = require("bitcore-lib");

var pub = new bitcore.HDPublicKey('xpubMyHDPublicKey');
var derivedHdPublicKey = pub.derive('m/0/1');
//increment up the keychain m/0/2, m/0/3, etc each order
var derivedPublicKey = derivedHdPublicKey.publicKey;
var address = new bitcore.Address(derivedPublicKey);
console.log(address);

Then just keep track of orders and addresses on your server database.


Can I change current receiving address in Bitcoin Wallet app? I download Bitcoin Wallet app. I receive BTC on first address (old type), but after some time second address (bech-32) became "this is you current address for receiving". Can I change receiving on first address?

The wallet generates a new receiving address every time you touch the "Request coins" button at bottom left. This is normal and is done for privacy reasons. The last one in the list is labelled "This is your current address for receiving" but you can re-use earlier ones if you don't care about privacy or if you really know what you are doing (e.g. receiving regularly recurring payments from same person).
There is no need to do anything with old addresses. They can be reused if you really need to but there is no harm in leaving them alone.
If you want to generate new old-style addresses for receiving payment from someone with old software, I don't see any way to do that with the current version 8.08 settings menu. It always generates new-style Bech32 addresses with a bc1 prefix so far as I can see.


With the upcoming hard fork will there be a fixed exchange rate between Bitcoin Unlimited and Bitcoin? As you know, there might be an upcoming hard fork of BTC to enlarge the block size.

Will the new currency Bitcoin Unlimited be a different currency or will it be compatible with Bitcoin with a fixed exchange rate between the new and the old currency?

If the two projects both persist, they would be freely traded one for the other. A fixed price could only be established if someone with unlimited funds guaranteed an exchange rate, which naturally can't happen because there is a limited number of tokens.

If the hardfork occurs you will have whatever Bitcoin you had on both these chain-tips.

Note, that to Bitcoin Unlimited nodes as it's currently implemented the Bitcoin chain would still appear valid, and if the latter ever grows longer after the chain split, BU nodes would reorganize back to the Bitcoin chain. This could of course be prohibited by setting BU nodes to require one of the blocks created after the chain split to be part of their longest chain.


Multiple transactions for a single payment in bitpay Let's say we are 4 people and we want to purchase something that is currently worth 10 coins. When we click the purchase button, we are presented with an address to transfer the coins within 15 minutes.

The question: Should we send the necessary coins in a single transaction? Or is it possible to make (for example) 4 different transactions of (for example) 2.5 btc each, summing in 10 btc? If so, what if one of us cannot make the transfer on time?

Any information/experience is appreciated.

I contacted BitPay support about the issue and they said that it'll just work.

So we made our payment via 3 different transactions. As soon as all transactions were made, the BitPay window informed us:"This invoice has been paid." At that moment either one of the transactions had a single confirmation or none had any. Then came the confirmations.

Addendum - The official response from BitPay support for question on paying via multiple transactions:

  "That should be fine. However with bitcoin you can structure a transaction to be paid
  from several accounts at one time. That's one of the cool concepts of
  Bitcoin. I recommend you check it out on wikipedia.

  For sake of time your method should be sufficient. Make sure you do
  sufficient fees to speed up the transaction."


When will there be no 'mineable' bitcoins left? At today's rate of progression when will the market cap of 21 million be reached? If bitcoin increases at such a rate. In addition to this, is it true that when the market cap is reached, miners will still get transaction fees? If so, how much will these transaction fees be?

Bitcoin will hit its maximum of 21,000,000 coins in approximately the year 2140.

After that, there will be no "reward" for mining, and the only incentive will be transaction fees.   Transaction fees will continue to be set by the market (as they are now), depending on how much people are willing to pay.

No one can say with certainty what the fees will be at that time.


Bitcoin disappeared after resetting the blockchain and transactions I'm looking for some advice on trying to recover bitcoins.
I transferred some bitcoin to my multibit wallet, it came through but still didn't confirm after 20 hours. So I tried resetting the blockchain and transactions, and now my wallet is empty! I got the message

com.google.bitcoin.store.BlockStoreException: Corrupted block store: could not find chain head

I searched for this and found advice about deleting the.spvchain file, but I don't appear to have this file!

Edit: Ok, so I just downloaded the newest version of multibit and the bitcoins appeared. All is good! Thanks for the info.

Your wallet shows empty because it doesn't really "know" that one or more addresses that it controls "owns" some bitcoins because you manually deleted the blockchain files.

It will display your correct balance once it synchronizes again, provided of course that you have not deleted the .wallet file.

I would also suggest you take extra care when deleting the .spvchain file, more at: https://groups.google.com/forum/#!topic/bitcoinj/vIbsMfd1NUA

Another approach would be to export your private key(s) for non-zero addresses and import them to a clean installation. Make sure you keep a back-up of your .wallet file somewhere safe throughout this process.


Which VPS providers are the most popular or notable for hosting bitcoind instances? A lot of people wanting to create their own service communicating with a bitcoind instance use virtual servers for hosting due to the low associated costs. Which service providers are the most popular and notable in this field?

BitVPS offers a VPS with a pre-installed and synced bitcoind, and of course they accept payment in Bitcoin.  Email the owner (james@bitvps.com) for details.


How many coins does Satoshi have? There are rumors that the creator of Bitcoin, Satoshi Nakamoto, currently possess as much as 1.5m bitcoins.

What are the steps involved to determine / guess how many coins Satoshi has?

Most people have estimated his wealth to be around 1 Million BTC. Don't take my word for it though this post https://bitslog.wordpress.com/2013/04/17/the-well-deserved-fortune-of-satoshi-nakamoto/ is often the first referring to this discussion.


Who stores your private key? How does Bitcoin work when someone opens a wallet and gets a private key? Who stores that data? How could you access it if your forgot it?

Also, how is it verified when someone exchanges bitcoin and dollars? Because the owner of those bitcoins has to change but there is obviously no proof in the system he has done that transaction...

How does Bitcoin work when someone opens a wallet and gets a private key? Who stores that data? How could you access it if your forgot it?

Usually your private keys are stored only on your computer, in an encrypted file. If you lose them, your bitcoins are lost. That is why it is important to take a backup of your seed words or wallet file. If you use a website wallet, the owner of that website stores your keys, which means you must trust them and risk that they will not be hacked, etc. which goes against bitcoin principles - don't trust, just verify. So it's important that you keep your private keys safe somewhere that you can access, don't let a website keep them from you.

  how is it verified when someone exchanges bitcoin and dollars? Because the owner of those bitcoins has to change but there is obviously no proof in the system he has done that transaction

Of course there is proof - every transaction is recorded in the blockchain forever. So every transaction can be seen by everyone else on the network, everyone knows the bitcoins have exchanged owners (technically they can't know whether they've exchanged owners or just moved to a new address though, of course)


Accept Credit Card Online to Bitcoin Address Backend I'm looking to start an online business, and I want to accept Credit Cards.
I want the funds transferred to my Bitcoin Address natively.

I've done some Duck-Duck-Go-Foo (Search Engine) but even the Big Boys, such as Mt. Gox, BitPay, etc. all refer to accepting BitCoin directly.

How do I accept Credit Cards and have it natively transferred to my BitCoin Address?

Thanks!

This problem is not solvable unless you want to place yourself at great personal risk. The trouble is that bitcoin transfers are inherently non-reversible, meaning that once you've transfered bitcoins there is absolutely nothing you can do to guarantee the return of those bitcoins. Credit cards however are highly reversible and most banks reserve the right to take back funds with very little justification and will almost always side with their customers (aka the people who are paying you.)

This means that if someone buys bitcoins from you with a credit card, and then removes the bitcoins from your sites wallet, and then they default on their credit card payment, the bank will ask you for the money back, and you will be out some bitcoins.

There are a few partial solutions to this problem. You can accept credit card payments but require the user to not remove the bitcoins untill the payment has become non-reversible. This is usually a prohibitive amount of time, taking anywhere from a month+ to clear. The fastest way to possibly transfer money in a non-reversible fashion would be either to use the SEPA network if you live in Europe, or if you live in the USA then you can use something called Automated Clearing House protocol, which was developed by the federal reserve to allow debiting of bank accounts. Both of these are quite difficult and annoying to implement.

Its impossible to buy bitcoins from yourself, because it implies that you have the bitcoins in the first place, and you cant offer a service that accepts credit cards for the reasons stated above, and other companies dont for the same reasons.


Is there any way to get the block number of generation from coinbase? I was looking on http://blockexplorer.com/ and saw a coinbase of 304602210088c72f5fae851934be23ea7f563ce0424397939480e52c27225efbd8c0c1fccc022100e882cc00e76ae150aefe76fa89a262198d4f1d67f95d2cc3a60ce189017c199901 and wondered what block it was a reward from. I didn't know if the coinbase has anything to do with what block it was generated in.

Blocks with a version of 2 or greater are required to put their block height in the coinbase. Your example doesn't. (At some point in the future, version 1 blocks will probably be discouraged and then banned.)

Here's an example of one that does:

038232030650b25c7d0f8bfabe6d6d0ebaccab777b7b5f4745bc81a22654d2fde018c3e8f06823670f5e790cbde3b6010000000000000000454d432055533300

The block height is the first thing in the coinbase. 03 is how many bytes the number has. So the number is 0x823203 in Bitcoin's little endian byte ordering, or 0x033282 in the big-endian byte ordering that humans usually use. Convert this into decimal and you can see that this is block #209538.


Relation between multi-sig and single-sig addresses (in BCCAPI library)? I had a multi-sig address M (starting with 3) that I was trying to send a small amount of coins to. I was playing around with BCCAPI and the coins got sent to an "ordinary" address A (starting with 1)

I had supplied M to the library but somehow the signed tx had the address A

I know who controls M but no one seems to control A. I am trying to see if the funds can be recovered by someone controlling M.

Is there any relation between the two addresses? I'd prefer not to post the actual addresses yet. However, the fact that I used BCCAPI might give some clue.

Here is the code (in Scala) that I used:

val M = "3..." // multi-sig address
val receiver = com.bccapi.bitlib.model.Address.fromString(M, netParams)
val so = new com.bccapi.bitlib.model.ScriptOutputStandard(receiver.getTypeSpecificBytes())
...

The call to receiver.getTypeSpecificBytes() strips off the version byte (the '3'), and ScriptOutputStandard() always creates a P2PKH script from this raw (with no version byte) 20-byte hash. The bitcoin that was sent to the P2PKH address is probably irretrievable.

You probably meant to do this to create a P2SH script:

val so = new com.bccapi.bitlib.model.ScriptOutputMultisig(receiver.getTypeSpecificBytes())

Also, just FYI I don't think BCCAPI is being supported any longer. I don't see any updates to it since late 2012, and the then maintainer has since moved on to create Mycelium. You may want to consider an alternative Java Bitcoin library such as bitcoinj.


SPV clients and full nodes Suppose an SPV client goes offline at block X (meaning it has block headers until block X) and then comes back online when the blockchain is at block Y. At that point, it needs to resynchronise its UTXO set. So, it does the following: (1) get the block headers of blocks X to Y; (2) construct a bloom filter for its addresses and request a full node to send all the transactions matching this bloom filter from block X to Y; (3) the full node does so and if a match is found, sends the transaction data along with a merkle proof to the SPV client; (4) SPV client verifies the proof and if it's correct updates its UTXO set accordingly.

Is this the way things actually happen?

If yes, then my question is then why can't the full node simply do the following: (1) send its UTXO set to the SPV client; (2) SPV client then filters the UTXOs of its interest and put those UTXOs in its own UTXO set.

Is this method not followed because it doesn't involve any verification from SPV client and this the full node can give the SPV client a totally wrong UTXO set?

Is this the way things actually happen?

Yes

  If yes, then my question is then why can't the full node simply do the following: (1) send its UTXO set to the SPV client; (2) SPV client then filters the UTXOs of its interest and put those UTXOs in its own UTXO set.

The UTXO set is large and a proof for every UTXO would be required. Proofs for every UTXO would be expensive to build and an extremely large amount of unnecessary data would be sent over the wire thus consuming network bandwidth that could be better used elsewhere.


Does ad hoc adoption of private blockchains make the financial system vulnerable to tampering? The security of a blockchain network depends on how many nodes are participating in that network. More number of participating nodes, implies better security. Currently, many financial institutions are integrating  a "private" blockchain into their operations. Since the number of participating nodes in a private blockchain is likely to be far smaller than the public blockchain, does it mean that it is easier to tamper the private blockchain? If that is true, then does it imply that ad hoc private networks of blockchain adopted by financial institutions will be less secure than a big public blockchain network?

this has the risk of getting a philosophical debate... Generally, the bitcoin blockchain was invented, to avoid, that malicious participants have no impact on the overall distribution of messages in the public network (aka tx with Satoshis in blocks). Along with some privacy features. So when someone creates a private blockchain, we are down to the level of trust. You can use a 1:1 copy of the bitcoin network, and don't go public. Then you compare the code to the executables, and can be sure, noone wants to tamper with it. But as it is private, you never know, how many "good" and how many "bad" nodes were invited to participate. There are use cases for private blockchains, when it comes to tx handling between several companies, which should be tamper proof. Question is, if the bitcoin blockchin is the right tool for this. In general I support your point of view, that private blockchains are less secure than a big public network. Trust is then based on the fact, that this company will not go bankrupt (or controlled by governments), and the privacy question remains unanswered, of course.


Migration of wallet accounts to labels I have multiple accounts on older bitcoin core version (0.16.3) but in order to move to newer releases I must migrate accounts to new label format with additional database which hold each account balance. Since I have many accounts what is best (and easier) way to move all accounts to label format and to keep addresses that each account has.
Best regards

OK, thanks.
For anyone else doing this type of migration, the procedure I did was :

bitcoin-cli listaccounts   //to get amounts of all balances on each account
copy old wallet to newer version node
bitcoind -upgradewallet //to upgrade wallet to newest version

This procedure preserves all keys, addresses and makes account a label so now when you enter bitcoin-cli listlabels you get all labels as were accounts before

Since label can not have any balance, in separate database enter balance of each account/label from first step.

While upgrading make note of new transactions that should be added to wallet and run

bitcoin-cli listtransactions XXX where XXX is number of last transactions you want to see

add each new incoming transaction (if any) to database balance so balance in database match balance on wallet

That is it. Seems complex but it can be done in no time even for large number of accounts.
Best regards


How to parse the blockchain? I know there are websites providing blockchain information, but I want to write some script to explore the blockchain on my own. How do I do it? Are there any document available online?

Not much documentation, but you can look at how others are doing it by examining their code. Take a look at bitcoin-abe. It is pretty straightforward.


Does cpuminer do its work? I have a question about using cpuminer to mine bitcoins. I know that it's not efficient, but I'm not about making any money from it (obviously), I just want to mine some fractions of a bitcoin.

Now, I have downloaded and compiled it on Ubuntu and then started the program as seen in the output:

 ./minerd --url=stratum+tcp://<server>:3333 --userpass=<username.worker>:<password> --algo=sha256d

[2015-04-26 20:22:45] Starting Stratum on stratum+tcp://<server>:3333
[2015-04-26 20:22:45] Binding thread 2 to cpu 2
[2015-04-26 20:22:45] Binding thread 1 to cpu 1
[2015-04-26 20:22:45] 4 miner threads started, using 'sha256d' algorithm.
[2015-04-26 20:22:45] Binding thread 0 to cpu 0
[2015-04-26 20:22:45] Binding thread 3 to cpu 3
[2015-04-26 20:22:48] thread 3: 2097152 hashes, 1814 khash/s
[2015-04-26 20:22:48] thread 0: 2097152 hashes, 1774 khash/s
[2015-04-26 20:22:48] thread 1: 2097152 hashes, 1742 khash/s
[2015-04-26 20:22:48] thread 2: 2097152 hashes, 1355 khash/s
[2015-04-26 20:23:54] thread 2: 81299404 hashes, 1230 khash/s
[2015-04-26 20:24:05] thread 1: 104547880 hashes, 1354 khash/s
[2015-04-26 20:24:13] thread 3: 108821800 hashes, 1272 khash/s
[2015-04-26 20:24:25] thread 0: 106421736 hashes, 1095 khash/s
[2015-04-26 20:25:01] thread 2: 73787712 hashes, 1102 khash/s
[2015-04-26 20:25:07] thread 1: 81252652 hashes, 1312 khash/s
[2015-04-26 20:25:14] thread 3: 76317796 hashes, 1256 khash/s
[2015-04-26 20:25:27] thread 0: 65677172 hashes, 1051 khash/s
[2015-04-26 20:25:52] thread 2: 66108472 hashes, 1305 khash/s
[2015-04-26 20:26:12] thread 3: 75386708 hashes, 1307 khash/s
[2015-04-26 20:26:15] thread 1: 78701868 hashes, 1152 khash/s
[2015-04-26 20:26:28] thread 0: 63037412 hashes, 1031 khash/s

The problem I have now, is that I never get any output like this:

[<Date>, <Time>] accepted: x/y (x/y%), <bla>khash/s (yay!!!)

and in the mining pool, I dont see my worker online.

I wonder now, if my computer does any work at all, or if it is just too slow and all the work it puts into mining goes to waste.

You are mining, but most pools today have a minimum share difficulty requirement, otherwise very fast miners bombard them with shares that they have to process and discard. For many pools this is at a minimum of 128 or higher, meaning it would take several days for a CPU miner to find a share on average. No pool has a payout of any less than 0.00001 BTC, so there is absolutely no chance of you ever being paid for your work if you are mining using a CPU or GPU at this point in time.


Can't we change the block data instead of a nonce? In the process of solving a hash puzzle, isn't it possible to change the transaction data instead of changing a nonce?

It's possible, and this does happen (refered to as extraNonce), but this is orders of magnitude more resource intensive to do, as you need at least the left hand side of the merkle tree, rather than just 64 bytes of the header.

In Bitcoin the nonce is only 32 bits, which means every 4.2 Billion hashes you need to either update the timestamp, or modify the transaction tree to create fresh work. For a standard block today, this is more than 22 SHA256 hash invocations, versus less than one for modifying the nonce alone.