How to send bitcoins with commission extracted from payment in PHP or bitcoind First, I have simple problem. I want to send customer some bitcoins, but I dont want to pay fees for him. I'd like to substruct fees from payment, so all commissions would be payed by customer.

I thought it should be a simple and common problem for all merchants that making refunds to clients. But I googled for hours and could not find any detailed explanation on how to achieve this feature 'receiver-pays-commissions'.

Here some links that I found usefull, but still they dont have exact answer

How to create raw transaction in bitcoind

How to create raw transaction in PHP

How to calculate transaction size and fee

Simply put. I want to send some bitcoins away so that my account balance will be equal exactly 1.8000000. Now it is slightly higher:

Surprisingly this simple and common problem took hours of googling, so I'm making this question just to share solution with public, since I finally found it.

(Or at least I think I've found it, so critics and comments are very welcome.)

Here is the algorythm without the code:

createrawtransaction with amount that you want to send assuming that fees are 0
fundrawtransaction to let your bitcoind construct final transaction, put your change address (on where you get change from unspent transaction - very important!) AND to caclulate fees that will be taken of your account for this transaction.
Substract caclulated fees from initial amount
Repeat steps 1-2 with new lowered amount.
Profit.

And here is the PHP code.

We will need function to create and fund new transaction

function prepareRawTransaction($amountToSend, $addressToSendTo) {

    $bitcoin = new Bitcoin('bitcoinrpc', 'xxx');

    $collectedAmount = 0;
    $sendToArray = [];
    $sendToArray[$addressToSendTo] = $amountToSend;

    $unspentTransactions = $bitcoin->listunspent(); //First we find out all our unspent transactions from where we can withdraw
    $collectedTransactions = [];

    foreach ($unspentTransactions as $unspentTransaction) {

        if ($collectedAmount < $amountToSend) {
            $collectedTransactions[] = [
                'txid'  => $unspentTransaction['txid'],
                'vout'  => $unspentTransaction['vout'],
            ];

            $collectedAmount += $unspentTransaction['amount'];
        } else {

            break;
        }
    }

    //Now we create raw transactions
    $rawTransaction = $bitcoin->createrawtransaction($collectedTransactions, $sendToArray);

    //And fund it
    $newTransaction = $bitcoin->fundrawtransaction($rawTransaction);
    return $newTransaction;
}

Now we can use that function to go on algorythm

$bitcoin = new Bitcoin('bitcoinrpc', 'xxx');

$amountToSend = 0.09999556; //That's exact amount that we want to send INCLUDING commission
$addressToSendTo = '2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF';

//createrawtransaction with amount that you want to send assuming that fees are 0
$transactionWithoutCommission = prepareRawTransaction($amountToSend, $addressToSendTo);

$decoded = $bitcoin->decoderawtransaction($transactionWithoutCommission['hex']);
print_r($decoded); //You can see that fees now set up

//Substract caclulated fees from initial amount
$amountToSend =  $amountToSend - $transactionWithoutCommission['fee'];

//Repeat steps 1-2 with new lowered amount
$transactionWithCommission = prepareRawTransaction($amountToSend, $addressToSendTo);

$decoded = $bitcoin->decoderawtransaction($transactionWithCommission['hex']);
print_r($decoded); //Here you can see that total amount + commission equal needed amount

$signed = $bitcoin->signrawtransaction($transactionWithCommission['hex']);
print_r($signed); //should say complete:1 if everything was correctly put

$published = $bitcoin->sendrawtransaction($signed['hex']);
print_r($published); //will output you tx id

And profit: you have sent exactly the amount you wanted INCLUDING the commission


How to set up multiple client under the same address? I want to use my all my computer to run Bitcoins, but is it possible to have it the same address so it generate under one wallet?

Thanks!

You can dump the private key from one and import it into the others


Bitcoin online game integration I want to create a game where users can win Bitcoins playing my games I created or perhaps other online games. What APIs do similar applications use to achieve this? how do they host the Bitcoins? do they use their own hosted wallet, bitpay? Bitcoin escrow?

The bitcoin software has it's own API.

Simply put, they run the bitcoind software and use RPC-JSON as the API.

EDIT : changed according to comment. Other implementations of Bitcoin also have their own APIs


What is time warp attack and how does it work in general? I am trying to understand the recent time warp attack on verge but since the attack is universal across all POW block chain i figure I could also ask here since people here are .. more knowledgeable.

I don't understand the detail of code.

But i assume something like, in bitcoin, there is a difficulty parameter that is decided for every 2016 blocks. Perhaps a integer. Such that all 2016 blocks mined during that that period all needs to have a hash that is less than that integer.

This difficulty is recalculated whenever 2016 blocks are mined. Everybody goes over this entire 2016 blocks, and take the earliest time stamp, take the latest timestamp, calculate how long it took to mine those blocks, and decide on a new difficulty integer for the next 2016 blocks.

But how does time warp works? I read something along, miners starts submitting blocks with large drifting timestamps (i think it is 2hrs for bitcoin?), but 2 hours is relatively small compare to the average time it is going to mine 2016 blocks (300+hrs). How would add or subtract 2 hours in the blocks cause mining to difficulty to decrease dramatically?

For a miner to drastically decrease difficulty, wouldn't he need:

Majority hash power so he can construct all 2016 blocks.
Change all timestamp in this 2016 blocks in a way such that it causes
dramatically decreased difficulty
profit... (but by that time people probably abandoned the chain anyway)

But once we get to point #1 we are.. kind of in trouble already, it's
just that having time warp made it worse???

Thanks!

The Bitcoin Protocol (consensus rules) has two relevant rules for the timestamps in block headers:

A node will not accept a block whose timestamp is more than two hours in the future.
A node will not accept a block unless it has a timestamp greater than the median of the previous 11 blocks.  In Bitcoin, we call this Median-Time-Past (MTP).

As you mention in your question, difficulty changes are calculated based on the times of the first and last blocks in a 2,016-block difficulty period.  (Technically there's an off-by-one error there, but that's not important here.)

Given the above rules, if all miners agreed, they could simply increment the clock the minimum amount of one second MTP for the first 2,015 blocks and then set the time to two hours in the future.  That would basically give them just a small decrease in the difficulty, but think about what happens to the MTP when they add that last slightly-future datapoint: the actual median doesn't change much at all.  Actual time stamps are in seconds, but here's a set of 11 timestamps in days delta from present time:

[-13, -13, -13, -13, -13, -13, -13, -13, -13, -13, 0]

The median of the above is -13, meaning that after miners create the slightly-future-time block at the end of the difficulty period, they don't need to move their timestamps forward more than the minimum one second---so the next difficulty period starts out -13 days.

At the end of the next difficulty period, miners again move the timestamp forward as far as possible, so the protocol thinks it took 28 days to mine the blocks---half the expected speed---and so decreases the difficulty by about half.  Now the values used for MTP look like:

[-27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 0]

So miners can continue keeping timestamps far in the past and repeat the attack, lowering difficulty every period until the point where it takes them less than 2,016 seconds to produce 2,016 blocks, at which point they can't lower difficulty any further because the MTP function requires time increase by a minimum of one second over the median every block.

Now, your main question was how can this attack work without collusion by a majority of miners.  Now that you've seen how the attack works with all miners participating, it should be clear than selecting the median time can allow an attacking miner who's lucky enough to find blocks reliably to prevent median time from jumping forward to an honest value.  For example, imagine these are the times of the previous 11 blocks, in block chain sequence:

[-27, 0, -27, 0, -27, 0, -27, 0, -27, 0, -27]

If you sort those numbers to find the median, it's -27 even though 5/11ths (45%) of the hashrate is mining accurately.  But wait, doesn't that mean the attacking miner has 55% of the hashrate?  Maybe not, for a large miner with about 30% or more of the hashrate could obtain an advantage over other miners using a selfish mining attack, or the miner could simply threaten to attempt to make stale ("orphan") other miners blocks who have accurate time stamps, causing those honest miners to earn less income.

I myself don't consider the attack particularly likely on Bitcoin because it's slow to execute and publicly obvious, but it's something protocol designers do need to keep in mind for when they change parameters, as those changes could make the attack easier to execute.


Transactions are verified by miners. What happens when the last BTC has been mined? Let's say we're X years in the future and we the last bitcoin has been minted. Since you can no longer incentivize mining new nodes of the blockchain, how will transactions continue to be verified?

You can still incentivize mining new blocks with transaction fees. So the premise of the question is false.


I was tasked with installing a bitcoin core on ubuntu and I had questions I was given the task to install Bitcoin core, to receive payments in the service. I have found some tutorials, but they were not used because they are GUIs. I want to use a bitcoin from the command line. How do i install bitcoin bark? How much free memory do you need?

At least 1 GB of ram is needed. If that is not enough you can simply add some swap memory to build the daemon.
Disk space is required also and at the time of writing it is around 200 GB.

To Build

./autogen.sh
./configure
make
make install # optional

Required dependencies

Ubuntu & Debian

sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3

Now, you can either build from self-compiled depends or install the required dependencies:

sudo apt-get install libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev

BerkeleyDB is required for the wallet.

For Ubuntu only: db4.8 packages are available here. You can add the repository and install using the following commands:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev

Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install BerkeleyDB 5.1 or later. This will break binary wallet compatibility with the distributed executables, which are based on BerkeleyDB 4.8. If you do not care about wallet compatibility, pass --with-incompatible-bdb to configure.

To build Bitcoin Core without wallet, see Disable-wallet mode

Optional (see --with-miniupnpc and --enable-upnp-default):

sudo apt-get install libminiupnpc-dev

ZMQ dependencies (provides ZMQ API):

sudo apt-get install libzmq3-dev

source: bitcoin github


docker container ip setting How to setting docker container ip?

root@instance-1:~# lightning-cli getinfo
{
  "id": "0230c8826852e2a39883f36233483419e9c139b644c696b8dbcca38fef7303ee95",
  "port": 9735,
  "address": [
  ],
  "binding": [
    {
      "type": "ipv6",
      "address": "::",
      "port": 9735
    }
  ],
  "version": "v0.5.2-2016-11-21-2725-gb79bb1d",
  "blockheight": 524318,
  "network": "bitcoin"
}
root@instance-1:~# docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS
       NAMES
59424f02b9e2        cdecker/lightningd:latest   "/usr/bin/lightningd…"   11 minutes ago      Up 11 minutes
       lightning
6d4c7fb6d3e2        dougvk/bitcoind:latest      "/entrypoint.sh bitc…"   23 hours ago        Up 23 hours         0.0.0.0:8333->8333/tcp, 8332/tcp, 18332-18333/tcp, 0.0.0.0:9735->9735
/tcp   bitcoind_mainnet

It is part of the basic concept of Docker that Docker assigns an IP address for you to the container.

But maybe this isn't what you are asking?

From what I can see on your screenshot, you have certain port mappings active, as listed under "PORTS". You should be able to access those ports under the IP of your Docker host as Docker will expose those port for you.

In other words: More often than not, you don't care about your container's IP address at all.


What if the system crashes if I have made transactions after my backup? Suppose I have a recent backup of my wallet.dat file.

Now I make (say) two transactions: one receipt and one send.

Before I run my next backup, the hard drive crashes and I lose wallet.dat.

I can restore wallet.dat, of course, but only prior to the new two transactions.

What will happen to those two transactions?

Assuming you had a chance to send those transaction out, they will still be processed. So long as the transactions didn't create any new change addresses, your wallet will still have all the information needed to spend any Bitcoins you have left.


What is the number of transactions in a block? What determines the number of transactions that can be validated in a block?

The absolute limit is the size of the block, which is currently hard-coded at 1,000,000 bytes.  Each transaction takes up a variable amount of space, but ~250 bytes is about right for a simple (one-input one-output) transaction.

However as soon as a block is solved it is not possible to extend the block by adding in more transactions, as the proof of work has to be redone, so broadcasting it immediately is the only sensible thing to do. So the number of transactions in a block is actually a function of the number of transactions being generated over a time period and the time taken to solve a given block.

Blocks used to contain fewer than 200 transactions and the largest number of transactions in a block was 1,976 at the time this answer was originally written (May 2013). In meanwhile (November 2017) the average number of transaction per block is well above 1500 with peaks above 2200.


What Income Could I Expect as an OTC BitCoin Trader How long is a piece of string?

Given "typical" UK market conditions, if I wanted to trade BitCoins as an OTC trader (via LocalBitCoins, IRC etc) - what income could I expect? £10/day? £100/day? £1000/day?

Just looking for a finger in the air guesstimate.

After the withdrawal of Mt. Gox and Intersango from having a domestic bank transfer method for those in the UK, there has been a widening need for local trading.

There are two exchanges that sell bitcoins and take Barclay's Pingit for payment, Blockchain.info/wallet and a new one, BitcoinFridge.co.uk, so any local trader is competing with those methods.

But for face-to-face cash trading, that is just like any retail operation where the key to success is location, location, location.

If you look on LocalBitcoins for London, there are a couple traders showing a history of completing hundreds of transactions, and the vast majority of the remaining traders with just a handful of completed trades.  Without knowing the timeframe for that and average purchase amount it is tough to compute earnings (profit).  It appears that there isn't much more liquidity above a 7% deviation from the market price, so that will be a limiting factor.

But there is an increasing level of local trading occurring, and buyers gravitate towards sellers who are established.  So starting sooner rather than later gets to that "established" level before the latecomers.

Also, there may be an opportunity to serve as a broker to other traders.  For instance, casual traders may have orders too big to accommodate themselves, but could fill the order with an affordable local source of bitcoins that are sold in larger amounts for maybe just a few percent premium over spot.  That's possibly where the biggest opportunity lies (albeit it would also be where the largest capital requirement, for inventory, is necessary as well.)


How to accept Bitcoin payments using Bitpay and Electrum for a business Our company uses a standard invoicing model where we bill our clients the service charge and require payment within X days. We'd like to be able to add a "Pay with Bitcoin" option on the invoices. We are thinking we'd use a service like Bitpay to facilitate the payment and then have Bitpay send the BTC to our business wallet which uses Electrum.
What are some important considerations? Although Electrum generates several wallet addresses, Bitpay only allows entering a single address. Is this okay? I've seen recommendations to always use different addresses, but I can't figure out how to do this with Bitpay.
Perhaps another service instead of Bitpay would be a better option...

Bitpay is easy to use but certainly has many limitations at least on the merchant side.
In my country it has even suspended the bitcoin settlement service altogether.

If your company is interested in investing a bit on the cryptopayment side, maybe can be a more wise approach building your own infrastructure, maintaining a BTCPay server and a Bitcoin full node.
This is the BTCPay description you find on bitcoin wiki:

BTCPay Server is an open source payment processor. It enables online
merchants to accept bitcoins as a form of payment.
The invoice API conforms to that of the centralized payment processor
BitPay. This allows easy migration of a merchant's code base to their
own self-hosted payment processor. This enables all the benefits of
using a full node wallet; such as censorship-resistance, control over
your own funds, trustless validation, uptime and privacy.

BTCPay is used both by small and large companies, it is widely supported by the Bitcoin community, supports lightning network which enables micropayments and seems a perfect fit for your needs.
This is the homepage: https://btcpayserver.org/
and here there is a live demo: https://mainnet.demo.btcpayserver.org/login?

If you don't want run your own BTCpay server, you find here some merchants that sell the service: https://directory.btcpayserver.org/filter/hosts
(although i suggest you reading this first)

If you want to explore other service beyond BTCpay i found this "curated list of awesome Bitcoin payment processors enabling merchants, businesses and nonprofits to accept Bitcoin payments": https://github.com/alexk111/awesome-bitcoin-payment-processors


Use UTXOs before transaction is signed/broadcasted Suppose I have an address with a single UTXO. I want to create 100 transactions and sign/broadcast them all at once. Could I do the following:

Create a transaction by hand (where change funds are sent to the sender address)
Calculate the transaction ID
Use the transaction ID and change UTXO output index to create the second transaction
Go to step 2

Until I create 100 transactions? I suppose my question boils down to: Is it possible to calculate the TXID of a raw transaction before it is signed or broadcasted?

Thanks!

It depends.

If your UTXO is a segwit UTXO, then yes. You will have everything that you need to know to calculate the txid before you signed the transaction.

If your UTXO is not a segwit UTXO, then no, you cannot know the txid until you sign the transaction. This is because with spending non-segwit UTXOs, the signature is part of data that is hashed to become the transaction id. So you cannot calculate the transaction id until you know what the signature is.

Signing and broadcasting a transaction is not a single step that happens simultaneously. You can sign a transaction before you broadcast it. So you can make your 100 transactions and sign them as you make them. Once all are made, you can then broadcast the transactions.

Furthermore, if you are sending 100 transactions with one output paying someone, and the other being change back to yourself, why don't just create one transaction with 100 outputs? This is far more efficient and will guarantee that all 100 receivers receive their money at exactly the same time. This will also save you on transaction fees.


What files do I need for backing up my wallet? Is %APPDATA%\Roaming\Bitcoin\wallet.dat the only file I need to backup my wallet?

I've heard about backing up every ~50-100 transactions is this correct? I thought that with the wallet.dat file, I have my private key, which is all that I need to restore my bitcoins.

Yes.  The wallet.dat file is all you need to be able to keep your coins backed up.  You'll also obviously need your password if you've encrypted your wallet.

However, backing up the entire folder may be advisable if you're on a slow internet connection.  The blockchain is getting rather sizable and can take a significant amount of time to redownload from scratch.  I recently needed to do that and it took almost 2 full days.


90% confidence interval for mining a block? I did some math and found that the 90% confidence interval for bitcoin blocks is that the block will take less than 1381.6 seconds. I used the calculation ln(10)*600 with 10 being used because a 90% confidence interval means one in ten blocks are expected to fall outside of this range. Could this be considered a 90% confidence interval?
Note: this could change if the difficulty is expected to rise or drop. If block time is 576 seconds, for example, it becomes a 91% confidence interval. In practice this changes a lot once the difficulty adjustment has passed.

Bitcoin blocks are mined according to a Poisson process with a mean of 10 minutes (600 seconds) if you assume constant network hash rate. The difficulty of mining blocks gets adjusted every 2016 blocks to address this variability.
Interarrival times of a Poisson process are exponentially distributed.
The 95th quantile of an exponential distribution with a parameter of 1/600 is 1797.4
The 5th quantile of an exponential distribution with a parameter of 1/600 is 30.8.
90 percent of the time an observation from an exponential distribution will fall in the interval of (30.8,1797.4) seconds
The median time is 415.9 seconds.


Bitcoind walletnotify runs only when transaction get it's first confirmation I've successfully configured bitcoind and walletnotify to run on every deposit transaction in testnet. The problem is walletnotify hits only when a transaction gets its first confirmation and nothing happens when the transaction has been just created and has 0 confirmations.
Here is my bitcoin.conf
blocksonly=1
daemon=1
maxconnections=20
maxuploadtarget=500
testnet=1
rpcuser=someuser
rpcpassword=somepassword
server=1
keypool=1000
walletnotify=/home/ubuntu/walletnotify.sh %s

And this is content of walletnotify.sh
#!/bin/bash
F=/home/ubuntu/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}

