How can I extract the values of all UTXO for a specific section of the blockchain? I'm working on some statistics concerning the distribution of the UTXO set. I'm especially interested in the values of the UTXO, and would perhaps like to limit extraction to certain sections of the blockchain.

Is there already a tool or script that lets me extract UTXO data?

Peter Wuille describes exactly how the UTXO data is stored in the chainstate directory of your locally-running full node:

What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

You'll want to scroll down to "Inside the chain state database".

You can grab the unspent amounts, transaction hashes and indices. The exact format specification can be found here:

https://github.com/bitcoin/bitcoin/blob/d4a42334d447cad48fb3996cad0fd5c945b75571/src/coins.h#L19


When and where to add extra information when signing P2SH raw transaction? This post is quite long so in summary: I'm wondering where I can add extra information when signing a raw transaction (in this case a cleartext of a digest). I'm also wondering if Missing inputs (code -25) which I'm getting without having provided the digest and trying to sign anyway is because of that or because of something else.

I am trying to sign a hashed time-lock contract with bitcoind that looks like this:

OP_IF
    [HASHOP] <digest> OP_EQUALVERIFY OP_DUP OP_HASH160 <seller pubkey hash>
OP_ELSE
    <num> [TIMEOUTOP] OP_DROP OP_DUP OP_HASH160 <buyer pubkey hash>
OP_ENDIF
OP_EQUALVERIFY
OP_CHECKSIG

and like all P2SH this is how you are supposed to add it to the network and sign it:

Pubkey script: OP_HASH160 <Hash160(redeemScript)> OP_EQUAL
Signature script: <sig> [sig] [sig...] <redeemScript>.

So I have sent some bitcoins to the base58-encoded P2SH address and created a raw transaction to the same address as seller pubkey hash. But when I am about to sign it I just can't find where I can put the digest.

According to the signrawtransaction RPC call: http://chainquery.com/bitcoin-api/signrawtransaction I need to add

2. "prevtxs"       (string, optional) An json array of previous dependent transaction outputs
     [               (json array of json objects, or 'null' if none provided)
       {
         "txid":"id",             (string, required) The transaction id
         "vout":n,                  (numeric, required) The output number
         "scriptPubKey": "hex",   (string, required) script key
         "redeemScript": "hex",   (string, required for P2SH or P2WSH) redeem script
         "amount": value            (numeric, required) The amount spent
       }
       ,...
    ]

which is where I'm guessing I can add the digest. Should it maybe be added to the redeemScript?

Then there is also:

3. "privkeys"     (string, optional) A json array of base58-encoded private keys for signing
    [                  (json array of strings, or 'null' if none provided)
      "privatekey"   (string) private key in base58-encoding
      ,...
    ]

but it seems weird to me that I should have to base58-encode the digest when it should probably be a hex string?

Just in case I don't miss anything important I will also list some of the steps in detail I've done up to this point (all done on regtest).

So I started by creating  a raw transaction to the P2SH address (since sendtoaddress gave me errors about the fee being too high or low):

createrawtransaction "[{\"txid\":\"5f3671ca7d5dea44dd3dd40fad076e76c57189702a4bb92bacb1747017136982\",\"vout\":0}]" "{\"2N5ZRwT42rHFjAtizZPa3Rp7Tn88PcoSzEB\":5, \"n1uGNwJ5nrrhTh4wQX5XKYpxDoZsp3w2fB\":40}"

After signing the raw transaction and decoding it to get the txid I then created another transaction to my own account:

createrawtransaction "[{\"txid\":\"f345938d21bc3fc0966a4f11a0e6b98831640b2cc6cf49bd143758cd95762a1c\",\"vout\":0}]" "{ \"n1uGNwJ5nrrhTh4wQX5XKYpxDoZsp3w2fB\":5}".

Finally I tried signing the transaction with nothing but the fields I knew from prevtxs:

signrawtransaction "02000000011c2a7695cd583714bd49cfc62c0b643188b9e6a0114f6a96c03fbc218d9345f30000000000ffffffff010065cd1d000000001976a914df9ac343e79ae35a727ff757b02e93ac5a4748dd88ac00000000" "[{\"txid\":\"f345938d21bc3fc0966a4f11a0e6b98831640b2cc6cf49bd143758cd95762a1c\",\"vout\":0, \"scriptPubKey\": \"76a9149a57624114b8c67ea007616a210ffe79e711bbd988ac\", \"redeemScript\":\"63a61486b8e067c700620260ad44f108e4add2ebf3c1d28876a91422a29435b1386d8fbc779a72612ccda7401d4aa2675cb27576a9147074ce8ff2f417d6b232d73a789ca09e7c0e8ef36888ac\", \"amount\":5}]".

When trying to sendrawtransaction on this I get error code Missing inputs (code -25). So my final question is: is Missing inputs related with not having provided digest in signrawtransaction or is it because I have missed to add something else?

Bitcoin Core's signrawtransaction RPC does not know about the specific type of script you're trying to sign for, and won't be usable.

You'll need to implement the signing logic yourself.


Why does this transaction results in more than 1 unspent output? This transaction results in 6 outputs in total. Why did it end up with having 4 unspent outputs? I read this answer from another question, and wondering, could it be because the user actually chooses to distribute the spare change to 4 of the addresses he owns?

This is an exchange withdrawal, and presumably they are batching multiple user withdrawals into one transaction to reduce the overhead cost. In particular, 17A16QmavnUfCW11DAApiJxp7ARnxN5pGX belongs to Poloniex.

This is not uncommon, and many companies that must make frequent payments to multiple people will batch the payouts to reduce fees.

Most wallet software will not let you set multiple change addresses for a single transaction, but nothing prevents you from creating such a transaction manually at a protocol level.


Script Bitcoin represent number > 16 I'm studying Script language, but I don't understand How can I rappresent the number > 16, for instance 210

I want to do a simple sum

OP_10 210 OP_ADD

how I have to represent 210?
I'm trying with OP_PUSHDATA1 without lucky.

You only need to use OP_PUSHDATA1 if you are trying to push more than 75 bytes of data onto the stack.

For pushing smaller sized values onto the stack, you can use the opcodes 0x01 to 0x4b to indicate the number of bytes being pushed. Thus, to push a single byte of value 210 (0xD2) onto the stack, you would use the byte sequence 0x01 0xd2.

To push a 16-bit number, such as 1000 onto the stack, you would use the sequence of bytes 0x02 0xe8 0x03. Note that little-endian byte ordering is used. You can do similarly for a 24-bit number, or 32-bit number.

The minimum size should always be used when pushing a value - meaning the most significant byte of the pushed value should never be zero.

The value pushed will internally be zero-extended to a represent a 32-bit signed integer. All of the numeric operations in bitcoin script are limited to 32-bit integers. The result returned by a numeric operation can be treated as a signed 64-bit value, but values which overflow the 32-bit integer range may not be used in subsequent numeric operation.

On OP_PUSHDATA1, this is used for pushing arbitrary binary data onto the stack which may be used as arguments for operations such as OP_SHA256. This works by having the first byte of the sequence being OP_PUSHDATA1, the second byte being the length of the pushed data, and the remaining bytes being the content. For data more than 255 bytes, OP_PUSHDATA2 is used, where the second and third bytes of the sequence represent the length, and so on. The minimum size rule applies to all of the kinds of pushes, including that you should not try to push a single byte <=16 onto the stack using 2 bytes, but should instead use the OP_N single-byte opcodes.


should i call keypoolrefill or it's refilled automatically? As far as i know that key pool gets refilled automatically with each address taken out of it. Why should i use keypoolrefill then ? What's the benefit of this command ?

Most people don't need to use keypoolrefill.

Bitcoin Core tries to fill the keypool to its configured maximum size whenever you take an address from the keypool. (It does not wait until the keypool is empty before regenerating it.) However, it isn't possible to add keys to the keypool unless the wallet is unlocked with walletpassphrase. So if you call getnewaddress 100 times (by default), your keypool will be empty and you will be prompted to unlock your wallet and run keypoolrefill. The same effect could be achieved by unlocking your wallet and then generating another address, which will also cause the keypool to be topped up.

Another use is if you want to temporarily increase the size of your keypool. For example, a really safe way of doing payment processing is to generate an encrypted wallet with a strong passphrase, generate thousands of keys using keypoolrefill 10000 or whatever, put this wallet on the live payment processing server, but only use the commands that don't require unlocking the wallet. Then even if the live server is compromised, the attacker can't steal the money because he can't unlock the wallet. This is similar to the idea of a watch-only wallet. You could do the same thing with the keypool setting, but I guess that restarting Bitcoin Core might be inconvenient in some cases.

