Is it legal in Egypt to sell BTC, and is that available there?

According to https://legal-or-not.com/bitcoin/egypt-bitcoin-status/, Bitcoin is legal in Egypt. On the wiki for list of countries on stances on bitcoin, Egypt is not listed.

In 2016, an Egyptian dentist was arrested for trading bitcoins for USD. Note, he was not trading bitcoins but rather exchanging them for USD. He was arrested for scamming, money laundering, and as I said above, exchanging through foreign currencies.

Thus, because there is very little information about the Egyptian's government on bitcoin, be careful, but it should be ok. Hopefully my answer helps you out.


can not access bitcoin in an address that belongs to a discontinued wallet, although i have the 12 word phrase?

If you have a 12 word recovery phrase for the old wallet, if the phrase is a BIP-39 recovery phrase and if you can find the derivation path, you should be able to recover control over your money using a standalone wallet that supports BIP-39 and which allows you to specify the derivation path.
You could use a list of popular derivation paths as a starting point for your own larger list and systematically work through them.
It would be easier if the original business could tell you the derivation path used in their discontinued wallet.


It is not an error that new blocks are detected.
You should check other parts of the output to see if you are correctly connected, you are hashing and submitting shares.
If you want us to check what's wrong, please, submit some other part of the cgminer's log.


Does a LN route with N channels at most require N-2 fee payments?

The last channel in the route does have an impact on the fees of the payment. It's a bit counter-intuitive but when a payment is being forwarded by intermediate nodes it pays to the node the fees necessary to traverse an outgoing channel of that node. In a situation A -> B -> C A sends to B amount + fee(BC) because A knows that B will subtract the fees according to the cost of traversing the channel to C namely 'fee(BC)'; note that if there are multiple channels between B and C, A can't choose which one to traverse. In the case of the last hop you want to it to have the amount that was requested in the invoice (or whatever amount you want it to receive), in the { A, B, C } example A is effectively paying for the last hop even though the amount that comes out of B is without fees because B takes them in advance (before forwarding it to C).

As reference you can look here and specifically in the field descriptions: every forwarding node has to respect the equality incoming_htlc_amt - fee >= amt_to_forward where incoming_htlc_amt is the amount being received upstream and
amt_to_forward is what will be sent downstream.So to answer your question, an LN route with N channels requires exactly N-1 fee payments.


Can I use Bitcoin to send money from a US bank to an Indonesian bank?

Bitcoin is not well integrated with the legacy banking system. What you want to do would therefore go somewhat like this:

Open an account with a Bitcoin exchange (A) that takes US customers. (Assuming you are a US citizen.)
Deposit USD into the Bitcoin exchange.
Open an account with a Bitcoin exchange (B) that serves the Indonesian market.
Buy bitcoins for USD on A, transfer the bitcoins to B, sell the bitcoins for Indonesian Rupiah on B
Withdraw Indonesian Rupiah from B to your bank account in Indonesia.

As you can see this is somewhat complicated, and there are likely ways to make this transfer more easily. However, I have successfully used a similar method to transfer money to myself in the past and it was much cheaper than an international wire transfer.


What is the cost of setting up a bitcoin account

You are asking 2 very different questions so here goes:

1) Bitcoin wallets are free to create and use. blockchain.info, for instance, allow you to create an account and receive Bitcoin instantly. The only real cost is when you send coins out to someone - you have to pay the miner fee. The best you can do is read about it here https://en.bitcoin.it/wiki/Transaction_fees

2) Bitcoin are as virtual as Euros or US Dollars - it's a currency which you can trade like any other currencies. Few notable differences though - Bitcoin is finite, meaning there can only ever be 21 million Bitcoin ever produced. Miners are producing the coins by solving a complex algorithm. The more Bitcoins are mined, the more complex it becomes to mine and therefore more expensive in terms of resources (read electricity and hardware). Nobody can set a price to a Bitcoin, it's a market driven by demand and it is way more volatile than general currency trading. Exchangers just allow users to buy or sell Bitcoin for another currency but there is no guideline. That's why a lot of users are doing arbitrage between different exchangers in order to get the most profit out.

Hope that helps you


You would be best off using something that links to libsecp256k1 than openssl, which is in the process of being dropped in Bitcoin Core due to endless security concerns anyway. I'm not aware of any that do, but I will update this answer if I find any.

  are there plans to implement a deterministic wallet in bitcoind?

Possibly, there's currently some planning going on with this, its at least likely that the current wallet will be deprecated and replaced with something more separate from the actual daemon. The current wallet is very heavily tied into the client in a lot of places, and has some massive dependencies like BerkeleyDB which are completely overkill for a key value store.

The current train of thought and some code is partly mixed into the bitcoin-dev logs and also on github. You shouldn't be using any of this with real money though, it is likely to be unstable for a long time.

  are there any bip32 wallets which call already-existing-functions in bitcoind wherever possible?

None I am aware of, most wallet software currently developed is either built on BitcoinJ (which numerous privacy and security considerations), querying some remote service (privacy and massive security issues), or something home brewed. Generally key management through JSON-RPC is pretty awful so that is somewhat understandable.

  if not then what level of risk is involved in using bip32 wallets which rely on non-openssl ecdsa libraries?

It's good you're thinking about this sort of thing to begin with.

Depends on the library, but the worst possible outcome is that a software implementation bug causes all of your money to be lost or stolen. This isn't unreasonable to suggest, and it happens almost constantly through the history of Bitcoin. Blockchain.info rolled their own RNG and has lost funds on a number of occasions due to it, Mt Gox wrote their own wallet and lost a pile of money when a function errored out and they sent their money to the pubkeyhash null, Bitcoin Armory found the ECDSA code they used leaked private keys through the signature. There's bound to have been more mistakes but these are the ones that have been made public.

Pretty high levels of risk, really.


I understand that: in "asm" i have RedeemScript. In txinwitness i have my signature and the pubblic key. Correct?

Correct. in a P2SH-P2WPKH the witness contains the signature and the public key, and the script signature contains the redeem script.

  is it correct to say that, as an additional condition, to unlock a UTXO P2SH-P2WPKH, compared to a P2PKH, you need the HASH of an additional public key?

This is where you are kind of wrong.

The address of a P2SH-P2WPKH is the hash160 of the serialized redeem script of the P2WPKH, which has to be OP_0 <hash160_of_public_key> according to BIP0141. So it looks like you need an extra public key, but in reality you are just using the same public key twice. One that goes inside a redeem script to the script_signature, and another for the witness field that goes naked alongside the signature.

In other words, there is no extra public key. It's the same public key that is wrapped inside a smart contract (redeem script) defined by BIP0141, serialized, and then hashed. Now, this hash is the same hash used for the public keys (hash160), therefore the outputs of these smart-contract hashes have the same length of those public-key hashes, and that's why they can be confused with public keys when in reality they are smart contracts. This is done on purpose to make P2SH backward compatible .


python-bitcoinlib | Create Private Keys, Public Keys and Addresses - How to Do It?

Sorry I am not familiar with python-bitcoinlib but if your goal is to just create keys/addresses you can use this library (disclosure: I wrote it) the following way:

  Generating a private key

private = PrivateKey.random()

or private = PrivateKey.from_hex('yourhexkeyhere')

or private = PrivateKey.from_wif('yourwifhere')

and then to get the hex representation use private.hex() of private.wif()

  Creating a public key

public = private.to_public()
public.hex()
'044cc549c65f4b0b7713d7a763a01221f85fd34602ac8ff0386995349c55de7111d16b5...'
public.hex(compressed=True)
'034cc549c65f4b0b7713d7a763a01221f85fd34602ac8ff0386995349c55de7111'

  Creating an address from the public key

public.to_address('P2PKH')
'16B2Ghyu5C1CofKfXF2Zi9JycqaAyaE8cd'
public.to_address('P2WPKH')
'bc1qtqshpjw8kr7jlk27gcvj7pvzt8lp6vn5dc2f24'

If you use this library please use it only as a learning tool and not to send real coins as there might still be some bugs.


no, trx fees are not calculated based on the value of a transfer.
TX fees incentivise miners, to include your trx in the block. Generally one can say, the higher you create your TX fee, the more probable it will be included in the next block. Or vice versa, the lower your TX fee, the longer it will have to wait, until it get's processed by a miner.


Why is the full blockchain required, effectively forever?

How likely is it that some block from 1 year ago later turns out to be invalid?

Very unlikely, but I think that isn't the problem.
The problem is, how does a new user find out the current state (UTXO set or equivalent) without having to trust other parties? Any community has dishonest people preying on it.

You cannot ignore, expire or invalidate unspent UTXO from much earlier blocks. That is someone's savings and the community wont throw their savings away or  arbitrarily take away their peers savings. To do so would undermine the credibility of the currency. Any such change would be ignored and not be adopted by the majority.


Are there any publications about deanonymizing Bitcoin?

A good resource is http://arxiv.org/. Search bitcoin in the search bar, and then look for "anon" on the page to find articles about anonymization and de-anonymization in bitcoin.

Doing that, I found these examples:

http://arxiv.org/pdf/1510.07782.pdf
http://arxiv.org/pdf/1509.06160.pdf
http://arxiv.org/pdf/1405.7418.pdf
http://arxiv.org/pdf/1107.4524.pdf


Does cgminer have to be on for me to solo mine for bitcoins

cgminer is just the client software to control your ASICs. Where cgminer gets it's work from is your question and that depends ...

You can run your own full node and point your hashing power there
or way easier would be to just use some hosted solo pool like http://solo.ckpool.org/

On the website you finde further information on how to solo mine.


BIP39 Japanese Mnemonic vector unit test process