which simply writes DateTime and txid of each transaction in wallet_transaction_log
wallet_transaction_log
20201111135218 - d0cafe97f46ae3f8fb0bda6234a5c7a54ecb7053da10d9c393e261e0f6ab8295
20201111135921 - dfdd50db6e4508a4221ab144d8b33d77620d324d2a4667b64882e0a608b2bf80

is there something I'm missing?

You are in blocks only mode as you have blocksonly=1 set in your bitcoin.conf. This means that your node will not receive or relay unconfirmed transactions. You only see blocks and the transactions that come in blocks. Thus the first time your node will see an incoming transaction is when it is first included in a block.


How does ENS prevent frontrunning attacks? Namecoin uses commitments to hide the domain. ENS uses simple hash, which is not hiding.

The only way to get the domain name on the ENS is to win at the target name auction.
So there is no need to hide the name.
ENS uses the name hash for converting arbitrary length string into bytes32.


How to see previous transactions? This question is linked to this one. I try to understand the bitcoin block by exploring and viewing every piece of information, since the blockchain is public and shared.

When the sender transacts some bitcoins to the recipient, he technically transact previous transactions. So in a transaction, it is possible to find successively all previous transactions. Where can we find this piece of information? (I remembered that I already saw this information on a website, I thought that was https://blockchain.info.)

You are correct all transactions other than coinbase transactions utilize previous transaction outputs. You can navigate those using any number of block explorers:

http://blockchain.info
http://blockcypher.com
http://blockr.io

And many more.


segwit is activated due to BIP91? Segwit (BIP141) is active since block 481824 in 24th August. I wonder if it was the BIP91 that made the segwit happen? I mean lets say BIP91 never existed, would segwit be activated in 24th August anyhow.

The direct cause for Segwit's activation is BIP 91 which forced all miners to signal for segwit and that thus activated segwit. However BIP 91 was caused by BIP 148 which threatened to force miners to signal for segwit on August 1st and potentially cause a hard fork. If BIP 91 had not activated, then there may have been two chains where segwit activated/will activate on one (the BIP 148 chain) and a chain where segwit is not activated and may not activate. There may have also been no chain split and all miners followed BIP 148 and activated segwit at around the same time anyways.


how difficult is it to generating an ECDSA (or Schnorr) signature with a certain number of leading zeros? If both the public key and the private key are known ahead of time (public knowledge), and the goal is to choose a message/nonce that generates a signature with, for example, a certain number of leading zeroes, is this a similarly computationally challenging task to traditional proof of work in that it is "hard to find" but "(relatively) easy to verify?"

It seems like the answer should be "yes," because if the answer is "no" then (I think?) it would imply that signatures are not pseudorandomly uniform for different messages.

Put perhaps more succinctly, can a signature also itself serve to represent a targeted proof-of-work?

Lastly, do answers to any of the above change when the signature scheme used is Schnorr rather than ECSDA?

edit: it seems that adapter signatures[1] may essentially allow for this, but I do not know enough about how they work to know for sure.
[1] https://github.com/ElementsProject/scriptless-scripts

Not if you just do leading zeroes or just lowest value when interpreting as a very large integer.

To make things easier, let's just assume that you use compact signatures which are just the signature's R and s values concatenated with each other instead of other signature formats which have additional surrounding formatting bytes that would interfere with a direct comparison.

The compact signature format just concatenates the R and the s values. However this would be a trivially broken PoW scheme as soon as one person found a valid PoW, and that person would always be the winner. This is because the R value is just the X coordinate of a nonce which is multiplied by the curve's generator point. If someone finds a R value that works with the PoW, they can just keep reusing that nonce and always have the same valid R value. So this is obviously broken.

But if you were smarter about what is compared for the PoW by instead checking that the s value is lower than the target. The s value is computed using a formula which includes the nonce, the message hash, and the private key. In Schnorr, there are also multiple hashes and EC Curve point multiplications, which help to make it more random. So s should be pseudorandom.

But there are some other issues with a signature based PoW, although these are more directed at ECDSA specifically rather than signatures in general.

The public key to verify against must be known, and must be known to be "correct". This means that you can't just have each person participating in the PoW provide their own public key, it needs to be some fixed public key, and everyone has to know the private key.

This is because, given an ECDSA signature and a message, you can compute a public key that would validate that signature and message combo. This is why it is important that the public key is known before validating the signature. Note that this is not possible for the proposed Schnorr signature scheme as it is not possible to do public key recovery with it.

The message that is verified must be published and hash. That's pretty obvious as it's a crucial part of any PoW algorithm. But specifically with ECDSA, given a signature and a public key, you can compute a message hash that would would result in a valid signature. This is why it is important that the message is something that is hashed and not just the value that gets put into the signature algorithm. This shouldn't be possible with the Schnor signatures.

So you could use signatures as a PoW so long as you are checking s and not R for the actual PoW check. And I would suggest that you use Schnorr signatures rather than ECDSA.


When purchasing an item through BitPay, how do their exchange rates compare with the market exchange rates? BitPay allows merchants to price their products in USD, and receive USD when a customer pays using Bitcoin. The exchange rate used at the time of purchase is calculated somehow by BitPay, but their website doesn't indicate how it's calculated.

If at the time of purchase BitPay immediately sold an equivalent number of bitcoins on, say, MtGox then the exchange rate used should be pretty close to the highest Bid price at that point in time.

Many people must have purchased items through BitPay. I'm interested in knowing what exchange rates were available on MtGox (or other exchanges) within a few minutes of the time of purchase, and what exchange rate was provided by BitPay. Can anyone provide an example of this?

Their website does have the methodology by which the exchange rates are calculated.


How do I determine the value of new altcoins? So, I'm curious about the value of altcoins.

Let's say I were to create an altcoin, and get some people to use it... how would I calculate the value of the coin? Is this determined by exchanges? Or by how much money people give in exchange for X amount of the coin? I'm a bit confused by this. I've tried researching it, but nothing's really helped.

Thanks in advance!

The price is found when offer and bid intersect. Exchanges are platforms that facilitate the management and visibility of these, but less efficient markets work as well.

The price is what you can get for it in exchange. You cannot dictate the price except by providing your own offers/bids.


Stratum Server Exception "[coin] is not connected" When i running 'twistd -ny launcher.tac' i getting the following Exception. The connection okay. Please help me to fix this issue.

2017-01-30 19:33:43,094 INFO bitcoin_rpc # Checking for submitblock
2017-01-30 19:33:43,097 DEBUG bitcoin_rpc # submitblock detected.
017-01-30 19:33:43,097 INFO mining # Found submitblock
2017-01-30 19:33:43,101 ERROR mining # Coind Error: Guncoin is not connected!

Thanks,
Your help will appreciated!

If anyone runs into this problem then check your coin daemon settings.

I got it because my client didn't find any nodes to connect to. I found a list of nodes and added them in my COIN CLIENT SETTINGS.

I.e:

addnode=xx.xx.xx.xx

Restart the client, run client-cli getinfo to make sure you're downloading blocks. If it works you should be seeing

ERROR mining __init__.setup # CoinD downloading blockchain... will check back in 30 sec

Let your client update to the latest block and everything should be just peachy.


What are conflicting transactions? Does it mean BTC lost permanently? An online store recently received a payment via a wallet-to-wallet BTC payment. But after a while the total_received value went down to zero on blockchain.info. Now the address cannot be sweeped as there is no balance so the merchant assumed that the money is lost/stolen.

Tradeblock seems to have more details for this transaction:

https://tradeblock.com/bitcoin/address/1L1MSa36vaSeo8myBcGfGA3UddGDitZXai

Here's another similar one "suspected" from the same user:

https://tradeblock.com/bitcoin/address/1KsVJ1ySWVmVD5uci4mSuT98Uj65VpEzD

(icon at the rightmost column of each transaction has more details)

Can someone pls explain the anatomy of this - how to interpret and how to rectify (if at all possible).

Conflicting transactions are simply two or more transactions that spent the same UTXO in its inputs (i.e. doublespending).

The only remedy is to not treat a transaction as successful until it has a number of confirmation that satisfies you.

It is impossible to recover from a successful doublespend attack should the conflicting transaction be included in the blockchain.


Backing up my bitcoin wallet - is wallet.dat all I care about? I know that there are many duplicates of this but I'm hoping that the way in which I word this explains and helps not just me, but others as well.

In any of the coin wallet  bitcoin and the alt coins, when I run a backup I see a wallet.dat file being created.

Does this wallet contain all the necessary information like private keys etc... in order to say encrypt this file and store it on a google drive , dropbox etc..  ?
If my hard drive takes a dive etc.. , CAN I simply take that wallet.dat file , and on another computer decrypt it and restore my information based on my coin currency?
If I do the encryption within the wallet, is the wallet.dat called something else?

I understand the exchanges , buying, trading , selling, mining...  I'm just not versed in the backup with my information... private keys etc...    thanks in advance.

Yes.
Yes.
No. Note that that the software's encryption encrypts only the private keys, not transaction and address book information, so to protect your privacy you may want to add encrypting the file itself.


How do TorCoins work? The tor network relies on volunteers providing bandwidth. This is a limiting factor of that system, since there is currently no direct benefit by operating a tor relay.

As I understood, TorCoins are altcoins that can be mined by providing bandwidth to the system. But how would a Proof-of-Work mechanism work for such a system?

TorCoin
is an alternative cryptocurrency, or altcoin, based on the Bitcoin
protocol [8]. Unlike Bitcoin, its proof-of-work scheme is based on bandwidth
rather than computation. To \mine" a TorCoin, a relay transfers bandwidth
over the Tor network. Since relays can sell TorCoin on any existing altcoin
exchange, TorCoin e ectively compensates them for contributing bandwidth
to the network, and does not require clients to pay for access to it.

For more info, see the white paper on TorCoin.


Would it be theoretically possible to make a Cryptocurrency in a scripting language like PHP, Python, or Ruby? Just wondering if this is even possible.  If so, are there any practical reasons not to?

Yes, it is possible. A cryptocurrency is essentially a set of rules and network protocols that nodes can use to talk to one another to implement those rules. The reference implementation Bitcoin-Qt is implemented in C++, but there are other implementations (eg. Java).

The tricky part about implementing a client for an existing cryptocurrency in another programming language is that you must be careful to implement the rules in exactly the same way as all other implementations. If there are any changes (even such as fixing bugs present in the original) then the blockchain may fork and your client would need a patch to continue participating.

If you're creating a new cryptocurrency from scratch, of course you don't need to be concerned with replicating bugs in an existing client. However, you run the risk of introducing a whole new set of bugs.


Transaction fees for smaller transactions Thinking about the potential problems with Bitcoin, I am doing a thought experiment.  Suppose that Bitcoin is successful in replacing gold.  The market cap of gold is $9.6 trillion (10^12).  At that level, each bitcoin would be worth $400,000.  In such a world, let's suppose that people were making $40 transactions to buy things.  Then the average transaction would be  0.0001 bitcoins.  Assuming a reasonable transaction fee of 1%, this would imply that transaction fees should be 1 micro bit-coin in such a world.

Bitcoin-qt would clearly need to adapt to this.   Some miners (payment processors) could offer different terms,  and users could choose these payment processors with the addnode option in bitcoind.

I just wanted to get some feedback on how transaction fees are going to adapt to a higher marketcap.

Kind Regards,
  Harold Naparst

The default fee is in place to decrease the chance the creation of dust outputs (miniscule amounts of bitcoin). Dust outputs cost more to spend than they are worth themselves and they still need to be stored in the disk space of anyone that stores the complete blockchain - thus are frowned upon.

To read a discussion on that matter with some of the Core Developers you might want to review The minimum transfer fee is not trivial anymore.

Currently, there are some mining pools that accept transactions even without transaction fees. The default transaction fee in bitcoin-qt has been lowered before when the value of bitcoin increased sufficiently to make the recommended transaction fee too high. This happened for example in May 2013, when the default fee was reduced to 0.0001 BTC from 0.0005 BTC.

It is therefore expected that the default transaction fee will be kept at a respectively low level should the value of bitcoin increase dramatically. In any case, anyone can choose to ignore it by changing the settings of their bitcoin-qt.


How can I sell BTC on Ripple com? I have just been helped by a friend and got 300 XRPs (which quickly became 299, thank you) and then I transferred 1 BTC from another address to my Ripple.com wallet.

First Ripple.com shows 299 XRP and has an exclamation sign next to it, which clicked says "Your current account is low. You must keep a minimum of 250 XRP to use all the features of a ripple."

Great! I am about to trust somebody for whom 299 < 250 ? Or is it advance warning?

But I digress, that is the new world of cryptocurrencies, some of the worst Web and UI and database programming seen in the recent history, so a site that clearly says it is beta must be excused.

Okay, so now I am trying to sell my 0.5 BTCs for some XRPs. Whether I place BTC sell order at the current bid, or in the middle between current bid and ask I always receive;

Error: Transaction failed
You don't have sufficient funds

Your current account is low. You must keep a minimum of 250 XRP to use all the features of Ripple.

That is a warning shown whenever your XRP balance is less than twice the current reserve requirements. The number in the warning will also change as you add/remove trust/credit lines or add/fill/cancel trade offers.

The amount of XRP required to in reserves are listed on the Ripple wiki. Basically, the 250 you see is 200 for your account plus 50 for your trust/credit line to Bitstamp (that you added to get Bitstamp-BTC into your Ripple account).

To make a trade offer requires an additional 50 XRP (which is just a reserve, it becomes un-reserved when the offer is filled or cancelled). Since you had only 299.9999 XRP (not 299 as you said) Ripple was unable to create a new trade offer as the new reserve limit would have been 300. Yes, the error message is not as clear as it should be.

Whoever sent you your initial 300 XRP really should have sent 300.1 or 350.1 (or more). Although it is possible to get more XRP from BTC on a new Ripple account with only 250.0001 XRP, it's requires careful management of the limited XRP that shouldn't be expected of a new user. It's really best to start a new account with at least 350.1 or more XRP.


Port Forwarding for Bitcoin Core in order to allow incoming connections? There is a rather good explainer on https://bitcoin.org/en/full-node#port-forwarding on how to do port forwarding for bitcoin core in order to allow incoming connections so as to support the network.
I have followed the instructions, set a fixed local IP for the Mac running bitcoin core and am now trying to configure the router for port forwarding.
Here I am facing the issue that I do not know what to write in the External host field. Please see attached screenshot. I am trying * since I do not know the IP of external host, but this does not seem to be allowed.  The instruction on the above link does not include the detailed configuration that my router requires.
Could anyone please identify what I am filling in wrong in the attached screenshot and suggest how I can change this so that my full node can start allowing incoming transactions?
Many thanks for your time and support!

External host is the IP of the host connecting to you. If you want to allow anyone to connect, you can just put 0.0.0.0.


Verification of transaction once trasaction is broadcasted I have few doubts regarding verification of transaction and am trying to find answers from last few days. I agree similar post exist in this portal but I am not getting satisfactory answer for my questions. Its also fine if you can paste link which has detailed analysis of transaction verification if its annoying to answer same questions again and again.

1) Since block is created after constant number of transactions is it the case that, until that number of transactions are accumulated all transactions remains on hold?