Running Bitcoin with -keypool=0 and then only manually adjusting the keypool  with keypoolresize might also be useful for some backup strategies, or if you have multiple servers using the same wallet (which is not recommended, but maybe possible if you're really careful).


Why is the Schnorr verification formula working and actually verifying the validity of a signature? Reading the bottom of page 2 of the Musig Paper we can find that a Schnorr Signature for a cyclic Group G of prime order p with generator g is a tuple (R,s) where

R = gr for a random secret r and
s=r+cx where c = H(X,R,m) for a message m, some Hashfunction H and the public key X = gx corresponding to the private key x.

It is further stated that such a signature (R,s) can be verified using the equation gs = RXc
I would like to know why that last equation proves the validity of the signature?

To prove the validity of the signature, we must see that the tuple (R,s) actually came from the private key x. In particular that s was derived as s=r+cx. Obviously, we should not possess the private key x (which is the reason why we need this verification equation) so

Looking at gs = RXc, we realize that we know (R,s), X and c (since c = H(X,R,m) and the public key X is known). As the generator g is also known, we can actually compute both sides of the equation.
Since s=r+cx, we know that gs = gr+cx
Since we do these calculations in a cyclic group of prime order we can apply the following rules: ga + b = gagb and gab = (ga)b (As far as I understand, this is the reason why the group needs to be cyclic and of prime order.)
Thus, gs = gr+cx = grgcx
Recalling R = gr and entering it into the equation from 4. we get gs = Rgcx
Recalling the other rule from 3. we have gs = Rgcx = R(gx)c = RXc

This is exactly the equation that was supposed to be shown.
Note the interesting fact that as mentioned in 1. all data needed to verify the equation is known but producing the data can only work if x and r are known. That is why the owner of x can produce the signature and others can verify it.


Security trade-offs between centralized wallet system and a SPV wallet? there are many wallets on the market. And I would appreciate if someone can clarify the key technical security advantages or disadvantages when using a SPV wallet vs a centralized wallet.

I am taking these two terms from the bitcoin.org page, and to give you an example by what they mean: SPV wallet would be eg the Electrum wallet. And a centralized wallet is eg the current "Ledger Live" App. SPV wallets validate transactions by connecting to multiple different  nodes/servers, while centralized wallet apps only use their own servers for transmitting transactions.

Thank you!

Well "wallet" as storage of keys should always be under your control. There are online wallets for higher convenience, but as the old saying goes "not your keys, not your bitcoin". It's probably a bad term, but I'd rather say "local (SPV) node" instead of "wallet".

When you are sending there is no problem with malicious peers as the transaction is (usually) cryptographically signed, so the most they can do is not relay your data to the rest of the network (DoS). Like a regular bitcoin node you can
basically just send the tx out to multiple peers.

The important part where blockchain comes into play is verifying whether a transaction actually happened (possibly also the one that you've submitted).
In this context "centralized" means you basically just ask another node. Now the node will usually tell you the truth unless it has some incentive to cheat. Like owners want to persuade you they've sent you money in exchange for your goods or services when in fact they didn't. You could ask multiple nodes, but you can't be sure they're not colluding to scam you (same goes for block explorers).

In order to be 100 %, you'd need to download the whole bitcoin blockchain from genesis and check for yourself. Point is that you do it from multiple nodes and due to PoW they can't make up that data from thin air. Downloading the whole chain is however a bit impractical so what "simplified payment verification" does is basically allows you to just download the chain of block headers (that are only 80 bytes each). Then you see that the block containing the transaction is part of the longest chain (and that means that there was consensus on the network that the transaction you are wondering about was indeed valid).


How to generate an output address from output scrips which start with 0x00? A few days ago, I got a BITCOIN traffic which contains some tx message.
some of tx messages contain witness data.
I want to produce all output addresses from transaction output scripts.
I extracted some of them, but in some cases, generated output address however seems to be valid,  but I can't track them in some sites like

https://www.blockchain.com

as an example, in tx output script which is showed below, how I can extract True address?

00142f82e61a98eb7027672760c691784d5fbccf7ce3

it seems a script which has op_code = 0x00 and push data length = 0x14.

It's a native segwit output. 0x00 signifies the segwit version (which is v0 in this case), 0x14 is the bytes to push and 2f82e61a98eb7027672760c691784d5fbccf7ce3 is the hash160 of the public key. Native segwit addresses uses bech32 encoding as defined in BIP 173 and begin with bc1. Use this for reference implementations in various programming languages. The address associated with the locking script is thus bc1q97pwvx5cadczwee8vrrfz7zdt77v7l8re20cz4


Will 64-bit miners work on 32-bit machines? I want to distribute some miners, but I prefer not to distribute 2 versions of everything (32-bit and 64-bit).

According to Microsoft, most 32-bit programs run on 64-bit systems. I'm not concerned with that as much as an efficiency drop; will 32-miners be half the optimal speed on a 64-bit system? Additionally, many miners (cgminer/cudaminer) require drivers to be installed; these would obviously have to be 64-bit.

So, should I distribute only one version of the CPU miner (minerd.exe) or will that cause problems or a lack of efficiency?

When you run 32-bit versions of software on 64-bit systems in Windows the applications are executed a bit slower than they would in a 32-bit system mainly because of the WoW64 subsystem that emulates the 32-bit environment.

On top of that, if your mining software requires lots of physical memory, the 4 GB barrier on the 32-bit architecture (or the 32-bit version of the software running in WoW64) would result in disk swapping for the required but not-available physical memory, which would significantly slow down the whole process especially if your system does not run on SSD disks.

Also note that, although it's rare, it's still possible that the 64-bit version of a program can actually be slower than its 32-bit version, and this occurs in low quality software where data variables are being represented by the biggest-in-size variable types while they shouldn't, which in turn results in the increase of the sizes of pointers that live in the system’s physical memory and from that point on memory swapping is just a few steps away.

So, no, you shouldn't use the same version of software across all your machines.


What does the blockchain represent? What does the blockchain represent? Is it the current balance of
    each account or is it the complete ledger?

The blockchain is the complete transactional history of Bitcoin. It collects every transaction performed in blocks which each are linked to their predecessor block.

By parsing the complete blockchain, you can discover all unspent balances. These are usually tied to addresses, which represent users much like email addresses do.

Also see these two related questions:

What is the “blockchain”?
Can someone explain how the Bitcoin Blockchain works?


Balance between minimum transaction fee and time using Electrum 3 Yesterday I made my first Bitcoin transaction using Electrum and I was able to configure the fees I was going to pay. As it was a non-urgent transfer I selected the minimum fee Electrum allowed me: "Within 25 blocks", the lowest sat./byte available from the slide bar.

If the transaction was supposed to be included in the next 25 blocks, I thought it will take around 250 minutes (~4hours) to be processed. But I don't know why, after 2hours the transaction already had 6 confirmations.

This minimum fee ended up being 0.0008 BTC (~10 € as the time of writing, which was ~14% of the sent amount).

Why did the transaction went so fast if the fee was for 25 blocks?
As it was a non-urgent transaction, couldn't I have selected a smaller fee in any way? I couldn't find a way to pay smaller fee in Electrum 3 --I could have waited for 24h with no problem to avoid this high fee.
Does this means that I paid much more for the fee than I could have paid, given the non-urgent requisition of my transfer?

It's all about bitcoin, the Electrum wallet is just a wallet, it doesn't minning block nor building block.

  Why did the transaction went so fast if the fee was for 25 blocks?

You can't predict in which block exactly your transaction will be added.
The block is filled with arbitrary transactions. *

 * While larger fees improve the chance to be included in the block there is still have a chance to be added to the next block.

  As it was a non-urgent transaction, couldn't I have selected a smaller
  fee in any way?

You can select any fees what you want(and 0 fees also), but there are no warranties what that transaction will be added to the block. Transactions that pay more fee take precedence.

  I couldn't find a way to pay smaller fee in Electrum 3 --I could have
  waited for 24h with no problem to avoid this high fee.

You can set commision manually in the Electrum settings.

  Does this means that I paid much more for the fee than I could have
  paid, given the non-urgent requisition of my transfer?

Transactions (with a small or zero fee) which stay unconfirmed for a longer time usually don't get priorized over transactions with a high fee.
Every miner is free to chose which transactions he is going to confirm in his mined block. Its all about how the node is coded to fill the block with TX's.
Since miners mine because they want to gain profit, they will always priorize transactions with a higher sat/B fee.

From me:

  What happens with transaction with zero or low fees?

Generally, after a few days, the transaction will be removed from the mempool and your wallet shows your balance again, which makes your coins
spendable again via wallet.


getting the unspent bitcoins based on bitcoin address im new to bitcoin and want to find out which is the best API or way for getting the bitcoin balance of a bitcoin address for any bitcoin address in C#

The easiest way would be to use the API of a block explorer. Several provide such an API and some have wrapper libraries for C#.

For example the blockchain.info blockchain explorer has such an API and has a C# wrapper as well. Consult their Blockchain Data API which explains how to get the balance (among other data) from an address. More specifically, you need to call the following (HTTP) API:

https://blockchain.info/address/$bitcoin_address?format=json

The result is a json object and "final_balance" is what you need.

If you use the C# wrapper you can find an example on how to get the balance of an address (and many other things) here.

Alternatively, you could query a bitcoin node directly. The easiest way to do that in C# would be to use a wrapper library.


Accepting Payments To Bitcoins I am setting up an online shop to sell digital goods. I would ideally like to accept only Bitcoin payments, however most users do not use Bitcoins or can't work it out. Therefore, I have to accept credit cards, Paypal, etc. to actually make a profit. My question: is there a service that provides all of these payment gateways but can then combine each service to a Bitcoin wallet?

For example, customer A pays by Paypal, customer B with Skrill. Both payments go into a single account where I can then withdraw the money to a Bitcoin wallet.

Thanks!

I don't know of any service that handles all of these. You can use Coinbase to accept bitcoin.  If your Paypal account deposits the fiat to a U.S. bank account, you can also use Coinbase to manually "buy" Bitcoin into the same Coinbase account.

If you knew the value of your USD account, you could automate the buying of bitcoin via Coinbase API.  Manually doing the conversion every week, month, etc would not be a bad idea though because you could wait until the Bitcoin price is low, or just keep a part of the funds in fiat for your business expenses.

If you are outside the U.S., probably better to look into Bitpay.


How the hell was I able to receive BTCs via an address I do not own? A few minutes ago I received 0.00000001 BTC. I don't know who sent them or why.

But what makes it crazy is, this sum was sent to an address I do not own and which the client I'm running (the standard Bitcoin-QT, versione 0.8.5) had never heard of before. I know this for sure because I only created 2 (two) addresses using this client, and the receiving address of this transaction is not one of them.

How is this possible at all?
Is it a hash collision, or what else?

The address is 1Cz2AmLe8U52KR549d13JQkqsqkV64RchB and the transaction ID is b9591410ff030e40deb3eda9d2fe30a29642ede443f354bb5f4ed5bb55f0d36d.

According to this page, the address seems to have received money a little time before from 1HTawQNCS4axPXft6L6fkzrv5ya7TguqwD, which actually is one of my addresses; the last two transactions are me sending all my BTCs to a new address, just to be sure. This worked, so it looks like I'm actually the owner of that address, even if my client doesn't list it as one of mine.

What's exactly going on here?

As Murch says one possibility is that this address is in your keypool. Another is that this is a change address the client created. If you're willing to share the relevant transaction we may have more to say.

Owning an address means "being in unique possession of a corresponding private key". It's difficult to know if you're the only owner, but verifying you have a key is easy - ask bitcoin-qt to sign a message with this address.


litecoin constants and prefixes Is there any list of litecoin constants available?
Something like Bitcoin list of address prefixes

Here is what I've gathered so far regarding the different version bytes for each type of Litecoin public address:
Mainnet:

p2pkh L-address (LM2WMpR1Rp6j3Sa59cMXMs1SPzj9eXpGc1): 0x30
p2sh deprecated 3-address (3MSvaVbVFFLML86rt5eqgA9SvW23upaXdY): 0x05 (same as bitcoin's mainnet p2sh)
p2sh new M-address (MTf4tP1TCNBn8dNkyxeBVoPrFCcVzxJvvh): 0x32

Testnet:

p2pkh m- or n-address (mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn): 0x6f (same as bitcoin's testnet p2pkh)
p2sh deprecated 2-address (2N2PJEucf6QY2kNFuJ4chQEBoyZWszRQE16): 0xc4
p2sh new Q-address (QVk4MvUu7Wb7tZ1wvAeiUvdF7wxhvpyLLK): 0x3a

This is the Litecoin project's converter between old and new p2sh address format.
And this is an online base58check decoder to check the version byte.


Is EFF's proposed Sovereign Key system similar to how Namecoin/Bitcoin works? To avoid the problems caused by the current SSL certificate infrastructure, the Electronic Frontier Foundation has proposed Sovereign Keys, which appears to be backed by a distributed, append-only datastructure that can grow to hundreds of gigabytes. That sounds awfully familiar to a block chain. Are there similarities between Sovereign Key and Bitcoin (or Namecoin)? Do they employ a related approach or is this just a superficial similarity?

No.  Sovereign keys are simply a technical mechanism to use the DNSSEC trust anchors instead of companies like Verisign.  Trust is still centralized; it's just centralized in a different place.


Do you have to keep broadcasting transactions until mined? From what I know, you can broadcast a transaction including input addresses, output addresses, and amounts, which is signed by your private key.
I often hear that your transaction might not be mined in the next block, since there is a limited capacity, and you can incentivize miners to prioritize your transaction by paying a higher mining fee.
But this doesn't make sense to me... I assumed that transactions must be mined in the next block, since your transaction also includes the hash of the previous block in order to prevent double-spending. Is this assumption correct?
Does this mean, for every block in which your transaction is not included, you need to continuously broadcast a new transaction with the hash of the new current block?
Or, is there a mechanism for just broadcasting a single transaction that can be mined in any future block, but cannot be mined more than once so that you don't accidentally spend extra? If so, how would this work?
I was thinking, because transactions must consume all bitcoin in an address (and you can send some back to yourself if you want), that a miner can not mine the same transaction twice because your address would now be empty in the new state of the blockchain. Is this the case?
Thanks for trying to clarify this for me :)

But this doesn't make sense to me... I assumed that transactions must
be mined in the next block, since your transaction also includes the
hash of the previous block in order to prevent double-spending. Is
this assumption correct?

This is not correct, the transaction does not reference blocks, it references outputs. A block references the previous block.
To answer your question, no, you only have to broadcast your transaction once. In some cases that the mempool is too large, nodes might start deleting transactions from their mempool starting with the ones with the lower fees. In that case if your set fee is too low you might want to rebroadcast it.
Miners of course cannot mine the same transaction twice because as you said a transaction spends the input coins and therefore you cannot spend them again.


Separate wallets sharing the same blockchain? Since the blockchain is such a large file, I'd like to have more than 1 account on the same computer share it.  Is that possible?

The most straightforward way to do this with Bitcoin-Qt/bitcoind (at this moment) is to swap the wallet.dat in your bitcoin data directory when the client is not running.

Another method (if you're on a UNIX-ish OS) is to create multiple data directories, then symbolic link (ln -s) the blocks and chainstate directories (not database) inside your datadirs to a common data dir.

mkdir ~/.bitcoin-alt  # new wallet directory
cd ~/.bitcoin-alt
ln -s ~/.bitcoin/blocks ~/.bitcoin/chainstate .
# launch new wallet
bitcoin-qt -datadir=$HOME/.bitcoin-alt

Then you can leave the wallet.dat alone. When launching you can specify a -datadir based on the wallet that you want to use, and it will share the blockchain dirs.

However even with this solution cannot run two bitcoind/bitcoin-qt instances at the same time sharing the block chain! This is currently not possible and will result in corruption if you try.


How do mining pool payout methods affect the cost of executing a block withholding attack? I'm wondering how each payout method (PPS, DGM, PPLNS, Proportional, etc) influences the cost of executing a block withholding attack.

Does it matter how the payout method places variance between pool and miners? With DGM this is a setting that can be adjusted by the pool operator. With other payout methods it is inherent to the system.

Does a block finder's bonus influence the cost of an attack? By that I mean part of the block income being reserved for the miner who created it, before the rest is distributed according to the pool's chosen payout method.

Are other factors important?

Which systems would be expensive to attack, and which would be cheapest?

Generally, the higher the variance for the miners of a reward method, the higher the cost of sabotage attacks (and I think also the potential profit of lie-in-wait).

In PPS there is no variance; and the cost for sabotage is negligible, it is merely the reward of 1 share.

In a typical method with no risk absorption and moderate variance, withholding a block means you lose your portion of its reward, which is h/H, your portion of the pool hashrate.

If you take an extremely high-variance reward method such as "pay per last 10 shares", withholding blocks means losing 10% of the reward, since if you submit a block then by definition you have a share in the last 10 shares, no matter your hashrate.

And of course, when solo mining, block withholding means losing all of your mining reward.

A block finder bonus is added multiplicatively to the other costs. For example in PPL10S with 20% finder bonus, when withholding you lose both the 20% bonus and 10% of the distributed 80%, for a total cost of 28%. However, finder bonus is a poor way to combat block withholding because it creates a lot of variance.


How a transaction proves its ownership of the its source, which can be one or multiple unspent output? I read the following from the book << Mastering Bitcoin >>

  "As you may notice, the transaction contains an empty scriptSig because we haven’t signed it yet. Without a signature, this transaction is meaningless, we haven’t yet proven that we own the address from which the unspent output is sourced."

I am wondering how a signature can prove that this transaction owns the address from which the unspent output is sourced?

Assume you understand how public-key cryptography works. In short, one can verify the ownership of an address by checking the signature. A valid signature can only be generated by the private key owner.

The detail of signature verification in Bitcoin is described here

Without digging into the details, OP_xxx are stack operations. For example, OP_DUP is to duplicate top of the stack. Basically it

first hashes the public key by operation OP_HASH160 and check if the result is identical to pubKeyHash by operation OP_EQUALVERIFY
then verifies sig and pubKey by operation OP_CHECKSIG

You can read more about OP_CHECKSIG here


What's the worst-case delay for BTC->USD? For big exchanges like mtgox, what is the longest delay time seen between ordering a sell and closing it?

In other words if I do an emergency sell of a large amount of coins because the exchange rate is dropping by the second, how much value might I lose while waiting for the sell order to complete?

Are there any exchanges that basically guarantee that the price in USD of my sell order when I place it will be the amount in USD I receive no matter how long their system takes to complete it?

When the BTC funds are on your MtGox account, a market sell order is nearly instantaneous and so done in a few seconds, dependent on the amount you buy.

Depositing Bitcoins to MtGox requires 6 confirmations before they show up in your account. 6 confirmations means 6 blocks to be mined since your transaction, this will averagely take 1 hour to complete.

The time for withdrawing your US dollars will strongly depend on the withdrawal method you want to use.

Note that there are many other exchanges and so this answer only holds for MtGox. It's likely that other exchanges require less confirmations and/or have faster withdrawal methods.


Problem with Greenaddress 2of2 Recovery I'm encountering an unforeseen problem with 2o2 Recovery procedure.
I followed all the instruction at https://github.com/greenaddress/garecovery, I've correctly installed Ubuntu for Windows, I've correctly run through all the steps until:

$ garecovery-cli 2of2 --nlocktime-file /path/to/downloaded/nlocktimes.zip -o garecovery.csv

I've passed the correct nlocktimes.zip, I've entered the right mnemonic, but the output I see is the following:

Traceback (most recent call last):
  File "/home/rene/.local/bin/garecovery-cli", line 7, in <module>
    sys.exit(recoverycli.main(sys.argv))
  File "/home/rene/.local/lib/python2.7/site-packages/garecovery/recoverycli.py", line 86, in main
    recovery = get_recovery(clargs.args, mnemonic, seed)
  File "/home/rene/.local/lib/python2.7/site-packages/garecovery/recoverycli.py", line 61, in get_recovery
    return TwoOfTwo(mnemonic, seed, options.nlocktime_file)
  File "/home/rene/.local/lib/python2.7/site-packages/garecovery/two_of_two.py", line 25, in __init__
    zipdata = gacommon._unzip(self.compressed_zip, chaincode)
  File "/home/rene/.local/lib/python2.7/site-packages/gaservices/utils/gacommon.py", line 35, in _unzip
    all_data.extend(_unzip(_fernet_decrypt(key, encrypted), key))
  File "/home/rene/.local/lib/python2.7/site-packages/gaservices/utils/gacommon.py", line 11, in _fernet_decrypt
    assert wally.hmac_sha256(key[:16], data[:-32]) == data[-32:]
AssertionError

Can anybody help me?
Many thanks in advance for any suggestions.

It seems that you have entered a valid mnemonic, but it cannot decrypt the nlocktime.zip file. It could be that the mnemonic you entered is not the one associated with the wallet (which can be used to decrypt the nlocktime.zip).

I replicated your error by using another mnemonic in one of the examples (garecovery/examples/example_2of2.sh):

$ garecovery-cli --network=testnet --mnemonic-file garecovery/tests/test_data/mnemonic_2.txt 2of2 --nlocktime-file garecovery/tests/test_data/compressed_1.zip
Traceback (most recent call last):
  File "/tmp/recovery/venv/bin/garecovery-cli", line 7, in <module>
    sys.exit(recoverycli.main(sys.argv))
  File "/tmp/recovery/venv/local/lib/python2.7/site-packages/garecovery/recoverycli.py", line 86, in main
    recovery = get_recovery(clargs.args, mnemonic, seed)
  File "/tmp/recovery/venv/local/lib/python2.7/site-packages/garecovery/recoverycli.py", line 61, in get_recovery
    return TwoOfTwo(mnemonic, seed, options.nlocktime_file)
  File "/tmp/recovery/venv/local/lib/python2.7/site-packages/garecovery/two_of_two.py", line 25, in __init__
    zipdata = gacommon._unzip(self.compressed_zip, chaincode)
  File "/tmp/recovery/venv/local/lib/python2.7/site-packages/gaservices/utils/gacommon.py", line 35, in _unzip
    all_data.extend(_unzip(_fernet_decrypt(key, encrypted), key))
  File "/tmp/recovery/venv/local/lib/python2.7/site-packages/gaservices/utils/gacommon.py", line 11, in _fernet_decrypt
    assert wally.hmac_sha256(key[:16], data[:-32]) == data[-32:]
AssertionError

For sure, the error message will have to be improved.

If you need further assistance and you feel you may reveal too much information about your situation, please send an email to info@greenaddress.it.


In which cases do transactions have multiple "from-account" but a single "to-account"? Taking a sample block on blockexplorer, I see that the generation reward is split between lots of recipients, I figure this is the pool that solved.

But looking at other transactions, there a few with over 100 'From' addresses, and a single 'To' address. The only reason I could think of, is merging many wallets into one. Since I see this in every block I am looking at, I wonder if there's another use-case.

Thanks!

First, if there is more than one 'From' address in a transaction, all of them necessarily have to be controlled by the same entity as each private key is required to sign the transaction.

Therefore, I see a few possibilities:

Somebody is consolidating a lot of small sums from different addresses to a single address owned by himself. This could be for example an Exchange moving deposits to cold storage, or a merchant preparing to pay his wholesale dealer. Alternatively, somebody needs to prove ownership of a discussed amount and moves everything to one address in order to sign a message proofing his wealth.
Somebody wants to pay a large sum, but doesn't have a single address that contains the full amount, so they source the payment from many smaller amounts.
Somebody is withdrawing a larger sum from an Exchange, Gambling Site or Online Wallet Service that hadn't been deposited in bulk.


Are there any open-source trading bots out there? Has anyone published an open-source trading bot that runs on a Bitcoin exchange?

ga bitbot

from the project page:

  ga-bitbot is a distributed genetic algorithm tuned automated mtgox trading system for Bitcoin which includes market data collection, gene client/server, reporting tools, and automated trading.

  The intention of this project is to create a high frequency capable trade platform for the bitcoin p2p currency.

bitcoin arbitrage

From the project page:

  bitcoin-arbitrage - opportunity detector and automated trading
  It gets order books from supported exchanges and calculate arbitrage opportunities between each markets. It takes market depth into account.

  Currently supported exchanges to get data:

  MtGox (USD, EUR)
  Bitstamp (USD, ~EUR)
  Bitcoin24 (EUR)
  Bitfloor (USD)
  Bitcoin-Central (EUR)
  BTC-e (USD, EUR)
  Intersango (EUR)
  Bitfinex (USD)

  Currently supported exchanges to automate trade:

  MtGox (EUR, USD)
  Bitstamp (USD)
  Bitcoin-Central (EUR) - closed

  (under MIT licence)

  *TODO:

  Tests
  Write documentation
  Add other exchanges:
  icbit
  BitFinex
  Update order books with a WebSocket client for supported exchanges (MtGox, Bitcoin-Central)
  Better history handling for observer "HistoryDumper" (Redis ?)
  Move EUR / USD from a market to an other:
  Coupons
  Ripple ?
  Negative Operations
  use Litecoin or other cryptocurrencies trades


How to develop with the Bitcoin cash? I have a simple wallet created with the BitcoinJ. I can create the address, track the transactions, check account balance etc with the wallet.

I would like to extend the wallet for the Bitcoin cash and was wondering is there any framework/library available for this forked currency?

There is a bitcoinj.cash project currently being put together.  The code is not ready for use but should be by next week: https://github.com/bitcoinj-cash/bitcoinj


Largest Bitcoin transaction fee ever paid? What was the largest transaction fee ever paid? Assuming that payment was an accident was the sender able to contact the miner who mined that block and negotiate a full or partial refund?

This transaction (2016-04-26) has even higher fees (291.2409 BTC).

This plot shows transaction fees higher than 1000USD from the past 3 years. From the plot, the April 2016 transaction seems to be the one paying the highest fee.

BitClub offered to refund the transaction, but the whole episode was a bit controversial.


Use case for multiple inputs in a single transaction Is there a way to ascertain a pair or more of Bitcoin addresses belong to the same wallet on the basis an address pair was used as input for a single transaction?

Can I verify the address pair input is not part of a createrawtransaction or fundrawtransaction transaction, for instance from a blockchain explorer?

In which case besides createrawtransaction and fundrawtransaction would multiple inputs within a single transaction belong to different wallets?

Is there a way to ascertain a pair or more of Bitcoin addresses belong to the same wallet on the basis an address pair was used as input for a single transaction?

No.

Assuming that all inputs to a transaction are from the same wallet is often called the 'common input ownership heuristic', but it is possible to create transactions using inputs from various wallets, so there is no way to apply this heuristic with 100% accuracy. In many cases it may work, but in many cases, it will fail.

  Can I verify the address pair input is not part of a createrawtransaction or fundrawtransaction transaction, for instance from a blockchain explorer?

No, the transaction data that is broadcast to the network is purposefully devoid of information about which software/method was used to craft the transaction. In some cases 'transaction fingerprinting' can be used to make an assumption about this, but again it is only a guess at best, false positives can easily be created too.

  In which case besides createrawtransaction and fundrawtransaction would multiple inputs within a single transaction belong to different wallets?

A transaction with inputs from multiple wallets is usually referred to as a coinjoin transaction. Some examples of wallets that implement coinjoin transactions are Wasabi wallet, or Join Market. Other ideas exist to create 'payjoin' transactions, such as P2EP. Coinjoins can also be manually created using software such as bitcoin-core.


Convert 12 word seed with passphrase -> 12 word seed without passphrase Is it possible to derive a new 12 word seed from a 12 word seed with passphrase (13th word) such that they both produce the same master key?

No, this is not possible.
The mnemonic and passphrase are put through PBKDF2. Any change in the input results in a completely different output.
While it is possible that there exists some 12 word mnemonic that just happens to hash to the same seed as your original mnemonic + passphrase, this would require bruteforcing all possible mnemonics to discover, and would not be derivable from the original mnemonic in any form - a hash collision would be completely unrelated.


How exactly is my account/wallet at ripple.com secure? Ok, I have my wallet name, passphrase and secret account key issued by 'the network'.
Now say that ripple.com is under DDOS attack or, for whatever reason closes for a month or even becomes inaccessible for even longer periods.

What exactly is the procedure that I need to follow to re-establish my wallet elsewhere? How do I find those @elsewhere that I may go to, if ripple.com is down? How do those at elsewhere know that my wallet passphrase and secret key is for real, if say ripple.com hrad drives all burnt in accidental fire in the building and they have no more records of my wallet?

Ok, so some distributed database has all the data about my wallet but what makes it itself secure, except maybe the sheer potential redundancy of entries, hopefully including one entry for my case.

Ripple.com only hosts the javascript client which talks to the Ripple network via websockets. Once Ripple is out of beta there will likely be different clients to choose from (smart phone apps; command line clients; desktop apps; etc). The existing javascript client is already open source and you can host it locally if you like (and have the technical know-how). Thus if Ripple.com becomes unreachable you have other client options. These options will only improve as Ripple grows and leaves beta.

Your Ripple wallet contains your secret key and your contacts in an encrypted form. Your balances and configured credit lines are stored in the ledger in the distributed ripple network. Currently there are only a dozen or so ripple servers all under the control of OpenCoin (in order to make it easy for them to make changes during the beta to the server code that would otherwise disrupt the network). As long as there are a sufficient majority of ripple servers intercommunicating you only need to be able to communicate with one of them (bitcoin is vaguely similar in that there is an intercommunicating network or bitcoind processes). Currently the webclient connects to s1.ripple.com by default (look under Advanced->Options) presumably this could point to any ripple server, and perhaps once out of beta the clients will have a list of servers to try.

When you created your wallet and when you login with the webclient there is a "Fetch Wallet" option (see What do the "Fetch Wallet" options when opening a Ripple wallet mean?) that controls where the wallet is stored. By default an encrypted version is stored "in the cloud" and locally by your browser. With the default options, if you run the webclient from the same machine+browser it can use just the local copy if the cloud storage is unavailable. If you move to a new machine or a different browser, the copy in the cloud needs to be accessible. You can also make a local backup of your wallet to a file, see How do I backup my Ripple wallet?

If for any reason there is no copy of your wallet available, all is not lost. Ripple lets you create a new wallet using your existing secret key (which is why they strongly recommend making a copy of the secret key). Since the wallet only holds your secret key and your contacts, all you will have lost is your contact names. The client would show your trust/credit lines and transaction history using just the ripple addresses of others. You'd just need to re-enter the contact names (perhaps recognizing your contacts by your current trust/credit limits and balances or perhaps needing to ask your contacts again for their addresses).


What is a cryptocoin made of? I want to know whether a cryptocoin is made of some piece of code or it is kind of a bill that says a person has transferred conceptual coin to another person when a transaction is published. If it is a piece of code, how it is made.

thank you.

A cryptocoin is a piece of information, like a text in some language.

What a cryptocoin says depends on conventions set by the cryptocurrency system, much like what a given text says depends on the language.

A cryptocoin is made by some piece of computer code, which has output it. It usually is not made of some piece of computer code, in the sense that a computer, interpreter, Turing machine.. could run it directly. It is fed as input to some computer code (e.g for validity verification, spending..).

How a cryptocoin is made, and what makes it valid, also depends on the cryptocurrency system. In decentralized ones, the making typically involves doing a large amount of arbitrary cryptographic computations.


Why does getdata have a field for the number of inventory entries? After a node receives an inv message, you can get the data for each tx/block hash using getdata:

  getdata - Request a single block or transaction by hash.

So if you can only get one tx or block at a time, what's the purpose of having a field in the getdata message for the number of entries you are requesting?

Field Size  Description   Data type   Comments
----------  ------------  ----------  -------------
?           count         var_int     Number of inventory entries
36x?        inventory     inv_vect[]  Inventory vectors

https://wiki.bitcoin.com/w/Network#Messages
https://en.bitcoin.it/wiki/Protocol_documentation#getdata

The documentation you are linking too is wrong, the bitcoin developer reference indicates you can send multiple inventories inside of a GetData message.


Reward schedule and maximum number of dogecoins? According to Dogecoin's bitcointalk-thread there will be a maximum of 100 billion dogecoins. Yet, just below that figure is stated that the reward schedule offers a reward of up to 1 million dogecoins for each of the first 100k block, which would amount to 100,000,000,000 doges already rewarded for the first 100,000 blocks. The subsequent next 500k blocks would up the total doges to just shy of 170 billion dogecoins.

It also states that there will be a constant reward of 10k doges starting with block 600,001.

This information is inconsistent and I am wondering, how the reward schedule is actually implemented:
Is there a maximum of dogecoins or will the amount continue to grow infinitely as suggested by the constant reward?

The Dogecoin reward schedule
I subsequently found the information that the Dogecoin reward schedule provides random amounts sized between 0 and a halving maximum for the first 600,000 blocks:

Block 1 — 100,000: 0-1,000,000 dogecoins
Block 100,001 — 200,000: 0-500,000 dogecoins
Block 200,001 — 300,000: 0-250,000 dogecoins
Block 300,001 — 400,000: 0-125,000 dogecoins
Block 400,001 — 500,000: 0-62,500 dogecoins
Block 500,001 — 600,000: 0-31,250 dogecoins
Block 600,001+: 10,000 dogecoins

The random reward amounts are dependent on the hash of the previous block. (H/T @JesseBusman)
How much?
At optimal random distribution, the first reward interval would provide 50 billion dogecoins. Altogether, the first 600,000 blocks would provide an estimated ~98.44 billion dogecoins, leaving another expected 156,250 blocks to be mined with the subsequent constant block reward of 10,000 doges per block.
How long?
As the block time is aimed to be 60 seconds, the reward is expected to halve every 69 days, 10 hours and forty minutes. At optimal block time, the last block with a reward would be expected after 525 days, or one year and 160 days.
Update: Flat 10k reward forever
On February 1st, 2014 the Dogecoin developers announced that Dogecoin would not be capped at 100 billion dogecoins after all, but would continue to have a flat 10k dogecoin reward for each block after Block 600,000.
While not hard-capped, a constant tail emission is predictable and disinflationary:


lightning network dispute costs I have some questions about Lightning Network.  I'm already banned from r/bitcoin so I'm posting here.  My first questions are about dispute costs:

Lets say I open a payment channel on the lightning network.  I need to have some balance in the channel, so lets say I have put in 1 bitcoin.  I make a purchase for .5 bitcoin.  There is then a dispute:  the seller is claiming my entire bitcoin from me.  Now what?

Per the whitepaper I can "dispute" this by broadcasting the transaction to the blockchain.  (Are there other options?)

1) Who pays for that, and how much?  Do I pay per bit whatever the market value is for block space at that time?

1a) With the claim on my entire bitcoin where do the transaction fees come from?

1b) What would prevent somebody from using this "pay to take it to court at auction prices" model as a denial of service or theft?  For example, a large actor opens many channels and funds them so they are used as hubs....then when well established he "outright disconnects" some large number of those channels.
Now there is very high demand for limited blockspace as everybody tries to dispute before the deadline.  What happens next?  What if there is so much congestion that disputes can not be made fast enough?

Either ELI5 or point me at the right page(s) and sections of the whitepaper.

Much appreciated,
Blade.

Who pays for that, and how much? Do I pay per bit whatever the market value is for block space at that time?

The fee for the commitment transactions is determined at the time of channel creation. It can also be updated. So when you broadcast the commitment transaction, the fee will already be set to whatever you two agreed to at channel creation.

The person who pays the fee is also negotiated at channel creation. The current specification says that the person funding the channel will be paying the transaction fees (currently only one party funds the channel).

  With the claim on my entire bitcoin where do the transaction fees come from?

There is no "claim on your entire bitcoin". The other party cannot claim your money unless you agreed to it by signing a commitment transaction. The merchant can only say "you owe me one Bitcoin" but nothing actually happens to the Bitcoin itself.

  What would prevent somebody from using this "pay to take it to court at auction prices" model as a denial of service or theft? For example, a large actor opens many channels and funds them so they are used as hubs....then when well established he "outright disconnects" some large number of those channels. Now there is very high demand for limited blockspace as everybody tries to dispute before the deadline. What happens next? What if there is so much congestion that disputes can not be made fast enough?

If the most recent commitment transaction is broadcast, there is no "dispute". It is just a normal unilateral channel closing and both parties will get their money eventually (the broadcaster must wait out the relative timelock).

If an old commitment is broadcast (and thus fraud is occuring), then there will be only two transactions for each channel closing ("disconnect") and revocation ("dispute"). The closing transactions need to be confirmed before the delay goes into effect. So if there is a shortage of block space, then not all of those closing transactions will be confirmed. When they do confirm, the other parties can then broadcast their revocation transactions and have those confirmed.

Furthermore, because the transaction fee for the closing transaction must be negotiated by both parties and the amounts can only be changed by both parties signing the transaction, the attacker cannot change the transaction fees. So the people broadcasting their revocation transactions have full control over their transaction fees, so they can increase the fee as necessary to have their transaction confirm faster.


Has there ever been a successful double spend attack on the Bitcoin network? If not, is it really necessary to wait for confirmations? There is a lot of concern about waiting for confirmations to avoid a double spend attack, but has there ever actually been a double spend attack?

It seems to be that there are two types of double spend attack.  One is perpetrated without a significant fraction of the network's total mining power.  In order to successfully perpetrate this the attacker must send both transactions nearly simultaneously.  If there is a significant delay between the legitimate transaction and the double spend then almost every miner will receive the legitimate transaction before the double spend.  The miners will reject the double spend, and the legitimate transaction will be almost guaranteed to be included in the next block.  Thus to successfully perpetrate this kind of double spend, the attacker must send out both transactions simultaneously so that half the network is working on one and half the network is working on the other.  However if they do this, then it should be easy for the payee to immediately detect and thus the payee can reject the payment within seconds.  Thus a double spend attack without a substantial fraction of the network power would not seem to be a problem--it is easily and immediately detected (or it will fail).

Thus, the only kind of double spend that is likely to succeed is one where the attacker controls a substantial fraction of the network power and can catch up from an initial handicap in block creation.  However, until such a double spend has been demonstrated it implies that no malicious entity has achieved control over a substantial fraction of the networks computing power.

Thus, if a double spend attack has never been perpetrated, everyday users transferring small amounts of bitcoins can be very confident that they will not be victims of a double spend attack (what are the chances of being the first?) and forgo waiting for confirmations.

(People conducting very large anonymous transactions on the other hand may be among the first people targeted by an double spender who has achieved a substantial fraction of network computing power)

Is that analysis correct?

For what it's worth, MyBitcoin.com claimed that their closure was precipitated by a series of double-spend attacks:

  Our programmer was under the assumption that one block was good enough
  to secure a transaction. Two years ago when the software was written,
  this single confirm myth was a popular belief.

User theymos (an administrator of the bitcointalk.org forums) had publicly warned them that accepting transactions after a single confirmation was "insane."

However, there is no way to verify whether or not any double-spend attacks have actually taken place because to my knowledge no one is currently scanning for them on the network (doublespent transactions are normally discarded after the event is resolved to the satisfaction of the block-chain).  All we can observe publicly are block-chain reorganisations which also naturally occur from time to time when blocks are found near-simultaneously by different miners or pools.  Perhaps a statistical argument could estimate how often these should be occurring (we've had 14 in the past month) and argue for the existence of double-spend attempts on that basis, but I've not personally seen such an analysis.

Most critically to your question about whether or not to wait for confirmation, however, is the fact that you have missed a possible attack vector, known as a "Finney Attack" after Hal Finney who identified it.  In a Finney Attack, a miner includes one "double" of the two transactions in their own blocks while mining, but does not broadcast it to the network.  When they eventually find a block, they purchase something with a conflicting transaction (the second "double" in the double-spend attack), and then immediately broadcast their block, which will invalidate the purchasing transaction in the blockchain.  If the merchant hasn't waited for confirmation, the attacker would walk away with both the purchased item (hopefully something cashlike) and their original bitcoins.

Since this situation and its variants apply largely to merchants who offer 'on-demand' items delivered instantly, your analysis of "everyday users transferring small amounts of bitcoins" remains roughly correct.  Keep in mind that if accepting 0-confirmation transactions became the norm, the incentive for the "send them simultaneously" attack would rise significantly (requiring even one confirmation prevents this in the vast majority of cases).  But for the time being, regular users should be more worried about regular old "you-pay-first" fraud on non-escrowed transactions, and man-in-the-middle attacks where an interlocutor passes messages between two trusted parties looking to do business, then walks away with the cash while they both yell that the other person is scamming them (this attack has been executed in the wild).

tl;dr Merchants and exchanges definitely need to wait for confirmations any time transactions are of significant value and/or in exchange for cashlike goods.  Individuals transferring small amounts need to be more worried about other aspects of trust in the exchange, and can protect themselves quite effectively with just a single confirmation.


Is it possible to run bitcoind without downloading the blockchain? I'm using bitcoind on a project, and I only need to send bitcoins to myself (from one wallet to another), so trust is not a factor.

That being said, is there a way to run bitcoind without needing to download the full blockchain?

Edit: I know Bitcoin-QT runs as "full node". Does bitcoind?

It isn't possible with the current version of Bitcoind, Bitcoin-QT is simply a GUI wrapper for Bitcoind so same applies for both.

If you need a wallet that doesn't download the full blockchain go with a thin wallet like Electrum. It does download block heards but that takes seconds. If you want to accomplish your project programmatically, consider the many libraries, such as Bitcoinj, Libbitcoin, and many others.


trying to get text of a field in json rpc 2.0 response into ar PHP variable I use json_decode to vardump a return which yields

array(3) { ["jsonrpc"]=> string(3) "2.0" ["result"]=> array(13) { ["status"]=> string(7) "Pending" ["amount (BTC)"]=> string(10) "0.05130899" ["index_url"]=> . . . . [more fields  here] . . .  ["address"]=> string(34) "1GHHojoC4Ai1SPMN3YoNzemLNaaj2XFHKc"

I am trying to fill a variable with the text from the "address" field and I tried

$result =  json_decode($response, true);
   $address = $result->address;

but a varbump of $addrwss is NULL

any other variant like $result->"address" or $result->["address"] is improper syntax

Can someone tell me how to get at the text of the address field of a JSON PRC 2.0 response to put it in a variable in PHP

To get the address you would do:

$result = json_decode($response, true);
$address = $result["result"]["address"];


Can I, and should I, verify bitcoin core source code before compiling it? If I use bitcoin core binary release I can verify them with the gpg keys of the core developers. Is there a similar process for the source code? A follow-up question: Is it preferable to use signed binaries or compile from source?

If you look at tagged commits on github, you'll notice they are also signed by the core maintainers keys, notice the "Verified" button, see bitcoin/tags and Github GPG Signature Verification.

You can verify the commits yourself if you've imported the signer's public key, see Verifying Tags:

$ git tag -v v0.17.0
object e1ed37edaedc85b8c3468bd9a726046344036243
type commit
tag v0.17.0
tagger Wladimir J. van der Laan <laanwj@gmail.com> 1538390952 +0200

Bitcoin Core 0.17.0 final
gpg: Signature made Mon Oct  1 04:49:17 2018 MDT
gpg:                using RSA key 9DEAE0DC7063249FB05474681E4AED62986CD25D
gpg: Good signature from "Wladimir J. van der Laan <laanwj@protonmail.com>" [unknown]
gpg:                 aka "Wladimir J. van der Laan <laanwj@gmail.com>" [unknown]
gpg:                 aka "Wladimir J. van der Laan <laanwj@visucore.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 71A3 B167 3540 5025 D447  E8F2 7481 0B01 2346 C9A6
     Subkey fingerprint: 9DEA E0DC 7063 249F B054  7468 1E4A ED62 986C D25D

  Is it preferable to use signed binaries or compile from source?

It depends on your situation, but most likely it will be easier to just use the compiled binary. If the binary doesn't work on your system, if for some reason your system is different enough, then compiling from source might be better. As long as you verify the signatures it shouldn't matter whether you run the binary or compile from source, the binaries are just provided for convenience.


Is there a limit to the number of Bitcoin addresses? Is there a limit to the number of Bitcoin addresses?
And if so, what stops someone from making all these addresses and holding the private keys for them so no one else can make a new public key?

Is there a limit to the number of Bitcoin addresses?

If I understand it correctly, there can never be more than 1461501637330902918203684832716283019655932542976 of the current type of addresses. 2160.

  what stops someone from making all these addresses and holding the private keys for them ...

Probably:

There aren't enough atoms in the universe to make a big enough computer.

There isn't enough time left in the universe before those atoms cease to exist.

  ..so no one else can make a new public key?

Other than the improbability of it occurring, there's nothing in the Bitcoin protocols or concensus rules that would prevent two or more people independently generating the same addresses. Any of those people could then spend any money sent to that address.

Which is to say, your bad-actor can't prevent anyone from generating an private-key a public-key or an address.


Could miners create a cartel to raise transaction fees? Could miners with enough mining powers (say >95% of all blocks) form a cartel where they demand absurdly high transaction fees? Of course, I still could could hope for a miner not in that cartel to relay my transaction for a lower fee, but in that case I couldn't be sure when my transaction gets paid to the adressee.

Is this a plausible scenario?

Miners have huge investments in hardware that can only be used to mine Bitcoins. They have no incentive to do things that reduce the value and usability of Bitcoins. Any "mining cartel" with the power to get 95% of the hashing power to take collective action in non-emergency circumstances would create enough fears about 51% attacks and the like that it would drastically reduce the value of the Bitcoin system and greatly encourage competitors. So while this is theoretically possible, it's unlikely in the extreme.


How to enable device in cgminer? I I have a GekkoScience Compac BM1384 bitcoin miner that I am trying to get working with CGMiner on my Raspberry Pi. It is really annoying though, as it doesnt detect any devices on startup. However, when I go into USB management and select I it lists my bitcoin miner and it says "inactive". But when I try to enable it it says "invalid selection'.

Any suggestions?
Thanks,
BytePhoenix

CGMiner doesn't come with support for that particular miner by default. I believe you have to get the driver for it. You can use bfgminer, which from 5.3.0 supports your miner out of the box.

Instructions from https://bitcointalk.org/index.php?topic=1173963.0

  The stickminer will enumerate as an antminer U3 on cgminer (if the version of cgminer you're using supports the U3), and should run fine.  It may give warnings about "no valid hashes within 3 seconds" but this is fine, as the U3 has a higher hashrate, confusing cgminer but not noticeably affecting performance.  If your hardware errors are low you're fine.  These older version of cgminer do not allow a clock rate over 250MHz.  This is pretty good for most people as that's moderately high power but in theory the chips will run up to 500MHz.

  Luke Jr added bfgminer support in bfgminer 5.3.0, so you may use that
  version of bfgminer.

  I (novak) have written a cgminer driver which enumerates the compacs
  as expected, removes the error, and ramps up the clock slowly to
  prevent spikes on USB power.  My custom cgminer can be found here:
  source code: gekkoscience.com/misc/cgminer-gekko.tar.gz win32 binary:
  gekkoscience.com/misc/cgminer-gekko-win32.zip EDIT: The current
  version supports bitshopper compacs as well, and can be (and is, in
  the case of windows) compiled with icarus support.

  I have not yet tested it but edonkey was nice enough to upload a
  custom minera image with cgminer-gekko enabled as a custom miner.  You
  can set the frequency under manual options as: --compac-freq 150.
  Link:
  https://dbtbmm05cubzd.cloudfront.net/cryptocurrency/mods/minera_compac_mod.zip

  On the engineering sample sticks you can only use old cgminer as the
  newer drivers for both cgminer and bfgminer depend on a hexfile
  flashed to the cp2102 which the engineering samples do not have.

  If you need to run cgminer on windows (either stock or mine), you'll
  need to install the zadig driver.  You can find it here:
  http://ck.kolivas.org/apps/cgminer/zadig/

  Run the program and install the winusb driver for the compac(s) that
  you have plugged into your windows machine.  You may need to replug
  the compacs afterwards while cgminer is running to get them to start
  mining.

  =========

  =How to Run=

  Old cgminer: To build use --enable-icarus flag.

  ./cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u

  1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr --au3-freq 150

  GekkoScience cgminer: To build use --enable-gekko flag.

  ./cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u

  1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr --compac-freq 150

  bfgminer:

  ./bfgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -O

  1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr --set compac:clock=x0b83


How Does trading on the Exchanges Work? Pardon my Ignorance but can somebody explain the basics

Of how trading (Bid Buy/Bid Sell) works of the common exchanges

www.mtgox.com
www.btc-e.com

Aslo some of the common ways people or conditions suppress or raise the price of LTC & BTC

Thanks In Advance

Currency exchanges are implemented through programs called order-matching engines. When a new order is entered, a buy order for example, the matching engine checks to see if there is a match on the other side, a sell order at the right price.

Bid is the price a user is willing to pay and Ask is the price at which a seller is willing to sell. The difference between the two is called the spread. Most exchanges try to minimize the spread. The price often quoted is midway between the highest bid and the lowest ask.

Here are some examples of matching engines: https://github.com/jordanbaucke/Limit-Order-Book


How are difficulty level and block reward determined and stored in decentralized fashion in Bitcoin? I know the difficulty level and block reward are periodically adjusted in Bitcoin to keep the block time approximately to 10 minutes.

I guess these are not determined by a central authority but rather are determined in decentralized fashion. If so, what are the exact steps involved here? Each node independently computes on their own, propagates and will it be verified?

Each node independently computes it on its own, following the formula:

At every block n with n beingg a multiple of 2016, look at the time stamps of the past 2015 blocks, and change the difficulty for what follows to old_difficulty*(2 weeks)/(time the past 2015 blocks took)

Each node does that calculation to make sure that any new block it finds will have sufficient difficulty in order to get accepted by other nodes on that network. This is all about how Bitcoin is kind of self-organized. A node can find a block with too little difficulty, but that will be next to useless as this block won't get accepted into the chain.


I received multiple transactions at one address, but may have screwed up wallet. Not sure what my options are. Some years ago, as an experiment, I took part in a mining pool and received a number of Bitcoin payouts, all to the same address. Then I stopped mining. I didn't spend any of the balance I had accrued.
However today for the first time in years I decided to fire up my wallet software and after sync'ing (yes, it took ages!) it appears to have zero balance.
I can look on https://blockchain.info at the receiving address I'd originally used and see all the payments that took place originally, with the total value that I expect. But somehow it looks as though I've screwed up whatever connection there was between these and what I thought was my wallet.
I'm completely lost in the complex world of blockchain, wallets, addresses, keys etc. I thought I had all the info I needed to 'prove my ownership' of these Bitcoin payments I'd received, but clearly something's missing in what I've done.
Can anyone suggest a way that I can 're-acquire' these payments somehow?
Apologies if the terminology I'm using isn't entirely appropriate - I seem to have forgotten whatever little I once knew about Bitcoin :(

If you do not have your private key for address you must forget about Bitcoin at all and use your national currency only. Point.

Bitcoin stands for "be your own bank". You are too dumb to understand it for serveral years.


BIP39 Path in Ledger Nano S On a Ledger Nano S, you are given a BIP39 24 word mnemonic. What is the path to the address used? Is it m/44'/144'/0'/0/0 ?

Say for example I use the address generated by the Ledger Nano S to store ripple. But then I lose the device. I can generate an infinite number of addresses from the mnemonic, but I'd like to know which default path address holds the tokens.

Ledger Nano S supported path is: m/49'|84'/0'/0'.
Source: https://walletsrecovery.org/


How to get my bitcoin back I have copied and sent bitcoin to the address that I have found on my blockchain wallet only to find out its not mine. So is there anyway I can get my bitcoin back?

Unfortunately, there is no way to get it back.  Once it is sent and confirmed into a block, it is permanent.
Best hope is that the address belongs to someone and they send it back thinking it was a mistake.

Sorry


How a web-service like bitnode.earn can know each node's blockchain height? How a web-service like bitnode.earn can know each node's blockchain height?

We can get some information of each node in bitcoin network in this web-site:
https://bitnodes.earn.com/nodes/

And, it is updated regularly(in approximately every 5 minutes).

My question is from here.
How(the method) the web-service can get all the information from all the nodes in the network? They ask those information to all nodes in every 5 minutes? Doesn't it take quite long time to get the responses from all the nodes(about 10K nodes in the network)?
Also, doesn't it required to be in peer-relationship with all of them to request those information?

I'm waiting any answer from you guys.
Thank you in advance for your nice answer!

Sites like bitnodes run their own lite nodes which are crawlers. These nodes connect to other nodes and only receive data from those nodes. When a node receives a new block, it will send it to the nodes it is connected to. If one of these is a bitnodes crawler, it can record that it received a block at height X from the node. In this way it can track the current height of a node.

Furthermore, nodes send their current height when they connect to another node. The crawlers, if they happen to disconnect from a node, can quickly retrieve the latest information about the node once they reconnect by simply waiting for the version message which must be sent in order for the connection to continue (it is part of the handshake at the start of every connection). The version also contains other information such as protocol version number and user agent string.

Other metrics such as up and latency come from the fact that the crawlers have open and active connections to those nodes. The fact that they have a connection means it is up. They can use the ping message to measure latency.


Bitcoin security, what is wrong with my thinking? Lets assume I keep generating random public keys with their matching private keys and never use them.
Severals years later I am checking for positive match against the blockchain for all my generated public keys.
If a match is found that means someone is actually using a public key I generated in the past and for which I know the private key.
I should then be able to gain control over someone else wallet even in the case of a paper or brain wallet.
Best regards,

Thats right, if you got the private key you got access to the bitcoins on it. You dont even need to wait until someone starts using this key, you could also randomly find a key which is already in use by someone.

BUT:
Bitcoin addresses are 160 bit hashes of the 256 bit private keys, so there are 2^160 or about 1.460.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000 possible addresses. You will notice thats the possibility is pretty much nil.

For more information you can read this article: http://www.miguelmoreno.net/bitcoin-address-collision/


Can I win some money mining bitcoin with an old computer I went to nicehash.com, a website that allows users to mine bitcoins.

I have my old computer on the side, it still work perfectly, but it's pretty slow. I could use it just for the fun of trying, if I win 50$/month I'm happy.

So I'm wondering, if I try to mine bitcoins, will I win a little money or will I lose some ??

I see 2 ways of actually losing money:

-if my computer is up all day, it will use electricity. If I never get paid, then I lose money in global.

-if my computer dies, I have to buy a new one.

So the two questions are: will I ever get paid, and how much ?

For the first question, I read somewhere that for each new transaction, several computers are ask to do so calculus, and the fastest computer often wins. The computer that wins get paid, the other are not. Is it exact ?

Thank you guys !

The short answer: No, you cannot. Sorry.

The longer answer can be found here: https://en.bitcoinwiki.org/wiki/Difficulty_in_Mining#How_soon_might_I_expect_to_generate_a_block.3F

Applying some common sense: If an old computer could mine for 50 USD / EUR / GBP per month, what do you think how many old computers would your neighbor have bought already and was running in his garage?

Bitcoin mining is only possible on specialized hardware these days. Your milage may vary on very, very recent high end GPUs, but this is far from an old unused PCs CPU power.


Where is the Coin in the Transaction Hash Chain? In Satoshi Nakamoto's diagram:

I see a Hash in each transaction block. It would be interesting to see the first block in the chain--it isn't shown. I say that because I do not see anything that references a digital coin. Presumably, if I were to go back to the original transaction block (let's assume that it's a coinbase transaction--one that received, say, 25 bitcoin from a mining effort)--is the Hash for that first transaction block simply a bitcoin address hashed with the next owner's public key? If my newbie question is too off-base, then my real question is: Where is the coin in the diagram above (I understand that coin transactions result from inputs and outputs, but to keep things simple, the "coin" I'm referring to would have only one input and one output--I am trying to track a single digital asset using the diagram above, so it's okay to abstract the "coin" into a single hash for the sake of explanation)? Is the "Hash" effectively the "coin"--and to see the original coin's address, you would need to see the first block in this transaction hash chain--is that correct?

Where is the coin in the diagram above

Nowhere really.

The "Transaction" part contains information about the movement of coins (or rather of fractional values). It doesn't really contain a coin.

To work out where the coins are (notionally), you read all the transactions in all the blocks since the first one and see at which addresses everything ended up.

It's like the paper pages of an accounting-book that keeps track of the movement of conch shells, except there are no actual conch shells. Certainly you won't find any conch shells in the accounting book. Bitcoins are imaginary conch shells - they don't actually exist anywhere¹.

No actual gold coins to be found in between the pages of this ledger

Footnotes:

Also true of USD really. Greenbacks are just pieces of paper that are part of a distributed accounting system.


Trying to remember email I have a 12 word passphrase and password from blockchain.info.  Trouble is that I can't remember the email I used.  Is there a way to retrieve the email with these two pieces of information?

If you have your 12 words phrase from blockchain.info you can just restore your wallet, then you will use a new email and new password.
To restore your blockchain.info wallet:
1 - Go to: https://login.blockchain.com/#/login
2 - Click on Need some help?
3 - Click on Recover Funds
4 - Use your 12 word phrase, lowercase, with spaces between each word.


Do miners mine their own transactions or submit them to the network? I am wondering how miners are behaving toward their own transactions. Do they send their own transactions to the mempool or can they process/confirm them directly?
I am assuming that the miners are interested or involved in sending and receiving of the bitcoins as well.

I suspect that miners submit their own transactions to the network like other users, but that they may prioritize them in their own blocks beyond what their feerate would merit.
The blockspace is limited to 4,000,000 weight units. Generally, miners simply fill it with a selection of transactions that optimizes for highest total transaction fees collected. Including their own transactions displaces other transactions from their block. If the displaced transactions paid a higher feerate than their own transactions, the opportunity cost of not collecting those fees should be equal to what would have been enough to get their transaction into another miner's block. Nobody can predict when exactly a block will be found or by whom. By submitting the transactions to the open network at a competitive feerate, the miners can get either quicker confirmation times (because any block will include the transaction, not just their own), or signal lower priority than the transactions they would currently include in an optimal block.
I would not be surprised if some miners included their own transactions in their blocks regardless of the feerate, though. It may even make sense to attach a competitive fee even when miners include their own transactions, because the transaction fee can be accounted for as a business cost, which is a bit harder to do for an opportunity cost.


can i send Bitcoin directly from my coinfloor exchange wallet to my binance exchange wallet? something in their small print about not being able to send to 'third party wallets'...ideally want to send direct without going through a separate wallet first to save transaction costs and waiting times etc..

Mark Lamb from Coinfloor here. Yes you can do this. That text is only relating to third parties wallets that are not owned by you.


retrieve all the transaction between two addresses I've used this query to try to get all the transaction between two addresses:

https://blockchain.info/multiaddr?active=1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm|1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ

but the thing is- according to my wallet there are many more transactions that aren't appearing in the json result here.

Why is that?

How can I see actually all of the transactions?

I though maybe blockexplorer would be better than blockchain.info, but actually- not so.

They have it as this:

https://blockexplorer.com/api/addrs/1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm,1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ/txs?from=0&to=50

perhaps it would be better to just query by txid?

I don't believe you can do this with just a single API call. I'd return all the transactions from one of the addresses, and cycle through all the inputs and outputs and if they match the other address then show the tx data.

Not sure which language you're using but the logic should be the same.

<?php
$addr1 = "1EipJdYVJbqsTSQhj1icK424AkMbyjvgBm";
$addr2 = "1LWwLvKWbcpiZYqCcwfuQ3gjjNJkxftmEJ";

$url = "https://blockchain.info/address/".$addr1."?format=json";
$fgc = json_decode(file_get_contents($url), true);

//num of txs
$txs = count($fgc["txs"]);

//loop through all txs
for($i=0;$i<$txs;$i++){
    //check all inputs & outputs for the other address
    //inputs
    $numinputs = count($fgc["txs"][$i]["inputs"]);
    for($ii=0;$ii<$numinputs;$ii++){
        if($fgc["txs"][$i]["inputs"][$ii]["prev_out"]["addr"] == $addr2){
            //found a corresponding tx
            print_r($fgc["txs"][$i]);
        }
    }//end inputs loop

    $numoutputs = count($fgc["txs"][$i]["out"]);
    for($iii=0;$iii<$numoutputs;$iii++){
        if($fgc["txs"][$i]["out"][$iii]["addr"] == $addr2){
            //found a corresponding tx
            print_r($fgc["txs"][$i]);
        }
    }//end outputs loop
}

?>

http://phpfiddle.org/main/code/8imw-ardy


Where does the random number come in to play when signing a transaction? Just given all the news about this topic lately (Android security flaw), I'm curious about WHERE and WHY the random number is used during the signing of a transaction.

I always thought a transaction was signed by just hashing the prev_out** and then encrypting that hash with the private key, so when it is published along side the public key it can be verified by other nodes.

**(maybe I need more clarity here too: is the ENTIRE previous transaction  hashed at this point, or just one the input being used in the prev_out?)

This is a common misunderstanding. It just so happens that signing with RSA is the same as encrypting with the private key. But this is a quirk of the RSA algorithm. Bitcoin doesn't use RSA, it uses ECDSA. DSA is strictly a signature algorithm -- it has no encrypt operation at all.

The ECDSA signature operation, like the DSA signature algorithm, requires a random value in order to generate a signature. The signature consists of two derived parameters that can only be generated with the private key but that can be verified without it. The relationship between the derived parameters depends on the message, so the message cannot be altered.

Sadly, if the same random value is used for two signatures, the private key can be derived from the signature.


If the top 6 mining pools started mining empty blocks, what would happen? I read that it was possible to mine empty blocks, so that miners can still earn when there are no transactions in the network.

What would happen if the top mining pools started mining empty blocks alone, stopping all transactions from being processed?

There would be a lot of empty blocks and the number of unconfirmed transactions would increase dramatically. But at the same time, miners who are including transactions in their blocks will start being paid more and more. Those miners including transactions in their blocks will be able to collect all of the transaction fees that are being paid. Because the number of transactions that can be confirmed in a given amount of time has significantly decreased, people will begin paying more and more in transaction fees in the hopes that their transaction gets selected. So the miners who are still including transactions are going to get paid even more than they were before.

This scenario is unlikely to happen, or if it did, it would not last long. Bitcoin's incentives structure makes it so that miners will want to include transactions in their blocks. Otherwise they will be missing out on money that they could be earning. We expect miners to be greedy (after all, most people want to have more money) and them being greedy is exactly what maintains the network.


Error message in cgwatcher with intel hd graphics 4000 The error message is :  "the miner path for the active default profile (chemin vers cgminer.exe) does not exist. You must set the miner path before you can start mining. Click the manage profiles button in the settings tab to open the profile manager, where you can edit the profiles miner path".

I am using windows 8 with intel i7.

What can I do ?


Withdraw and wallet lock race conditions? I'm working on a site that has wallet-like functionality in ruby/rails. I'm wondering the best way to process withdraws. My first inclination is to do something like this:

def process_withdraw
  client.wallet_passphrase(ENV['wallet_password'], 10) # unlock the wallet for 10 seconds
  client.send_to_address(address, amount) # send coins
  client.wallet_lock # re-lock the wallet
end

However, I'm concerned that with many concurrent withdraws I could run into race conditions. For example, if "Process A" unlocks the wallet and sends coins, but then "Process B" jumps in and unlocks the wallet but before it can send coins, "Process A" locks the wallet. So when "Process B" tries to send, the wallet is locked.

Is this a legitimate concern? Do I need to re-lock the wallet or is it safe enough to just wait for the 10 second timeout? Is it worth writing some sort of queue system for my client?

Thanks a lot in advance!

If the wallet unlock is global (that is, it affects a wallet that exists outside the method, which it clearly does), then yes, that is a race condition. Generally, this is handled with mutexes. A mutex provides "mutual exclusion", that is, only one thread of execution can enter an area protected with the mutex.

From a software design point of view, forcing everything that calls the send_to_address method to do so in a mutex is very bad design. It seems you should make a wallet class that encapsulates all the functionality you need to perform on wallets that manages the locking/unlocking of the wallet inside the class.


When or how does one becomes a part of Bitcoin P2P network I am new to bitcoins and got a question raised in my mind recently. I learnt that every person doing a transaction is a node in btc p2p network and that when he/she joins the network he/she gets a full blockchain starting from the genesis block. But can anyone tell me that in reality am I becoming a node while I am registering myself on a trading site like Zebpay, Koinex or IQ Option. If so then how can I see the blockchain I have received.

When you sign up for a wallet or exchange site, you are not becoming a node on the network.  You are using a site that already runs several nodes on the network, and you are trusting them to send and receive transactions for you.

To actually join the network, you need to run your own node.  This can be a full node or an SPV node, but the point is you are running it yourself.  Otherwise, you are using a 3rd party to connect to the bitcoin network on your behalf.


bitcoin-cli getnewaddress can i customize my address start through getnewaddress?

for example instead the address start with 1asdjIOAWJRA

i write getnewaddress 1xxxx then it continues as it wish

also what's the difference between addresses starting with 1 and addresses starting with 3?

can i choose from bitcoin-cli to get my address starting with 1 or it must be random and can be started by 3 while i dont wish that?

the reason of the need to customized addresses to make sure that it really creates this offline addresses instantly and is not in a hidden database installed while installing the bitcoin-cli

That is called a vanity address, and Bitcoin Core does not support generating vanity addresses. In order to do that, you would have to find a vanity address generator (separate piece of software). But then, you have to audit the code to make sure it is not doing anything funny with your private key. Bitcoin Core is open source, so you can audit the code that generates the keys if you want.

The address prefix denotes the type of script the address encodes. A bitcoin address that starts with a 1 is a Pay-to-Pubkey-Hash address, and a 3 is a Pay-to-Script-Hash. See Address Prefixes

You can change the type of address the cli generates by passing an optional argument to getnewaddress see RPC Docs - getnewaddress:

bitcoin-cli getnewaddress "label" "address_type"

address_type options are "legacy", "p2sh-segwit", and "bech32"


How does one find places that accept Bitcoin in the US? How does one find companies or stores that accept Bitcoin in the US?

The Bitcoin payment service provider BitPay claims to have 20,000 merchants, both online and physical (brick and mortar), that accept Bitcoin on their system. They have a directory of companies here: https://bitpay.com/directory#/ but they are certainly not the only payment services provider.

http://coinmap.org/ has a list of almost 5000 brick and mortar locations that accept Bitcoin (not tied to any particular payment service provider).

Interestingly enough, just yesterday Yelp.com officially announced a new feature that allows businesses to specify whether or not they accept Bitcoin! This means that soon the Yelp API will also become a very valuable source of Bitcoin acceptance information.

Major retailers like Overstock.com and TigerDirect have also began accepting Bitcoin!


BitcoinJ encrypt message I came across this in the source code for ECKey.java:

"Represents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption."

Why can you not encrypt with it? It would be useful to be able to do that, for instance you could write a message to someone that only they can read. Is it a fundamental problem or simply a matter of man hours to implement it? (I'm happy to write it if it's possible.)

Here is the quote you're referring to (link)

/**
 *
Represents an elliptic curve public and (optionally) private key, usable for digital signatures but not encryption.
 * Creating a new ECKey with the empty constructor will generate a new random keypair. Other constructors can be used
 * when you already have the public or private parts. If you create a key with only the public part, you can check
 * signatures but not create them.

 *
 *
ECKey also provides access to Bitcoin-Qt compatible text message signing, as accessible via the UI or JSON-RPC.
 * This is slightly different to signing raw bytes - if you want to sign your own data and it won't be exposed as
 * text to people, you don't want to use this. If in doubt, ask on the mailing list.

 *
 *
The ECDSA algorithm supports key recovery in which a signature plus a couple of discriminator bits can
 * be reversed to find the public key used to calculate it. This can be convenient when you have a message and a
 * signature and want to find out who signed it, rather than requiring the user to provide the expected identity.

 */

This library implements ECDSA is Elliptic Curve Digital Signature Algorithm, hence you can only sign/verify with this algorithm.
ECDH is Elliptic Curve Diffie Hellman and can be used to share a secret
key between two parties.

ECIES is Integrated Encryption Scheme which mix EC and AES, but it is
not implemented in OpenSSL (the core Bitcoin crypto library) nor the one you reference.

More details on these algorithms on wikipedia ;)

In conclusion, with ECDSA you can only sign/verify, you may encrypt
mixing ECDH to generate keys and AES to do symmetric encryption (even at
command line: look at ecparam, ecdh, enc), or you may use ECIES but you
need a different library.

On a related note, this guy seems to have re-invented ElGamal encryption using ECDSA but I haven't looked into his code at all.


BIP 100: What votes are possible? I understand that, with BIP 100 as suggested by Jeff Garzik, in the first step the maximum block size can be increased from (then, after the hard fork) 2 MByte to at most double of that, so 4 MByte - without a hard fork. Depending on the miner's votes (counted for 12.000 blocks, 75% majority necessary) the block size may be increased further.

How can I, as a user start the voting process? What if I'm a miner? How do I determine the new maximum block size? Can two votes for 3 MByte and 4 MByte run in parallel?

Gregory Maxwell in IRC:

  the scheme would have the pariticiants specify the size they want, and
  at the end the period the smallest 25% would be tossed and the
  smallest remaining would be used.

So in each block there would be a field, initially set to 2 MByte. A miner is free to set any value (up to 2x the current limit).
Assuming we have the following values set in the last 12,000 blocks:

20% 2 MByte
20% 3 MByte
60% 4 MByte

Then, because only 60% want 4 MByte but 80% agree to have 3 MByte, the limit is increased to 3 MByte.

There would be a new vote every 12,000 blocks, and a decrease also would be possible if that is what the miners want.


How to convert Satoshi to bitcoin? hi people just i am join on this site.can anyone Help by telling me how to convert Satoshi into bitcoin?

Satoshi is simply a denomination, not a different currency.

1 BTC is comprised of 100000000 Satoshi, similarly to how 1 dollar is 100 cents.

To convert between them, all you need to do is multiply or divide by 10^8.

For example, 1 BTC is 10^8  * 1 Satoshi. Similarly, 10000 Satoshi is equivalent to 10000/10^8, or 0.0001 BTC.


Transaction records? Can you track your payment if you do a transaction from person to person for a house rental if the seller doesn't follow through with their end of the deal and doesn't send the keys can you get your money back?

Or in other words is there a record of your transaction so you can claim a dispute or track down the person who didn't follow through?

What safety do i have in this aspect for example i am applying for  rental house but i found out they're in the states and I'm in Canada so they have to send me they keys but they want the payment first through btc wallet so if i do this and send the bitcoins and he doesn't send me the keys and i find out it was a scam is there a way for me to recover my payment?

Can you track your payment if you do a transaction from person to person for a house rental if the seller doesn't follow through with their end of the deal and doesn't send the keys can you get your money back?

You can view your transaction's status on a block explorer or your own node, if yu have one. You cannot get the money back unless the other party explicitly sends it back to you in a new transaction. Bitcoin transactions are irreversible once confirmed.

  Or in other words is there a record of your transaction so you can claim a dispute or track down the person who didn't follow through?

Bitcoin is a decentralized system. There is no one to file a dispute with.

  What safety do i have in this aspect for example i am applying for rental house but i found out they're in the states and I'm in Canada so they have to send me they keys but they want the payment first through btc wallet so if i do this and send the bitcoins and he doesn't send me the keys and i find out it was a scam is there a way for me to recover my payment?

Usually, for such transactions, you would utilize an escrow service that only releases the BTC to the seller after you have received what you paid for. You should ask the seller to use a reputable BTC escrow (there are a few on Bitcointalk). If the seller refuses, you should proceed with caution, if at all, as many people are scammed by such offers.


Is it possible to mine empty block without downloading entire blockchain? As far as I can understand, whole blockchain is required for verifying and discarding double-spend transactions. Also, mining empty block is accepted by bitcoin's blockchain protocol.

When we want to mine empty block, we don't need to validate transactions, because there are no transactions (except block reward) in our empty block. Is it mean, we don't need to download entire blockchain for mining empty block?

Yes. The only things you need to create a block are:

Hash of topmost block
It's height


How does one reference an unspent transaction output? In a bitcoin transaction the previous unspent transaction outputs are referenced.

How are these referenced?

  Do outputs have unique reference or maybe as

  unique transaction reference X output recipient's address (its public key)

Each transaction output is uniquely identified by an outpoint. Outpoints consist of

txid: The unique transaction ID of the transaction that created the output. The txid is the 32-byte sha256d hash of the transaction.
index: The output index (vout) that marks the position of the output in that transaction. The output index starts counting at zero and is a 4-byte unsigned integer.

As an arbitrarily picked example, the outpoint

e06a3193c6ac49b8dd862baf9bd3561ffe86d65b6e8a9e73ebe1dc91e3ca2978:1

refers to the second output of the transaction e06a3193c6ac49b8dd862baf9bd3561ffe86d65b6e8a9e73ebe1dc91e3ca2978 worth 0.001 BTC which was sent to address 1La27vpuDDr9NR1aZ6GpxoJyNYmHT62nRb.