So entropy seeds mnemonic (bip39?), then mnemonic | password hashes to Seed; Seed then acts as the master key for the bip32 xprv? (correct me if I'm wrong!?)

That sounds about right. Most of the process is well detailed in BIP-39.

An SHA-256 is taken of the entropy, and the first entropy_len_in_bits / 32 bits of this hash are appended to the end of the entropy. The resulting entropy bit string is divisible into 11-bit-long chunks (it's no longer an integral number of bytes).
Each 11-bit chunk is converted into one of 211 mnemonic words.
The words are joined by spaces. For display purposes in Japanese, these should be Unicode IDEOGRAPHIC SPACEs, '\u3000'. If there's no need to display the mnemonic to the user, they can be "normal" SPACEs ('\u0020').
The mnemonic sentence is Unicode normalized in NFKD form. This converts any IDEOGRAPHIC SPACEs into SPACEs. It also changes some characters in some of the mnemonic words, therefore this step cannot be skipped. (The question What is NFKD normalization? is a whole separate topic that's probably best asked elsewhere IMO....)
The mnemonic sentence is converted into bytes via UTF-8 encoding.
The binary seed is computed as PBKDF2HMACSHA512(key= "mnemonic" | passphrase, data=utf8_mnemonic, iterations=2048, out_bytes_length=64). The passphrase can be the empty string. It must first go through the same steps 4 and 5 as the mnemonic.
(this part isn't detailed anywhere AFAIK) The master extended private key is constructed by using the first 32 bytes of the binary seed as the private key, and the last 32 bytes as the chaincode.

  Is it just NKFD Unicode normalization, which Electrum 2.0 does?

Electrum 2.x does use NFKD normalization, but it also performs additional steps, such as removing spaces between Japanese words after step 4. It also uses a different key string in step 6, and a completely different process prior to step 4. See this answer for an implementation of Electrum 2.x's mnemonic-words-to-seed procedure in Python.


Old Bitcoin QT Core (V0.7) - Sent BTC - Lost?

Anyone know what might be the problem ?

Your client thinks that funds were sent. All other nodes know nothing about your transaction. So, the truth is that your bitcoins are still yours, but you should remove the unconfirmed transaction from your wallet and/or use updated software.


Error message still returned after transaction was indeed broadcast

This looks like an implementation choice of the PeerGroup.broadcastTransaction method of bitcoinj.

If you send a transaction out to one or more peers, there is no guarantee that any of those peers will forward them on to others, and no way to verify it without having another node somewhere else on the bitcoin network listening for it (or listening to it from the same node but from different peers). You can only attempt to have some level of confidence that the transaction has been broadcast by sending it to multiple peers.

The broadcastTransaction method appears to have some confidence calculation in it, and probably does not complete the promise unless the confidence is met. I've not explored the details of it, but I'd suspect you're perhaps not connected to enough peers for it to have the confidence. Are you only connected to one peer perhaps? Maybe you need a longer timeout? Check the details of how the broadcast is implemented and you might figure it out.


The Antminer S7 runs standalone. It has a micro-controler that runs CGminer, and a web interface where you can point it to any pool you want. You just need to figure out the IP address of the miner, then type it in a web browser. The default password is root/root, if my memory serves me well.

In any case, you should read the manual.


Why bitcoin addresses have different number of characters?

Bitcoin addresses are 160bit numbers. They are derived by running the public key through hash functions. The result is a number in a fixed range i.e. 0 to 2^160. This is then encoded in base58check or bech32. You could represent it as hexadecimal as well if you liked.

2 and 53 are both random numbers inside 0-100. One takes 1 character to write out while the other takes 2 characters to write out. Instead of writing them in the decimal number system I could write them in hexadecimal and that would not change.

Base58check is just another encoding format. It's converting the number into base 58 number system and adding a checksum at the end to prevent typos.

You can represent zeroes in all of the above number systems/encoding formats. You may do it with characters other than 0 though. In the case of base58check 0 is represented with 1.


As explained in this answer fees are not fixed so I don't think that your conclusion about them being useless for spam protection is true.

Other than that I would say that they can be used similar to how Bitcoin is used. They may be a future competitor to Bitcoin even though they are certainly not marketed that way. They are scarce, easy to transfer etc.


Where off-chain transactions are registered afterwards?

It doesn't.

From the point of view of the blockchain there are just 2 transactions: one going into an exchange address the other is going out of an exchange address.

For example:

You sent 0.1 btc to an exchange [recorded on blockchain]
Some other people send other amounts to that exchange (exchange controls all these addresses) [recorded on blockchain]
You make 0.05 btc on a trade (that means somebody else lost that 0.05 btc) [NOT recorded on blockchain]
You withdraw 0.15 btc minus any trading fees
Exchange sends yours 0.1 btc + somebody else's 0.05 btc to you (they might use a couple of addresses that they sent from, or they might use a cold storage address) [recorded on blockchain]

The only transactions that are recorded on the blockchain are 0.1 btc from you, other deposits from other people, and you withdrawal of 0.15 btc as per example above. Any trades that are happening on the exchange are happening in their own database.

Also exchanges might consolidate balances into hot or cold address. So you might notice that after you sent 0.1 btc to an address that an exchange provided to you, that 0.1 immediately left that address to an address that has a large balance, but your funds are still displaying on your exchanges's account. That is because it is now handled by their internal database.


what is the fastest free way to get at least 1 satoshi

There are no shortcuts, nor any free rides.

First off, you aren't going to be able to do anything with 1 satoshi.  You wouldn't be able to afford the mining fee to transfer it anywhere, which means that it has essentially been taken out of circulation.  As it stands, everything you can do with 1 satoshi you can currently do with 0 satoshi.  For amounts that small, you shouldn't bother.

Second, your time has value.  Regardless of your electricity costs, setting up a CPU/GPU to mine bitcoin will take time.  Furthermore, with so little hashing power, you aren't going to see a payout anytime soon...even while mining on a pool.  You are probably better off trying to use the faucet you mentioned.

As it stands, the least expensive (both time and money) and fastest way for you to obtain a usable amount of bitcoin is either to purchase some, or sell a product/service in exchange for some.

I know this is not what you are looking for, but I assure you that it is the truth.


Will a USB mining device use my computer's processing power?

If you are using dedicated mining hardware, then CPU is only used for dispatching work to ASIC and sending the result back to pool. Therefore, CPU usage in this case should be very small, certainly not 100%.

Own experience: Linux, cgminer, 2*5GH/s ASICs: the miner uses about 1 minute of CPU time per 24 hours walltime, much less then bitcoin client running mostly in background.


Who pays the miner fees for the closing transaction of a payment channel?

According to the BOLT 3 specification, the peer that funded the channel will incur the costs of closing fees. It also seems that these fees would be calculated before closing a payment channel. Both parties already have a transaction with a built in fee that can be used to close the channel that they can broadcast at anytime.

Reference: https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md#closing-transaction


If you have not received the Bitcoin payment you are expecting, contact the sender and ask for the transaction ID.

You can copy the transaction ID into a blockchain explorer like blockchain.info or https://www.blocktrail.com/ to track the payment. If you cannot see the transaction ID, the send never sucessfully broadcast the transaction to the Bitcoin network.

If you can see the payment but it has not confirmed you will be able to tell if the problem is related to the transaction fee being too low, the BTC being sent to the wrong address or something else.


Transactions for multiple crypto-currency coins in cold storage without downloading full block-chains

This is probably a question for a longer discussion, less for an q&a forum :-) There are too many opinions on how to, based on the desired outcomes and values (and paranoia). The higher the values, the more important is a proper stress tested storage system. My current solution would be a mix of virtual machines and different hardware.

I think of storing several altcoins in several cold wallets (offline). My major concern would be data loss due to broken hardware. Therefor I'd have two or better three backups. I would create several offline PCs in virtual machines/environments, and also have an offline Linux, and maybe an older MacOSX and/or some RaspberryPIs (all offline). All systems have one advantage over the other. In the virtual machines I would try to setup a wallet, by compiling myself. If not, I take a default wallet. Once the procedure is "clean", I can do the same on an offline PC. It's astounding, how many dependencies there are...

I would install the default wallets on the offline machines, note down the priv keys and/or seeds, capture a photo of the priv key/seeds (make sure your mobile doesn't sync the photo to the network, and delete it after downloading!), and keep it written down and/or somewhere in a veracrypt container on the different offline PCs. It is good to distribute, hardly all break at the same time. Also I note down the public keys and/or addresses. Then in the exchanges, one could send keys to "my" addresses.

I wouldn't download all the blockchain(s), that is not required. For example in Bitcoin, it is sufficient to have the priv key, to get it loaded in an SPV wallet like Electrum. In Ethereum there is MyEtherWallet. Other cryptos only have the "full client", which make it a bit more difficult, when it comes to spending. The clients might not recognize the funds, which have been sent from an exchange to the cold storage since its inception. As long as there is no SPV type wallet, you would have to download the chain up to the point, where you received last funds, or assemble a tx yourself, and send it to the network. I have done this several times with bitcoin, but never for altcoins...

You asked for an efficient process, my guess is, there isn't. I leave it to the audience, to convince me of the opposite :-) There are too many dependencies and different requirements, even if you have the technical understanding, implementing a wallet and being able to cold storage still requires a good thinking on process and trying it out regularely. I'd be very annoyed, if I think I have saved my data, just to discover one day, things have changed and I cannot access funds!

Here in the forum are many links to the keyword "cold storage", and over at bitcointalk as well. So my post is not at all covering all and every options. Maybe people can share some more options.


Bitcoin Cash: how to check address balance / transactions?

Bitcoin Cash block explorers are (sorted by usefulness and features):

✯ BlockTrail: www.blocktrail.com/BCC
✯ BlockChair: blockchair.com/bitcoin-cash/blocks
✯ BTC.com: bch.btc.com
✯ ViaBTC: www.viabtc.com
✯ Bitcoin.com: explorer.bitcoin.com
*✯Coin Dance: cash.coin.dance/blocks
✯ BitInfoCharts: bitinfocharts.com/bitcoin%20cash/
✯ BitBox: explore.bitbox.earth
BlockDozer: blockdozer.com
Blockexplorer: bitcoincash.blockexplorer.com
CoinSpace: bch.coin.space
BitPay: bch-insight.bitpay.com
Yours: insight.yours.org/insight

* Shows only blocks, doesn't show transactions.

✯ The ones without star use the same Insight UI, so that websites may not show interesting data.


How many confirmations will Bitcoin core wait before I can send my coins out?

Using Bitcoin core 0.14, how many confirmations do I have to wait before I can send the coins out?

Bitcoin Core will let you spend received money after 1 confirmation, and let you spend change (money leftover from a transaction you sent yourself) without confirmations.

If possible, it prefers using coins that have 6 confirmations.

  Is there a method to wait X confirmations before sending coins out from specific addresses that have less than X confirmations?

You'll have to do that manually, using listunspent and createrawtransaction.


If you're using a client, you can just export the wallet.dat through an option, be sure to encrypt it!

If you need to move your Coinbase "wallet", you can just send the balance to an offline wallet address.


Ledger Nano Mnemonic Generation and Questions

What was the motivation to move 8 bits to the end and use 2^11 possible words instead of move no bits and use 2^8 words with a 32 word mnemonic resulting in a bijective correspondance between the set of permutations of words and the set of possible 256 bit sequences.

Typical word lists are 2048 entries, and that seems to be well established as usable. Using 256-entry lists would mean significantly longer seed phrases, which are presumably less optimal in terms of convenience. Deviating from that just so that the bits align with 256 would seem very strange.

Because of the dependence of the last word on the first 8 bits, there are (2048)^24 - 2^256 \approx 2.95 x 10^79 invalid 24 word mnemonics. Does anyone know what would happen if you tried to input on of these into a ledger during recovery mode? Mathematically it should give a random 264 bit sequence and then either 1) check that the first and last 8 bits are the same - if not, error. 2) throw the last 8 bits away to obtain a valid 256 bit seed that would correspond to a different mnemonic, where the # corresponding to the 24th word began with the same 3 digits.

The text you quoted says the 8 checksum bits at the end are computed using SHA256 of the 256 entropy bits; not just a copy of the first 8 bits.
I don't actually know what happens if you enter a seed with mismatching checksum, but I suspect the device will just reject it.

"The device generates a sequence of 256 random bits using the true random number generator (TRNG) built into the device’s Secure Element." This is the only part that startles me a little. I feel like I remember reading in the past that a lot of attacks happen because random number generators can be exploited because they are not truly random. How is the randomness of this TRNG tested?

Randomness is indeed hard, but you buy a hardware wallet because you trust its security more than you trust a software wallet running on general purpose hardware. If that's not true for the RNG in it, don't use it - you can always generate it elsewhere and import.


Can secp256k1 be implemented efficiently on a 8-bit processor and very limited RAM?

I don't see why not.  Most of what you need to do is just modular arithmetic with big integers (around 2^256).  There's no obstruction to doing this on an 8-bit microprocessor, it just takes a few more instructions.  You might even find some existing code for arbitrary-precision arithmetic.  256 bits is 32 bytes, so 8K of memory seems like plenty.


Relationship between Hash-Rate and Difficulty

Short answer:

  difficulty = hashrate / (2^256 / max_target / intended_time_per_block)
             = hashrate / (2^256 / (2^208*65535) / 600)
             = hashrate / (2^48 / 65535 / 600)
             = hashrate / 7158388.055

(where hashrate is expressed in hashes/s)

Longer answer: there is no direct relation between the actual network hashrate and the difficulty, because the actual hashrate cannot be observed. What happens is that every 2016 blocks, the average hashrate during that period is measured, and the difficulty is adjusted based on that.


How to access any transaction detail in Bitcoin version 0.8 and above?

Two new command-line or bitcoin.conf file commands have been added in the 0.8 release that allow for historical transactions to be accessible by recreating the old index:

  txindex : maintains an extra index of old, spent transaction ids so they will be found
  by the getrawtransaction JSON-RPC method.

  reindex : rebuild block and transaction indices from the downloaded block data.

[...]

  you must run once
  with -txindex=1 -reindex=1 to rebuild block-chain indices


Mining Theory: What would happen if a block hash collision occured?

This is a very unlikely event to occur, but, in the case it would happen nothing strange will go on.

Also if a block is mined by two miners at the same time, some nodes will see and accept one of the two "twins" blocks first, and the second will be simply ignored. After the majority of nodes agrees that one of the two blocks is the "good" one (A) the other twin block (B) get rejected by all nodes following a network discard of such block(B).

However, chances of that happening are negligible, because the block hash is a random 256 bit output (smaller than the current target), which allows for an immense number of possible hash outputs of a similar magnitude as the address space. ref

Well explained also by P Wuille:

"If two blocks with the same hash and the same parent are produced ~simultaneously, one of which is valid, and the other is invalid (but does have valid proof of work), some nodes in the network will see one first, and others will see the other first. Those who see the invalid version first will mark the block as permanently invalid, and they won't bother even trying to learn about the valid one when another block builds on top. This would lead to a permanent chain fork between the nodes who saw the invalid block first and those who saw the valid one first." ref


How can the blockchain survive without an army or other kind of law enforcement?

The blockchain itself does not have any power. It is just public set of records, like a phonebook.

Depending on the contract between trading parties, you arbitrage the contract disputes within the legal means you have available.

However, blockchain can act as a proof of agreement and everything signed there is very hard to forge: the other party cannot claim they did not sign the agreement if the private key used in signing can be proven to belong to the party.


Removing Bitcoin from my phone to secure storage

You are overthinking this.  The easiest way to move some of your bitcoin to a different wallet is simply to send it to an address belonging to the second wallet.  This works, regardless of what type of wallet the second wallet is.

For example, if you use Bitcoin Core on a desktop in your house, simply request a payment, which will show a QR code on your screen.  Scan it with your phone, and send whatever amount of bitcoin you want to your desktop wallet.  Yes, there will be a transaction fee, but it will be a lot less value than the time/risk associated with importing private keys into Bitcoin Core and then purging them from your phone wallet.

As for the most secure wallet for long term storage...there's some debate on that.  Here's an earlier answer I gave on the subject:  What options does one have to manage Bitcoins?


Yes, cashing out is profit protection but, it is also a stop gain. Follow the exchange user guide for instructions on how to sell or contact their support team, the details of how you do this are exchange specific.


You can use ku  utility provided in pycoin library.

example:

ku -s 0/0-2 xprv9xWkBDfyBXmZsA85GyWj9uYPyoQv826YAadKWMaaEosNrFBKgj2TqWuiWY3zuqxYGpHfv9cnGj5P7e8EskpzKL1Y8Gk9aX6QbryA5raK73p

will generate keys from index 0-2 on derivation path 0/x


Is there any "added value" to run a full node behind a router or firewall?

benefits for the network

Maybe, but barely.

If your node happens to connect out to a number of reachable nodes that aren't well connected by themselves, and you have a fast connection to both, it is possible that you improve relay of transactions and blocks between them. This is unlikely to be significant on itself, as reachable nodes can typically accept many connections, so there are many chances for other nodes than yours to do this as well. However, the effect of a large number of node operations choosing to do this or not may be significant.

  benefits for the individual

Absolutely, and in my opinion, this is the only reason you should (or shouldn't) run a full node.

It makes you independent.

If you run a full node, and use it to validate incoming transactions, nobody can send you an invalid transaction. There are other ways of accomplishing the same, but they all rely on trusting other parties.

And even if you don't use it to verify incoming transactions that affect you, it makes sure that miners cannot change the rules of the network without you knowing.


Are there any opensource PHP cryptocurrency exchange/marketplace

I'm not aware of any and I believe it's something hard to find, Because exposing PHP codes may lead to some critical exploits and vulnerabilities.


The actual stated development process can be found here. That said, there's become a rule where enough core developers need to "ACK" it like seen in this pull request.

Will there be a procedure for voting? If core devs feel it is safe, tested, useful, well written, match coding style, etc. then it gets merged into bitcoin. This is usually not easy and the bitcoin development archives and the numerous pull requests that haven't made any headway should make this obvious.

Will Sidechains get in? The big thing to note about sidechains is that at least a few of the core developers are actively working on it. This means they're going to try their hardest to get it in. So there's a better chance than most features people usually propose.

Do nodes vote? They can, of course, refuse to upgrade their bitcoin client to the new version that has sidechains, for example. That's entirely their choice. But actual getting into the bitcoind code, they do not vote on. People can and do, fork bitcoin and use that as their node (Luke-Jr and Eligius being the most prominent example)


Possible to restore an Electrum wallet with partial (12/13) seed?

There are only 2048 possible first words, if your other 12 words are correct, this guarantees that you will find the seed. Here is the list of possible words for English:

https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt

There is also a checksum involved in the seed, so it's possible to narrow down the list further if you can program a bit. Best of luck.


I also can't connect to that node. It simply seems like it is offline. Node explorers like 1ml don't keep track in Realtime if nodes are online. Did you talk to the owner of that node?


Will a channel be automatically closed if there's a expiring HTLC that doesn't have its own output in the commitment transaction?

If it's a mutual close, the HTLC will be resolved prior to closing of the channel. If the close is unilateral, then yes the HTLC which is below the dust_limit_satoshi cannot be resolved. When you are adding HTLC below the dust_limit_satoshi there is some trust element involved and hence we deduct the HTLC amount from our "balance" as a fee in the commitment transaction.

The bigger question at play is asking yourself why you are closing the channel unilaterally. There may be a number of reasons like peer is unresponsive, peer has fallen behind, or worse peer is trying to cheat. In such cases, protecting your balance in the channel is much more important than a couple of satoshis that might have been added below the dust limit.

Moreover, the fees that you will pay for unilateral close will also be higher than a mutual close. If the commitment transaction had a bunch of HTLCs, the fees from the transaction size will be much higher than the couple of satoshis that you might have added in form of HTLC that you have forwarded. So, when you broadcast the commitment transaction for the unilateral close containing HTLCs below dust limit, you will lose that much amount if you have forwarded the HTLC. Your peer will lose the HTLC amount (below dust) if it was the one that had forwarded the HTLC.


You just need to find some software that can import your private key.

These days, the standard for backing up wallets is defined by BIP32/39/44/49/84, and it comes in the form of a 12 or 24 word mnemonic seed phrase. This seed phrase is used to derive all keypairs and addresses in the wallet, so you just need to store it safely in order to recover your wallet later.

So most wallets accept a seed phrase, and inputting raw private keys has become less common (though it is definitely still possible). You just need some software that can accept a private key.

Note that in some cases, you may have to create a new wallet, and then import the private key to it— there may not be an option to create a new wallet by importing the private key alone.


The Bitcoin network confirms one block of transactions approximately every ten minutes. The blocks are produced in a random process by miners. Each miner may select their own set of transactions to confirm, and therefore whoever is successful at finding the next block determines which transactions get confirmed.

Since the blocksize is limited to 1,000,000 bytes, the number of transactions that can be confirmed per block is limited as well. Miners maximize their mining revenue by selecting the transactions first that pay the largest fee rate, i.e. the greatest amount of satoshis per byte of blocksize the transaction requires.

Thus, users are bidding with "transaction fees" for inclusion into a limited supply of blockspace. The network is "congested" when a lot of more transactions bid for inclusion than can find space in the blocks.

Multiple proposals to upgrade the network's capacity exist. Especially the segregated witness proposal has been production ready for several months and is waiting to be activated. Unfortunately, an insufficient portion of the hashrate is signaling readiness for its activation at this point in time.


The Bitcoin Core client stores private keys typically  in DER encoded format, at 279 bytes per key, for compatibility with older versions. There is no good reason for that though. For encrypted wallets, which are more modern, keys are stored using just the (encrypted) 32 byte secret plus the full public key. Compression is derived from the length of the corresponding public key, so it doesn't need to be stored separately.


How could the transaction have negative value of amount and fee ? Could this be the reason of that error "bad-txns-in-belowout"?

No, it is not. The negatives you see are normal; the values are actually positive, but because you are sending money away from your wallet, they will display as negative relative to your wallet.

That error means that the value of the inputs is less than the value of the outputs. You need to check that output 0 of 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b actually has the value that you want to spend.


What is Ripple and how does it compare to Bitcoin?

This is answered in the official wiki:

  Like Bitcoin:

  ripple is a distributed peer-to-peer payment network
  ripple transactions are irreversible, sent over the Internet, and counterfeit proof
  ripple uses the same underlying cryptography as Bitcoin
  ripple has multi-signature support
  ripple has low to no transaction fees
  ripple servers can be run by anyone

  Unlike Bitcoin:

  ripple can send any currency
  ripple can automatically exchange currencies
  ripple transactions are fully confirmed in seconds
  ripple allows nicknames and gravatar icons for accounts
  ripple's reference client is a Firefox and Chrome add on
  ripple has no block chain download, clients are ready in seconds
  ripple has no mining or direct monetary reward for running a ripple server
  ripple has no currency risk as people can hold whatever fiat they want
  ripple solves the double spending problem with consensus instead of proof-of-work


Can I view .bit domains without having internet through my ISP provider?

Unfortunately, no, the contents of websites themselves are not distributed by namecoin. There is something that is, though: For regular internet sites, your computer would first contact a domain name server with a query of what internet protocol (IP) address this site currently has. When using namecoin's .bit domain, all the information that usually originates at domain name servers on the internet instead comes from data distributed by the namecoin network across its clients.

So, yes, there is some data that is distributed and does exist locally if you run a namecoin client. But it will only give you some minimal metadata about the sites, not any of their content.


Can Bitcoin Core be made to display/enter amounts in USD or other fiat currencies?

No, this is not possible in Bitcoin Core. You will have to use a third party wallet software such as Electrum if you want this functionality.
There also isn't any standardized format for exchange rate APIs, so you will be limited to the exchanges that are already built into the wallet you select.


Under Withdrawal/Ripple there is a link named "trust this address".

(removed from here the address itself due to a good suggestion: don't trust what is written here, go there and have a look yourself)


How to transfer bitcoin bought online to my desktop wallet?

You can easily send your bitcoins from Coinbase to Electrum.

Once logged into Coinbase click on the Send / Request button on your left hand menu. A form will pop up asking for an email address or bitcoin address.

What you want to do is enter in one of your bitcoin addresses from Electrum. Open up Electrum and click on the tab labeled "Receive". You can pick any address that is listed there under Main Account > Receiving.  Pick one, copy it and paste it in the Coinbase form that asks for an email address or bitcoin address.

From there just complete the form and hit send. Your funds will now be transferred to the address on your Electrum wallet. Be sure to back up your wallet and seed. If your computer crashes/breaks and you don't have a back up YOU WILL LOSE ALL OF YOUR COINS.


Issue with getrawtransaction txindex and reindex

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

When starting the node, the following command should be issued

bitcoind -reindex=1 -daemon

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

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


A friend owes me cash, how can he pay that debt in btc?

You only have to do a simple transaction. You have to create an address (for example, this one (which is mine): 1CnCc2Dp35BZboHE8AZvoyrQXCFFaHUvTZ) and tell him to transfer Bitcoins to that address.

You dont have to pay anything for the transaction, but your friend need to pay the transaction fee.


Why is the Mastercoin Exodus address used in every mastercoin transaction?

This was a shortcut to easily identify all Mastercoin (now Omni) transactions. We considered removing it when we were concerned our transactions might be identified that way for censorship, but that never happened thankfully. If you list all transactions to 1EXoDus, you list all transactions in the Omni protocol.


I recently got mine locked because my YubiKey broke.

When you want to disable the YubiKey for your account, your account will be frozen for two weeks. I had my account information verified and still got locked.


How can OP_CHECKLOCKTIMEVERIFY be used to create outputs provably spendable by anyone?

Start by reading the whole sentence:

  CHECKLOCKTIMEVERIFY can be used to create outputs that are provably spendable by anyone (thus to mining fees assuming miners behave optimally and rationally) but only at a time sufficiently far into the future that large miners can't profitably sell the sacrifices at a discount.

In other words, CLTV is used to delay when an output can be spent, not to make it provably spendable by anyone. The latter is trivial: just don't have any signature checking operations in a script.


What is `modifiedfee` in mempool dump, how is it related to actual fee?

It is related to the prioritisetransaction RPC, which changes what fee a transaction has for the purpose of inclusion in blocks.

If you never use prioritisetransaction, the modified fee will always be equal to the real fee.


Bitcoin client won't connect to the network

You should get the best results if you port forward port 8333 to your laptop. It is also advised to leave your computer on for a long time the first time you connect to the network, as it has about 1GB of data to download and check. After that the operation should be easier.


If you have to update your Bitcoin core wallet you can just download the new version and open the new bitcoin-qt file.


What happens if 1-way functions no longer exist?

without modifications the current bitcoin system would simply be compromised.

it seems very likely all private-public key cryptography would be compromised as well, and society as we know it would change.

however, given unknown advances to begin with, there is always the chance that something entirely different could replace the current system of secrecy when it comes to trust.

there is also the possibity that no matter how many advances we get, 1-way functions might be impossible to completely break, or that we find new maths that guarantees breakage if any 1-way function but with a cost that is prohibitive.


mining difficulty is not changed on regtest

It worked. I needed to change some configurations.

change source code

// src/chainparams.cpp
consensus.nPowTargetTimespan = 14 * 24 * 60;
consensus.nPowTargetSpacing = 10; // 14 * 24 * 60 / 10 = 2016
consensus.fPowNoRetargeting = false;

https://github.com/bitcoin/bitcoin/blob/0.17/src/chainparams.cpp#L291

check the difficulty change

// initial difficulty
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest getmininginfo
{
  "blocks": 0,
  "currentblockweight": 0,
  "currentblocktx": 0,
  "difficulty": 4.656542373906925e-10,
  "networkhashps": 0,
  "pooledtx": 0,
  "chain": "regtest",
  "warnings": ""
}

// generate 2016 blocks
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest generate 2016

// check the difficulty
$ ./bitcoinA/src/bitcoin-cli -rpcuser=bitcoinrpc -rpcpassword=bitcoinrpcpass -rpcport=16591 -regtest getmininginfo
{
  "blocks": 2016,
  "currentblockweight": 4000,
  "currentblocktx": 0,
  "difficulty": 4.716464207201856e-06,
  "networkhashps": 1024.75,
  "pooledtx": 0,
  "chain": "regtest",
  "warnings": ""
}


Crypto-Trader.com Shut down. Did I loose all my Coins?

A similar type of event happened with Mt. Gox where users lost a total of 850 000 Bitcoins. Your Bitcoins are likely lost forever if the owner of the private keys does not agree to send them to you. However, you may be able to sue the exchange, but I am no legal advice. Take this as a lesson, to never keep a cryptocurrency on an exchange, it is very important to own your coins.


How do I install a specific version of bitcoin-core

If you're building from source, you can select a specific version as follows:

First, review the build requirements, dependencies, and instructions for your OS:

https://github.com/bitcoin/bitcoin/tree/master/doc

Once that is done, use git to pull the source code and select a branch:

## clone the bitcoin repository
$ git clone https://github.com/bitcoin/bitcoin.git

## change folders
$ cd bitcoin

## check which versions are available
$ git tag

## find your desired version in the list, and then 'checkout'
$ git checkout v0.x.x

## now you can build:
$ ./autogen.sh
$ ./configure
$ ./make
$ sudo make install

Once you have finished the install and booted up bitcoind, you can confirm the correct version of the client and daemon are running:

bitcoin-cli getnetworkinfo

bitcoind --version


How come the block reward keeps only getting halved but there is an upper limit for bitcoins in existance?

This is more a math question, but basically, the sum is a geometric series:

https://en.wikipedia.org/wiki/Geometric_series

1/2 + 1/4 + 1/8 + 1/16 + ... = 1

That's basically what's happening here except with 21 million instead of 1.


Question regarding the number of bytes in an OP_RETURN transaction

I found the answer on Wikipedia:

  One hexadecimal digit represents a nibble, which is half of an octet
  or byte (8 bits)

So two hex digits per byte. And a "nibble" for half a byte. I like that. :)


Is there are written code for mapping public address to an user?

You can write both of those queries in a way that takes nearly linear time and space.

Make a hash table that maps addresses to "neighbor addresses." A neighbor address is an address that was used as an input alongside another address. To find the addresses a user owns, query the hash table for the address. Add all of the addresses that are neighbors of that address. Recurse for all of the neighbors.
This can be created in O(n*k) time and space. (n = number of transactions, k = average number of inputs from distinct addresses per transaction)

Make a hash table that maps addresses to the block they were first seen in. For each address of each transaction, you check the hash table to see if it has been seen yet. If not, you create an entry for it, pointing to the current block and transaction. Then, while querying, you can quickly tell if a transaction contains addresses that have been seen for the first time.
This can be created in O(n) time and space. (n = number of inputs)

(It doesn't need to be a hash table specifically. Other approaches would work too.)


What does cache value signifies in UpdateTip log messages?

It's describing how much of the allocated UTXO cache you are using. You can adjust how much maximum memory Bitcoin Core uses for this and others with the dbcache parameter, the higher the limit in megabytes the higher the performance to a certain degree.


Why is a short blocktime considered to be unsafe?

The shorter the blocktime the more time is lost by the relaying of blocks in relation to the average blocktime. A very short block interval therefore makes SPV mining (i.e. mining empty blocks without transactions) more attractive, and increases the advantage of large pools, because they can start mining on top of their own block the quickest.

Additionally, it increases the number of headers that need to be verified and stored by any client, even smartphone wallets.


When does OpenCoin Inc intend to make the Ripple server code public?

We have publicly stated that we don't expect the code to be made publicly available in less than two months and that we would consider it a failure if we didn't make the code publicly available before the end of the year.

Right now, we've received a lot of public feedback and are trying to make changes responsive to that feedback. See this github issue for an example. It will be very hard to make significant changes after the source code is public.

(I'm an employee of Opencoin and one of the designers of the Ripple payment network. I'm speaking only for myself.)


I found this on a Quora. Hope it helps.
Property
Pro:
It is eligible for long-term capital gains tax treatment, if held for more than one years (which is a huge benefit). The US has very favorable capital gains taxes.
Con:
Every purchase made with bitcoin will be a capital gain or a capital loss that must be tracked, even if the purchase price is denominated in bitcoin.
Currency
Pro:
Money spent with bitcoin on bitcoin-priced goods & services would not give rise to a separate taxable transaction. Theoretically one could benefit from bitcoin appreciation and never be taxed upon that appreciation.
Con:
Conversion of bitcoin to other currencies would give rise to taxable income, if a gain occurs, and losses would be unrecoverable (for individuals).

I think coin.dance (your link) is not 100% up to date.


I've been reading about "loop in" and it seems to be like a one-way offline channel, is that correct?

I would not recommend the notion of a one way offline channel. Historically one way channels could have been build for a long time by offering new signatures for spending an output of a 2-2 wallet to the 2nd party in which more and more btc of the consumed input are given to the 2nd party. The second party naturally has an incentive to publish the latest of such tx.

Loop is more like a submarine swap. With loop in you request to get some balance on a payment channel to your side.

Let us assume you have a payment channel with 0.1 btc capacity but all the money is on your partners side. However you would like to add some funds to your side without rebalancing your channels or opening a new channel.

In order to achieve that you could create an invoice with a payment hash. A person might be willing to pay that invoice on lightning if you reimburse that person on chain. The question that loop solves is to make this process trustless.

You make an onchain btc tx to that person but encumber a second output which goes back to you with a timelock. The output that can be claimed by that person can only be claimed if the preimage of your payment hash is presented. This works directly before the timelock expires.

Now there are two cases. Either the person pays your invoice and receives a preimage and can be sure to get reimbursed. Or if the person does not pay the invoice you can reclaim your btc after the timelock. Noone needs to trust the other side.

What I don't know is if trezor allows to sign such a timelocked / special transaction and how the trezor api works. However I don't see any reason why it would not support signing such a transaction.


Do I have to try to mine bitcoin in order to verify peoples transactions?

Verifying the validity of transactions is not the same as mining. Verifying transactions means that you are just running a full node; mining is taking those transactions and putting them in blocks so they are committed to the blockchain. You can run a full node and verify transactions, but you won't get compensated for it. Only miners can earn money as they are spending the energy and work required to generate blocks.


Can Litecoins be traded directly to Bitcoin?

Yes, if you find an exchange or person that will accept the trade. Various major exchanges offer the LTCBTC trading pair. Also, there are a few coin swap products out there. I'm not writing any names because I've never used them. Shouldn't be hard to do an Internet search for those services and apps.
If you are asking about an on-chain exchange, that has been done too. The search term is atomic swap (Lighting Network).


Spending unconfirmed output from a change address

You are technically able to do this but it is strongly not recommended. A transaction can spend the output of another transaction so long as the parent transaction is known by the node in question, however this is quite fragile.

Bitcoin transactions back reference by TXID, a cryptographic hash of the previous one being spent. Due to a property known as transaction malleability it is currently possible for this TXID to change spontaneously when it it broadcast through the network, due to some nodes running custom code which mutates transactions in specific ways. If you build a long chain of unconfirmed transactions and one early on is mutated, all subsequent transactions can suddenly appear to spend outputs which don't exist anymore and are effectively invalidated. It's difficult to produce safe software which can handle this situation with this as there's a lot of edge cases that need dealing with.

If you need to make a number of payments to many parties in a short period, many large providers will split their outputs up ahead of time to avoid ever needing to spend unconfirmed change. When they receive a 100 BTC output they might break it into four 25 BTC chunks paying themselves, which will allow them to pay four people when required without needing to ever attempt to spend unconfirmed change. Some delicate balancing is required here, if you have too many outputs in your wallet the fees increase dramatically and the software will become slow.


I verified the keys on https://bitcoinpaperwallet.com/bitcoinpaperwallet/generate-wallet.html?design=alt-testnet#, and choose testnet on the first tab, and then the second tab (print front). They match, so good. Then I tried to decompose your line, where you say it is the signtransaction call. This seems to me unsigned:

 TX_IN[0] Script Sig (uchar[])
  210340165231215A98E7A32ABCE9D410ECD09AC505938B25F9451DEFA051D591EBF8AC
  ##################################################################
  ### tcls_in_sig_script.sh: decode SIG_script OPCODES from a TX ###
  ##################################################################
    21: OP_DATA_0x21:     type tag indicating LENGTH
    03: OP_INT_0x03
        40165231215A98E7:A32ABCE9D410ECD0
        9AC505938B25F945:1DEFA051D591EBF8
        AC
    * This terminates the Public Key (X9.63 COMPRESSED form)
    * corresponding bitcoin address is:
   mvVWbgb3sZeEz495eDoaem79Qi876zuG9S

whereas the second line (manual) looks good:

 TX_IN[0] Script Sig (uchar[])
  483045022100D6E538AA819F3162D5C6A0E4D9EE0323395DF89E943C769D96AE939BAEC5C6920220083A311CB35DF3C98D7A6BD0BC80D98A71FBDF8E325BA908EA4B721A4EAC8BB301210343395A6E84C7F2B1D50C11F96783664A6F04D66B51BEFB3BEFCC57334E2A9ABC
  ##################################################################
  ### tcls_in_sig_script.sh: decode SIG_script OPCODES from a TX ###
  ##################################################################
    48: OP_DATA_0x48:     push hex 48 (decimal 72) bytes as data
    30: OP_SEQUENCE_0x30: type tag indicating SEQUENCE, begin sigscript
    45: OP_LENGTH_0x45:   length of R + S
    02: OP_INT_0x02:      type tag indicating INTEGER
    21: OP_LENGTH_0x21:   this is SIG R
        00D6E538AA819F31:62D5C6A0E4D9EE03
        23395DF89E943C76:9D96AE939BAEC5C6
        92
    02: OP_INT_0x02:      type tag indicating INTEGER
    20: OP_LENGTH_0x20:   this is SIG S
        083A311CB35DF3C9:8D7A6BD0BC80D98A
        71FBDF8E325BA908:EA4B721A4EAC8BB3
    01: OP_SIGHASHALL:    this terminates the ECDSA signature (ASN1-DER structure)
    #########################################################
    ### procedure to strictly check DER-encoded signature ###
    #########################################################
    Minimum and maximum size constraints                        - ok
    scriptsig always starts with 0x30                           - ok
    length 138 chars is less than actual sig length (144 chars) - ok
           (hex 0x45, decimal 69, 138 chars)
    length of R coordinate (66) >= 0                            - ok
    length of S coordinate (64) >= 0                            - ok
    S-Value is within scriptsig boundaries                      - ok
    Make sure the R & S length covers the entire signature      - ok
    S-value must be smaller than N/2                            - ok
    strictly check DER-encoded signature                        - ok
    #########################################################
    21: OP_DATA_0x21:     type tag indicating LENGTH
    03: OP_INT_0x03
        43395A6E84C7F2B1:D50C11F96783664A
        6F04D66B51BEFB3B:EFCC57334E2A9ABC

    * This terminates the Public Key (X9.63 COMPRESSED form)
    * corresponding bitcoin address is:
   mmEXEzUGcMmmiLsfxxM8gB8TQSTkuR1drf

so also all DER checking of the siggnature is ok. However I see the address being different, effectivly it is the output address, isn't it?
Maybe you mixed up some addresses while signing manually?
What is the address you are spending from?


Could bitcoin/blockchain be used to create a secure non-3rd party escrow?

I would think it has been asked several times, but not in this detail. The way to use escrow would be a „2 of 3 multisig“ transaction. A search in the forum reveals a lot of links. Also very useful is the wiki and of course the bitcoin.org webpage. There are even wallets providing multisig functions. But still it is not „an easy usecase“. Data has to be exchanged between the parties, and as far as I know, there is no protocol specified. So it is still possible to make errors and loose funds :-(

Oh, and then there is Andreas‘ book „Mastering Bitcoin“, which explains even more escrow (3 of 5 combination). Worthwhile to read, and also online available.


UpdateTip logs appear in debug.log unsolicitedly

Turn out the validation.cpp is performing many checks and they use LogPrintf() instead of logging tag.

So by default the debug.log always include them.


There are multiple ways in which you can update Bitcoin Core to the latest version. Each one has its own advantages and disadvantages:

Build from source code: You can always update your software by cloning the git repository. This way you can verify the code and build the binary yourself. However, it is a resource intensive task and you will need to compile it every time a new version is released. It is also the slowest of the update options.
Update using pre-built binaries: Bitcoin Core developers build the binaries inside a deterministic build environment and sign them for verification. You can just download these binaries, verify their signature and replace the old binaries with it. This is a better, easier and the most preferred way to update.
Update using a third party PPA: You can use third party packages like the Bitcoin PPA for Ubuntu. It is the easiest method to update Bitcoin Core however, it involves trusting the launchpad and the PPA owner. Moreover, I'm seeing that the PPA does not offer the latest versions (latest release available is v0.18.0; so it's missing v0.18.1 and v0.19.0.1).

Updating using prebuilt binaries:

Visit the Bitcoin Core Download page and choose the operating system for which you want to download the pre-built binaries. After downloading the main file, click on the the verify release signature to download the signatures associated with the hosted file. Ensure that you check that the release signature is correct so as to be sure that you have downloaded the correct file. Read more about why signature verification is essential. Below are the steps for Ubuntu.

# Download the binaries for Ubuntu OS
$ wget https://bitcoincore.org/bin/bitcoin-core-0.19.0.1/bitcoin-0.19.0.1-x86_64-linux-gnu.tar.gz

# Download the signature file
$ wget https://bitcoincore.org/bin/bitcoin-core0.19.0.1/SHA256SUMS.asc

# Verify that the hash of the downloaded file matches the hash in the signature file
# This ensures you have downloaded the correct file for which the developers have signed
$ sha256sum bitcoin-0.19.0.1-x86_64-linux-gnu.tar.gz
732cc96ae2e5e25603edf76b8c8af976fe518dd925f7e674710c6c8ee5189204  bitcoin-0.19.0.1-x86_64-linux-gnu.tar.gz

$ cat SHA256SUMS.asc | grep bitcoin-0.19.0.1-x86_64-linux-gnu.tar.gz
732cc96ae2e5e25603edf76b8c8af976fe518dd925f7e674710c6c8ee5189204  bitcoin-0.19.0.1-x86_64-linux-gnu.tar.gz

# Verify the signatures. If you have not imported the signature, you would need to do so for verification
# The key is mentioned in the box: "Bitcoin Core Release Signing Keys v0.11.0+ 01EA5486DE18A882D4C2684590C8019E36C2E964"
$ gpg --recv-keys 01EA5486DE18A882D4C2684590C8019E36C2E964

# After importing the key you can now verify the release. You should get the below result.
$ gpg --verify SHA256SUMS.asc
gpg: Signature made Sun 24 Nov 2019 09:14:42 AM UTC
gpg:                using RSA key 90C8019E36C2E964
gpg: Good signature from "Wladimir J. van der Laan (Bitcoin Core binary release signing key) <laanwj@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 01EA 5486 DE18 A882 D4C2  6845 90C8 019E 36C2 E964

After verifying the result, you can extract the file and copy-paste the binaries. Mostly the binaries are in /usr/bin/ or usr/local/bin file. You can check it for Bitcoin by running the command: which bitcoind.

Build from source code:

You can remove the existing binaries and build the code from source. You can follow the following commands on ubuntu:

$ git clone https://github.com/bitcoin/bitcoin.git
$ cd bitcoin
$ git checkout v0.19.0.1
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

While running the ./configure step, you can enable or disable certain features of bitcoind through the use of --enable-FEATURE and --disable-FEATURE flags. You can run ./configure --help to check the features available.

Update using third party PPA

If you have installed Bitcoin using third party PPA, then you can just run the command sudo apt-get update.


How the Bitcoin community will handle attacks on a Client's code?

FYI since BTC mining became so prohibitively expensive due to use of ASICs 1 51% attack could be pulled off at any time by BTC Guild. Their listed % is just under 50% at ~48% but I find it hard to believe they aren't sitting on >51% mining power. See the problem is every client is meant to be able to mine making large conglomerates like BTC Guild impossible.
This could very well be the end of BTC since you've got no change at all of mining BTC using anything but an ASIC pool.


Can ISP intercept network messages to identify the IP of the transaction issuer?

That is right. If you want to obtain more anonymity you could install Tor and use the -tor command-line option when starting bitcoind to connect to the network through a (safe) Tor circuit. I believe this is discouraged however unless it is absolutely necessary, because Bitcoin will not automatically create a hidden service for node connection. This means that nodes can not connect to you, but you only to nodes and if everybody did this the network would not function. (could someone provide a source in a comment please? I'm pretty sure I read it but the link is dead).

Alternatively you could make use of the local library computer facilities, McDonald's WiFi (keep in mind that government authorities can request this data and that it WILL be given to them, make sure your laptop is anonymized as much as possible, with Tails for example) or establish an encrypted connection to a VPN.

Further reading:

Running Bitcoin - the Bitcoin wiki
Tor - the Bitcoin wiki
Tor design paper


How to check two hashes are equal using block data and the nonce?

I wrote a python program to calculate the block hash from the version, prev_block, mrkl_root, timestamp, bits, and nonce. You can see it here.


No, difficulty is a network-wide consensus rule. POW mining helps solve the issue of sybil attacks, whereas your idea opens up mining to sybil attacks:

Your idea would create a level playing field for all devices (regardless of computing power), so if I want to expand my mining operation, I would just want to run thousands of mining nodes. Hardware doesn't matter, so I could just use cheap computers, or better yet, a botnet. The more nodes I can make, the better!

Additionally, how can you be sure nodes aren't lying about the hashrate available to them? How can you be sure a user hasn't rewritten the source code of their client to artificially lower the difficulty? Etc.


Would it be possible to add an RPC call to be able to determine if a node is fully synced?

Existing Methods
The Bitcoin client does have a way of detecting if it is not sufficiently synchronized. However, to my knowledge, it's not really exposed to RPC in a nice way.
It's called IsInitialBlockDownload(), and it will consider itself not synchronized if any of the following are true:

The client is importing from bootstrap.dat or reindexing the blocks it has.
The client has not reached all of its block checkpoints.
The client has received and verified a block in the last 10 seconds AND that block has a timestamp of more than 24 hours ago.

You can call getblocktemplate, and if IsInitialBlockDownload() is true, it will come back with an error of RPC_CLIENT_IN_INITIAL_DOWNLOAD (or -10).
Drawbacks

If your Bitcoin node is down for less than 24 hours, this won't detect anything wrong when it comes back up.
It's a bit ugly.
When your client gets within 24 hours of the current block, it'll think it's up to date, when it probably needs to get ~144 blocks.
If your client stops downloading blocks while it's still synchronizing, this won't detect anything wrong.

New RPC call
Let's suppose that we're designing a new RPC call from scratch. As other posters have noted, it's not possible to determine this perfectly in the presence of malicious actors. What factors could we measure to make an educated guess?

Node uptime. Has the node been up for at least five minutes?
Node downtime. Has the node been down recently? If so, take the amount of time that it was down, and divide it a thousand. If your node has not been up at least that long, then it is not synchronized.
Block timestamp. The network is fairly liberal about enforcing this rule, but my unscientific guess is that it's usually within half an hour or so. You could use this information in a similar way to how IsInitialBlockDownload() does.
Block height of central node. This is the "Look at blockheight of blockexplorer," solution mentioned in the other question.
Your method would probably work. The only issue I can think of is that if you connected to another node that was still syncronizing, you'd fail to fail.


I dont know which api you are talking about , but i am this much sure that ones your transaction is minned and updated in block you cannot revert it or refund it. Blockchain data is immutable. If you want to restrict your client form sending low or high then you have to use some business logic on backend of your code also using JS logic on front end when user inputs the value will help you alot


How do I get the scriptPubKey type from the raw output script?

Internally, Bitcoin does not have the concept of scriptPubKey type. To the system, scriptPubKey is simply a mathematical equation into which some bitcoins have been locked (UTXO) and the spender must satisfy the unlocking conditions, which most of the times are the signature(s) and public key(s), in order to spend those bitcoins. These basic construct can be used to build higher level concepts like the scriptPubKey type that you are referring in your question.

Since Bitcoin is a programmable money, a user can lock their bitcoins in a number of different ways. The Bitcoin community has accepted certain output types as standard locking scripts. Below are some of the standard output scripts (scriptPubKey) that can be used to determine the script address type (main net address types have been used):

Pay to Public Key Hash (P2PKH): In this type of script, the bitcoins are locked in the hash of a public key. The output script will look like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "OP_DUP OP_HASH160 243f1394f44554f4ce3fd68649c19adc483ce924 OP_EQUALVERIFY OP_CHECKSIG"
    "hex": "76a914243f1394f44554f4ce3fd68649c19adc483ce92488ac",
    "reqSigs": 1,
    "type": "pubkeyhash",
    "addresses": [
      "14JetYAhLevTRaePcAAX1vRMwaJt2QGRzp"
    ]
  }
}

Pay to Script Hash (P2SH): In this type of script, the bitcoins are locked in the hash of script. The script can be a multi-sig output, time-locked output, P2SH-P2WPKH (SegWit address in P2SH format) and others. The output script looks like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "OP_HASH160 243f1394f44554f4ce3fd68649c19adc483ce924 OP_EQUAL"
    "hex": "a914243f1394f44554f4ce3fd68649c19adc483ce92487",
    "reqSigs": 1,
    "type": "scripthash",
    "addresses": [
      "34zfp5f8tZEqWkLpjFq7SYnJ66bbdaTmt"
    ]
  }
}

Pay to Witness Public Key Hash (P2WPKH): In this script, the bitcoins are locked in the hash of the public key, but follows SegWit. The leading 00 indicate that it is SegWit version 0. The output script looks like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "0 eb308eb99tb8ff3797d2e5cfb33a9231700d6195"
    "hex": "0014eb308eb99tb8ff3797d2e5cfb33a9231700d6195",
    "reqSigs": 1,
    "type": "witness_v0_keyhash",
    "addresses": [
      "bc1qavcgawvmerln097juh8mxw5jx9cq6cv46xmzxk"
    ]
  }
}