2) Since there is only one coinbase transaction per block does this mean that all the rewards are accumulated in single transaction and then distributed among the winners?

3) When transaction is verified what exactly it verifies and how it verifies ?
Here major part of my confusion is. As per my understanding it checks each and every transaction from beginning of time by verifying signatures to check whether given transactions are unspent or not which I feel is unpractical.

Thanks for your time

1) Since block is created after constant number of transactions is it the case that, until that number of transactions are accumulated all transactions remains on hold?

Your premise is false. Blocks are not created after a constant number of transactions. They are created whenever someone manages to create one.

  2) Since there is only one coinbase transaction per block does this mean that all the rewards are accumulated in single transaction and then distributed among the winners?

No. Each block has a coinbase transaction that rewards the miner who generated that block.

  3) When transaction is verified what exactly it verifies and how it verifies ? Here major part of my confusion is. As per my understanding it checks each and every transaction from beginning of time by verifying signatures to check whether given transactions are unspent or not which I feel is unpractical.

You don't have to actually do this. You just have to produce the same results as you would if you did this. Since you check each transaction as it occurs, there's an obvious optimization -- there's no need to check transactions you've already checked. That will be every past transaction.

Basically, you check that the transaction is well-formed, properly signed, doesn't spend out more money than it pulls in (unless it's a coinbase transaction), and that all the funds it pulls in come from valid transactions and haven't yet been spent.


