Really are Bitcoins untraceable? Usually, when some bad guy do something, he requests a payment using Bitcoins. Given that the demanded payment is not common, wouldn't be easy to trace the attackers when they retrieve the money back? Assuming that the bad guy wants to retrieve all the money.

For example:

A) X requests 1000000 BTC.

B) Y is monitoring all transactions and notice about a payment of 1000000 BTC to qwerty

C) Y reports to all banks about the address qwerty, as it looks suspicious due to that recent income.

D) X goes to Z to withdraw the money, but as Z knows about that address, it blocks the funds and call the police.

All bitcoin transactions are actually traceable by protocol definitions. Basically the blockchain is a long list of all the transactions throughout the history of bitcoin. The problem arises when trying to pinpoint who owns the address the transactions are being sent to. You can create as many BTC addresses as you want. Also with services like coin join and tumbling you can make tracing the coins much harder. Basically what your saying is possible but there are ways to easily mitigate any tracing being done.

The "bad guy" requests payment to a certain BTC address, they then tumble the coins through multiple intermediary addresses. At this point it's pretty hard to trace where the money actually ends up. Tumblers have built in features that convert a 100 BTC transation into multiple 10 BTC transactions that all end up at the same address in the end, making you tracking idea much harder. They also have features to delay a transaction making it harder to trace on the way out since you are expecting the transaction to happen immediately and instead it was delayed by a random increment of time. Tumblers also institute a random fee usually varying from 1-3% meaning the value coming out of the tumbler is not going to be easily traced to the value going in.

Wallet (A) is sent 100 BTC
Wallet (A) tumbles 100 BTC over 10 transactions of 10 BTC increments to wallet (B)
repeat until satisfied.

Since the attacker can create as many BTC addresses as they want they can easily hide the trail of where the BTC is being sent.

Basically bitcoin transactions are traceable, there are just ways to make it not worth attempting to trace.


How in laymans terms do I restore a .dat BTC backed up wallet file on my mac please? the bitcoin wallet backup.dat file is in my documents
but I'm not an advanced computer user
I have the complete bitcoin qt on my computer but don't know how to restore from the backup

Close Bitcoin core so that the program is not running.
Go to /Users/{yourusername}/Library/Application Support/Bitcoin/ and there you will see much of the blockchain data, and a wallet.dat file.
If there is a wallet.dat file here that you also need, save it elsewhere by copying and pasting.
Put your backup.dat in this directory, and rename it to wallet.dat.
Start Bitcoin-QT with the -rescan option so that it will go and look for any coins that your received in the blockchain.

That's it!


Is bitcoin arbitrage profit varies with BTC market price? Consider the following scenario,

I have 365 USD in Btc-e and 1 BTC in Cryptsy, now I bought 1 BTC at a price of 362 USD in Btc-e and sell it on Cryptsy with 370 USD, now I made the profit of 4 USD (included txn fee), now the current market price of 1 BTC is 370 USD

Market price I mentioned was 1 BTC = 360 USD

How the market price affect my profit?
Still I have 8 USD profit in Cryptsy or I made a loss/profit with respect to market price?

If you want to make money on arbitrage like this, you should have reserves on both exchanges, and at the moment when you are buying in btc-e, you should sell at cryptsy (for example). Otherwise te price can change to "wrong" direction when you are transfering bitcoins from btc-e to cryptsy or vice versa. Also, you should understand how to withdraw/deposit fiat to this exchanges fast with minimal expences, that can be the biggest issue especially for btc-e.


How can anonymity and uniqueness be achieved in the blockchain? How We Use Elliptic Curve Cryptography
At Follow My Vote, we use this technology to create votes. During the registration process, voters create two ECC key-pairs. The voter reveals her identity to a verifier, who certifies the first key-pair (the identity key-pair) as belonging to that voter, then the voter anonymously registers her second key-pair (the voting key-pair) as belonging to one of the identity keys, but the way this is done, no one can determine which identity key owns her voting key. She can then create transactions which state her votes on the contests in an election, and use her voting private key to sign those transactions. Once these are published, everyone participating in the Follow My Vote network can verify that the signature is valid and adjust the tally accordingly. This way the votes are public and anonymous, but each voter can verify that her vote was correctly recorded and counted. Furthermore, all participants can verify that none of the votes were tampered with by validating the signatures. In this way, Follow My Vote software performs transparent, end-to-end verifiable online elections without compromising on security or voter anonymity.

In particular, my doubt is about the selected phrase: "no one can determine which identity key owns her voting key."

I think the best way to interpret the sentence is that the voter can cast her vote anonymously and she can also verify that her vote was tallied.

This has less to do with the blockchain than just end-to-end verifiable elections. A simple example of such an election is the ThreeBallot system.


Energy to confirm one block? What is the minimum energy (or CPU operations) required for someone to confirm one block on their own, to launch a double-spend attack?

How can I calculate this from the current difficulty or hashrate?

There is no minimum. In theory, you could find a valid block on your very first attempt. The best we can do is an average.

Here's the average energy required to find one valid block using CPU mining:

  average energy required = difficulty * 232 / 2*10^6 * joules

Or, at current difficulty, 1.018×10^14 joules.

Explanation:

  difficulty * 232

The average number of hashes to find a block.

  2*10^6 * joules

According to the Bitcoin wiki, the typical mining efficiency for CPUs is 2 Mhash/J.


Getting insufficient funds when trying to send from a watch only wallet on blockchain.info android app i currently have stored some btc on a paper wallet and have it as watch only on my blockchain.info account. now when i tried to send it out from the paper wallet, i'm getting an insufficient funds error. anyone know what this could be caused by?

also since i have it as a paper wallet and i can see the funds are still there via the blockchain. how can i import it into something else more secure?

Obviously you can't spend funds from an account you added as watch only. You'll need to import the private key into the tool of your choice. Note that as soon as you do that, it ceases to be a paper wallet. So you should only do that when you're ready to spend/destroy the paper wallet.


What happened to bitcoin-24? As per subject. It has been down for some days, apparently due to bank problems of the owner(s):

  Our Service is momentarily not available.
   1. All funds (EUR, USD, PLN, GBP & Bitcoins) are safe.
   2. All withdrawals will be gradually processed chronologically from another bank account.
   3. The Polish authority closed our Bank account in Poland.
   4. Our lawyers are working with high pressure on a solution.

  We will back with Bitcoin-24 2.0 on when all declarations are
  finished.

  All important Emails can be send to help@bitcoin-24.com

Doesn anyone have more information?

From the website:

Update 28. April
BTC withdrawals are now enabled.
All withdrawals will be done manually within 24 Hours.

Your password must be reset with the following link: reset password

For support please use our Ticket-System


What are the limits of ASIC Mining? My assumption is that ASIC miners optimize for the "hashes per joule" metric, as did GPU miners over CPU miners.

It would seem that after some time, the decision to mine Bitcoins would be based on if you could source energy cheaply enough.

When do we reach that point?

I'm not a hardware guy so I'm curious to understand what the upperbound limits are of ASIC mining from a technical perspective. How much more can we optimize?

Thanks!

I'm not an expert, but as far as I understand it, Moore's Law applies to ASICs just like other chips. So, every two years you get newer ASICs which can hash more, even though the chip design is not all the different from the previous ASICs, the number of transistors that chip has on it is doubled.  So, there is always going to be a cost of keeping up with the latest chips. This is part of what prevents a 51% attack, since there are literally not enough ASICs is the world for one big bank or something, or one scammer, to buy them all up to mine with.  World BitCoin Network on YouTube goes into this in more detail in the 51% attack video.

Moore's Law isn't going to hit a limit in the near term, since when we get so small we are on the scale of just a couple of atoms, we will just start stacking chips on top of each other.  Itel is already researching liquid cooling between chip stacks.  So, for the forseeable future, Bitcoin mining is not just going to be a function of cheap energy, or optimized chips, but the financial treadmill of buying new ASICs every two years.


Is there a way to identify exchanges in the blockchain? Is there a way to identify transactions that occur on exchanges (such as Mt. Gox) in the blockchain?

To expand a bit on the above answer, blockchain.info provides information about several APis and exchanges here:
https://blockchain.info/api/3rd_party_apis


Is there a Blockchain per bitcoin wallet? According to this article "A gentle introduction to bitcoin", it looks like a blockchain is created per Wallet.

Is this correct or am I misunderstanding it? If my assumption is not correct, what determines when to create a Blockchain?

"The blockchain" is the universal list of all Bitcoin transactions that have ever been confirmed.

A new wallet doesn't "create" a new blockchain.  Rather, it downloads a copy of the existing universal blockchain.  It does create some new files on its own computer to store the data it downloaded, but the data itself isn't new.