Pay to Witness Script Hash (P2WSH): In this script, the bitcoins are locked in the hash of a script, but follows SegWit. Similar to P2SH, the redeemScript can be a multi-sig output, time-locked output, etc. The leading 00 byte indicate that it is SegWit version 0. Below is how the locking script looks like (your example in the question):

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "0 e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122"
    "hex": "0020e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1quvc8arstvv898sh3lqtsv77wq8zr3y5r8cpzmt04a90nr05fky3qwnkvta"
    ]
  }
}

Pay to Public Key (P2PK): This type of output script pays the public key directly. Note: Although currently Bitcoin Core shows an address starting with 1 for P2PK, it is an error that will be rectified in the next release of Bitcoin-Core. Below is how the output script looks like:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "02d2a6892c51741f83759088d9eed12c2c52eea9b999ecc36af1cb569b733b6ff1 OP_CHECKSIG"
    "hex": "2002d2a6892c51741f83759088d9eed12c2c52eea9b999ecc36af1cb569b733b6ff1ac",
    "reqSigs": 1,
    "type": "pubkey",
    "addresses": [
      "1FK1FmLuTY19JGdb9SsKHs68HxRD69jtc1"
    ]
  }
}

As I said earlier, bitcoins can be locked in any allowed operator operations. However, if the output script does not belong to the above five types, the output script will be non-standard and you will see the type as "nonstandard" in the scriptPubKey field.