Who generates the coinbase transaction? As the wiki article says,

  Given just those fields, people would frequently generate the exact
  same sequence of hashes as each other and the fastest CPU would almost
  always win. However, it is (nearly) impossible for two people to have
  the same Merkle root because the first transaction in your block is a
  generation "sent" to one of your unique Bitcoin addresses.]1

Who generates the coinbase transaction?

The coinbase transaction is not relayed by the network. It is invalid except as the first transaction in a block.

A standalone miner generates the coinbase transaction itself.

In mining pools, the mining pool generates the coinbase, and sends it to the mining client.


How can one be truly anonymous without mining? Assume that person wanting to be anonymous has reason to do so. Powerful enemies will see what is bought with bitcoins, perhaps web blog on server and domain name. Even in nations with rule of law, United States applies strong pressure and registrars and server hosts give up bitcoin address used to pay for things.

They trace address to address until find person who sold bitcoins for cash or credit card or wire fee.

If cash, famous exchanges know which city and bank address cash was deposited. Modern law enforcement technique is excellent for figuring identity once given such a clue. If not famous and idiot from Craigslit or similar, roll over in hurry when threatened with prison. Will try very hard to remember. And credit card or wire more even more trivial to figure.

I run tests, bitcoin mining take 22 million million years to give pocket change. Computer not so fancy after all.

Forgive poverty english please, translated to many languages and back before posting.

Once you have bitcoins, there are tools such as mixing services to help increase your privacy.

For true anonymity in acquiring bitcoins, cash-in-the-mail provides a method that can be anonymous.  You send an envelope with cash and a bitcoin address.  Voila, bitcoins are acquired anonymously.

Cash-in-the-mail methods:

Get-Bitcoins.com - U.S. address, accepts USD.
QuickBitcoins.net - U.S. address, accepts USD, EUR
BitcoinNordic.com - Danish address, accepts EUR, GBP, DKK, SEK, NOK, USD (others with prior approval as well)
BitcoinsInBerlin.com - German address, accepts EUR


Do bitcoin addresses reveal my identity? Is it recommended to use different addresses for transactions whenever possible? I have been told that a bitcoin address is similar to an email address.
Is my total possession of Bitcoin visible on the blockchain by anyone?
If address A receives 1 BTC from Alice and address B receives 1 BTC from Bob, and then I want to send 2 BTC to Dave; is that possible and how?

The blockchain doesn't know your total possession.  You know that addresses A and B belong to you, but the rest of the world doesn't know they belong to the same person.

However, Bitcoin transactions are allowed to have multiple inputs.  So you can create a transaction with two inputs, one from each of your two previous transactions.  This transaction will include two signatures, one for A and one for B, thus proving to the world that the respective owners of A and B (whether the same person or different people) have authorized their coins to be spent in this way.

Your wallet client software will take care of this for you automatically.  So from your perspective, all you have to think about is that you own 2 BTC.  You don't really have to pay attention to which addresses they live in; when you want to spend coins, your client software will choose appropriate inputs from among all your addresses.

It's not really correct to think of a Bitcoin address like an email address that identifies a particular person.  It's a token that's associated with a particular private key, such that coins sent to the address can only be spent by whoever holds the private key.  But there doesn't have to be a one-to-one correspondence between addresses and people.


How to send a payment through a route saved in a json? From lncli network=testnet sendtoroute -h:

