How to push through transaction that has been pending for 2 weeks using Blockchain.info? I'm using blockchain.info and was trying to send some bitcoin to Binance. It's been 2 weeks and it is still pending because I put too low of a fee. I'm wondering what method I can use to push this through and how to do it using blockchain.info Thanks!

Normally, I would refer you to:
Q: Why is my transaction not getting confirmed and what can I do about it?

But I'm going to make it simple for you.

You basically got two options:

1. Wait it out.
Easiest solution. Wait until the transaction gets picked up or dropped.

2. Ask miners for help
Some mining pools and miners offer services to allow you to prioritize your transaction in their mempool so that it is chosen sooner for inclusion in a block. One such service is https://pool.viabtc.com/tools/txaccelerator/. Also you can find others here.

Some members on Bitcointalk.org offer free transaction accelerator services, some of them have access to several pools. If urgent, you may consider the paid services(Beware of the scammy ones though).

3. Rebroadcast
You can try to manually broadcast the transaction, but this probably won't help you at all because your fee is low.

4. Replace by Fee (RBF)
Won't work with blockchain.info.

5. Child Pays for Parent (CPFP)
Won't work with Binance.


Can I generate passive income on BitCoin Sorry if this sounds like a basic question, but I struggle to see how Bit Coin works as an investment because, unlike standard currency there is no way get interested on stored bit coins. For example, say you have $10,000 in a set period of (depending on what your banks interest rate is) you could see your money become 11K, 15K or even double. Now lets say (hypothetically of course) one has 100 bit coins. Its unlikely that they will become 101 in the coming future right?? So how does one generate any form of passive income?

If you buy 100 bitcoins for $10,000 ($100 per coin), indeed you will always have 100 coins, you will never end up with 101. But if the price increases to $15,000 for your 100 bitcoins, you could sell 33.333 of them for $5,000 fiat profit, and still you would have $10,000 worth of BTC just like you bought at the start - a profit of $5,000.

You can increase the number of bitcoins for free if the price then drops after you sold some, lets say the price goes back down to $100 per coin after you sold the 33.333 coins ($5,000 at the time of sale), then you could purchase back 50 coins at the new price, leaving you with a total of 116.667 BTC


is transaction malleability a threat to my local wallet? I have a local Bitcoin-QT wallet. Can transaction malleability be used to steal my horde of tens of thousands of Satoshis?

No. It can not under any circumstances be used to steal funds from a Bitcoin-QT wallet.


Permission problem installing bitcore I have tried to install bitcore.io on a clean and upgraded Ubuntu 16.04.3 (64 bits) but always get permission errors.

I have already created a user and password for bitcore:

sudo useradd -r -m bitcore
sudo usermod -aG sudo,adm bitcore
sudo passwd bitcore

Installed nodejs v8.9.3 and ZeroMQ:

apt-get install libzmq3-dev build-essential

But when install bitcore:

npm install -g bitcore

I got this error message after download bitcoin-0.12.1-linux64.tar.gz:

bitcoin-0.12.1/lib/libbitcoinconsensus.so.0.0.0
npm ERR! path ../lib/node_modules/bitcore/bin/bitcore
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/bitcore/bin/bitcore' -> '/usr/bin/bitcore'
npm ERR!  { Error: EACCES: permission denied, symlink '../lib/node_modules/bitcore/bin/bitcore' -> '/usr/bin/bitcore'
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied, symlink '../lib/node_modules/bitcore/bin/bitcore' -> '/usr/bin/bitcore'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'symlink',
npm ERR!      path: '../lib/node_modules/bitcore/bin/bitcore',
npm ERR!      dest: '/usr/bin/bitcore' },
npm ERR!   stack: 'Error: EACCES: permission denied, symlink \'../lib/node_modules/bitcore/bin/bitcore\' -> \'/usr/bin/bitcore\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/bitcore/bin/bitcore',
npm ERR!   dest: '/usr/bin/bitcore' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

Also, I have ran the previous command with sudo but the error is the same.

Also, I have ran npm install bitcore and it is installed without problem but cannot run bitcored. System returns bitcored: command not found.

I solved this problem using NodeJS v4. I did a clean install again and ran these commands:

NOTE: My user is 'test' so my home is located at /home/test. Replace 'test' with your current user.

Install NVM:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh |  bash

After that, close and reopen your terminal and test whether NVM was correctly installed:

$ nvm --version

Install NodeJS v4:

$ nvm install v4

Check whether NodeJS was correctly instaled:

$ node -v

Install ZeroMQ and Tools:

$ sudo apt-get install -y libzmq3-dev build-essential

Install Bitcore. Today (December 2017), the lastest version is 4.1.1. This version uses two different versions of bitcore-lib and cause a conflict when you run bitcored. So, install bitcore v4.1.0:

$ npm install -g bitcore@4.1.0

Done!!

With these steps, I could use bitcore however they doesn't solve my original problem which is, install bitcore using NodeJS v8.9.3.


Can we do Multisignature transaction for bitcoin_cash? I tried implementing multi-signature for bitcoin and it worked successfully. Is it possible to implement multi-signature transactions for Bitcoin_Cash?

Yes, Bitcoin Cash supports exactly the same script opcodes as Bitcoin (as of this writing), so multisig transactions can be created and spent in exactly the same way.


How can I forecast the date Bitcoin will hit a certain blockheight? How can I forecast the date Bitcoin will hit a certain blockheight?

Are estimates for future halving and other important blockheights just based on the current height plus 1 for each 10 minute period between not and that date/time?

Are there any better formulas that also that take into account difficulty changes just after block halving or release of a new powerwide ASICs mining chips?

Take the difference (in days) between the current date and the date you are trying to estimate the block height for.

Then multiple that difference by 24 hours and by 6 (6 blocks per hour)

Current block height + (difference in days) (144) = new estimated block height

Difficulty changes upon release of new ASICs or halving are temporary (average block time will eventually revert to 10 minutes) and hard to predict. Therefore they cannot be accurately modeled in any equation.


Where can I read more about the fields of the transaction returned by listtransactions API I am looking at the results returned by listtransactions API and I do not understand the difference between blocktime, time and timereceived. Help tells me the following:

"blocktime": xxx,         (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
"time": xxx,              (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
"timereceived": xxx,      (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available for 'send' and
'receive' category of transactions.

Can anyone explain these fields in a little bit more details?

The Bitcoin developer reference has a section on the listtransactions call:

The blocktime is the timestamp of the block that confirmed this transaction on your local best blockchain. It is not returned for unconfirmed transactions.

The time field tracks the time that your wallet started tracking this transaction.

The timereceived field tracks the time that your node learned about the transaction, or alternatively the time of the block that included this transaction.


How to get block height, if I have only block header? Imagine I executed ReadBlockFromDisk and now I have valid instance of CBlock.

How do I read height of this block?

CBlock block = ...;
CBlockIndex index(block);
assert (index.nHeight != 0); // fails, nHeight is default initialized

It looks like this function from validation.h does the job:

CBlockIndex* LookupBlockIndex(const uint256& hash)


Can two signed transactions be merged into one? I'm in a situation where I have a presigned transaction, which, due to a bug in software that generated it, has a fee lower than minimal relay fee. I have that transaction's hex, but it can't be broadcast in a way that'd get it mined, so that's no use. Thus, the question: is it possible to merge it with another transaction which I could arbitary create and sign with my wallet, so that that transaction would unlock enough bitcoin to cover the fee for the resulting transaction? If so, how could I do this?

Potentially. It depends on how the transaction was signed.

If it was signed with a SIGHASH_ALL flag, you cannot combine it since the signature checks to make sure the inputs and outputs have not been changed.

If it was signed with an ANYONE_CAN_PAY flag, you can add additional inputs, and potentially more outputs depending on the rest of the signature.

All consumer wallets I'm aware of default to SIGHASH_ALL, so you're likely out of luck.

Your best bet would be to either send more BTC to that address and sign a new tx, or to import your private key into another wallet with more BTC, and create a tx spending from more than one address.


Now that my GPU mining rig will be made obsolete, where to turn? With the return from GPU mining likely to be affected by ASICs, where can miners turn their machines? Should I become a pro gamer? Join a rendering farm for cash (do they exist?) and let Disney use my rig to make toystory 4? Donate it to SETI@HOME or FOLDING@HOME? Donate it to an Anonymous botnet? Join a spamming farm used to bombard Bitcoin dev's with requests to switch double-SHA256 for double-MD5 in the code?

In short, what serious alternatives are their for profit or just putting to good use mining rigs?

Vanity mining for example over at my Vanity Pool. Thanks to split-key vanity addresses anyone can request a vanity address without compromising their security, set their own bounty, and anyone with a mining GPU can try solving the work and claiming the bounty.


Bitcoin - Level DB - Block Index - Parsing value for block hash I am trying to read the value against block hash in level DB of Bitcoin node database - Block/index. For Genesis block, I get 88 bytes which I want to parse. I tried to follow instructions in https://bitcoin.stackexchange.com/questions/67515/format-of-a-block-keys-contents-in-bitcoinds-leveldb but wasnt able to do that successfully as the first 4 bytes should be version but I get an invalid version.
I tried obfuscating the whole value as well but still the first 4 bytes does not give me a valid version. I must be doing something wrong but not able to identify that.
Value I get (in hex string)
8be750000b0100080100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c

Additional resource I tried - Link
Note: I am using c# to read and parse the data.

Found the logic for parsing the block index here


I use sendmany to make bitcoin payments this my php code.
but the result returned is false!
How can i do it?

I want to pay more bitcoin at a time.

I believe that you don't need to encode the array.
The library you are using should take care of this for you - at least the EasyBitcoin library does.

Let us know


Any way to track a Bitcoin scammer? I have been scammed by a Bitcoin scammer imposing by the name Andrew Hamish. I have reported every possible way but wanted to ask if anyone knows how we can track the IP address by their walled ID or other means.
He is using this tel: +447441393273
and this walled ID: 3Ncudh6CejAT9C56oX2NkcbQ4uJxXuZtmf

Welcome to BSE. Sorry to hear this happened. I know of no way to reliably get an IP address associated with a wallet. Your best bet is the phone number.

That's a UK phone number. I'm not aware of your laws and cannot suggest a course of action.

If you're in the US, then you could start with consulting a lawyer.

As a default response, inform the authorities or consult a lawyer before informing the authorities. If the amount is large enough and you're in the US, they might be willing/able to do something. The authorities won't step in to try and track this guy for 100 USD of BTC. 100 million USD and you may be able to find someone willing to take an interest.

If there is enough value there, outside of official channels, there are private investigation firms / lawyers who may be willing to work on contingency. The fact that you have a name and phone number is a good thing. Not sure if they're real or not.

My point is, from a technical perspective you've hit a dead end. That wallet has only transacted 1.8 BTC:

https://longhorn.bullpay.com/?gateway=2&data=3Ncudh6CejAT9C56oX2NkcbQ4uJxXuZtmf

If the name/number are real then it would be much easier tracking and taking legal action against the person.


Transactions with multiple origins? See this transaction.

How can a transaction have multiple origins? Surely one transaction comes from one address?

Transactions can 'claim' from multiple addresses. In fact, the default client will do it if your balance is spread out amongst multiple addresses when you want to make a transaction.


Why is bitcoin-qt startup so slow compared to MultiBit Bitcoin-QT: Very long startup and at first launch needs to download the entire blockchain

Multibit: Starts up in a few seconds and downloads for only a few seconds

Why is Bitcoin-QT so slow?

Bitcoin-QT is slower than Multibit because Bitcoin-QT is a thick client(it downloads the entire blockchain,) whereas Multibit is a thin client(it does not download the full blockchain.)


How i can extract all bitcoin output addresses from tx message? I want to extract output addresses from tx messages in any bitcoin pcap.

currently, i extract tx messages which it's output script starts with "0x76" or "0xA9", but i don't know how can i extract the other types of op_codes which is introduced here:

https://en.bitcoin.it/wiki/Script

Most of the output addresses follow one of the following 'standard outputs':

Legacy Outputs

P2PK: scriptPubKey: <public_key> OP_CHECKSIG. Output pays the public key directly and hence does not have a direct address.
P2PKH: scriptPubKey: OP_DUP OP_HASH160 <hash160 of pubkey> OP_EQUALVERIFY OP_CHECKSIG. For this kind of output you just need to base58check the hash160 of pubkey with version 0x00 and you will get the addresses that starts with 1.
P2SH: scriptPubKey: OP_HASH160 <redeem_script> OP_EQUAL. You again need to just base58check the redeem_script with version 0x05 and you will get an address starting with 3.
Multisig: scriptPubKey: M <public_key1>...<public_keyN> N OP_CHECKMULTISIG. In this case, you cannot get the addresses as the output pays the public keys directly.

Segwit Outputs

P2WPKH: scriptPubKey: <0x00 (version)> <hash160 of pubkey>. You will need to create a bech32 address using the version and 20-byte redeem script and you will get an address starting with bc1. You can find the python script for bech32 encoding here.
P2SH: scriptPubKey <version: 0x00> <sha256 of redeem_script>. Again a bech32 address starting bc1 but the redeem_script is 32 bytes rather than 20 bytes for P2WPKH.
P2SH(P2WPKH): scriptPubKey: OP_HASH160 <redeem_script > OP_EQUAL. The encoding is same as legacy P2SH. Base58check with 0x05 version. For a more detailed overview on how the 'redeem_script` and addresses are generated for P2SH(P2WPKH) see my other answer here.

OP_RETURN

Many times people like to encode some data in the Bitcoin blockchain. For that, you use a OP_RETURN opcode. The scriptPubKey:<OP_RETURN><OP_PUSHDATA1><bytes to push><script>.


How to broadcast a Bitcoin Gold transaction I'd like to broadcast a signed BTG transaction - In Bitcoin it's very easy to do with tools like coinb.in. Is there a public RPC/API endpoint similar to the following examples where you can broadcast a signed transaction:

coinb.in
chain.so
block.io

Bitcoin Gold is a fork of Bitcoin. You can just start up a Bitcoin Gold node and broadcast transactions using sendrawtransaction. Another option is to use an insight-api.

https://btgexplorer.com/ is a fork of the famous insight block explorer. You can use their API to broadcast your raw transaction using these docs:
https://github.com/bitpay/insight-api#transaction-broadcasting

Send a POST request to https://btgexplorer.com/api/tx/send with rawtx as a parameter.


Bitpay Without Credit Card I am having trouble finding this information so I would like to ask those who use BitPay:

Can you create a BitPay account and spend coins without having a Credit/Debit Card associated with your account?
Tying into the first question can you use Bitpay without tying any personal information to your Bitpay account?

Some stores only accept bitcoin via Bitpay but I don't want to create a Bitpay account if it removes my anonymity.

BitPay just payment processor. As buyer in stores you need own only bitcoins in any wallet, exchange or other places. When you make payment to this store, you will need send btc from your wallet or an exchange

In your case BitPay probably help to the store make immediately exchange your btc into usd


CheckProofOfWork() Linux error on old altcoins I've seen the following error on Linnux online with several old altcoins now, the one below is UFO coin. It will sync exactly 500 blocks and then throw the following error, if I restart the client the error on that block does not reappear and it downloads a further 500 blocks and throws the exact same error.

I'v added a few extra lines to get some additional debugging info. Before I spent time crawling through code I was hoping that someone else may have come across this same error and found the reason. UFO is several years old and current Windows clients are running OpenSSL 1.0.1h, services running were probably compiled around the time of that SSL release. The server with this issue is running OpenSSL 1.0.2g.

CheckProofOfWork() bnTarget.getuint256=000000050e650000000000000000000000000000000000000000000000000000
SetBestChain: new best=f7c2f4f28e66399bc17e0e35498300c20bf384d210ce8c5d640b70d9a3dfe372  height=17000  work=68218691770398  date=01/23/14 03:00:50  tx=2 ProcessBlock: ACCEPTED
received block 93f88d57ab19ae388e22
CheckProofOfWork() hash=bf82aa6e76ec014faf5bc9c347eb5ba8242545acdf09259ac753b8d264aec0f0
CheckProofOfWork() nBits=486629382
CheckProofOfWork() bnTarget.getuint256=0000000160060000000000000000000000000000000000000000000000000000
ERROR: CheckProofOfWork() : hash doesn't match nBits
ERROR: CheckBlock() : proof of work failed
ERROR: ProcessBlock() : CheckBlock FAILED

Edit: Compiled it with OpenSSL 1.0.1u and have the error.

That error simply means that the block is invalid as the proof of work is incorrect. That has nothing to do with OpenSSL versions. The difficulty of a block is specified by the nBits field of the block header, and the block header must hash to a hash that is less than nBits. What is happening here is that the block hash is not less than the nBits, so the block is invalid.


How to import an extended public key into bitcoin core 0.16 I exported an xpub key from a HW wallet and want to import it into my own node to keep track of changes to the balance. My node is running satoshi 0.16.1

Can someone help me find the right syntax for bitcoin-cli, or make a statement about whether it is possible at all to import extended public keys?

Edit: @aantonop seems to state in this video (https://youtu.be/8mpDcBfNA7g) @ 16:55 that this is possible in bitcoin core though I may be getting it wrong and also he isn't omniscient.

It's not possible in bitcoin core right now. You can use electrum and import your xpub as a watch-only wallet.


How does my bitcoin node know that a node it connects to is running the same version of the protocol? As stated in the title. How do I know that when my node gets data from, or sends data to another node, that this other node is on the same version of the protocol? What prevents my node and their node from getting confused and communicating data between different versions of the network?

What different versions of the protocol/network? All protocol changes were backwards compatible, so there really is only one Bitcoin protocol. There are a few op_codes that old nodes don't interpret correctly, but they're fine with that.

Unless you're talking about altcoins and Bitcoin, they don't have the same seed nodes, so they wouldn't find each other. Even if they were, they'd ban each other for relaying invalid information.

This it's for example what happens if a  protocol is upgraded that is not backwards compatible. Old nodes see that information from new nodes doesn't adhere to the rules and stop talking to them.


How many computers are connected to the "Ledger" or the Blockchain of Bitcoin? Somebody asked me about Bitcoin and I explained to him many many computers are connected to the Blockchain to keep records of all the accounts (or to keep addresses of the bitcoin and owner?). But how many computers are connected to it, as of recently or 2020?

Somebody asked me about Bitcoin and I explained to him many many computers are connected to the Blockchain to keep records of all the accounts (or to keep addresses of the bitcoin and owner?).

The blockchain is the data structure they collectively maintain. It is not an "entity" that can be connected to. The nodes are just connected to each other, and tell each other about updates they learn about.
It's hard to count how many nodes there actually are. There are sites like https://bitnodes.io that keep track of reachable nodes. However, there are many nodes on the network that only connect out to others but can't be connected to; probably in the 100000s.
A further complication is that not all of these nodes are equally relevant. It's easy to spin up a few hundred nodes on AWS, that nobody uses for anything, but do make it look like there are lots of independent users. Worse, there are also a lot of spy nodes on the network that don't do any work, except trying to monitor which nodes are the origin of particular transactions.
In the end, if you run a node yourself, it doesn't matter. It validates everything the network tells it, so if you do that, the part that matters is: 1 node, your own.


Why does the Bitcoin core client use so much CPU time while synching? I have always noticed the huge increase in cpu usage when I opened my client for the first time in a few days. I was wonder what this is from? I would imagine verifying all of the signatures of the blocks?

Essentially doing the same calculation the miners seek to do and just checking their answers?

I would imagine verifying all of the signatures of the blocks?

You are verifying every single script, every single signature for continuity. You are making sure nobody is spending coins they're not allowed to. You're making sure all the rules are followed.

  Essentially doing the same calculation the miners seek to do and just checking their answers?

Yes, in addition to the above. You are verifying every block has a valid Proof Of Work. This takes two SHA256 operations though, versus the billions of billions a miner needs to do.


Turn off fee destruction in PPCoin In the sourcecode of PPCoin/SRC/MAIN.CPP line 1433 I read: fees are destroyed to compensate the entire network.

I want to turn it off that fees are destroyed, if I change this code will it work?

// ppcoin: fees are not collected by miners as in bitcoin
// ppcoin: fees are destroyed to compensate the entire network
if (fDebug && GetBoolArg("-printcreation"))
    printf("ConnectBlock() : destroy=%s nFees=%"PRI64d"\n", FormatMoney(nFees).c_str(), nFees);

If I change destroy=%s to destroy=%$$$, will it stop destroying fees?

No. That's a printf statement, so you will only prevent the printing, not the actual destruction.


Sweep transaction issue I have old (pre-random-number-bug) addresses in my android bitcoin wallet app, with 0 balance. After patch I am using a new address (with balance) and still keeping my old address in my wallet. Should I delete my old addresses from my android app?

Let's say some one cracked my old key, and imported it into his wallet. In this case, is it anyway possible for him to do a sweep transaction? I remember, something like this happened with blockchain.info / mywallet app but I am not very sure.

https://en.bitcoin.it/wiki/Sweepprivkey_proposal

You should be fine as long as you avoid sending coins specifically to that address, but I would delete it just to be safe. The app that I use doesn't let me delete addresses directly, so I just re-installed it.


Is it normal to not "own" your bitcoins? Are 6% transaction fees normal? I downloaded an app on my phone that lets me exchange bitcoins for the local currency. Next, I downloaded the Electrum wallet on my computer and set up a bitcoin account on it too. Now, I bought some bitcoins (for fiat money) from the app. I transferred all the money from the bitcoin account on the app to the bitcoin account in Electrum.

Bitcoin account on app: 3BSRdfCnQ17NWkvxomUXzpfJg38Vif5GLo
Bitcoin account on Electrum: 1A8B5T3cjh4TFHBfagS5fexPz18LgWyUyJ

Now, when I view this transaction in the block explorer, it shows me that the bitcoins (0.040151 BTC) have been transferred from some other bitcoin account (and not from the 3BSRdfC account) to my Electrum account. Does this mean that the bitcoin I bought was actually in the app company's account and not in the account they created for me? Is this normal? Ethical?

Next, to send bitcoins to another bitcoin address, the app providers charge "Bitcoin network fees" which can be as high as 6%. Are these rates reasonable? I thought that, with bitcoin, we were supposed to have "lower transaction fees". 6% is exorbitantly high, I think.

There are both custodial and non-custodial online services as well as apps. If it's important to you to control your own funds, you should research the account model your service provider uses and avoid services that manage your funds for you.

Bitcoin transactions are not paid respective to the amount that is being transferred, but rather in regards to the blockchain space that you purchase in order to have your transaction confirmed. Transaction fees have been much higher in the past months than previously, as the supply is capped and demand has been increasing. Personally, I'm hoping that a protocol upgrade by the name of Segregated Witness will be activated soon, as this will increase the blockspace as well as provide access to a payment layer that I expect to work as a valve to curb demand.

For you personally this means that fees are more or less the same size for whatever amount of money you transfer. If you make large payments, the fees will be minuscule, if you make small payments, the fees will be a significant port of the transferred value. Naturally, this is making Bitcoin unattractive for smaller payments.


Bitcoin API - createmultisig - what is redeemScript? The Bitcoin API call of createmultisig returns two parameters - address and redeemScript. What is the latter used for?

To really understand this, you would need to read the protocol specs.  But I'll describe it briefly.

Each transaction contains a script.  In order to claim the bitcoins from a transaction (e.g.: you want to spend them in a new transaction) you have to provide whatever proof is described by the script.

Normally, the script is pretty much the same: the intended recipient has to provide a digital signature that proves they own the destination address.  But you can requires a lot of different kinds of proof: require more signatories, no proof at all, or require the claimant to solve a puzzle.


Why did the price of bitcoin increase so dramatically? I read this question on money.stackexchange, in which a user asks how to tax the speculation gain they (involuntarily) made. This guy (or girl) bought BTC for a few hundred USD a few years ago, lost the respective harddrive, and when they found it again, the BTC were (supposedly) worth a million or so USD.

So I am wondering, why did BTC appreciate so dramatically in other currencies? Is it just because of rising demand, in turn due to increasing trust in BTC?

As a corollary, could the BTC appreciation also be driven by a speculative bubble?

Sorry if this is a very noob question.

some reasons for the price-increase:

-bitcoin becomes an official currency in japan

-Australia Will Recognize Bitcoin as Money and Protect Bitcoin Businesses, No Taxes

-many people know/buy bitcon now, who did not know bitcoin some months ago (in many countries) caused by increasing media coverage

-bitcoin becomes an alternative currency in venezuela, Nigeria and some other countries caused by internal political problems

-the scaling problem seems not to be finally solved but the segwit-activation could improve the scaling-situation

-Russia’s Parliament is Discussing the Legalization of Bitcoin

-meanwhile the blockchain-technology is more established: there are no known hacks of the blockchain self


How big is the Bitcoin network? How big is the Bitcoin network in terms of total number of computers (peers, clients) that are connected together? Are there any network statistics or historical size data available?

My current real-time estimate using https://github.com/ayeowch/bitnodes is 8000 to 10000 nodes that are reachable at any one time with churn rate of 300 to 500 nodes every 5 minutes. The churn could be due to several factors, e.g.

Node went offline
Node reached max. allowed connections
Time of day, e.g. more nodes are online during US working hours
Network errors


Can a Ledger Nano X hold multiple BitCoin Wallets? From my reading of Ledger Nano X, it can hold multiple types of currency, for instance, BitCoin and Ethereum.

Can it hold two or more separate BitCoin wallets with different balances?

Frank

Yes, you can have multiple bitcoin wallets in ledger nano x by adding a new account
All these accounts share the same seed, but have different derivation path


Bitpay xPrivKey to private key Network: BCH testnet
Client: bitcoin-abc-0.18/bin/bitcoind and bitcoin-cli

I want to convert xPrivKey which is from exported Bitpay wallet file to private key for using bitcoin-cli importprivkey

Thank you.

xPrivKey is a BIP32 extended key. This can be used to derive child addresses.

importprivkey expects a WIF Wallet Import Format.

In order to convert to from the extended to compressed format, all you need to do is decode from Base58Check and grab the last 32 bytes (33 for public keys). See BIP32 - Extended Key Serialization and then encode to WIF format:

$ printf "xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7" | base58 -dc | xxd -p 0488ade4013442193e8000000047fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae623614100edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea

The last 64 characters (32 bytes) represent the hex version of the private key.

edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea

Then convert to WIF:

$ priv="edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea"
$ # 0x80 for mainnet, 0xef for testnet
$ pub_suffix=01 # append 01 if the corresponding public key is compressed
$ mainnet_prefix=80
$ ext_priv_mainnet=$mainnet_prefix$priv
$ wif_enc_mainnet_compressed=$(printf "$ext_priv_mainnet$pub_suffix" | xxd -r -p | base58 -c)
$ echo "WIF Mainnet (Compressed): "$wif_enc_mainnet_compressed

WIF Mainnet (Compressed): L5BmPijJjrKbiUfG4zbiFKNqkvuJ8usooJmzuD7Z8dkRoTThYnAT


What goes in the tx hash preimage when signing with 0x83 (SINGLE|ANYONECANPAY)? I have script to create a P2WPKH to P2WPKH transaction (1 input, 1 output) and sign it with the sighash type 0x01 SIGHASH_ALL.

Which fields would I need to change in the tx digest preimage to turn the signature into one with a sighash type of 0x83 (SINGLE|ANYONECANPAY)? I'm having trouble understanding the documentation in bip_143.

For reference, the tx digest preimage:

  Double SHA256 of the serialization of:
       1. nVersion of the transaction (4-byte little endian)
       2. hashPrevouts (32-byte hash)
       3. hashSequence (32-byte hash)
       4. outpoint (32-byte hash + 4-byte little endian)
       5. scriptCode of the input (serialized as scripts inside CTxOuts)
       6. value of the output spent by this input (8-byte little endian)
       7. nSequence of the input (4-byte little endian)
       8. hashOutputs (32-byte hash)
       9. nLocktime of the transaction (4-byte little endian)
      10. sighash type of the signature (4-byte little endian)

From BIP143:

  If the ANYONECANPAY flag is not set, hashPrevouts is the double SHA256
  of the serialization of all input outpoints;

  Otherwise, hashPrevouts is a uint256 of 0x0000......0000.

All the details you need are in the BIP


Does the bitcoin URI message parameter have character limits? Is there a limit to how many characters are allowed in the message parameter of a BIP21 URI? I tried searching on the subject, but found nothing about it.

There isn't a limit described by the BIP (https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki). In general, however, URIs might be encoded into QR codes, so their length should be kept as small as possible.

GET requests often have limits on the length of the encoded URLs, something like 2000 characters (https://stackoverflow.com/questions/266322/is-there-a-limit-to-the-length-of-a-get-request). This might be applicable depending on how you are using the URI.

As a guideline, however, I would say that messages in Bitcoin URIs should be fairly short. I'd probably try to stick to less than 200 characters.


Choosing between blocks with chain same work- why pick the first received? What if one block contains many more transactions than the other? Wouldn't it be better to pick the block with more transactions?
Also, why is a tie ultimately broken randomly, rather than a deterministic way that helps the network?

Consensus rule dictates that chain work is measured based on the production of a solution which satisfy the difficulty set by consensus. So as long as a produced block satisfy said rule, said produced block would be accepted.

It is technically infeasible to choose base on blocks with more transaction for a variety of reason. First, bitcoin lacks strong consistency (i.e. its impossible for nodes to share a consistent state for its mempools), if block acceptance requires that a block based on the highest number of transaction is accepted, then the blockchain will most likely be orphaned many times as miners compete to produce competing block tips and nodes would discard block tips literally each time a new block with more transactions is received. This results in more partitioning in the network, which leads to a poorer security as less work is focussed on any particular branch of the chain.


What is the fastest way to determine whether an address exists on the blockchain? All I want is to determine whether a given address has ANY activity on the blockchain.  I've seen projects like bitcoin-abe, which might work, but I wondered if there were a simpler way than using abe, or using a web service (I'll be querying too much for this option)?

Thoughts welcome and appreciated.

Using local blockchain.

If you are prepared to keep an up to date copy of the blockchain yourself (or if you already do) then I would expect it to be quicker to check locally yourself than to use a web service (which you seem to have decided for yourself already).

Using list of distinct addresses present on the blockchain.

If you are only looking for a True or False answer to the question "is this address present in the blockchain?" you could achieve faster responses by keeping an up to date list of distinct addresses rather than search the whole blockchain. Once the list is complete keeping it up to date only requires adding those addresses present in the latest block - a small task roughly every 10 minutes.

Using list of abbreviated addresses.

If your purpose permits a margin of error then you could improve speed further by using only the first n characters of the bitcoin address. Maintain an up to date list of distinct abbreviated length n addresses and abbreviate the candidate address to n characters before looking it up.

Even if you require very accurate results, using only half the characters in a bitcoin address will still give almost 100% accuracy, while giving a significant speed up.

Discounting most recent blocks.

If you don't need the most up to date information you could reduce the work required for keeping your abbreviated address list up to date. Only considering blocks more than m blocks deep will reduce the amount of redundant updates due to blocks that are later orphaned.

The improvements in speed described here will be irrelevant for most purposes unless you are processing a huge number of candidate addresses per second, but your question hints that you may be, for at least some of the time.


Bitcoin - not so democratic future? Bitcoin's goal is a decentralized democratic value system.

But miners and platforms are already consolidating into bigger more powerful entities.

What's to stop it?

I feel a crypto will only be truly democratic when the holders are also the miners, and the markets.

Bitcoin's goal is a decentralized democratic value system.

It absolutely is not. A democracy is a system where the majority of participants can decide for everyone.

In Bitcoin, nobody can decide for you. A Bitcoin node will verify all blocks and transactions that others produce. It does not at any point what other participants in the network think or do, if they don't agree with the rules you enforce, they simply don't exist from your point of view. In other words, in Bitcoin, your choice of participation is choosing the rules the system has. If you disagree with those rules, you are effectively on a chain fork - which is essentially its own currency.

There is one exception to this everyone-validates-everything model, and that is double spending. If someone produces two conflicting transactions (which spend the same money) and broadcasts them on the network, the system somehow has to make a determination about which of the two is to be accepted. There is no objective rule that everyone can enforce here. You can state that the first one is to win, but unfortunately due to the finite speed of light, it is impossible for geographically distributed entities to jointly come to the same conclusion about who was first. To solve this problem, miners are introduced. Their only power is cooperating to building up versions of history, resulting in the ability to decide the ordering and timing of otherwise valid transactions, up to and including the power to delay transactions indefinitely.

For miners, hashpower majority matters. But this is not a democracy (it is not one miner one vote, it is one hash one vote), and they do not set the network rules through it. All they can do is either cooperate, or disrupt. The system is designed so that disruption is less profitable than cooperation.

Now, your main concern stands. Centralization of power in mining is a dangerous trend, as it gives small groups of actors a large power to disrupt.


Does mtGOX allow for buying on one exchange and selling on another through their API? Can the mtGOX API be used to buy on one exchange and sell on another, if so, how? (An example api call/url etc would be great)?

The Mtgox API can be used to buy or sell on Mtgox. To buy or sell on another exchange you'll need the API of that other exchange.

More information about the Mtgox API can be found at https://en.bitcoin.it/wiki/MtGox/API.


generating a zprv from a base58 rootKey with bitcoinjs-lib var bitcoin = require('bitcoinjs-lib');
let bip32 = require('bip32');

let rootKey = 'xprv9s21ZrQH143K32CfqoCQHtbKiEb5BqFazXX6jCtNCnuty3gUjxS4CsXWi9rcNyHdjDVPiC6P1bnyEZr2ioouRq56h6HAdwejeTty1BsSEtL'
const node = bip32.fromBase58(rootKey, bitcoin.networks.bitcoin);

//legacy account extended private key
console.log("LEGACY: " + node.derivePath("m/44'/0'/0").toBase58())
//xprv9y7nL2k2diLdA9bmop94K8Pec2WdL998PLdvTraxj5jiQ36gnLmhVJG4bY8FzgqZPaBM5HDBi9sgRK1ZCi14n5j4Pk1o6d3j4Y6T9NS4nA6
(works as expected)

//segwit account extended private key
//trying to get a segwit extended private key (zprv) using the same inputs as above.

I want to get a segwit/bech32 extended private key using the same root key as above. How can I do this using bitcoinjs-lib? BIP84 only works for mnemonics IIRC.

Your xprv already has the derivation path "baked in" so even if you were to just convert to zprv it will still be under the old m44/ deriv path. Also you can't go from xprv to HD seed. So to change from an xprv to a zprv or yprv you need to start with the HD seed, then declare your derivePath("m84'/...","m49/'/... etc), then you can create an extended public key. Then you'll have to convert to yprv, zprv, ypub, etc...
Example uses bitcoinjs-lib v3.3.2
function seedToXpub(seed, deriv, account){
   var root = bitcoin.HDNode.fromSeedHex(seed);
   var acct = root.derivePath("m/"+deriv+"'/0'/"+account+"'");
   var xpub = acct.neutered().toBase58();
   return{
       xpub
   }
}

function seedToXprv(seed, deriv, account){
   var root = bitcoin.HDNode.fromSeedHex(seed);
   var acct = root.derivePath("m/"+deriv+"'/0'/"+account+"'");
   var xprv = acct.toBase58();
   return{
       xprv
   }
}

function convertXpub(xpub,target){
    //source script for converter https://github.com/jlopp/xpub-converter/blob/master/js/xpubConvert.js
    const prefixes = new Map(
  [
    ['xpub', '0488b21e'],
    ['ypub', '049d7cb2'],
    ['Ypub', '0295b43f'],
    ['zpub', '04b24746'],
    ['Zpub', '02aa7ed3'],
      ['xprv', '0488ade4'],
      ['yprv', '049d7878'],
      ['zprv', '04b2430c']
  ]
  );

  xpub = xpub.trim();

  try {
    var data = b58.decode(xpub);
    data = data.slice(4);
    data = Buffer.concat([Buffer.from(prefixes.get(target),'hex'), data]);
    return b58.encode(data);
  } catch (err) {
    return "Invalid extended public key! Please double check that you didn't accidentally paste extra data.";
  }
}

var mySeed = "114259550292e14ca462e5202875f987fa3c93300306417c8b62de591710e4b34340a9bcdf8241ebbe83cf3cdf428c2f32973c9db68e247ce623fd73b9bd1fb2";
var extPriv = seedToXprv(mySeed,84,0);
var zprv = convertXpub(extPriv,"zprv");

//zprvAcihK1ERNzUfX6zh3v8weMVw5s8Y2xkmjdEfeFF3v9X2jbDf9iJ4vS5t4Po6Jhwsjkzjz1TddTENc5dPVsVFyMZPzWz8Kskci6wkYSmuhup


utxo vs account-model There are two possible models, the UTXO model and the account model. Each has advantages and disadvantages. Bitcoin chose the UTXO model. XRP and Ethereum for example use an account model.

What are the advantages and disadvantages of each model?

The primary advantages of the UTXO model are simplicity of implementation and improved privacy.

With the UTXO model, transactions just consume some UTXOs and create some UTXOs. This tight constraint on what transactions can do makes transactions simpler and easier to execute in parallel.

The UTXO model also improves privacy by making it more difficult to associate transactions issued by the same party.

The primary advantages of the account model are improvements in transaction flexibility, account management, and multi-currency capabilities. A transaction in an account model can do much more than just consume and create UTXOs, it can modify persistent data associated with an account. This permits functions like order books and cross-currency payments.

Perhaps most importantly, it allows an account to be managed. For example, the XRP Ledger permits accounts to change their cryptographic credentials. You can have a publicly known receiving address and change the key needed to spend funds sent to that address without having to communicate a new address or move funds.

On a multi-currency system, accounts can specify assets that they're willing to accept as payment. So, for example, if I owe you US dollars, I can check your account settings to see what assets you accept for dollar payments. The enables the XRP Ledger's foreign asset system, enabling the largest decentralized exchange in the world.

Lastly, an account model makes it easier to bring new servers up. The number of accounts will generally be much less than the number of UTXOs in a comparably sized system. This means less data needed to bring on new nodes.


Want to learn Blockchain I am completely new to this technology ..i wanted to learn blockchain and starting with doublespending, POW, consensus,miners,mining everything i am not able to relate things and get clear with the exact concept...can anyone please help me out ?

Best resource is the book "Mastering Bitcoin" by Andreas Antonopoulos. You can find it online at https://bitcoinbook.info. You can download it for free on github. The book explains everything in a structured and easy-to-process way.


Hardware wallet without a hardware wallet I want to do some research in order to purchase a hardware wallet. Until I have decided what to do, I would like to transfer my bitcoin balance out of the exchange that I am currently using. I want to avoid multiple transfers, so what I would like to do it to transfer to an address which can be "imported" into my future hardware wallet. Here is my question:

How can I manage a software wallet which is compatible with any of the existing hardware wallets? Are hardware wallets following open standards to generate the bitcoin addresses, or are those proprietary? What standards are they following?

Create a seed outside a hardware wallet and then importing it in this latter doesn't make any sense. Hardware wallets have a strong security because the seed is generated by themselves and never revealed outside. I would recommend to wait for your hardware wallet and then generate and transfer your coins on it.

If you know the risk and still want to generate a wallet outside, then you can import it to hardware wallets thanks to the 24 words seed. Make sure your software implements BIP39.

These are the standards implemented by both Trezor and Ledger wallets:

BIP 16 : P2SH serialized script addresses
BIP 32 : hierarchical Deterministic Wallets
BIP 39 : seed mnemonic
BIP 44 : specific wallet structure


Transfer Bitcoins from Coinbase to an Offline Wallet Besides using the send bitcoins option, is there a way I can transfer my bitcoins from my online Coinbase account to an offline wallet? I mainly want to do this because I'd recently found out that Bitcoin is located in the US and can be seized by the Obama Regime at any time.

Edit: I guess what I'm trying to ask here is: is it possible to export an Online Wallet Private Key and import it on an Offline Wallet? If so, how?

Yes, coinbase allows you to create a paper wallet.

http://blog.coinbase.com/post/51573799308/use-coinbase-to-export-your-bitcoins-to-a-paper-wallet


sendtoaddress questions Does sendtoaddress automatically collect as many unspent outputs as needed?
Is there any way to specify the from address?
How is the fee computed? I just tested with two transactions:
a) 0.0001 xbt, fee 0.00017519
b) 0.001 xbt, fee 0.00017441.

1) Yes. See this question for more detail.

2) The from address will be an array of address that hold the unspent outputs. If you want to select which outputs are sent and from what address, you can use coin control in the QT wallet, or you can create a raw transaction using createrawtransaction, signrawtransaction, and sendrawtransaction.