How can I verify that an arbitrary transaction contains a
human-readable signature?

There is no such thing as "human-readable signature". The signature is just a very big number. Or we can treat it as a pair of very big numbers. Usually we encode it in hex, so it looks like 3044022007ae5e36b79303f992e153798061458b435d34285c5fddc20655451ac71b49f6022079421d162cad51db0daa0a934cbf5261d4b53f185604e9790094a49145f3812f01

Which information of the transaction data should I use to obtain a
human readable form of the transaction signature?

Input scripts

Which online resources could be used to verify a signature?

Google for "ecdsa verify signature online". But I am not sure that these resources are suitable to verify bitcoin signatures.


How to use electrum RPC to get address balance on windows

Turns out that electrum doesn't have to be in daemon mode to receive api requests, but it has to be in daemon mode before it supports them.


Compiling bitcoin-qt error: ld.exe: cannot find -lsecp256k1

Problem resolved !
There was an error during the secp256k1 compilation process (MINGW32 under windows), adding:

  LT_INIT([win32-dll])

into the secp256k1/configure.ac has resolved the compilation error.


How do I restore use of my wallet.dat file, last used in 2013?

In any case, is there anything preventing me from just installing Bitcoin Core and replacing the default wallet.dat to recover my backed-up wallet? What is the recommended way to recover such an old wallet.dat file?

