When you pay from a P2SH address, does its change go into a P2SH address too? Because that means you must always keep the redeem script around to make the change addresses, and if it's a multisignature script, then you'll need to have the script with those public keys around, ready to go too.

When you pay from a P2SH address, does its change go into a P2SH address too?

No. Not necessarily. You can include p2pkh/p2sh/p2wpkh/p2wsh outputs.

  Because that means you must always keep the redeem script around to make the change addresses

If you consume P2(W?)SH UTXOs to produce new P2(W?)SH outputs, you generally keep the redeem script or communicate them well in advance with the recipient (if not yourself).
If you consume P2(W?)SH UTXOs to produce new P2(W?)PKH outputs, you do not need to communicate the redeem script as the recipient can work it out themselves.


Two kinds of Bitcoin addresses issued with bitaddress.org I forked the bitaddress.org repository and generated a new paper wallet. On the output page there are two addresses generated: one "regular" and one "short address". Both start with 1 and are legacy addresses. I transfered a small amount to the short address and checked the balance on blockchain.com. The problem is that there is only a transaction on the short address. I expected the addresses to be linked somehow. What am I missing here?

Okay, so a compressed address and an uncompressed address are 2 separate addresses. They aren't linked, and the blockchain sees them as 2 entirely different addresses.
There are 2 different private keys, and the one starting with the number 5 is for the regular address whereas the one starting with the letter K or L is for the compressed address. If you want to use the uncompressed address you will have to import the private key starting with the number 5. If you want to use the compressed address, you will have to use the private key starting with K or L.
So now, what is a compressed address? The underlying ECDSA key for these two addresses is the same, just represented 2 different ways, one of which is longer than the other. The 2 private keys encode the same ECDSA key, they just have a small header that identifies whether the address being used is the compressed or uncompressed variant.
You should only use one or the other, not both. To the Bitcoin network, they are 2 different addresses, so if you wanted to use both you'd have to import both keys separately. However, because the underlying ECDSA key for both are the same, if you use both addresses, it is possible for an analyst to identify both addresses as belonging to the same person, and if someone got your compressed key, they would be able to easily figure out the key to your uncompressed address (and vice versa).


When using a paper wallet and doing partial spends via blockchain.info. Where does the change go? I'm pretty shocked that I found out now about the change thing as I read everywhere about paper wallets being secure, but no where does it state that when you spend partial amounts from your paper wallet you might actually lose it all if you don't have a change address setup.

Now my question is how does blockchain.info handle this paper wallet situation with change addresses? It's kind of scarey knowing that you coins can just disappear just because you don't know the inner workings of how transactions work.

If you use a paper wallet with just one address. The most common way to make transactions that do not spent a complete unspent output (UTXO) is to send the change back to the wallet address itself.

Note that using only a single address implies that you have no privacy whatsoever. Everyone that Evers comes to know your address can see your balance and every transaction you receive or send.

Paper wallets are useful to safely and conveniently store some bitcoins, but when you want to make payments on a more frequent basis, you should use a more sophisticated wallet that can contain multiple addresses.

Note that HD wallets (Hierarchical Deterministic wallets) make it possible to have a paper wallet that can consist of many addresses. However I don't know of a wallet app that already supports this type of wallets today.


Can I find miner's payoff record in the Block Chain? To my understanding after researching on the infrastructure of Bitcoin, the block chain maintains transaction records between two parties represented by their public keys. At the same time, the Bitcoin system needs miners to verify the blocks in order to maintain the system. Then my questions go as following:

How are miners identified for a given block? And, how is this piece of information in the block chain?
Is "coinbase transaction" stored as part of a block, and thus records the gross reward for mining such block? Or, what element/record within a block is recording the amount of "reward"?
In addition to this part of "reward" issued by the system, miners can also collect transactions fees (light reference). Please correct me if I am wrong: transaction fees are free-floating voluntary residuals from normal transactions, to be collected solely by the miner who consolidated the block. Then, how are transaction fees "paid" to the miner? It seems that there needs to be another entry of record nested within in the block denoting the amount the miner has declared. How may I identify this record?

How are miners identified for a given block? And, how is this piece of information in the block chain?

Miners are only identified if they choose to identify themselves. That is usually done by adding a message to the scriptSig of the coinbase transaction, or by taking credit for mining the block on a website.

  Is "coinbase transaction" stored as part of a block, and thus records the gross reward for mining such block? Or, what element/record within a block is recording the amount of "reward"?

Every block has a coinbase transaction. The coinbase transaction is always the first transaction in the block. The sum of the amounts of each output of the coinbase is the reward that the miner claims. The reward must be equal or less than than the current block reward plus the transaction fees. If a miner claims less than they are entitled to, the extra money is gone.

  transaction fees are free-floating voluntary residuals from normal transactions, to be collected solely by the miner who consolidated the block. Then, how are transaction fees "paid" to the miner? It seems that there needs to be another entry of record nested within in the block denoting the amount the miner has declared. How may I identify this record?

Each transaction has inputs and outputs. The sum of the amounts of the inputs minus the sum of the amounts of the outputs equals the transaction fee.

A miner is entitled to claim the fees of all of the transactions in their block. They claim this by increasing the reward they claim to the block reward plus the transaction fees.


Does GHashIO already have above 51% hashrate? Right before writing this question I noticed the GHashIO showing 32% hashrate distribution using the following link.

Unknown has 26%. And the IP address of the most blocks reported from unknown is: 88.150.205.243. After doing some digging it seems that the IP address is owned by GhashIO according to totalhash.

Not sure how reliable the data from totalhash is but it seems that GHashIO has already achieved above 51% total hashrate. Can someone confirm this? If it's false then what would be the proper way to investigate this in the future?

When blockchain.info says that a block came from an IP address (for example, 88.150.205.243) it means that blockchain.info received this block from this IP address, but it can not determine which pool mined this block.

It also means that blockchain.info is connected with this peer node. There is a high probability that this node has many peers where blocks can come from.

It does not mean that this block was mined by this IP address.


Multiple coins on one server running MPOS/stratum I've got an instance of MPOS and a stratum server running a single PeerCoin pool perfectly fine.

How do I go about adding a second pool to the same server?

I've tried to duplicate both the stratum server folders and the MPOS folders, then configure for a different coin. However, when when I browse to the other MPOS instance, for example www.mysite.com/MPOSSECONDSITE/public, it loads a blank page. What am I doing wrong?

Have you given proper permission to
www.mysite.com/MPOSSECONDSITE/public

If not, use this:
cd /home/username/mpos chown -R www-data templates/compile templates/cache logs


How can I find the transaction that spends a specific output via an API? I am wondering how I can find the transaction that spends a specific output (for a large number of transactions). So for example, I have a transaction like the following: https://www.blockchain.com/btc/tx/ebd4a554faff31dd2a07135913fa073012a4495b195c1a5d5a9a7bca3e88de61. It has two outputs which are both spent. I would like to find the transaction that spends that output. Blockchain.com has a link to the spending transaction via the tx index (https://www.blockchain.com/btc/tx-index/355543195). However, they do not offer this an API endpoint and just in the GUI. I was wondering if there exists an API that offers to find the transaction via either the tx-index or other means.

Background
I just started doing research on the lightning network and I was interested in the closing of channels. In particular, I took a snapshot of the lightning network in January from https://graph.lndexplorer.com/api/graph and scan all the channel transactions to see if the channel is closed. If the channel is closed I want to know if it was a mutual close, unilateral close, or a disputed unilateral close (an old commitment tx which should have a revocation tx following the commitment tx on the chain). Since the dataset has around 16.000 channels, I need an automated way of parsing through the transactions.

