What current wallets support deterministic public addresses (BIP32)? Just curious how many complete implementations of the bip32 standard exist.

I know of these three:

The Gem API enables wallets to be made using their BIP32 compliant API.
There is also the BitGo service that uses BIP32 Multisig wallets.
BitStash hardware wallets also are BIP 32 compliant.


Can I buy Bitcoins in Romania and if yes, where? I'm new here and I saw one can buy them e.g. in Germany at bitcoin.de via an online transaction, by paying Euros. Is the same possible in Romania (do you need a €-bank account for that?) and if so, is there some (online) exchange service best suited for that?

There are no exchanges yet that accept RON (Romanian Leu).

There are individuals in Romania who trade bitcoins for face-to-face cash trade:

https://localbitcoins.com/country/RO <-- But be careful of the listings who are not local, wanting to trade online instead.

Also there is the #Bitcoin-otc marketplace and the #bitcoin-otc-eu IRC channel in which you might find someone willing to trade.

If you have access to purchase UKash vouchers with cash, there are several services such as Mercabit.eu, VirWoX, and Bitcoin Nordic who will accept that voucher for the purchase of Bitcoins.

Otherwise, if you have the ability to send a SEPA transfer, there are many exchanges you can use, include BITSTAMP:

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


How do I compose a transaction with OP_RETURN in Python? Currently trying to figure out how to use Python to construct a transaction with OP_RETURN. I tried to encode the message myself, and had no luck. I found a function, OPReturn(), on the internet, but when I attempt to use it, I get the error (from the Blockchain.info broadcast API): Exception: None Standard Script Output OP_RETURN 594f4c4f53574147

Code:

# coding: utf-8

from bitcoin import *
import binascii
from test import *

priv = sha256('brain wallet')

pub = privtopub(priv)

addr = pubtoaddr(pub)

inputs = unspent(addr)

message = "YOLOSWAG"
FullLen = format(len(message)+2,'x').rjust(2,'0')
MessageLen = format(len(message),'x').rjust(2,'0')
ID = binascii.hexlify(str(message))
snd = "6a"+MessageLen+ID

outputs = [{'value': 50000, 'address': addr}, {'value': 0, 'script': snd}]

fee = 10000

tx = mksend(inputs, outputs, addr, fee)

dt = deserialize(tx)
ins = dt['ins']

#print addr
#print ins

for ind, elm in enumerate(ins):
    print elm
    tx = sign(tx, ind, priv)

#print tx

print(pushtx(tx))

I have forked the pybitcointools library to return a properly formatted OP_RETURN hex string, or insert the OP_RETURN into a raw hex transaction.

My fork can be found here. The code is as follows:

from bitcoin.pyspecials import safe_hexlify, from_string_to_bytes, from_int_to_byte, from_string_to_bytes

def mk_opreturn(msg, rawtx=None, json=0):
    def op_push(data):
        import struct
        if len(data) < 0x4c:
            return from_int_to_byte(len(data)) + from_string_to_bytes(data)
        elif len(data) < 0xff:
            return from_int_to_byte(76) + struct.pack('<B', len(data)) + from_string_to_bytes(data)
        elif len(data) < 0xffff:
            return from_int_to_byte(77) + struct.pack('<H', len(data)) + from_string_to_bytes(data)
        elif len(data) < 0xffffffff:
            return from_int_to_byte(78) + struct.pack('<I', len(data)) + from_string_to_bytes(data)
        else: raise Exception("Input data error. Rawtx must be hex chars" \
                            + "0xffffffff > len(data) > 0")

    orhex = safe_hexlify(b'\x6a' + op_push(msg))
    orjson = {'script' : orhex, 'value' : 0}
    if rawtx is not None:
        try:
            txo = deserialize(rawtx)
            if not 'outs' in txo.keys(): raise Exception("OP_Return cannot be the sole output!")
            txo['outs'].append(orjson)
            newrawtx = serialize(txo)
            return newrawtx
        except:
            raise Exception("Raw Tx Error!")
    return orhex if not json else orjson

Note that the module name has been changed to btc (from bitcoin) in my fork.

To run this, you'll use os.chdir("c:/python/pybitcointools") (or whatever directory it's been downloaded to. Then from bitcoin import *. Now, let's use msg = 'The enemy of my enemy is my friend' and rawtx = "01000000016e3cd2b24fcf49259db29888ec5fe6521070041cb8c7bb2017537046f9e00f2b0000000000ffffffff0168d61100000000001976a91469bbbb16301e40b9fb67130e1aa53a2281d60af088ac00000000".

mk_opreturn(msg, rawtx) returns:

01000000016e3cd2b24fcf49259db29888ec5fe6521070041cb8c7bb2017537046f9e00f2b0000000000ffffffff0268d61100000000001976a91469bbbb16301e40b9fb67130e1aa53a2281d60af088ac0000000000000000246a2254686520656e656d79206f66206d7920656e656d79206973206d7920667269656e6400000000

This is the raw Tx with the OP_RETURN properly inserted. Run the function without the rawtx parameter and it returns the string 6a2254686520656e656d79206f66206d7920656e656d79206973206d7920667269656e64


Starting point for listening to bitcoin network transactions in Python I would like to create a python script that listens to the bitcoin network and monitors some addresses, stored in a mysql db. As soon as a transaction is broadcast with one of these addresses as an output, the script should run a function.

I do not need to store the whole blockchain, nor do I want to. The private keys are also not on the same machine, for security. There is no wallet on this machine, just a list of addresses in a DB.

For the moment I have implemented this with the webhooks from blockchain.info and also tested with blocktrail. It works but it does not work fast enough te achieve my goals, these solutions are just too slow to be practical. I need to be notified instantly.

I've looked at several options but none seem to fit as a good starting point. (BitcoinJ seems the closest but it is in Java) I cannot believe there is no such thing in existence, I just couldn't find one.

So, can you steer me in the right direction?

If you just listen to transactions on the network without having a validating node of your own you will have absolutely no way of knowing if they are legitimate or not. You must have a fully validating node locally, otherwise transactions can be cost-lessly fabricated to spend any amount of money anywhere. There is no recourse if you get this wrong, this is primarily why nobody has implemented any sort of validation in Python, there's various bits of the p2p protocol on Github, but it does exactly zero consensus validation on the data it receives.

The current master of Bitcoin Core (and the up coming 0.12 release at the end of the year) both contain a ZMQ interface which gives you a real time supply of validated transactions. A full node (pruned) can be run in as little as 2GB of space, and isn't very resource intensive for somebody running a business. There's example code for that available on github as zmq_sub.py which should get you started, just be aware that ZMQ has no guarantee of deliverability, some messages may be silently dropped if there are connectivity issues.

It's important to keep in mind that an unconfirmed transaction has no guarantee of being confirmed, and may be invalidated at any point in time. Accepting zero confirmations is extremely risky, though updating a user interface with a list of unconfirmed transactions is perfectly reasonable behaviour.


Bitcoin is attacked by China miners by screwing with the network, what will Bitcoin do? There was a report recently (https://arxiv.org/pdf/1810.02466.pdf) that stated that China controls 74% of the hashing power. They can choose to collude and attack the network by either doing a 51% attack or stall the network by not including any transactions.

If China did attack the Bitcoin network. Are there any contingency plans in place to recover the network with a fork of some sort? What would happen?

One may speculate on this, but this was already taken into account in the design of Bitcoin. Essentially an attacker would not choose to attack the network because it would hurt their own investment. In the whitepaper, Satoshi states:

  if a greedy attacker is able to assemble more CPU power
  than all the honest nodes, he would have to choose between using it to
  defraud people by stealing back his payments, or using it to generate
  new coins.  He ought to find it more profitable to play by the rules,
  such rules that favour him with more new coins than everyone else
  combined, than to undermine the system and the validity of his own
  wealth.

Now to speculate, if there was another reason which made it more profitable to attack the network than to support it, those who support the valid chain could hard fork and put a new consensus rule that would put the attacker at a disadvantage. A potential solution commonly discussed is using a different proof of work algorithm, which would make their current mining hardware basically useless.


BTC wallet recovery: I have a 17 word backup, what do I do? I have a 17 word seed phrase from a 10 year old Bitcoin-qt/core? acct, but don't know what tool to use to turn it into a wallet. I also wrote down the 17 letter associated private-key itself. It starts with "q" and has two commas and a space in it?? Is that valid? Obviously I am terrified to put the seed phrase into any ONLINE tool. I want to practice offline somehow to see if I even wrote it down properly. I tried looking thru the sourcecode: https://github.com/bitcoin/bitcoin to see there is a word-list.. No joy. One guy said Electrum, but it didn't help decipher the individual words, just kind of a 'put them all in', sink or swim endeavor.... Thanks!

I have a 17 word seed phrase ...

Usually seed-phrases are 12, 18 or 24 words long. You can often add some extra phrase of your own, but even so, 17 words seems wrong.

... from a 10 year old Bitcoin-qt/core? ...

Bitcoin-qt/core has never used seed phrases.
Electrum was first released in late 2011 and used seed phrases - it used a proprietary system that has since been superseded by the standard BIP39 system for seed phrases.

... acct

The accounts feature in Bitcoin core was dropped some years ago.
There was never a private key per account. I believe Bitcoin-qt's accounts were mainly a way of organising addresses. The current equivalent is labels.
When people write about accounts, I always suspect they mean an online custodial account rather then a normal wallet. Bitcoin was intended as digital cash that each person looks after themselves without the need for any trusted third party. Accounts are associated with giving your money to some trusted third-party business and hoping they look after it for you. Some businesses call their customer accounts "wallets", which I think is misleading, but that's just one man's opinion.

17 letter associated private-key itself. It starts with "q" and has two commas and a space in it?

I don't think that is how Bitcoin private-keys are normally encoded. There are several encodings but the most common is probably Wallet Interchange Format (WIF)

One guy said Electrum, but it didn't help decipher the individual words

The individual words of a BIP-39 seed phrase are not ever deciphered. They are not the result of enciphering some plaintext. The whole phrase is the input to a mathematical operation (not encryption, decryption, encipherment or decipherment) whose result is a number that can be used as a private-key. The words are not intended to be processed individually.
I think Electrum is a good candidate but the information you are feeding it is not what would be expected. You also need to make sure that you are using electrum in a way that is appropriate for a legacy seed-phrase rather than the current system it normally uses.

With the information you have so far, I don't see any way to recreate your wallet - the information isn't consistent with typical use of Bitcoin-qt of around 2011. I'd look for other information, files on disk, backups, emails, records of downloaded software, etc.


Which wallets work with payment codes? I know the samurai wallet for android has support for payment codes, what other wallets support payment codes?

Samourai Wallet on Android and Billion app on iOS.


After a month, BTC sent from trezor to coinbase never received after 5000 confirmations On 12/21, I sent 0.75 BTC from Trezor to a valid BTC Coinbase address. The transaction is stuck. It has over 5000 confirmations but Coinbase.com never received the BTC. Both Trezor and Coinbase have been of zero help. Can someone please help me?

Here is the link of the transaction

Thank you!

Coinbase is custodial bitcoin wallet so they don't give you access to your bitcoin private keys or anything. they're just like PayPal. you have numbers in your account, and you can't go to the bank and withdraw these funds. unlike non-custodial bitcoin wallets. they're better for anyone who is looking for bitcoin wallet.

So, what I'm trying to say these types of issues could happen with those wallets and nobody in here can help you get your money back.

Contacting coinbase.com could be the solution and consider changing your bitcoin wallet.


Is a 51% attack on bitcoin likely? Given that the majority of bitcoin processing is done in China (source: https://bitcoinmagazine.com/articles/report-links-74-bitcoin-mining-china-sees-threat-network/), is it possible for a single entity to accomplish double spending (or be forced into accomplishing it by the Chinese government) to make profit for themselves or for the country?

How likely is it for all the separate entities doing the mining in China to be forced into complying and compromising the network's validity and has there ever been credible reports of such a thing occurring on bitcoin's front specifically?

No.

Bitcoin is an economical system. To become a pool operator, you must have 1) large amount of bitcoin or 2) large amount of hardware. Both requires you to be an "investor". In contrast to Proof of Stake, it is not easy to sell everything and leave Bitcoin in short time, which means you're informally "contracted" to Bitcoin. To put it another way, the only proper way to profit is long term mining. That requires you to ensure that it won't decrease in value. (1% increase is actually a lot for them) As a consequence, you can't attack Bitcoin even if you have the power to do that, as it'll affect its value.