NAME:
lncli sendtoroute - send a payment over a predefined route
USAGE:
lncli sendtoroute [command options] [arguments...]
DESCRIPTION:
Send a payment over Lightning using a specific route. One must specify
a list of routes to attempt and the payment hash. This command can even
be chained with the response to queryroutes. This command can be used
to implement channel rebalancing by crafting a self-route, or even
atomic swaps using a self-route that crosses multiple chains.
There are three ways to specify routes:
 * using the --routes parameter to manually specify a JSON encoded
   set of routes in the format of the return value of queryroutes:
       (lncli sendtoroute --payment_hash=<pay_hash> --routes=<route>)

 * passing the routes as a positional argument:
       (lncli sendtoroute --payment_hash=pay_hash <route>)

 * or reading in the routes from stdin, which can allow chaining the
   response from queryroutes, or even read in a file with a set of
   pre-computed routes:
       (lncli queryroutes --args.. | lncli sendtoroute --payment_hash= -

   notice the '-' at the end, which signals that lncli should read
   the route in from stdin
OPTIONS:
--payment_hash value, --pay_hash value  the hash to use within the payment's HTLC
--routes value, -r value                a json array string in the format of the response of queryroutes that denotes which routes to use

I use this command to save the routes in a json file:

lncli -network=testnet queryroutes 02e34c1b4c5f8e7419cf4d10e3bc9651d46dc1af68df6a7b81a24951a9192aa9c4 --final_cltv_delta=144 25000->routes.json

Then from the spec, performing:

lncli --network=testnet sendtoroute --payment_hash=03bd33db2dfdebff50ca8a7ae3bade681bbf7f25246248c9416b4441b1dbf4c2 --routes=routes.json

I always get back this error:

[lncli] unable to unmarshal json string from incoming array of routes: invalid character 'r' looking for beginning of value

Am I doing something wrong?  What should I set as --routes parameter?

I think the problem is that you are trying to pass the file name as an argument instead of the content of the file. Try passing the json through the standard input instead:

cat routes.json | lncli --network=testnet sendtoroute --payment_hash=...


Standardness rules related to BIP 16 (P2SH) I can read in BIP0016 wiki the P2SH Specification

  Transactions that redeem these pay-to-script outpoints are only
  considered standard if the serialized script - also referred to as the
  redeemScript - is, itself, one of the other standard transaction
  types.

  The rules for validating these outpoints when relaying transactions or
  considering them for inclusion in a new block are as follows:

  Validation fails if there are any operations other than "push data"
  operations in the scriptSig. Normal validation is done: an initial
  stack is created from the signatures and {serialized script}, and the
  hash of the script is computed and validation fails immediately if it
  does not match the hash in the outpoint. {serialized script} is popped
  off the initial stack, and the transaction is validated again using
  the popped stack and the deserialized script as the scriptPubKey.
  The rules for validating these outpoints when relaying transactions or
  considering them for inclusion in a new block are as follows:

  Validation fails if there are any operations other than "push data"
  operations in the scriptSig. Normal validation is done: an initial
  stack is created from the signatures and {serialized script}, and the
  hash of the script is computed and validation fails immediately if it
  does not match the hash in the outpoint. {serialized script} is popped
  off the initial stack, and the transaction is validated again using
  the popped stack and the deserialized script as the scriptPubKey.
  ...

OP_CHECKSIG and OP_CHECKSIGVERIFY count as 1 signature operation, whether or not they are evaluated.
OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY immediately preceded by OP_1 through OP_16 are counted as 1 to 16 signature operation, whether or not they are evaluated.
All other OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY are counted as 20 signature operations.

But in Antonopoulos's book I can read

  Prior to version 0.9.2 of the Bitcoin Core client, Pay-to-Script-Hash
  was limited to the standard types of bitcoin transaction scripts, by
  the isStandard() function. That means that the redeem script presented
  in the spending transaction could only be one of the standard types:
  P2PK, P2PKH, or multisig nature, excluding RETURN and P2SH itself. As
  of version 0.9.2 of the Bitcoin Core client, P2SH transactions can
  contain any valid script, making the P2SH standard much more flexible
  and allowing for experimenta‐ tion with many novel and complex types
  of transactions.

Now, I'm using 0.19.0 and I'm able to create custom script and rely it in my regtest enviroment.
the question is: Can The BIP0016 is obsolete? And if it is, where I can see which BIP is became obsolete?

In general, changes to policy rules are not specified in BIPs. They're up to individual clients anyway.

BIP16 is not obsolete, though its description of the standardness rules in Bitcoin Core is outdated by now. However, its consensus rules (i.e., what is valid in a block, not what will be relayed as individual transactions) are unmodified since it activated in 2012 — anything else would be a hard fork.

As far as policy in Bitcoin Core goes, in version 0.10.0 (2014), relaxed standardness for P2SH spends, allowing any script using up to 15 signature checks. Several later changes to standardness were made (including every script-affected softfork (CLTV, CSV, Segwit) was accompanied with making corresponding spends standard), but none so fundamental.

Today (Bitcoin Core v0.19.0) standardness rules for P2SH spends include:

Max scriptSig size is 1650 bytes including redeemScript (not enforced on testnet)
Max 15 signature checks in the script (not enforced on testnet)
No opcodes intended for future upgrades (NOP3-NOP10) [discourage upgradable nops rule]
No non-DER encoded signatures, or hybrid public keys [strictenc rule]
No signatures with s values in the upper half of the range [low-s rule]
The additional argument popped by OP_CHECKMULTISIG(VERIFY) must be exactly the empty byte array (as pushed by OP_0) [nulldummy rule]
All pushes must use the minimal size encoding (OP_i instead of direct pushes where available, no OP_PUSHDATAi when unnecessary), integers can't have unnecessary zero padding [minimaldata rule]
Execution must end with exactly one non-zero element on the stack [cleanstack rule]
Checksig operations that fail must be passed an empty signature [nullfail rule]
OP_CODESEPARATOR cannot be used (not even in an unexecuted branch).
Signatures that are verified cannot appear in the scriptPubKey (they must come from the scriptSig) [const scriptcode rule]
At the transaction level: no tx version above 2, and the whole tx cannot be larger than 400000 weight units (100000 bytes if no segwit inputs are present).


Where is the part in code related to the installation on Linux/Mac and windows? Where in the source code is the part related to the GUI and platform depended installation?

The GUI is based on QT, the code for the GUI is in the folder src/qt.


Is there a Android POS full node wallet apps that is open source? An app that can also stake? Are there any Android Proof of Stake apps that is open source. The peercoin app seems to be a light client. Some of the apps seem to be QT transformed to Android.

I think the short answer is no, there isn't an Android full node app. Being a full node would requiring downloading and storing the entire block chain, and that is too much data for mobile devices.

I don't know of any mobile wallets that stake. And you are right that many of the apps are just the QT code transformed to Java. I think it was done this way on purpose so as to ensure that the two references are bug-for-bug compatible.


Is my Tor bitcoind node seen by new normal nodes? I've finished the setup of a bitcoind node behind Tor like in method 1 of this guide
I'd like to be as helpful as possible to the network and especially new nodes trying to sync.
Are new nodes able to see me right from the bat even if my 8333 port is only open using a .onion ip address?
Unfortunately I can't open port 8333 because I'm behind a firewall and my ISP charges for a public IP address.
If I want to set up an electrum server (electrumx) using .onion address will it be easy for normal electrum wallets to connect to my machine?
Thanks

Are new nodes able to see me right from the bat even if my 8333 port is only open using a .onion ip address?
  Unfortunately I can't open port 8333 because I'm behind a firewall and my ISP charges for a public IP address.

No... Onion sees onion, clearnet sees clearnet.  Your firewall is keeping you off of clearnet.

  If I want to set up an electrum server (electrumx) using .onion address will it be easy for normal electrum wallets to connect to my machine?

Yes, just tell your users to follow this:

Using Electrum Through Tor


How to generate bitcoin P2SH WIF key and address pair from sha256 private key? lets say i have sha256 Private Key Hexadecimal Format

0000000000000000000000000000000000000000000000000000000000000001

how can i get P2SH address and its corresponding WIF private KEY ?

by P2SH i mean P2SH-P2WPKH address starting with 3.
are these called 1-of-1 multisig address ?

Private keys give public keys, which can give bitcoin addresses starting with a 1. But a P2SH address (starting with a 3) is simply the hash of a script, and that script could be almost anything, it isn't usually associated with a single public/private key. Perhaps you mean P2SH-P2WPKH? In that case you could read something like this: https://bitcoincore.org/en/segwit_wallet_dev/ (specifically the section called 'Creation of P2SH-P2WPKH Address'). Otherwise maybe something like a 1-of-1 multisig address or simple P2SH encoding a normal P2PK/P2PKH redeem script? I'll update this answer if you clarify exactly what you mean :)


How to process refunds and ensure that after a crash you don't resend to someone? I want to have a server running that will be processing payments and refunds.  However, I also want to ensure that should my server die, that after a restart I will continue sending out any applicable refunds without sending a refund to someone I have already sent one too. I plan on using a WAL to achieve this, but I need to know what to store in the WAL. Is it possible to know your transaction ID before submitting the transaction?

That way I could just log the ID before submitting, and if I crash, I can just check the blockchain to see if that transaction already exists or not.

This seems like it would be a common problem for payment processors, but looking at the JSON-RPC documentation it appears that you only ever get the transaction ID after submitting the sendfrom/sendtoaddress.

You can check blockchain for the latest transactions of the address you are using for refunds.

Get the latest transactions of the address from the blockchain and compare those to the refunds in your system to see which ones you were able to send and which ones you weren't before the crash.


How do people actually try double-spends? I've occasionally seen people online claiming they were victims of a double-spend because they handed over something of value in exchange for a bitcoin payment with no confirmations.

Although I understand this is theoretically possible, how would someone try this practically?  All available bitcoin clients would not allow you to make a transaction that spends an output that has already been spent, and the client would know about the first transaction very soon after it was broadcast.

Are there specialized double-spend-friendly bitcoin clients out there?

EDIT:  Please note: I am not asking for theory of any kind (especially not theory on how the blockchain / proof-of-work / waiting for confirmations solves the dobule-spend problem).  I am asking purely practically ... how does someone pull off a double-spend attempt?

Edit

You could practically open two separate bitcoin clients (such as MultiBit and Bitcoin-QT). Prepare a transaction that is using the same input. As for output one would use the payee's address, while the other client would use your address (you're double spending right?).

At this point you'd just have to send the transactions at the same time and hope your payee has gotten the correct transaction instead of the double spend. I doubt there's a client that automates this procedure.

You could also make this happen with a higher success rate if you send the valid transaction directly to the payee's client, while you send the double-spend to the node of a pool. This would increase the chances that your double spend will actually make it inside a block before the other.

Of course to do this would require you to get your hands wet with lower level bitcoin clients such as sx or directly bitcoind. Actually I'm afraid you'd have to program this functionality yourself studying the protocol and making sure you know how to broadcast to specific nodes instead of the entire network.


Is blockchain necessary? I am interested in developing a crypto-currency (who isn't), but I have no interest in the blockchain mining aspect of it. I want to program one that emits the coins when someone has performed some verified work in the real world.

So, does that still require the use of blockchain?

I want to program one that emits the coins when someone has performed
  some verified work in the real world.

This is fiat currency. You receive some coins for performing some work for someone :) No blockchain needed