3) Fee is computed by the number of bytes your transaction has, not necessarily the amount of the bitcoins you send. If you have a lot of small unspent outputs that go into your transaction it will make the transaction larger and thus a larger fee.

The code for the fee calculations

https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L53
https://github.com/bitcoin/bitcoin/blob/0.9/src/main.cpp#L811

As of right now it looks like the tx fee per 1,000 bytes is 10,000 satoshis (0.00010000) to create a transaction.


How do Open Source Blockchain companies Stay Competitive? I understand the importance of having secure code and your customers trusting your brand. What I do not understand is how do open source blockchain companies like Wallets stay competitive when their competitors can fork their code? Also, is this standard different for closed source exchanges because they do not show source code, however some of them are not regulated.

If I was not clear, I am confused about the whole concept of "Open Sourcing" everything and building a competitive business.

They can do this because the crypto market can support multiple companies

However, it does not happen many times anyway, due to the following reasons:

Just "forking" is not as easy as it sounds; you also need:
Infrastructure & dev-ops
Support
A legal entity
There might be a lack of skilled people, which get hired by the companies instead of starting their own projects
Response time: why would I use a fork, if the project it was forked from is the original one, with faster bugfixes?

In addition, some companies only open-source a limited portion of their code that does not let you run it, which is pointless, the way I see it.