I would parse the blockchain. There are libraries for almost any programming language. You can in a 5-liner scan through all transactions and see which input they spent. You need to do this with a local parser and not via an remote api as remote api calls would take way too much time.
If the input txid is an element of your funding txset wich you collected before it is a channel close (for now while we don't have Splicing)

On the other side 1ml.com has a history of channels with the closing tx. So you might be able to get the data you seek from them.


Insert data to transaction with OP_RETURN This might be a possible duplicate with this.

I want to know a proper way to insert additional string with OP_RETURN and retrieve the transaction from block chain and decode it accordingly.

Thank you

How do I add metadata to the blockchain?
Essentially, one of the output scripts should be
OP_RETURN <the data you want to add>

That's it.
Let me give an example. Say you want to add the string "Melons." to the blockchain.

Convert to binary
"Melons." -> 4d656c6f6e732e
Add the push-data-onto-stack command at the start. This is the length of your metadata if it's less than 75 bytes, or OP_PUSHDATAx otherwise.
074d656c6f6e732e
Add OP_RETURN at the start
6a074d656c6f6e732e
Put this in the scriptPubKey of an output of a transaction. I wrote a guide on this here.

How do I find it again?
That's... trickier. Bitcoin is not optimized for searching the metadata of transactions.
Possibilities:

Look through all of the transactions you get with something like bitcointools.
Use a website like coinsecrets.org.


What are the most notable attacks on pools? Since Bitcoin's inception there have been several attacks on mining pools. There was the Linode problem, where some 46,000 BTC were stolen from pool accounts.

What are some other notable attacks on mining pools?

Exploits / Hacks resulting in BTC theft:

The Linode Incident - 46,000 BTC were stolen due to the compromise of a single employee workstation.
Slush's Backup Hacked - 3094 BTC stolen after a backup of Slush's pool was compromised.
Mt.Gox Database Theft - a reported 100,000 BTC were stolen, and another 400,000 BTC reported 'missing'. Mt.Gox shuts down and stops honoring trades of compromised coins.

[D]DoS Attacks ([Distributed] Denial of Service):

Slush's Mining Pool DDoS - A DDoS attack which lasted nearly 2 days before being recovered from.

This is a CW entry in the hopes of creating a clean index of info about all known (and notable) attacks against mining pools. Please maintain it as new information becomes available.


Is it possible to block bitcoin signal？ I heard that china gonna block bitcoin signal and shut down all the miners. Is it possible? if possible is there any way to bypass it？Will Core release new update to prevent this?

block bitcoin signal

What signalling? Do you mean mining?

  Is it possible?

Maybe, for some pools. But it may not be possible for some pools. Here's a tweet from ViaBTC's CEO:

Source: https://twitter.com/yhaiyang/status/909309756220653570

  Is there any way to bypass it?

Sure, they can set up VPNs on their US or other countries' servers.
But no one will do that. No one wants to go to jail for that.

  Will Core release new update to prevent this?

Are you asking, that what is going happen to difficulty? Currently 70% of the hashrate comes from China, if they shut down at the same time, then the block will come every ~ 35 minutes, not 10, making the mempool bigger and transaction fees will go up.

Core can release an emergency update, that is scheduling a hard fork to lower the difficulty.


Tracking a specific Bitcoin to make it represent something else, which could then be traded without trust Imagine if one could follow the movements of a specific Bitcoin (or fraction thereof) in the block chain. Then that would mean that I could make that specific Bitcoin represent something else, which people could then freely trade just as other Bitcoins.

For example, I could mark 100 Bitcoins and define that these represent 100% of the equity of my company. I could then put them up for sale for something I felt was reasonable given the value of my company + the value of the Bitcoins themselves. People would know that they could freely and almost anonymously resell the equity of my company without trusting anything else than what the Bitcoins represented. No need for lawyers, no need for contracts regarding selling and buying of equity, no need to meet at all to do the exchange. My company could also pay the owners dividend, because I would always know which wallets owned the special Bitcoints.

My question is therefore: Is this currently possible, given all the nice scripting features in Bitcoin. And if not, then are there currently any plans to modify Bitcoins to enable such a feature?

Needless to say, I believe that there is a huge potential in this, because one could basically mark the owner of billions of things (virtual or not) by assigning something like 0.00000001 Bitcoins to each thing. This way one would always know who was the true owner of that specific thing.

As you say following the outputs of a transaction could be used as you describe, there are more people that like that kind of use cases and that's why ColoredCoins was created or Zerocoin which try to make it completely anonymous.

Indeed so many people is trying to add metadata to coins that in 0.9 version of the client there is a new output type that can include 80 bytes of data with no other use (you can read more about it here https://bitcoinfoundation.org/blog/?p=290)


Access the NXT / Ardor database console? I want to do some queries on the H2 database. How can I access this console that lets me type in commands.

You can access the NXT's H2 database from the website by going to /dbshell path.

Example:
Show top 100 accounts sorted by balance:

  select *, BALANCE / 100000000 as NXT from account where latest = true
  order by balance desc limit 100


If the blockchain records all transactions, how does losing your wallet imply that you lose your Bitcoin? My understanding is that the blockchain records every transaction that has ever occurred, and that, when we say there are x amount of coins at address y, what we really mean is that the blockchain records transactions in which the difference between the total amount of Bitcoin going to that address and leaving that address is x.  In other words, it doesn't store the amount of Bitcoin at an address per se, but instead determines this by looking at transactions.

If my understanding of this is correct, then I don't understand how you are at risk of losing your Bitcoin if, for example, your hard drive crashes.  The blockchain would still be able to tell how much coin was at that address, so all you would need to be able to do is prove that that address belonged to you.

If the problem is that the address goes away with the client and (most likely) the user didn't have their address memorized, then why not just add the ability to access the same address with more than one client?  This way, if, for example, they lost their client on their desktop at home, they could still look up their address on their client at work, on their laptop, etc, and be able to recover the 'lost' coin.

You've answered your own question - "all you would need to be able to do is prove that that address belonged to you." To prove the address belongs to you you need the associated private key, which is secret and typically kept on your computer. If you lose your key you are no different than any other pretender to the address.

This is why you must back up your wallet file containing the keys, so should something happen to your computer you can still access the coins using your backup.

Remember, this is a decentralized digital currency. There is no clerk you can go to with some documents who can authorize that this is your address. You must prove ownership in a universally verifiable digital way - by using your private key to provide a cryptographic signature.


Run lightning-charge on c-lightning regtest I'm trying to run lighting-charge (https://github.com/ElementsProject/lightning-charge) on top of one of my 2 lightning (https://github.com/ElementsProject/lightning) instances. I am running 2 nodes using the script here: lightning/contrib/startup_regtest.sh. This file will start a bitcoin instance as well as 2 lightning nodes (/tmp/l1-regtest, /tmp/l2-regtest)

I then tried to run lightning-charge with:

$ NETWORK=regtest charged --api-token super_secret_1 --ln-path ~/.lightning --db-path ~/charge1.db --port 9112

Which gives me this error:

Lightning client connection error { Error: connect ECONNREFUSED ~/.lightning
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '~/.lightning' }
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ~/.lightning
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)

I've also tried running it with ln-path set to /tmp/l1-regtest/

with ps aux I can see lightning is running with this command:

~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l1-regtest
and
~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l2-regtest

Does anyone know how to get lightning-charge to connect to my regtest lightning node?

There are instructions on how to do this in docker in the readme file (https://github.com/ElementsProject/lightning-charge/blob/master/README.md), but it doesn't seem to work outside of docker.

the problem is in your call of charged there you are passing the argument --ln-path ~/.lightning assuming that you run lightning in your home directory thus you have to set ln-path to /tmp/l1-regtest/.

Now you say that this also did not work. So before I give you a solution let me explain what is actually going on. charged talkes to lightningd via an rpc-interface on an UNIX Domain socket. In older versions of lightningd there was a file called lightning-rpc in the folder that you specified as lightning-dir however lightningd has switched its API recently to to have subdirectories in lightning-dir for mainnet, testnet and regtest. (the reason was that in particular in the default directory people wanted to have different configs for mainnet, testnet and regtest)

Thus I assume that you will find lightning-rpc when you do ls /tmp/l1-regtest/regtest which means that you should pass the tmp/l1-regtest/regtest in --ln-path when you call charged. If that is not the case I would have to see another error message.


Bitcoin Exchanges for Self Directed IRA LLC I have a self directed IRA with control through an LLC for funding purposes. Has anyone registered with a bitcoin exchange in the name of their LLC and if so, which exchanges are user friendly for setting up such an entity?

Thank you in advance!

Coinbase was easy and only took a couple of days. I provided ALL required information and it was simple. I also established one with Binance no problems there.


Blockchain Explorer for local full node I would like to build my own blockchain explorer because I have found that using the API's of 3rd party blockchain explorers only gives me around 2 or 3 requests per second.

Does an open source project already exists which will let me explorer my local copy of the bitcoin-core blockchain?

Ideally, I would like to:

Index all transactions into a local database such as MySQL to make searches faster,
Be able to search by tx, address, public key, block number etc,
Would be nice if it can interface with NBitcoin so I can code with C#.

Any recommendations will be highly appreciated.

You could check https://github.com/Blockstream/esplora
I think it ticks all of the boxes, I am not sure about the NBitcoin though.


Mining on Pegged Side Chains How would mining, theoretically, work in Pegged Side chains?

If mining can be done on these side chains, then it seems like too many coins could be created. And once they were used in transactions, how could they be accounted for to know which coins can and which coins can't be moved back to the main chain?

If mining cannot be done on side chains, then it seems like the side chain system could be very insecure, unless there is another way to secure the system.

Sidechains cannot create the same asset that is pegged to Bitcoins to use as a reward for mining. Obviously, it would be problematic if anyone could put in a certain amount of Bitcoins into a sidechain, and get out more/less than what was originally put in.

However, there are many other ways to reward miners. Transaction fees is one example that is also used in Bitcoin. The sidechains paper lists some alternative reward mechanisms in section 6.1 such as demurrage (percentage of held coins are redistributed automatically to miners) and creation of a seperate unpegged asset on the side chain to reward miners.


Is the whole idea of proof of work or proof of stake quite unnecessary and superfluous for cyptocurrencies? I only have a vague idea of proof of stake, but I think I reasonably understand proof of work. In the case of bitcoin, the whole hash thing business has to be combined with a mechanism to increase the difficulty according a certain time calculation. Now this difficulty/time calculation is merely a matter of good faith, and hope that a majority abides by it. If you look a bit deeper, the whole hash function itself relies on good faith, also called the 51% risk/attack whatever.

And hence you have currencies like ripple, which are just faith (maybe one degree higher compared to bitcoin and ethereum) as far as I can see, without any hash or other garnishing. This does seem to be equally functional. So did Satoshi over-design bitcoin? Does this suggest that a whole new generation of minimalistic cryptos will completely sweep away bitcoin, ethereum and the likes?

Can you elaborate some of your statements a bit?

  Now this time calculation is merely a matter of good faith, and hope that a majority abides by it.

When you have a look here you will see that the average block times is 9m 4s. Not too far away from the ten minutes the protocol tries to enforce.

  If you look a bit deeper, the whole hash function itself relies on good faith, also called the 51% risk/attack whatever.

Why does the hash function rely on good faith?

You're example ripple is in no means a replacement for bitcoin or ethereum. It is a completely centralised currency / system. We could use SWIFT banking instead.


Can I verify my own transaction? I'm waiting since 16/12/2020 and i still waiting in the Mempool. Exists a way how can i verify my own transaction without a Bitcoin miner? Yes, i paid a low fee.
Here you can see my transaction:
https://www.blockchain.com/btc/tx/cc32cd350dde5a9141e8180c63fb1aff4245d212d11c8249c58789a93acce4a3

Yes, there exist two possibilities to release your stuck transactions using Fee Bumping:

This page gives exact instructions on how to increase the fee on a transaction that is currently stuck in order to make it unstuck. This is always done by creating a new transaction that will either spend the coins sent by the stuck transaction (called child-pays-for-parent, or CPFP) or replace the stuck transaction (called replace-by-fee, or RBF).

Edit: I recommend consulting Johoe's Mempool Statistics next time before you broadcast a new transaction.


How do I buy bitcoins using a prepaid credit card? [Canada] I live in Canada, I don't have a credit card. I want to buy a prepaid one and but some bitcoins. How can I do this? Or is there a way to use my debit card? Or even go to my bank and do it.

Yes, I am Canadian and I have used both these services:

www.cavirtex.com

They can be added as Online Bill Payee at RBC, BMO, Scotia, or TD Bank (takes 1 to 2 days)

and/or

www.canadianbitcoins.com

I never left my seat and Bitcoins were deposited with the hour!

They use TD Canada Trust, and you can add them as a Payee by calling your EasyLine banking, then make an Instant payment to them.


How to deal with bitcoin/crypto volatility as an online casino? Let's say an online casino has btc as a deposit and withdrawal method.
Assuming A player deposits 1 btc, plays and does neither win nor lose much and then cashes out the balance, which happens to be exactly 1 btc. I am using simple values to focus on the main issue.
However, the btc price was 15% volatile since the deposit was made.
Technically, the player has neither won nor lost based on game play, but he would get a free 15% in value just due to the btc price increase.
The opposite applies if btc loses 15% of value.
Of course it is a nice thing for the casino if the btc price plummets, but potentially disastrous if the price goes up, assuming an average 4% house edge for the casino.
What would be a fair solution for both parties?
Edit: The main game play would be slots, but the same problem arises for Black Jack, Roulette and sports book events. Poker could be affected to a degree as well.
There is no crypto to fiat conversion. An option would be to convert the bitcoin to a Casino token, but fiat is off the table .

Do players gamble in USD or in BTC?
If players gamble in BTC then it is not your problem to deal with. You just deal in BTC and take a cut of the BTC. If the player who wins BTC ends up losing USD, that's not your problem - just like if a player goes to a European casino and wins EUR but then loses money after converting to USD, it's not the casino's problem.
If players gamble in USD and use BTC only as a transfer mechanism, then you should have some sort of financial mechanism to hedge against price changes. For example, you could sell the BTC as soon as you get it, and buy more BTC when players withdraw.
I am not a lawyer and this is not legal advice.


What software can I use to calculate my private key from a seed (e.g. Trezor or Ledger)? I want to make sure I can use my seed from Trezor or Ledger (or others) in a backup process without using an actual Trezor or Ledger to do it.
I have to find out my private key. I probably also need to calculate the addresses I used for receiving bitcoin.
How can I do this?

Any wallet software that allows restoring from a BIP39 mnemonic will allow you to do that, such as Electrum.
However, you should not do this on your regular computer, since putting your private key on your computer defeats the purpose of having a hardware wallet. If you really have to verify your key is correct, and you'd like to maintain the security of having a hardware wallet, do it from a computer that isn't connected to the Internet.


CPU Mining with a large EC2 cluster - worth the effort? I'm relatively new to Bitcoin, and am playing around with pool mining for fun.

I have access to a fair amount of EC2 instances - c1.mediums - between 30 and 50 on a given day.

I already have the 'minerd' CPU miner working on a single instance, connecting to a mining pool service.

Two questions about this setup:

First, would running 50 c1.medium instances, each running 2 threads of 'minerd' at ~ 750 khash/sec/thread be worth it?

Second, I assume this type of mining is allowed in a pool against a single account, but maybe it's not? I am thinking the 50 instances would all work together to increase my account's work load, but I may be misunderstanding a fundamental part of Bitcoin mining.

CPU mining for Bitcoins is almost never worthwhile since the advent of GPU mining. If your EC2 instances are free you're welcome to try but there's a better alternative.

A decent CPU won't get you but 3-5 MH/s of Bitcoin mining power, which at current difficulty and exchange rates will net you about 0.0046 BTC per day (worth about a penny at current rates). On the other hand, that same CPU will net you perhaps 3 kH/s of mining power on one of the sCrypt based forks, I'll use Litecoin (LTC) for this example. Mining LTC on that same CPU will net you about 3.06 LTC per day which, at current exchange rates, will net you about 0.0153 BTC, worth about 4.5 cents per day. It's still not a lot, but at present CPU mining on CPU-friendly forks is much more profitable than CPU mining Bitcoin directly.

As for whether your 50 c1.medium instances would be worthwhile, if (for the sake of easy math) we assume each can produce somewhere in the neighborhood of 2 kH/s of Litecoin mining (decent guess, a 1 MH/s BTC CPU tends to put out about 1 kH/s on sCrypt based variants) then that's a combined 100 kH/s worth about 102 LTC per day, 0.51 BTC per day, or about $1.53 per day. Since I'm assuming the cost of 50 c1.medium instances is more than $76.50 per month, I don't think it would be worthwhile for dedicated mining. If, on the other hand, you already pay for these instances for other purposes and the addition of mining is essentially "free" then an extra $76.50 (or 25.58 BTC) per month isn't too bad.

Finally, yes, all fifty of your instances could work together on a single account in a mining pool. This is so common it actually has nomenclature: each of the running instances would be called a "worker" and while some pools allow you to create many workers, that's really just for your own stat tracking and isn't necessary at all. Each instance can certainly submit shares under the same account without error.


BTC taxation: difference between EU and US How is it possible in US if someone reveiced salary in Bitcoin, right on that day income become taxable? In Europe, in Hungary only when BTC is sold and sent to a bank account it become taxable. So in my country my assumption is, it is possible to postpone when income become taxable received in BTC.

My tax consultant said the reason is because BTC is not an acknowledged currency at our central bank, this is the difference between EU and US BTC taxation. Do you agree?

I suspect that the differences in taxation between EU and US may be less than you state.

Salary is taxed based on the cash equivalent value. If you are paid in paperclips, this is sometimes known as a "benefit in kind" and is taxed in the same way as salary paid in fiat currency. The amount is based on the current cash-value of paperclips.

Capital gains are taxed based on the gain in value. If you save your paperclips until the global paperclip shortage disaster and then sell them for ten times their original cash-value, you pay capital gains tax (not income tax) on the difference.

The wording varies from country to country but the same general principles seem to be followed.
The US IRS say

Q–3: Must a taxpayer who receives virtual currency as payment for goods or services include in computing gross income the fair market value of the virtual currency?
A–3: Yes. A taxpayer who receives virtual currency as payment for goods or services must, in computing gross income, include the fair market value of the virtual currency, measured in U.S. dollars, as of the date that the virtual currency was received.
Q–6: Does a taxpayer have gain or loss upon an exchange of virtual currency for other property?
A–6: Yes. If the fair market value of property received in exchange for virtual currency exceeds the taxpayer’s adjusted basis of the virtual currency, the taxpayer has taxable gain.

US IRS treatment of cryptocurrencies
EU tax treatment of cryptocurrencies


Raw data of transactions in all blocks As of April 16 2018, there have been 518563 blocks (e.g. https://blockexplorer.com/api/status?q=getBlockCount). Is anyone aware of a way to get the number of transactions in each of those 518563 blocks?

There is a page that provides the average per day of the number of transactions per block (e.g. https://blockchain.info/charts/n-transactions), but I want the raw data that went into those averages.

There is another page that provides the list of all blocks, and clicking on a block gives you the number of transactions in that block (https://blockchain.info/blocks), this is what I need, but I will have to click more than 0.5 million times.

Is anyone aware of a way to get the raw data of the number of transactions in each of all existing blocks?


Why there's no bank or institution lending Bitcoins? To the best of my knowledge, there's no bank lending in bitcoins, yet, which surprises me. Now that Bitcoin has stabilized to circa USD $100, I think it could be reasonable for an institution to start lending in this currency. By using Bitcoins instead of a national currency, the number of potential lenders goes way up than the number of banks in most countries, and the interest rates could potentially be way lower.

I thought of a way to make it even less risky for a potential lender to someone they don't know in a remote country: they could ask the potential client to ask for a loan in their national currency to a big, recognized bank. The bank would do the job of assessing the client's capability of payment, do the background checking, etc. and lend (in national currency) the amount they believe the client is capable of paying off, in the selected time period.

This amount would be transferred (via the traditional banking system) to the Bitcoin bank, and the documents for the loan would be scanned and faxed/e-mailed as well (with validated-transaltion attached, of course). The Bitcoin bank could then take the risk-assessment of the local bank at face-value, return aprox. 95% of the amount transferred in the very same national currency to the client so it can pay the loan to the bank almost immediately (thus paying a very small amount in interest to the local bank) and then loan 90% of the original amount but in Bitcoins - at hopefully a lower interest rate. Of course, the difference in the amounts plus the interest would be the profit.

In effect, grabbing the money from a recognized, traditional institution would be a way of saying "hey, look, other guys think I'm worthy of a credit up to aprox. this amount for this time-period". I for one would be happy to give it a try, taking a loan on Bitcoins!

Could this be feasible?

My co-founder and I just started a Bitbond.net where we connect borrowers and lenders and offer an online wallet. Our goal is to make banks obsolete by such a service.

You can borrow Bitcoins by issuing a Bitbond. Before that, we perfom a credit rating to assess the creditworthiness of the issuer. We also do an identity check so if a borrower is late on his or her payments this can hurt their credit score.

The good thing about it is that by connecting borrowers and lenders directly you match the maturities of bith sides. One big problem with banks is that they give out long term loans and refinance them with very short term money, i.e. their client's deposits or overnight loans from other banks. Since Bitcoin wants to be a better and more stable currency we believe that banking as such also needs to improve. That is why we built Bitbond.net


How small can a payment be while still adding value to your wallet? If you receive 1 satoshi (0.00000001 bitcoin) in a transaction then adding it as an input to a larger transaction would add more than 1 satoshi to the transaction fee. This means the 1 satoshi shows in the total balance for your wallet, but in reality it is not worth anything to you because it would cost more than 1 satoshi to spend. In fact if you need to empty the wallet completely then the 1 satoshi is causing a loss.
So how small can a payment be while still adding value to your wallet?

You generally would not be able to receive a single satoshi.
The Bitcoin Protocol defines something known as a "dust limit".
The exact value of this limit varies based on the receiving address type, but it is defined as the minimum amount of BTC required to spend an input for a given address type.
It is calculated by using a basic 1 input 1 output transaction consuming an input from that address type at the minimum acceptable fee level, and calculating its fee (minimum fee level * tx size).
This works out to 546 satoshis for traditional p2pkh addresses, and 294 for p2wpkh addresses.
Transactions that create one or more outputs under the dust limit will be rejected by the network and you will not be able to broadcast them (even if other outputs in the transaction are above the dust limit). If you're left with a value under the dust limit as change, most wallets will add it to the fee.


How to use python reference for encoding a bech32 address? Could someone provide an example of how to use the python reference implementation for generating a bech32 address?

For example, generating a mainnet bech32 address for this scriptPubKey: "0014751e76e8199196d454941c45d1b3a323f1433bd6"

The reference implementation provides a handy all-in-one encode function. To encode the scriptPubKey 0014751e76e8199196d454941c45d1b3a323f1433bd6 as a mainnet bech32 address, you would do:

import bech32
import binascii

spk = binascii.unhexlify('0014751e76e8199196d454941c45d1b3a323f1433bd6')
version = spk[0] - 0x50 if spk[0] else 0
program = spk[2:]
print(bech32.encode('bc', version, program))


Transfer BTC from Coinbase to Bittrex: fee static or percentage I want to transfer BTC from Coinbase to Bittrex. Now I only have a very small amount of BTC to transfer. But I have some money in my wallet with which I will buy BTC and transfer it later.

Now is my question. Is the fee to transfer the BTC static or is it a percentage?

So does it matter if I transfer twice (one 1 BTC, later 10 BTC) or at once (11 BTC)?

The transaction fee is neither static nor a percentage of the amount you transfer. It is based entirely on the size of the transaction in bytes (because a transaction is just data). Since you have no control over the transaction except for one of the outputs, you cannot determine the fee that will be paid.

It is better to send it all as one transaction rather than multiple. This is because there is some overhead bytes in a transaction that are saved by making one transaction instead of two. Furthermore, there is a cost to create a change output (as that would likely need to happen, although it will probably happen anyways) and a cost to spending that change output again when you make the second transaction. Since sending as multiple transactions will incur an extra cost, you should make just one transaction.


Why is increasing block size in the Bitcoin network considered to decrease security? I have been doing some research on the Bitcoin Cash hard fork and the main contention of increasing the block size appears to be the possibility of less security on the network. How does an increased block size result in a less secure network?

Generally speaking, a larger block leads to more computational resources (tx validation, bandwidth, storage, memory) required for each person who wishes to validate newly confirmed transactions.

Higher validation cost lead end-users to rely on/trust
centralised services to "validate" their transactions.
Larger blocks require more time to propagate in the network,
increasing pooling pressures for more centralized mining-pools.

The lower the validation cost, the more we can push validation to the edge (end-user) of the network, the more decentralisation we can achieve. Decentralisation is ultimately the source of security, as it is harder for an external force to attack.


Random Bitcoin address generation From https://en.bitcoin.it/wiki/Address:

  A Bitcoin address, or simply address, is an identifier of 27-34 alphanumeric characters, beginning with the number 1 or 3, that represents a possible destination for a Bitcoin payment.

Is any random address I create following the above rules going to be an address I can sucesfully send Bitcoin to?

For example if I randomly generate these addresses:

1AAAAAAAAAAAAAAAAAAAAAAAAAA
3111111111111111111111111111111111
2FWIOHFEWNFEOWEFHO34234242244EFDE

Are these all valid addresses I can always send Bitcoin payments to?  Or do they have to already 'exist' in some capacity?

Addresses are randomly generated starting from a private key. The private key is the only truly random value in a whole chain of interesting values. These values are then mathematically derived from the private key. On the other end of the chain of values is the address.

Now if you could simply pick an address and recover the private key that, when passing it through the address derivation mechanism, gives you that address we would be in a lot of trouble. People could simply listen to transactions on the network, extract the receiving address, reconstruct the private key and spend the funds, even if they were not the intended recipient. So at this point it should be clear that simply picking an address and go ahead from there is not possible, in other words some of the functions in the chain are non-reversible.

So starting from the private key, we construct a public key. Already this first step is non-reversible, otherwise public-key cryptosystems would stop working. It should be computationally unfeasible to recover the private key from the public key. Bitcoin further goes ahead and hashes the public key twice. This step is non-reversible as well.

The first character of the address depends on the address version and may not be freely chosen. Then there is the matter of the Base58 encoding, which unlike the other mechanisms is reversible.

Finally the last few characters in the address are a checksum which is again calculated as a double hash of the already hashed public key. So for these last characters there is simply no way of "choosing" them so that the address looks a certain way.

So to answer your question: no, you cannot simply pick an Address that looks nice and use it as yours. That's also the reason why tools like vanitygen exist: they simply pick a random private key, transform it until they get an address and then check whether it has the desired features, e.g., your name in it. The more restrictive you are with what you want your address to look like, the harder it gets to find one that does. This difficulty increases exponentially, hence the term computationally unfeasible above.


Implementing Multi-Sig Escrow? I want to start a BTC market.  I understand all the ways to go about creating a site, it's just the payment implementation which confuses me.  I want multi-sig transactions capable between my users on site.  If I understand correctly, multi-sig addresses are just special wallets anyways which require a certain fulfillment (2 out of three keys, for example) to go through.

How can I implement a system like this for my users on my server?  So I can allow users to trade without the middle man if possible, yet also have the opportunity for an escrow moderation in case something happens?  In the end a small percentage of market fees can be charged?

I'm new to Bitcoin programming but I'm assuming you simply have your web application interact with server daemons which dynamically create multi-sig addresses on demand for your users and somehow give them each a key, and leave a key for escrow moderation?  And that would probably be all you'd have to do?

You basically got it.
create 2-of-3 multisig addresses (meaning needing two out of three signatures)
1 is for the buyer, 1 is for the seller, and 1 is for the mediator

buyer sends money to the multisig address, commiting the funds to the transaction
if the transaction goes well, buyer sends a signed transaction
spending the multisig output to the seller and sends the transaction
to the seller, the seller signs the tx and broadcasts it
if buyer is unhappy he/she can try to work out the matter with the
seller till they agree on any split of the money, it would involve
same steps as in (2) except now the money is divided (any
percentage) between the buyer and the seller
if the buyer and seller can't work things out, the mediator steps in
and after a decision is made, the money is split between the three
addresses (buyer, seller, fee for mediator)

So those are the conceptual steps to implement the scheme


Do pool servers check for duplicate shares? Assume, for the sake of argument, that I am a miner and that I am ready to cheat. The (stratum) pool server sends me a notify message and I start mining. I find a valid share. I submit it to the pool server (which, presumably, checks if it is valid). Now, what happens if I re-submit it a little while later, in order to artificially increase my number of accepted shares?

So stratum pool server keep a list of submitted shares and check for de-dups? On large pools, where miners report a share every few seconds, this means keeping about 16kbyte of data for each miner, and scanning through it every time it submits a share. So it seems feasible.

But is it actually done?

Yes, it is absolutely done. A well known exploit in early stratum mining pools was that they used string comparison when looking up duplicate submissions, where nonce aaaaaaaa and Aaaaaaaa are identical but weren’t caught by the duplicate submission check. You could submit a share up to 2**8 times if you were lucky and got an all alpha encoding nonce, and thefts from pools using this exploit did happen.

You only need to store the work ID and the nonce, and pools can tune the client to only be submitting a share every few minutes if they choose. It’s not a particularly intensive task to keep tack of submissions.


What happens if nodes have different P2P versions during discovery? My understanding is that nodes connecting to each other to exchange messages starts with a version handshake such that each node sends its P2P protocol version and gets an acknowledgement and vice versa. If the nodes are running different versions then communication cannot continue.
So according to this developer reference would it be correct to conclude that a node running Bitcoin Core v0.13.2 and another running on release v0.13.0 would not communicate?
Also, if a significant number of nodes run different protocol versions, is this situation what would result in a hard fork?

If the nodes are running different versions then communication cannot continue.

That is incorrect. If two nodes interact which have different versions, they just communicate using the lower of the two versions.


How many bits of entropy is a Bitcoin address? I've seen references to 160 bits of entropy, but I'm not sure if this is universal or just applies to the old address format.

For Pay2PubKey addresses, it's always 160 bits of entropy, regardless of the address format (old, 1... or the new Bech32 format)

Pay2ScriptHash addresses, in the old Base58 format (3...) have 160 bits of entropy.  In Bech32, they have 256 bits. You can read more about why the developers increased it here and here.


I have a 100 character text message and I want to encrypt this message with my bitcoin "PUBLIC KEY" and decrypt it with my private key in Javascript Are there any javascript libraries that can encrypt a 100 character text message using your bitcoin public key, but only be able to decrypt it with your bitcoin private key?

I'm looking to create a web form that can encrypt the form values using only your bitcoin public key. And on the other end when received it can be decrypted with the private key.

You could use something like this eccrypto (Do your own research on the security of this implementation). Also, doesn't appear to allow compressed public keys. Update: It now supports compressed keys as of v1.1.

index.js

var crypto = require("crypto");
var eccrypto = require("eccrypto");

var privateKey = new Buffer("c337ded6f56c07205fb7b391654d7d463c9e0c726869523ae6024c9bec878878", "hex");

//var publicKey = eccrypto.getPublic(privateKey);
var publicKey = new Buffer("04730a151f545f5dcdb1c6d99fb1251f5c70f216f39ba2681bcf10db16bd582e6720bc881d51f25ffbe961df6a0af24a9d39a4db3d86a7f6b3f9bf4eaac0e4006b", "hex");

// Encrypting the message for B.
eccrypto.encrypt(publicKey, Buffer("msg")).then(function(encrypted) {
    console.log('Encrypted message ' + JSON.stringify(encrypted));
  // B decrypting the message.
  eccrypto.decrypt(privateKey, encrypted).then(function(plaintext) {
    console.log("Decrypted message: ", plaintext.toString());
  });
});

Output

$ node index.js
Encrypted message {"iv":{"type":"Buffer","data":[204,13,168,25,80,255,9,233,111,60,165,204,180,126,53,65]},"ephemPublicKey":{"type":"Buffer","data":[4,192,3,65,241,134,65,186,52,52,250,61,208,189,216,167,122,206,156,152,27,173,69,152,37,138,164,5,54,189,227,88,37,243,220,183,22,204,235,37,212,110,207,66,225,244,25,92,69,223,247,175,218,228,134,210,247,190,211,248,239,77,183,21,36]},"ciphertext":{"type":"Buffer","data":[75,104,205,95,93,108,18,50,220,120,164,224,42,214,75,28]},"mac":{"type":"Buffer","data":[63,243,230,143,99,187,246,241,194,10,247,215,188,163,82,98,140,15,186,158,58,207,170,49,230,143,26,17,117,248,195,143]}}
Decrypted message:  msg


Closing a channel in Lightning Network I have some doubts about the closure of a lightning network channel. As far as I know, there can be (al least) 4 different scenarious:

one node decides to close the channel, and the other one accept the decision. The channel is then succesfully closed.
one node decides to close the channel, but the other node doesn't respond to its request. A time period passes, and the channel will be closed with the transaction of the first node. In this case, what would happen if a user tries to close the channel with a malicious transaction (i.e., with an older transaction), and the other user doesn't respond?
one node decides to close the channel with an older transaction, and the other node claim all the funds due to a malicious intention.
one node decides to close the channel but the other node refuses. Is it possible this scenario? What would happen in this case?

The first three scenarios are indeed possible, the last one is identical to the second.

This is called a collaborative close. It has the advantage of using a lower on-chain fee since the transactions are not time critical and the users get their coins back immediately (no dispute time).
If the other node is unresponsive (offline or doesn't sign a collaborative close), you can do a unilateral close. The downside of a unilateral close is that the closing party will have their funds unavailable until the dispute is settled (usually about 24 hours) and higher fees are leveraged since this is a pre-signed transaction that is time-critical to get confirmed.
This is called a breach-attempt, and is the reason for the dispute period above. The breach is basically publishing an old unilateral close transaction, and it needs to give the counterparty time to react and punish the breaching party.

So in all cases well-behaved parties get their funds back, the difference is just in how long it takes.


Should port forwarding for running bitcoin be done also on the ISP's router? Follow up question on What is the NAT traversal technique used by bitcoin.

The network architecture described here https://superuser.com/questions/1109859/2-routers-connected-in-series-and-port-forwarding is something that I (probably) have in my home (and probably 99% of other people):

Internet > ISP router (NAT 1) > My home router (NAT 2) > My Node

So my Node is hidden behind 2 NATs. Therefore I should forward ports on both routers to allow incoming connections to my Node.

But people have no access to NAT 1 and can only port-forward NAT 2, and must probably contact ISP to port-forward NAT 1.

How do people run their nodes with incoming connections enabled when this issue is present?

EDIT: In discussion with lenlord it seems that his ISP's router does not perform NAT and that his home router has (dynamically) assigned public Internet address. Is this the standard configuration ISP's provide for homes.

EDIT2: After contacting the ISP and reading some forum posts I found out that I'm indeed behind their NAT (NAT 1 in picture, so called CG-NAT), but that they can remove it for me for free.

In discussion with @lenlord it seems that his ISP's router does not perform NAT so that his home router has (dynamically) assigned public IP address.

After reading some forum posts and contacting the ISP I found out that some ISPs (and mine is one of them) do indeed hide households behind their NAT (NAT 1 in picture, so called CG-NAT), but that they can remove this NAT for free on demand.

Remove this NAT on the ISP's router is needed to operate bitcoin node with incoming connections.


Custom Payment Gateway UX Help (in app purchases) I have built a very basic custom payment gateway that accepts Bitcoin.
I am running a Bitcoin Core node in a Docker container. I have a backend web service that sends rpc calls to this node to read / send transactions. This web service acts as a bridge from my secured web service to my Bitcoin Core node.
I have an iOS app that I use to accept Bitcoin payments. (it consumes the formerly mentioned web service).
When I want to charge the user (in app purchase), I present the user with the amount of their bill and a QR Code (as any merchant payment gateway would do).
I also allow them to automatically copy the information to the clipboard to paste into their crypto exchange for sending. This is usually how they send the transactions. You can’t exactly scan a QR code if it’s on the same device you’ll be sending a payment from (via the Coinbase app or whatever).
Is there a better way to do this that I’m not thinking of? I really want the UX to be smoother. It would be cool if you could auto-open the Coinbase app and pass data to populate the payments screen in Coinbase, so the user can proceed from there. Maybe using iOS universal links? I can’t seem to find anything on the internet about this level of functionality.

I think you may be looking for "Bitcoin Universal Resource Identifiers (URIs)" as specified by BIP21, a standardized string format for bitcoin payment requests.


Erroneous blockchain transactions...more coins than I specified! This isn't directly related to Bitcoin; rather this is related to Infinitecoin, however the technologies are virtually the same.

The other day I sent 2,000 IFC from my wallet (Infinitecoin-QT for Windows, version 1.8.8.0) to another address.

I looked at this transaction on the blockchain, and it is reporting that I sent 60,000 IFC.

The transaction shows the 2,000 IFC as being sent to the correct address, and then another 58,000 IFC to an unknown address.

Here is a link to the transaction for more info:

https://coinplorer.com/IFC/Transactions/106a8812b178c74b65303c42c8a754941db4a296b861eab116d71bd8f4c0492c

I'd really like to know where my 58,000 IFC went!

P.S. My wallet does not show 58,000 missing coins

The 58000 coins have gone to a change address in your wallet. When you sent 2000 from the 60000 UTXO you've had 60000 go out to two inputs: your change address and the spending address.

Keep this in mind: when spending from a single input you're  sending the whole lot!


Can I print my public key using a custom logo? qrycode monkey allows me to print a qr code with my company's logo in the middle.

Q: Can I do the same for our public key?

You generally don't publish your public keys, you give clients an address (which is usually computed from a public key, but not exactly the same).

You can definitely put an address in a QRCode. Putting a logo in the QRCode doesn't change anything about that.

Generally you'd put a "bitcoin:" URI in the QRCode. More information can be found in BIP21.

Note that best practices involve not reusing addresses for more than one payment (and certainly not for more than one customer, or you wouldn't be able to tell what the payment was for), which may make it harder to use a custom web-based service for generating the QRCodes.


What effects would a scalable Quantum Computer have on Bitcoin? A scalable quantum computer is a quantum computer that is easy to extend - adding more (q)bits of memory is not a fundamentally hard problem, and will happen. Or, alternatively, that it follows Moore's Law - its memory capacity and speed will increase exponentially over the years with technological advancement (the exponent might be relatively low).

Suppose such a Quantum Computer were constructed tomorrow - what would this mean for bitcoin?

You have a good discussion in:

https://bitcointalk.org/index.php?topic=133425.0

Basically, ECDSA is compromised, hashing isn't. With a quantum computer, you could easily deduce the private key corresponding to a public key. If you only have an address, which is a hashed public key, the private key is safe. Anyway, to spend a transaction, you need to send the public key. At that point you are vulnerable, but the attack is not straightforward.

In general, quantum computers are not exponentially better than classical computers. You cannot access all the states in the superposition, only global properties. You can read http://www.cs.virginia.edu/~robins/The_Limits_of_Quantum_Computers.pdf to get a good idea of what they can and cannot do.


Server based BitCoin wallets Is there a Bitcoin wallet which can be installed server side with a direct access iOS/Android app to maintain the funds but where two different parties can access it directly.

Yes you can use bitcoind: https://en.bitcoin.it/wiki/Bitcoind

and use the

the bitcoin json rpc api https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list


Understand how wallet works My goal is to understand the bitcoin internals.

Here is what i have done:

I have downloaded, maked and installed bitcoin sourcecode from github.

I have launched the bitcoind daemon. Everything seems to work because i can generate addresses with bitcoin-cli.

My first question is: When and How my private/public key was generated ?
I had nothing to do for that and i am wondering when this operation was done.

My second question is: I know this is not a good practice but if i only know my private/public key in clear format (not encrypted): Is there a way for me to "import" this public/private key into my bitcoin wallet.
In other words, can i say if i know my public/private key, i know everything.

Thanks

Welcome to the Bitcoin world.

  My first question is: When and How my private/public key was generated?

Your public key is calculated by your private key.

Where your private key is a randomly chosen number, so let's suppose that now we choose k value as your private key, from this we can apply a unidirectional cryptographic function, ie from the private key I can ALWAYS get my public key but it is impossible to contrary (unless expensive brute force attacks, where the game is not worth the candle)
This hash function is an elliptic curve function, I leave you the reference to a bitcoin book.

So I have my private key K where I apply my asymmetric encryption algorithm and get the public key.

P = hash_fun (K);

  My second question is: I know this is not a good practice but if i only know my private/public key in clear format (not encrypted): Is there a way for me to "import" this public/private key into my bitcoin wallet. In other words, can i say if i know my public/private key, i know everything.

Yes, the wallet is formed by the pair (private key, public key) many wallets keep the whole pair but it is possible to get the public key whenever you want, if you know the private key, but not vice versa.

So your private K key is your wallet, or rather what makes your wallet alive


How do I reconfigure a Mt. Gox Yubikey? After following the instructions here, which suggested I use ykpers or the gui version, I discovered the Mt. Gox Yubikey is protected by a "configuration protection access code."

From the manual:

  Protection of the key and configuration data

  Given the symmetric nature of the AES encryption algorithm, the
  security of the Yubikey relies that the AES key is logically and
  physically protected both in the key and in the server that verifies
  the OTP.

  The configuration data is updated via a configuration API, accessible
  via the USB interface. To prevent unauthorized update, the
  configuration can be protected by a 48-bit access code. If used, an
  exhaustive search of all combinations would typically take some
  100,000 years to perform. Furthermore, the Yubikey configuration data
  is write-only, i.e. configuration data and the key can only be written
  but not be read. This means that unauthorized update of the
  configuration is an act of sabotage rather than a security threat.

  The configuration data is stored in a non-volatile storage integral to
  the microcontroller. A potential attack is to physically probe the
  silicon or analyze the hardware behavior to potentially gain full or
  partial knowledge of the stored secrets. However, such an attack would
  require a complete break-up of the Yubikey, involving dissolving the
  microcontroller chip encapsulation. Furthermore, very advanced
  equipment is needed to probe the chip internals. Given the effort and
  costs involved for such an attack, this is not considered a threat
  given that just a single device will be broken.

Yubikey wrote me:

  In case, if you have forgotten the configuration protection code or do
  not find it in the log file, then you can not reconfigure the YubiKey
  slot again. This functionality is implemented to strengthen the
  security.

Also, he wrote:

  In the context of the manual, an "unauthorized update of the
  configuration" would be changing the configuration settings on an
  unprotected YubiKey. Since you already have an access code in place,
  you cannot preform such an update.

But it should still be possible to "sabotage" a Mt. Gox Yubikey, no? If not, why? If so, how?

thanks

What is also strange is that when I try to create an account at forum.yubico.com or test my Yubikey at demo.yubico.com, they reject my OTP. Yubico Forum's registration says my OTP can't contain non alphanumeric characters, and it sometimes contains periods. [Update: this ended up being because I was using Dvorak keyboard layout for the Yubikey. I've changed it, and now my OTPs work on these sites.]

UPDATE #2: I found this: https://github.com/nezza/yubicrack
But there has to be a quicker way than doing a brute-force search of the code. I really wonder why it is so hard to flash a Yubikey? Is it so that others can't render it effectively "lost" or "stolen"?

Mt. Gox locks their Yubikeys with an access code. You cannot reprogram them without the code. If you're willing to wait a few months, you can brute force it.


Testing altcoin reward halving - Help! I am currently working on reward halving changes for a test coin and i have added all the necessary changes but my question is how do i safely test this new halving without affecting production. I understand bitcoin has testnet but is there a way to test the altcoin halving. May be connecting two daemons with each other to create a closed network? Thank you in advance.

If your test coin source code has the same regtest mode as bitcoin, you can use that, it allows you to mine blocks instantly and it's a completely separate chain to the testnet or mainnet so it won't affect anyone else. You can run your coin with the -regtest argument, and then use the generate RPC to mine blocks and see how much reward you get. Note that in the source code, the regtest reward halving may be (and probably is) a different number of blocks to mainnet, this can be changed in chainparams.cpp


What block had the most transaction fees? Why? What block had the most transaction fees? Why? How big can transactions be? What's the largest transaction (size, in bytes)?

I am not sure which block it is, but you can see it on this graph from blockchain.info. It was ~305 BTCs in transaction fees. The blockchain will not tell you why the transaction fees are so high. It is probably an accident or a joke.

I believe the largest size a block can be is measured in terms of bytes, and it is 1MB. So the largest transaction can be as large as 1MB of data will let it be.


Lost / Forgotten Wallet? I have this issue I have... When I first started using crypto currencys I used a lot of wallets ... etc trying to get a feel for what I wanted.. so ... Now I have a wallet that reads . 01 BTC balance and while I recognize the the last few letters of the address .. I have no clue what or where is it.. Evercoin, Crytonator, Coinbase... Any ideas .. I am sure I can find it if I had and clue where to look...

If you were getting transaction notifications to your email address, you might be able to find something in your mail account. Other than that, an address alone does not provide any indication which service or software might have generated it.


What would be the technical, and wider, implications of a cryptocurrency that used proof-of-disk-space? ShelbyMooreIII is promoting AnonyMint and/or AnonyCash as a concept* cryptocurrency based on a disk-space intensive algorithm. Some details are given here: http://anonymint.org/#Proof-of-Work_Designs

What would be the positive or negative impact of this kind of software on:

The disk you're running it on
The CPU/GPU of the PC
The HDD market
The environmental effects of increased disk manufacture (I'm assuming here that such a currency would cause an increase in production)
Anything else substantially affected

*I don't know what stage of development AnonyMint is at.

I'm speculating here, because I'm not going to test anything out.

The IOPS would like shoot through the roof. The potentially large amount of writes and reads will likely affect disk life, especially if the disk is an SSD. It would generate excess heat. A magnetic disk would also generate constant vibration. Heat can be controlled easier than GPU or CPU heat because there's less of it, and vibration can be dampened using rubber mounts. The largest risk is simply drive failure due to above average activity.
The GPU would likely be idle. The CPU would only be necessary to drive the hardware operations.
I think it may be difficult to get a 3 TB drive for that new gaming rig, because all of the miners would be trying to pack as much disk space into a device as possible.
I don't know enough about the manufacturing process to hypothesize accurately.
I could see a lot of need for drive recycling. HDDs burn out a lot quicker and take up a lot more waste weight than CPUs and GPUs.

What's interesting about the proof-of-storage-space concept is that it can really take advantage of unused space on consumer devices. I know I've got a 500 GB hard drive in my work computer that has never seen more than 50 GB on it. Amalgamate that across a corporate network, and there's probably PB of space available! I could see malicious types taking advantage of this in malware pretty easily, too: high CPU or GPU usage causes lots of heat and terrible performance, while high HDD usage can just make a program take a few seconds longer to start up.


Any need for coinbase field in coinbase transaction? My understanding is that every block in the bitcoin blockchain has a coinbase transaction which contains a coinbase field. It is essentially an orphan field (placeholder) for use in claiming existing outputs. Since the coinbase transaction does not need to claim any existing outputs, it can be filled with any random data the miner chooses.

Would there be any adverse effects on Bitcoin (security or otherwise) if restrictions were placed on what the coinbase field can contain?

[Note: such a restriction may be desirable in order to prevent Bitcoin from being used as a parent coin in merged mining.]

The coinbase field is crucial for pooled mining. All workers in a pool will be working to produce a block with the same list of transactions and the same block reward recipient address (that belongs to the pool owner/admin). The "nonce" field in the block header is only 32 bits long. The only way each worker can independently avoid wasting cycles on duplicate work is for the each worker to be assigned a different piece of coinbase data.


What is expected of current mining equipment 2 years from now? I am curious if I buy a miner  today what good would be two years from now, will it still mine the same way and also still be profitable? Assuming that the difficulty factor is adjusted to the way that it mines.

Presumably you are asking about ASIC hardware as there is no sense in acquiring more GPU or FPGA hardware at this point in time.

There are always optimizations possible, so while the work performed by the miner hardware today will most likely still be a valid method two years from now there may be new approaches that make current mining hardware either incompatible with the new method, or of too low of performance to justify continuing to use it for mining.

As far as it being profitable, that cannot be answered.   Mining hardware profitability is determined by the difficulty level at intervals over time and the exchange rates -- neither of which can be known today.

Mining is a form of speculation on the Bitcoin exchange rate.


Are Bulletproofs fully implemented into liquid? Blockstream themselves released a paper in 2018 about a more efficient range proof and Calles IT Bulletproofs. I'm wondering if it is already fully integrated into the liquid sidechain?

No, the Liquid system isn't using Bulletproofs yet.

The code has been written to use them, but switching over will require more review, and a hardfork upgrade once deployed.


Bitcoin QR codes: raw address or Bitcoin URI scheme I am the author of bitcoinaddress.js library and I am wondering what's the best content for Bitcoin QR codes.

What Bitcoin QR codes should contain (for mobile wallet apps and other barcode scanners):

Only Bitcoin address (this is only one I have seen wild myself)
Bitcoin URI scheme link (BIP 21) with payment amount, transaction note, etc.

Currently I implemented address only, as I don't know how well-spread BIP 21 support is among the mobile phones and mobile wallets. If anyone can give me some answers and pointers to the prior research regarding the matter I'd be grateful.

I'm working on a Bitcoin project, and what I've seen are:

Just the Bitcoin address
A url parameter-like scheme with the format "bitcoin:{plus the bitcoin address}" (no brackets used)
A more elaborate url parameter that includes the amount, like "bitcoin:{bitcoin addr}?amount={the amount}

Coinbase uses the last scheme and it is fully recognized by the BlockChain iPhone app, enabling you to request a certain amount of Bitcoin directed to a specific address.

Coinbase uses the (deprecated) Google chart apis and the full querystring they use to build a QR code looks like this:

<img width="300" height="300" alt="Chart?cht=qr&amp;chl=bitcoin%3a1k1yfezde2c37pwdevjnin1yc2qbtly6bk%3famount%3d0" src="https://chart.googleapis.com/chart?cht=qr&amp;chl=bitcoin%3A1K1yfEZde2C37pWDevjnin1yc2qBtLy6bk%3Famount%3D0.01&amp;choe=UTF-8&amp;chs=300x300">

If you run that src url through a url decoder, you'll find that it requests 0.01 BTC to the address 1K1yfEZde2C37pWDevjnin1yc2qBtLy6bk.

When you're building a QR code, you don't need to url-encode the data.  Coinbase is only doing so because they have to request the QR code from Google through a url addressing scheme.

I build my QR codes on my own server and display them as images on a web page, and I just use non-encoded data.


Why bother checking both public key and signature in P2PKH transactions? In a P2PKH pubkey script, first, the public key provided by the intended spender is verified to be correct and then this key is used to verify the spender's signature.

I wonder why just verifying the public key is not enough. The pubkey script contains a cryptographic hash of it, so reversing should be impossible and anyone wanting to spend the UTXO associated with that script needs to have the correct public key. Doesn't that already authenticate the spender sufficiently? I understand that signing is necessary in P2PK transactions, but with P2PKH, hashing and signing seems redundant to me.

Isn't mere hashing of the redeem script also used for authentication in P2SH?
The pubkey script in P2SH just checks if the redeem script hashes to the correct value and then it already executes it. If hashing is taken to be secure in P2SH, why not also in P2PKH?

1) The addresses would obsolete after one use.

2) If someone does a Sybil attack, s/he can prevent the transactions from relaying (which may also happen now), but also s/he can make a fake transaction from that address and relay it, as the attacker knows what the preimage is.

3) Even without a Sybil attack, someone could take advantage from eventual orphaned blocks and grab the money from all transactions in them, by making a fake transaction for each one.


Why did Ripple do a giveaway? Was there ever a stated reason for the giveaway?

Was this in response to the ridiculous criticisms they received such as "centralization" and concentration of wealth?

The best description of XRP distribution/giveaways I've seen is on Ripple Labs XRP Distribution web page.
The whole page is worth reading, but I'll just include a few select quotes that may address the question:

Users don’t need to hold XRP if they prefer to transact in other currencies (e.g. dollar, euro, yuan, gold).

…

The inventors of the Ripple protocol created 100 billion XRP at its inception, and no more can ever be created according to the protocol’s rules. The creators gifted Ripple Labs 80 billion of the 100 billion XRP in existence.

…

Ripple’s method of confirmation, called consensus, doesn’t need mining; therefore, it requires comparatively negligible computing power, confirmation time adapts to network latency, and transactions are immediately irreversible once confirmed.
Because Ripple’s new architecture does not require mining, the creators of Ripple had a choice: distribute XRP exclusively via mining or diversify the distribution methods.
Distributing value is a powerful way to incentivize certain behaviors. Bitcoin’s mechanism, for example, led to an explosion of processing power devoted to bitcoin mining. Our goal in distributing XRP is to incentivize actions that build trust, utility and liquidity in the network.


Will BTC value depend on their history? It might seem that virgin coins will have higher value than older coins that have lot of exchange transactions that might make it more traceable.

Is there some prevision in the protocol for this effect?

There is none, and I don't think it will ever be significant. There is a gentleman's agreement that's part of what makes Bitcoin work that a Bitcoin is a Bitcoin is a Bitcoin.

You can have a few "rare Bitcoins" with extra value. I might pay extra to have one Bitcoin transferred to me directly from the coins in the genesis block, for example. But just like there can be a few rare dollar bills, a dollar only works as a medium of exchange if more or less, we all agree that a dollar is a dollar. A prime serial number is cool, but your grocery store can't care about that if it wants to do business.


Is the threat of computer malware to steal Bitcoin exaggerated? Some months ago I put a small amount of Bitcoin into an account and wrote the address and private key into a text file. I have left on my computers and on those of a couple of friends. The money hasn’t been taken.

Where does the main danger come from? Screenshots, key-logging or what?

My main motive in asking this is that I use bitaddress.org offline to generate addresses, but without using Ubuntu or taking out my hard drive. I never copy my private key onto the clipboard, and I wonder whether the danger I face of having my coins taken - particularly if I store more in this way - is real or merely highly improbable?

Currently attacks against Bitcoin users can be categorized as

"Normal" keylogging malware which stoles credentials to Bitcoin sites and steals Bitcoins from your online wallet (unless you have two-factor authentication). These kind of malware infections generally steal all your passwords, including Facebook, PayPal, and they do not especially target Bitcoin users.
Password reuse attacks - if you have used the same password on some other sites, your username and password are stolen or taken from the site and then tried on all popular Bitcoin sites. This may especially happen with shady services like faucets which promise "free bitcoins" if you sign up.
Phishing attacks, both via email and Google advertisements. E.g. if you search BlockChain or LocalBitcoins on Google, the first "result" is an advertisement leading to a phishing site. The user gives his username and password on the phishing site, then the site will empty the wallet on the actual Bitcoin site the user thought he/she was logging in.
Malware and computer viruses targetting locally installed Bitcoin software. These steal wallet.dat or unencrypted copy of it from the memory when you unlock it.
Malicious browser addons (Chrome) targetting popular Bitcoin sites. These may modify Bitcoin receiving address on the page in-fly, so that they can get around two-factor authentication protections set up by Bitcoin sites.
Malicious Tor exit node attacks - if you want to hide your tracks using Tor network, there are malicious exit nodes which will do HTTPS man-in-the-middle attack using fake security credentials. The web browser warns about this, but an ordinary user may ignore the warning.
Social engineering attacks. If you are a "known Bitcoin celebrity" criminals might to attack your personally, by phone calling you and posing as a service operator, police etc. They might go after your ISP, email provider, etc. and try to social engineer access to your email.
Very difficult to pull attacks, like rerouting all Internet traffic just to gain access to Bitcoin mining pool IP addresses

There are already 100+ strains of malware targeting Bitcoin users. Because Bitcoins are easy to steal from careless users, it seems to be profitable to include Bitcoin-stealing capabilities in all malware kits. In the light of this, malware threat against Bitcoin users is not exaggerated.

Of course, to get your Bitcoins stolen by malware, you need to get your computer infected. The ways to protect yourself include

Do not install applications or browser extensions on your computer from non-trusted sources, especially pirated applications or random download sites which offer Microsoft Windows application downloads. Always download all Windows software from the webpage of the software author. For OSX or Linux use App Store or the Linux distribution package manager.
Always keep the software on your computer up-to-date. Nearly every vulnerability widely exploited by cyber criminals has already been patched by the software manufacturer.
Use safer operating systems like Ubuntu Linux and OSX instead of Microsoft Windows, to lower the risk to get infection on your computer
Use password management software, like KeePassX, and random password on every website
Keep most of your Bitcoin holdings offline, on a separate device not connected to Internet


Getting bitcoin globe data I just saw this bitcoin globe https://blockchain.info/nodes-globe?series=topBlockRelay
It has two modes,"Online Now" and "Miners". I wanted to ask if anyone knows what the bars and colors stand for and if there are any APIs which I can get those data.
Thanks

That "information" being shown is effectively useless and therefor isn't made available in any consumable form. What is being shown is the GeoIP lookup of the node that a block or transaction was relayed to Blockchain.info, and the frequency at which that location appears in their database. It doesn't reveal the location of the originator of either inventory item, or provide anything worth knowing about the state of the network or its users.

http://getaddr.bitnodes.io/ shows the approximate locations of many (but not all) listening Bitcoin nodes, which is about as close to reliable data as you can get for this sort of network.


ELI5: is it true that Base58 doesn't prevent typo, but Base58check does, really because there is a checksum? I am reading the book Grokking Bitcoin by Manning 2019.
It first said, if John sends the token (bitcoin) to the cafe owner but made a typo in the cafe's address (the PKH), then that token is "burned" and gone forever. Nobody can use it whatsoever.
So to safeguard it, Base58check is used.  But Base58, like Base64, is merely to convert some numbers to different representation of characters, and can be converted back and forth freely by anybody.
But it seems like, what is at work to prevent the "typo" is not Base58, but that there is a 4 byte "checksum", perhaps like some banks, when you tell them the account number, they have a one digit checksum which is the last digit of your account number, to see whether the checksum match.
So the Base58check really depends on this "checksum" to verify that you didn't make a typo, and the odds that you made a typo but the checksum still checks is by that 4 bytes, therefore is 32 bit and is 1 in 4 billion odds?  So it is not Base58 itself, but the "check" part or the "checksum"?

Yes. Every byte sequence corresponds to one Base58 string. Every byte sequence also corresponds to one Base58Check string, which contains a 4-byte redundancy, a checksum.
And this 4-byte-code's only purpose is the detection of transmission errors (typos). Newer Bech32 addresses have a different kind of checksum allowing error correction, up to a certain level in addition to error detection.


How to create bitcoin wallet for many users? I need create bitcoin wallet for many users but I have no idea how to do it.
Before that I thought to do it with bitcoin-core. But it turned out that accounts are not what I need. In the new version (v.0.15.0) of the bitcoin-core there are multi-wallets, but to add a new wallet it is necessary to restart the daemon.
Who can tell me?

To manage many users balances, you should generate a new deposit address for each person, and keep track of their balances via your own database or similar, rather than relying on the deprecated account system in bitcoin core.


Which bitcoin wallet allows me to generate and export a large number of addresses? I need a software Bitcoin wallet (not web account based) that allows easy generation of many new payment addresses at once that are ideally stored in plain text, (bulk exported as plain text). The security is not a concern.
I like Bitcoin-Qt but it is outdated and it takes forever to download the entire chain, which make it not portable in a way.

Is it necessary to download the chain? If one can use a paper wallet than one must be able to use software one without having the blockchain, or having just a small number of blocks, right?

It is not necessary to download blockchain to generate address. Use an HD wallet like electrum, so that you can regenerate wallet using seed even if you lose private keys.

To generate addresses http://docs.electrum.org/en/latest/faq.html#how-can-i-pre-generate-new-addresses
To export addresses use electrum command line http://docs.electrum.org/en/latest/cmdline.html


What is the difference between signrawtransactionwithwallet vs signrawtransactionwithkey in signing unsigned raw transaction? I have a bitcoin address generated in bitcoin-core (offline computer)
I imported that one address into electrum as a watch-only wallet (online computer)
From electrum I created an unsigned transaction scan it back using QR code to the offline computer.
Which one should I use to sign the unsigned transaction using bitcoin-core? signrawtransactionwithwallet or signrawtransactionwithkey? If possible please tell me the different cases of which one to use?
Please also tell me if there is any better way to sign unsigned transaction using bitcoin-core.

signrawtransactionwithwallet is used to sign transactions for your wallet in which you can avoid entering private keys for spending different UTXOs as the private keys are in your wallet. You may need to enter passphrase using walletpassphrase
signrawtransactionwithkey is used to sign transactions for spending any UTXO using private keys
Examples:

I create a transaction for spending UTXO associated with address tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey that belongs to my wallet

createrawtransaction "[{\"txid\":\"a1a564ae1983e1a87e731c4b9b205f3e8edbd724bb03d4474090f32ccd8f55a0\",\"vout\":0}]" "[{\"tb1qlu4kjktgcdru8cjnlx47me2ha4phxgceg2v4mj\":0.01}]" 0 true

Sign the transaction using signrawtransactionwithwallet without entering any private key
signrawtransactionwithwallet 0200000001a0558fcd2cf3904047d403bb24d7db8e3e5f209b4b1c737ea8e18319ae64a5a10000000000fdffffff0140420f0000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000

Or I could sign the same transaction using private key for tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey
dumpprivkey tb1qlqyjzjuxel0r80gs97uf5snh0a0kesmjyxxzey

signrawtransactionwithkey "0200000001a0558fcd2cf3904047d403bb24d7db8e3e5f209b4b1c737ea8e18319ae64a5a10000000000fdffffff0140420f0000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000" "[\"cT29Pb7V9kxCp6VRfwNNips8T9beVV6AkJDJ9PZcn1RSx3pCnfCd\"]"

I create a transaction in Bitcoin Core for spending UTXO that belongs to my wallet in Electrum and private key for it is in Electrum.

createrawtransaction "[{\"txid\":\"542646583f5bd9b8424832d84ccfd23148f1e19b1b75cf3945bc8693d2dcb82e\",\"vout\":2}]" "[{\"tb1qlu4kjktgcdru8cjnlx47me2ha4phxgceg2v4mj\":0.022}]" 0 true

I copy its private key from Electrum.

Sign transaction in Bitcoin Core using signrawtransactionwithkey:
signrawtransactionwithkey "02000000012eb8dcd29386bc4539cf751b9be1f14831d2cf4cd8324842b8d95b3f584626540200000000fdffffff01c091210000000000160014ff2b695968c347c3e253f9abede557ed4373231900000000" "[\"cSBRq5UwGRZdKwLh6XGf3XFkYDvLdz6WwMxmtTdTvrNyw76mHHAV\"]"


How to compute profit and loss with currency trading? I can't seem to wrap my head around this.  Let's say we have these fake trades between two currencies

        C1  C2      Rate    dPIP    Trade   Value C1    Value C2
Day 1   1   0       10      0       buy      1          10
Day 2   0   10      10      0       sell     1          10
Day 3   10  0        1     -9       buy     10          10
Day 4   0   1000    100    99       sell    10          1000
Day 5   5   0       200   100       buy      5          1000

Day 2 you decide to short and overnight it crashes to 1 on Day 3.  So you buy.  Your holdings for Currency 1 (C1) go up 10x.  But the value of your holdings doesn't change.  Likewise you decide to short on Day 4 after seeing a 100x jump.  On Day 5 you get cold feet and decide you sold too soon and buy in again at 2x at a loss.

How would you compute the running profits and losses (and which currency should be referenced)?  For Example on Day 3 you made 9 of C1.  Day 4: 990 of C2, Day 5: you lost 5 of C1.  What is the right way to track the P&L because they are relative to each other.

And what is the overall yield?  In the end of it all you went from C1=1 to C1=5 or in terms of C2...C2=10 to C2=1000.

EDIT:  I've looked that this some more.  If I look the change in C2 values during sales and the change in C1 values during buys I think I get the trade-trade yield.  Does this look correct?  Could then be summed to show the accumulative yield?

Example C1 yield (2nd buy) Yield=((10-1)/1)*100 = 900%

        C1  C2      Rate    dPIP    Trade   Value C1    Value C2    Yield %
Day 1   1   0       10      0       buy      1          10
Day 2   0   10      10      0       sell     1          10            0
Day 3   10  0        1     -9       buy     10          10          900
Day 4   0   1000    100    99       sell    10          1000       9900
Day 5   5   0       200   100       buy      5          1000        -50

So if you add up the yields you get 900+9900-50=10750%, but if you look at the yield on C1 it is 500% vs C2 at 1000%.  Obviously I'm not doing something right.

I will assume that the base currency is C1 since that is the initial balance.

Day 1: 1 C1
Day 2: sell 1 C1 for 10 C2, no change in price, so 0% gain, still 1 C1
Day 3: price falls to 1 C1: 1 C2, so 900% gain, sell 10 C2 for 10 C1
Day 4: sell 10 C1 for 1,000 C2, no change in price, so 0% gain, still 10 C1
Day 5: price rises to 200 C1: 1 C2 from 100 C1: 1 C2, sell 1,000 C2 for 5 C1, so 50% loss, now 5 C1

To sum:

0% gain by 900% gain by 0% gain by 50% loss
= 1 * 10 * 1 * 0.5
= 5
= 400% overall gain

I can provide more detail if needed, but a base currency must be selected.  The price only needs to be taken into account if there is a position still open; in other words, the price should be applied in this case if you still own something other than C1, the base currency.

If all positions are closed out before accounting for gains, only the trades need to be used to calculate the rate of return.

The simple formula for measuring relative prices is x_final/x_initial, and the change/return/yield is x_final/x_initial-1, with gain >= 0% and loss <= 0%.

Directly applying this formula to the trades, denominated in C1 is:

(10 C2/1 C1) * (10 C1/10 C2) = 10
(1000 C2/10 C1) * (5 C1/1000 C2) = 0.5

The overall relative prices is 5, expressed in percent is 400% because the percentage gain of 5 is (5-1)*100%.

If there is an open position, to account for change:

(# of C1 paid/# of C2 received) * (current price expressed as quotient of C2/C1)

Arithmetic vs geometric returns

I reread the final portion of your question.  First, the calculations are incorrect, so you should follow my example.

Second, one cannot add returns, the total arithmetic return.  They must be calculated geometrically, and that is why the each final/initial should be multiplied.


Transactions before blockchain sync? I withdrew some bitcoins from a site and the blockchain is not synced yet. It's taking too long for the sync (more than a day). The payment is still not in my wallet. Can I send payment to another wallet before it's synced ?

Yes, you can send bitcoins to any wallet at anytime you want.

The transaction will be shown in the wallet after it synced.


16 word recovery phrase for blockchain wallet not working I downloaded my blockchain wallet but now i forget the password and my recovery phrase is 16 word, so I tried them but they are not working. Can somebody please help me?

Above answers regarding seedrecover.py and BIP39 are wrong.
Blockchain.info legacy wallets can use any number of words from 15 to 21 or more. The number of words changes depending on your password length.
The words are NOT a part of the BIP39 seed words and seedrecover.py will NOT be able to find the missing words as it is based on a completly different algorithm.
Blockchain.info used their own wordlist composed of over 50000 words not compatible with the BIP39 wordlist pre 2016. From 2016 they started to use 12 word seeds compatible with BIP39.
Your seed is either missing a word or you have entered a wrong word.
The seed does not contain your private key like the BIP39 seed words, instead it has your wallet ID to login to blockchain.com and your password. In rare instances the seed only contains your username and pass, that is if it was created pre 2013.


How to move money to the default bitcoind wallet? I am using bitcoind and have been playing around.

Recently I used the sendtoaddress command to send 0.50btc without realizing the implications of this command versus sendfrom.  Now when I list my accounts I see the following:

$ bitcoind listaccounts
{
    "" : -0.60010000,
    "w1" : 0.74584297,
    "w2" : 0.00022000,
    "w3" : 0.00000000
}

So at this point my main/default wallet has -0.60010000 and my w1 wallet shows 0.74584297.

I can list the default wallet address using:

$ bitcoind getaddressesbyaccount ""

However, is it possible to transfer funds locally to the default wallet or should I just use a explicit sendfrom with w2's address?

Is there a way to move 0.74584297 to the default wallet without having to send over the network and incur a fee?

Thanks!

For this, we have the bitcoind move command:

$ bitcoind move "w1" "" <amount>

These kinds of transactions do not incur a fee:

https://en.bitcoin.it/wiki/Accounts_explained#Account_-.3E_Account_Transfers


Why will or will not the bitcoin infrastructure become unsustainable? I am new to bitcoins, but as I understand the technology:

All transactions must be downloaded to the client machine (say, Grandma's Windows XP machine from 2003)
New transactions are also sent to all clients

Is that correct?

If 1 billion people adopted Bitcoin as their primary currency, and performed an average of 1 transaction per day each, this would be 11,000 transactions per second every day on Grandma's Windows XP machine.  I think it would catch fire!

I will let Satoshi Nakamoto answer this:

  Long before the network gets anywhere near as large as that, it would
  be safe  for users to use Simplified Payment Verification (section 8)
  to check for  double spending, which only requires having the chain of
  block headers, or  about 12KB per day.  Only people trying to create
  new coins would need to run  network nodes.  At first, most users
  would run network nodes, but as the  network grows beyond a certain
  point, it would be left more and more to  specialists with server
  farms of specialized hardware.  A server farm would  only need to have
  one node on the network and the rest of the LAN connects with  that
  one node.

  The bandwidth might not be as prohibitive as you think.  A typical
  transaction  would be about 400 bytes (ECC is nicely compact).  Each
  transaction has to be  broadcast twice, so lets say 1KB per
  transaction.  Visa processed 37 billion  transactions in FY2008, or an
  average of 100 million transactions per day.   That many transactions
  would take 100GB of bandwidth, or the size of 12 DVD or  2 HD quality
  movies, or about $18 worth of bandwidth at current prices.

  If the network were to get that big, it would take several years, and
  by then,  sending 2 HD movies over the Internet would probably not
  seem like a big deal.

  Satoshi Nakamoto

Link: http://www.mail-archive.com/cryptography@metzdowd.com/msg09964.html


How can I withdraw dollars from Mt Gox? What are the steps to withdrawing from a MtGox account to a bank account in USD?

Mt Gox's Dwolla account is currently (Aug 2013) frozen or shut down.

Are there international transfer, money order, wire transfers that can occur be used?

Can the steps be better defined?

One Method

1.0) Using Coinbase, (coinbase dot com) is currently my preferred way. Create an account there and do your homework. They have made the process rather straight forward once you are verified.

1.1) The fastest way to get verified is to link your US based bank account to their service. I would suggest buying a small fraction of one BTC to get verified more quickly, rather than having  Coinbase send a couple transactions to your US bank account for you to verify.

1.2) Answer the Coinbase security verification questionnaire quickly. They are following the Know Your Client (KYC) rules. If you take long to answer the questions your verification will fail and you will need to wait 24 hours to try again. In this context KYC refers to due diligence activities that financial institutions and other regulated companies must perform to ascertain relevant information from their clients for the purpose of doing business with them in the USA.

2) Convert your USD at MtGox to BTC and send it to your account at Coinbase.

3) After you have been verified you can convert your BTC to USD and transfer the USD into your US bank account rather quickly.

Note that the price you are selling the BTC at Coinbase is less then what you paid for them at MtGox which can be $ignificant if you have many BTC to sell for USD. There are other ways but this is one that has been working well for me. . .


How safe is my USD deposit at Bitstamp? With Mt.Gox probably going insolvent/broke in these days, how safe is my USD account balance with Bitstamp? Is Bitstamp as a company registered with some financial institutions? Are customers USD deposits insured? I only want to consider security from the financial point of view and not my account security (strong passwords, two-factor authentication etc. - is a personal responsibility IMHO).

I guess I would lose all my USD balance if the company goes broke?

Bitstamp and any other exchange are companies and so can be insolvent. If you transfer $1000 to them in exchange for bitcoins. Until they send you the bitcoins they are in to debt to you for that amount. You could take them to court to recover that if they failed to provide the bitcoins or a refund. The court could issue an order allowing the companies assets to be seized so you cod get your $1000 back.

However if they become insolvent as appears to be the the case with Mt Gox then there's little chance of you being able to collect on the debt. As there will be no assests left for the court to seize.

Some regulated professions are required to use nominated accounts were money is held on behalf of a customer. In this case the money is still yours. This is something regulation of the BitCoin exchanges might require.