I have mistakenly sent my LTC to (M) address instead of (3) address I have mistakenly sent my litecoins to (M) as the starting letter of the address, whereas the Litecoin address now has changed to (3) as the starting letter. So can anyone help me to recover this?

Litecoin was having issues with users confusing Bitcoin and Litecoin addresses. To that end, they introduced a new address format for Pay-to-Script-Hash (P2SH) addresses. This new address format encodes the address with an M prefix rather than the original 3 prefix which is also used by Bitcoin's P2SH address format.

As any underlying address can be expressed in either address format, each address with an M prefix has an equivalent address with a 3 prefix. They simply are two different encodings of the same P2SH address.

Check out the address in question on the CryptoId block explorer for example:

When you search the address in question on this block explorer, you should be able to see both the M address that you meant to send to as well as the 3 address that your address now changed to, just like for the random example in the image.
 A transaction output will arrive in the same wallet with either of these two addresses given as destination.


Can mining rewards be based on real world data Is is possible to replace mining as a guessing game where your chance of winning is related to the how quickly your machine can perform calculations compared to how quickly other miners are performing similar calculations with electricity generation data rather than a solution to a mathematical problem to generate block rewards.
Is it possible to have the network generate a unique random number which is assigned to the transaction which records the successful production of a predetermined amount of electricity from data derived from an electricity meter, the electricity meter is attached to a network node and records and transmits transactions (data logs) to the network.
Each energy producer uses a smart meter to record their electricity production a computer with the blockchain installed which is attached to the meter that collects and transmits those transactions to and from the blockchain network, the transactions are validated and do not allow for conflicting transactions, the transactions are put into blocks of up to 2KB or about 70 transactions,  the M.I. devices compute cryptographic hashes until they find a block good enough to count, the block  is then submitted to the blockchain network which earns the energy producer a reward.
Every electricity producer that produces the require amount of kWh of electricity will have the same chance earning a reward as it is a guessing game where your chance of winning is related to the how quickly you produce the electricity, and not how much processing power you have.

This is not really possible: other participants can not provably verify the output of the electricity meter. What if it is malfunctioning or modified by a malicious entity? Proof-of-work has the key advantage of being independently verifiable. Anyone can compute the blockhash and see that it is smaller than the target without any additional information or having to trust anyone.


Are all strategies to mine PPCoin Proof of Stake blocks equivalent? Alice, Bob and Charlie each own 100 PPCoin, and would like to generate more using Proof of Stake.