Do AntMiners comply with FCC Part 15? Do AntMiners comply with Part 15 of the U.S. Federal Communication Commission's rules and regulations?

I tagged this question with "safety" because implicit in my question is what percentage of watts going into an AntMiner get converted to RF interference. If it's a lot, it could be a safety issue, especially since the cases of many AntMiners (e.g., S5s) are open and thus do not act as Faraday cages.

Yes. On their sales listing they note specifically that they have passed FCC and CE approval, and their products bear the markings for this accordingly.


What is the size limit in namecoin transaction? This is quite a basic question.

Namecoin allows any arbitrary text as data:value pairs. How big can the data be? 100 bytes? 1 MB? I am not sure.

520 bytes for name_update to work

http://dot-bit.org/forum/viewtopic.php?f=2&t=503

It should be twice that amount but there is some bug.

As you can read in the forum thread some planning is going on to increase it to 9kb.


Does segregated witness allow to securely create LN channel opening transactions? In Rusty Russell's paper about the simplified version of the Lightning Network, some problems about the practical implementation of the opening channel method from the original LN paper are mentioned:

  The anchor transation id required for the commitment input will only be known once the anchor is signed.
  The anchor transation can be malleated by either party before entering the blockchain, rendering the commitment input unusable.

The paper mentions mentions how problem 2 is not solved by BIP62, but does not talk about segregated witness. Are these two problems effectively solved with segregated witness?