You can do just that. In fact, that's exactly the way to restore a backup.


Connect Trezor (T) directly to a printer to generate paper wallets

It is a feature that this is not possible. You do not want to use a printer to print paper wallets as this is highly insecure.
Printers have a track record of having low security - so people can hack the printers - wait for it to print something that looks like a private key and send them home(not yours).
Also some printers have build-in hard drives that save every document printed - so there are also attack vectors where the printer does not need to be compromised before printing.
Also have a look here: https://events.ccc.de/congress/2011/Fahrplan/events/4780.en.html
https://media.ccc.de/v/28c3-4780-en-print_me_if_you_dare


blockchain.info receiving address changes - is it OK to put BTC address on the website?

I'm not sure from blockchain.info because its a wallet.

You should use an address that you have to download to your computer and use a keystore file with password. No one has the keystore file or password so it'll be safe.

Try:
https://bitcoin.org/en/download
and there are many others.

You're using another company and if they go out of business (I doubt blockchain.info would ever) then you may lose your coin.


Wallet.dat (<0.4.0) format: retrieving Bitcoin, possible security concerns

Using wallet /import

If you load the wallet file in a modern Bitcoin Core version, you can use the dumpwallet command (to create an unencrypted dump of the keys), and the importwallet command in a fresh instance with a new empty wallet.dat of the dump. You will need to rescan afterwards, though, which may take a while.