How do previous transactions work? I'm confused about the inclusion of the hash of the previous transaction in a transaction. Is it mandatory? Should it be the hash of the last outbound transaction? What if an unexpected transaction messes up the linked list? I have written specific scenarios below for which I am unsure about the behaviour.

I have an account A for which its only transaction T1 was receiving 1 BTC from some other account. If I want to spend my 1 BTC in a transaction T2, do I need to include the hash of the transaction T1 in T2?
I have an account B which so far only received 1 BTC from a transaction T1 and I want to spend the 1 BTC in a transaction T2 referencing T1. But just before broadcasting T2, a transaction T3 also referencing T1 credits my account with 1 BTC. Will T2 be accepted despite T3 entering the blockchain before T2?
I have an account C to which someone will send 1 BTC tomorrow in a transaction T1. Is it possible to "pre-spend" the 1 BTC in a transaction T2 without knowing the hash of T1? By pre-spend I mean that as soon as my account gets credited with the 1 BTC from T1, transaction T2 can immediately also enter the blockchain.

Short answers: yes, yes, no.

The longer answer is that you should stop thinking in terms of accounts/addresses - they are irrelevant as they don't really exist at the protocol level (they're just a client-side abstraction in the wallet).

Bitcoin functions in terms of coins, very much like your physical wallet containing coins. Coins are produced and consumed by transactions.