(This assumes it is a "full node" wallet.  "Thin" or SPV wallets don't download it; they rely on other nodes to tell them what transactions already exist.)


Bitcoin Mining Computational Power 1/ I do not understand why bitcoin mining is random when hashing is deterministic.
reference : https://en.bitcoin.it/wiki/Nonce
Can the mining pool with the most mining power always win?
What value should nonce be when mining bitcoin ?

Read the above links and learnt that it is easier to increment a nonce than starts with a random one!

2/ And in the following scenario the node which has the most computational power should be able to solve the proof of work fastest. Of course, I am assuming that mining is deterministic.

Suppose every node in the network starts from zero and increment it. The hash of the nonce and the transaction would be executed by each node and the one computing the hash fastest would arrive at the correct nonce the fastest because hashing is deterministic?
What's wrong in my argument?

Thx

You are assuming that each mining pool is hashing the same block.  This is not the case.  Each pool has its own block, with its own set of transactions, put into its own order. Mining isn't about finding the only block that is able to be the next block, just a block that follows the protocol rules.

Furthermore, mining pools are constantly updating the block headers that their nodes are hashing, to include more transactions that they just heard about.  Because all pools, and even all nodes, are trying to find a nonce for different block headers, it's not always the most powerful pool that wins.  It becomes random.


When a block that has a transaction with change in it is successfully mined, is the change transaction included in the newly mined block? If not, how is the change transaction processed?

There is no change transaction type.

Transactions are defined as a list of inputs consumed, and outputs created, and the values assigned to those new outputs. The creator typically makes an output for a entity they wish to pay, and another output which pays excess change back to them.

Any amount of Bitcoin left un-used by the outputs is interpreted as the fee for the transaction.


Testnet Bitcoin Connection refused (111) I have ah Raspberry and i will a BTC & Lightning node set up.
my bitcoin.conf
testnet=3
Bitcoind options
server=1
daemon=1
txindex=1
disablewallet=1
 Connection settings
rpcuser=raspibolt
rpcpassword=1212431
addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151
 Raspberry Pi optimizations
dbcache=100
maxorphantx=10
maxmempool=50
maxconnections=40
maxuploadtarget=5000

I have the addnode from this thread:
testnet3 node sync process is very slow
in the getnetworkinfo stands:
"version": 160000,
  "subversion": "/Satoshi:0.16.0/",
  "protocolversion": 70015,
  "localservices": "000000000000040d",
  "localrelay": true,
  "timeoffset": 0,
  "networkactive": true,
  "connections": 17,
  "networks":
  "warnings": "Warning: unknown new rules activated (versionbit 28)"

and in the debug log stands:
2018-04-24 17:39:51 connect() to 85.207.214.190:18333 failed after select(): Connection refused (111)
2018-04-24 17:38:16 connect() to [2001:470:c144:cafe::a]:18333 failed: Network is unreachable (101)

anyone have an idea where the error lies?
my testnet port: 18333 is open.
many thanks for the help!
regards

Connection refused means there's something prevents reaching your server.

make sure that your firewall allowing connections to your port and try to add this line to your bitcoin config:

rpcallowip=0.0.0.0/0


How do we know that exchanges don't have trading bots going, affecting prices and our trades? There is so much unknown when it comes to an exchange. There are bids and asks constantly flashing. There are lots of people using some sort of trade bot tapped into an exchange's API.

How can we be sure that the people running the exchange are not doing anything sketchy?

To know what is going on, it is important to understand the order book.

The order book is the set of all open orders on the exchange.
The bids and asks we see flashing indicate changes occurring on the order book.

The order book changes when these happen:

An order is added to the order book (new order is placed).
An order is removed from the order book (order is filled by a trade or order is cancelled).

Since the order book is visible to us, we can check it for any type of sketchy behavior. The order book can be compared with order books on other exchanges. Some services exist that aggregate pricing data from exchanges. See: https://www.cryptocompare.com/coins/btc/markets/USD. If we use a limit order, there is no way for an exchange to manipulate our order or trade. If they did, we would know immediately. This is because we set the limit price of course. Ultimately, exchanges could be doing malicious things behind the scenes and malicious bots could be operating on the outside. In order to know if funny business is occurring, we must understand how the market is supposed to be working. Additionally, we must protect ourselves from the malicious behavior that may exist.
Additional notes on price manipulation:

If an exchange were to manipulate prices materially, they would create an arbitrage opportunity for market participants. As market participants exploited the opportunity, the price would move toward the true price.
If an exchange were to be creating phony bids/asks, aka quote stuffing, it would require analysis of all order submissions to know that this was happening. This data would need to be made available. The SEC provides this type of data for analysis of exchange traded equity securities. This data is provided through the Market Information Data Analytics System. This type of manipulation would not affect users creating limit orders. However, it would allow the exchange to scalp every market order.

We can protect ourselves by:

Using limit orders. When we use a limit order, we set the limit
that we are willing to pay. When we look at the order book, we are looking at all prices available to choose from. At each price there is some quantity available for trade See: GDAX limit order
Avoiding market orders. If we use a market order, the price is not
specified. Thus, any price can be used to fill our order. See: GDAX market order

I have made this video discussing the order book on GDAX.  Take a look here: GDAX order book
This playlist contains the videos mentioned above along with others that may help.
Take a look here: GDAX Playlist


How should I encrypt a bip39 mnemonic with a password? With no server and only in the browser I'm generating an a bip39 key and giving the user the mnemonic to store some place safe for restoring, I also want the user to be able to login with a password.

1) Could I encrypt the mnemonic with a password?

2) If I do encrypt the mnemonic, which algorithm should I use?

Bip39 has an optional "encryption" over PBKDF2 (passphrase-to-key) used as salt (this allows possible deniability).
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed

The weakness there is that BIP39 uses only 2048 rounds during KDF. Which is easy to bruteforce.

If you store it in a cloud (or similar), I recommend to do a AES-256-CBC encryption of the mnemonic with a strong password and a strong KDF (maybe use PBKDF2 with at least 30'000 rounds).


BIP70 who issues the transactions, wallet or payment_url server? The BIP70 specs I'm reading confuse me about who broadcasts the underlying transactions to the bitcoin network. My reading seems to suggest that both the user's wallet and the server at the payment_url do.

Is that true, or is it the user's wallet unless a payment_url is specified in the payment request, in which case the server at the payment_url does?

You're right, it is confusing in the specification. Particularly:

  When the merchant's server receives the Payment message, it must determine whether or not the transactions satisfy conditions of payment. If and only if they do, if [sic] should broadcast the transaction(s) on the Bitcoin p2p network.

and

  Customer authorizes payment to the merchant's address and broadcasts the transaction through the Bitcoin p2p network.

The image particularly shows the Wallet broadcasting the transaction.

What is established, however, is that the transaction in the Payment message sent to the merchant is the same transaction the wallet app broadcasts. IMHO, I think it's safe to assume that both the customer's wallet and the merchant attempt to broadcast the transaction. When both parties hold the transaction, they can both ensure that it was broadcast to the network..


Bitcoin wallet website I am new in bitcoin. I am developing a PHP website to let users build their wallet on my website. I want to give every user a wallet. I do not want to give users private keys. I keep private keys, so all their bitcoins owns mine. If everyone wants to spend his/her bitcoins, he/she needs to send a withdrawal request and I will handle it. I want to be able to send user's bitcoin at once with one transaction and one fee. So if I give every user a new address, bitcoins will be a changeed (a little amount in every address). So spending them needs lots of fee. What should I do? I am using blockcypher's API. Is there any other API can help? What senario should I do to achieve all above targets? thanks.

You'd have to get creative here.

Step 1) Get unspent outputs. https://bullpay.com/docs#GetUnspentOutputs
You can build your unspent outputs from multiple wallets. As long as you have the private keys, it can be done.
Step 2) Build your signed transaction. https://medium.com/coinmonks/how-to-create-a-raw-bitcoin-transaction-step-by-step-239b888e87f2
Step 3) Send your signed transaction. https://bullpay.com/docs#SendTransaction or use a node.

The part you'll want to repeat is in step 2. Building out the inputs each using their own private keys. The tricky part here is waiting long enough to have multiple outputs to warrant going through all this.


Would it be possible to store hashes generated in a file, then brush through them to find out if they are under the target? I have been wondering if it would be possible to generate hashes, store them in a file, then use them as hashes when mining. When you would mine, you would not generate the hashes, but instead, just compare them to the target. This would be much more efficient, right? Anyway, here is some psudo python code i made up:

import hashlib
while True:
    hash = hashlib generate random hashes
    file = open('hashes.txt', 'w')
    file.write(hash)

or something like that.

While this certainly could work, the chances of the hashes ever being valid are next to zero.

The reason is, the hashes must not only meet the target requirements, but they must also be a valid hash of the block header, which changes with each block.