Are these two problems effectively solved with segregated witness?

One is; one is not.  Specifically:

  (1) The anchor transation id required for the commitment input will only be known once the anchor is signed.

Segwit fixes this.  If the anchor transaction contains only segwit inputs, then its transaction identify (txid) does not change when signatures are added.  This allows other transactions (such as the Lightning commitment transaction) to refer to its outputs regardless of whether or not it has been signed.

  (2) The anchor transaction can be malleated by either party before entering the blockchain, rendering the commitment input unusable.

Segwit does not fix this specific problem, but it does fix an important related problem.  As the paper you cite says, "The last of these is particularly pernicious, as BIP62 doesn't solve it: signatories can always re-sign a transaction, hence altering its transaction ID."

The anchor transaction is created with inputs each user unilaterally controls (or shares control with a third-party to the Lightning channel currently being opened, an irrelevant detail to this discussion).  Because of this, each user has the ability to create a full double spend of their part of the anchor transaction; if that double spend is what's included in the block chain, then any children of earlier versions of the transaction (such as the commitment transactions) are invalid.

The important related problem segwit does solve is useful to Lightning and required by other smart contract protocols.  A payment in a payment channel (including Lightning) uses multisig to require both parties sign the payment under regular circumstances, called 2-of-2 multisig. Because signatures sign all of the non-signature data in a transaction (normal SIGHASH_ALL) but are currently included when generating the txid, either party can unilaterally malleate a transaction by changing his signature.

But with segwit, all non-signature data in a transaction is still signed but the signatures are not covered by the txid, so neither party can unilaterally change the txid without invaliding the other party's (or parties) signature or signatures.  In other words, it requires both 2-of-2 to change a txid or, more generically for m-of-n, segwit requires at least m participants to change the txid.

This simplifies the design of Lightning-style Hashed TimeLock Contracts (HTLCs) and also improves the privacy of outsourcing channel enforcement, but is not required for Lightning.  However, it is required for some other smart contract protocols that use sequences of transactions.  For example, a Spillman-style payment channel would be secure using segwit but today it is vulnerable to malleability.


state of 'atomic cross-chain trading' in 2016 Much of the information I've come across is a bit dated, 2 years or so.

For instance, this other question, this thread on the forum.

It seems like Interledger is trying to implement, more or less, the described protocol of ATXC, is that right?

Other than that are there any actionable implementations around?

Interledger's protocol is not atomic swaps. Their model is not entirely trustless either.
There are actionable implementations like MercuryEx but not used because:
a. transaction malleability fix is required
b. discovery problems in a decentralized system


Does the future SIGHASH_ANYPREVOUT capability hurt the privacy of Taproot lightning channels? One of the advantages I've heard about Taproot is that all transactions will appear identical to a blockchain observer. This would of course also be true for lightning channel open/close transactions as well which would be a great privacy benefit for lightning users.
For what I understand of the proposed ANYPREVOUT upgrade, it will build on top of Taproot but will need to use a different length pubkey. Would it be possible for an observer to scan the blockchain for this pubkey length in order to determine which transactions are using ANYPREVOUT, and are therefore likely to be lightning related? Or is it possible to somehow hide this inside Taproot in such a way that privacy can still be maintained?