Make sure to wipe the dump file afterwards.

Using db dump/load

One way is to use the following command on a Linux install with db4.8-util installed: db4.8_dump wallet.dat | db4.8_load wallet.dat.new

This will create a new wallet.dat.new file, with the same records as the wallet.dat file, but without any old potentially never-overwritten data.

db4.8-util may be hard to install these days, as most distros stopped distributing db4.8, in favor of 5.1 and later. Bitcoin Core however still uses 4.8 for compatibility reasons. You can use db5.1-util as well, but that means that you'll need a Bitcoin Core version compiled with db5.1 support afterwards to use the newly constructed wallet file.


What would happen if the BTC price collapsed and the reward for mining dropped below the cost of mining?

The block reward is composed of two parts, the block subsidy and the transaction fees. While the block subsidy is fixed respective to the height of a block, the transaction fees are a product of the blockspace market. If Bitcoin's exchange rate dropped precipitously, the profitability for miners would drop of course. Since each miner has a different situation, it would not be just one spot at which every operation suddenly becomes unprofitable, but rather a range, though.
As the exchange rate drops, some miners would stop mining. This would reduce the block cadence. Then, as transactions get processed more slowly, we'd see feerates of unconfirmed transactions go up as users vie to be included in the next block. Between the added revenue from transaction fees and the immense hardware investment miners have fronted, hopefully there would be enough incentive for some miners to continue mining. Then with the next difficulty adjustment, the difficulty would drop and mining profitability would increase again, likely causing some of the miners that had paused their operations to return.
Note that it would not take 2016 blocks for the first difficulty adjustment in most cases, as the exchange rate could drop at any point in a difficulty epoch. If the hashrate dropped significantly in the middle of an epoch, the first difficulty adjustment would likely not reflect the full drop, though.
You can see a similar effect around halvings: after the block subsidy dropped from 12.5 BTC to 6.25 BTC on May 12 2020, the difficulty dropped by 6.0% and 9.3%  in the two following adjustments.