What`s a blocks coinbase value? Under the bitcoin Protocol rules here:
https://en.bitcoin.it/wiki/Protocol_rules#Transactions
in the "block" messages section
There is the pseudo-algorithm for validating a given block.
On Point 16-2 It says:
"Reject if coinbase value > sum of block creation fee and transaction fees"
If we keep it simple,

I know that the block creation fee is calculated using 64 bit integer operations (in satoshis) as:
(50 * 100000000) >> (height / 210000)

And I also know that transaction fees are defined as:
the sum of input values minus sum of output values for a given transaction.

So the overall transaction fees on a block would be the total sum of all transaction fees in that block.
But how do I 'calculate' in pseudo-words, the coinbase value and what is it referring to?
I seem to not understand something here...
Thanks in advance

The coinbase value in that comparison is the sum of the amounts of the outputs of the first transaction (coinbase) in the block
(community wiki answer, to avoid having unanswered questions with answers in comments floating around and occasionally getting bumped to the homepage)


How To Send Cash To BTC-e, Crypto-Trade I have bee scouring on how to fund accounts in captioned exchanges from the US-preferably with a credit card or even paypal where possible, I suppose no online sites would do ACH confirmations type transactions. I have noticed some of online sites don't want to deal with us on this side of the pond. What ways are some you using to fund your accounts?

Most exchanges which support USD exchange will be funded via international wire. Depending on your bank these charges can be between 10-50USD.

If your transferring from a different currency the rate given on conversion is better than if you were to purchase USD in cash from your high street but lower than spot on forex markets.

ACH / domestic transfers will come when domestic (to you) exchanges build more solid relationships with banks when more regulation comes in place.

Trading with locally on places like localbitcoins is the best bet if the percentage in fees is larger than 5% of the amount you plan to buy. This is a good rule of thumb.


Have Blockchain.info (intentionally) removed the option to directly exchange BCH into BTC/ETH? An article on the Blockchain Support Center documents Exchanging bitcoin cash (BCH) for bitcoin (BTC) or ethereum (ETH), with the following screenshot:

Since Monday, I've been unable to see the Exchange Bitcoin Cash option in my own wallet:

On Tuesday I reached out to @AskBlockchain on Twitter, but so far I've had no response.

Has Blockchain.info has removed this option completely or is this simply a bug?

Turns out that this was an issue with my home WiFi blocking some of Blockchain.info's API calls. Not sure why, mind you, but connecting to a different network allowed me to see those options again.


How can I create and distribute my own private blockchains in a scalable way? I would like to experiment with blockchains in a controlled environment for fun and/or development purposes. Is there a way to do this easily?

Yes there is:
https://github.com/coinclone/cloner

You can mine genesis blocks, configure common settings for nodes on your network and ship them easily using this opensource project.


Is change of Bitcoin address of an account possible? I have multiple Bitcoin addresses in my Bitcoin Daemon,

Which address will be used for receive transaction
Can i change my default account address(mentioned in 1) to new one

Yes, you can generate a new address and use that to receive transactions instead. However, note that funds from the old address don't automatically get transferred to the new address, so don't delete the private key to your old address! If you always keep a copy of your wallet.dat safe (with backups), you don't need to worry about this.
The (default) thing is just a label. You can rename it to anything you want. There is no difference between the "default" address and a new one.


Time to send bitcoins? I was investing bitcoins in Coin Controller but I need the time to send it because they only give you 10 minutes. So I want to know how to calculate the time to send bitcoin with for an example 0.00005 transaction fee. I know that you can't calculate it but do you know how long it would take if I send 0.00015 and the transaction fee is 0.00005 (the half of a normal transaction fee).

The time required for your transaction to be broadcasted over the network is normally a few milliseconds. A high HD utilization, an outdated processor or many small unspent outputs in your wallet can delay the time required by your client to perform the broadcasting.

The time, however, required for your transaction to get one confirmation, assuming that your client is synched and the transaction itself is valid and carries the right fee to get included right away into the next block, is currently around 8 minutes (6:45 to 8:43 minutes over the past 30 days).


How safe is Nicolas Dorier's BCCSpliter? I noticed a link to this resource on an article talking about safely splitting your BTC and BCH(/BCC):

https://github.com/NicolasDorier/BCCSpliter

Has anyone reviewed the source code and is it safe to use?  Could someone provide a run-down on how it works?  I read the readme but am hoping for a bit more detail.

The readme file pretty much explains everything step by step.

But if you don't have much technical knowledge, the best one to use will be a wallet with some GUI. I suggest you to use Electron Cash.

But before using your private key of the BTC addresses, move those BTC to any other addresses, and then only use the private keys in this software (just a precaution).

You can also import multiple private keys together in this software.

P.S. I cannot comment due to the reputation limit right now, hope this helps you somehow.

Edit: Use precaution while using Electron Cash, as it is as of writing this answer is not much tested and have bugs.


How do I catch the unconfirmed transactions? I'm catching all the deposit transactions with walletnotify and insert them into my database. Then on every blocknotify call I fetch all the transactions under 6 confirmations from the db and update them, specifically their confirmations. How do I catch the possible unconfirmed transactions, so the ones that got saved in the db when were first posted, but in the process were rejected/unconfirmed in the next 6 blocks. And also, I'm open to any recommendations on improving my existing system. Thanks

How do I catch the possible unconfirmed transactions, so the ones that
  got saved in the db when were first posted, but in the process were
  rejected/unconfirmed in the next 6 blocks.

There are two ways a transaction (TXID) is first introduced by walletnotify:

1) Acceptance in mempool
2) Confirmation in a block

A transaction in mempool has no guarantee of being mined, and a confirmed transaction may have never been previously seen in your local mempool. Therefore, you need to be able to differentiate between the two scenarios, and only store the transactions which actually receive confirmation.

Reorgs: Furthermore, there is no guarantee that a previously confirmed transaction receives confirmation from subsequent blocks. It is possible that subsequent blocks form a separate branch, so that your previously confirmed transaction is no longer in the strong chain. This is where incrementing confirmation with each new block as you describe will fail.

Better to verify the longest header chain (they must link together via prev header hash) and ensure that the transaction is included in this longest chain when computing the level of transaction confirmation. If this longest header chain reorganises, you can update the confirmations of all transactions accordingly.


How to run multiple bitcoin RPC commands through the command window? Yes, I can generate a new address through the bitcoin-qt command console, but how might I run a for loop to generate 100 different addresses? What kind of file does the bitcoin client take?

Can I run a python script through the bitcoin command console?

How exactly does sending multiple commands to a command prompt work?

Yes, I can generate a new address through the bitcoin-qt command console, but how might I run a for loop to generate 100 different addresses? What kind of file does the bitcoin client take?

You can't. It only accepts specific API commands as described here or by calling the help command in that dialog.

  Can I run a python script through the bitcoin command console?

If by the "bitcoin command console" you refer to QT's dialog then no, you can't. You can run a script from your console, though, if you have Python installed in your system or go for a more elegant approach a use a proper RPC API wrapper.

  How exactly does sending multiple commands to a command prompt work?

It has already been answer above.


Bitcoin.conf problem I'm trying to get deposits sent to my website to show up in the users balance, inside my bitcoin.conf I have:

walletnotify='http://localhost/blocknotify-update-deposit?trxhash='%s

This is not showing up the users deposited balances however if I put the same line in my url bar the balances show up straight away.

What have I missed from the bitcoin.conf? The person I bought the application from has not been much help regarding the bitcoin integration and I'm learning as I go myself here.

walletnotify takes the supplied string and runs it as a command. If you want to make it request a URL, you should pass the URL to a command that can do that.

On linux:

walletnotify=curl 'http://localhost/blocknotify-update-deposit?trxhash='%s

If there's an error while running the command, Bitcoin will append a message to debug.log. It should look like this:

runCommand error: system(curl http://...) returned 3


What is the maximum amount of an Elements asset that can be issued? Elements allow for assets issuance, and I was wondering what was the limit to the number of units that we can issue for each asset.
There's a limit to the amount that can be issued each time, which is 21 millions, but it seems that by issuing 21 millions again and again I can issue much more than that.
My guess is that the max amount that could be issued is the maximum number of satoshis that can fit in a int64_t, which should be 92,233,720,368.54775807, am I getting this right?

There is no maximum that can be created, however you may run into issues with RPC-APIs in Elements if any wallet contains more than 92,233,720,368.54775807 at any time.
Confidential transactions will function with any realistic amount (you would have to re-issue an asset more times than possible to overload the 256-bit confidential amount type, however the receivers wallet would fail if int64 overflows.


What is the longest known vanity address generated? Anyone can generate a vanity address of arbitrary length with appropriate tools, it's just a matter of performing enough computations. What is the longest known vanity address anyone has generated?

It's impossible to say for sure what's a vanity address and what's generated purely at random, but 1CFBdvaiZgZPTZERqnezAtDQJuGHKoHSzg is 34 characters with no digits in it other than the initial '1'.  That may well be a vanity address.  Then again on average 1 in every 515 34-character addresses you generate won't have any digits in them other than the leading 1, so possibly not.

The address with the longest initial list of lower-case letters is 1yaniraswqyghuJKCRrGwJUA2HakWtRad, and is clearly a vanity address since it appears in the same transaction as many other vanity addresses.

Edit: I just found this one:

1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX

It belongs to etotheipi, author of the Armory Bitcoin Client, and was found using vanitygen, as he said in a bitcointalk forum post:

  Yessir!  I got a little crazy with vanitygen and succeeded.  It
  should've taken about 70 days of computation time but I got lucky and
  found it in about a week...  (notice no digits either, only uppercase
  letters).

  Unfortunately, it's so cool that people don't even recognize it as a
  Bitcoin address :)


Calculating fee based on fee rate for bitcoin transaction I'm writing an algorithm for calculating fee based on fee rate and amount to be sent (requested amount) in order to propose the fee to user;

Sorting UTXOs ascending based on value
Take enough UTXOs so sum is larger than requested amount
Calculate change, add to outputs
Build tx
Calculate fee based on tx byte size times fee rate
Is Change larger than calculated fee? (can we "fit" fee into change)
If no: go back to step 2 and add more UTXOs to get to fee
If yes: reduce the Change for fee and build final transaction

This works well in most cases, but if you have large number of UTXOs with small values and fee rate is large (e.g. 88 sat/byte), you can end up with very large transaction, i.e. very large fee for sending very small amount of coins.
I have tried to make a change in algorithm where after X number of iterations, I would give up and try to take enough UTXOs for requested amount and deduct fee from that amount and send what ever is left.
But I ended up in long loop again, as UTXOs were small, transaction large and in every iteration I didn't had enough to pay the fee.
As this is obviously bad implementation, is there any other way to calculate fee bases on fee rate?

There are some improvements that you can make to this algorithm.
The first is to select UTXOs based on their effective value. The effective value is the value of the UTXO with the amount in fees required to spend it subtracted from it. In this way, each UTXO you spend pays for itself. This is called the effective value because that is the value that actually affects the outputs. You do this by calculating how large spending that UTXO will be, then multiplying by your fee rate to get its fee. This fee is then subtracted from the UTXO amount.
Then you can calculate the fees for the rest of the transaction, i.e. the fixed overhead (tx version, locktime, etc.) and the outputs. Since these are all determined before you choose the UTXOs to spend, it's fine to calculate this value before you choose UTXOs. The UTXOs you choose won't have an effect on this fee. This amount in fees can then be added to the amount you are trying to select for, i.e. add it to the amount being sent.
By using the effective values of inputs (so inputs pay for themselves) and then increasing the amount that you are trying select (so the cost of the rest of the transaction is covered), you can remove the need to loop (step 7) in order to choose the UTXOs you want. Now when you choose the UTXOs, you know that each input has paid for itself, and that you have chosen enough value to cover the outputs and their cost.
Another improvement is to not sort the UTXOs. In fact, it is better to choose UTXOs randomly. You can achieve this by shuffling the list of UTXOs instead of sorting them. Sorting UTXOs has several longer term effects that will negatively impact you in the future. Notably, by sorting UTXOs, you will end up creating very small change, which means that future transactions will have many UTXOs with small values, which increases their fee. Sorting by smallest first will see this effect sooner. Sorting by largest first will see this effect over time.


sweepprivkey alternative - bitcoin core I guess they took off this function, so any alternative?

what i'm looking to do is exactly like this

sweepprivkey privkey minconfirms [destinationtype destination] [fee] [amount changeaddress]

Nobody "took off" this function, it was only proposed, but was never actually added to Bitcoin Core.

Instead, you can use importprivkey and then send BTC to a new address:

https://en.bitcoin.it/wiki/Help:How_to_import_private_keys_in_Bitcoin_Core_0.7%2B

Note:

Why doc says importing private keys is so dangerous?
Why so many warnings about importing private keys?


How particular node is searched in Merkle tree? Suppose I have Merkle Tree with Transactions 'A','B','C','D','E','F' and I want to know how to check if particular transaction i.e 'A' exists in a Tree or not ?.
And if it is present then how to traverse using root hash to the node with transaction 'A' ?

A Merkle tree is just a particular way of hashing a list of elements. In this application, the elements are transactions.

Finding something in a Merkle tree is just looking through the list. The Merkle structure does not help you.

However, what you can do with a Merkle tree is create a compact proof that a particular element is included (by giving the hashes higher up in the tree it is combined with).

So to summarize: you don't use a Merkle tree for searching. You use it to prove things are in it. This means the searching can be outsourced: if some (software) party tells you about a piece of data that allegedly belongs to a tree, instead of checking it for yourself (which requires having the tree), you can ask for a proof (which can be verified by only having the root).


Using bitcoind JSON-RPC, how to get transaction from input address? I have an address from which all unspent txouts were used in a single transaction. How can I find out what transaction was that? In my node instance, listtransactions will not list addresses that spent the coins, only those that received them.

The data you are looking for isn't actually included in the transaction that spends the UTXOs. Addresses are basically shorthand for a scriptPubKey, and scriptPubKeys are associated with outputs, not inputs. So if you want to check if an input spends from a certain address, you have to get the corresponding previous output and look what address it pays to.

For example, I have a transaction in my listtransactions:

{
"account" : "",
"address" : "mmcuav4ZD8EBc8aH5EkoGcKZSPsoHz1UzZ",
"category" : "receive",
...
"txid" : "8cb677f33d2ad2d9d94a4aa5552cd6a09615568abb7e5fd3c34df3c7869105d3",
...
}

So, I use getrawtransaction to see what my transactions inputs are:

$ bitcoin-cli getrawtransaction 8cb677f33d2ad2d9d94a4aa5552cd6a09615568abb7e5fd3c34df3c7869105d3 1

...
"vin" : [
    {
        "txid" : "33e25fd78c075dff3b0474911ca2244c5246cb40b0b34653e2fe1ca6f7c26d46",
        "vout" : 1,
        "scriptSig" : {
            "asm" : "3044022009ee6ccde46a58d7e5347ed28e8e946b1cbca3518c5066bcf1809abdfef9ef940220254fa3ed7f80831f08f760958d870a575f612aa5bb67add4cd4eb7d135a75b6a01 02a54cf1e2ecaea3e56721af6e90eb8e934597ee77cd03e060bbed47b8db03a754",
            "hex" : "473044022009ee6ccde46a58d7e5347ed28e8e946b1cbca3518c5066bcf1809abdfef9ef940220254fa3ed7f80831f08f760958d870a575f612aa5bb67add4cd4eb7d135a75b6a012102a54cf1e2ecaea3e56721af6e90eb8e934597ee77cd03e060bbed47b8db03a754"
        },
        "sequence" : 4294967295
    }
]
...

Now I look at the transaction output that funded this input, which is at index 1.

$ bitcoin-cli getrawtransaction 33e25fd78c075dff3b0474911ca2244c5246cb40b0b34653e2fe1ca6f7c26d46 1

...
"vout" : [
    ...
    {
        "value" : 2.39990000,
        "n" : 1,
        "scriptPubKey" : {
            "asm" : "OP_DUP OP_HASH160 1fab219d5483021bd791453e155f7b956f4b3ed4 OP_EQUALVERIFY OP_CHECKSIG",
            "hex" : "76a9141fab219d5483021bd791453e155f7b956f4b3ed488ac",
            "reqSigs" : 1,
            "type" : "pubkeyhash",
            "addresses" : [
                "miQQFQse4DwFE9rkMkZ78CwvTHkg3sTJmc"
            ]
        }
    }
]
...

So, miQQFQse4DwFE9rkMkZ78CwvTHkg3sTJmc is the addres that funded my original transaction. Obviously, this can be automated so you don't have to make all these calls each time you want to see the address that funded a transaction.


bitcoin compile error on CentOS 6.6: ‘SIZE_MAX’ was not declared in this scope I am trying to run a bitcoind instance (branch 0.9 from git repository) on CentOS 6.6 following this guide but I get this error when building LevelDB:

Building LevelDB ...
make[3]: Entering directory `/home/bitcoind/bitcoind/downloads/bitcoin/src/leveldb'
g++ -I. -I./include -fno-builtin-memcmp -pthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX -g -O2 -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter  -Wstack-protector -fstack-protector-all -fPIE -fvisibility=hidden -I/home/bitcoind/bitcoind/deps/include -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -c helpers/memenv/memenv.cc -o helpers/memenv/memenv.o
helpers/memenv/memenv.cc: In member function ‘leveldb::Status leveldb::<unnamed>::FileState::Read(uint64_t, size_t, leveldb::Slice*, char*) const’:
helpers/memenv/memenv.cc:65: error: ‘SIZE_MAX’ was not declared in this scope
make[3]: *** [helpers/memenv/memenv.o] Error 1
make[3]: Leaving directory `/home/bitcoind/bitcoind/downloads/bitcoin/src/leveldb'
make[2]: *** [leveldb/libmemenv.a] Error 2
make[2]: Leaving directory `/home/bitcoind/bitcoind/downloads/bitcoin/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bitcoind/bitcoind/downloads/bitcoin/src'
make: *** [all-recursive] Error 1