Every coin has a value (between 0.00000000 and 21000000.00000000 BTC), and an address of its owner (that's a simplification, but it suffices for now).

Every transaction consumes one or more coins. This is done by referencing them explicitly (by stating the hash of the transaction that created it), and providing a signature (for each) that proves you are the owner. They are consumed entirely: they're either spent or unspent, there is no "withdrawing" or "crediting" of/to them.

Every transaction also produces one or more new coins, whose sum in value cannot be more than the value of the coins consumed by the transaction.

As transactions deal with complete coins all the time, this means we sometimes have leftovers that need to be returned. This is what change addresses are for. When you have a coin of value 3.1 BTC, and you want to pay me 1 BTC, you'll create a transaction with one input (consuming the 3.1 BTC coin), and two outputs (one 1 BTC coin to me, one 2.1 BTC coin to a possibly different address of yourself).

Even though the concept of "balance of an address" is well-defined (the sum of the value of all unspent coins assigned to that address), this concept does not exist at the protocol level. You always work with full coins, and arbitrary amounts that get added/subtracted from balances (though the value of those coins is arbitrary).


what is the relationship between bandwidth and hash rate? What is the relationship between bandwidth and hash rate?
I have an AntMiner S4 mining at 2.1GHashes.
I understand that the miner has no hard drive, and does its operations purely in memory, and that the device sends and receives data when calculations are complete.

My question is what does running a Bitcoin Miner do to network load (I am assuming network load is a function of Hash rate).

Hash rate measures how fast your miner can attempt to find a nonce that satisfies the proof of work.  The speed at which it performs this task is not related to network bandwidth.  It does not perform a network operation per hash.

Bitcoin mining still requires network usage, however.  Your miner will request a unit of work from the mining pool, which is really just a block header.  This is only 608 bits (not bytes) of data.  Your miner's job is to fill in the remaining 32 bits of the block header (total size is 640 bits), called the "nonce", and hash it to determine if the proof of work is satisfied.  If you have exhausted all 2^32 options, then you will request a new unit of work.

So your miner will request units of work more often the faster it can hash, but this amount of network traffic is small.  Since each unit of work is only 608 bits, this is a very negligible bandwidth usage.  You won't see a significant increase in profitability by increasing bandwidth.

You may want to check out this answer to How do mining pools distribute work effectively?, specifically the comments.


How to create (many address)/receive/send bitcoin without download blockchain? I need to create a lot of address on my wallet to get bitcoin.
Check balance and make transfers.

I do not have a hard disk of 200 GB, can I use bitcoin without downloading the blockchain?

Need implementation on NodeJS, or at the command line.

mkdir .bitcoin
echo "prune=600" >> .bitcoin/bitcoin.conf
bitcoind --daemon

And blockchain not more 600 MB


Connection refused from external server Here is my bitcoin.conf

server=1
rpcuser=root
rpcpassword=passwordhere
rpcconnect=75.74.28.1.2 (last 2 digits randomized for security).
rpcport=8332
rpcallowip=107.180.44.217

So whats the issue? When I run it via localhost it is able to connect. Externally it isn't. Ports are forwarded and are open.

Without indication if your bitcoin.conf belongs to the client or server, I leave you some guidance on what to check:

Make sure your server bitcoin.conf has the following line:
rpcallowip=your.client.ip.address

Both server and client bitcoin.conf should contain the same rpcuser and rpcpassword lines
rpcuser=foo
rpcpassword=bar

Make sure your client bitcoin.conf has the following line:
rpcconnect=your.server.ip.address


bitcoin adresss in my email from 2014 i did a search in my email for "bitcoin" and i came up with a bitcoin address sent from me to me looking like this "bitcoin:1AQhW**************" is that bitcoin money and if so how do i get it ?

That's just a bitcoin address, it may not have any bitcoins sent to it, and even if it does, you can't spend them unless you find the private key too. Check the balance of that address here https://blockchain.info


How to store transactional information on the blockchain I have an operational process that involves several sub processes. I am currently maintaining an audit trail of the entire process.

For (successfully) completed processes, I want to record the successful transaction (along with all relevant details) on the blockchain, for public consumption.

What is the 'best practise' way of storing data on the blockchain? - and what (if any), are the data size limitations (and how to workaround data size restrictions?)

OP_RETURN is meant to store extra data on the blockchain. As fees are per kbyte, you'll be paying more fee.

Remember that block size is limited (1MB now every 10 minutes, but growing) and fees are expected to go up quite a bit, so if your application needs to be able to scale, you really need to do some calculations whether yours is a viable solution at all (in general: it should be much cheaper and easier to store extra data yourself, instead of burdening the whole world with it).


Could a hacker replace Bitcoin QT in some Linux repository and steal Bitcoins? Bitcoin QT, being a Linux application, is updated regularly when the application in the repository is being updated (For example, apt-get upgrade on Debian).

Theoretically, if a hacker could get into some Linux repository, he could replace the application with a malicious one that steals both the private key and the wallet file and send it to a remote server (effectively stealing all the Bitcoins from most the users).
If possible, even through social engineering, the incentive for such hack is enormous.

How likely/unlikely that to happen?

You know you don't have to trust the repo. The developers of Bitcoin-QT actually recommend using their binaries rather than the distro's. So you can just keep up to date with those. Official binaries are signed with a Bitcoin-QT developer's PGP keys.


Storage of Private Keys Most web apps that accept bitcoin (whether it's an exchange, a gambling site, etc) provide the user with a public address for depositing bitcoins into their account.

How are these web applications storing the private key associated with the deposit address? What is the best practise for the storage of the private keys from a security standpoint? What is the best storage procedure for web developers looking to create large quantities of key pairs for their web applications?

If you only need receiving addresses, then you need only a table for those along with a column that flags to prevent it from from being used a second time.

Keys can be generated in bulk:
 - http://bitcointalk.org/index.php?topic=101708.0

Now just because you aren't saving the private key on the web host doesn't mean security can be lax.  If a host were compromised, the attacker could replace the Bitcoin addresses in the table with addresses under the control of the attacker.

For situations where the Bitcoin client needs to send transactions, a cold wallet / hot wallet method will help lessen the damage should  the system become compromised.

Here's additional information for Securing online services:

http://en.bitcoin.it/wiki/Securing_online_services


Will I be still getting segwit2x coins if I store BTC in my desktop BTC wallet I'm with three exchanges, one says they don't support BTG and therefore user should withdraw their BTC before Nov 16th's fork takes place.

Another one says they will issue 1:1 segwit2x.

The last one doesn't seem giving a clear answer.

I have some BTC in these three places. If I withdraw my BTC to my desktop wallet, would I be able to receive segwit2x and BTG when fork take place?

I have some BTC in these three places. If I withdraw my BTC to my desktop wallet, would I be able to receive segwit2x and BTG when fork take place?

Nope, BTG hard fork has already happened. If your exchanges don't support BTG, then there is nothing you can do to claim your BTG.

You can still withdraw your BTC if you want to claim your S2X coins, and if you do, you'll be able to claim them after the hard fork. (~15th of November)


Delay of shipping mining equipment on purpose? Is the delay in shipping mining equipment on purpose?
Couldnt the manufacturer mine with the new hardware and deliver it in a few month, as said to be a production problem, but mining itself until the difficult level is too high, all on purpose, and then getting rid of the hardware? Its perfect, altough morally really weak, to mine with the equipment others pay for.

There are reports online that Butterfly Labs and Avalon were both doing this as some customers have received dusty equipment with mining pool information set, however it is just as likely that the equipment was shipped out with preset pools and customers plugged them in and didn't reconfigure settings.

https://bitcointalk.org/index.php?topic=236348.0 is an interesting read, however it all appears to be circumstantial evidence at best.


Importprivkey's "label" - is it the same as an account? The "importprivkey" API call allows one to import a private key and save it with a label. Is the "label" in the API call synonymous with an account used in the wallet?

Though the terminiology is unclear, in code "label" and "account" are the same thing:

importprivkey function (src/rpcdump.cpp):

pwalletMain->SetAddressBookName(vchAddress, strLabel);

from getnewaddress function (src/rpcwallet.cpp):

pwalletMain->SetAddressBookName(keyID, strAccount);


What laws apply to selling / buying bitcoins for USD in California? Please help me identify any laws that would be potential blockers to selling and buying bitcoins in person.

I am not a lawyer but I think this Bitcoin Magazine Article should be informative. As far as case-law goes I would check out the bitcoinica bankruptcy suit as well as the tradehill bankruptcy suit


How to stabilize Bitcoin's exchange rate (reduce volatility)? Is it possible to stabilize exchange rate(s) of Bitcoin to FIAT currencies (USD, EUR etc.) and make the rates less volatile only by raising the market capitalization (more people buy/invest in Bitcoin so it will be less vulnerable to big buys/sells) or are there other options?

The Bitcoin price is the result of a free market. There is no central authority that could by order "pump money into the system".

This currently happens anyway - but decentralized. When more people buy Bitcoins the market cap increases. With a higher market cap a single trade has a lesser effect on the price. Therefore, over time when Bitcoin attracts more users and investors, volatility will go down. There is no need for a centralized intervention.

Bitcoin can also be compared to small cap stocks or currencies of small countries. These types of assets are known for their high volatility. Large cap stocks on the contrary show a significantly smaller volatility due to the above stated reasons.

For a more in depth treatment of these arguments, read this article on Bitcoin volatility.


Why was Bitcoin Core in need of a fork of LevelDB? Why did Bitcoin Core fork LevelDB? What special needs does Bitcoin Core have, which require a specialized version of LevelDB?

Sometimes LevelDB has bugs and those bugs sometimes are not fixed in a timely manner in the upstream LevelDB project. These bugs can be problematic for Bitcoin Core so a fork of LevelDB was created to handle these bugs specifically.

Additionally, to ensure security, we want to use a specific version of LevelDB at a specific commit. By having our own fork of it, we can control what version and what commit it is on so that we can control exactly what code we are putting into Bitcoin Core.


Where is Australia's second bitcoin ATM machine? Last ABC1's 7:30 ran a balanced Bitcoin story.

http://www.abc.net.au/7.30/content/2013/s3926368.htm

In it they showed a Bitcoin ATM being use in Melbourne.

They also said "One way to buy Bitcoins is using Melbourne's first Bitcoin machine. It's one of just two nationwide".

I haven't been able to google up where the second machine is. Possible places mentioned online are Melbourne (different provider), Sydney and Nimbin.

Anyone know were this second AMT machine is?

The one in Nimbin is definitely a Lamassu, I used it in mid-January this year (2014), and apparently I was his first customer!  You can find them on coinmap.org


Why do I get: Error:  has no matching Script The example code for psbt.addOutput() with address '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp' works as expected. But if I change this to an testnet address I get this error: ' has no matching script'. I expect I need to specify testnet somewhere, but do not know where.

    const psbt = new bitcoin.Psbt();
    psbt.addInput({
        hash: 'b881ecef041a7396f3c225644507955732ae98d4a736de7b9ac235c69e1eb182',
        nonWitnessUtxo: Buffer.from(
        '020000000001012aa24043833303b066cf10...1a1800',
        'hex',
       ),

    });

    psbt.addOutput({
      //address: '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp', <- works
      address: 'mhm89vYkAjmU3MWUtyCUcsYYUvkgXT1FAw',
      value: 7240446,     //was 7250446

    });

you need to be  passing the  network parameter as the tuple and thus you forgot to put the {} on them . the link on github repo (https://github.com/bitcoinjs/bip174) explains the proposition in correct way.


Is there an intermediary that allows me to pay eBay purchases with Bitcoin? I mostly buy stuff on Ebay since Amazon and Bestbuy don't offer worldwide shipping, I live in southern Asia.

I have an account with my local public bank denominated in US Dollar to make my payments to Ebay. However, it is very hard to get USD in this country as rich people have all of it. If I used a local currency account instead, the bank would charge a 10% commission for each international payment for currency exchange and cross border fee.

Is there a Bitcoin solution for this?

One thing you could do is order an prepaid debit card with one of the various providers. They usually allow you to create virtual cards instantly, which are just denominated in one of the major currencies. One example is crypotopay.me


How well does P2Pool scale? See this thread.

How would P2Pool scale if 10% of Bitcoin mining was done via it? 50%? 100%?

Is the current implementation scalable? If not, are there designs for making it scalable?

There are two problems with scaling P2Pool:

The sharechain difficulty goes up as the pool gets bigger to maintain the rate of finding shares at around every 10 seconds.  If everyone was using P2Pool then the difficulty of finding a share would only be 60 times less than the difficulty of solo mining, and so varience would go right up.
As more miners join, it's likely that the latency goes up.  Since the share that the pool is working on changes every 10 seconds or so, a delay of just a few seconds is very significant.

In order to scale, there needs to be multiple P2Pools.  Maybe they can be nested in a tree structure: a level 1 P2Pool sets its difficulty so it finds shares every 5 minutes.  100 different level 2 P2Pools feed into it, finding shares every 1 minute, and 100 level 3 pools feed into each of the level 2 pools, finding blocks every 10 seconds.  Ideally this would all be managed automatically by the p2p network if that's possible.


Why is not possibile to convert a signed transaction into psbt? In the bitcoin core doc is explicitly said that conversion from hex to psbt are only allowed for unsigned transactions, or, at most, passing a signed one with the permitsigdata param set to true, but again it returns the related unsigned tx.

The converttopsbt RPC converts a network serialized transaction to a PSBT.
This should be used only with createrawtransaction and fundrawtransaction createpsbt and walletcreatefundedpsbt should be used for new applications.

Why signatures aren't allowed/considered while converting?

Given just a signed transaction, it is difficult to extract all of the data in the scriptSig or scriptWitness into PSBT's input fields. This requires having the UTXO and then interpreting and executing the script which is not necessarily available to bitcoind instance doing the conversion.

Additionally, signed network serialized transactions are not necessary fully signed, they could be partially signed in the way that the raw transaction RPCs do it. This makes it even more difficult to extract that information.

Lastly, a PSBT is far more mutable than a network serialized transaction. It can change afterwards which can invalidate signatures.

So instead, we decided to disallow signatures to avoid the possibility of putting incorrect and/or invalid data in a PSBT during the conversion.


What is the difference between reliance on miners on Drivechains and Lightning? It's commonly said that the Drivechains proposal gives much power to miners and that they can steal money from these drivechains, but I keep thinking that if what they can do is to vote on which transaction will be able to spend from the hashrate-controlled escrow, then if a majority of miners collude they vote on a steal transaction, fine.

Now, a majority of miners can also steal the funds from Lightning channels they're participating in if they are able to spend an old channel state and don't allow the new state or the penalty transaction to be published in time.

Some differences between the two steal attempts are:

To steal on Drivechain the colluding miners don't ever have to orphan blocks.
They can steal all the Drivechain funds at once.

Are these the crucial differences? Do they make Lightning inherently safer than Drivechains? What am I missing?

I would consider these two crucial differences, so I guess you answered your own question. I guess the more important distinctions, though, are about the systemic impact of both:

Firstly, Lightning can simply be done with bitcoin as it is (OK, we needed segwit, but we needed that anyway). So it would be hard to keep people from using Lightning.

Secondly, the risk of miners stealing bitcoins in LN channels is probably not a problem: LN deals with small amounts, miners would have to collude with one side of every channel they want to steal, and breaking Bitcoin's censorship resistance in order to steal some LN funds would be such a nuclear attack that it would probably tank price AND lead to a PoW change.

On the other hand, IIRC drivechains explicitly expect miner consortiums to steal funds in unpopular sidechains. Very different risk profiles IMHO.


How does one create another transaction when all funds are tied up in an unconfirmed previous transaction? If I have only one UTXO and I spend from it that's fine, I send myself back the change and that works how I expect it to. However if I want to create a new transaction in the time that the first transaction hasn't confirmed yet then what do wallets do?

Do they use CPFP/RBF? What's the most reliable way to send a new transaction that depends on the first transaction getting confirmed.

It depends on your wallet software. Some may simply refuse to create the transaction. Others will spend the change output of the unconfirmed transaction. CPFP and RBF typically only occur when you specifically request for it in order to increase the fee of an unconfirmed transaction. Wallets will not do this automatically for you.


Withdrawing Ether from Cryptsy to geth I am trying to withdraw Ethers from Cryptsy to geth account. Cryptsy says address, where I enter my account id, is invalid. Do I need to create a separate addresses besides running geth account new to create a new account?

It is just a formatting issue.  Include "0x" at the beginning.


How much Bitcoin did I mine in December 2013? I just realized I had a bitcoin mining program installed back in November/December 2013.

I am trying to figure out if it's worth going through all my backups to see if I can still find the wallet file.

I assume that based on the duration, the date and my MacBook Pro specs, I should be able to get a rough estimate on how much I had mined. Maybe someone can help me figure out, what the difficulty was back then, and based on the MacBook Pro specs, how much I could have mined.

Starting date: 25. November
Ending date: 22 December

Hardware: MacBook Pro (Mid 2012) - 2.5 GHz (3210M) Intel Core i5 Ivy Bridge -  Nvidia GeForce GT 650M with 512 MB

I had my MacBook on pretty much 24/7.

I am just looking for a rough estimate.

You can go to https://en.bitcoin.it/wiki/Non-specialized_hardware_comparison for a table of mining performance of many different CPUs and GPUs.  The GT650M is reported as doing 17.8 Mhash/s; let's round it up to 20.  There is a range of values for various Core i5 CPUs from 5 to 20 Mhash/s; let's be generous and call it 20 also.  So you were mining at a combined rate of say 40 Mhash/s; in scientific notation that's 4.0e7 hash per second.  You mined for 28 days which is 2.4e6 seconds, so you performed a total of 9.6e13 hashes.

Next we need to know the mining difficulty around that time.  There is a chart at Blockchain.info.  It was increasing rapidly during that time but in early December it was around 707,000,000, or 7.1e8.  Each 1 unit of difficulty corresponds to 2^32 = 4.3e9 hashes needed to mine one block.  So at that time, it took about 3.0e18 hashes to mine one block.

As such, you would expect to have mined 9.6e13 / 3.0e18 = 3.2e-5 blocks.  The block reward at that time was 25 BTC per block (see https://en.bitcoin.it/wiki/Controlled_supply) and so you would have earned, on average,  BTC 8e-4, or in other words BTC 0.0008.

At today's exchange rate of USD 6149 per bitcoin, that is worth just under USD 5.00.

This is of course an average, or expected value.  If you were mining for a pool, this may or may not have been enough to actually earn a payout.  If you were solo mining, you would have had to mine a full block worth BTC 25; the probability that you did so is about 3.2e-5.


Are there any Web Crawlers for Bitcoin addresses? In an effort to "track the chain" I wonder if there are any Bitcoin web crawlers that specifically look for Bitcoin addresses.

Following on to that question, are there any groups/volunteers/ people using that information to compile a dossier on who has what address?

Well Google, or any other search-engine, already crawls the Web for you. Probably just Googling an address will lead you to the Website where its owner published it, and it'll allow you to find other relevant information related to that address. This of course assuming the publisher of the website actually owns that address.

The only real way to prove that someone owns an address is for them to actually sign a transaction using that address - in other words: they can prove to you they own an address by making a payment of a specific amount using that address.


Bitcoin-QT Windows Safety Concerns According to https://www.file.net/process/bitcoin-qt.exe.html

"The application uses ports to connect to or from a LAN or the Internet. Bitcoin-qt.exe is able to connect to the Internet, record keyboard and mouse inputs and monitor applications. Therefore the technical security rating is 31% dangerous."

It is my understanding that when port 8333 is enabled the node shares its blockchain data with other nodes through the network, however this is not a requirement to run Bitcoin Core and is not enabled by default. Is there any other ports used or possible vulnerabilities when a node is not configured to transmit outbound information through port 8333?

Also curious if anyone can elaborate on these safety concerns particularly relating to "record[ing] keyboard and mouse inputs and monitor[ing] applications"?

Thank you

It is my understanding that when port 8333 is enabled the node shares its blockchain data with other nodes through the network, however this is not a requirement to run Bitcoin Core and is not enabled by default.

Your understanding is incorrect. Bitcoin Core is an application that requires network access to work. Outbound connections are always possible and do not require port 8333 to be open or available. Port 8333 is only required to be available and open to the internet if you want to receive incoming connections. Listening on port 8333 is on by default, but you typically need to configure your firewall(s) to allow incoming connections to port 8333.

  Also curious if anyone can elaborate on these safety concerns particularly relating to "record[ing] keyboard and mouse inputs and monitor[ing] applications"?

Bitcoin Core has keyboard and mouse input in order for people to actually be able to use it, therefore it has to be able to "record keyboard and mouse inputs".

I don't know what they mean by "monitor applications". That's a pretty vague description and could mean a lot of things.


Bitcore-p2p: Peer.connect does not work I'm trying to run a simple script to connect to a Bitcoin peer, like this one:

var bitcore = require('bitcore-lib')
var p2p = require('bitcore-p2p')
var Peer = p2p.Peer;

var peer = new Peer({host: 'localhost', port: 18333, network: Networks.testnet})
peer.on('connect', function () { console.log('connect'); })
peer.on('ready', function(){  console.log('ready'); });
peer.on('disconnect', function() {  console.log('connection closed'); });
peer.connect()

However, the connection seems to never be established.
I only get the 'connect' and the 'connection closed' output, but not 'connected'.
The port I set is the one in the Bitcore config file.

Can someone please help me figure out what is the problem?

I'm not sure what exactly you are trying to do with:

peer.on('connected', function(){  console.log('connected'); });

You can just do on ready instead.

peer.on('ready', function(){  console.log('connected'); });

Example connecting to a peer and receiving notifications

var bitcore = require('bitcore-lib');
var Peer = require('bitcore-p2p').Peer;

var peer = new Peer({host: "101.201.31.79"});
//IP of one of the btc.com's miners

peer.on('ready', function(){
    console.log("Connected "+peer.version, peer.subversion, peer.bestHeight);
});
peer.on('disconnect', function(){
    console.log("disconnected");
});
//loop through peer notifications
peer.on('inv', function(message){
    var nodeMsg = message.inventory;
    var nodeMsgLen = nodeMsg.length;
    for (var i = 0; i < nodeMsgLen; i++){
        console.log(nodeMsg[i].hash);
    };
});
//connect
peer.connect();


With the right technology, could the entire blockchain be rewritten? Imagine that someone had access to an alien super computer such that they could mine any block in nanoseconds. At that point, could that person create a chain with the same BTC genesis block, generate any/all the blocks and transactions they want, to the point where this new chain had a greater cumulative difficulty than the current chain? And if that person did this, would the network accept this chain, thus erasing the past 10+ years of BTC?
I realize the computational power to do this is theoretical, like this question. However, I still wonder what, if any, safe guards are in place to prevent something like this?

In theory yes but the alien super computer would have to have hash power at an incredibly large multiple of the hash power pointed towards the Bitcoin blockchain today. According to blockchain.com today's network hash rate is around 130 million terahashes per second. If the alien super computer had more than this it could likely produce the next block with greater than 50 percent chance. However, to generate a new chain from genesis (over 10 years ago) it would need to create 10 years of blocks rather than just one. There are checkpoints in Bitcoin Core at historical intervals for when you are doing an initial block download but my understanding of these is that they don't overrule a new chain with a heavier accumulated proof of work even if it goes all the way back to genesis.


Issue with getrawtransaction txindex and reindex I am running Bitcoin Core Deamon version v0.16.0.0 on Ubuntu and need to call the getrawtransaction command for some TX.

To use the getrawtransaction I need to run bitcoin core with txindex=1.
But if I am running with txindex=1 it says that I have to run the core with reindex or reindex-chainstate.

So I did run first
bitcoind -reindex-chainstate
and then
bitcoind -txindex=1 and it still says that I have to run with reindex or reindex-chainstate.
So I tried to run
bitcoind -txindex=1 -reindex-chainstate  but still says run it with reindex or reindex-chainstate.
Now I am running bitcoind -txindex=1 -reindex

Is this the correct way? And is it normal that bitcoin-cli getblockcountis stuck on 0?

txindex=1 has to be added in the bitcoin.conf file.

When starting the node, the following command should be issued

bitcoind -reindex=1 -daemon

You can keep checking the debug.log file in the .bitcoin folder to see the progress of blockchain synchronisation

Until you have downloaded the entire blockchain and reindexed, getblockcount will keep returning 0.


Is there a service that can track how a coin flows from one wallet to another visually? I sent some coins to an address and would like to track how these coins are flowing into other wallets. Is there a service that shows this visually? My main point is that I want to know if these coins were sent to a flagged or known  address at some endpoint.

Currently blockchain.info i can only see 1 address at a time. It would be great if there was a graphical tool that shows how the coins get dispersed and spent.

I'm curious as I sent some coins from coinbase to an address and I don't want to get my coinbase account banned if someone else down the line is using it to buy stuff on the dark market.

I think you're looking for something like https://www.bitcointracker.co


How proof of work works in Blockchain? Sorry, if the question may seem trivial but it is bothering me for a while now. I understood how the proof of concept works when one tries to change an old block. But how that will work for the case of the latest block?

For example, say I am an attacker who continuously mines blocks. Every time when I get a request for a new block, I will add a fraudulent transaction to it even before trying to find the hash. And I do that every time I get a request for a new block. If I was not able to successfully find a new block before someone it's okay, I will just discard my current work on the fraudulent block, will accept the honest block and again will repeat the same with the new block.

After a while, I ought to be lucky and my fraudulent block will be the first one that is published into the network. When that happens my block will be part of the honest chain and there will be no way to find out about this.

How Blockchain prevents this kind of attack?

You would be wasting your energy, because the network will simply ignore your blocks.

The rule in Bitcoin is that the best(*) valid chain is to be accepted by nodes in the network. If you add a block that contains an invalid transaction, nodes will discard your block (and any potential successors built on top of that block, even if those contain only valid transactions).

(*) best is defined as maximal sum of difficulties across all blocks in the chain. In case of ties, the first-received tip is used to pick a winner.


How to verify that the recipient received a payment? I sent a Bitcoin payment using Circle Pay. According to my Circle Pay the transaction is completed. It's been two days and the person on the other end is claiming they have not received the money. How can I check to see if he is telling the truth. From what I read, all transactions are public, correct?

Just check the address of the recipient on a blockchain explorer (e.g. https://blockexplorer.com/). If the address shows your payment as confirmed, it must have arrived.

It may show, but still be marked as unconfirmed which would explain why the recipient states that they haven't received it yet.


I sent bitcoin and put low tx fee (4sat/b). Unconfirmed for 3 days. Can it be forever? I just want to withdraw bitcoin and put a low fee.
It's been 3 days and nothing happened with it - Unconfirmed.
So, can it be forever? Or how much time it may take to be confirmed? Or what should I do to make it faster?
I used a simple web blockchain wallet.
I've read about CPFP but I don't know how to find a private key in the blockchain wallet.
My tx: 347c25f1fb17fa0375f02268733910fe1ba1a94f28a61089fca754774c8cb0da

Fee rate used for the transaction: 4sat/vbyte and unconfirmed since 2 days 10 hours. Weird that I couldn't find the transaction using https://blockstream.info and had to use https://btc.bitaps.com

No it won't be unconfirmed forever

It should be confirmed in next couple of days looking at the mempool but you can't be sure. If enough users are willing to use a fee rate higher than 4 sat/vbyte, your transaction will not be prioritized by miners.

If you own one of the below addresses, you can try to spend unconfirmed transaction output and send BTC to one of your other address with a fee rate higher than others for a quick confirmation. Check https://mempool.observer to see fee rate of other unconfirmed transactions. This is called CPFP. Child transaction paying for parent transaction.

3GQdDSwSU5gJst9fvTH9fXz51aqUV3cb5W
1DdjvgaKTgpPXEQj5uhLxrkJqSEz2tk61Z

Use Electrum wallet: https://electrum.org/#download


Need to find bitcoin wallet circa 2015 During this bitcoin boom I remember going to a bitcoin event and the host had me open a wallet and used an ATM to deposit $1 in it.
I dug through my old photos and I took a screenshot of my passphrase but no other information. I'm attaching a photo of what the screen looked like (without the phrase of course). Anyone have any idea which wallet/app/etc... this could be from?!?!?

If this is 12 words, you can download Electrum that is a Bitcoin wallet and import this SEED. Go to the website and download and install the wallet on your computer.
Then you will create a new wallet using this SEED, basically, these are the steps to do this:
1 - Go to create new wallet and give any name to this wallet.
2 - Go with the option to standard wallet.
3 - Go with I already have a SEED.
4 - Click on options and check BIP39 SEED and enter with your SEED.
If there is any Bitcoin in this SEED, you will probably see them. You can also try to just paste the SEED without check the option Bip39 in step 4 to see if the SEED will be recognized.