Where can I find examples of Node JS code for P2SH transactions (funding and spending)

bitcoinjs-lib has examples for multisig P2SH, single-key Segwit wrapped in P2SH, and multisig Segwit wrapped in P2SH.


Why is it harder to compute nonce for a hash with a certain number zero prefixes than it is for any other hash?

A hash is 256 bits long, so there are 2^256 possible hashes in the hash space. But if you assert that the hash has to begin with a 0, that halves the number of hashes that are allowed (and thus doubles the average number of hashes you need to test), and if you say it must start with two 0's, that's now only quarter of the hash space that is valid. The difficulty of finding a valid hash thus grows exponentially with the number of 0's you require at the start.

But as you said, because the hashes are uniformly distributed, there is nothing unique about requiring the hash start with x number of 0's. Requiring the hash to start with x number of 1's would be the same, as would any specific sequence of 1's and 0's be. 0's are just a nice choice and make sense in practice, because like you said, you are then computing a hash less than a specific number.

Just to point out the terminology difference by the way, it's not targeting a specific hash, it's targeting a specific subset of the possible hashes. To find a specific hash would mean SHA-256 is broken, because you are basically reversing the hashing operation.


Miner's address is in the coinbase tx that is included in the block. See Whats the process of Creating a Block on the BlockChain


publicly available json-rpc node for bitcoin-cli connection

There is a free bitcoin-cli sandbox at bitcoindev.network:

  Here is a simple sandbox environment for trying out the bitcoin command line interface! Select Start Scenario to bootstrap your own private instance!

You can check out the on-line sandbox here:

https://bitcoindev.network/bitcoin-cli-sandbox/

Simultaneously they provide a docker container for it, so your students can go up & running with their own daemon in a blink of an eye.


What is the key differences between bitcoin-qt, bitcoin-cli, bitcoind, bitcoin rpc, and daemon?

All of those things are part of the same program, Bitcoin Core.

bitcoin-qt: The GUI version of Bitcoin Core. Most users will use this as it provides a nice Graphical User Interface that uses the Qt framework. It does all of Bitcoin Core's functionality, including being a full node and handling your private keys and transactions.

bitcoind: The Bitcoin daemon. It is the version of Bitcoin Core which can run in the background. It still does all of the full node and wallet things that bitcoin-qt does but is harder to access. bitcoind is primarily used for machines without a GUI (e.g. headless server). It can be accessed and interacted with using the JSON-RPC protocol.

bitcoin-cli: A tool that you can use to interact with bitcoind. It speaks the JSON-RPC protocol that bitcoind uses and lets you send commands to bitcoind and get the results back.

bitcoin-rpc: The Bitcoin Core RPC server. This is part of bitcoind and bitcoin-qt (it must be set explicitly to be enabled in bitcoin-qt). This is the interface that bitcoin-cli interacts with.

daemon: A daemon is any service which runs in the background. bitcoind is a daemon, and so are many other software which run in the background and have no GUI.


Freelancer.com-like website but based only on BC payments using some sort of escrow-like system to make sure that employer has enough money?

Such projects are possible with Bitcoins. Generally, what you can do with money, you can do with Bitcoins.

Escrow services in Bitcoin were popping up every now and then in the earlier days of Bitcoin, but I don't recall any of them becoming too popular. However, setting up an escrow-like service should be fairly simple. If you need some help, you can drop me a line ;).


Go to your Bitcoin data directory
Backup your wallet.dat to a safe location
Move your wallet.dat away from the data directory
Start Bitcoin. It will create new wallet.dat
Get an address from the new wallet, save it in notepad
Encrypt the wallet with some passphrase you will remember for a long time
Turn Bitcoin off
Go back to your Bitcoin data directory
Take the new wallet.dat and store it somewhere safe
Move your old wallet.dat file back into the data directory
Run Bitcoin again.
Send 8 Bitcoins to the address you saved in notepad

Now you have two wallet files - one with 2 bitcoins for your normal use, one with 8 bitcoins for keeping them safe. Just make sure not to lose either of the two wallets, or you'll lose your coins.

Keep your wallet.dats backed up and don't run duplicates at the same time.


Probably encrypted using an OpenSSL-interoperable format. See

https://crypto.stackexchange.com/questions/8776/what-is-u2fsdgvkx1/8777#8777

http://juliusdavies.ca/commons-ssl/pbe.html

The 8 bytes following "Salted_" should be the salt.

Example cmdline to decrypt:

echo 'U2FsdGVkX19qplb9qVDVVEYxH8wjJDGpMS+F4/2pS2c=' | openssl enc -a -d -salt -des3 -pass pass:changeit
Hello World!


cant see bitcoin after restore of backup

Try running bitcoin-qt with the -rescan argument.


Starting out with Armory - can I make it go faster?

Unfortunately there is no solution for that.
You could try to download the blockchain externally but, it's not recommended given that you would not verify if the content is legit.
Take a look at a specific topic related to your question
https://bitcointalk.org/index.php?topic=1310261.0


Yes. Thats possible. I wrote a python program that returns the supply at a given block (works with future supply, too):

#!/usr/bin/env python
# -*- coding: utf8 -*-

def btcSupplyAtBlock(b):
  reward = 50
  supply = 0
  y = 210000 # reward changes all y blocks
  while b>y:
    supply = supply + y * reward
    reward = reward / 2.0
    b = b - y
  supply = supply + b * reward
  return supply

block = 514227 # you want the supply after which block?
print(btcSupplyAtBlock(block))

supply at block 0: 0
supply at block 100,000: 5,000,000
supply at block 514,227: 16,927,837.5
supply at block 1,000,000: 20,187,500


What programs, websites or other applications leverage Mt Gox's API?

Not sure of any official list but here are a few that I've found

Github Repos

bitfloor books
bitcoin-arbitrage
metabit
mtgox-node.js-client

Websites

bitcoin charts
bitinstant


Why are the mining rewards set to reduce in such dramatic steps?