gcc version: gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

Here is the a pastebin with the end of the compiling output.

Anyone have some idea on how to workaround it?

So I found this thread that gave me the clue how to workaround this issue, basically insert the following at line 5 of src/leveldb/helpers/memenv/memenv.h and it compiles fine:

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif


Why is there so much uncertainty with SegWit2x when it has 85%+ mining support? I'm confused about the uncertainty and pessimism about the Bitcoin scaling debate. I see coindance https://coin.dance/blocks is signalling a 85% support for SegWit2x. As far as I know SegWit kills 2 birds with one stone i.e. SegWit gets implemented in Bitcoin August 1 and then there is a 2mb hard fork a couple of months later which also has its benefits (and is not as extreme as the 8mb or unlimited proposal).

At 85-90% mining support it looks like the hard fork will have a clear and dominant coin even if other miners do choose to continue mining another chain (+-10%, BU).

So it may be finally possible to buy that coffee with bitcoin at the end of the year while Bitcoin still keeps all of its current benefits to society. Is there something I'm missing?

The problem is that this will most likely result in a hard fork.

There is no well tested core client which supports segwit2x. The bitcoin core developers oppose that. Confusingly, their proposal (just called segwit) announces a soft-fork which is designed to be compatible.

In the end, this is a political game. Miners tend to support segwit2x, while bitcoin core developers support UASF. Their statement about the danger of a chain fork can be found here: https://bitcoin.org/en/alert/2017-07-12-potential-split


Eclair Lightning Node With Core Version 18 When attempting to open channels in lightning network I get the following error:

signrawtransaction was removed in v0.18. Clients should transition to signrawtransactionwith key and signrawtransactionwith wallet (code: -32)

I know that signrawtranaction was a deprecated RPC call in version 0.17 but could still be used. However it was removed in version 0.18. Is there a workaround for this this for Eclair v0.2-beta9?

No, there is no workaround. According to this github issue, Eclair v0.2-beta9 is completely incompatible with Bitcoin Core 0.18. The next release of Eclair will fix this.


Will calling "walletpassphrase" twice in a short amount of time increase the time the wallet stays unlocked? The Bitcoin API call for walletpassphrase allows one to open the wallet for a set amount of time. If one calls it again while the wallet is still unlocked, we get an error of 'Error: Wallet is already unlocked.'. Does the call extend the amount of time the wallet is unlocked, or not?

After doing some experiments it appears that as calling the function results in an error, it is not processed, and thus the unlock time is not extended.


Attacking Blochcain/Bitcoin by hash Assuming that SHA-256 is not save anymore. How could the Bitcoin blockchain get attacked? Ok I could get the input value for the hash function but could I now easily add my own blocks to the chain? I'm currently confused why there are theses hashes used...

How long would it take to attack the hash now, with a working SHA-256. Could you provide me a calculation with GFLOPS or something?

best regards

i can not calculate gflops  but...

some easy thoughts:

if sha2 is not safe anymore you can not easily steal bitcoin from an existing address by calculating the private key from any address because to generate the address ripemd160 is also used. and you did not assume that ripemd160 is also not safe anymore.

if everyone would know sha2 is not safe anymore then bitcoin will be worthless because everybody can mine without doing any work of the proof-of-work-process.

if only the attacker knows how to calculate the input of an sha2 function, an intelligent attacker would not attack the system. he would use the system:
the easiest way to make money when you can calculate nearly arbitrary sha2-hashs with nearly arbitrary input: mining. you can mine blocks and so you can earn 12.5btc several times every hour (furthermore you earn the transactionfees) without paying many money for electricity because you don't need to "work" in the sense of proof of work anymore. the advantage: you do not destroying the system because no one can really realize that you can "hack" the system and so you could theoretically earn many bitcoins.


What bitcoin wallets supports SegWit? It's more than a week since SegWit activation, and still there seems to be almost no wallet out there supporting SegWit?

Well, I've heard Trezor supporting it, but no ... I don't want to buy a hardware device.

Bitcoin Core and BTC1 supports it from the command line ... but no, I'm not interested in running a full node at the moment (again, that would require me to buy hardware - I probably should set up a full node, but that's probably not happening this month).

I had electrum installed, and it is supposed to support SegWit - but no, can't seem to get it to work. Even tried downloading the bleeding edge version from git, but no ... no segwit, and it was crashing with error messages all the time.

Here is a list of wallers which supporting a SegWit

bitcoincore.org/en/segwit_adoption


reflecting badly on the organization A non-profit I volunteer for wants to stop accepting Bitcoin because "it has been in the news a lot negatively and it reflects badly on the organization".  How can I answer this?

Tell them that actions of others doesn't necessarily reflect the organization you're in. Gangsters and drug dealers use USD everyday as well, their wrongdoings are not yours.


How to run a bitcoind on a hosting securely? I'm developing a web site which should receive bitcoins and display the amount of received coins. As this is my first bitcoin experience I would like to know if the following scheme is secure enough:

I'm planning to run a web server and bitcoind with the encrypted wallet on a hosted server in a datacenter. No payments will be made through this bitcoind so the wallet will be locked all time and just will be used to monitor the transactions. The front end will communicate to bitcoind by JSON-RPC. There will be regular backups of the encrypted wallet file.

The payments will only be done from another machine which has a copy of the wallet and is secure (both physically and from IT side).

Will this work?

As I mentioned in the comment above, unless you absolutely need your private key to be on the server, I would recommend only storing the address for checking purposes.

I've never used bitcoind before, but the best solution I have seen for accepting bitcoin payments would be to use something like bitaddress.org to generate a huge number of address and private key combos. Upload the addresses into a database on your server, and then when a customer goes through a transaction your server can select a brand new (never before used) key  for them to pay to. Then you can use a bitcoin API like the one provided by Blockchain to validate that the correct number of bitcoins have been sent to this address, and once it confirms, you can release the product to the client.

Then, at your leisure sometime in the future, you can collect your Bitcoins from the addresses having received payments.