Alice keeps her ppcoind running all the time
Bob stores them offline for a year, and then runs ppcoind for a week
Charlie uses some other arbitrary "strategy", where I define a strategy by a sequence of ON/OFF schedules, that can possibly depend on whether he finds coins in previous schedules. (Technically it's a decision tree).

Would all the above, on average, achieve equal expected amount of PPCoins in their wallets? Is there a dominant strategy? What about a combination of maximum expected value and security (running your client 24/7 might yield the max amount of PPCoins, but it's also the most volunerable one (wallet must be decrypted for coin generation)).

alice finds the most blocks. 520 confirmations + 30 days of no-stake makes a maximum of 12 blocks per year from the same coins. compound interest makes no impact at all with 12 compounds and 1% ROI .she makes max 1.00437%

bob makes a perfect 1.00% but loses a lot of stake and risks not finding a bloc in that week.

charlie makes 1.00-1.00437% depending how often he finds blocks.

actually, they can find much more blocks, as parts of wallet have different age, but its just as running many wallets, there is no difference in maths.


Is there a list of altcoin communities that has the most active developers? In terms of updating the codebase, bug response, new features etc.

Who are the front runners that at least update at least once or twice a month?

If an altcoin that doesn't even update their codebase or bug responses within a month should not qualify.

Coin Gecko (https://www.coingecko.com/en) has all sorts of metrics on what coins have active communities/developers. I'm not sure how exactly they measure each of these things, but it may be what you're looking for.


How do I generate multiple address with a master public key in pybitcointools? I'm goofing around with this fork of pybitcointools and I got stock with generating multiple address for receiving coins with a master public key. So far, this is what I have:

import bitcoin as btc

privatekey = btc.sha256("large example seed for this great test")
print privatekey

# 03e02b95a485112b543ac29cd262afbbd64dca9b4496e264e47312cb193ae5ab

bip32_masterprivatekey = btc.bip32_master_key(privatekey)
bip32_masterpublickey = btc.bip32_privtopub(bip32_masterprivatekey)

print bip32_masterprivatekey
# xprv9s21ZrQH143K3tQmGrVtKc7B6ZPtCJAmD6wDAJXxb7YXAoZFTb55UroSxrU7k823vSQmYPDhdseRKqP1mgSUWDneinai2seUd7RLX2xkmGW

print bip32_masterpublickey
# xpub661MyMwAqRbcGNVENt2tgk3uebENbktcaKroxgwa9T5W3btQ18PL2f7vp78LNoioGhZcgSH1i2cH48YcQttiEaAh86TuJpsUu2J7jQWnmbC

You want to use bip32_bin_extract_key on the bip32_masterpublickey:

https://github.com/vbuterin/pybitcointools/blob/8e8a33d7281c871950519e5f256ad08cf0d5df69/bitcoin/deterministic.py#L140

And then use pubkey_to_address on the result:

https://github.com/vbuterin/pybitcointools/blob/8e8a33d7281c871950519e5f256ad08cf0d5df69/bitcoin/main.py#L446

simply put:

btc.pubkey_to_address(btc.bip32_bin_extract_key(bip32_masterpublickey))


Does Bitcoin use smart contracts to enable multisig? I have heard that bitcoin does have a limited smart contract and I was wondering whether this is how they created multisig wallets?

Bitcoin's script language that enables smart contracts is used for everything in the technology, even single signature payments. One could say even those are smart contracts.


An explanation of transaction scripts https://en.bitcoin.it/wiki/Script

I'm trying to wrap my mind around them. Could anyone provide a bit more intuitive understanding?

Scripts are used to determine the person who can spend the transaction (at Bitcoin you spend using transactions, not using BTC on an address).

To understand scripts, you probably first need to understand the Bitcoin transaction model. Unlike your old style bank, where you have accounts with a certain amount of money on it, Bitcoin doesn't actually have accounts. The address you send money to is nothing like an account, even though clients show them as such for simplicity.

What Bitcoin really does is send transactions with scripts that can only be solved by one specific private key, by using the public key to create a script. If you send money, you basically destroy one or more previous transactions to create a new one. If you're sending less than the sum of the transactions you're using, just send a bit back to your own account. A transaction can only be used once.

Because of that transaction model, scripting can work. A transaction can be made with a script that doesn't indicate one specific destination address, but instead lets everyone spend it. Such a transaction does not fit in the old style bank model, but works fine for Bitcoin. There can even be scripts that require multiple private keys, or scripts that require you to answer a question.

One quick step back to the transaction model, so I can give you the full picture. Money is created with mining, via special transactions that don't have to destroy a previous transaction: coinbase transactions. All transactions have inputs and outputs. The inputs are the previous transactions it's getting the money from (exception: coinbase) and the outputs are the scripts it's sending the money to. After money is created via mining, it can be used once as an input, after which the money will be destroyed and re-created in a new transaction that can then be used. The role that scripts play in this whole process is to verify that you actually have permission to spend certain transactions.

Hope it helped. Scripts are not the easiest part of bitcoin to understand.


Physical safety of crypto owner Let's image a scenario where I buy (or trade) BTC on a regular basis and have a large number of coins in my wallet. Of course I'd like to be able to use my coins whenever possible, exchange with friends or strangers locally. So, I move part of my cryptos to another wallet for petty purchases, exchanges, etc.

My concern is, suppose I have a transaction with a malicious person, they can trace back with relatively high certainty to my account. Now I know this is debatable as they couldn't really tell with certainty but maybe they just don't care. All it matters is they know or I may have cryptos. In this scenario I am left at their mercy. They could threaten me, there's cases of kidnapping, etc.

My question is, is there a reasonable way to go around this problem? Bear in mind I'm talking about local exchanges in a relatively small towns, where people know my face and name, not online where I could keep anonymity.

If you are worried about physical security and using the above setup (using two wallets, one for savings and one for petty cash), one way to protect anonymity is to CoinJoin the coins when you move them from Savings -> Petty Cash.

In theory, CoinJoining makes it impossible to determine where the coins originated from. It

More information on CoinJoin: https://en.bitcoin.it/wiki/CoinJoin


Will this assumption allow individual bitcoin tracking possible? Fist bitcoins in, First out.

Will this assumption allow individual bitcoin tracking possible?

example,

Addresses A, B and C each has 50 BTC

Transactions,

  tx1 - A > D - 10 BTC (D - 10 BTC)
  tx2 - B > D - 15 BTC (D - 25 BTC)
  tx3 - C > D - 20 BTC (D - 45 BTC)

  tx4 - D > E - 20 BTC (E - 20 BTC, D - 25 BTC)

  Now,
    D has none of BTC received from A, 5 BTC from B and 20 BTC from C
    E, fist 10 BTC was received from A, next 10 BTC was received from B

This is only true if one does not mix transactions. Otherwise you will have coins that are for example 50% from source A, 10% from B, 40% from C and so forth.


Can't connect to Bitcoin RPC on DigitalOcean server I am running bitcoind on a DigitalOcean droplet with public IP address e.g. 1.1.1.1.

I would like to connect to it via RPC from another DigitalOcean droplet with public IP address e.g. 2.2.2.2.

Both Droplets are running Ubuntu Linux 18.04.

~/.bitcoin/bitcoin.conf on 1.1.1.1:

datadir=/mnt/vol1
disablewallet=1
rpcbind=1.1.1.1
rpcuser=x
rpcpassword=x
rpcallowip=2.2.2.2/32
server=1

netstat -ln | grep 8332 on 1.1.1.1 yields:

tcp        0      0 127.0.0.1:8332          0.0.0.0:*               LISTEN
tcp6       0      0 ::1:8332                :::*                    LISTEN

RPC commands on 1.1.1.1 such as ./bitcoin-cli -rpcuser=x -rpcpassword=x -rpcconnect=localhost -rpcport=8332 getnetworkinfo return normally.

However, on machine 2.2.2.2, when I run ./bitcoin-cli -rpcuser=x -rpcpassword=x -rpcconnect=1.1.1.1 -rpcport=8332 getnetworkinfo I get:

error: Could not connect to the server 1.1.1.1:8332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

Machine 1.1.1.1 has firewall rules in DigitalOcean as follows:

Type        Protocol        Port Range      Sources
SSH         TCP             22              2.2.2.2/32
Custom      TCP             8332            2.2.2.2/32

Note that SSH into 1.1.1.1 from 2.2.2.2 is working just fine.

sudo iptables -L on 1.1.1.1 gives:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Is there anything obviously wrong in my configuration or setup?

Running curl -v 1.1.1.1:8332 on 2.2.2.2 immediately returns with:

* Rebuilt URL to: 1.1.1.1:8332/
*   Trying 1.1.1.1...
* connect to 1.1.1.1 port 8332 failed: Connection refused
* Failed to connect to 1.1.1.1 port 8332: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 1.1.1.1 port 8332: Connection refused

which from what I have read likely indicates a firewall issue.

bitcoin.conf should contain the machine's own IP address as an argument to the rpcbind parameter.

For example, if you are running bitcoind on a machine with IP address 1.1.1.1 and you wish to connect to its RPC server from a different machine, your bitcoin.conf file on machine 1.1.1.1 should contain the line rpcbind=1.1.1.1.


How is locktime enforced in the standard client? I am trying to study the locktime feature of transactions ( https://en.bitcoin.it/wiki/Protocol_specification#tx ). I have created some raw transactions in the testnet with different locktimes, but, when I send them, they are confirmed as usual. I have also been able to spend the just sent coins immediately. When I dump the block, the locktime field looks correct.

How is the locktime checked when confirming a transaction? Can someone point me to the piece of the code that does the checking?

Or am I wrong and locktime is really not implemented?

It's checked in the IsFinal() method of CTransaction. A non-final transaction cannot be included in blocks.

A transaction is final if either:

The lock time is in the past.
All of the inputs have sequence numbers equal to UINT_MAX.

The second one is probably what confused you.


Why it's not good to the community to hoard bitcoins? Colin Dean's answer to zcopley's question inspired me to ask this:

While Bitcoin supporters would hope that one would not hold on to Bitcoin as an investment, but rather spend it in order to further the economy...
Can you tell me the rational behind this, according to Austrian economics? I'm a beginner enthusiast of Austrian economics but as far as I know there is no argument against hoarding real (value based) money. When the user will see he/she can get something more valuable in his value scale he/she will exchange the money for that product or service. It's that easy.

Commodity money results in artificial scarcity.
Take the case of Jack and Jane

Jack is a great gardener who could use more customers
Jane is a great web designer who has a forest of untamed weeds growing on her front lawn.
Neither Jack nor Jane have much (if any) commodity money, say, gold. And thus, neither of them engage in trade with each other though it would be beneficial to both.
Gold is scarce, and its especially scarce because the people who have it, not Jack and Jane, are trying to hold on to it, and in fact amass more.
The scarcity of gold, through people's perceived need thereof to engage in economic activity, results in an artificial scarcity of goods and services and declining economic activity. People who should trade with each other do not.

I actually do not think this is a problem with bitcoin because bitcoin can be divided as needed so even if Jack and Jane only have a Satoshi the current minimum unit, between them, the protocol can be modified and a whole economy can run on one Satoshi.

Most people people see this as a problem because they extend the analogy of commodity money too far. This is if fact one of the ways that bitcoin is disimilar and superior.


Duplicate Transaction Prevention I'm trying to understand Bitcoin a bit more and I'm struggling to find an answer for this scenario. Say for example I have access to a wallet and I have give a person on the other side of the world access to the same wallet (both using bitcoin core wallet and bitcoin-cli sendtoaddress). We are on our phones and we both have the exact same balance and are at the exact same block height. How does bitcoin prevent the scenario where I send money to one address and a person with access to the same wallets sends money to another address at approximately the same time?  Does the first transaction to hit the network win and the later one just never get confirmed? How does the  decentralized network decide?

Does the first transaction to hit the network win and the later one just never get confirmed?

Almost however it's not as simple as the "first" transaction, but it is essentially a race.
When a new transaction is broadcast to other nodes it enters what is known as the mempool. Using the phrase "the mempool" can be confusing since there isn't a single mempool, every node has its own mempool and it may not be the same as another nodes mempool.
In your scenario, two identical wallets different sides of the world, the one that broadcasts a transaction with a higher fee may "win", or the one that broadcasts to nodes that are better connected for propagation across the network may "win".
Once the transaction is in the mempool and other nodes know about it, you will likely receive a "missing inputs" error when trying to broadcast inputs that have already been spent. The transaction does not have to be confirmed in a block in order for the double-spend to be noticed; it only needs to be in the mempool. Some transactions can sit in the mempool for hours or even days if network use is high and the transaction fee for that transaction are low making it important that transactions in the mempool are checked for double-spends.
In any event a transaction does not have any degree of permanence until it is confirmed in a block. Even with 1 confirmation a transaction may not be permanent in the event of competing longest chains, the losing chain will have orphaned blocks.
Back when bitcoin was younger many people would wait for 6 confirmations before considering a transaction permanent.  Today a few confirmations is likely enough for most transactions to be considered permanent.


Is the 51% attack the only technical reason no country will adopt Bitcoin as a state currency? Is the 51% attack the only technical reason no country will adopt Bitcoin as a state currency?
Lets suppose a country with GDP size less than 300 Billion USD adopt the Bitcoin as an official currency. It will be very easy to crush or take control of state currency if a country like US or China invest to run 51% of mining pool.

If what you mean by adopt bitcoin as a state currency means replace their existing fiat currency; I believe there would a lot bigger problems to consider. If they did do that, it would essentially be saying that their money no longer has any value, which would cause a massive panic within their population. A type of panic similar to when India banned the 500 and 1000 Rupee notes.

You'd also have to consider countries that have that type of GDP, they would need the infrastructure for everyone to be able to be connected to the internet and have devices to use Bitcoin. Also they would need everyone to be tech savy enough to understand how to use bitcoin.

Also, with the lightning network at its current state, bitcoin transactions can't scale to an entire countries' economic activity.

So I would say that a 51% attack is pretty low concern for a country looking to adopt bitcoin as a state currency. A better approach would probably be to start stock piling bitcoin and perhaps even use it to back their fiat currency to strengthen it.


Administration of bfgminer in linux I'm just starting to screw around with bitcoin mining.  I've been a long time Boinc pseudo-enthusiast and so I just had to check out bitcoin mining.  I've started using bfgminer and I'm a little confused as to how its administration should go.

I get it running in the terminal and it shows me the main menu, but is there a way to exit out of that menu and keep it running in the background?  Then once it's going, is there a way to bring the menu back up to check in on it?

I've looked around for an answer to this and I haven't been able to find one yet; can anyone put me on the right track?

Many thanks in advance!

GNU Screen is often the ideal tool to run interactive programs in the background. You can also run it with --syslog and/or --api-listen to have a more traditional daemon-type process.


Bitcoin -qt or Bitcoind - which one to use for building a trading website? I'm building a Bitcoin website that will be fully based on wallet services and also trading. I learnt through my searching in the web that Bitcoin qt is the friendly UI version of the software while Bitcoind is just the headless daemon, but same core functionalities.

Now I was given a project to build a website that provide wallets and exchange service for users and also with trading application. Which of this two software will be the best to download? The website will be on VPS account with Godaddy.

Thanks to Nate and Pieter for warning on the security. I understand the risk but I will still love to have answer to that question.

You should use bitcoind. You can make JSON RPC calls to it to generate an address, or to find out what the balance of an account is. Using that, you could build an application that allows access to a song if a customer pays for the song, or something like that.


Historical Crypto Data I'm looking for for historical data on crypto currencies that tracks down to at least the hour if not 5 minutes for each day for at least the past year. I need OHLV price, and volume at a minimum for each interval, but further trade data would be a great plus. I would prefer to get this from an API if one is available, but at least some csv's would help to start with, all the historical sources i see only track on a once per day basis.

Free version to the previously proposed paid version:

  Actually, you CAN get the whole Bitcoin trades history from Bitcoincharts in CSV format here : http://api.bitcoincharts.com/v1/csv/

  it is updated twice a day for active exchanges, and there is a few dead exchanges, too.

  EDIT: Since there are no column headers in the CSVs, here's what they are : column 1) the trade's timestamp, column 2) the price, column 3) the volume of the trade

Please search first.


C#, How can I actively query the crypto-market? Are there any wrappers to get the real-time crypto-currency value similar to coincap.io?

Right now I am using Json to deserialize a download string from CoinMarketCap, however, the api does not actively check the real-time value, like coincap.io. Was wondering if there is a wrapper that checks real-time activity.

If you're looking for more than just price data, Coinigy is another option. https://www.coinigy.com/

I found their API easy to implement and very reliable and they covered all the exchanges I was interested in.


Should I join a pool? I've configured the large (8x) GPU image on AWS at 2.60/hour. I ran it goes few hours after setup and mined nothing.

This was my first foray into mining.

Given this setup, am I better placed to join a pool? And what pool should I join? (Some pools reward the biggest contributor and others payout shares.)

You are unlikely to collect rewards consistently (or at all) solo mining with that hashrate. You should join a pool to smooth out your expected return, unless you are okay with the posibility of earning nothing for long periods of time (or are a very lucky person).


Is there a sandbox in bitcoin for testing? Is there a sandbox in Bitcoin for testing, so that I can create sample bitcoins without mining and do transactions for testing purposes?

Testnet is really heavy (hundreds of gigabytes), there is a lighter alternative to that now: signet. There is also a local-only network called regtest, which I put in its own section. Finally, I'll explain txindex, which is a useful option to have your own mini block explorer.
Signet
To use it, first start bitcoind with the option:
bitcoind -signet

It will need to sync, but it will be a lot faster than testnet since the chain started recently and as of writing only has about 27000 blocks:
% bitcoin-cli -signet getblockchaininfo
{
  "chain": "signet",
  "blocks": 26029

You can use bitcoin-cli -signet getnewaddress to get a new address, which you can paste into the faucet: https://signet.bc-2.jp/ (if it complains that you have no wallet, see next section). Note how signet addresses also start with tb (which is called the "human readable prefix", hrp), just like testnet addresses.
% bitcoin-cli -signet listunspent
[
  {
    "txid": "9484eff65e5c33f601a8d6446859ffbc6ba59ffd53dca564d66a7c09e040c26a",
    "address": "tb1q7x3nnyskqmgrj9hp95fgfg75fz50x4khay3s0t",
    "amount": 10.00000000,
    "confirmations": 3,

If you don't see anything right away, wait a bit. Once the transaction arrives, you'll see the confirmation count rising at a regular interval. Signet has much more regular blocks than testnet.
Regtest
The regtest is not really a network, since it isn't meant to be used publicly. The chain starts with the genesis, and proof-of-work is effectively disabled, so you can just mine your own blocks. This is useful if you need to test reorgs and stuff like that, which you won't be able to do with signet.
% bitcoind -regtest

Let it run in the a separate terminal window.
Now you should have an empty chain:
% bitcoin-cli -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 0,

Now, lets see if you have a wallet:
% bitcoin-cli -regtest getwalletinfo
error code: -18
error message:
No wallet is loaded.

If you get an error like this, create a wallet:
% bitcoin-cli -regtest createwallet testwallet
{
  "name": "testwallet",
  "warning": ""
}

Now, you can create a new address:
% bitcoin-cli -regtest getnewaddress
bcrt1q0qx0d7prvrd64s3e3trq39fet7jwdecstw5tzu

Note how the HRP mentioned above is now "bcrt", "bitcoin regtest".
Mining some coins
That's right, CPU mining is alive and well ;) In fact, regtest only has blocks when you generate some, yourself. That's nice for testing, you have time to figure out.
You can mine directly to the wallet (so-called coinbase outputs, you may have heard of a company named after these). Here I am using the shell to insert an address generated using the command from above (should work in PowerShell on Windows too):
% bitcoin-cli -regtest generatetoaddress 10 $(bitcoin-cli -regtest getnewaddress)
[
  "2e25176b5122a3d16eca11355b2807ebf99e8ef3cf01e32634417baf47cb9a4b",
  "3e8136a62d513925a075700e92789d70da67d5b3dd986e936d65b12a3ba53c72",
  "55ca10e3932a9087259a3826148aa660e09b69b63fe84d6a81bc4e57de052060",
  "4864e894662693ae7e32cb0d2a8bc3ad94c4f5e67e109873555bc5f7b5c166bc",
  "0de8a4bfb5fa5a38fba39dcf9fe360e3382e6fa56c226553c30736525bea659e",
  "69e3a04724793b90de126358a99f297b821cac83b9be12f3d569effd73729199",
  "3eb2a83540ce04ef75f5258359ee1695fa0b2e6cbc04a078f85e3182cd500004",
  "35e39307638bca2db359ee8fa6930fbbf20e5d465882c50e05c05e2510ca2e28",
  "12f2b855729929aa091a7cffccb66886a6c406c7855f8851c25ab162b17455f1",
  "2414f3ddfa767aa1916f296066d35ae58c828b49e84542c57509e7161201b746"
]

We mined some bitcoin, but you have to remember that there is "coin maturity", which means that coins can not be used immediately after mining, not even on regtest.
So after mining these 10 blocks, you'll see that the wallet still reports no unspent outputs:
% bitcoin-cli -regtest listunspent
[
]

To mature the coins, mine a hundred blocks more (I'll omit the output, it's just the command above with 100 instead of 10), and you'll see the coins mined in the first command:
% bitcoin-cli -regtest listunspent
  {
    "txid": "6fe92df06b95a20db44f989471483802a9aebc56e93057dca9fe0546445d35ff",
    "vout": 0,
    "address": "bcrt1qlu9a5687f3m4ct3r5ndlwy8juppgghysy2s67f",
    "label": "",
    "scriptPubKey": "0014ff0bda68fe4c775c2e23a4dbf710f2e042845c90",
    "amount": 50.00000000,
    "confirmations": 110,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([a45ff478/0'/0'/2']02ebc0275e56ecca4a80d6a6ff7d7ab884c972cff9db9a91b9bb3681741624d41a)#rgeusc6u",

There will be a ten tx's like this, because the ten blocks that we initially mined have all matured. They have confirmation counts from 101 to 110.
Processing bitcoin output with jq
Note how you can use standard JSON tools to extract information from the bitcoin-cli output.
For example, we can verify the number of unspent wallet outputs. In the example from the previous section, we mined 110 blocks, that each have one coinbase output for the Core wallet. But only the first 10 have matured:
% bitcoin-cli -regtest listunspent | jq length
10

Starting over, nuke the chain
You'll possibly want to reset your testing environment before and/or after running a test. With regtest, you can remove the whole blockchain. So shut down the bitcoind process that we started above. You can simply wipe the regtest directory, but be very careful that you don't wipe the wrong one (actually, you shouldn't even have real (mainnet) coins in the filesystem that you run your tests from).
% rm -rf ~/.bitcoin/regtest/

This isn't a true factory reset, since if you have any configuration in ~/.bitcoin/bitcoin.conf, it would still be loaded. So if something is still working unexpectedly, check your config.
Deleting a signet blockchain makes less sense, since you'd just download the exact same chain after relaunching (unless something is horribly broken). So to ensure a clean signet testing environment, maybe just wipe everything except blocks, e.g. chainstate, wallets and indexes.
Txindex, your own block explorer
Bitcoin Core has a neat feature that lets you look up information on an arbitrary transaction. But you enable must it first. To do that, write txindex=1 in ~/.bitcoin/bitcoin.conf, possibly in a regtest or signet section, though I just put it at the top-level since my mainnet coins are elsewhere, and it is useful for all testing.
Now, with txindex enabled, you can retrieve information on, lets say, the first transaction of block 1 (right after genesis):
bitcoin-cli -signet decoderawtransaction $(
  bitcoin-cli -signet getrawtransaction $(
    bitcoin-cli -signet getblock $(
      bitcoin-cli -signet getblockhash 1
    ) | jq -r '.tx[0]'
  )
)

You get, for example, the output script these coins were locked with:
  ...
  "vout": [
    {
      "value": 50.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 9243f727dd5343293eb83174324019ec16c2630f",

The "getrawtransaction" step requires txindex.
This is similar to information that you'll see in a block explorer. In this example, I used signet (which has a public block explorer), but for regtest you obviously won't have a block explorer available, so the txindex could come in handy.


Blockchain fees $100 for $1000 !!! Please help I have a problem with blockchain.info.

I want to send some Bitcoin but fees are very high, $100 for a $1000 transaction. My wallet balance has a lot of tiny transactions.

I also got this message when trying to make a payment:

  Your wallet needs to consolidate many smaller payments you've received in the past. This requires a relatively high fee in order to be confirmed quickly.

What can I do to have ordinary fees?

You cannot change this.  It is a design limitation of the network. Continuing reading for an explanation.

What blockchain.info is referring to is the data size of your transaction. Bitcoin fees are based on the data size of the transaction, usually marked as a btc/byte value.

Transactions can vary a great deal in size because of the number of inputs and outputs. Any bitcoin address you have is actually made up of all the inputs it has received. If you have received 10 transactions into a single address, emptying the address will require all 10 of those inputs plus at least 1 output. This adds data size to the transaction, therefore it requires a higher fee.

Blockchain.info is telling you this is the case with your address, and it's not particularly unusual. I had an old address that served as my mining receiving address for several years. It just collected mining profits in small chunks over all that time. When I finally decided to move all of it, there were 72 inputs and one output, amounting to a massive fee. It kind of sucks, but that's one of the limitations of the network.

One thing to note is that mining fees are entirely unrelated to the value of bitcoin or the sum of the transaction outputs. Fees are only based on the data size of the transaction. A 100 bitcoin transaction with only one input and one output will be a significantly less fee than a 1 bitcoin transaction with ten inputs and ten outputs.


In Bitcoin, what happens if there is no viable nonce? I'm assuming SHA is perfectly uniform.
In bitcoin, there are $2^{32}$ possible inputs per block, which are mapped to $2^{256}$ possible outputs. So there is a $1/2^{224}$ chance that any randomly picked 256-bit string is a possible output hash of one of the possible nonce values. So that means there are $2^{32}$ possible output 256-bit strings. In other words, a 1-to-1 mapping from nonce to output is very likely.
The $2^{32}$ possible outputs are distributed uniformly. So that means half of them have a 0 in the first bit, and the other half have a 1. That means there are $2^{31}$ possible outputs with a 0 in the first bit. Each leading 0 bit reduces the number possible outputs by half. So with 76 leading zero bits (the current difficulty), there's a $1/2^{44}$ chance that there exists a acceptable nonce.
Another way to see it is that there is a $1/2^{76}$ chance that any nonce is accepted. But there are $2^{32}$ possible nonce values. So the probability that none of those nonces are acceptable would be $(1-1/2^{76})^{2^{32}}$ which equals $1/2^{44}$.
Either way you look at it, there's an extremely small chance that any 32-bit nonce will work.
So what happens if there are no acceptable nonces?

It's important to note that the block hash is over the entire block header, which contains:

Block Version
Nonce
Previous block hash
Timestamp
Merkle Root
nBits

Of these, only the nBits and previous block hash are fixed - all of the others can be manipulated to alter the hashed data at will.
Once all 32 bits of the nonce value have been exhausted (which happens extremely fast on ASICs), miners will simply alter the timestamp, block version, or merkle root (by altering the coinbase transaction or changing their list of selected transactions/their ordering), allowing them to try a new block header with the entire nonce space again.
These alterations are repeated until some combination of the above produces a valid block hash.


Detecting generation transactions I'm implementing my own blockchain reader but I'm stuck validating transactions.

I can validate a common transaction checking the UTXO and executing both scripts, but... how do I validate generation transactions? AFAIK there's no flag that lets me detect generation so I can ignore the input.

Let me clarify the response from kaoD for future reference. The generation transaction is a transaction with exactly 1 input, whose prevOut hash is null:

0000000000000000000000000000000000000000000000000000000000000000

An example of such a transaction in JSON format can be found here (blockchain.info is no use here as it does not conform the JSON output of bitcoind). Notice that besides this, the Satoshi client also puts the coinbase transaction in first position in the tx array, I wouldn't trust this too much though as it may well change in future and may not be consistent across clients.


Running a Bitcoin node (behind Firewall / NAT or anything else? disallowing inbound connections) I consider running a bitcoin full node on a raspberry Pi 3. I want to attach the raspberry Pi into my home-network (wifi). When I check my IP address I have a public address to the outside (which is changing from time to time, however is only one of 5 different addresses) and via NAT given by my ISP. I don't know what is between "my" public IP and my homenetwork in detail.

As I understand it correctly a bitcoin node does only good to the overall network iff it can accept inbound connections, therefore my raspberry pi must be publicly available (behind all this NAT whatever). If I run a bitcoin node I would like to use it at least by myself as a trusted node inside my mobile bitcoin wallet...

In the end I see two ways to do that:

Resolve NAT issues with one of the following techniques: Upnp, TURN, NAT hole punching, STUN, ICE, IGDP, NAT-PMP, PCP, ALG, wathever else there, I don't know...
Or running a hidden service.

So my question:

Is it good/bad/ok to "only" allow inbound connections as a tor hidden service?
Is there an easy way to get a bitcoin node with "traditional" means available as a public node inside a home network?

You may wish to attempt the following: Your router most likely offers you a GUI so you can adjust a few settings. Use your browser to connect to your router whose ip address is something like 192.168.0.1. This will bring the GUI to your browser (you will need to find out the login details giving you access). Once you are connected to your router, there is probably a section called 'advanced settings'. Within that section, you may see a subsection called 'DHCP reservation' which should allow you to choose a fixed internal ip address for your raspberry. Once you have done that, go back to advanced settings and find a subsection called 'port forwarding`. This will allow you to instruct your router to forward any connection attempt on port 8333 to your fixed ip address.

In fact, I have just been paraphrasing bitcoin.org


Ripple XRP in circulation From the 100 billion of total XRP, 20 billion went to the founders and 30 billion to OpenCoin to fund development. The 50 billion remaining are supposed to be given away to promote Ripple.

Is there any source of information tracking how many XRP have been distributed to the public?

Have any of the funds for development been sold?

this is pretty good article calculating how many XRPs are floating on the market

http://www.thebitcointrader.com/2013/05/ripple-is-now-tsunami.html


Compressed or uncompressed for brainwallet? When creating a brain wallet, should I choose the compressed or uncompressed version? Why?
What happens if I choose the uncompressed version (which is what the official client uses, right?), and someone sends coins to the compressed address? Will I see the coins? Would I be able to spend them if I saw them sitting in the other address?
Will I have to remember which option I chose, or the pass phrase is enough? Will other options keep popping up? (eg: super compressed)

Brainwallet.org doesn't make this terribly clear: choosing a compressed versus an uncompressed address is not choosing between two different versions of the same address, but rather two different addresses based on the same secret exponent. Sending bitcoin to one address will not be accessible by the other, as they are technically independent. With that in mind, we can address your second point first:

Will I see the coins? Of course! You can see everything that happens
on the block chain.
Would I be able to spend them if I saw them sitting in the other address? No. Unless you have access to the private key for the other address, you cannot spend the coins.

As for the first point, it really depends on whether or not your client supports signing transactions with compressed private keys. Your client will always be able to receive coins at the public address, but it may not be able to process a compressed private key and thus not be able to spend with it.

Here's some info on popular clients that might be helpful:

BlockChain.info --
Currently, if you try to import a compressed private key into blockchain.info's web app, you will get a warning that they key will not be usable to create transactions on the mobile app. So, if you need to make payments with their mobile app, don't use compressed private keys. Although their web app, should work fine, even if accessed from mobile.

Bitcoin (Android - Andreas Schildbach)--
Andreas Schildbach Android bitcoin client, on the other hand uses compressed private keys. Although they are normally hidden from user, there is a (somewhat convoluted) way to import and export private keys into the app and out of the app. So, if you are making payments with this app, you can use compressed private keys. (Note: I'm actually unclear as to whether or not you can import uncompressed keys into this client, so compressed keys might actually be mandatory here.)

Armory --
I don't believe that the Armory supports importing of private keys at this time. So, if you're planning on using this, you must use uncompressed keys.

As for your third point, I would suggest remembering your chosen option just in case the clients you wish to use doesn't support it compressed keys. That way, you have a good idea of what's going on in case making a transaction fails.


Where does Bitcoin Core store DB_LAST_BLOCK? My understanding is that Bitcoin Core stores where it left off(DB_LAST_BLOCK) in $DATADIR/blocks/index.

But which is the actual file bitcoin core stores it at?

It depends on your specific data directory. Bitcoin Core uses a LevelDB database for the index and LevelDB handles the exact storage format and files of the database. This can be different for every data directory. There is no particular file that that record is stored in that Bitcoin Core knows.


How do I create the coinbase from the genesis block? I wanted to write an application that given a timestamp(text basically) and a public key will generate a merkle hash for the creation of a new genesis block. So I decided to first try and re-create the one from Bitcoin.

Unfortunately, I am failing somewhere. This is my code http://pastebin.com/sVmZgMt8

So, I should be getting this result, which is available on the Genesis Block wiki article.

04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

However while the text in hexadecimal form is there, there is another problem I am getting. This is the output.

1d00ffff000104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

The first thing wrong is that the nBits are displayed in an endianness different than the one above, and skimming through the Bitcoin source code a lot I failed to see how and where it was swapped, as the only line is this one

txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));

Also, there is an additional 0x04 byte in the Coinbase of the Genesis Block that I am also failing to get, and nowhere did I see it being added OR what it represents.

The nBits don't exactly get swapped. The notation on the wiki is in big-endian notation, which is basically the notation you'd use when displaying it, similar how the number twelve is written 12 and not 21 (different number order) but can be stored as 21 by a computer.

Your modern computer uses little-endian, which means that if you write something like :

int myInt = 0x1d00ffff;

It will actually store that in the RAM as 0xff 0xff 0x00 0x1d

Because of that, when you take the pointer of that int, and convert it to a unsigned char*, you get the little-endian order of it. Which happens to be what the reference client does :

(const unsigned char*)pszTimestamp

So, to put myInt in a char[], all you have to do is copy it there:

char tx[4];
int myInt = 0x1d00ffff;
memcpy(tx, &myInt, 4);
// tx now contains 0xff 0xff 0x00 0x1d

The only things that bitcoin actually swaps are network port numbers, which are stored in the memory as big endian numbers. Anything else doesn't really get swapped by bitcoin, it just stores them in the CPU's native endianness.


Do foreign bitcoin exchanges need to be liscensed in every US state? I read something about this, but it seems pretty unenforceable. I understand US-exchanges need to be liscened as money transmitters in every state, but how can US states fine a foreign entity for making transfers to US accounts? What kind of laws are being broken?

As far as I understand, the exchange is only bound by the laws in the country which it does business and transfering money to US bank-accounts isn't exactly breaking any sort of laws. The US customers would still be coming onto the website, presumably hosted in the foreign country, so the business would still only be considered taking place in that foreign country.

I'm no expert on the legality here of foreign entities. Can anyone offer some advice.

As CTO of Bit2C, Israel bitcoin exchange I can tell from my experience that the exchange has a bank account at it's local country, the exchange required by the bank which holds the customers funds to "know your customers" and in Israel we are obligated to ask from customers who make deposits to sign a document declaring they have no us citizenship, so we can't deal with US customers.


What encoding or format is the private key in Dumpprivkey? I'm trying to use the results of Dumpprivkey to sign a message outside of the QT client, however I'm either having a problem signing or extracting the real value of the key.

What encoding, endian, or format is Dumpprivkey in?

I assume it's Base58 encoded...

The format is base58check, with 0x80 as version byte (for Bitcoin mainnet, at least), and an optional suffix 0x01 byte to indicate that the corresponding public key is compressed. So combined:

base58(0x80 | 32-byte big-endian secret parameter | checksum) for uncompressed public keys
base58(0x80 | 32-byte big-endian secret parameter | 0x01 | checksum) for compressed public keys


I want to start mining new blockchain (exactly as Satoshi did in 2009) for testing purpose I will mine myself ONLY so difficulty will be always in 1 range so CPU is enough for this task

So my question is: how to setup bitcoin core 0.12 to start mining with CPU new blockchain ?

If I type in the console: setgenerate true and wait a few hours it's possible to mine first block with 50 BTC (of course with internet connection OFF to prevent download blocks)?

I know that this BTC will be worthless ATM (without $ value) but I want to do that anyway to better understand mining process

First, create a directory to store your blocks and configuration:

$ mkdir mybitcoindir
$ cd mybitcoindir

next, you need to create a conf file called bitcoin.conf that has this in it:

checkpoints=0
connect=0.0.0.0
daemon=1
discover=0
dnsseed=0
gen=1
irc=0
keypool=5
listen=0
port=19002
rpcpassword=test123
rpcport=19003
rpcuser=test
upnp=0

Now start up your bitcoin daemon

$ bitcoind -datadir=mybitcoindir

You should have no outbound connections

$ bitcoin-cli -datadir=mybitcoindir getpeerinfo
[
]

Now you can generate coins

$ bitcoin-cli -datadir=mybitcoindir setgenerate true

Note even with the difficulty at 1, generating coins off of a single CPU can take a while. Expect it to take a few hours to find your first block. You're better off getting a really cheap USB miner as they can find about 2-3 blocks at difficulty 1 every minute. But that, of course, requires a bunch of setup as well.

Best of luck.


How can a miner choose which transaction to include in the next block? This question is not a duplicate of Can miners choose which transactions to mine?
Everybody seems to agree on the fact that miners can select which transactions they are mining. But I can't find a way to do it!
I created a personal bitcoin network (testnet protocol) where I'm the only miner. I send transactions to my several (fake) nodes and get them all in the mempool.
For demonstration purposes, I want some of the transactions (with high fees) to be includeed in the first block and the rest in the second one. I tried to use prioritisetransaction (with my miner node) to do this but all the transactions went to the same block:

bitcoin-cli prioritisetransaction txId1 5000 200
bitcoin-cli prioritisetransaction txId2 0 -200

I put arbitrary values, the goal is to mine Tx1 in the first block and Tx2 in the second or even after. How can I create such a behavior? Do I really need to put more than 1000 transactions to see my transactions going in different blocks?
I will welcome any help, thank you in advance.
EDIT: I'm adding a question to this post. On another lead to find a way to "choose" in wich block my transaction will be included I tried "estimatefee/priority" calls. In my private bitcoin network (height: 14.000 blocks) when I call:

bitcoin-cli estimatefee X

whatever X (number of block before inclusion), the answer is "-1" which means that the network cannot estimate what I'm asking (should only append for high digits). Do I need more blocks in my Blockchain? More transactions? Same experiment in the real testnet, estimatefee works but is really far from the reality and whatever the fee, all my transactions go to the first block.

Do I really need to put more than 1000 transactions [in a block] to see my transactions going in different blocks

No.  You can limit the size of the blocks you produce by changing the -blockmaxsize option.  For example, if you only want to be able to add a single 250-byte transaction plus the 80-byte header and 1-byte (in this case) transaction count, you can start Bitcoin Core like this:

bitcoind -testnet -daemon -blockmaxsize=331

Then you can use the prioritisetransaction RPC to prioritize tx1 over tx2.

Regarding your second question, estimatefee and estimatepriority may not return useful results on testnet because transaction volume there is low so almost every transaction goes into the next block.

You may find it more useful to experiment with regression test mode which will allow you to create a private testing network and completely control every block (as well as mine blocks instantly).


If Fees Were Paid In US Dollars, What Would They Be? Assuming all Bitcoins had been discovered and fees were paid in US dollars (please ignore the obvious problems), what would an appropriate fee be? Would it depend on the size of the transaction? How would it scale?

Instead of asking what would be the fees if they were paid in US dollars, I think you meant to ask "what will be the purchasing power of the transaction fees, measured in today's US dollars".

There's some discussion of this at How much will transaction fees eventually be? but the short answer is that nobody knows. Left to their own devices the fees will be close to 0, which is a problem. No consensus has been achieved on how to fix the problem. Personally I think the goal should be fees on the order of 0.1% + 1 cent.


gen option on bitcoind: testing Can you actually generate "test" coins using bitcoind and testnet?

I mean, in a standalone test environment, can the generation of "simulated" BTC be done and with very short test blockchain be done in a very short time?

Testnet is not a standalone test environment. It's an actual distributed block chain like the main chain. Only, because few people are mining on testnet, the difficulty is quite low.

So yes, you can generate test coins on testnet.

Beside this, it is possible to create a very own standalone test environment, but it would require you to edit the source code. Specifically, you will need to change the (hard coded) genesis block and most probably remove the peer seeds because you don't want to bother mainnet or testnet users with your own blocks.


Will merge mining patch make Bitcoin network mining power available to anyone? I think Namecoin has a good value, but while I think Vladimir overestimates the inflation effect of merged mining, I still mostly agree with his post, which is negative towards uncontrolled merged mining. It requires small patch for bitcoind to make it "parent" for Namecoin blockchain, is the patch exclusive for Namecoin? If yes, what makes it exclusive, and if not, is there a way to design a merge mining patch, so it would be exclusive for a particular blockchain? That way bitcoin community would have a choice, when downloading a new version of bitcoin, if it wants to adopt a new blockchain.

The patch has no effect on the parent blockchain, it just allows the patched bitcoind to be used for mining on both chains simultaneously.  Only the child blockchain needs to be modified in order to support merged mining.  There's no way for the Bitcoin network to prevent merged mining, even if doing so were desirable.

Merged mining does have to potential to allow alternate chains access to greater hash power (and thus security against double-spend attacks) than they would have had otherwise.  However, this alone will not give them value as currency.

Bitcoin is able to sustain value because of its network effect.  The more active users it has, the more useful it is to each user.  The alternate blockchains have userbases that are a a few orders of magnitude smaller than Bitcoin's.  Newcomers to the cryptocurrency world will tend to choose the more useful and popular chain, further increasing Bitcoin's lead.


listtransactions will list transactions only involved with me? Will listtransactions list all transactions from blockchain, or only list transactions involved with me?

I have checked bitcoin wiki, it's only saying that it will return recent transactions from "all accounts". What does "all accounts" mean? does it mean all MY accounts? or it will include accounts of other people?

"listtransactions" will list all the transactions associated with your specific bitcoin wallet.  The "All Accounts" business, I believe, has to do with the various addresses someone could have withing a single wallet.

For example, I have an address where I receive donations, and a different address where I receive mining payouts.  by default "listtransactions" will list all my transactions from both addresses, however, I could specify one of my addresses and it would list only those transactions.  It's an easy way to get more granularity in the lists and organize your data better.


Block Explorer, which fields are reversed, and which are the same as in a raw block dump? Recently I'm trying to properly recreate the genesis block in my low-level application. To do this, I use the Block Explorer to get the proper values for different fields, but at times it can be very confusing with its endianness. Which fields presented in the Block Explorer should be reversed before they are included in a raw block, and which should stay as they are?

Hashes are displayed in little-endian when they are actually big-endian on the network, and difficulty bits are displayed as big-endian when they are actually little-endian on the network.

All other integers are little-endian.


Merged mining custom bitcoind What are the core changes to bitcoind that allow one to merge-mine? Are there any new JSON-RPC commands that are enabled, or changes to the existing ones?

Here is my merged mining implementation - not quite up to date


Can you get the seed phrase of a HD wallet from the private key of one of the wallets? Let us say I have a HD wallet. Can I get it’s seed phrase from the private key of one of its wallets?
Also are seed phrases just easy to remember private keys? If so does that mean that from the seed phrase private key you can get a public key? And if this is true if I send cryptos to this public key in which HD wallet is it going to appear in? The first one?

Let us say I have a HD wallet. Can I get it’s seed phrase from the private key of one of its wallets?

No, the mathematical processes are one-way processes. See BIP 39 and PBKDF2

Also are seed phrases just easy to remember private keys?

Seed phrases are not intended to be memorised. They are intended to be written down and stored somewhere safe. For example you might use letter punches to stamp the phrase into stainless steel sheet and store the sheet in a safety deposit box.

from the seed phrase private key you can get a public key?

Yes. See BIP 32

if I send cryptos to this public key in which HD wallet is it going to appear in?

Money will appear in, and be spendable from, every appropriately-configured wallet created using that seed-phrase.
If you are thinking of each key pair derived from the master node as a wallet in its own right (which I think is a misleading way to think of things, or at least unhelpfully ambiguous) then the money is only associated with one of the key-pairs in one of the "wallets" derived from the "master node". But that "wallet" (depth 1 derivation) can exist in many wallets (multiple wallet software installations on one or many computers)


Failed to import Bech32 SegWit addresses using importmulti Bitcoin-Core 0.16.0rc3 I was trying to import Bech32 addresses using importmulti on Bitcoin Core 0.16.0rc3.

       [
    {
        "scriptPubKey" : { "address": "tb1qkzq7kgx7rk45na3d3vt6vrqftfczq6ryn9zq0d" },
        "timestamp" : "now",
        "watchonly" : "true"
    }
  ] ,  { "rescan": false }

Response:

Please enter the wallet passphrase with walletpassphrase first.

Why that error? and shouldn't I add witness scrpit instead of scriptPubKey?

As noted in the Bitcoin Core 0.16 release notes, importmulti does not support SegWit addresses yet. This will be fixed in an upcoming release.


what happens to UTXOs when a transaction output script is satisfied? As per my understanding from the book "Mastering bitcoin", a transaction output contains three things

Amount - Bitcoin Value in Satoshis
Locking-Script-Size - Locking-Script length in bytes, to follow
Locking-Script -A script defining the conditions needed to spend the output

Now let us say a transaction input points to UTXOs mentioned in one of the transaction output through transaction hash and a validation software is able satisfy the scriptPubKey(locking script) using script‐
Sig(unlocking script).

Questions regarding this case

What would happen to the UTXOs mentioned in the output of parent transaction? Would it get vanished in the transaction or any change would happen?

  Only a valid transaction that correctly satisfies the conditions of
  the UTXO results in the UTXO being marked as “spent” and removed from
  the set of available (unspent) UTXO.

This was a statement from the book, now is there any seperate pool of UTXOs or it just meant the transaction lying at the leaf nodes of merkel tree?
And what does

  removed from the set of available (unspent) UTXO.

mean?

Would the output of the child transaction contain the same transaction  ids as the its parent'output contained?

Assume when the spender tried to see what all he can spend i.e the transactions directed to its bitcoin address then these were the transaction output which he got

[<7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 with 25000000 Satoshis>, \
<7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 with 16100000 Satoshis>, \
<6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 with 16050000 Satoshis>]

Please enlighten me if I am missing out on something.

I would like to first clarify a thing, before trying to answer, and it is also from the book:

  unspent transaction output (UTXO) UTXO is an unspent transaction
  output that can be spent as an input in a new transaction.

a UTXO is not an element per se, it is a description for a set of data in a transaction. UTXO's can be spent, or unspent. For transactions to become valid, they of course can only use unspents. So when using an UTXO from a previous transaction, spending all funds to a new address and a return address, the previous UTXO becomes part of two new UTXOs. And yes, the previous UTXO is spent, documented in the blockchain, and can't be used anymore.

When it comes to adding or removing UTXOs: here it is about mempool. The list of unspent tx is kept by the bitcoin client in memory. To see, how big UTXO database is, see here. This is what you described as a separate pool. And in this sense

  removed from the set of available (unspent) UTXO

simply means, that when you have sent a transaction, this particular UTXO must be removed from the mempool. I am not 100% sure, but the mempool is needed to verify, if the tx is valid or not (aka spends only valid UTXO out of the mempool). See also page 119 in the book.

  Would the output of the child transaction contain the same transaction
  ids as the its parent'output contained?

Each tx references a previous tx, to specify from which transaction (the tx hash) and VOUT to take the funds. So a child tx would reference a parents tx inputs. However, if the child tx is then referenced by the next tx, you wouldn't see references from the parent tx.

Assuming you have (you see) these three TX_IDs and outpoints and values,

7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 25000000 Satoshis
7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 16100000 Satoshis
6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 16050000 Satoshis

the wallet software would know, these are unspent outputs, and could be asked to use these as inputs for a new transaction of ~0.57BTC to a new address.

Besides the very good book from Andreas, I also recommend Ken Shirrif's blog entry, were he explains how to manually sign a tx. That makes things very clear as well.


RPC for LND: rpc_pb2_grpc vs lnd_grpc I'm trying to automate launching multiple LND instances with a Python script. I've been trying to use lnd_grpc but can't get it to work. I created an issue in the LND repository and was pointed towards https://api.lightning.community/. This website does have plenty of documentation and examples, but I can quite get the relationship between lnd_grpc (which I've  been using) and rpc_pb2_grpc (which is used throughout the documentation).

For instance, initializing a new wallet (as per official docs) in lnd_grpc is:

lnd_rpc = lnd_grpc.Client()
lnd_rpc.gen_seed()
lnd_rpc.init_wallet()

which is different from that in rpc_pb2_grpc.

Are these libraries (is this a proper word?) compatible? Should I  switch from lnd_grpc to rpc_pb2_grpc?

rpc_pb2_grpc is an official lnd API. This is a low-level interface that supports essentially all the same calls you can make through lncli. If you decide to use this one - I can suggest you start with this official tutorial.

lnd_grpc is a third-party wrapper on top of rpc_pb2_grpc, which introducing additional level of abstraction and hides some things from the user (such as handling protocol buffer messages and stubs). It is easier to use for most of the cases, but it is not official and it is less flexible than rpc_pb2_grpc.

Naturally, if you use the latter library - you should open issues in their GitHub, since they are not affiliated with the lnd devs.

Regardless of what you use - I think the error you are getting is related to the fact that you start lnd with the --no-macaroons option.


How to establish connection for mining testnet blocks on newly created altcoin I was trying to clone an altcoin for educational purposes. I am total newby and I've got some plans to implement different PoW and continue working on cryto-currencies.

I followed the cloning guide by Shakezula.

I followed all steps in the guide, however I am losing the main point: thus I am unable to connect machines to start mining. Can anyone please explain what I am doing incorrectly? I am struggling with this and am really looking forward to understand.

What I do not understand is the point on port forwarding from Shakezula's guide:

  Side note: because I use a VPS for this, I don't really need to worry
  about port forwarding at that end. On the home PC, you will want to
  forward the port you chose for P2Pport in the cut and paste section to
  the PC you're using. For this example, that is port 55884.

What does it mean?  Does it mean that I should add this port in .conf file of the machines?

My case:

I am trying to connect compiled coins on two VM machines: VM1 with IP 192.168.122.121 & VM2 with IP 192.168.122.158 (they are able to ping each other)
In my conf files I only put rpc username/password
On VM1 I do ./barcoin -testnet -connect=192.168.122.158 &
On VM2 I do ./barcoin -testnet -connect=192.168.122.121 &

In .barcoin/testnet3/debug.log I get the following:

ThreadSocketHandler started connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
Flushed 0 addresses to peers.dat 42ms
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused}
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused

I added this port 55884 to conf file of one of the machines and getting the same error.

Then I added command connect=192.168.122.121:55884 to one of the conf files and started getting this:

trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121:55884 lastseen=0.0hrs connect() failed after select(): Connection refused
trying connection 192.168.122.121 lastseen=0.0hrs connect() failed after select(): Connection refused

Please help me with this one.
Thank you very much!

I am glad to say I found a solution. It is quite trivial:
 The main PC, the main node, should be listening for others, therefore you need to add a command:

listen=1

In addition, I would suggest you to add following commands as well, but for all nodes:

testnet=1
testnet_config=1

Good luck everyone.


Why does blockchain.info show the warning "Transaction rejected by our node. Reason: The transaction is not final"? The transaction fc3f81c625720063c5cab2145bcb5ef20b13ff0aa73b0b2435ffdb645acfcb8b has the warning "Transaction rejected by our node. Reason: The transaction is not final." on Blockchain.info.

The same transaction shows up with five confirmations on Blockexplorer.com.

What does that "the transaction is not final" mean, and why did blockchain.info reject the transaction?

BTCJerk on reddit noticed that "Blockchain.info is having issues, the last block they show is 442341". Other block explorers were already on block 442349…

Since the transaction was timelocked until block 442345, and timelocked transactions are considered invalid until the appropriate blockchain height is reached, blockchain.info was still considering the transaction invalid due to its lagging behind.


How many Halving Days will there be? The first Halving Day was November 28, 2012, when block 210000 was generated.

How many more Halving Days will there be?

There will be 32 more if the precision doesn't increase. If Bitcoin lasts this long (very unlikely), precision probably will be increased.


What dead simple algoritm can be used for generating checksums by pen and pencil? I'm holding a course on Bitcoin and blockchain technology. On my agenda I have an exercise where I'm going to let the attendees create their own blockchain on the wall using post-its.

I'm in search for something that would resample Bitcoins proof of work that the attendees could calculate by paper and pencil. I've seen the 0.67 hashes per day however I'm in search for something much simpler.

What algoritms for generating hashcodes, or better for this purpose a checksum, exist that does not require ascii or base conversions? Could you invent something for this purpose?

When it comes to doing an easy calculation by hand, you are going to run into a problem.  An important part of a cryptographic hash function is unpredictability.  It is this unpredictability that allows us to use a cryptographic hash function as a proof of work.

For comparison, let's use a simple checksumming method on the alphabet.  Normally, a checksum is used to detect copy errors during a transmission or copy of data.  A simple method would be to count the number of vowels in the message, and append this number to end.  For example:

This message is checksummed

becomes

This message is checksummed|7

A simple checksum like this can be used to check if a vowel as accidentally turned into a consonant, or a consonant accidentally turned into a vowel (not very useful, I know).  If either of those two types of errors were to happen during transmission, the checksum wouldn't match on the receiving end, and we'd know there has been an error.

This mrssage is checksummed|7  <--- the checksum is wrong, so there's an error

This simple checksum is also a hash function, as it maps a larger block of data to a smaller chunk of data.  Obviously, this is a terrible hash function with an extremely high collision rate, but it's a simple enough example to calculate with pen and paper.

Now let's see what happens when we try to use this hash function as a proof of work.  We need to also add a nonce value that can be changed to modify the output of the hash function, without modifying the important part of the message.  I'll use the form message|nonce|hash.  Let's say that someone performing the proof-of-work needs to find a nonce such that the hash digest is greater than or equal to 10.  For example, the following would satisfy the proof-of-work:

This message is checksummed|aaa|10

When the message is hashed (checksummed) together with the nonce, we meet the proof-of-work.

The problem, however, is that our hash function is non-cryptographic, and therefore reversible.  Starting with our target value of 10, and our message of This message is checksummed, we can perform the checksum on the message and then do simple arithmetic to generate an acceptable nonce.  There is no unpredictability in the system.

If you use some sort of pen and paper hash function, you are almost certainly going to run into this problem.  Likely, those attending your class will see right through it, and not understand the purpose of the proof-of-work.  In the case of this example, it would be pointless.

If you choose to use a method like this, it is probably worth explaining to your class the significance of cryptographic hashing functions.  Otherwise the entire concept of proof-of-work doesn't make sense.


"State of the Coin 2012" and the mention of Satoshi Dice Jeff Garzik in his presentation "State of the Coin 2012" put the following slide:

Bitcoin development
Like trying to fix and upgrade a car,
While the car is going 100 m.p.h.,
With users fighting over the driver's seat,
Including one big burly driver named
SatoshiDice,
All of whom do not really listen to the mechanic,
Who will lose all their money if the car crashes.
And this is what we call fun!

What did he mean by that reference to SatoshiDice? I wouldn't want to not get any possible jokes, hints or allegations ;).

There was a very controversial and heated discussion among developers and on forum started by Matt Corallo: Huge increase in satoshidice spam over the past day. Essentially he proposed to police transactions priority for block inclusion to punish websites which doesn't take measures against overburdening Bitcoin Network.

It's worth to note that SatoshiDice by no means was trying to DDOS Bitcoin Network. The amount of transactions is the result of its successful business model and somewhat careless implementation.

Personally I think SatoshiDice is a very good thing, it pushed Bitcoin Network to its limits, but not to the point where it could become dysfunctional. SatoshiDice revealed that network's choke point was disk access time to verify transactions rather then ECDSA verification time. As far as I know LevelDB implementation to store transactions history to reduce disk access time was the direct result of SatoshiDice spam. It is also accelerated development of Ultra Prune method to reduce storage requirements.


Lost Account/ Wallet Back in I want to say 2011-2013 I was working and I was tipped by a man who was all excited to show me this new form of currency. I had created an account that he had sent me coins over. Since then I have lost/ switched phones and can't remember the exact app that I had at the time. Is there any way to look up my name and email?

Try the mainstream wallets like Coinbase, blockchain.info, etc and see if they look familiar and try to log in.

The hard part about your situation is that it's kind of the point of the Bitcoin system. Its like cash. So in a essence a few coins fell out of your pocket at the movie theater. It's online cash.


When will Litecoin be fully mined compared to Bitcoin? And at what years will each halving occur? Bitcoin will be fully mined in about 100 years. When will Litecoin be fully mined for its 84 million? And in what year will each halving occur for Litecoin?

Litecoin block reward halves every 840,000 blocks, which is roughly every 4 years (block time of 2.5 minutes). The first halving to 25 LTC per block happened on 25 August 2015, and the next is predicted for August 2019, when the reward will halve to 12.5 LTC per block. So because litecoin halves as often as bitcoin, it'll be completely mined only a couple of years after bitcoin is

2015-08 -- 25.0 LTC

2019-08 -- 12.5

2023-08 -- 6.25

2027-08 -- 3.12

2031-08 -- 1.56

2035-08 -- 0.78

.... and every 4 years.


Does anyone get custodial control of your funds when using Lightning Network? When I open a payment channel on Lightning Network, do I need to subject my funds to custodial control of another party? Is there a counterparty risk in Lightning Network?

From my understanding on how the Lightning Network works (derived from the whitepaper and video), all parties commit an amount of funds in order to open a payment 'channel'.  The architecture itself forces the funds to be either transmitted correctly (potentially multiple transfers between the involved parties), or in case of a non-collaborating channel node, for the transactions to be pushed to the Bitcoin blockchain and therefore for the channel to close without any of the involved parties losing any of the funds (but potentially not completing the intended transactions).  The custodian is the channel itself and therefore all the participating channel nodes.  Taken directly from the explanation:

  "This entry [multi-party blockchain entry] can be closed out at any time by either party without any
  trust or custodianship by broadcasting the most recent version to the
  blockchain."


How to find out where I sent my coins in 2011? I got into Bitcoin a while ago. 2011-ish. I build a miner and got a number of coins.
My storage wallet shows that I moved 4 coins to {long code} but I don't remember where I sent them. Is there any way to find them with that code?
I think I was sending it to a trading site or some kind of online wallet. Maybe my mining client? I honestly just can't remember.
I would be willing to send a coin your way if I am able to recover the lost coins with your advice.
Thanks in advance.
-someone who should have paid more attention to what he was doing
(at least i didn't pay 10,000 for a pizza...)

Check your email account around that time to see if you created an account on a Bitcoin exchange, or if you got a deposit confirmation.

To find it more quickly, you could try to search your emails for the amount you sent, the address that you sent from, and the address that you sent to, because either might be contained in such a deposit confirmation or payment request.

As Jannes mentioned, you could also try to search for the receiving address on a block explorer, to see if the address or a succeeding address where the money was forwarded to is a known entity.

Unfortunately, the most commonly used exchanges from 2011 are now defunct. But it may be worth seeing if you sent it to a Bitstamp account as that was founded in 2011.


How do I calculate the miners fee for my transaction using BitGo.com API? BitGo.com gives you the options of 'high priority', 'medium priority', 'low priority' and 'very low priority' for setting miners fee when sending bitcoin with their web wallet.

I am using their API to send bitcoins to different addresses. How do I calculate the miners fee (corresponding to any of the various priorities) to pass to the API when sending bitcoins.

Simply put, if I want to send 0.01BTC to an address with medium priority, how do I calculate the miners fee for medium priority (and the others) with their API or any other API.

You can get up-to-date Bitcoin transaction fees from bitcoinfees.21.co.

They also have an API.

If you are a coder, you can use the API to provide a dropdown list allowing your members/users to select the priority they want to use when making a transaction.


Are Bitcoin transactions really "frictionless" given confirmation time? One of the big selling points for Bitcoin is that transactions are frictionless.  I understand this to mean that there is no middleman to take a cut.  However, there are 2 major frictions I see.

1) Clients are difficult to use for "non-techies".  This can easily be solved with better clients.

2) Transaction confirmation times can take 10 to 60 minutes.  This seems like major "friction" in that it prevents fast transactions - something most people are really used to with cash and plastic.

So is Bitcoin really frictionless?

For small amounts it's fine to accept unconfirmed transactions. You must really understand how the protocol works to be able to double-spend an unconfirmed transaction. I'm sure in the future hackers will build tools to allow for these sort of scenarios to benefit them, but also bitcoin clients will grow more secure and be able to diminish the propagation of a double-spend in the network, perhaps using trusted central entities that can propagate your transaction much quicker than the attacker could propagate their double-spend.

If I'm selling something for lots of bitcoins, yes I'd wait at least 10 minutes. But if you compare this to selling something for cash, you'd still need the time to sit down and count the money and make sure it's real and that you're not being scammed. This could take you more than 10 minutes and you'd probably need to do it in a private area. With bitcoin you can do it in any public place using your phone, and instead of using the 10 minutes to check whether you're being scammed, you can have a friendly conversation with the person you're doing business with.


A Secure Offline Bitcoin Payment System A paper titled Secure Wallet-Assisted Offline Bitcoin Payments with Double-Spender Revocation (https://www.ethz.ch/content/dam/ethz/special-interest/infk/inst-infsec/system-security-group-dam/research/publications/pub2017/asia084.pdf) was published a while ago. The paper proposes the first solution for secure Bitcoin offline payments using an offline wallet with several novel security mechanisms to prevent double-spending and to verify the coin validity in offline setting.
There are three phases:

Online Bitcoin preloading.

Offline Bitcoin payment.

Online redemption of coins and revocation of double spending attacks.

In the first phase, the payer X generates pre-loading transaction τl (step 1) that transfers some bitcoins from her standard Bitcoin account x to the offline wallet’s account w, so that the balance of w becomes positive. This is done by means of standard online Bitcoin transaction, for which the network generates n-transaction confirmation n -Tl.
In the second phase the payer X requests W to generate an offline transaction τo with the desired amount destined to the account y (step 3).
In the third phase, the payee Y redeems the bitcoins he received offline by broadcasting τo into the Bitcoin network (step 4) and optionally obtaining network confirmation n -To (step 5).
The network confirmation will only be issued, if the network has not detected a double-spending attack against τo. Otherwise, the payee Y will trigger an optional double-spender revocation procedure, which includes sending a double-spender revocation transaction τr (step 6) to the Bitcoin network and obtaining corresponding confirmation n -Tr (step 7).

How does the transfer between the payer and payee's wallet actually happen if both nodes are offline? Does the offline wallet operate as a Layer 2 protocol somewhat allowing for deferred settlement like LN?

How does the transfer between the payer and payee's wallet actually happen if both nodes are offline?

From the paper:

  Because both, the payerX and the payeeY, have no on-line connection during the payment, the offline transaction τo is sent via local interfaces (e.g., Near Field Communication (NFC) or Bluetooth Low Energy (LTE)), in contrast to regular (online) Bitcoin transactions which are transferred via the Bitcoin peer-to-peer network.

So basically, whatever way the two devices can communicate will work just fine to communicate the transaction.

  Does the offline wallet operate as a Layer 2 protocol somewhat allowing for deferred settlement like LN?

I would not say it is analogous to LN, the function and trust model is different. From the paper:

  These  mechanisms achieve probabilistic security to guarantee that the attack probability is lower than the desired threshold.


What is the relationship between the Minsc language and Policy language? Quoting from the Minsc website "Minsc is a high-level scripting language...based on the Miniscript Policy language with additional features and syntactic sugar sprinkled on top including variables, functions, infix notation and more."
This question describes the relationship between Policy, Miniscript and Script. Sanket Kanjalkar explains how Policy compiles down to Miniscript whilst Miniscript is encoded to Bitcoin Script. So what about the relationship between Minsc and Policy? How best to describe this?

This is a work in progress in answer based on a conversation between the creator of Minsc (shesek) and me. I am paraphrasing so any errors are my own.
Minsc has a runtime environment with a Policy data type that gets constructed as the result of evaluating the program. The program evaluation could be considered part of the compilation process, in which case you could say that Minsc compiles to Policy but it is also possible to consider this evaluation as the runtime and say that Minsc doesn't compile at all, but is rather an interpreted scripting language with a runtime Policy datatype that could be produced by it. Functions/programs can return different data types too, but the high-level API catches when the main program does that and considers it an error.


Different ways to encode Bitcoin Address What are the different ways to encode a Bitcoin Address (both private and public) and how are they calculated? I've heard of things like firstbits, mini private key format, and I`d like to know how does one convert one number into another.

What you're talking about is actually two separate concepts. A "Bitcoin Address" is not a keypair, it does not have public and private components. The Address is derived from the public portion of the key pair and is almost always expressed as a Base58 string.

Firstbits is merely a way to look up addresses. When you enter someone's "firstbits" address at firstbits.com, firstbits converts what you've entered to all lowercase characters and then looks through the block chain to find the first (chronological) occurrence of an address beginning with that string. You can't send coins to my firstbits address of "1enmaku" for example, but plugging that into the search box will produce an address "1EnmakuaAN1WgAK2tUFvmsYcKc3NvH3NML" which is valid.

The others mentioned are all methods of expressing the private key. An address represents a receiving address, but the private key represents the right to claim coins at that address. A private key is a 256-bit number which can be represented in many ways. The most common way is WIF or "wallet import format" which is a 51-character string in Base58 which always begins with the number 5 and has some built-in error checking.

The mini private key format is also seeing some widespread use such as in Casascius' physical bitcoins. Mini private key uses as few as 22 characters of the same Base58 encoding as Bitcoin standard addresses. There are some criticisms that the fewer number of characters represents a smaller number of bits, making these keys vulnerable to brute force attack, but even the smallest of them still represent a substantial amount of entropy.


Tether USDT raw transaction unsigned I'm not using omnicore by RPC calls, I dont want to put a server up and make those RPC calls, I want to make a simple transaction on the TetherUS(USDT) network, this is my code:

const getUnsignedTransaction = async (data) => {
  let { pubKey, fromAddr, toAddr, amount, fee, testnet } = data;
  let params = new URLSearchParams;
  params.append('transaction_version',1);
  params.append('currency_identifier',31);
  params.append('fee',fee);
  params.append('testnet',testnet);
  params.append('pubkey',pubKey);
  params.append('amount_to_transfer',amount);
  params.append('transaction_from',fromAddr);
  params.append('transaction_to',toAddr);
  return await Axios.post('/v1/transaction/getunsigned/0', params);
}

When I call this function above

  let a = await getUnsignedTransaction({
    amount:    '0.00001',
    fee:       '0.00005',
    testnet:   false,
    toAddr:    '1KH34S5mAmgAzu3mJAqrS3wjP15qYKZQXx',
    fromAddr:  '17UrxYAAF5WkjtFKeuZ2S7ojDWoJY2LunF',
 pubKey:'03f26647f3bbf4566318d00e2438036be0f1a68ee5deea604be6fa6cad68349888',
  }).then(e => e.data);
  console.log(a);

I got this response:

{ sourceScript:
   'OP_DUP OP_HASH160 4715b028de4327f5f87915d89d1d074db3f03992 OP_EQUALVERIFY OP_CHECKSIG',
  status: 200,
  unsignedhex:
   '0100000001131184d4a10bbf1acef3cb137d37ecc8f36cb3da208c9ebe86fb988821d532b40100000000ffffffff034d160000000000001976a9144715b028de4327f5f87915d89d1d074db3f0399288ac22020000000000001976a914c87aa36f1402052ef87ea433c2fa252ae9a9794988ac0000000000000000166a146f6d6e69000000000000001f00000000000003e800000000' }

Now here is the question: How can I make this unsigned raw transaction an valid transaction to the Tether network and so, broadcast this signed raw transaction

This is the blockexplorer I'm using: https://api.omniexplorer.info/#request-v1-transaction-pushtx

Code solution

As the @Raghav_Sood chosen answer, I had to use bitconjs-lib to wrap this transaction and to sign it.

For those who wanna see in the future how I made the transaction, was kinda this:

let tx  = bitcoinjs.Transaction.fromHex(raw);
let txb = bitcoinjs.TransactionBuilder.fromTransaction(tx);
txb.sign(0, keyPair)
let raw = txb.build().toHex();

let d = await pushtx(raw).then(e => e.data);

function pushtx

async function pushtx(raw) {
  let params = new URLSearchParams;
  params.append('signedTransaction',raw);
  return await Axios.post('/v1/transaction/pushtx/',params);
}

The only omni-specific thing in Omni/Tether txs is the OP RETURN, and a small dust output to the address you are sending the funds to. Both of these seem to check out in your tx (I'm assuming you're sending to 1KH34S5mAmgAzu3mJAqrS3wjP15qYKZQXx).

You should be able to just use the regular Bitcoind signing functionality (or whatever library you are using's wrapper of it). They don't require any special signatures.


What does change address mean inside Electrum wallet? I am bit confused with the change label that is inside Electrum Wallet . Can I receive bitcoin if i give this address which are under change label? What is the difference between Receiving and Change Label Address?

Receiving addresses are addresses generated specifically for sharing with people to send payments to you. Change addresses are generated by your wallet automatically when you send funds to someone else.

To understand how change addresses work, consider this example. Say you received 0.1 BTC once, and 0.2 BTC another time. Now you have two UTXOs (unspent transaction outputs) to use to send to someone else. Now you want to send 0.25 BTC to someone. You have to use both of your outputs to have enough to send, but then you have 0.05 too much. You can't partially spend UTXOs, so what you have to do is make a transaction that spends both the 0.1 BTC UTXO and the 0.2 BTC UTXO, and sends 0.25 to the receiver and 0.05 back to yourself in a new address called the 'change' address.

You should not be giving addresses from the 'change' section out to other people. Use receiving addresses for receiving, and let your wallet program automatically handle change addresses.


How to distribute UTXOs in hard fork while preserving privacy? Let us say I have a UTXO set S = {U1,U2, U3 ..., Uk} on a pre-fork bitcoin blockchain.

How do I spend the previous UTXO S so that the new UTXO sets on both the chains are not linkable/tracable? Are there any common practices which people use for it? What are the trade-offs of different approaches?

At the point of the fork, both chains are identical, and thus all UTXOs are identical. All spends of those outputs are completely public as always, in the blockchain. So your question really comes down to whether you can hide which UTXOs you are spending in a given transaction, with or without the fork. The only way I know how to do that is via mixing. If you send your transactions in each chain to a mixing service, you'll end up with different outputs on each chain. The untraceability of the mixing is then dependent on things like how many other transactions are being mixed at the same time (on a new fork, there may be fewer people sending coins), or whether the value of the output you're spending is identifiable coming in and out of the mixing.


How are fractions of bitcoin implemented and spent? If the ability to spend bitcoins and therefore bitcoins depend on/correspond to private keys, how can fractions of coins exist? Can the key be split up? How are fractional transactions signed versus integer transactions? I am not asking what the subdivisions of bitcoin are or how it can be further subdivided.

Bitcoin doesn't use the concept of "balances" it uses transactions.  A transaction consists of inputs and outputs.

The transaction amount is the total of all inputs.  Each input in a transaction is spent in its entirety during the transaction.   And the outputs can total any amount up to the total transaction amount.  Any amount remaining (inputs - outputs) goes to the miner as a fee.

So a transaction might look like:

INPUTS:
25 BTC
50 BTC

OUTPUTS
40.2 BTC
34.7 BTC

So the 75 BTC total inputs, less 74.9 BTC total outputs means 0.1 BTC goes to the miner.

Now, at the protocol level, the 25 BTC amount is really 2,500,000,000 because each 1 BTC is actually 100,000,000 Satoshis.

So the 34.7 BTC output was really the number 3,470,000,000.

So there are no fractions.  These are all integers.

When the client displays these numbers, it shows them in whatever units the client is configured to use (BTC, mBTC, uBTC).


What happens when a coin is split? The original Bitcoin paper states:

  We define an electronic coin as a chain of digital signatures.

What happens when a coin is subdivided and transferred to multiple owners? Does each coin fragment form its own chain of digital signatures, or are all the fragments still part of this one original chain of digital signatures?

Each fragment starts it's own chain.

Edit: I randomly selected a transaction for you to see.  Try this link: http://blockchain.info/tree/7514743 and click on the yellow circles.

Edit2:: Actually, this one is more interesting: http://blockchain.info/tree/50429084  In the former, the payments mostly returned in part to the original address.  That's odd.  The usual way of doing things is sending to one address and returning to yourself at yet another address.


The ratio between propagation delay and block interval Is there a certain website or a study that gives an estimation for the
ratio f = Propagation Delay/Block Interval for the Bitcoin network ?
I know the Block Interval is roughly 10 minutes however, I don't know the propagation delay. I define it as the time it takes for all nodes to hear  about a mined block after it's been broadcast.

As mentioned by Ethan Heilman here:

  According the paper 'Information propagation in the bitcoin network.' by Decker and Wattenhofer. The mean time for a node to see a block is 12.6 seconds, after 40 seconds 95% of the nodes have seen that block.

From my personal experience as a developer, this delay is real and noticeable. Some block explorers catch transactions ~20-30 seconds before others. It may be scary at first but its normal.


How much should I charge a client if they pay me in bitcoins? The price of bitcoins fluctuates rapidly against other currencies. If I were to go to a restaurant and pay for a meal in bitcoins the price at the start of the meal would almost certainly be different by the end of the meal. In fact I have heard of this behavior happening in countries undergoing hyperinflation.

So how should I charge a client for a service when price of bitcoins change?  How should you pay employees an hourly rate in bitcoins when the price changes for each hour?

For the scenario of a retail or ecommerce purchase, one approach is to have an expiration on the price quotes.  For example, when a merchant uses BitPay, the invoice is good for 15 minutes.  If the funds aren't received, then the payment is recalculated as-of the time it arrives and if it overpaid, the customer gets a refund and if it was underpaid the customer has to send more funds.

Also, you can pad the exchange rate to your favor a little so that while some transactions lose value because of a change in the exchange rate, others will be in your favor but when you net it (overall gains minus losses) it ends up about a wash or a small gain.

Coming up with the pad amount can be aided by using a calculation that looks at recent volatility.

As far as contractors, you would want to contract that in advance.  So if both parties agree to a contract at a certain rate quoted in BTCs, then that is the agreed upon rate that is paid.

For salaries, you probably want to establish that in terms of fiat, and only after withholding for taxes and other deductions only them convert the net check amount into bitcoins at the prevailing rate at the time.

A company that has BTC-denominated contracts may want to hedge against exchange rate risk by either acquiring sufficient coins in advance, or using derivatives (e.g., CALL options or futures contracts).


What is the best way to restore an old Multibit wallet to the new version (and also different OS)? My files from Feb 2014 (on a dusty old usb) are as follows, all in a directory called MultiBit.
directories:

multibit.log (containing a log file)
multibit-data, containing four backup directories including key-backup, which itself contains two files like multibit-201402xxxxxxxx.key
and five files: checkpoint, info, properties, spvchain, wallet  (all preceded by multibit.)

It seems the “multibit” prefix changed to “saving” after 0.5.13. Also I have no “wallet words”, only a password, so I guess that changed too.

My thought is to use the import private keys procedure given in Multibit support. This would get around a new Multibit install asking for the wallet keys with the restore wallet procedure. And possibly issues with using a new OS too (Linux).

But:

1) Which multibit-201402xxxxxxxx.key file should I use,  the most recent, or both?  Will this work with my old files; should I change the prefix to “saving”?

2) Should I instead install some early Multibit version and use restore wallet from within the program? In which case can I tell what version I had in 2014 from my log file (or otherwise)?

3) Possibly not relevant, but I’m not sure if my files are from running a Multibit backup, or just manual copying. There is no .exe files in there, but they were created under Win (98 I think).

Note this question Help retrieving my old wallet, is similar, but doesn’t ask about importing private keys, among other things.
Also this question Transferring bitcoins out of an old multibit wallet, has a brief comment by the OP they managed to import their private keys, but not how this was done.

Not massive value in there but I’d be very grateful for advice.

Open a wallet on the block chain.com site and use your private keys there to restore your wallet


Litecoin query re Wemineltc Wondering if you can help me out with question..

I was mining litecoin with WemineLTC some years ago...  I am aware that they have now disappeared from the market.. I have or had 10 coins which were transferred into my wallet on my PC and have sat there for the last few years doing nothing..  Have these been lost or can they still be redeemed.

Thank you in anticipation

Find the seed phrase you used for your wallet, or open your wallet and transfer them to an exchange.

The actual coins are still on your computer - they are just some strings.
So you need to open your local wallet or restore it using the seed phrase.
Sell the LTC to convert to something else. LTC just isn't worth it.