This was the reason Emin Gün Sirer's Majority is Not Enough: Bitcoin Mining is Vulnerable was controversial.


Will I lose payments on a mining share in the time it takes to sync? I bought a mining share a couple months ago from Bitcoop, downloaded the wallet that they suggested, and the wallet has taken this long to sync. The first mining payout was a few weeks ago.

Will I get that payment or is it lost?

You will get that payment. Your wallet does not need to be online or synchronized to receive funds, only to do anything with them. (I'm assuming you're using Bitcoin-qt or something similar, I don't know what that vendor recommended or what you've done.)

However, the client shouldn't take months to sync, so this could indicate there is some problem.


Is there an open database to query bitcoin transactions My goal is to get all addresses with a balance of more than 0.01 BTC. In order to get this data, I have to sync the full bitcoin node but I want to avoid it. Maybe there is any open SQL or MongoDB database somewhere. The speed is important.
Thanks in advance

Google Cloud provides a dataset for most public blockchains, including bitcoin. You can directly query the dataset via their BigQuery Tool - you can use standard SQL
Bitcoin Dataset on GCP:
https://console.cloud.google.com/marketplace/product/bitcoin/crypto-bitcoin?filter=solution-type:dataset&id=7fd60425-cb95-4a58-b59f-ab3789642844


Why it is not possible for a payee to verify double-spends of the coin? I'm reading Bitcoin paper of Satoshi Nakamoto (https://bitcoin.org/bitcoin.pdf).

It says:

  Each owner transfers the coin to the next by digitally signing a hash
  of the previous transaction and the public key of the next owner and
  adding these to the end of the coin. A payee can verify the signatures
  to verify the chain of ownership.

And the very next sentence is:

  The problem of course is the payee can't verify that one of the owners
  did not double-spend the coin.

That is, as I understand, after every transaction a new transaction hash is generated. So, first, it is not possible to double-spend a coin because it already has a new previous transaction hash. Second, why it says payee can't verify a double-spend if every transaction a coin has a new previous transaction hash?

As a participant in the peer to peer network, it is impossible for you to know that the state and timing you are seeing are consistent with what other people are seeing. You can't ask other participants in the network what they are seeing directly as they can lie, withhold information, or the request can be tampered with on its way across the network. The block chain and proof of work mining system are designed to ensure that in all probability, nodes in the network have consistent ordering and atomicity. Absent this, it would be very feasible for nodes to see a different state and make different decisions about validity.


RPC Wallet API methods "getblockhashes" was removed? I'm testing RPC wallet API methods of Bitcoin 0.13.2, and I realized the method getblockhashes (method returns an array of block hashes for a specified block range ex: between two timestamp) cannot be called, the API returns "Method not found", so is it removed? I'm locking for a method that works like this method.
Thanks.

Just for the record, the RPC call getblockhashes exists in bitcore patches for bitcoin/zcash etc, because the insight block explorer, which uses bitcore patches for the running node, needs to know last blocks.


In Ripple, when an IOU is defaulted upon, who gets hurt? Let's say there are five people.

  Alice <-> Bob <-> Charlie <-> David <-> Eve

Each of them trusts the person next to them. For instance, Charlie trusts Bob and David, but not Alice or Eve.

Alice run a donut shop. One day, Eve comes in and asks to buy a donut. Eve creates an IOU, then uses the web of trust to resolve it. Eve leaves with the donut.

Eve then flees the country. Complicating the situation, David is broke, and was relying on Eve's IOU to pay Charlie.

Who gets hurt in this situation?

There are two very important concepts here:

You can only be hurt by someone you chose to trust.
A chain only exists instantaneously while a payment is made.

The answer to your question depends on whether David pays Charlie or not. If David pays Charlie, then David gets hurt because he trusted Eve and she betrayed him. If David doesn't pay Charlie, then Charlie gets hurt because he trusted David and David betrayed him.

David learns a valuable lesson here. If you trust someone, you may wind up on the hook for the full amount you were willing to trust them for. Your choice will be to make good on them or betray the trust that people have extended to you.

Alice still holds an IOU from Bob and she agreed to trust Bob. Unless Bob betrays her, she's safe.

Now, this may not be exactly what happens. For example, if David can find someone else who will take Eve's IOUs that leads to a payment path to Charlie, he can meet his obligations and stick someone else who chose to trust Eve with her worthless IOUs. So you may get a game of "hot potato" with someone getting stuck with it last.

It is important to understand that when you extend trust to someone in Ripple, you are trusting them to hold your money -- money you may owe to other people. It should not be done lightly, except perhaps in small amounts.


Why are mined blocks not always full Why do mined blocks tend to vary so much in size. If the miner's objective is to maximize their revenue from transaction fees they should add transactions starting with the one with the largest fee, working down to the one with the lowest until the pool of waiting transactions is empty.

If you look at recent blocks on https://blockstream.info/ (as of today, Aug 15 2020), nearly all blocks are very close to 4000 kWU. The variation is due to availability of sufficiently small transactions to fill up the last part, and differences in selection algorithms.
Occasionally, an empty block appears instead. These happen as a result of pools learning about a new block faster than they can construct a new template on top, and inform all their hashers. Instead, the instantly tell everyone to start working on an empty block (which is definitely valid), and only when a new full block template is constructed do they inform the hashers of it. This is exacerbated by validationless mining, where the pool may learn about the new block hash tip, before actually having even seen the new block.
So, as far as I can see, in recent times with sufficient pressure for demand, effectively all blocks are full, except for empty ones occasionally.


Resources for multisignature transactions? I am interested in using multisignature transactions to secure my company's coins and I'm wondering what tools are available right now for use with multisignature transactions? I'm especially interested in solutions that work on keys distributed between multiple wallets (no single wallet holds all the keys) and are not currency specific (would work just as well for Bitcoin as for Litecoin or other coins).

I know that the standard bitcoind API is lacking in multisignature support due to this bug.

blocktrail has a 2of3 HD Multisig Wallet API, it's setup like:
 - the 1st key being your primary key to use
 - the 2nd key being a backup key you store offline and
 - the 3rd key being a cosign key owned by blocktrail

it only supports bitcoin and bitcoin testnet atm though ...

https://www.blocktrail.com/api/docs#payments_overview


Running multiple DNS Seeds I would like to know how to run multiple DNS Seeds on the same node.

It seems fairly straight-forward as described in: https://github.com/sipa/bitcoin-seeder

For example, I want two DNS Seeds:
bitcoin-seed.mydomain.com
testnet-seed.mydomain.com

It seems as per the existing instructions I would either need to run multiple VMs or at the very least create new users and redirect port 53 to them. (I am not sure I can redirect port 53 to multiple users)

Is there any way that I can set this up on one VPS with Root access?

Asking this question on Super User might have resulted in a quicker and more response as this is strictly speaking not limited to Bitcoin.

Sipa's bitcoin-seeder allows you to run the DNS node on a port other than 53, so that you could set up a DNS seed for each of the networks you want to support. In order to receive incoming queries and respond to them you'd then set up a BIND server that acts as a slave for the individual subdomains and then delegate incoming queries to the corresponding bitcoin-seeder. The zone configuration of the BIND daemon does allow you to specify ports other than port 53.


Verifying a legitimate version of bitaddress.org on Windows How can I make sure I am accessing (online) or have downloaded (as an HTML file or from GitHub) a legitimate, trustworthy version of bitaddress.org?

In other words, how can I make sure no hacker has modified something at bitaddress.org or in the GitHub files in order to be able to capture generated keys?

I have read somewhere something about computing the "hash" and/or "verifying the signature" or something like that. I'm not at all familiar with all this.

I think the same question would apply for bitcoinpaperwallet.com, too.

1) Google how to verify a PGP signature

2) Import author's PGP sig (from the main Web site), use procedure from 1) to verify contents of
https://www.bitaddress.org/CHANGELOG.txt.asc (and obtain SHA256 sum of the latest release, although you can get that from Github as well)

(If you trust Github and want to use an offline copy, you could skip 1) and 2) and just get the latest release from Github)

3) Download the latest release, unzip and calculate SHA256 sum of the main (bitaddress.org.htm) HTML file, compare with SHA256 sum in the URL or downloaded CHANGES.txt.asc file:
sha256sum.exe bitaddress.org.html
dec17c07685e1870960903d8f58090475b25af946fe95a734f88408cef4aa194  bitaddress.org.htm