This method presents a number of distinct advantages IMO:

1) Private keys are never on the server, you are considerably less vulnerable to an attack.

2) No requirement to keep the entire blockchain on your server, saving space and bandwidth.

3) Funds from each client are held separately (initially) so if you had multiple sales in a short time period, you can still identify each separately (if you used one central wallet, you run the risk of confusing the payments)

4) Your central wallet is slightly safer - the client no longer pays directly to it. Important to note that this makes very little difference because they'd still need your private key, but peace of mind is nice.

I appreciate that this isn't quite the solution you were asking for, but I think it may still fit your usage case & be more secure.


How can I test and verify a vanity key before I send coins to it? I ran vanitygen and oclvanitygen on the same machine, and realized after my run that both exe's share the same output file.

I've had experience in the past where many programs append to the same TXT file that corruption might happen.

Regardless of the source of the corruption, what is the most complete way to validate a key created by vanitygen?

Update

I added the developer tag since I'm looking to do validation in bulk.  Command line scripts also work.

If you don't want to do it online, you can try to import the private key into Bitcoin-Qt then see if the matching public key is the one you expected.


How can someone prevent a sybil attack when connecting through TOR? As I understand it, running sybil BTC nodes through an anonymous network like TOR is much less expensive than in clearnet. This makes it possible that one could be connected to a majority of nodes controlled by the same entity, right?

Is there any way to limit exposure to this when connection through TOR?

( I am asking for a friend :P )

Low-latency transmissions over Tor can be defeated with a timing attack if you're connected to several of the attacker's nodes and the attacker is watching your transmissions at your ISP.

The attacker can relay only blocks that he/she creates, putting you on a Bitcoin fork (separate from the main chain). After that you would be open to double-spending attacks.

Monitor the network hash rates closely. If they are unusually low then you should be careful you are not an a fork created by a sybil attacker, targeting Tor users.

https://en.bitcoin.it/wiki/Weaknesses#Sybil_attack

Potential deonimation of metadata is probably a larger threat than a sybil attack if you are waiting for multiple confirmations and monitoring network hash rates

http://arxiv.org/pdf/1410.6079.pdf

"Consider the following case. A client uses the same
computer for sending both benign Bitcoin transactions and
sensitive transaction. For benign transactions the user connects
to Bitcoin directly, but for sensitive transactions he forwards
his traffic through a chain of Tor relays or VPNs. If an attacker
implements the attack described in section III, all client’s
sensitive transactions with high probability will go through
attacker’s controlled nodes which will allow her to fingerprint
the user and record his transactions.
When the client later connects to the Bitcoin network
directly to send benign transactions, he will with some probability
choose an entry node controlled by the attacker (in
section V we show how to increase this probability). Once it
happens, the attacker can query the client for the fingerprint
and thus correlate his sensitive transactions with his IP address.
Note that even if the attacker is not implementing the complete
man-in-the-middle attack on Tor, but just injects Sybil peers
and Sybil hidden services he will be able to link many sensitive
transactions to the real IP addresses of the users."

The risk here can be limited by never accessing Bitcoin over Tor and clearnet from the same computer. Accessing Tor via a virtual machine over public WIFI can also help reduce your risk of being deanonymized.


Online exchange bitcoin balance to hardware wallet For better security, how would I move bitcoin from my Coinbase Wallet and Vault to a hardware wallet like Trezor?

Generate an address on the hardware wallet.  Then log in to your web wallet account and send all your coins to that address.  That's all.


Mnemonic seed language options How many languages are mnemonic seeds currently offered in other than English?

Does the entropy for different languages depend on the number of words the relevant dictionary has available to draw from?

I can answer the second part of your question regarding entropy.

Yes entropy absolutely is correlated with the number of seed words available to choose from. This should be easy to understand if you are familiar with the reason why alphanumeric passwords (letters, numbers and special characters) have far greater entropy than numeric passwords of the same length.

Regarding the 1st part of your question, please understand that understanding the meaning of every English word is not required to use English mnemonic seeds.  While adding a few more popular language may make some sense at some point the benefit of additional language support will increase security risks (from bad implementations, etc) and support costs more than the marginal benefit provided.


Is it technically possible to change the total amount of Bitcoin? Also, is it possible to change the reward cycle duration or the number of mining- reward coins?

Technically, yes, yes, and yes.  However, I'm not sure if we'd still call it "Bitcoin" at that point.

Any of these changes would require a hard fork, which means that the underlying rules of the system are changing in a non-backwards-compatible way.  It means that blocks/transactions from after the fork are not guaranteed to be considered valid to nodes running software for pre-fork.

So, to change Bitcoin like this in practice would require convincing the entire rest of the world to agree with the changes.  Anything less, and you will end up with two versions: the original and the one with your changes.  Which one gets the title "Bitcoin"?  I don't know.  That's a non-technical question, and a point of contention.

For an example of this in practice, see Bitcoin Cash.


What is the official explorer and value API for Bitcoin? I am new to cryptocurrency development, and I have noticed that Bitcoin has an official wallet for both Desktop and Mobile (correct me if I am wrong).
My question is, does Bitcoin have an official explorer and value API (such as Bitcoin to fiat conversion) too? If not, are there services or APIs for developers that are recommended and widely used?

I am new to cryptocurrency development, and I have noticed that Bitcoin has an official wallet for both Desktop and Mobile (correct me if I am wrong).

There is no official Bitcoin wallet.

My question is, does Bitcoin have an official explorer and value API (such as Bitcoin to fiat conversion) too?

There is no official Bitcoin explorer or value API.

If not, are there services or APIs for developers that are recommended and widely used?

If using Bitcoin Core, JSON RPC can be used. Example: https://bitcoindev.network/accessing-bitcoins-rpc-service-from-php/
List of RPC commands: https://bitcoincore.org/en/doc/0.21.0/
There are also lot of Bitcoin libraries in different languages which can be used to make things easier:
Scala- Bitcoin-S
.NET- NBitcoin
Open Source block explorers:
https://github.com/Blockstream/esplora
https://github.com/dgarage/NBXplorer


How to accept payments via Ripple on a website A web search led to Ripple.com.

Is it possible to add the payments via Ripple payment to an e-commerce website?
Where can i find source code to implement such Ripple payments?

For example, there are few websites which offer payment via Ripple such as PrivateInternetAccess.

There are some existing sources of information for merchants wishing to use Ripple:

Brief introduction and overview of Ripple for merchants
Merchant's section/pages on the Ripple wiki

If you are looking for something pre-implemented and easy to add to an existing automated web commerce check-out page, there isn't much available along those lines at the moment. Ripple is still in beta and the server and client code still appear to be the focus of attention. However, there has been a recent small bounty offered for the community to develop shopping cart plug-ins that use Ripple.

It's easier for sites that have a manual check-out process as they can just add a Ripple URI for customers to use and the merchant can manually check for received payments with the existing Ripple client (or use a third party tool such as wasipaid).

The basic process for a merchant to use Ripple is:

Create a Ripple address to receive funds (one time setup).
Create payment paths in Ripple for the funds you wish to receive (e.g. trust a gateway for USD or EUR, etc) (one time setup).
Supply a Ripple URI, possibly with a nice "Pay via Ripple" button that customers can use to initiate Ripple payments with their Ripple client. This can use a unique "destination tag" and/or "invoice ID" to distinguish individual Ripple payments. The Ripple client will offer the customer payment options using whatever assets they have for which it can find a payment path.
Manually or automatically watch for updates to the Ripple ledger to detect when payments are made. Make sure to handle partial payments (e.g. update a balance payable field) and to handle over-payments (e.g. return the excess, since Ripple payments are non-reversible and a reverse path may not exist for the currency being used this can be non-trivial). This is the "big" step where automation or plug-ins would be helpful, especially in handling all the corner cases.
Release/ship the thing being sold.
Periodically extract the received funds via Ripple, e.g. withdraw your balance in Ripple through a gateway into a bank account. Alternative, use the funds within Ripple.


Replay attacks: can a coinbase transaction be replayed? I'm pretty sure that I understand how replay attacks work:
A malicious node takes a valid transaction from chain A, and replays it on chain B. Other nodes on chain B see the transaction as valid and therefore it is included in both chains, instead of just A.

My question is whether the first transaction in a block, that generates new bitcoins, can be also replayed.

Short answer: No.

Longer answer: depends on the rules of the B chain.

A coinbase transaction creates coins out of thin air, but is typically only valid if the block itself is valid. Typically if the block is valid on chain A it's not valid on chain B: because a block usually points to it's previous block, which should be on the same chain.

On the other hand, the rules of B chain can literally be anything, as crazy as the creators imagination allows. If the B chain is specifically designed to also allow A blocks, then the answer would be yes. But the coins would still belong to the miner, so it's hardly an attack.


How to make Bitcoin-Qt or other client run off of a flash drive (Mac) I work in an office with lots of computers, and I am on a different workstation every day. Is there a bitcoin client I can keep on a FireWire/USB drive?

Bitcoin-Qt on Mac leaves all the files in the home directory - the block chain, the wallet, etc. Someone else is going to be using this computer tomorrow! I want to keep all those files, and even the application itself, on a portable drive.

Somebody posted a portable client, but I don't trust them, so I'll show you how to make your own.
Windows guide

Download the windows .zip from bitcoin.org

Unpack it. Go into that directory.

Make a file called launch.txt
Put this in it:
 start bitcoin-qt.exe -datadir=data

Rename it to launch.bat

Make a folder called data

It should look like this. Double-click launch.bat to start it. If files show up in the data folder you made, then you've done things correctly.
Macintosh guide
Download the Mac .dmg from bitcoin.org
Find the Bitcoin-Qt.app file, and copy it to to your flash drive.
Go to Launchpad, type in 'terminal'. Hit enter.
When the terminal comes up, type:
cd /path/to/flash/drive
mkdir data
cd Bitcoin-Qt.app/Content/MacOS
nano start.sh; chmod +x start.sh

Type in:
#!/bin/bash
dir1=$(cd "$(dirname "$0")"; pwd)
dir=`echo $dir1 | sed 's/"/\\"/g' | tr -d '\n'`
data="$dir/../../data"
"$dir"/bitcoin -datadir="$data"

Now hit Ctrl-O, enter, Ctrl-X. You should be back at the terminal.
cd ..
nano Info.plist