The foundation of a channel is a multisig output which can't be distinguished from other outputs when using musig and taproot.
The mutual channel close is just a regular tx spending this output so I'd say it'll be hard to detect this as a lightning Chanel without other data (similar as with current channels)
However the unilateral close is different and leaves a footprint of the channel state. I think the update transaction that is used to kick of the settlement tx might have the detectable structure that you have been referring to. (I'd actually like to ask you for your source)


Can we detect contentious soft forks created by the miners? Can we analyze the blocks or the data sent per block in order to see if it includes new data that we do not recognize and assume that's a soft fork and invalidate such a block?
Can a softforked mining node send data that a user's fullnode can't tell it's foreign?

Because a soft fork by definition follows stricter rules than the normal chain, you would have to make assumptions based on the block data. For example, if a soft fork no longer allows certain scripts, you might be able to determine that by noticing that those scripts are no longer present in any blocks from that miner. However, it would be a guess since it is still a valid block, and just might happen to not contain those scripts.
There might be other changes that would be more obvious, but still a guess because the blocks will remain valid according to consensus rules.
Edit:
Regarding Segwit (BIP141), the block indeed contains extra data regarding the witness data, specifically the commitment structure which contains a witness root hash:

A witness root hash is calculated with all those wtxid as leaves, in a way similar to the hashMerkleRoot in the block header.
The commitment is recorded in a scriptPubKey of the coinbase transaction.

However, without knowing what to expect (and without the witness data, which was not sent to old nodes), this data is meaningless. One thing that does give away data that may appear to be extraneous is the use of the OP_RETURN script code, since this allows arbitrary data to be included in a transaction, and this is used in the commitment structure.
It is also interesting to see how BIP141 handled older nodes, by simply not sending witness data, see Backwards Compatibility. The segwit transactions appear to be anyone-can-spend scripts to older nodes, so the only thing they lose out on is the ability to validate segregated witness transactions, since it will assume such transactions are always valid. They don't know about or propagate witness data.


How does a BIP70 url look like? I want to send my email to the person I'm sending my coins to. I'm trying to build an application that takes bitcoin and also an email. But when you send bitcoin you cannot send a message attached to it. Supposedly BIP70 solves this problem. How does a BIP70 URI look like? Example: I sell digital tickets that I email to my customers. My customers only have my bitcoin address. When they send Bitcoin to my address, how can they also send me their email address so I can email them the "digital ticket". Don't I have to have my URI something like this:

bitcoin:12A1MyfXbW6RhdRAZEqofac5jCQQjwEPBu?amount=1.2&message=buytickets@gmail.com

There isn't any such thing as a "BIP70 URI" as I understand it.  To use BIP70, the client fetches a payment request from somewhere, typically an ordinary https url (which can also be embedded in a bitcoin: uri, see BIP72).  The payment request is passed to their Bitcoin wallet client, which generates the transaction as well as a Payment message which is sent back to the server at a given URL.  There is a memo field in the Payment message which you could use, but filling it in would be up to the user's wallet client.  I don't see any way for your payment request to instruct the software how to fill this in.

So you would have to tell the user how to fill in the memo field of the Payment message using their particular software (assuming their software supports it at all).  And if they should fail to do so, too bad - by the time you receive their Payment message the transaction has already been sent.  Though you could still refund their payment in that case (using the refund_to field of the Payment message).

If the user has already given you the address (e.g. entered it in a web form) then you could generate the payment request in such a way that the payment_url embeds their address (https://my.server.com/pay?email=buytickets@gmail.com).  Then when they send their Payment message to that url, an appropriate application on your site can record that address as being associated with the transaction.

Note that in all cases the user needs a lot more than just your Bitcoin address; you have to run a publicly available secure web server to negotiate the payment protocol, and the user will need its web address.


Can miners be paid transaction fees even if they don't solve the current block? I was recently mining on ltc.tbdice site which is a solo type site. They only pay out when a block is found and nearly all goes straight to the miner.

I had set up a specific wallet address for this mining pool and I recently had a very small payment show up in there even though I have never gotten a block on that site.

It was about 0.00065 LTC (sorry, don't have wallet with me right now).

So is this a correct payment or maybe just a bug on that specific website? It doesn't really make sense to me.
Thanks

Generally, the point of a mining pool is that everyone gets a portion of the mining profit (in proportion to how much hash power they contribute relative to everyone else) regardless of whether their own miner found the correct block or not.

This is so that small miners can make a more consistent and predictable revenue. If they mined by themselves, their chance of finding a block is very low, resulting in an unpredictable revenue stream where the vast majority of the time they would make no revenue.


How can I sign a bitcoin address that is on a paper wallet? I have a bitcoin address that shows I held the BTC prior to December 2019.  I need to verify this but as the address refers to a paper wallet I don't seem to be able to do so.   If I move the coin to a hardware/software wallet I can verify BUT I will have created a new address that doesn't meet the criteria in that case.
Is there a way to sign a message with my paper based bitcoin address?  Or import the paper wallet into something that can sign messages?

Import private key of bitcoin address (paper wallet) in Electrum


What's the difference between a wallet and an address? Bitcoin seems to have the concept of a wallet and an address. Are they the same thing? If not, how do they differ?

Addresses are public-key hashes of an asymmetric key pair
An address represents a hash of a public key of an asymmetric key pair.¹ The owner of the key pair can use the private key to sign transactions or messages (for example in order to prove ownership). Only by using the correct private key a valid signature may be created, which then anyone can verify as valid by using the associated address (which, again, represents the public key).
Wallets are an abstract concept, a "keyring"
A wallet is an abstract construct, which contains the set of public and private key pairs randomly generated for the user. In a deterministic wallet, the keys are derived from a passphrase (a specific seed, masterkey or password) instead of a random seed. Essentially, it corresponds to a keyring in the cryptographic sense.
The Bitcoin client software abstracts the wallet for the user such that it checks each of the addresses contained in the wallet, whether there are any balances (transaction outputs) associated in the blockchain with them. It sums the funds up and presents them as a single total balance. Underlying, however, these balances are stored publicly in the blockchain (that's right, the wallet doesn't contain your coins, it just allows you to spend them). They are split up to numerous addresses and transaction outputs:

Address #15521² has
3 BTC in transaction output 1
Address #23414 has
1.2 BTC in transaction output 1
0.7 BTC in transaction output 2
...

Everyone can see them, however, usually can't determine the identity of the owner.

¹ To be more accurate an address is a Base58-encoded hash of the public key.
² Of course, real addresses actually are alphanumeric strings with up to 34 characters.


From LND Bitcoin Wallet to Bitcoin Wallet Let's say I have some Sats on Zap Desktop wallet. Is it possible to transfer the Sats out of the Zap Desktop Wallet to for example MyCelium?

Yes. You always have two accounts on LND (ZAP interfaces over rpc with your self hosted lnd node). One account is your lightning wallet where channel management is done, and the other is your on chain wallet. Depending on where your balance is there are different processes for moving the balance to your on chain wallet (which is what I assume you want).

Moving balance from lightning channels - You need to close the channels on the ZAP wallet which will broadcast the closing transaction to the bitcoin network. Depending on how long the HTLC is, the balance would take some time for it to become spendable.
Moving on chain balance - You can simply transfer on chain funds to your other wallet just like any other on chain transaction.


address list in "getrawtransaction" i have a confuse about the "getrawtransaction" RPC function,it returns a json object, which contains the addresses list in the "vout" object,like below.It took me some time to understand when the multiple addresses will contains many items,as i see, it always only one item, After reading the source code, I also found that even for multi signature transactions, there will not be multiple addresses. I need somebody help！please！

 {
      "value": 1000000,
      "script": "a914d550ecfc60d9f976de1f2a43bdf4e491b684cd6887",
      "spent_by": "cd2494071876f91e1f9505f5c5421088c7df2e6f939c17f742d3638bc7df789a",
      "addresses": [
        "3M8voDot82tBrQE7QWGy9WUWxp7gDU7owx"
      ],
      "script_type": "pay-to-script-hash"
 }

full url is: https://api.blockcypher.com/v1/btc/main/txs/46001fade64b8fa23815066ec62cc4a91ee0c8f4a4fad26e428bc4c0a2146290

I tried to send a multi sign transaction to the test network, and then looked at the data, and found that there was only one address.

It is a left over API design from bare multisig transactions.

The example you provided is a P2SH multisig - in this, the actual output script has no way of telling Bitcoin Core that it is a multisig output. It can be any script. Thus, Bitcoin Core just decodes it to a regular P2SH address.

Although no longer commonly used, there are also bare multisig outputs, which use multisig scripts that are not wrapped in a P2SH. These would be of the form M <pub1> <pub2> ... <pubN> N OP_CHECKMULTISIG for a M-of-N multisig (this is the redeem script for a P2SH multisig).

When Bitcoin Core used to decode these, you'd get one address per public key, hence the array.


What does malleable mean in "transaction malleability"? Does malleable mean modifiable?

If you can malleate a transaction you can modify some of its parts leaving the transaction as still valid (the signatures are not broken).

If you can malleate the transaction outputs you can modify the outputs.

If you can malleate the order of inputs you can modify the order of inputs.

But the bitcoin.stackexchange.com "transaction-malleability" tag says:

  A property of Bitcoin transactions that allows them to be replicated
  with another transaction id before they are included in a block.

This confuses me. Does transaction have an ID at all, and if it does ID seems totally irrelevant?

Malleability is ability to change the binary contents of transaction (that also includes its TXID) without invalidating it, by someone else after broadcast and before the confirmation in block.


Why can't someone build a custom computer and win the reward for a few days? I've been reading about mining, and that to get the reward it basically comes down to brute force. The difficulty of this brute force being adjusted every 2016 blocks.

I also understand that some hardware are better at brute force than others.

So, if I were to tinker in my garage an amazing mining rig, connecting together many ALUs or whatever (sorry I'm not a hardware guy) to give myself a significant advantage - would this work?

I'm not saying it would work forever, but would it work until someone built an even better machine, or until the difficulty self adjusts again?

I assume it's not the case since it would happen a lot. But seeing how people are racing to build the top mining rig, I feel like there is some degree of truth?

Lets see, following on from the other answer, you're going to need 6,400,000 TH/s. Currently you can buy the Antminer S9 which will give you about 13.5 TH/s, so you'll need a mere 475000 of them.

If you are buying  that many units I reckon you could negotiate a pretty good discount, if you don't cause an international shortage. Lets say you could get them for $3000 a unit. This would cost you only $1,420,000,000.

You are going to need about 3900 m/3 of space to store the devices, unpacked. By my reckoning that is about 4 tennis courts filled about 2 meters deep. Not a vast area but bigger than most garages. In reality, you'll need more space for ventilation and access.

To run all the devices concurrently you'll need about 66,500,000 Watts of power, that is enough to supply about 88,000 domestic homes. Your electricity bill would be at least $50,000 a day.

By my reckoning, you'll need about 45,000,000 BTU's of cooling, this could be achieved with 661 of these costing around $7,000,000. I haven't accounted for the additional space, electricity and airflow requirements.

The S9's internet bandwidth requirements are relatively economic, averaging out at something like 500 bytes a second. So, you'll only need 238 Mb/s bandwidth. This could be be supplied via and OC-12 line which will cost at least $700 a day, or more depending on distance. You're going to need something like a 1 Cisco Catalyst 6513-E switch, 180 Cisco Nexus 2348TQ and 10,000 Cisco Nexus 2248TP-E switches. The switches alone will cost something like $51,000,000. There is likely a more cost effective solution but you'll need to speak to your engineering team to work that out.

None of this takes in to account other concerns like expert cable management and racking, maintenance and security.

Finger in the air, you need a couple of billion dollars to get started. Given the current market cap this might actually pay off but you can see the risk and, don't forget the cleanup cost once you have devalued the market.

Good luck.


How secure is zero confirmations? I sent a small amount of BTC to someone and she was notified within seconds.  But the first confirmation did not happen for ten minutes or so.

What is the chance that this transaction could fail between the notification and the first confirmation?

Does it all depend on how well I try to double-spend?

For small amounts, like a cup of coffee, the double-spending risk is going to be negligible. If it's a person I know, I wouldn't mind receiving and accepting as valid a transaction with zero confirmations.

For shops that will start accepting bitcoin, a stronger security measure would be for them to have multiple bitcoin clients installed in multiple geographical locations. Once each of them has "seen" the transaction they can confirm it as valid, even though it hasn't been included in the blockchain yet.

The idea behind having several machines look and validate the transaction is that it becomes much harder for someone to propagate a double-spend against a transaction that has already been seen and propagated by several machines across the world.


Is Bitcoin's gossip protocol perfect? With Bitcoin's gossip protocol, could we take it for granted that if I sent a transaction, for example, at 1:00 PM on 1st January 2018 UTC that then every node connected to network at 1:00 PM would receive that transaction by let's say (for network latency) 1:05 PM 1st January 2018, because of how the gossip protocol works?
And by everyone I mean every single node that was connected to the network at that time.
Given some time for network latency, do messages reach all connected peers, and if so, how long does it take for them to do that?

Given some time for network latency, do messages reach absolutely all connected peers and how long it takes for them to do that?

Usually, standard transactions that pay a sufficient fee to be acceptable to most mempools, without any conflicts on the network will reach almost all nodes within a minute or so.

However, there is no guarantee whatsoever that it will reach all nodes. Every node has its own relay policy, and even perfectly correctly behaving nodes may choose not to relay anything at all.

Most of the delay is due to intentional delay in the propagation. Random delays are added before forwarding in order to obscure the source of transactions. Each hop on average takes 5-10 seconds.

Bitcoin has a subsystem with absolute propagagion guarantees though - the blockchain. While obviously subject to not being partitioned off the network, every node eventually learns the best chain. There are no guarantees on how long that takes, or which transactions are included in it.


From unsigned to psbt transaction Recently, I happened to see in a codebase something like the following snippet to convert a standard transaction into a psbt format:

txHex = "01000000038caba88b36e86b253de1c22574205ad7d46598a87349b2e7f364d244246b66820000000000ffffffff8d4cefc5b67a8ae0e4c6b8fd7ee259943c29b46471c4f31a5252422177fa20770100000000ffffffff68bc5046732a7e7e57b8f0abd6f94c63f7153738cb39525d497ce1cd765e35230100000000ffffffff02404b4c00000000001976a9148eccac781789b66751f19c3a58f36526a201786488ac00093d00000000001976a9148eb446f809f526fb37059a32cf8255c4cb43d2da88ac00000000"
psbt = "70736274ff0100c9" + txHex + "000000000000"

Is this correct?
One thing I understood after reading bip174 is that the last byte of the prefix should not be hardcoded because it contains the lenght of the transaction, but I have no clue about the suffix

The "suffix" is not a fixed suffix. The number of 00 bytes needs to match the number of inputs and outputs of the transaction. Those bytes are the terminators for the key-value maps for each input and output. The automatic converter does not fill in those maps, but an empty map will still have its null terminator. So the number of empty maps (and thus the number of null terminators) will change depending on the number of inputs and outputs in your transaction.

Also, those bytes will change as the PSBT gets filled with information. It is not a fixed suffix. So as the extra data for signing for each input and output gets filled, the "suffix" of your PSBT will change.


Historical prices of currencies Where can I get historical prices for coins, with the ability to store the information. I understand that most APIs do not allow you to save their information, any that do?

Have a look at cryptoarchive.com.au for historical crypto data.


Auto formatting data into sendmany command Apologies for the newb question.
But what's the best way to convert data on spreadsheet (lists of addresses and corresponding amounts to be sent), into a format suitable to be entered as a sendmany command into bitcoin console with the minimum amount of steps?  Ideally would handle any amount of addresses and amounts.
Thanks in advance if anyone can help out at all!

ie

from

1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ     0.01
1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz     0.5

to this

sendmany "" "{\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.5}"

You can export the spreadsheet as a CSV file, then parse it using your favorite programming language into a dictionary. Convert the dictionary to JSON, and that will give you the second argument to the sendmany command.

I'd do this in Python using the built-in csv and json packages.

I'm not aware of any solutions that will do this if you don't know how to program, though.


Where do transactions get sent? Related: how do transactions get to miners, but I'm looking for a slightly (and only slightly) more technical discussion.

Say I download a lightweight bitcoin client and set up a wallet on machine A. From another machine B, I send a coin to this new wallet.

How does my transaction reach a miner? Presumably, the client on machine B sends a message out to the internet ... but doesn't it have to specify which IP address to send such a message? Which IP addresses does it send to?
Similarly, how does machine A learn of the transaction? Is the client continually pinging the network to query for new transactions to its address? How does it know what IP addresses to ping the first time it executes?

How does my transaction reach a miner?

First, when you start up your wallet, it will connect to several other nodes on the network using the mechanism described here. These connections are TCP connections, so they are data streams from one computer directly to another; the IP addresses are known and data transmission is handled by the TCP layer.

Over this TCP connection, the two nodes will begin exchanging data. This first consists of some initial handshake stuff like version messages, various filters for the other node to apply before sending data to the other node, etc. Then it consists of block and transaction data. These are typically first announced via an inv message (basically just says "I have this piece of data"), requested with a getdata message (says "please give me this piece of data"), and sent with the appropriate message type (block, tx, etc.).

So when you send a transaction, your node announces via an inv message to the nodes that it is connected to that it has a transaction. The other nodes request it and the transaction is sent. Then those nodes repeat the same process; they announce to their peers that they have a transaction, it is requested and then sent. That is how a transaction propagates through the network. Eventually it will reach a nodes which belong to miners so the miners will be able to include your transaction in their next block.

  Similarly, how does machine A learn of the transaction?

Since the TCP connections are bi-directional, your node is also receiving blocks and transactions from its peers. For full nodes, it will receive every block and transaction that its peers knows of, which, in general, will be every block and transaction on the network. It can then interpret each transaction and find the ones which pertain to your wallet.

For a lightweight wallet, it will use a special set of messages which allow it to set a filter on the transactions it receives. This filter is sent to the nodes it is connected to and those nodes will only send to your wallet the transactions that match this filter. Then your wallet will do additional filtering locally to find exactly which transactions pertain to it (the filters set can have false positives).


How can I calculate the possible number of correctly formatted version one minikeys? I'm doing a small research project collecting information on minikeys. In that research process I've come across a couple of questions that I have been unable to answer in relation to the assumed keyspace of the version one minikey. The said mini key, was used primarily by Casascius Series 1 coins, and consisted of the following parameters

Generated using Base58 encoding scheme
Consists of a total of 22 Characters, of which 21 are random, with the 1st character being a capital S prefix

Has the following requirements to be considered well formatted:

If the minikey appended by a ? at the end of the string hashed using SHA256 results in the first byte being 00, the string is a well formatted minikey

Key Question: Is there any way to calculate the potential number of keys within the massive 58^21 keyspace that would be considered properly formatted?

My current suspicion is that it's not possible to do so because the validation involves hashing and the entire input of the entire minikey input would be needed to generate a proper hash (meaning potentially in order to calculate the possible number of valid keys, every potential key, of a impossibly large keyspace would need to be generated, which is currently impossible). However I am asking this question with the hope that this suspicion is incorrect and that it is somehow possible to calculate the possible number of valid well formatted keys.

For reading on this subject I would recommend checking out:

https://en.bitcoin.it/wiki/Mini_private_key_format

Be warned, the python script needs minor modifications to run on Python2.7

Bold is for key questions
Italics if for important thoughts

Note: This post intentionally does not cover the more secure Casascius Series 2 Keys, however it is likely assuming that there exists an answer for Series 1 keys that the process can be used on Series 2 as well.

Because outputs of SHA-256 can be considered equally distributed for the whole space and this property passes for the first one byte of those outputs, you can calculate this number easily with a really good approximation. One in every 256 in the space you mentioned would be a valid minikey. This approximation would be very good, since the space is, as you noted, really large, so it follows the law of large numbers.

If you needed an exact number, however, your assumption would be correct, though, calculating this number would require to check every possible "candidate" minikey in the space, which would essentially be bruteforcing the whole space and won't be computationally feasible.


Bitcoind JSON/RPC extremely slow under load I am data mining the blockchain using JSON/RPC on a bitcoind full node with txindex (0.9.1).

I have 64 RPC connections simultaneously going to bitcoind from a remote client. My workload is mostly getrawtransaction and decoderawtransaction. I have bumped rpcthreads to 64.

What I am observing though is that bitcoind is taking a very large amount of time (from 30 seconds to 2-3 minutes) to respond to each call.

I have verified that there are about 66 connections opened on the RPC port, and the bitcoind process has 73 threads, so that seems to confirm that both my load and the rpcthreads setting are correct.

If I query something like "help", I get the same slow response time, so it seems to be related to the RPC server rather than actually accessing the data from disk/memory.

Am I missing a setting to make it scale?

Bitcoind can be quite memory hungry and bandwidth hungry. If you're swapping a lot, definitely add more memory.

You may also consider using an external API like:

http://dev.blockcypher.com/#blockchain-api

Bitcoind itself is actually quite hard to scale out.


Creating a P2P network like Block Chain Posting this in Bitcoin community because I believe that you guys would be the best to answer the question since my question is related with the blockchain.

I am wondering how to create a P2P database (like blockchain?) which can be maintained by some party (miners)?

For example, in Bitcoin community, we know that a transaction is not valid if someone attempts to transact more Bitcoins than they have. Nodes don't relay them and miners discard them.

What should be the approach to create this project? Also, just like Bitcoin, you transact to store data (technically) on the network. How do I stop spammers? What measure should I adopt to achieve a spam-less network?

I am wondering how to create a P2P database (like blockchain?) which can be maintained by some party (miners)?

This is quite a big question to answer in one message. There's "Mastering Bitcoin: Programming the Open Blockchain" book that explains all the internals of Bitcoin in details. Also you can refer to Bitcoin Developer Guide – there're answers to all you questions.

  How do I stop spammers?

This is why Proof-of-Work is needed: adding a block to blockchain takes a lot of time and a lot of computations (that's why people buy fast video cards for mining). Thus, spamming is not possible.

  And, how does a Bitcoin node start finding peers?

There're are DNS seeds hardcoded in Bitcoin clients. When a new node is started it queries the seeds to get the IP address of at least one other node.


Why are the inputs of Bitcoin transactions signed? This is my understanding of what a transaction looks like:

inputs:
  input0:
    txid: <funding tx0 TXID>
    outputID: <output ID of UTXO in the funding tx0>
    scriptSig: <pkhash_redeemer> <sig0_redeemer>
  input1:
    txid: <funding tx1 TXID>
    outputID: <output ID of UTXO in the funding tx1>
    scriptSig: <pkhash_redeemer> <sig1_redeemer>
  ...
outputs:
  output0:
    scriptPK: <scriptPK for new UTXO>
    amount: <amount for new UTXO>

Where the signature <sig_redeemer0> is over:

<funding tx0 TXID>
<output ID of UTXO in the funding tx0>
funding transaction's Pub Key Script
<scriptPK for new UTXO>
<amount for new UTXO>

I've read much that states things along the lines of: "the signature is over the entire transaction" or "the signature signs all the inputs and outputs". However, there are a few points of confusion I have:

Do multiple inputs necessitate multiple signatures? Or is my example wrong?
Why do we need to sign the inputs of the transaction?

If the inputs aren't signed, that means the following are left unsigned:

txid of funding transaction
<output ID of UTXO in the funding tx>
sequence number (?)

If all outputs are signed, the amounts and scriptPubKeys of all UTXOs from funding transactions are fixed. An attacker might be able to change the inputs to the redeeming tx, but they are only unlockable if the inputs remain the same, so an attacker can't use an arbitrary input.

Any help would be appreciated! Thanks

There may be multiple utxos that the same script would unlock. The most common example is two transactions that both pay the same address. If inputs weren't signed, an attacker could replace one input utxo by a different utxo that pays the same address, and this would be bad.

Consider the following scenario.  Alice has received two payments to her address 1Alice, both in the amount of 1 BTC: one with txid 234abc in the amount of 1 BTC, and another with txid 567def.  She wishes to pay 0.5 BTC to Bob, so she creates and signs a transaction using the 234abc utxo as input, with the following outputs: 0.5 BTC to the address 1Bob, and 0.4999 BTC to some "change" address, 1AliceChange.  (This leaves a transaction fee of 0.0001 BTC.)

After this transaction is broadcast and confirmed, Bob modifies the transaction so that the input is 567def instead.  The scriptSig works equally well for every transaction that pays 1Alice (they all have the same scriptPubKey), so this new transaction is also valid.  Bob broadcasts it and effectively steals an additional 0.5 BTC from Alice, which she never intended to give him.

This only works as long as 567def has the same value, or greater, than 234abc, but that's not much of a restriction.  (If 567def has a greater value, say 10 BTC, then Bob's new transaction still only returns BTC 0.4999 to 1AliceChange, so it effectively has a transaction fee of BTC 9.0001.  Any miner would be extremely happy to confirm this transaction; indeed, maybe a miner will perform this attack even if Bob doesn't care to.)


Remote SSH connection to Raspibolt Lightning Network Node I am trying to establish a remote SSH session using Putty into the Raspberry Pi running my Lightning Network node without success (connecting from the local network works fine).

The related port of my fixed IP is open and seems to correctly forward to the Raspberry, however, when I try to connect with Putty, the connection is rejected ('Server unexpectedly closed connection.').

Can anyone more familiar with such setups help me figure out how I can connect with Putty?

About your specific setup we would need more information to trouble-shoot but here are some general network debugging steps I take -

Start at the lowest level

RPIs come with SSH enabled by default last I checked so this is just a sanity check step.

First make sure that the Raspberry Pi is allowing SSH connections (you mentioned you already did this so just for brevity) from your local network -

From another machine on the same local network as the RPI -

$ curl -v {{put your rpi local IP address here}}:22

which shows if the port is open because if it is you should see something along the lines of * Recv failure: Connection reset by peer.  If the port is not open the failure from above should be something along the lines of failed: Connection refused.

In the first case your server responded on 22 but did not accept the connection (since it is a curl and not an attempt to SSH in)

If that is successful you can of course follow up with an SSH attempt to verify you have access -

$ ssh {{user}}@{{local ip}}

Move outside the network

Since you were able to SSH in locally (if you were not then getting to this step is irrelevant) the next step is to disconnect from your Wifi or local network and then test your router / firewall settings.

You can do this for example by tethering on to your phones internet connection and issuing the same commands as above, replacing the IP address on the local network above with the your external IP address.  You can get your external IP address by Googling "What is my IP".

Finally, repeat the steps above to first test that the port is responding and second test that the connection is being allowed.

As you mentioned before the main culprit is not forwarding ports on the router.  Additionally you will need to set up your lnd.conf to listen on the externalip as well as instructing the RPC service or REST service to listen on that external IP as well unless you are using something more advanced like a reverse proxy.


Is it posible to create a transaction output that can either be reddemed by privK of Addr A or by privK of Addr B AFTER certain blockheight? I am thinking about how to secure your Bitcoin savings.

One idea I had was to create sort of a "backup" address B for an address A which stores the bitcoins. So what I want to achieve is that you are able to spend your bitcoins with the private key of A at any time. But in case you lose access to the private key of A you are also able to spend the bitcoins with the private key of B but only after a certain amount of time (i.e. blocks) has passed.

Would something like that be possible with the Bitcoin scripting language? And if so, how would one achieve this?

Thanks in advance.

Certainly. You can do this with OP_CHECKSEQUENCEVERIFY which allows for relative timelocks.

The basic structure would look something like this:

IF
    <pubkey A>
ELSE
    "30d" CHECKSEQUENCEVERIFY DROP
    <pubkey B>
ENDIF
CHECKSIG

Read BIP 112 for more information.


Service that displays how many inputs/outputs there are in the blockchain? Ideally, I am looking for a service like http://statoshi.info/, but one that displays the real-time number of inputs and outputs in the blockchain.

Note that I am not looking for information on the UTXO set, but the set of all inputs and outputs that are in the main bitcoin blockchain.

This is a useful statistic for developers because it has implications for the data storage requirements of parsing the blockchain and storing data per input/output.

http://webbtc.com/stats

This website displays statistics about its own output database, though it should be very rare that any developer need to maintain an index in this way. Most people will only need to interact with their own, unspent outputs rather than the entire history of the mostly unrelated chain.


Litecoin difficulty and reward How can I know difficulty value and reward for Litecoin network ?

I'm looking for website such as

http://blockexplorer.com/q/bcperblock
http://blockexplorer.com/q/getdifficulty

to get difficulty and reward for Litecoin network (instead of Bitcoin network)

I'm looking for a way to get difficulty and reward using an API that can be queried every 15 minutes to make my own mining profit calculator.

Current difficulty is around 100 and current reward is 25 LTC.

The latest version of Abe supports getdifficulty, so you could run it yourself or convince the explorer administrator to upgrade.  But this will be the difficulty as of the last solved block.  I would expect "litecoind getinfo" to give a more accurate number during difficulty adjustments, and this does not require Abe or a website.

As for the block reward, Abe lacks bcperblock.  Perhaps the easiest route is to get the current block number (also available via getinfo) and calculate the reward.  According to litecoin.org, the reward starts at 50 LTC and is halved every 840,000 blocks.  In Python:

def reward(blocknumber):
    return 50.0 / (2 ** int((blocknumber + 1) / 840000))

Adding 1 to the block number gives you the next block's reward, which is what matters to miners.


Programming for/modding bitcoin-qt on Windows In multiple places I've found methods of modifying or adding to the bitcoin-qt(or other coin wallet) source on ubuntu or osx, but how would I do this on a Windows machine? If possible, I'd like to be able to use an IDE(pretty much required) to be able to build, but also, I need some way to edit. Thanks ahead of time!

Qt is a multiplattform library, so is its IDE (qtcreator). You can compile bitcoin-qt on Windows pretty much the same that yo do on Linux.


What happens to price when the block reward is gone completely? What will happen, specifically to the price of Bitcoin and transaction fees when the block reward drops to a negligible amount?

Today, each block reward is approximately worth 25 * $300 = $7,500. To generate a tantamount reward as today, with (an assumed) 4000 transactions per block at today's exchange rate, the average transaction fee would have to be $1.87.
Under these assumptions that would put Bitcoin out of business in terms of being an affordable way to make everyday transactions, especially micropayments.

Now I know that block size is mutable so does this mean it's inevitable? Or does it mean that the price of BTC will have to rise to at least the cost to mine a block divided by the transactions per block multiplied by the exchange rate to be worthwhile? Doesn't this then mean that the value of Bitcoin outside it's functional value, is then ultimately determined by the block size which markets don't have control of?

Does BTC fiat price increase to meet the collective cost of actually hashing the transaction block or does the total block transaction fee value determine it?

My point is, when transaction fees are the ONLY incentive to mine (and that will happen eventually as a certainty) the total sum of the transaction fees must match the cost of mining the block they were included in. If the block costs more to mine than the value of the transaction fees in a block, miners (most) will shut down. At least so many will shut down that the network becomes insecure and Bitcoin will die.

You've completely failed to mention the difficulty retarget mechanism in your analysis. If the block reward drops, miners will quit until the difficulty is low enough that the remaining miners will break even. This will happen regardless of what the new reward per block is, the only thing that changes is the new difficulty/hashrate. (There is some subtlety in that the retarget mechanism takes time to kick in, but if the drop is gradual that's not much of a problem.)

With low hashrate, the network is less secure. This is why we need to come up with ways to make sure transaction fees are sufficient to fund an acceptable level of mining. (A limit on the data size of blocks is a possible such way, but not a very effective one IMO.)

But the drop in reward will not magically cause the price to go up. The price is determined by the market.


What shape of merkle tree does the Bitcoin client build? The Bitcoin client builds a merkle tree to represent the transactions, then includes the root of that tree in the block header.

But usually, the number of transactions is not a power of two. When that happens, how does the Bitcoin client represent the transactions in the tree?

If I wrote a custom mining client, which built a tree with a different "shape," (example below) what would happen?

When the number of transactions is not a power of two, how does the Bitcoin client represent the transactions?
Each time around, it hashes each transaction with the one next to it, until there's only one left.

If there's an odd number of transactions, the last one is hashed again.

In this example, we start out with 11, then 6, then 3, then 2, then 1.

What would happen if you made a differently-shaped merkle-tree?
When sending blocks around, there's no way to specify the shape of the merkle tree. If it's different, the standard client will just reject it.


1ML shows larger number of nodes comparing to other lightning network explorers I found that 1ML displays almost double the number of nodes comparing to other lightning network explorers.

I think 1ML does not provide the datasource but are you able to guess about the reason of the difference?

Besides 1ML, the numbers of nodes are almost same.

My own c-lightning nodes shows about 4,000 by listnodes command and lightning.chaintools.io uses lnd's GetNetworkInfo rpc call according to their source code.

1ML https://1ml.com/statistics

Nodes: 7,462
Channels: 39,310

ACINQ https://explorer.acinq.co/

Nodes: 4,011
Channels: 39,514

Indexplorer https://graph.lndexplorer.com/

Nodes: 3,941
Channels: 38,983

Lightning Explorer https://lightning.chaintools.io/

Nodes: 3,971
Channels: 39,201

Lightning Explorer https://explore.casa/

Nodes: 3,978
Channels: 39,009

Let's start by ignoring the 1ml case. It is perfectly reasonable that the number of nodes differs a little bit as the gossip protocol takes some time to forward the information. In particular there  could be private nodes having a channel to the node that is used  by the explorers and they could include the knowledge about such a node in their  counting...

So why is 1 ml counting almost twice as many nodes? As it is closed source we can only guess. I observed that 1ml also depicts closed channels for a node. So I could imagine that the number of nodes shown by 1ml also includes nodes which existed in the past by counting all nodeids they have ever seen in their database instead of counting the nodes from the gossip store. I did not find such an example quickly. Also the gossip protocol specifies to remove channels if they close on chain but has as far as I rember no rule for removing nodes. Maybe 1ml uses a different / secret lighing implementation. That never drops nodes from their gossip store.