If you skipped step 2), you can perform it in step 3 using the downloaded ZIP archive.
For checksum, use a utility you want (or two, in case you don't trust one). One example:
http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe


How is proper fee rate got on Bitcoin Cash I'm developing wallet system trading BTC, BCH and so on.
In BTC, I'm using estimatesmartfee API to calculate by transaction size and relayfee to guarantee minimum fee and it works well.
In BCH, though most of logic is same as BTC except estimatesmartfee, estimatefee is used in BCH.
However, as increasing transaction size by input UTXOs, sendrawtransaction is often failed because of shortage of fee.

How should it implemented properly? What is it affected?
I guess some reasons,
If I need to use API to get proper fee rete from some sites, what is that site?

The minRelayTxFee (which despite the name is a feerate) on BCH is 1000 satoshis per kilobyte or 1 satoshi per byte.

BCH has a blocksize limit of 32 MB and has generally had only a very small portion of the blockspace used. The current 7-day average is 27 kB blocksize. It rarely even peaks to 400 kB.

 via fork.lol

Given that BCH is currently using about 0.1% of its available blockspace, there is no need to pay a higher fee rate than minRelayTxFee.

Hence, I would recommend not to spend more time on research, but instead simply hardcode a fee rate of 1000 satoshis/kB. If you want to play it safe, you can go with 1500 or 2000 satoshis/kB. In the unlikely case that BCH traffic picks up enough to fill blocks, software support should probably improve at that time and you'll be able to reevaluate then.


Private key and Address Private key is 32-byte number.

Address (Hash) is 20-byte number.

Is it true that there is many Private keys that have the same 20-byte hash?

P.S. How to get Address from Private key:

Private key (32-byte number, random) --1--> 04+Public key (64-byte number, elliptic curve point) --2--> Hash, Address (20-byte number) --3--> Address string (Base58 string).

Elliptic curve point multiplication
SHA256, ripemd160
Hex converts to Base58

Yes, that is true.

However, to go from an address to any corresponding private key still requires an unfeasibly large amount of computing.


How to understand the first reply of a node I have send my version message to a bitcoin node and the hexdump of his answer was this:
https://pastebin.com/QBNaeS0g
Maybe this is a network related question but I want to know the version used by this node and how did you come with it.

Easiest way to understand the response of other nodes IMO is using Wireshark and follow the below steps:

Install Wireshark

Capture packets according to the network you will be using on this system when Bitcoin full node connects with the network.

Launch Bitcoin Core

Stop capturing  packets once the node is connected to few peers

Filter captured data in Wireshark with keyword "bitcoin"

Check the details of version packet sent by other node

In the middle section you have all the details in readable format and last section is bytes view. Once you select any information in the middle section, relevant info will be highlighted in the byte view as the selected bytes.

According to my understanding, src/clientversion.cpp decides the version message in Bitcoin Core and src/init.cpp helps in sharing this information.
There is one more tool for conversion of such data but I have not used it enough. I think it can be helpful while experimenting with Bitcoin: https://github.com/gchq/CyberChef


Bitcoin Private Key question Thanks for your great content. I've got a question regarding Bitcoin Private Key.
If a hacker stole a Private Key and took possession of the coins by entering the Private Key into his own preferred wallet, then sent the coins to his own Bitcoin wallet or sold it via an online exchange"
1. Would the primary/main owner of the Private Key be able to figure out what has happened to his/her money and/or find the real name of the person who stole it?
2. Can the primary owner open a legal action against this?
3. What's the best course of action for the primary owner to do if this happened to get their money back to find the person who stole their money?
Thanks.

Would the primary/main owner of the Private Key be able to figure out what has happened to his/her money .

Yes, the wallet would show a transaction that spent/moved the coins

  find the real name of the person who stole it?

Most likely not, unless using some kind of tracing service (Chainalysis, CipherTrace, Coinfirm)

  Can the primary owner open a legal action against this?

Assuming you find out who did it and you can prove it, and your jurisdiction supports such legal actions, then yes.

  What's the best course of action for the primary owner to do if this happened to get their money back to find the person who stole their money?

Ask the internet for help, do some analysis yourself (using public facing tools), hire a company specializing in this type of work.


Using Ripple for assets accounting, loans, deposits, stock exchange, etc If Ripple can handle money as exchanger, is it possible to use it for other financial operations like assets accounting, loans, deposits, stock exchange etc.?

Ripple has a contract system under development. This will allow people to bind Ripple assets or accounts to a set of rules. This should be usable for most of the things mentioned in your question.

Loans, ideally, would be done just as negative balances on a pathway.


Why can't Bitcoin switch over to Gridcoin's proof of work system? Gridcoin advertises itself as a "a mandatory competitive reward mechanism based on contributing the most towards BOINC projects on top of existing cryptocurrency technology."

Is there a reason why Bitcoin couldn't use Gridcoin's proof of work system, either to secure the system, or to distribute coins? What consequences would switching to their system have?

Related: What sort of calculations do the miners have your computer do?

Such a switch will never happen. There are three main reasons for this.

It would require the worst kind of hard fork, one where a lot of legacy code would have to remain in the coin, for the sake of validating transactions before the hard fork date.
While the reward system itself has been specifically designed to not be game-able (https://github.com/TheCharlatan/Gridcoin-Research/tree/master/contrib/BoincMonteCarlo), it is nevertheless destroyable by a malicious actor with reasonable funding, since it relies on a centralized service to distribute its data.
There is little to no research towards the specific crypto algorithms used to secure user information in the chain, such as https://github.com/TheCharlatan/Gridcoin-Research/blob/CPID-style/src/cpid.h . In fact the CPID (which is used to identify researchers) is an md-5 hash of some string and the user email, so it definitely does not compare to Bitcoin's standard of security.


Is it okay to run regtest for dev purposes while simultaneously running a node on mainnet (bitcoind)? Hope it won't mess anything up on my mainnet node.

As long as your nodes are running on separate ports and using separate data directories, you should have no issues running multiple networks.

Note that you may run into resource issues, especially with regular spinning HDDs, if both networks have high requirements for disk writes and reads at any point.


Will Lightning be implemented on Bitcoin network? Lightning cannot currently operate with pruned nodes. I presume without limitation the same applies to SPV nodes. Will Lightning be implemented on the Bitcoin network?

Lightning nodes can function in a light client mode by connecting to full nodes who support the new BIP157&158 light client mode. This is supported by LND (the lightning network daemon), and is known as neutrino. On testnet, the lightning faucet operates a neutrino-compatible full node but support will spread and it will eventually become as easy as using SPV currently, with many added benefits over SPV.


Is BTC inherently much more energy-hungry than other currencies, or just been around longer? A beginner question, but my understanding is that BTC (and many others) rely on solving ever increasingly complex algorithmic problems, which acts as a self-gating mechanism on the ever-decreasing cost of CPU power(?)
BTC's energy use has been in the news a lot recently and there's discussion about relative transaction cost in other coins. Do they work fundamentally differently, or is their blockchain just so much smaller that they are where BTC was, say, 2 years ago?
Or am I confusing mining with transaction cost?

other coins. Do they work fundamentally differently,

To secure the record of transactions, Bitcoin uses a type of mechanism called Proof of Work (PoW). Some other cryptocurrencies use any of several other mechanisms such as Proof of Stake (PoS).

BTC (and many others) rely on solving ever increasingly complex algorithmic problems

The complexity is not increasing. A "difficulty" target is adjusted that affects the number of iterations required. That difficulty target can go down as well as up.

BTC's energy use ...

The energy consumption of Bitcoin's PoW depends on the amount of computing power that miners have invested in. To ensure that new technologies and miners with deep resources do not become able to forge the transaction journal, Bitcoin increases the difficulty of Mining proportionally to the total computing power applied by miners. Mining is competitive so more powerful mining equipment provides a higher proportion of the rewards. So the energy consumption of the Bitcoin network is largely a reflection of the return on investment (ROI) that miners predict in their business plans. It isn't affected directly by number of transactions.
Transactions provide a transaction fee to miners, so the transaction rate and fee-rate has some influence on ROI.  However the transaction rate does not directly drive energy costs in the network.
To put it another way, if all but ten† miners left the Bitcoin network and those ten† only used one† small† PC each for mining, the transaction rate might not be affected and energy costs would be far far smaller. However, in the absence of any other limiting mechanism, the network would be insecure, a miner could step in and use overwhelming computing power to commit fraud.

† These numbers are not real, just illustrative. there is some minimal number that would be adequate to process current transaction rates if all humans were always honest, trusted all other humans in all circumstances, never had disagreements and never made mistakes. However Bitcoin was made for the real world and this requires some energy be expended to keep money secure


Why should I use a Bitcoin Mixer? I understand that I can use Bitcoin anonymously using Bitcoin Core with Tor running a full node or with Electrum using Tor running an SPV node, why should I also use a Bitcoin Mixer?

Using a mixer helps preserve your financial privacy. The question is: who are you protecting your privacy from?

Bitcoin transactions are public record, so anybody can view any historical transaction at their leisure. So when considering your privacy, there are a few different situations worth exploring, for example:

An unrelated third party is looking at your transactions

The blockchain history is public record, so anyone can view the entire history. Addresses aren't linked to real-world identities, but by looking at spending patterns, a third party can make guesses at which addresses are controlled by the same wallets (and thus users). Keep in mind this is only a guess, made by using certain heuristics that are not always correct, but nonetheless in many cases these guesses can still be accurate.

A counterparty to your transactions is looking

This is perhaps where a Bitcoin mixer becomes most useful. While addresses are pseudonymous, when you transact with someone they will gain some information about which addresses you control.

For example, if you have a 5 BTC UTXO, and spend it to send 1 BTC to somebody, then by looking at the transaction, your counterparty would know that you own at least 4 BTC more. And by analyzing the history of inputs (and outputs) from your transaction with them, the third party may be able to guess which other addresses you own, by using the same sort of heuristics mentioned above. So suddenly, just by transacting with someone, you've sacrificed a perhaps unnecessary amount of your financial privacy and history to them.

This is where a mixer can help: it breaks the links between addresses in your wallet, by allowing you to participate in transactions which break blockchain analysis techniques. As in the example above, your counterparty would still be able to see your change output, but they would be unable to look at the history of inputs (and outputs) from the transaction to gain more information about your wallet (though they would be able to tell you used a mixer).

An analytics company with a lot of resources is looking

This situation has the same considerations as above, but it is worth noting that analytics companies may have enough resources to engage in deeper investigations and analysis, for example by using IP address tracking to associate addresses to users. Nonetheless, using a mixing service will still help preserve your financial privacy.

As an example, many KYC'd exchange services are required by law to keep track of how their users interact with the service, and spend the bitcoin they acquire through it. This means the service might watch how you spend bitcoins that they sell to you, in order to ensure you aren't engaging in some illicit activities (according to the legislation the exchange must follow). So by using a mixer, you can sever the link between your exchange account, and your bitcoin spending habits.

Note that throughout all of this, the main idea is that you should only reveal your financial history to those individuals you choose to, meaning, this gives you the selective ability to preserve your privacy. If you need to provide a history of transactions for an audit, then you can do so, and a bitcoin mixer will not help you fake that history.

This makes a bitcoin mixer more useful for the everyday user that wants to uphold their privacy, than it is for a criminal wishing to hide their history from authorities. Maintaining privacy is difficult, but possible, and in fact many Bitcoin developers are working on technologies that will make the tracking of transactions more difficult. Maintaining privacy and fungibility is important: without it Bitcoin as a system of money and value would be broken.

EDIT: It is also worth mentioning that not all mixers are alike. In fact, many mixers have historically been unable to actually break the links between users/wallets/addresses, so they provide a false sense of security.

Consider this: if you were running a chain analysis company, and the existence of a mixer would hurt your business model, then why not just run a mixer yourself, and keep logs of all the transactions that users send through it? You would have front-row access to all their transactions, under the guise of providing them privacy.

With this in mind, A good mixer should be:

Non-custodial
Unable to distinguish between users/inputs/outputs, and thus unable to keep a history of users/transactions
It should probably run exclusively over the Tor network

If a mixer doesn't satisfy these points, it should be avoided.


Can a blockchain from the future be synchronized today? If one or a few computers with blockchains from a future time line were connected to the Internet today, what would happen? This other question in Worldbuilding focus on possible consequences, but with this one I am trying to focus on the technical details that would allow or prevent a synchronization to happen. Here are a few sub-questions/ideas I would like to focus on:

Would Bitcoin reject a future blockchain (a.k.a. FBC) immediately?
If a larger number of computers (surpassing any other collective group) with the same FBC connected now at the same time to the Internet, would others be forced to synchronize to that blockchain?
If multiple different FBCs connected, would any of them be synchronized? Which ones and why (furthest or closest to the current time)?
Is it possible to simulate an FBC? (e.g. by creating transactions in a future timestamp and synchronizing them)
In the event of a full synchronization with an FBC would transactions be possible? What would be "new blocks"?

I am new to crypto-currencies and to this SE site, and I only found this question with some resemblances to mine, but if you have suggestions which add further details/examples or improve this question, please let me know.

Extremely creative question. Most of UTF-8's answer is correct. I'd like to observe a few consequences:

If someone brought a future blockchain to current reality and even 11 blocks were immediately accepted, you would have some serious chaos. People that didn't spend bitcoins from their wallet would suddenly see money they were going to spend in the next two hours gone. Exchanges would see outputs of a lot of their money that they would have had to send out in the next two hours gone to people that were about to, but didn't yet ask for them. Same with merchants that deal with bitcoin, people would have paid money to addresses that may not have been generated yet!
The big thing about the future blockchain is that you have some serious replay attack vectors. Once future blocks are known, pretty much anyone can replay these transactions as long as they're valid and include them instead of transactions that try to spend the same UTXOs.
There would probably be a hard fork quite quickly to preserve the value of bitcoin that renders all blocks and transactions from the FBC invalid. The competing FBC chain wouldn't have any value since you can't create any transactions on there and some amount of hashing power has gone over to the new fork, making it extremely difficult to catch up to the FBC chain in any way.
From a world-building perspective, the most interesting consequences would be the potential future you got a glimpse of. You would know that you spent some amount of bitcoin 17 days from now, but for what purpose?
The evidence that FBC is actually from the future would be really compelling. First, the proof-of-work on a future blockchain, if it's more than a year in the future, for example, would be astronomically high and nearly impossible to fake. Second, people would see signatures to their own private keys on the chain that they never generated. Again, really convincing proof. It would certainly spawn research into time-travel =)


How to decode raw transaction which has 00 in '#TxIn' slot? These are two raw transactions I got from Testnet, using bitcoind -testnet.

01000000000101dc82cf0b892b325413ec7b3237e1a122c3114002ccd6e0f0157c8851144c00200100000017160014a530e459b62406b99aa75091bd9eb833a20698a3ffffffff0290f4f700000000001976a9143eabc5342434987e43e5c49f42462689d969c56288ac67baa26f2e00000017a9144d62bfc7376858c8d601c50dc08d8dc8491b27a8870247304402206998883f24133677c46a70e01e70cd9f69ee9059a4d5d82e891b82e797f125000220760a3af0836a9068de63ca0a4cedbb68bc8ea2d067f5cdaf92f2cd4d31703e18012103d8421b44b3d21151a5a2660662bc6ef69a0ef2266bf68b8c56eea715b23a596500000000

0100000000010151df0e2bb6bd3ffa19ae03330b7f89a4a8d6ad93bc204ec7d8cd367e58a10b580100000017160014a03506f19e6851264f21f373bae14023d247d760ffffffff02bc733400000000001976a9143d19e810138ebcb0033c462cf2b5e62a9d7af24588acc4ecca632e00000017a9142f877141344c0202e2f6eb979025d9e3f4f38c6a87024730440220342f74d49243d342a8cd3818e48d8aaf94c71fa41a96863dd986057992650bc202202a7cbe1541941e55abf06fee496c890cce9a2d2fcbb0710fb24342f3b513cd0a0121029e3868ce4a192e0b47f29090c243764e68b4c2c18aa0476272a61b62e3a3804c00000000

When I try to parse these transactions using new bitcore.Transaction(serialized) via Bitcore library, the return value either results in Buffer error or malformed Transaction.

When I refer the Bitcoin doc, the first 4 bytes are assigned to be version, and the following bytes are assigned to be the number of inputs, in the variable length integer format. Variable length integer has the value of uint8_t when its value is less than 0xFD, according to the doc.

Following the rule, above two raw transactions should indicate that these transactions have zero input because it has 01000000, thus 1 in little endian (so it means version 1), which is followed by 00, thus 0 (so it means 0 input) according to the doc.

But when I decode these raw transactions either at BlockCypher or by bitcoin-cli decoderawtransaction, it clearly shows that it has some input and the result seems to be valid. (By querying the tx id or addresses, I can get a valid result too.)

Is there any other way to decode these kind of raw transactions?

This is a SegWit transaction, serialized using the new format defined in BIP144.

The format is only permitted when at least one of the transaction inputs has a witness, and works as follows:

4-byte integer nVersion
1-byte dummy (must be 0)
1-byte flags (must be nonzero)
vector(transaction inputs)
vector(transaction outputs)
if (flags & 1): vector(input witnesses) (excluding the length, which is implied by the number of transaction inputs)
4-byte integer nLockTime

The dummy byte is required to be 0, guaranteeing that the transaction cannot be misinterpreted by old software (as by consensus rules, a transaction with 0 inputs is invalid).


Alternative to Nicehash Miner for Linux I have a high performance Desktop computer with a powerful NVIDIA GPU available.
I wonder if there is some software similar to NiceHash Miner which I can install in Linux to make some little cash while I'm working on the machine doing other things.

There are many blog posts, howtos, etc. available through Google which will tell you know to mine your favourite crypto currency using an NVIDIA GPU on Linux.

Please note that NiceHash is something similar but different. NiceHash is an online marketplace for hashing capacity. It is not a mining pool. NishHash is about renting out hashing capacity to people who think they know how to get back more rewards from using X amout of hash than they have to pay for it.

AFAIK NiceHash does not offer a Linux client. Did you try to run it in a VM or on Wine?


Bitcoin Mining using an iPhone? Is it possible to start Bitcoin mining using an iPhone with 4G internet connection?
Storage is not an issue,or is it?
(Mine is 256GB).

Is it possible to start Bitcoin mining using an iPhone with 4G internet connection?

Yes. It is theoretically possible to start mining with an iPhone.
Your internet connection is almost completely irrelevant and your space is also not important. The important thing is the power of your CPU.

But: Mining with an iPhone means mining with CPU. And that's completely unprofitable. Even mining with GPU is not profitable anymore because of all the ASICs. You would fight against big mining pools and you would probably never be the first one who gets a hash with 20 zeros. So, you would waste a lot of energy and don't get any reward. Not worth it!


Bitcoind daemon get received notifications by public address For my project I need to check the balance of a public address using bitcoind. Can I do that without importing the private key, only by public address?

Need solution no dependence, because I tried with blockchain.info API and after x requests, they blocked me. I need to check a lot addresses every 30 minutes.

Instead of polling many addresses every 30 minutes, you probably want to import your addresses into bitcoind, using bitcoin-cli importaddress and then have bitcoind notify you automatically when a new transaction comes in, using the walletnotify option.

See for example: How do I use walletnotify?

There are a lot of details to get right: transactions might never confirm, the transaction ID might change. When bitcoind loses connection to the network, you want your script to be able to handle that. etc.


How to 'attach' metadata to a bitcoin receive address I need to generate a receive address that is directly associated with some metadata, M, that forms part of a verifiable contract.

I require that customers can verify that an address really was generated from a specific contract message, but I do not want them to have the private key to the address.

I obviously don't want to bloat the blockchain nor do I wish to use non-standard transactions. P2SH is also not possible as it is still largely unsupported by many online wallet providers.

So here is my first attempt, based on (https://bitcointalk.org/index.php?topic=108423.0) ...

# generate an EC key pair for the company
issuer_public_key = issuer_private_key * G

# create a contract message string, M
M = 'Terms of contract bla bla and also includes issuer_public_key for safety'

# generate a hash of the message
e = SHA256(M)

# create an EC point that is known to both parties
contract_point =  (e * issuer_public_key)

# generate a public key for this contract to form our receive address. Customer agrees to contract when they send BTC to receive address.
receive_public_key = contract_point + issuer_public_key

# the private key for the receive address is thus
receive_private_key = contract_point + issuer_private_key

Feedback much appreciated

That's all well and nice, but it turns out that courts aren't interested in "mathematical proofs" (with good reason).  I recommend reading all the books by Bruce Schneider.

Let's say you got someone to pay you at receive_public_key. Does that mean he has agreed to contract M? No.

The courts would still need to see documentation that your partner actually saw and agreed to the contract M. You could have emailed the guy and said "I'll give you $10 if you send Bitcoins to receive_public_key, then later claim that he agreed to contract M.

This same thing happened in the 90's, with vendors claiming cryptographic digital signatures had the property of Non-repudiation. But the courts disagreed. For example, someone can hold a gun to your head and make you 'sign' a contract (digital or otherwise). No court will consider that a valid contract, fancy math or no fancy math.


How to get balance of tens of thousands of addresses? What is the best way to get balance of large amount of addresses?
I tried to use APIs from different providers, but they are limiting the requests. Is there any APIs that give premium service without limiting requests?

Or maybe should I run full node, and use it?
If yes, how I'm using the full node to get the addresses balances? I'm using Ruby on Rails.

Thanks.

I think your should consider that using an API could result in fakes, wrongly-validated data. Using an API means you fully trust the API service,... which is kind-of against bitcoin no-trust model.

I recommend you to run a full node (Bitcoin Core 0.13.2 during time of writing).

There is no address-index (there is a patch you can manually compile into Core).

Simplest way with standard Bitcoin-Core 0.13.2 is to import all your addresses as watch-only into a wallet.

import addresses

Use the RPC call importaddress <address> "" false to import a watch only address.

The 3rd argument false is required to not rescan the blockchain for each import (can take serval hours).

Once you have imported all addresses, stop bitcoind/qt and restart it with the startup argument -rescan.

The rescan may take a couple of minutes/hours (depending on your Disk/RAM/CPU). Once done, you can call getreceivedbyaddress <addr> for each address to get the balance.

This result in authentic, self-validated data.

Note: If you are using Bitcoin Core 0.14, consider importing multiple addresses with importmulti


Are Closed Prices just the last trade or are they averaged? Since these exchanges run 24/7, are the posted close prices (say if the chart shows 1 hour increments like on bitcoinwisdom.com) based on the last trade for that time frame?  Or are they averaged over that time frame?

They are the endpoints. You can easily see that because in a bar chart, the bars always align with either the top or the bottom of the previous bar.


What is happening to the none approved transactions? Every 10 minutes only 1MB of transactions are been approved, so what happened to the rest of them? Let's say my transaction was not entered into the block, can I be sure that no one is going insert it to the next block?

Each node on the peer-to-peer network may store the transaction in its mempool, during which time they will continue to relay it to other nodes.  After some amount of time, the node will drop it from the mempool.  The default time in Bitcoin Core is two weeks but individual nodes are free to use a different value.

  Let's say my transaction was not entered into the block, can I be sure that no one is going insert it to the next block?

No, you can't be sure of that.  Certainly while the transaction is in most node's mempools, it will continue to be considered for inclusion in new blocks.  That's desirable for most people, who would prefer that the transaction get confirmed soon, even if it isn't confirmed immediately.

In principle it's possible that some node sits on your transaction, and that it makes its way into a block a long time later - years, even.  The only way to be sure your transaction is never going to confirm is to double-spend it: make a new transaction which spends at least one of the same inputs.  If the new transaction is confirmed (with a sufficient number of confirmations, say 6) then the old one can't be, because the block chain isn't allowed to contain conflicting transactions.


Problems generating addresses using bip32 I'm trying to generate bip32 addresses using the following (the PHP version).

https://github.com/prusnak/addrgen

The author provides a test MPK which I can get working that looks like this:

675b7041a347223984750fe3ab229df0c9f960e7ec98226b7182a2cb1990e39901feecf5a670f1d788ab29f626e20de424f049d216fc6f4c6ec42506763fa28e

However, the MPK I export from electrum does not work. Its much shorter and looks like this:

xpub661MyMwAqRbcGntu46CZtzegh5V3vT624SJqPVUgqzboX6A39f1hb8vEMrG555gV5QzVXEpPXqwayMQKu1ZKKRLkX9AoFvqPwAm3qL24AnE

The exact message I get is

pack(): Type H: illegal hex digit x

Any idea whats going on? Why does electrum's MPK not resemble the authors?

addrgen author here!

Addrgen was created before Electrum was BIP-0032 compatible and thus it used different master public keys and derivation method.

Please check the following PHP implementation which supports BIP-0032:

https://github.com/Bit-Wasp/bitcoin-lib-php

For python there are couple of implementations available, e.g.

https://pypi.python.org/pypi/bip32utils
https://pypi.python.org/pypi/pycoin/
https://pypi.python.org/pypi/bitcoin/


Perfect option scammed I have been scammed from the platform Perfect Option.
Does anyone else have any dealings with them?
I am interested to find out further information

They're an obvious scam. I mean, absurdly obvious.

I'm really baffled how anyone could fall for something like this. If someone had a way to reliably invest $10,000 and turn it into $120,000 in a month, what would they want your money for?

At that rate, $10,000 would become over $800 quadrillion dollars in just a year, 2,400 times the amount of money that there is in the entire world! Why would they bother setting up a web site and dealing with customers?

Investing always involves a risk/reward trade-off. If there was some way to get large rewards without taking large risks, everyone would do that and be rich. But that's obviously impossible -- there is no economic engine with that capacity. The planet would be entirely owned by every random person with $10,000 to invest in less than year. Where would all those planets full of yachts and mansions come from?

So such a low risk, high reward system doesn't exist. It can't exist. It is so many orders of magnitude outside of the bounds of what is even conceivable, much less possible.

There are a lot of copy/paste scam websites like this. They all have the same red flags all over them. Untraceable testimonials, bad English, no identifiable people in their management, and paragraphs of meaningless mumbo-jumbo.

But most importantly, there is no way anyone could tell what level of risk they would be taking even if the offer was legitimate. Of course, it can't be legitimate, because it doesn't tell you what risks you are taking. Anyone who understood what investment was should be able to immediately tell this is not a legitimate investment because the risks are not clearly disclosed.

If this were possible, nobody would ever have to live in debt. Just borrow $10,000 and next month you have $120,000. You could pay back the $10,000 loan, pay off $100,000 in debt, and have leftover to live off for the next month. Of course, nobody would be in debt -- why would anyone lend anyone $10,000 if they could invest it and have $120,000 in a month? Why would mortgages exist?

Seriously, I have to slap my forehead that people could think this is legitimate. I don't mean to be mean, but geez.


Detect types of ScriptSig and parse each part As explained in

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

there are many types of scriptPubKey and scriptSig like:

<sig> <pubKey>
<sig> <pubKey> <pubKey>
<sig> <pubKey> <pubHashA>
<sig> <pubKey> <pubHashA> <pubKeyHash>
...

how can we detect type of ScriptSig and separate each part?
In other words is there a length variable or something like that to parse each part separately?

Really, the only way to detect the type is to parse it as a program.

All scripts Bitcoin are written in the Bitcoin Script language. Much like any other programming language, certain symbols have special meaning, and correspond to specific op codes, which appear in the raw hex form. You can find a list of op codes on the Bitcoin Wiki: https://en.bitcoin.it/wiki/Script#Opcodes

The standardized scripts, which are usually what we see presented as addresses, are really just specific snippets of Bitcoin Script programs. For example, a P2PKH "address" is really just half a program in the form of:

OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

When combined with the remaining half of the program, which is provided as the ScriptSig when spending the coins, you get a complete program which can be evaluated.

To determine the script type, you really just need to parse the program (or partial program, in the event of an output) and see if it matches a known, standardized type.


Whats the process of Creating a Block on the BlockChain have been mining on pools and blindly going a long for the ride of

> generating a block

Can somebody walk through the process in simple terms of the steps involved in creating a block on the blockchain ?

What determines what transactions get included on the block we are mining ?

When miners try to compute a block, they pick all transactions that they want to be added in the block, plus one coinbase (generation) transaction to their address. They may include any transaction they want to form a tree of transactions later hashed into the merkle root and referenced into the block's header.

It is to note that for a block to be accepted by the network it needs to contain only valid transactions: inputs that are not yet spent, inputs that have the valid ammount, signature that verifies ok and etc...

After having a valid merkle root they build the block's header:

Version (4 bytes)
Hash of the previous block, thus making a chain of block (32 bytes)
Merkle root, the tree of transactions' reference (32 bytes)
Timestamp, number of seconds since 1970-01-01 00:00 (4 bytes)
Bits, a representation of the networks current difficulty (4 bytes)
Nonce, incremented when mining (4 bytes)

See more here to learn more on how to build the header.

Then this where your miner enters the game. It starts with the nonce at 0, hash (sha-256 2x) the block's header and then check if the hash in under the current target (if you are on a pool the share target). If not it increments the nonce and hash again. If the hash is under the current target YOU FOUND A BLOCK, you then transfer your block's header and the associated transactions' tree and the network accepts it. Because you had a coinbase transaction in your block paying to your bitcoin address those bitcoin then becomes yours.

It is to says that finding a block is rare so your miner will eventually run out of nonce to use you can then change parameter in your block header (more likely the timestamp) or add a extra nonce field in your transactions tree thus changing the merkle root.

As for which transactions are chosen to be part of a block, it is mostly the miners choice to include one or other transaction. But normally they would include transaction with a miners fee in it to gain more bitcoin, a miner could also choose not to include any transaction and only get the coinbase one. The propagation of ones transaction through the network also influence which transactions a miner do include.


Is there a mining software that I can run on my webspace (php, ruby, python)? Is there a miner written to be run on webspace, e.g. in ruby, php or python?

I know, it will be to slow and its not worth it, but I want to see it though :)

You should look into webminers - What is the status on webminers?

But generally, it's not really worth it. Unless you get a lot of high-end-graphic-card-owning users to stay on your website for a long while, you won't earn much. You can try running some of the webminers on your own machine and see how much you can earn for example by using my Mining Calculator. Having someone with a 100MHash/s graphic card (fairly decent for a non-dedicated miner) on for 24 hours would give you about a cent of revenue.

All in all, you're probably better off with adding some ads to your website.


Can an old passphrase recover my bitcoins using an old backup wallet.dat file? I forgot the new passphrase for my wallet.

But i previously backed up the wallet with a passphrase  i do remember.

Can i then access that previously saved wallet and recover my btc ?

The passphrase is stored as part of the wallet.dat file, so yes, that should work, as long as you haven't received any payments to addresses with private keys that don't exist in the old wallet.

Note that these received payments can actually occur when you send a payment, as a hidden "change" amount is sent to an unused hidden private key which is stored in your wallet file. Your old wallet file should have had stored 100 of these generated in advance though, which means you're probably ok as long as you haven't used more than 100 private keys since your backup.

Most payments you make will use one of the pre-generated private keys, as will each receiving addresses you create.


What would be an example for an insertion into the blockchain? I'm reading the paper The Bitcoin Backbone Protocol:
Analysis and Applications. On page 21, definition 8 reads:

An insertion occurs when, given a chain C with two consecutive
blocks B and B, a block B* created after B′
is such that B , B*, B′ form three consecutive
blocks of a valid chain. A copy occurs if the same block exists in
two different positions. A prediction occurs when a block extends
one which was computed at a later round

The word round seems to be indicating that the network is considered synchronous and time is divided into rounds. My understanding is that an insertion has a negligible probability but what would it look like if it did happen? I could use an example and more explanation for how insertions could happen and under what conditions.

An insertion occurs when, given a chain C with two consecutive
blocks B and B, a block B* created after B′
is such that B , B*, B′ form three consecutive
blocks of a valid chain.

For an insertion to occur in the Bitcoin blockchain, block B* would need to be a valid child of B:

a valid block at the corresponding height
commit to B as its prevBlock

B* would also need to be a valid predecessor of B':

The prevBlock in block B' would need to match the hash of B*

Finally, the block B' would need to be a valid block at a height one greater than the one it was previously found at.

These requirements are not just improbable but actually impossible to fulfill. Condition 1. is costly in that it requires expending sufficient work to fulfill the proof-of-work requirement of a valid block. Condition 2. would require finding a block that hashes to an exact value. This means breaking second pre-image resistance of SHA-256 which is considered infeasible. The good news is that if we can break second pre-image resistance, we can also find valid blocks more easily; the assumption that partial pre-images are hard to find are the core assumption of Bitcoin's proof-of-work algorithm. Finally, fulfilling condition 3. is impossible: each block commits to a specific block height in their coinbase transaction as required by BIP34. A block therefore can only be valid at exactly one height in a chain, and inserting another block in front of it invalidates the block.
Looking at the paper, it seems to me that that Definition 8 is chiefly used to prepare Definition 9 (emphasis added.):

Definition 9 (Typical execution). An execution is (ϵ, λ)-typical (or
just typical), for ϵ ∈ (0, 1) and integer λ ≥ 2/f, if, for any set S
of at least λ consecutive rounds, the following hold.
(a) (1 − ϵ)[X(S)] < X(S) < (1 + ϵ)[X(S)] and (1 − ϵ)[Y (S)] < Y (S).
(b) Z(S) < [Z(S)] + ϵ[X(S)].
(c) No insertions, no copies, and no predictions occurred.

I.e. the authors are trying to describe the three defined occurrences as atypical execution.


Do dormant bitcoin wallets go stale? I have a bitcoin wallet. There is not much money in it, and I do not want to run bitcoin-qt all the time.

I have a question. If I save it securely, so I can recover it at any time, but do not run it actively with bitcoin-qt, does the wallet go stale?

In other words, if, hypothetically, I have my wallet.dat safely in a file but without any software actively running it, will I be able to reinstall bitcoin-qt after an arbitrarily long period of time, read wallet.dat, and use the money stored in it?

Or will it somehow be completely out of sync?

Thanks

There is no expiration date for when an output can be spent.


Lightning network: Are decrementing timelocks used in bi-directional channels? I am surely not getting some part of this, but it seems to me that the paper and the video (both listed on the official Lightning website) contradict each other. In particular, the paper describes a simple bi-directional payment channel in Section 3 using only one timelock value (1000 blocks). In the video though they claim that in order to reverse the direction of the channel you have to use a shorter timelock (which makes indefinite number of channel updates impossible).

Are decrementing timelocks actually used in simple bi-directional channels? If so, what would go wrong if new commitment transactions were just created with the same timelock value, say, 1000 blocks?

The paper Towards Bitcoin Payment Networks (thanks this answer for the link) gave me a clearer understanding of the topic. Here is a very simplified summary of what I've learned.

There are multiple approaches to payment channels, including:

A simple uni-directional channel (replace-by-incentive);
A simple bi-directional channel (with decrementing timelocks, i.e., replace-by-timelock);
Duplex micropayment channels (see also: my related question);
Lightning network.

In Lightning, a single bi-directional channel is constructed using a breach remedy transactions (BRT), the idea being: before updating the channel state, both parties commit that if they broadcast an earlier state, the counterparty will be able to claim all funds. This is achieved with relative timelocks.

Furthermore, Lightning channels are connected into a network, where payments can be routed through non-custodial parties. This construction is based on hash time locked contracts (HTLC). The receiver generates a random value R, sends H(R) to the sender, and the sender specifies in the output script that R is requires to claim it. After the transaction propagates through nodes, the ultimate receiver discloses R and claims their funds; knowledge of R, in turn, allows all parties along the route to claim their funds from the previous node. In order to give each party time to do so, decrementing absolute timelocks are used.

Summary: the Lightning network does not use decrementing timelocks in a single channel, but uses them in multi-hop channel networks.


How important is the hash power in solving a block? What is the role of hash power in solving a black, I have read at numerous place it's more like a lottery to successfully form a block in bitcoin and any such crypto blockchain currencies.

Is it importance of hash power or luck that plays the role? If it's all about hash power then why is so, that people with huge hashes at time fail to achieve blocks but little ones get them? How much is real computation power involved along side fortune factor?

Hash power is like a lottery ticket. The more you buy the greater the chance you have that one of your tickets will match the drawn numbers.

But a person with one ticket can also win just the same. Each ticket has the same chance.

Having a higher hashrate simply gives you more chances to win within a given block frame.

In the end it boils down to luck. But the more attempts/lotto tickets/hashpower means your odds of finally matching/winning/solving increase.


What are the positives and negatives of "Flexible transactions"? What are the positives and negatives of Bitcoin Classic's Flexible Transactions? (related BIP 134)

Why aren't they used instead of Segwit? It seems that they solve the exact same issues as Segwit, in a more clear way.

The only issue I can think of is hard-fork vs. soft-fork, which is indeed an important issue, but if the code was cleaner, it's probably better to hard-fork. Also there are plans to hard-fork anyway by some miners, why aren't those for flextrans instead of segwit+large blocks?

Classic people themselves write There is no reason to choose SegWit over Flexible Transactions here

Why aren't they used instead of Segwit? It seems that they solve the exact same issues as Segwit, in a more clear way.

Segwit existed long before FlexTrans first came out and was almost ready for release by the time FlexTrans was even conceived. It has received far more testing and review than FlexTrans. In order to deploy FlexTrans, it would need to have much more testing, and have much more review.

Furthermore, FlexTrans requires a hard fork and for wallet developers to completely rewrite their serializers and deserializers to understand the FlexTrans format. Since Segwit is really just an extension of the current transaction format, it only needs a soft fork. This means that people can upgrade their software when they are ready and wallet developers only need to slightly modify their software in order to support segwit. They can also do so at their own pace. FlexTrans would require every wallet developer to perform a full rewrite or a new addition to their code which adds complexity and is more error prone. The FlexTrans format itself is also exotic and much more complex than the current format, and that can lead to potentially disastrous bugs.

Lastly, a hard fork to FlexTrans only transactions would completely break every single transaction in-flight at the time of the fork. It would make every single unconfirmed transaction that uses the current format invalid by the new hard fork rules, so every single unconfirmed transaction would need to be remade in the FlexTrans format. This also causes issues for transactions that have a lock time and the private keys necessary to spend those lock-timed coins have been lost/thrown away.

If a FlexTrans hard fork were to allow the current transaction format, then it wouldn't solve any problems. People would just keep using the current transaction format since using FlexTrans has no requirements to switch to using it. At least with segwit, if you have segwit outputs and want to spend from them, you must use the segwit transaction format. There is no such requirement to use FlexTrans. Furthermore wallet developers would then have even more complexity as now they need to have code that figures out when to use the current transaction format and when to use FlexTrans for serializing and deserializing a transaction. That is additional complexity and possibility for failure.

Therefore Segwit is preferred over FlexTrans. Segwit breaks less things, is easier to implement, and is backwards compatible, all of which FlexTrans is not.


Are there alternatives for proof of work? Bitcoin uses proof of work to secure the network, Ripple uses a global consensus system and PPCoin uses proof of stake.

Are there any known alternatives to the above methods?

A really quick answer is this: The proof of work system is a solution to the distributed synchronization issue; in another guise it is called the Byzantine Generals' Problem. Thus, any solution to this problem is an acceptable alternative, however the proof-of-work solution is particularly suited to distributed systems.

You can read Satoshi Nakamoto's discussion of this here.


Restore New Funds after Blockchain Backup If I transfer money into my Blockchain account after receiving my Json wallet backup by email, would it restore recently added funds?

EDIT:  According to this answer: Future addresses are not backed up, but you should have the option to receive a new email backup every time you make a transaction.

Without an official statement from Blockchain, you should assume that the backup does not allow you to restore future funds.

At the time of this answer, Blockchain states that they back up your wallet every 24 hours, which indicates they are probably not using deterministic wallets (deterministic wallets only need to be backed up once and can restore all existing and future private keys).

From the Blockchain.info Backups page:

  Your wallet is automatically saved on at least two separate servers and is backed up to an offsite location every 24 hours.

Note that this answer also states that the "keypool" is not enabled on Blockchain, which means future addresses would not be backed up

Description of the keypool from en.bitcoin.it:

  The wallet contains a pool of queued keys. By default there are 100 keys in the key pool.


Development environment requirements for Bitcoin Core Can someone help me out in understanding the System Requirements and dependencies required for setting up a development environment for Bitcoin Core?

What else is required apart from the Bitcoin Core source?

All the info you should need is here:

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


What is the maximum character length when sending a NXT message? I'm looking to see whats the limit of characters a nxt message can contain.

Right now it's 1000 bytes. Text is converted into bytes by using UTF-8 encoding.

Don't hardcode this limit, use "maxArbitraryMessageLength" parameter returned by "getConstants" API request.


Why are blocks and reverse patches not stored in individual files? Block and reverse patches are currently stored in .dat files, and in each .dat file there are several blocks or reverse patches. What is the reason why blocks are not stored in individual files called, for example, [block_hash].blk and [block_hash].rev and are instead stored in this way?

No file systems handle large numbers of files well, putting 600,000+ files in a directory would cause absurd performance problems. Opening and closing that many files during sync would have a performance penalty, versus appending to an already open file and writing its position to an index. Even attempting to delete a folder that large would be a struggle.
A reason the block files are as small as they are is due to limitations in windows file systems that have restrictive legacy compatibility.


Bitcoin and encryption To the best of my understanding Bitcoin uses encryption to create the digital signature, basically, by encrypting the hashed message (transaction?).

Would like to get your expert opinion to my claim the encryption is used by the Bitcoin protocol/algorithm.

Bitcoin uses cryptography to create digital signatures and cryptographic hash functions for various purposes such as transaction ids, block ids, and to commit to specific transactions in blocks. The Bitcoin protocol itself does not use encryption anywhere, but many wallets use encryption to secure private key material. There is also a Bitcoin Improvement Proposal (BIP) that aims to introduce encrypted peer-to-peer communication between Bitcoin nodes.

To follow-up on the question in the comments:

  "You have a bit-stream and you use a means called 'private key' to generate a bit-stream based on the original and then you use a 'public key' to uncover the original bit-stream - you use encryption."

The signatures in Bitcoin are created by means of the Elliptic Curve Digital Signature Algorithm (ECDSA). ECDSA uses two functions:

sign(privkey, message) which returns a signature
verify(pubkey, message, signature) which returns true or false

ECDSA does not qualify as an encryption algorithm, because the signature does not transport the message and there is no way to "recover the original bit-stream" from the signature. The verification of the signature validates that the correct key committed to the given message. This happens by means of evaluating an equation testing a mathematical relationship the triplet of pubkey,message,signature must fulfill for a valid signature.

H/T Pieter Wuille, David Schwartz, and John Newbery for the helpful comments.


How to get the number of Bitcoin transactions every 30mins using API in python? I'd like to get number of Bitcoin transactions every 30 minutes using API in python.

Does someone know sample code how to mount in Github or any website?

You can use the blockchain.info api (https://blockchain.info/api) and then track in your database the different number of transactions based on any time you would like.


How do you invert an ECDSA multiplication to get the generator? Pieter Wuille said:

  [...](people often assume that no inverse for EC multiplication exists, which is true, but only to solve for k in k*P = Q; solving for P is possible).

When you multiply a scalar value by an EC point, you get an EC point. According to the above comment, it is possible to take the output point and derive the input point. How is this done? Does it require knowing k?

Note that I'm specifically not asking about extracting the scalar value (k) from the output point.

Also note that this wouldn't be useful to breaking Bitcoin signature algorithm - the generator that private keys are multiplied by is publicly known.

k is just a scalar, modulo the order of the elliptic curve group.

Q = k*P

thus:

(1/k)*Q = (1/k)*k*P

thus:

(1/k)*Q = P

You find P by multiplying Q with the multiplication inverse of k modulo the curve order.


What is the size of different Bitcoin transaction types? I found this interesting take on Bitcoin transaction type trends from 2015.

As that article is from 2 years ago, I am wondering:

a. Are there any newer transaction types?

b. What is the average size of each of these transactions?

c. Is there a site/way to see the transaction types included in each block?

There are a number of different address formats and other standard transaction types:

Pay to Public Key (P2PK) outputs tie payments directly to the public key of the recipient instead of the derived address. These have been almost completely replaced by P2PKH, although sometimes mining rewards are still paid out to P2PK.
Input: 114 B
Output: 44 B (compressed), 76 B (uncompressed)
Multisig transactions were possible by using the corresponding OP_CODE directly even before P2SH was introduced. Most multisig transactions today are done with P2SH transactions today, though.
Input:  variable (depends on m-of-n)
Output: variable (must include all pubkeys)
Pay to Public Key Hash (P2PKH) is today the most commonly used address format. A P2PKH output signs over funds directly to an address derived from a single recipient key.
Input: 148 B (compressed), 180 B (uncompressed)
Output: 34 B
Pay to Script Hash (P2SH) was in the past foremost used for multisignature transactions, but any valid redeemscript is allowed. Creative use of P2SH allowed the introduction of backwards-compatible segwit addresses: "Nested Pay to Witness Public Key Hash" (P2SH-PWPKH or NP2WPKH) and "Nested Pay to Script Hash" (P2SH-P2WSH or NP2WSH) can be sent to by any client that can send to P2SH.
Input: variable (2-of-3: 297 B, NP2WPKH: 91 vBytes, NP2WSH 2-of-3: 139 vBytes)
Output: 32 B
Pay to Witness Public Key Hash (P2WPKH) is the corresponding native segwit format to P2PKH, making use of a witness program rather than a signature script. P2WPKH addresses are encoded with bech32 instead of base58 meaning that only clients that understand the native segwit format can send to them.
Input: 68 vBytes
Output: 31 B
Pay to Witness Script Hash (P2WSH) is the corresponding native segwit format to P2SH, making use of a witness program rather than a redeemscript. P2WSH addresses are encoded with bech32 rather than base58, only updated clients can send to them.
Input: variable (2-of-3: 105 vBytes)
Output: 43 B
Null Data (OP_RETURN) transactions are allowed to have a single output that writes up to 83 bytes of data to the blockchain.
Input: N/A
Output: x ≤ 83 + 11(?) bytes
Non-standard transactions encompass any other transactions that don't fit one of the above template. Non-standard transactions will not be relayed by most nodes in the network.

Additionally, transaction overhead adds 10 bytes for non-segwit transactions and 10.5 vbytes for segwit transactons (for numInputs, numOutputs < 256).

  overhead = version + numInputs + numOutputs + nLocktime = 4 + 1 + 1 + 4 = 10 bytes
  segwit overhead = version + numInputs + numOutputs + nLocktime + marker + flag = 16 + 4 + 4 + 16 + 1 + 1 [weight units] = 42 weight units = 10.5 vbytes

All size data is provided on a best-effort basis, corrections welcome. Figures with "(?)", I have been unable to corroborate. H/T to Pieter Wuille, Alex Bosworth, Raghav Sood, Sergi Delgado for corrections.

Note that due to the formatting chosen to represent ECDSA signatures in Bitcoin, they have variable size up to 72 bytes with most being 71 bytes or 72 bytes. The given figures above represent the maximum size of the input scripts.

Many of the above formats may produce variable input and output sizes.
Generally, the average transaction size has been 514 bytes in the past week. I suspect that this number may be absolute transaction data size and not virtual size, unfortunately blockchain data providers are still lagging behind on properly assessing segwit transactions.

p2sh.info collects a number of statistics on various transaction formats, but as far as I can tell unfortunately not the number of transactions using the respective formats in each block.


What is the purpose of XBTEUR.d tradable pair? On Kraken exchange fee page are listed tradable pairs. Some of them come with an extra suffix *.d, e.g. there are listed fees for together for XBTEUR and XBTEUR.d.

What is the purpose of these pairs? How do the fees are calculated? This information seem to be missing from the page.

The difference between XBTEUR and XBTEUR.d is that the former is on the "regular" kraken exchange whereas the latter is on a dark pool.

In substance, dark pool orders are only visible to the exchange (and the exchange will fill your order as and when somebody comes with an opposite order) but not to other market participants. In theory it allows you to place larger orders without the market knowing about them.

Note: in a regulated environment (say equities), the exchange is not allowed to use the information provided by your order to "front-run" you. I don't think there are any similar laws applicable to crypto-currencies - to be checked.

You can find additional information in the official announcements here and here.


Alternative uses of a blockchain-mechanism? Bitcoin's blockchain is basicly just a mechanism to record timestamped entries. Bitcoin uses it as a transaction ledger, but it could be used for many other things.

For example, one could create a chain for a decentral chess-game, where each move is an entry in the blockchain. All nodes can verify if the players turns are by the book, and in the correct order, and decide who is the winner.

Can anyone think of other examples of alternative chains?

Provably fair games can utilize it. For example, Satoshi dice published the hash of their daily secretkey hash list in the blockchain. In that way, they can prove that they haven't altered they secret key list. Or you could do a simple "guess a number" game that kept an encrypted copy of the result in the blockchain. Later reveal the secret key and

Essentially any kind of system that relies on the escrow of a small amount of information could use the blockchain for that escrow. You could even use it to as a communication channel if your messages were small enough.


Get the number of confirmations for an external address I'm building an application that tracks transactions between two points for multiple currencies, currently:
BTC, BQC, BTB, FTC, LTC, NMC, NVC, PPC, TRC, WDC & YAC.

I need a way to check the number of confirmations for the latest transaction to a list of external addresses.  For BTC i discovered that i could do this (in a somewhat round about way) like so:
At start get the balance: http://blockexplorer.com/q/getreceivedbyaddress/ADDRESS/0
Then later i can check that again, specifying 1 confirmations.
/q/getreceivedbyaddress/ADDRESS/1
and see if the balance has increased from the start point, if it has, i know a transaction that is 1 confirmation in has occured. then i can check:
/q/getreceivedbyaddress/ADDRESS/2 and so on and so forth.

This works fine.  But for all the other coins there is no blockexplorer.com, but there is what is most commonly used, bitcoin ABE.

In bitcoin abe you can do a similar call, for example:
http://bbq.cryptocoinexplorer.com/chain/BBQCoin/q/getreceivedbyaddress/ADDRESS
but from what i can tell bitcoin abe does not support the /N parameter at the end to specify the number of confirmations.

So now i am stuck.  I looked into running local instances of all the different coin deamons like bitcoind. But, although bitcoind has getreceivedbyaddress, bitcoind does not support this for external addresses.  Since i do not know the private keys of these addresses i cannot add them locally, and so bitcoind does not work for my purposes.

Since all the other altcoin clients are based on bitcoind, they all share the same problem as well.

Any help is greatly appreciated!

Looks like the functionality i am looking for is getting added to bitcoind.  Hopefully most of the devs responsible for their clones of bitcoin will update accordingly and eventually this functionality will be available for all cryptos.
https://github.com/bitcoin/bitcoin/pull/2121

EDIT: Also see this pull: https://github.com/bitcoin/bitcoin/pull/2861

Hopefully it gets merged into master soon.


What exactly does "trustless" mean in terms of Bitcoin? People often say that Bitcoin is trustless, what exactly does it mean?

I know you don't need to trust one of following entities when you transact in Bitcoin, but what don't you need to trust?

third party
recipient
other

You definitely need to trust Bitcoin system, right?

Bitcoin is untrusted, in that you don't need to trust a third party to use Bitcoin. Bitcoins are signed over directly from you to the recipient. This is binary, either the bitcoins remain under your control, or they have been signed over to the recipient. You can observe the state of your payment by running a full node, i.e. a Bitcoin client that enforces all rules of Bitcoin independently on the data it received from the Bitcoin network.

As you've suspected, you still trust the software that you're running, the community to continue operating Bitcoin under the same rules, and your recipient not to try to swindle you.

Each of those can also be mitigated to some degree, i.e.

you can review open-source software yourself (or pay someone to do it for you)
you are part of the Bitcoin community that maintains the rules of Bitcoin
if the recipient sent you a bill that specified the amount and the recipient's address, you can prove a confirmed payment by means of the blockchain even if the recipient denies receiving it.


Difference between createmultisig and addmultisigaddress on v 0.20.0? What is difference between createmultisig and addmultisigaddress? I ran 2 methods for 2 same bitcoin address on bitcoin-cli but gives different addresses as multisig to me. the results are as follows:
>  bitcoin-cli -testnet createmultisig 2 "[\"03f47a5115cd9e5e21b94136db90e2e3d6ac7e40396d8e62f73df3fd3fcfb3f214\",\"0395ad430034c1761bbe9b4dfd784fb06229970d54016a7e090fc6ceb3814611b5\"]"
RESULT:
{
  "address": "**2Mt1jgrBoojAHbJS5zGJTZnx4TFktUCCNxu**",
  "redeemScript": "522103f47a5115cd9e5e21b94136db90e2e3d6ac7e40396d8e62f73df3fd3fcfb3f214210395ad430034c1761bbe9b4dfd784fb06229970d54016a7e090fc6ceb3814611b552ae",
  "descriptor": "sh(multi(2,03f47a5115cd9e5e21b94136db90e2e3d6ac7e40396d8e62f73df3fd3fcfb3f214,0395ad430034c1761bbe9b4dfd784fb06229970d54016a7e090fc6ceb3814611b5))#6nexfs8d"
} ```

> bitcoin-cli -testnet addmultisigaddress 2 "[\"2NEy9um4CpWerPeaEhPa3TckNYWnh58yDXN\",\"2Mxr2oaph8iapbnbL1MSEvfZH8EQaXYuhAy\"]"

RESULT:
 {
  "address": "**tb1qjyvx2kwl4kq2cypj5zawhw5gpwxmphxe487z3hxj9m36ux8tylpszpazsu**",
  "redeemScript": "522103f47a5115cd9e5e21b94136db90e2e3d6ac7e40396d8e62f73df3fd3fcfb3f214210395ad430034c1761bbe9b4dfd784fb06229970d54016a7e090fc6ceb3814611b552ae",
  "descriptor": "wsh(multi(2,[a025344d/0'/0'/0']03f47a5115cd9e5e21b94136db90e2e3d6ac7e40396d8e62f73df3fd3fcfb3f214,[a025344d/0'/0'/1']0395ad430034c1761bbe9b4dfd784fb06229970d54016a7e090fc6ceb3814611b5))#gmdd9d2p"
}

why those addresses is different?
thank you

If solution suggested in the comment resolved your problem it's related to address_type in both RPC commands. It is legacy by default for createmultisig and set by -addresstype in bitcoin.conf for addmultisigaddress
You have used public keys in first command and addresses in second so I am not sure if the addresses are for same keys and in the same order.
Please refer to this question for order of keys: Is the `addmultisignature` API call dependent on order of public keys in the array? Or is it lexicographically sorted?


How can I migrate from blockchain wallet to Electrum? I would appreciate a simple step-by-step guide to migrate from Blockchain wallet (https://play.google.com/store/apps/details?id=piuk.blockchain.android) to Electrum wallet. Presumably I would have to use my blockchain.info wallet seed words to create a new Electrum wallet. Is there a step-by-step guide for this operation?

Thanks

P.S. I am not allowed to use "migration" and also "Blockchain Wallet" tags because I am a newbie

These steps are for new Blockchain.info wallets based of BIP39 seeds.
If you have previously imported private keys to blockchain.info they have to be exported separately, as they are not part of the keys derived from the seed.

Get your blockchain.info seed. Login to your blockchain.info account, click on 'Security Center' then click on 'Backup Phrase'. Be aware that onced the phrase is backed up, you won't be able to access it again on blockchain.info. So note it down carefully.
Start Electrum, choose to restore a standard wallet, then restore from seed, enter your seed, then click options and check the 'BIP39 seed' box. -> Click Ok/Next.
Blockchain.info follows the BIP 44 standard for derivation paths, so the default account has a derivation path m/44'/0'/0'/0
You should now have migrated to Electrum.


How to build Merkle root from merkle branches? Is there any help/tutorial on how to build the Merkle root from stratum data?

The Slushpool's stratum protocol has an example of a mining job but it does not contain any Merkle branches and I don't know if I am generating the Merkle root correctly.

Here is the string from Slushpool:

{"params": ["bf", "4d16b6f85af6e2198f44ae2a6de67f78487ae5611b77c6c0440b921e00000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff20020862062f503253482f04b8864e5008",
"072f736c7573682f000000000100f2052a010000001976a914d23fcdf86f7e756a64a7a9688ef9903327048ed988ac00000000", [],
"00000002", "1c2ac4af", "504e86b9", false], "id": null, "method": "mining.notify"}

This would indicate an empty block (no transactions). So only coinbase should be used to construct merkle root. So merkle root = Coinbase

Example block: https://www.blockchain.com/btc/block-index/512049/00000000000000000429a0c4fbe735b2d8b493daedf0207728543f748c262437

(edit: but please verify with others)


How to generate valid BTC address to withdraw coins to I set up bitcoind, and the complete blockchain is synced. I created a wallet, and I loaded the wallet.
How can I generate an address to deposit BTC to? I tried bitcoin-cli getnewaddress and I get this address bc1q4mglxdp28f693lw476fnmcesq25tmfkcsfqnpk, but at the Huobi exchange when I try to withdraw 0.001 BTC to that address as a test, I get the message "Invalid address."
What am I doing wrong? How can I create a valid BTC address on my loaded wallet to send BTC to?

Your bitcoin client is generating a P2WPKH (bech32 encoded) address, which is a newer address format which has some benefits compared to legacy formats. The address is valid, but for whatever reason, the exchange mentioned has not upgraded it's code to recognize and send to this address type yet.
The fix is easy: you just need to tell bitcoin-core to generate a legacy address. You can use the following command:
$ bitcoin-cli getnewaddress "(address_label)" "legacy"
You can substitute your own label in for the (address_label), this is just for local book-keeping purposes, it can also just be left blank if you'd like:
$ bitcoin-cli getnewaddress "" "legacy"


With SilkRoad shutting down, and BitCoins being seized, what does this mean for bitcoin? Over the past 2 days, it has come to light that the online market place SilkRoad has been seized by the FBI. Also, they have seized $3.5m worth of BitCoin (which must've been in Escrow).
http://www.bbc.co.uk/news/technology-24381847
http://arstechnica.com/tech-policy/2013/10/feds-shut-down-silk-road-arrest-alleged-admin-dread-pirate-roberts/

What does this mean for the BitCoin cryptocurrency - can we expect a sudden increase in the value of a BitCoin? Or because BitCoins biggest source of transaction is shut down, will we see a sudden crash?

The above does not have to be strictly related to the amount that was seized - it can be influenced by peoples view of bitcoin after the seizure of the money.

Also, is BitCoin itself in trouble for "money laundering" or anything similar?

Bitcoin being seized

The bitcoins on SilkRoad have been seized by gaining access to the private keys of the SilkRoad's wallets. Government agencies have seized bitcoins once before in a similar fashion from a customer of SilkRoad. $3.6m are somewhere around 30k Bitcoin out of the around 11.75m currently existing. For comparison more than 500k BTC have been transmitted in the last 24h according to Blockchain.info. The amount that was seized is economically insignificant and as it probably will be held as evidence for the trial, will not have any influence on the bitcoin market itself.

SilkRoad being shut-down

Bitcoin has plenty of legitimate reasons to be used, so that this one illegal reason should not be all that important.
Bitcoin is useful for/because:

International money transfers (superior speed, reduced cost, however you have the currency risk)
Faster and cheaper for shop owners compared to credit card payments
No exposure of credit-card information when online-shopping
Solves a bunch of problems for services such as porn merchants (no chargeback (buyer's remorse is a big problem for them), pseudonymity, fast, cheap, easy)

Bitcoin has started building a lobby (Bitcoin Foundation, Angle Investors, Investment Trusts, Exchange Traded Funds) and businesses (Exchanges, Webstores, Mining equipment manufacturers, Gambling) have been gathering investments, so that there is funded interest to keep bitcoin going.

I don't think that it was particularly unexpected to see SilkRoad shut down and don't think that it will be a bad thing for the bitcoin project. If anything, it might prove to be an opportunity for the bitcoin project to show that it has evolved beyond just shady use-cases.


Hash that defines previous block in Blockchain vs mathematical solution Is the hash that defines the previous block (block A) in a new block (block B), the same as the hash the miner calculated to submit block A?

As far as I know, you need to find a nonce so that the hash of the entire block A starts with zeroes. If you find a fitting nonce is this hash with the zeroes used by the next miner in his block b when he links to your block with the previous hash?

To clarify, if person A found a nonce so that the hash of his block is 000231 is the hash in the previous field of the next block also 000231?

Thanks

Yes, it is. That is the hash of the block header, so it is used as an identifier for that block, and is used to reference it in the next block in the same way that a hash of a transaction (txid) is used to refer to that transaction.


Do NXT aliases expire? And when? Since NXT aliases are like domain names. Do they expire? Currently alot of people are squatting aliases and was wondering how the NXT community plan on fighting that?

Nxt aliases do not expire now, and probably never will (since it would be unfair to change the rules after people paid for them). There is an upcoming change to allow them to be transferred, so you may then be able to buy them from squatters.


bitcoin listunspent showing an address which does not belong to my wallet I use bitcoin listunspent to list unspent UTXO, but found one that doesn't match my addresses, so what's that address and where is it from ?

bitcoin-cli listunspent
[
  {
    "txid": "edc69b3fb53bd221129c4e0f115bdaa5227d01173a23aac2064fc29a78006714",
    "vout": 1,
    "address": "2MtkQ9MeXv9vKeFLuTPeEPfj5DQfWnL1jbw",
    "redeemScript": "0014e329000822d1b101d7940800ff2983aa54b33374",
    "scriptPubKey": "a914107caab5b5a035de348d22aa865d20db3fb1907987",
    "amount": 0.54856181,
    "confirmations": 92,
    "spendable": true,
    "solvable": true,
    "safe": true
  }
]

If you have sent and received Bitcoin before, then this output is likely a change output.