Find the lines that look like this:
    <key>CFBundleExecutable</key>
    <string>Bitcoin-Qt</string>

Change it to:
    <key>CFBundleExecutable</key>
    <string>start.sh</string>

Now hit Ctrl-O, enter, Ctrl-X. You should be back at the terminal. Now we just need to give it a better name.
cd ../..
mv Bitcoin-Qt.app BitcoinPortable.app

Try running your BitcoinPortable.app. If you see files show up in the data directory next to it, then you've done things correctly!
Thanks to Pygy for the script
Note: I don't have a Mac, so this is untested.


How to install the latest bfgminer binaries directly from terminal without 'aptitude' on a raspberry pi 4 8gb running raspbian? months ago I found an entry on StackExchange or somewhere else on how to install the latest (!) bfgminer binaries directly from terminal. I can not find the stackexchange post, no matter how deep I search here / on Google.
I do not remember if it was a download directly from luke-jr's website via terminal or from somewhere else. I only remember that it was done via the terminal and it created an executeable shortcut in the /bin/ and/or /usr/bin/ folder.
Visiting the website from luke-jr triggers my anti virus software telling me the website is infected or hosts infected files. So I can't visit it directly sadly.
Months ago I tried it out on my old RPi and it worked just fine. But now that I had to switch to a newer RPi I can not find or remember the correct terminal command for installing bfgminer binaries directly.
More details about why I need the binaries:
Compiling prints out LOTS of errors for me.
Using 'sudo aptitude install bfgminer' needs "aptitude" installed, so I tried to install it and it returned lots of errors, most of the package files where not downloadable (my Internet connection is fine by the way).
Can you help me out with a terminal command that let's me successfully install bfgminer on raspbian?
On my old Pi I managed to install it without aptitude and without compiling it first.
Thanks so far!

Update: sudo apt-get install bfgminer failed several times, as the same for sudo apt-get install cgminer.
After trying numerous times it finally worked!
No more need to download it from this website, got it.
Thread can be closed. Thank you anyway for your time! :)


Bitcoin trading at bitstamp I would like to start trading with Bitcoins. My only question for now is:
Can you lose more money, that you deposited on Bitstamp? If yes, how?

Step by step question:

I deposit 1 bitcoin (balance 1 bitcoin)
I trade with bitcoins (balance 0 bitcoins)
I lose (balance -1 bitcoin) <-- Can i get in negative state, or is there a limit of 0?

Thank you for all your answers!

Bitstamp does not offer credit, so your balance can not go below zero.


bitcoin transaction expired I made a BTC transaction on the 17th of January with this ID:
1f15277460d80454fae5c3fae60012e9b1b250e16f778b647c6e8e4acc49f1dc

According to coinify (blockchain.info) it expired, so I wasn't able to exchange the BTC. They responded with:

  Bitcoin transaction was not confirmed on time (this is not your fault or ours, it is the miners who confirm transactions). In such a case, the system issues a refund email. We sent a BTC refund address request to [email]

But if I look up the Tx ID, it seems to be confirmed. What am I missing?

It did indeed process and get verified.

The bitcoin is now in 17rnNNdhnc1dcdb9qBCbMsvHmufFiVzCcJ

If you didn't receive anything in return (goods/services) of value. Then it would seem you've been scammed.


Version 0.5.0.1-Beta I forgot about my bitcoin account until recently.  I have the software version listed above and my last real transaction was in 2012.  I don't remember my password, but my 12 year old PC does.  Do I need to transfer this to a wallet?  I have done a test transfer with $100 or so but it hasn't kicked off.  I noticed the S/W is "Catching up" and "Downloaded 173968 blocks of transaction history".  And "Last received block was generated 2121 days ago".  Any advice?  Do I need to wait for it to "Catch up"?  Thanks.

Congratulations! Safely exit the software, create a safe backup copy (check that everything is copied correctly) and upgrade to the newest official version for your operating system. You will need approximately 150GB of storage in total for the full blockchain once it finishes catching up, including what you have already, or you can set -prune= mode.


How to see the balance change from each block Given a new bitcoin block, I want to see:

Which address have balance change.  I.E., send / receive
The amount of that change

Is there any RPC endpoint to achieve that purpose?
Basically, I maintain the balance of ALL bitcoin addresses. And after each new block, I want to update the balance of the changed address.

Addresses are not stored on the blockchain in the typical format (Base58 or Bech32). They are stored as ScriptPubKeys.
To update each address, you would have to run getblock and parse each output's ScriptPubKey to an address and then find the Address of each input and remove those.
Bitcoin does track the existence of every currently existing coin in what's called the UTXO set.


The context of FBI involvement with Bitcoin A number of articles appeared recently linking to a leaked document about Bitcoin written by the FBI.

  Bitcoin Virtual Currency: Unique Features Present Distinct Challenges for Deterring Illicit Activity

What involvement or interest has the FBI had with other alternative currencies, such as Liberty Reserve, Dwolla, e-gold, etc?

This question should help provide some context to compare with the interest they've shown in Bitcoin.

There was quite a hype in the US about how bad Bitcoin is, and how they were going to crack down on it. I suppose this report comes from those feelings. Liberty Reserve has actually been closed recently, by the police forces.

Their interest is chiefly identifying and, if possible, removing threats. The EU actually has a similar (but better) report, to assert the status of digital alternative currencies.

The red thread to all of these documents is "Bitcoin is independent of law. Bitcoin cannot be legally prosecuted, and if it could it would be difficult to do it. Anonymity makes it suitable for criminals but it isn't fully anonymous, so maybe we can do something (because of the blockchain). Personally we think Bitcoin is pretty cool.". They also somewhere seem to understand there is a legitimate purpose to Bitcoin, but it's unclear whether that matters or not.

It's very hard to look into the mind of a millions of people wide security organization. If we don't know something it probably exist but it's still classified. This document had only public sources, so did not need classified status. They likely have build a much more detailed document now with knowledge from the NSA (about cryptography) and from Bitcoin companies in the US.

The NSA, meanwhile, has likely been tracking Bitcoin usage very closely. It likely has a pretty good way to de-anonymize Bitcoin traffic. All the aforementioned are, of course, as unprovable as PRISM was.

Most police forces in the world will have reports or accumulated knowledge about Bitcoin because it presents "a novel challenge to law enforcement". These reports will contain "nothing we didn't already know" and reflect the legal perspective of the agency, but only the mood the report writer thought his boss wants.

Good luck people. The police are our friends. Sometimes in the "Do not run, we are your friends" kind of way, sometimes as the robot friend.


What prevents miners from mining more bitcoin after 21million btc? What prevents miners from mining more bitcoin after 21million btc was mined?

The Bitcoin protocol allows block authors to create a limited amount of new bitcoins in the outputs of the coinbase-transaction (which also collects the transactions fees) in each block. The amount of the so called block subsidy is limited by the consensus rules.1 Creating more than the allowed amount makes a block invalid to other Bitcoin nodes.

Each full node unilaterally enforces the consensus rules. This means that while a miner would be able to create a block that breaks the consensus rules, every other full node in the network would recognize it as invalid, drop the block, and ban the peer that sent it to them.

A change in the consensus rules that allows blocks that were previously considered invalid is called a hardfork. Hard forks require social consensus of the complete ecosystem or will cause a split of the network as each node operator determines for themselves which software to run. Even if a majority of the hashrate and a majority of the network's nodes hardforked to a new version of the Bitcoin protocol that allowed blocks with a higher block reward, the remaining nodes enforcing the original consensus rules would consider it invalid and continue to follow their own rules. Therefore, an intolerant minority may be able to veto a hardfork, especially if this minority has a significant share of the economic weight. If the economic majority prefers the original rules, miners following the hardforked chain may find it difficult to sell their mining reward. This is essentially what happened in the case of the SegWit2x hardfork attempt.

In the case that both protocol versions have some economic support, a persistent fork may be calved in the form of an airdropped altcoin. This is essentially what happened in the cases of Bitcoin Cash spinning out from Bitcoin, and Bitcoin Cash calving Bitcoin SV.

1
The block subsidy started at 50 bitcoin per block and halves every 210,000 blocks. We're currently in the third era where miners are allowed to create 12.5 bitcoin per block. Having recently passed block 600,000, more than 18,000,000 bitcoins have been found already, and the next halving to 6.25 bitcoins per block is coming up at block 630,000 in spring 2020.