It`s a geometric series with the base 1/2. After half of the remaining coins are mined, rate is decreased until half of remaining coins since the drop are mined.

The rate is convergent, that is, it approaches a finite number and doesn't go on until infinity (like say, 1, 1/2, 1/3... 1/n would). This makes it so that there will never be more than certain amount of Bitcoins created.

As for why it is so dramatic, probably for the ease of calculating whether the block is correct. If you would have some complicated way of calculating the reward some of the coins might be lost due to rounding error (below 1 Satoshi), and different (non-official) clients might have issues with calculating the result effectively. Moreover, these sudden decreases in amount of coins generated probably will increase the worth of Bitcoins.


Gear/approach to legimitately mining (not buying) a single Bitcoin

Bitcoins aren't mined individually; they're awarded to miners who discover a block.  This process is like a race that restarts every ten minutes when a new block is mined (the miner gets a block reward plus transaction fees).

In order to have a shot at winning these races, mining operations use expensive arrays of custom hardware.  So, without that, you would have a pretty slim chance of discovering a block before one of them did.


What is wrong with my ScriptSig? I get 64: scriptsig-not-pushonly

Your signature is not correct. First of all, its length can't be 74 bytes long. According to the Bitcoin wiki:

  Signatures are either 73, 72, or 71 bytes long, with probabilities approximately 25%, 50% and 25% respectively, although sizes even smaller than that are possible with exponentially decreasing probability.

Having said that, it seems that you have computed the length of the signature wrong twice. First, what you decoded as the DER signature is not 74-byte long, but 72:

sig = "304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f98"

len(sig/2) = 72

Moreover, you didn't count the hash flag as part of the signature length, and you should. That will add an extra byte, making the signature 73-byte long.

Putting all together, the script should be:

ScriptSig = 49304602210090c4fc2369cf225559c1141a1e9be3d7598f0fb7affe8a29f86e737972c7587a022100cbd8619ecae3baa40fdb565014fdac28a95deb90c0fcd4adcbd97d58d0e96f9801410442718de90a0a10f0cd10054ff4ab6037fd230c5d4b50c07eed0bc247e1e3dbd9ad3f4c65680396813bd96b0c2db5647e355082db34c7106a74337d51e5730f45

Finally, notice that, according to what @pebwindkraft told you in his answer, you are producing high-S signatures, so you should also work around that.


Why does Electrum include seemingly unnecessary inputs in a transaction?

Electrum used both UTXO, even if only one was needed, to protect your privacy albeit at the expense of higher fee.
This is from the Electrum source code and explain this choice:
Attempts to better preserve user privacy.
First, if any coin is spent from a user address, all coins are.
Compared to spending from other addresses to make up an amount, this reduces
information leakage about sender holdings.  It also helps to
reduce blockchain UTXO bloat, and reduce future privacy loss that
would come from reusing that address' remaining UTXOs.
Second, it penalizes change that is quite different to the sent amount.
Third, it penalizes change that is too big.

This looks to me as though I can make the same transaction and incur a
smaller fee by using "coin control". Am I missing something?

No, you are right, if you wish focus more on fee minimization instead of privacy, you can achieve better result doing so manually than rely on the Electrum coin control policy.

Is there a disadvantage or risk to doing this? I'm thinking there must
be, otherwise Electrum would just do it automatically

There are multiple goal you may want achieve with a coin selection strategy and there is no one strategy that solves all problems, so wallets adopt different strategies depending on their priorities; but these strategy are meant for unskilled user or user that don't care these things (eg. the Coins tab is hidden by default on Electrum)... If you know how bitcoin transactions works and what UTXO are, probably you prefer do your own coin selection manually based on the needs of a specific transaction.


will be stored only after any transactions occur ?

Wallet addresses are not technically seen in the blockchain until they are used in a transaction, but that does not mean that they have not been generated/belong to someone. A Bitcoin "address" is derived using the public key (and the public key is derived from the private key, using ECDSA) and are really used for simplicity and readability through Base58 encoding (imagine needing a user's full 32 byte public key!).

A private key can be used to derive a public key and likewise the public key can be used to derive an address. Due to the nature of hash functions/ECDSA, these values are "computationally infeasible" to reverse. Meaning you cannot take the address and obtain the public key nor can you calculate the private key given the public key.

As the wiki states:

  A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. Using public-key cryptography, you can "sign" data with your private key and anyone who knows your public key can verify that the signature is valid.

Anyone with the private key necessary to meet the spending condition (scriptSig) of a transaction will have the means to spend it's output(s).


Wants to send my bitcoin to another wallet

The address you have is a watch-only address, meaning you can only watch it, but not send it without the private key. The private key is something you HAVE TO have in order to send it.

It's 32 bytes in size and starts with a 5


What's the default strategy miners employ when they select txs from their pool?

You are correct, it is infact equivalent to knapsack problem. To the best of my knowledge most miners simply sort by fee and this gives a good approximation for optimal solution.
A couple of things of things to highlight how difficult the transaction slection is:

1) Knapsack problem as you pointed out.

2) But even if the constraint in knapsack were removed(i.e infinite blocksize), still calculating optimal fees is NP hard problem.

  Transactions also have dependencies and conflicts. We’ll take
  conflicts first, which come from the prohibition on double-spending.
  We’ll also make the problem considerably easier by ignoring the block
  size limit and assuming all transactions have a constant fee. If
  transactions B and B’ both claim funds from transaction A, then only
  one of B and B’ can be published and we say they conflict. If this is
  the only constraint, we can simply draw a graph of all transactions
  with edges between transactions which conflict. The miner’s task is to
  find the largest set of vertices (transactions) with no edge between
  then (no conflict). Solving this is exactly the maximum independent
  set problem. (Source)

I presume the double-spend instances are rare and so are dependant transactions(child pays for parent known as CPFP). Therefore, my best guess is that simple greedy algorithm(taking CPFP into account) is close to optimal. Furthermore, there is also the tradeoff of time complexity which is very crutial for miners when we attempt alogrithms which are not simple.


Chinese Bitcoin exchanges don't take a fee per trade and some actually reduce the withdrawal fee if more trades were made.

Outside of China, exchanges usually take a fee on each trade. The volumes therefore are not really comparable, and I sincerely doubt that the actual economic activity is so much bigger in China.


Can a bitcoin bank solve the problem of intensive value fluctuation caused by hoarding?

Saying people are hoarding bitcoins is out of focus: they are simply "not spending them" because there aren't enough ways to spend them.

Allowing loans wouldn't improve the situation, since there still wouldn't be many ways to spend those loaned bitcoins.

Finally, bitcoins already are a currency subject to deflation, and they are also (more or less) constantly gaining value against traditional currencies, so just holding them increases their value.

To sum it up, not a terribly good idea, and definitely not ground-breaking.


According to the Bitcoin Wiki:

  A Bitcoin address, or simply address, is an identifier of 26-35 alphanumeric characters

And:

  Some Bitcoin addresses can be shorter than 34 characters (as few as 26)
  and still be valid. A significant percentage of Bitcoin addresses are
  only 33 characters, and some addresses may be even shorter. Every
  Bitcoin address stands for a number. These shorter addresses are valid
  simply because they stand for numbers that happen to start with
  zeroes, and when the zeroes are omitted, the encoded address gets
  shorter.

So no, the length does not imply higher/lower security.


What is the maximum number of transactions per seconds on Bitcoin Cash?

The throughput in Bitcoin is not defined in transactions per second, rather indirectly, via block size limit. What matters in the size of transactions in bytes. The more complex the transaction is (complex meaning more inputs and outputs, long scripts), the more space it takes. A typical full (nearly 1 MB) block in Bitcoin includes around 2000 transactions, or around 3 tx / sec at 10 min / block. 7 tx / sec in the absolute maximum, calculated in the assumption that a transaction contains one input and one output (most real-world transactions contain two outputs -- the second one being the change). BCC increases the block size limit to 8 MB, that means it can handle 8 times more (assuming other things equal).


Fees for transfering money by bitcoins and banks

I for sure cannot answer, why other people say, that transferring money with bitcoin has less fees. Your picture is correct, everywhere are fees.

For specific cases, fees might be lower than bank transfers. I usually send money to Africa. I was doing it with banks, with WE and Moneygram, and with bitcoins. With bitcoins the advantage is, that the fees are independant of the amount. So I can send the equivalent of 1 mio Euros in bitcoin to Africa, and pay just the transaction fee. Try this with the 7 or 8% fees of the best banks or money transfer agencies. You will never ever end up at 5 Euros tx fee. So in these cases, bitcoin is far cheaper than traditional, old-style money transfers.


fetching unconfirmed utxos from blockchain.info

This is most likely something on blockchain.info's end. You have a very similar call available via API to blockcypher.com here:

https://dev.blockcypher.com/#address-endpoint

unspentOnly=true will get you what you want.


Spreading the word about your experiences (and supporting it by the hard facts of website domain registration etc.) is the best way. You might be able to edit the wiki entry to add a warning. In addition, the scam accusation section on bitcointalk.org might be a good place to make your warning visible to many potential victims.


Retrieve BCC/BCH but now have 0. Was i Hacked?

It looks like you're not the only one who ran into this. Someone posted about this on bitcoin talk too. One user posted this is the result of a peer list poisoning bug:

  Electron Cash has a "peer list poisoning" bug, see
  https://twitter.com/ElectrumWallet/status/892433256385261568 This is
  probably what you are experiencing. To fix that, disable auto-connect,
  and select a server that you trust to be a BCC server.

Apparently the casharia server is working for people.

Also quick PSA that Electron Cash is not related to the Electrum Bitcoin SPV wallet. This is the announcement on BCC from Elecrum: https://electrum.org/bcc.txt

There's also a warning about Electron Cash from Electrum:

  The person who distributes the Electron Cash binaries has decided to
  remain anonymous, and uses the fake name "Jonald Fyookball" in order
  to sign Electron Cash binaries. Thus, if these binaries contain code
  that is designed to steal your bitcoins, the author of the theft will
  be anonymous and walk away safely with your funds.


How to determine the Software (Core, Classic, XT, etc.) and quantity
  on the whole network?

connect to host and take the 'user-agent' string from 'version' packet

  How to determine the last 1k blocks and their Miner Software?

the miner can be determined by analyzing coinbase transaction.

the software can not be determined


What is the total number of Bitcoin transactions processed so far?

You can chek this and other statistics in:
http://blockchain.info/

With the available data, the simplest way is taking the number of blocks:
http://blockchain.info/q/getblockcount
and the average number of transactions per block:
http://blockchain.info/q/avgtxnumber
and multiply them. As I'm writing I get 215749*238=51348262 transactions.

The daily number of transactions is also online:
http://blockchain.info/charts/n-transactions?showDataPoints=true&timespan=&show_header=true&daysAverageString=1&scale=0&address=

You could write some code to count the transactions directly from you local copy of the blockchain, but if you want a fast figure the links I've written are enough.