How to transfer BTC between paper wallet and an exchange? I am new to the paper wallet, and have a few questions about how to use it. Concretely， I am following the instructions here (https://walletgenerator.net/) to generate a paper wallet for BTC, but I am wondering 1. How can I transfer BTC back and forth between my paper wallet and the GDAX exchange, and 2. Is there any fee to do such transfer? Thanks!

Paper wallets are often a very secure way of storing bitcoins for the long-term but not for two-way transactions.

You can easily transfer bitcoins into your paper wallet from GDAX by going to WITHDRAW FUNDS and putting in the public address part of the paper wallet.

Sending bitcoins to GDAX from a paper wallet is more complicated.
You will need to import your private key into a real client.

Once you imported the private key into your client wallet it will allow you to spend your bitcoin and send it to the address provided on GDAX.

Current fees for bitcoin transaction can be found on miningfees.com


which private key to export from electrum? I have an electrum 2FA wallet.

When I list my addresses I get a list of around 30 addresses. (commnand below)

electrum -w /path/to/my/wallet/file/default1 listaddresses

Then I use the below command to obtain private keys from a particular address:

electrum getprivatekeys -w /path/to/my/wallet/file/default1 "myaddress"

Which private key is the one that I should get, so that I can import it to bitcoin-qt wallet? Is this even the right approach?

I tried first two of mentioned 27 addresses but none of them worked.

UPDATE:

Also when I export my master private key from electrum:

electrum getmasterprivate -w /home/path/to/my/wallet

However, I get Invalid private key encoding (code -5) error from bitcoin-qt when trying to import my master private key.( into bitcoin gold core wallet)

UPDATE 2:

I tried to get private keys from all (27)addresses and then run this command to import them all:

importprivkey  L3285rshf9LgkMfaNogEARoJpGhGVMMKd1dQgRgrtGd7EQ8F4qW '' false
importprivkey  L3285rshf9LgkMfaNogEARoJpGhGVMMKd1dQgRgrtGd7EQ8F4qW '' false
importprivkey  L3285rshf9LgkMfaNogEARoJpGhGVMMKd1dQgRgrtGd7EQ8F4qW '' true

output of command was 'null', yet my coins were not imported. Balance is still zero.

here is very detailed tutorial on how to salvage your bitcoin gold coins from 2FA electrum wallet.


Merkle Tree computations Assume I am running a mini-blockchain that is I only have blocks' headers but no transactions. I wish to verify a transaction of a third party. For that I need the transaction's path to the Merkle root. Given that no one stores Merkle tree and it is computed on the fly. My question is that who will compute Merkle tree. That is:

Option # 1) I will receive all transactions hashes of the block and I will be computing the Merkle tree myself. Pitfall: That implies, I will be receiving lots of data and sender has to send lots of data.

Option # 2) A node running full-block chain will compute Merkle tree and will send me only the transaction path. Pitfall: the sender will be computing Merkle trees of lots of people. What reward he is getting for his services?

I feel both options are not ideal. May be there is a third option which I do not know. I will appreciate your reply.

PS: Please also point me towards a publication which has all the information.

Option # 2) A node running full-block chain will compute Merkle tree and will send me only the transaction path. Pitfall: the sender will be computing Merkle trees of lots of people.

This is what happens. You connect to a full node, tell it to send you transactions which match a filter, and then you will receive those transactions along with the merkle tree path.

This is specified in BIP 37 which is used by many SPV wallets. Note that not all wallets use BIP 37 such as Electrum which uses its own protocol and connects to special Electrum servers.

  What reward he is getting for his services?

None. Full nodes are not rewarded for anything unless they are a miner.


Can encrypted private keys (BIP-38) be generated from HD wallets (BIP-32)? I am aware that the introduction of BIP-38 resulted in a standard for passphrase-based encrypted private keys utilizing AES. What is not clear to me is whether these can be generated from HD wallets? Are the HD wallet seed-based private keys, then, considered encrypted private keys? Or do they follow the general private key format, since they are derived through their own HD wallets' processes?

The private keys themselves can be generated with BIP 32 and then those private keys encrypted. Private keys generated with BIP 32 are not special private keys; they are just normal private keys and you can do exactly the same things to those private keys as you would to any other private key.


Can an intermediary block be lost? Since the blockchain is stored in a distributed database, is it possible that one block can be lost? Then it would be impossible to link future blocks to previous blocks.

How many copies of the blockchain are there?

It is technically possible that all copies of the blockchain are lost...but extremely unlikely.  Also, I see no reason why such a massive data loss would be restricted to a single historical block, rather than the whole blockchain.

For a cool visualization of the number of full nodes on the network, look here:

https://bitnodes.21.co/nodes/network-map/

Keep in mind that there are probably a lot more copies of the entire blockchain than there are full nodes.  For example, I run 1 full node from my house, but also have 3 full copies of the blockchain backed up (so I don't have to download again).  It would take a cataclysmic event to destroy all the world's backups.

Also, having worked IT for a bank, I can assure you that your bank account doesn't have nearly this many redundant backups.


Can an account define conditional tags to blockchain Let me try to specify my question with an example:

Consider that there are 4 accounts ( AccountA and AccountB and AccountC (Taged as Store) and and AccountD (Taged as Night Club)), and AccountA wants to send let's say $100 to AccountB with a specified condition (i.e. $100 can be spent only at Accounts taged as Store ).

Can i implement above case?

If i can, how?

Not directly.  The Bitcoin protocol doesn't allow you to place restrictions on how a transaction can be spent.  The input script doesn't get to see the output script.

However, the net effect of what you describe would be as follows: after B decides to send the funds, they are in the control of C, who can spend them as desired.  In other words, the approval of both B and C is needed in order to move the funds onward.  You can get this effect with a 2-of-2 multisig transaction that requires signatures from both B and C, and can then be spent in any way they agree to.


Compromised Bitcoin clients? Are there any known cases of compromised Bitcoin clients (whether proprietary or free)?

I don’t mean separate malware that attacks installed clients, but malware that is included in the client itself.

The authors could have included malware intentionally, or unintentionally (without understanding the consequences, e.g. by accepting a code commit of someone else), or their download server could have been compromised, or something else.

There are, but I can't remember where I read about them. Sorry.
There has popped up Litecoin wallets with malware/trojans in them... Therefor there is always a warning/saying that tells you to download the wallet ONLY FROM the official site. (for instance http://litecoin.org)


How to uncompress a compressed private key? So I have a compressed private key. Is it possible to get the uncompressed version of it? If yes, how? Examples in Javascript would be much appreciated.

Ok I answered my own question. From: https://github.com/pointbiz/bitaddress.org/blob/master/src/bitcoinjs-lib.eckey.js#L186-L222

bytes = Bitcoin.Base58.decode(compressed_or_uncompressed_private_key);

After some processing, this bytes-array can then be re-encoded into a compressed or uncompressed private key.


Test vector 1 BIP32 in Python i tried to replicate code in this git
https://github.com/tongokongo/bitcoin-basics/blob/master/HD_wallet/bip32.py .
I'm not familiar with python but the xpub is correct (this is the Test Vector 1 from BIP32) while the xpriv is:
b'Har3K3MhV5fiuEp6ztqjoMJejPsfnrLHAzSWDpkzLGomKaoUPLkSrwPxsdKMbzgsi6eegKG5BMwPyk8RMbDEe6zpHSUnRZMNJkX2HEhDzo41ds7qJVyRkhb3jsGezXb8XB4hW12QKUuxc3pDstNHMuYwEyV'
b'xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8'

what's the mistake?

Below the code:
import binascii
import hmac
import hashlib
import struct
import ecdsa
import base58
from ecdsa.curves import SECP256k1
from ecdsa.ecdsa import int_to_string, string_to_int

#chain m
seed = binascii.unhexlify("000102030405060708090a0b0c0d0e0f") #generiamo il seed, importiamo la stringa del test vector
#calcolaiamo ora I come HMAC-SHA512 (seed key="Bitcoin seed" Data = seed) - occorre importare hmac e hashlib
I = hmac.new(b"Bitcoin seed", seed, hashlib.sha512).digest()
#il risultato ottenuto va diviso in 2 stringhe da 32bytes (Il & Ir)
Il, Ir= I[:32], I[32:]

#il risultato va serializzato come descritto dal BIP32
#priv=xpriv+depth(1byte)+fingerprint(4bytes)+chaincode(32bytes)+chiave(33bytes)
#pub=xpub+depth(1byte)+fingerprint(4bytes)+chaincode(32bytes)+chiave(33bytes)

secret = Il #parte sinistra ottenuta dal HMAC
chain = Ir #parte destra
xprv = binascii.unhexlify("0488ade4") #è la version di default per la mainnet di Bicoin
xpub = binascii.unhexlify("0488b21e") #è la version di default per la mainnet di Bicoin
depth = b"\x00" #come da guida a livello della master  "0x00 for master nodes"
fingerp= b"\0\0\0\0" #come da guida a livello dalla master "(0x00000000 if master key)"
index = 0 #index del child al livello della master
child = struct.pack('>L', index) # L = big endian, the way of storing values starting from most significant value in sequence

#importare ECDSA dopo averlo installato. Occorreranno inoltre le librerie:
#from ecdsa.curves import SECP256k1
#from ecdsa.ecdsa import int_to_string, string_to_int
k_priv = ecdsa.SigningKey.from_string(secret, curve=SECP256k1)
k_priv = k_priv.get_verifying_key()

#bisogna ora serializzare la chiave privata come 32bytes con 00 davanti
data_priv = b'\x00' + (k_priv.to_string())

# serialization the coordinate pair P = (x,y) as a byte sequence using SEC1's compressed form
if k_priv.pubkey.point.y() & 1:
    data_pub = b'\3' + int_to_string(k_priv.pubkey.point.x())
else:
    data_pub = b'\2' + int_to_string(k_priv.pubkey.point.x())

raw_priv = xprv + depth + fingerp + child + chain + data_priv
raw_pub = xpub + depth + fingerp + child + chain + data_pub
#print(raw_priv)
#print(raw_pub)
#a questo punto abbiamo ottenuto due strutture da 78 byte che possono essere Codificate base58. Occore però prima trovare e concatenare
#il cheksum da 32 bits (4 bytes). Il Checksum si ottiene con un doppio SHA256

hashed_xprv = hashlib.sha256(raw_priv).digest()
hashed_xprv = hashlib.sha256(hashed_xprv).digest()
hashed_xpub = hashlib.sha256(raw_pub).digest()
hashed_xpub = hashlib.sha256(hashed_xpub).digest()

#vogliamo aggiungere a raw_priv e raw_pub gli ultimi 4 bytes dei digest ottenuti

raw_priv += hashed_xprv[:4]
raw_pub += hashed_xpub[:4]

#codifichiamo ora base58 - importare prima il pacchetto
print(base58.b58encode(raw_priv))
print(base58.b58encode(raw_pub))

It's code from my video.
In k_priv = k_priv.get_verifying_key() it should be capital K, I was trying to be as close to original biputils lib as possible,
Then you use it in pubkey related data derivation:
if K_priv.pubkey.point.y() & 1:
    data_pub= b'\3'+int_to_string(K_priv.pubkey.point.x())
else:
    data_pub = b'\2'+int_to_string(K_priv.pubkey.point.x())

Sorry for making it confusing, I'll try to represent it better next time :)


What do I need to do to protect my wallet on my computer? I am using Multibit. How to overcome if my computer burns off?

There is a lot of info about securing your wallet on bitcoin.org

http://bitcoin.org/en/secure-your-wallet


How to create a P2SH address with bitcore-lib I was looking to create custom P2SH addresses from redeemScripts ( they start with 3...) using bictore-lib.

If anyone can direct me to the right code in their module, I can't find it.

Here is the reference for creating a P2SH multisig address https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L44

However your question states "custom" P2SH so I think you might be asking about something more advanced, in which case I would suggest reviewing bitcoin.script.compile, the CLTV address for example:

let bitcoin = require("bitcoinjs-lib");
let bip65 = require('bip65');

function cltvCheckSigOutput (aQ, bQ, lockTime) {
    return bitcoin.script.compile([
      bitcoin.opcodes.OP_IF,
      bitcoin.script.number.encode(lockTime),
      bitcoin.opcodes.OP_CHECKLOCKTIMEVERIFY,
      bitcoin.opcodes.OP_DROP,

      bitcoin.opcodes.OP_ELSE,
      bQ.publicKey,
      bitcoin.opcodes.OP_CHECKSIGVERIFY,
      bitcoin.opcodes.OP_ENDIF,

      aQ.publicKey,
      bitcoin.opcodes.OP_CHECKSIG
    ])
  }

  function utcNow () {
    return Math.floor(Date.now() / 1000)
  }

let NETWORK = bitcoin.networks.testnet;
let alice = bitcoin.ECPair.fromWIF('cScfkGjbzzoeewVWmU2hYPUHeVGJRDdFt7WhmrVVGkxpmPP8BHWe', NETWORK);
let bob = bitcoin.ECPair.fromWIF('cMkopUXKWsEzAjfa1zApksGRwjVpJRB3831qM9W4gKZsLwjHXA9x', NETWORK)

//set lock time for 3 hours from now
let lockTime = bip65.encode({ utc: utcNow() + (3600 * 3) });

let redeemScript = cltvCheckSigOutput(alice, bob, lockTime);
let scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript));
let address = bitcoin.address.fromOutputScript(scriptPubKey, NETWORK);

console.log(address);


transactions and 51% attack? I have a very basic understanding of how the bitcoin blockchain works and am trying to understand how manipulating transactions in a 51% attack works.

I just watched a video which stated 51% attacks can't steal bitcoins from people's wallets. Is this true?

My understanding is if someone successfully implemented a 51% attack i.e. they created a longer chain than the current chain, then they would most likely have manipulated one or more of the transactions which had been confirmed in the original true bitcoin chain.

I assume the reason they can't steal someone's bitcoin directly from their wallet is because they would be unable to create a transaction to send bitcoin from that person's wallet, as they would need their private key to do that.

That said if for example William had sent 1 bitcoin to Sarah who previously had 0 bitcoin in her wallet. Could they not simply remove that transaction from their new/manipulated chain? This would then mean Sarah no longer has the 1 bitcoin in her wallet effectively stealing that 1 bitcoin from her.

William would still have the 1 bitcoin meaning he could now reuse that 1 bitcoin. I assume this is what they mean by double spend i.e. he can now spend that same 1 bitcoin again.

If this is possible then the blockchain would view Sarah's wallet as having 0 bitcoin. If in a later block Sarah had sent that 1 bitcoin to her friend Helen, then wouldn't that transaction be invalid? If so would this mean the person creating the fake blockchain would have to also remove that invalid transaction?

If that is the case it could presumably create a knock on effect where multiple future transactions are now invalid. Helen's wallet (like Sarah's wallet) could have only contained the 1 bitcoin Sarah had sent her, so if Helen had sent that bitcoin to someone else that transaction would now also be invalid.

I just watched a video which stated 51% attacks can't steal bitcoins from people's wallets. Is this true?

Yes, 51% attack cannot steal coins controlled by other people's keys. When you sign a transaction with your private key, you include the entire transaction data as a message in the signature hashing algorithm. Thus changing any data within the transaction (output value, address of the receiver etc.) will render the signature invalid and hence the transaction as invalid. An attacker can only make cosmetic changes like signature malleability (S component of signature can be replaced with -S) which can also be done by any other miner or an intermediate node in between that is relaying your transaction.

  My understanding is if someone successfully implemented a 51% attack then they would most likely have manipulated one or more of the transactions which had been confirmed in the original true bitcoin chain.

An attacker cannot manipulate transactions as I have stated above. What the attacker can definitely do is exclude the transaction from their version of the chain thus bringing in a censorship attack.

When you read news articles like "attackers stole coins from 51% attack" it does not mean they changed the transaction data. This is how the attack happens: An attacker sends some coins to an exchange. This gets recognized on the Bitcoin blockchain and after that gets reflected in your exchange account. Now on the exchange portal the attacker exchanges BTC for any other coin like say ETH and withdraw the ETH coins from the exchange account to their personal wallet. Now, they launch a 51% attack and create a different version of the Bitcoin blockchain that has excluded that transaction in which they sent the coins to the exchange. After your chain becomes the longest it will be accepted as the main chain. Thus you end up in BTC and the ETH that you got from the exchange. Although I have given the example of Bitcoin, do note that BTC has never experienced a 51% attack.

  This would then mean Sarah no longer has the 1 bitcoin in her wallet effectively stealing that 1 bitcoin from her.

Yes, this is the same example I have mentioned above. However, as confirmations on the transactions increases, the more difficult it is for an attacker to exclude transactions.  If there are tens of confirmations on the transaction, then reorging with just over 50% hash rate will take days if not weeks. Thus most recent transactions are more vulnerable to the attack than previous ones.

I think rest of your questions follow the similar tone. It is a best practice to wait for 6 confirmations, but if the amount sent is really large enough, it will be prudent to wait for tens if not hundreds of confirmations.


Calculate Unspent using private keys Can we calculate unspent of addresses which are generated from other node server if we are having private/public key of those addresses?

If you have just a pair of private and public keys, you would need a little more information.

A single public key can control Bitcoin in a number of ways:

A direct p2pk output
A p2pkh output paying the hash of the public key
A p2sh output paying a script controlled by a set of public keys that may include keys other than the one you have
A p2wpkh segwit output paying the hash of the public key
A p2wsh output paying a script controlled by a set of public keys that may include keys other than the one you have

Without knowing which type of output you are looking for, the public key alone is not sufficient, especially for p2sh and p2wsh outputs where other keys are required to construct the address.

Once you know which output type to look for, you can use the scantxoutset RPC method of a node, or construct your own index similar to an explorer or Electrum server and query balances.


How can I transfer my bitcoins from my wallet to a market place? I got a bitcoin coupon as a gift. I got the bitcoins into my wallet (Bread). Now I would like to transfer those coins into a market place like eToro or similar to start by selling some of them. I haven't found a way how to do that so far. Any help would be very welcome.

Marketplaces (as well as ATM's for this matter) typically require you to send the bitcoins to an address of theirs. As soon as that transaction confirms, they send you cash via a traditional bank account, paypal etc...

Any trustworthy marketplace will describe that process in detail. Here is some information from btcdirect, for example: https://btcdirect.eu/en-ie/purchase-order


What is resource of mining rewards How the coins must be paid miners for mining process is provided? One of resources may be transactions fee. Is there any other resources for proving reward of miners?

Miners receive a block subsidy and any transaction fees in the block.

The subsidy started at 50BTC and halves every 210,000 blocks. See Mining Reward. These are newly minted coins the network accepts as valid coins based on consensus rules above.


How can Blockchain help to vote? I have seen in some videos and blogs that Blockchain can be used in our election voting system for example here:

  Another company working on creating a platform that uses Blockchain
  technology to replace and/or enhance the current voting methods used
  today is BitCongress, which released a White Paper on its approach.

  The company uses the Blockchain technology with a token based system
  to control the voting system ensuring one person, one “unchangeable”
  vote.

  This token is called a VOTE and by using the blockchain to permanently
  record each vote, it ensures that there can be no manipulation of
  those votes or voting twice

As far as I understand it, the company would assure that each person that is allowed to vote gets a unique token and can only vote once.

Then each block of the blockchain contains the information for which party one voted and the unique token. But I don't understand the following:

If there is a company who assigns each user a unique token, then how can I possibly check if the token actually belongs to a human?
How can we check that the company does'nt create some fake tokens that do not belong to a user?
How can we prevent a Brut force attack that someone just tries billions of possible tokens to make their vote?

E-voting is a hard problem. There are three major sub-problems: (with two extras if you use a Bitcoin-based system)

How do you provide a trustworthy computing environment?
How do you distribute voting keys to voters? (Or, how does the government get an accurate list of keys that belong to real voters, with no duplicates?)
How do you prevent denial of service attacks against the network being used to send completed ballots, and the network that announces the results?
(Bitcoin only) Does it scale?
(Bitcoin only) What's the preference of the hashpower majority?

Actually counting the vote is a comparatively simple problem.
Trustworthy Computing Environment
Most people's computers are not very secure. Depending on who you ask, between 30%-48% (1), (2) of computers are infected with some kind of malware.
If there's some kind of malware on a computer, how do you prevent it from altering the vote before it's signed and sent out?
As far as I can tell, the linked whitepaper doesn't address this.
Getting Keys to Voters
I don't think this part is any more difficult than distributing absentee ballots.
You keep a list of voters along with contact information and addresses. If there's a question about whether two people are the same, or whether a person exists, or whether a person is qualified to vote, you use a series of gradually more expensive identity verification methods.
Denial of Service
Some of the people who tamper with an election do so to alter the result. However, some people are satisfied with preventing the election from completing, or calling the results of the election into question. This could be something like BGP hijacking, or a denial of service attack against the DNS servers that introduce new nodes into the network. Or, as a more targeted option, find a list of people who are likely to vote for Candidate A based on what Facebook groups they're a member of, then send a denial of service attack to their home internet connections.
(Bitcoin only) Scale
Let's do some back of the envelope math. You need to count 150 million votes. A bitcoin transaction takes about 200 bytes per vote. Multiply those two numbers. That's 30 GB. Bitcoin has a block size limit of 1-4MB, meaning that a day of blocks can contain 600 MB at most. Even if you make some very optimistic assumptions, it's an order of magnitude too small.
This implies that you need something more efficient than 'broadcast all votes to everybody.'
The whitepaper suggests using simplified payment verification, but since Counterparty rules are not consensus rules, an invalid Counterparty transaction can be included in a block without making that block invalid. Therefore, even if every miner is honest, SPV cannot be trusted.
(Bitcoin only) Hashpower preference
What happens if a majority of hashpower have a preference for who should win the election, and they decide to rig the election in that person's favor?
Well, they can. They can exclude any opposition votes from their blocks, and refuse to build on blocks that contain opposition votes. It's not clear how you could punish them for doing this, or that it's even illegal.
If that's too overt for your tastes, you could exclude opposition votes from blocks you mine, but still build on the longest chain. This doesn't even require a majority of hashpower, but it could still change the final tally.

Things that aren't problems

Brute force attacks
There are certain physical limits about how efficient computers can be. There is also a limited (but very big) amount of energy in the universe. Therefore, there's also a limit on the number of bruteforce attacks you can attempt, which is smaller than the number of keys in a 256 bit keyspace. There's a more detailed version of this argument here.
The bottom line is that you shouldn't worry about brute-force attacks. Instead, worry about attacks which are more efficient than brute-force.