How do you generate a NXT / Ardor address using javascript only? I'm looking for a way to generate an nxt/ardor address using only a javascript library and without having to be online. Is there a js library that can generate a nxt/ardor account by passing in the secret passphrase as a parameter?

Codepen Example: http://codepen.io/satoshinakamoto/pen/ObGwXy?editors=1010

Yes, you can generate the nxt/ardor address by using the following function call:

NRS.getAccountId('asdf'); //Generates the

NRS.convertNumericToRSAccountFormat(NRS.getAccountId('asdf')); //Converts that ID to RS (reed solomon) format

Found in html/ui/js/nrs.encryption.js

You will need the following html setup and js files to generate nxt addresses without the need to be online:

<!DOCTYPE html>

    <meta charset="UTF-8">

Welcome


When transferring money between a bank and bitcoin exchanges, might the bank suspend my account? I'm based in the UK and am worried that my UK bank might have a problem with me transferring money to or from a bitcoin exchange, for example, Mt Gox.

I know that Paypal will suspend an account if it's involved with bitcoins, but does that also go for high street banks?

There have been numerous reports of exactly this happening on bitcointalk.  This thread lists several people talking about this problem: https://bitcointalk.org/index.php?topic=255174.0;topicseen.  Another person also asked why this happens so regularly right here on stackexchange and received what sounds like a pretty good answer: Why so many bitcoin exchanges have their bank accounts closed and have problems establishing bank accounts?

I do not live in the UK, so I cannot speak with personal experience about UK banks' opinions about Bitcoin.  But if you are interested in buying bitcoins and concerned about having your bank account closed, I would encourage you to open an account with the Internet Credit Union: https://internetcreditunion.org/  They went on record at last year's Bitcoin Conference saying that they will support Bitcoin with their Credit Union, see their presentation for more details: https://www.youtube.com/watch?v=RD6fVNGEnlI&list=PLUOP0P68GJ3BGjfqoLLnzAefk3ZzXQtJ7&index=5  Unfortunately, I don't remember where in the 34 minutes it was that they said that, but it's in there somewhere.

Their bank is based in the United States, but their signup page (https://internetcreditunion.org/form-membership-application/) says you can use a foreign passport and United States tax ID number to get an account.  So if you're willing to get a tax ID number, you can get an account with them.  That would be my recommendation if you're interested in buying bitcoins without having to worry about having your bank account closed.


Trading bot - what is the maximum load an exchange server can take? I did create my own altcoins trading bot in Python3. The bot trades on the minute market and is multi-threaded. Which makes that a lot of requests are send to the server of the exchange.

I'm (was) using Bittrex as exchange. Although it did works, the bot required some more fine-tuning. I was in that process when Bittrex blocked my account, without explanation. I guess I was demanding a bit too much from the servers, as the threads addressed as much as 10 requests per seconds.

Now the question is: in order to avoid being blocked, what is an acceptable request rate for such a server ?

TIA

Christophe

Finally, after 7 days of waiting, I got this answer from Bittrex:

  Your account has been re-enabled.
  "Your account was disabled for API-ABUSE.  Please refrain from making more than 1 request per second or you can expect your account will be disabled again"

Now you now it too, fellow bot-users: no more than 1 request per second !

HTH


RAM usage of very small systems What is the absolute bare minimum RAM required for a full node.  So for example a pi zero with 512MB RAM, could that act as a full node?

If not what components are causing the RAM usage, my own theory is that the txleveldb is fully loaded to RAM?  If so as the chain gets longer, RAM usage will need to increase?

just look at the Page where its written Sir

https://bitcoin.org/en/full-node#special-cases

2 Gigabyte RAM you must have,  otherwise fail you will ;)

And what i forgot to say, it is not the length of the Blockchain, it is the mass on Data for Transactions, forwarding money, Blocks and so, Mempool simple.


Can you explain to me how this transaction work? I was looking at bitcoin rich list and found binance cold wallet

For this transaction in particular https://www.blockchain.com/btc/tx/afb6523e4f5f060a076dcc2f8e5eb7a1aa58a3831456c62da946e2b5a41c24f0 whats going on under the hood? Why is the same address 8 times as input with different balances(?) number ?

Thanks

Bitcoin uses a UTXO (unspent transaction output) model for transactions, see here for why. This means each time you spend a coin you create an output that is assigned to an address (or multiple outputs to different addresses), and those outputs must references previous unspent outputs to your address. You have to spend all of the coins from the utxo, so usually there is a change output that goes back to the original owner (usually a different address that they own, for privacy reasons).

  Because each output of a particular transaction can only be spent
  once, the outputs of all transactions included in the block chain can
  be categorized as either Unspent Transaction Outputs (UTXOs) or spent
  transaction outputs. For a payment to be valid, it must only use UTXOs
  as inputs. - https://bitcoin.org/en/developer-guide#block-chain-overview

You are seeing many unspent outputs on the left that the address 16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe is using to add up to the values on the right that it wants to send.


After being officially canceled, SegWit2x is live. Will transaction replaying be massive ? If yes what does this means? As you know, segwit2x was officially canceled last week, but some miners decided to still go forward today, and some exchanges like coinbase plan to support the hard fork.

So things will happen like this for double spending one segwit2x exchanges resume deposits and withdrawals (If I understand correctly) :

The frauder installs 2 bitcoin wallet software on his computer : one supporting segwit2x and another one which doesn’t (both using the same wallet format).
He sends non segwit2x bitcoins to his wallet on his computer.
He backup his wallet file.
Frauder then perform a segwit2x transaction through his segwit2x software to an exchange accepting segwit2x. The transaction being larger than 1Mb block size, it is rejected on the original blockchain and he keeps his balance on the original blockchain but not on the second.
He then replay the same transaction by using his backed up walled through his non segwit2x software to an exchange not supporting segwit2x.
Frauder then converts his segwit2x bitcoins to an other cryptocurrency like Doge or Litecoin, and send them to an exchange not supporting segwit2x (which he converts to original bitcoin).
He does the same operation on the exchange were he sent his replayed transaction (and sends the doge/ethereums to the same exchange he sends his ethereum doge converted from segwit2x).
He then repeat the operation by resending his doubled non segwit2x bitcoins to his wallet on his computer.

So, if I understand correctly, the price of the original chain should go down to zero due to the trivial arbitrage operation described above and price of segwit2x chain should explose, correct ?
So I suppose this means I should get out of exchanges implementing the update, isn’t it ?

If I misunderstood, please explains what transaction replay means.

Frauder then perform a segwit2x transaction through his segwit2x software to an exchange accepting segwit2x. The transaction being larger than 1Mb block size, it is rejected on the original blockchain and he keeps his balance on the original blockchain but not on the second.

Note: just because a transaction on the 2x chain is in a block larger than 1MB, that only makes the block invalid on the main BTC chain, but the transaction itself can still be replayed on the BTC chain.

Frauder then converts his segwit2x bitcoins to an other cryptocurrency like Doge or Litecoin, and send them to an exchange not supporting segwit2x (which he converts to original bitcoin).
He does the same operation on the exchange were he sent his replayed transaction (and sends the doge/ethereums to the same exchange he sends his ethereum doge converted from segwit2x).

Up til this point, all you have done is sold your S2X and your BTC for Doge or Litecoin, you have gained nothing extra. This is equivalent to selling both your BCH and BTC for Litecoin after the BCH fork.

He then repeat the operation by resending his doubled non segwit2x bitcoins to his wallet on his computer.

Firstly, he would not have doubled the non-S2X bitcoin. Even if there was trading support for S2X, the price would be much lower than the price of bitcoin so you might only gain a small extra percentage from the sale. For example HitBTC price for B2X is currently 0.034 BTC, so in selling your B2X you would only gain 3.4% more BTC than what you started with.
Secondly, after you have purchased post-fork BTC, you would not get the corresponding S2X coins too. You would only get the BTC that you purchased. So you cannot repeat that procedure. All you have done in the method you outlined is sell your S2X coins for a small amount of extra BTC, which is fine. In general, you only get corresponding fork-coins of BTC you hold at the time of the fork, nothing if you bought them after or sold them before the fork occurred. (Unless, due to no replay protection, the coins could not be separated, in which case you wouldn't be able to sell them either).


How do I determine my transaction fee in an automated way? When I send Bitcoins through Electrum, I just pay whatever transaction fee the software recommends. Now I'm writing a program that will have to determine the size of the transaction fee on the fly.

How is this computed? It looks like Electrum is consistently recommending .0002 BTC for each transaction but I read elsewhere that resolving the fee amount depends upon the size of the transaction. In an extreme example, if I wanted to redeem 15 tiny unspent outputs and send them to 2 destinations (the receiver + my change address), would the unusually large number of inputs for the new transaction justify a larger transaction fee? If so, how much larger?

How is this computed?

Bitcoin Core offers something called fee estimation, where you can gauge the amount of fee that is probably necessary to get a transaction into the next block. It returns the fee per kilobyte to get into one of the next n blocks, assuming the miners making them have similar transaction acceptance rules as prior ones.

1 confirmation 0.00026816 BTC
2 confirmation 0.00011483 BTC
3 confirmation 0.00002048 BTC
4 confirmation 0.00001255 BTC
5 confirmation 0.00001255 BTC
6 confirmation 0.00001255 BTC

Emulating this without running a fully validating node that can evaluate its memory pool over a long period of time is probably not particularly doable at present. Centralized wallets like Mycelium make HTTP calls to their own endpoint which returns this information on their behalf, there will probably be more endpoints for this in the future given the difficulty of estimating fees for non fully validating wallets.

  would the unusually large number of inputs for the new transaction justify a larger transaction fee? If so, how much larger?

The transaction fee is per kilobyte. Adding additional inputs requires both the public key for the address and a signature, and some miscellaneous overhead to be included. It will often be about one hundred bytes per vin, but this varies if the input is P2SH or not and if the keys used were compressed or not. Generally if the input is below 0.00005 BTC it is probably going to add more in cost in fee than the value of it to include.

This transaction on mainnet is similar in size to the one you describe, it has 16 vin, 2 vout, for a total size of 2291 bytes. The key for 1FkiXxeKektpHVjvfknVvC6eQmjM9DEu9D is compressed (begins with 02 and is only 33 bytes long) which contributed to the small size of the transaction.


Can I use the same bitcoin address to receive more than one payment? I used an old address I once used to receive a payment; can I still receive funds in that address even though the address on my bitcoin wallet has changed? The vendor claimed he made the payment but I can't find it in my wallet. What do I do?

An old address can be reused, but its usually recommended you don't do so for privacy reasons.

Even if you wallet is displaying a new address, it should still show a balance that includes any recent payments made to older addresses.

To be sure, check the receiving address on a block explorer website, and if the vendor is telling the truth, you should see the recent payment in addition to any past transactions. At that point,  try re-syncing your wallet if the payment isn't displaying properly.


Download of Multibit Windows 64 Bit has corrupt signature I'm trying to download Multibit from https://multibit.org/community.html the Win 64 version.

it consistently gives a 'The signature of multibit-0.5.18-windows-setup.exe is corrupt of invalid.'

is anyone else experiencing this?  Any Suggestions?

There are various signatures tha you can use to ensure the integrity of your MultiBit downloads.

The 0.5.18 release notes have SHA256 hashes of the binaries:
https://multibit.org/releases/multibit-0.5.18/release.txt

You can check the SHA256 hash of the file you have and it should match.
If it does NOT match then DO NOT USE it.

Try downloading it again from https://multibit.org. It could be that it the download failed.


NBitcoin - how to set RBF to true in order to give higher fee for transaction I have a few transactions staying unconfirmed - been a few days now.

I suspect the minimum  mining fee was upped - 15 minutes prior I was still doing hundreds of transactions a day at that fee - but now it is not enough.

All documentation indicates this is an easy process - simply use the same TX as you used earlier.

I am now feeling that this is more involved.

I took the unconfirmed TX - and goot its prev_hash.

I loaded the TX of this prev_hash and resubmitted it to BlockCypher - and get the message :

Error sending transaction: Unable to lock an input of transactions xxx, likely already spent by yyy..

It correctly identifies that unconfirmed transaction in yyy placeholder.

Thus it does not want to spend it as its already spent.

Now there is a Readonly RBF property on NBitcoin.Transaction class.

RBF means "Replace by Fee" which is what I want to do - but I can't set it as it is read only.

How do I go about to indicate this is a RBF?

NBitcoin just follow BIP125

public bool RBF
{
    get
    {
        return Inputs.Any(i => i.Sequence < 0xffffffff - 1);
    }
}

If you are using the TransactionBuilder for creating a transaction, you have two ways:

One is to use TransactionBuilder.SetLockTime(blockHeight) where block height is the currentHeight-1 (actually, if you put 0 it will be fine as well)

The other way is to build your transaction without signing first with TransactionBuilder.BuildTransaction(false) change one of the input sequence, then use TransactionBuilder.SignTransaction to sign.


Mining: is there also "luck" factor ? I'm almost new in Bitcoin / crypto currency world.

I know that "old" coin like Bitcoin and others (for old i mean 2-3-4 years), when you want to mine there is a difficulty variable to considerer.

My question is: if i put my CPU (or my low computational GPU) to try to mine, can I except to be "lucky" and mine ..something ?
My question is : is there also a "Lucky" factor to consider when you try to mine cryptocurrency, or .. it is only a cpu/gpu power matter ?

Thanks

Yes there is a luck factor - mining is just probabilities, it is all about luck and probability. Technically every miner, no matter how big, has a chance of mining the next block. But more powerful miners have a higher chance, like they've bought more lotto tickets, than those who have only smaller mining rigs. This makes the probability of mining a block using a GPU so tiny that it's almost certainly never going to happen.

See this answer for more info: In the ASIC-age, is it worth starting mining Bitcoin at home?


BTC denominated vs fiat denominated stock exchange? What could be done more easily (or just be doable) in a BTC-denominated stock exchange that is difficult (or plain impossible) in a fiat-denominated one?

i.e. what features of a BTC denominated exchange would make it relatively attractive to ordinary traders?

Advantages of BTC stock exchanges

1) Speed of deposits and withdrawals

Ordinary investors (in USA where there is no SEPA) use ACH transfers or checks to fund their brokerage accounts. ACH transfers take 3 business days and make no progress on the weekends. After this is in the brokerage account it takes another 3 days for the cash to "settle". So in an extreme case where there is a holiday weekend, a money transfer to a stock exchange (with the intent to buy stock based on new time sensitive information) on a Thursday will take

(1) Friday, (1) Saturday, (1) Sunday, (1) Holiday Monday, (2), Tuesday, (3) Wednesday, (1-Settle) Thursday , (2-Settle) Friday, (2-Settle) Saturday, (2-Settle) Sunday, (3-Settle) Monday, (Tradeable) Tuesday

On Software as a Service bitcoin denominated stock exchanges (this is also known as "centralized") this takes just a few confirmations which will average an thirty minutes (3 confirmations) to an hour (6 confirmations) to fund an account, and the bitcoin is immediately then available for trading. For trades requiring less time to profit, the user can limit exchange risk by withdrawing their bitcoin from an exchange when they are not using it, and this only takes another the time for it to confirm to their personal addresses. Using ACH transfer from a fiat exchange will again require 3 business day cash settlement time (for stock sells, derivatives have 1 business day cash settlement time) and an additional 3 business days to reach their actual bank account.

If this investor is using a check from the brokerage, the time is further compounded by an 3 business days in snail mail.

But Wire/SWIFT transfers obviously aren't much better, due to the cash settlement time before the transfer happens.

On a decentralized exchange (using mastercoin protocol, counterparty, or colored coins), one does not need to "deposit" bitcoin at all, but the sacrifice being the stock trades themselves are at the mercy of the confirmation speed, so many kinds of trading (time sensitive under 30 minutes) are not practical, but investing and swing trading is. Colored Coin protocol does not have this sacrifice. On decentralized exchanges AML is impossible barring some future invention that attempts to make some bitcoin tainted to the entire network.

2) More liquid and greater fungibility: Investment funds can be spent for goods and services, indistinct from a personal wallet's funds.

On fiat stock exchanges, brokerages create investment accounts where cash has to "settle" and be transferred to a bank account before it can be spent on goods and services. We have already established that this can take two weeks.

On bitcoin exchanges, the user's exchange addresses (accounts) are indistinct from their personal accounts. On the centralized exchanges, they function as hosted wallets, if userA wants to get paid to a bitcoin address, userB doesn't know if the requested address is being accessed on bitcoin-QT or tied to an account on a stock exchange. Similarly if userA wants to send funds from a stock exchange they can simply 'withdraw' it to userB's requested address.

On decentralized exchanges, once again the user's funds have never left their private wallet to begin with and there is no concept of withdrawing before money can be spent on goods and services.

3) Economic freedom. Invest in companies in any jurisdiction in the world, and for-profit decentralized services that have no jurisdiction.

In fiat stock markets, a company has to list in each individual market in each individual country, and investors outside of those markets/countries cannot invest. (If an investor has practical access to invest in foreign stock markets, they are not your ordinary investor). Also many markets and countries have capital controls as well as socioeconomic barriers to entry.

In bitcoin stock exchanges, these barriers do not exist. If you want to invest in a hot sector in Gangzhou China or Missouri USA, you can just do that. On centralized exchanges, site operators have at some points attempted to limit people from certain countries (america) from accessing their markets, due to liability issues. With decentralized exchanges there is no practical way to limit access in this way.

4) Low to nonexistent costs to listing a company.
Many more types of crowdfunding can take place since hundreds of thousands of dollars in legals fees are not necessary to create an asset for trading.

5) Smaller investors can invest.
In fiat stock exchanges, minimum funding requirements can be $2,000 for a margin account or minimum account size at all. Its fun to tell teenagers to invest $100 a week in a stock so they'll be rich by the time they are 50, but no decent brokerage will let them open an account, and they'll be better off trading Nike shoes and go on to other frivolous activities.

In bitcoin stock exchanges this doesn't exist. Some centralized exchanges have high fees to enter, decentralized exchanges cannot barring a future protocol that does.

6) Lower fees to trade.
centralized exchanges have their own trading fees. decentralized exchanges will only have the network fee and whatever their protocol requires.

fiat stock market fees can be much higher, at 'discount brokerages', in direct access markets, and in tailored investment firms (bucket shops)

7) Data feeds are not delayed, free
Fiat stock markets give delayed data unless the investor goes out of their way to find better and better data with more and more custom tailored services. It is only a fairly recent change that an individual investor can get live quotes across exchanges at all, let alone level 2 order book information. But even then, this investor has to do a lot of research to find ways to do this cheaply.

No bitcoin stock exchange delays data. This would actually be hard to do. This is impossible on decentralized exchanges and no centralized exchange would gain a community if they did that.

8) Free API access
In fiat stock markets, getting API access to data feeds is impossible or very expensive. Nasdaq charges $6,000 a month for this access, and the protocol (FIX) is very antiquated compared to JSON and restful services.

Bitcoin stock exchanges all user modern JSON, some use various forms of restful services and Oauth. All provide this for free, not as a courtesy but because that is modern and the data is there.

Now ordinary investors are able to both VIEW live data and retrieve it via API for their own applications.

With fiat stock exchanges, making trading applications such as automated bots were largely out of reach for ordinary investors due to the restrictions in data access, contributing to an illusion that "High Frequency Trading" was an unattainable mystical trade reserved for the mystical quantitative programmers in secretive hedge funds.

9) 24/7 market hours

Bitcoin stock exchanges never close. Trade any asset any hour of the day. There are no gap ups and gap downs due to information coming out while markets were closed.

This is an advantage because information can become available at any time for a security in any part of the world.

In centralized exchanges, implementing "closed" hours is difficult (but a future exchange may opt to do this), and in decentralized exchanges this is impossible barring some future protocol change.

Advantage of fiat stock exchanges

1) Margin, lots and lots of margin. bitcoin currently does not have a practical way to offer margin for stocks.

2) SIPC insurance, for stocks. If the exchange shuts down many regulatory environments have a way for depositors to get their money back up to a point.


Is blockchain always "public"? Is the following definition of blockchain by its wikipwdia page correct?

Where it is mentioned:

  A blockchain is a decentralized, distributed and public digital ledger
  ...

Cannot we have a private blockchain? And if so, is the above proposition wrong ? when it says always a blockchain is public.

An example: Consider a company or organization which aims at using (permissioned) blockchain such that it is visible only for its (internal) employees. So, it uses ex. visibility property of blockchain but limited only to internal employees.

Please Note that here the question is NOT if using a permissioned blockchain is logical or not, but also the question is the exact definition of a blockchain. So, according to definition of blockchain in its wikipedia page, a permissioned blockchain is real blockchain?

Ok, you can create your own private blockchain. It will be visible only by yourself. Nobody will not even know about it. I do not see any reason for it, but you can call it "blockchain" if you want. You can call it "my private blockchain" or even give any name for this technology, for example "nsdfuishgreryuiw"


remote channel message: Unreasonable to_self_delay = 2016 (max=2000) so tried to open a node whose owner opened the port but I get this message above: remote channel message: Unreasonable to_self_delay = 2016 (max=2000). I tried on both elcair wallet and bitcoin lightning wallet.

Usually you can configure the timelock that you wish your channels should have and the maximum timelock that you are willing to accept. Eclair mobile will set the maximum value that is allowed according to the protocol which is 2016 blocks or statistically two weeks. This means you can technically have your mobile turned off for up to two weeks and still be able to act upon a channel breach.

It looks though like the other node you have has set that it will not accept values above 2000.

You should see if you can configure one or both nodes to make those values be compatible to each other


Is it possible to retrieve bitcoin address? I have Bitcoin daemon running in Amazon AMI, i have some balance in my bitcoin wallet, suppose i re-install os/daemon, is it possible to retrieve those balance what happened to that bitcoin addresses(Is it available in my wallet/all addresses will be lost?)

All you need to do is to extract the private keys for the addresses that hold any balances into your wallet and then import these keys back to your fresh installation.


Bitcoin core 0.19.1 RPC, 'sendtoaddress' not working! Suppose this scenario:

There are 2 wallets called wallet1 and wallet1 on the same node in testnet blockchain.
wallet1 balance: 0.001 BTC
wallet2 balance: 0 BTC

I am trying to send 0.001 BTCs from wallet1 to wallet2; so I use the sendtoaddress command like this:
bitcoin-cli -testnet -rpcwallet=wallet1 sendtoaddress <wallet2 address> 0.001 "" "" true.
This gives me a txid which none of the blockchain explorers like live.blockcypher.com/btc-testnet can't recognize it!

It deducts the coin from wallet1 and I don't know where does it go!?

For solving this, I tried to get the transaction hex to broadcast it via some other platforms to check if the raw transaction is correct and it was OK and after broadcasting it via the other platform, blockchain explorers could detect the transaction id.
Here are my question:

Isn't just using sendtoaddress enough for sending coins?
Why the broadcasting process doesn't complete on my node?

Here is my bitcoin.conf:
[test]
prune=600
blocksonly=1
maxconnections=15
testnet=1
regtest=0

deprecatedrpc=accounts
deprecatedrpc=addwitnessaddress
deprecatedrpc=signrawtransaction
deprecatedrpc=validateaddress

minrelaytxfee=0.0001
maxmempool=200
maxreceiverbuffer=2500
maxsendbuffer=500
dbcache=16000

rpcbind=0.0.0.0
rpcallowip=--

rpcuser=--
rpcpassword=--

server=1
rest=1
daemon=1

The main problem is the parameter blocksonly=1 in bitcoin config file. This prevents the node to broadcast transactions to the netwrok. I removed it and it works fine!


How does the SuperNet NXT Multigateway Exchange work? I'm still trying to figure out how the multigateway exchange works for nxt. i see you can put your bitcoins and other altcoins into the system and trade on top of the asset exchange using the nxt wallet creating a decentralized exchange. my concerns are:

Do my bitcoins / altcoins goto a centralized wallet like how typical exchanges work today?
Who controls the coin wallets and what if they need to be rebooted?
What prevents the multigateway admins from running away with our coins?
What are some major advantages to over typical exchanges today like cryptsy / poloniex / bter?

The main advantage of the MGW exchange over traditional exchanges is that for protocols which support multisig, all funds are stored under 2/3 multisig accounts on 3 geographically separate servers, most likely, owned by different entities.


Challenge difficulty adjustments Basically for this question I need a confirmation that all of my listed assumptions are fairly accurate.

The bitcoin network measures how much time it took to create the last 2016 blocks in a blockchain. If it took significantly more than 2 weeks, the challenge difficulty is reduced. If it took significantly less than 2 weeks, the difficulty is increased.

Who performs these measurements? Every miner for themselves? I assume, since they operate on the same algorithm, they automatically change the goal for their algorithm from time to time without having to verify their assumptions with anyone.

For example, for some time a certain miner has been trying to provide responses to challenges so that the hash(challenge+proof) has 40 leading zeros.

After each new block is being inserted in the blockchain, a miner measures the time it took to produce last 2016 blocks.

If the measured time is higher than a certain treshold, difficulty should decrease.

From then on, the miner simply starts submitting proofs of work that result in 39 leading zeros.

The miner is counting on the fact that the other miners had the same conclusion and that they will accept his answer, his proof of work?

Even though the miners didn't have an official agreement - "From now on, we are all solving an easier task. Ok? - Ok! - Lets go!"

I assume, since they operate on the same algorithm, they automatically change the goal for their algorithm from time to time without having to verify their assumptions with anyone.

Yes that is correct, every node in the network must calculate this independently and come to the same result. All content used for validation is always independently constructed by every full node, you can manage complete synchronization of the Bitcoin network using only block binaries and no further information at all.

  For example, for some time a certain miner has been trying to provide responses to challenges so that the hash(challenge+proof) has 40 leading zeros.

"Number of leading zeros" is frequently used to describe Bitcoin mining but doesn't really reflect how proof of work operates, it merely shows a side effect how the blocks are encoded and displayed to users. SHA256 hashes are 256 bit integers, miners are attempting to find block hashes that are lower than a particular integer target. If the system were just based on the number of zeros in the hex encoded hash there wouldn't be enough granularity between two levels.

  Even though the miners didn't have an official agreement - "From now on, we are all solving an easier task. Ok? - Ok! - Lets go!"

That would be against the consensus rules, and any blocks arbitrarily targeting the wrong value are simple discarded. Nodes in the network strictly validate every single rule and throw out any blocks with don't follow them. Miners only exist to order valid transactions into blocks and provide relative trust to SPV clients where required, they don't set the rules.


How exactly are Bitcoin's consensus rules enforced? There are some rules called consensus rules, for example the block generation amount.
And it is said that "a change to consensus rules is a hard-fork".
But how exactly are the consensus rules enforced?
The internet says that the consensus rules are the rules that every full node follows. And every node rejects blocks that do not meet consensus rules "no matter what".
Ok.
But.
Must ALL of the full nodes accept? Or should MOST of the full nodes accept? Or is there some "holy full node" that must accept?
What if one controls 90% of all full nodes and decides to accept blocks with, say, 200 BTC/block? What if one controls 90% of the hashpower AND 90% of all nodes AND 90% of all full nodes?
Is full node software "signed" in some way to prevent modification to consensus rules?

But how exactly the consensus rules are forced?

Every single full node enforces them.

Internet says that the consensus rules are the rules thet every full node follows. And rejects blocks that do not meet consensus rules "no matter what".

Correct.

Ok.
But.
Should ALL of the full nodes accept? Or should MOST of the full nodes accept? Or is there some "holy full node" that must accept?

It doesn't matter to me what your full node does. It doesn't matter to me what anyone else's full node does. Mine enforces the consensus rules as I understand them.

What if one controls 90% of full nodes and decides to accept blocks with, say, 200btc/block? What if one controls 90% of hashpower AND 90% of all nodes AND 90% of all full nodes?

Then one has a network that won't interoperate with anyone else because it doesn't follow the consensus rules and so everything it says looks like garbage to everyone else. As far as the rest of the world is concerned, 90% of the hashing power just stopping mining valid bitcoin blocks. They won't try to make sense of the garbage that person is generating because they have no idea what it means. How would they know what the rules are that make that data sensible?
How would I even know that those blocks have a 200 BTC reward? The very same rule set that tells me where to look in the block to figure out the reward also tells me that the reward is not 200 BTC. How would my node even know how to make sense of that? Of course, it wouldn't. It would say, "that's not a block, it's some garbage that I can't make sense out of" and ignore it.
The rules my bitcoin full node follows don't provide any way to specify a block reward over 50 BTC. There is simply no way to get my full node to accept that such a thing exists because it's coded not to.

Is full node software "signed" in some way to prevent modification to consensus rules?

No. Everyone is permitted to follow whatever rules they want. Of course, they can only interoperate with people who have agreed to follow the same rules. If they cannot agree, then the network can fork with the people who have chosen different rules winding up on different blockchains.


What prevents me to create the longest chain and multiple nodes, and deceiving everyone? Let's say I create the longest Blockchain for Bitcoin ever (let's assume it's possible). And then I add 50,000 nodes to the Bitcoin network and I use the aforementioned chain, wouldn't I be able to deceive everyone? Bitcoin trusts the longest chain, so if I have the longest chain and own majority of the nodes, wouldn't I be able to convince others some account has any amount of Bitcoins I desire?

If it's not possible for Bitcoin for some reason, is it possible to do the same for a cryptocurrency that was created recently?

Sorry for the stupid question, and thank you very much.

Contrary to popular belief, Bitcoin does not use the longest chain. This is because of exactly the scenario in your question. Instead Bitcoin uses the chain with the most cumulative work. This is calculated by summing the difficulty of each block in the blockchain. If you made a blockchain that has more blocks than the current main chain but has blocks at a lower difficulty, then your chain won't be accepted because it has less work than the main chain.

You would have to have a chain that is so long that you have done more work, or have blocks with a higher difficulty so you have done more work. Either way, more work is required and that is prohibitively expensive.


What will happen, if transaction's rate becomes very high? Let's imagine, that the bitcoin network becomes very responsive in the future. So, that the time of exchange of transactions between peers is comparable with a time of evaluation of a bunch of hashes. The bad situation comes, when the transactions rate is so high, that even if someone finds the new block, it becomes invalid with a very high probability due to the new accepted transactions.

Can this possibly slow down the finding of the new blocks? May this even be a problem, or do I miss something?

This will not slow down the finding of a new block, because it is not necessary to include every new transaction in the next block. Miners can decide which and how many transactions to include and can only update the transaction set they mine on at arbitrary times. They could for example only update the data set every time they receive a new block, or every minute.

below line is the answer to the previous edit of the question.

The scenario you describe cannot come to pass.

The Bitcoin network is self-regulating and automatically resets the difficulty every 2016 blocks to sustain an expected time of 10 minutes between blocks. The difficulty will be adjusted by up to factor four.

Extremely fast verification cannot be sustained

If a new block would be found every second in average (still magnitudes slower than your scenario calls for), the difficulty would be reset after 2016 seconds (33.6 minutes). The difficulty would quadruple, so in order to sustain that verification speed the networks hashing power would also have to increase four-fold in the same time! I am sure it is obvious, why the hashing power of the Bitcoin network will not quadruple every half hour for a significant frame of time.

Between blocks transactions are collected and verified together in the block

Every miner will collect all transactions transmitted to him, and whenever he tries to find a new block, he will try to include all unverified transactions together in that same block.

Once somebody finds a block, it will be broadcasted to the network and any receiving miner will check if it is valid and increases the length of his blockchain. If both is the case, he will accept it as a parent for the block he is trying to find. He will remove any transactions that have now been verified from his "unverified transactions" pool and will recommence to find a new block to verify the remaining transactions. Whenever more transactions are relayed to him, he will add them to his "unverified transactions" pool and will adjust the parameters of the block he is trying to find.

Blocks cannot be changed after they have been found! However, there can be several blocks that compete with each other to be accepted into the blockchain next, but such races will eventually be decided when a successor is found for one of the competitors. These "mini-forks" happen every once in a while, but is very unlikely that competing blockchain ends find new blocks several times in the row at the same time. Eventually, one will definitely be first and all other competitors become invalid.

Block size limit

There is some concern that the current block size limit will become a problem, because it cannot handle a sufficient amount of transactions. Should this come to pass, however, it would not change the amount of time between blocks, but rather that every block would be filled with transactions and transactions that didn't make it into the block to be on a waiting list for a future block. There is currently an ongoing effort to adjust the blocksize limit in order to support a bigger number of transactions per time.


Are Schnorr signatures quantum-computer resistant? Here (https://bitcoincore.org/en/2017/03/23/schnorr-signature-aggregation/) it says Schnorr replaces ECDSA, we know that ECDSA can be broken by quantum computers. Is Schnorr safe from q-computers?

No, ECDSA and EC-Schnorr, as well as related schemes like EdDSA, all belong to the class of elliptic curve cryptography. Their security is based on the assumption that the EC discrete logarithm is unfeasibly hard to compute. This assumption is not true if a sufficiently strong general purpose quantum computer would exist.

Quantum resistant signature algorithms do exist, but they all rely on very large signatures - which may make them unfeasibly expensive for purposes like Bitcoin. Furthermore, much less research exists into features on top (like homomorphic derivation like BIP32 uses, or aggregation), making them effectively a step backwards in terms of functionality if we'd adopt that instead.

However, I am not very worried about this. Quantum Computing in general has a very long way to go before it comes even close to tackling problems like solving discrete logarithms for curves of our size. A general-purpose QC with several 1000s of qbits would be needed, and it is not even known whether it is physically possible to build such a computer.


Is there any tech that uses a signature as a private key? I've been pondering how the Lightning Network will work when one of the parties in a channel tries to cheat.  It seems that publishing a transaction that shouldn't be published (a "bad act") must involve publishing something the victim can use to unwind everything.  I'm trying to identify what it is that the bad act provides to the victim, the "signature as a private key" seemed like a possibility.
Even if the "signature as a private key" idea isn't used in LN, it seems like a useful concept, but I couldn't find anything on the internet discussing it.  I tried a Google search and then came here.

It seems that publishing a transaction that shouldn't be published (a
  "bad act") must involve publishing something the victim can use to
  unwind everything.

Really, I should have asked the question that Murch answered for me (and the LN paper also answers it, but I didn't read it carefully enough the first time).  That question is: "Does LN use signatures as private keys?"  The answer is no, it uses the existence of UTXOs from obsolete transactions as the information published by a cheater to defeat the cheat.

Thanks to Murch's explanation, and the link Nick provided to the LN paper, I can answer my own question.  There is a scenario I now understand better, so I'll mention it below.

In fact, the bad act itself is publishing an "obsolete" transaction that puts (some) bitcoin into each party's address, but from which the cheater can't spend for a while.  The existence of that transaction in the blockchain is what the victim can use to unwind the bad act.  This is the case because the victim, according to the way LN works, will have an "anti-cheat" (Murch's term) transaction from the cheater, already signed, which spends the cheater's output from that obsolete transaction.  It's a useless transaction unless the obsolete one gets broadcasted, and once that happens, it becomes useful and will end up sending most of the funds to the victim.

This may seem to provide the cheater with a "double-spend" opportunity.  The bad act (publishing the obsolete transaction) creates an output (the cheater's output) that the anti-cheat transaction is supposed to send to the victim.  Couldn't the cheater make their own transaction that also spends that output, but provides a high fee to reward miners for choosing to help the cheater?  The answer is no, the cheater can't make such a transaction because the outputs from the obsolete transaction require signatures from both parties.  The cheater already signed the anti-cheat transaction.

On the other hand, regarding the question I actually posed, I think the answer is NO, there is currently no tech that uses a signature as a private key.  Perhaps this is for the reasons Nate gave in his comment, or perhaps no one who could appreciate the benefits of doing so has thought of it yet.


List of companies that has Implemented their own cryptocurrency or Color Coins in their business? Is there a list of companies that has implemented either their own crptocurrency or went with the color coins approach into their business? I'm particularly looking for non-mining related companies that went with the color coins approach piggy backing on top of an existing cryptocurrency. Either they used it as a way of points or actual currency in their business to buy products/services.

This question is too vague, like asking list of companies that use arrays in programming. Colored coins are programming abstractions(just a type of data structure) and when truly used for a technical reason(not for crowdsale) they are under the hood.
(At work, I have used it as a mechanism to account for scarcity of a resource.)


Is there actually a dilemma of whether or not to publish channel states for LN nodes? I've heard that there is such a dilemma for LN: if channel states were not published, the payer will not able to find any viable path, unless he takes brute-force-like probing approach (which looks quite unscalable); if the channel states were meant to published, the economic privacy of LN users would be sacrificed.

Does such dilemma exist? If such idea is wrong, why?

I suggest we say channel balance instead of channel state (the state is encoded by a signed  commitment TX and if it leaks you could loose your funds)

As for the balance such a dilemma indeed exists. Indeed routing becomes more trial and error without public channel balances. Yet, there will probably be methods that allow to predict routes with higher probability.

On the other hand, there is not only the privacy aspect speaking against public channel balances. One would have to announce every balance update to the network which happens for every payment and  would result in an infeasible high payload of gossip messages.


What happen when 2 transactions with one doublespending the other reachs the same block? Let’s have 2 transactions. The second one is duplicating Input of the first one.
Both have very high fees so they are selected by miner to be included in the same block but before passing validation (because it makes no sense to validate transactions if they aren’t included in the block after because the fee is too low).

Which is the transaction is going to be rejected by not being included in the block ? The first one with a slightly lower fee than the second or as it’s the same block, the second one ?

And where is the code in Bitcoin core handling this ? I mean which source files and lines ?

Which is the transaction is going to be rejected ? The first one with a slightly lower fee than the second or as it’s the same block, the second one ?

Generally speaking, miners will choose the transaction that has the highest fee, but they are not obliged to.  In fact they don't need to mine any of your transactions if they don't want to.

  Both have very high fees so they are selected by miner to be included in the same block.

No, the miner must choose 1 or zero not both, otherwise the block they create will be invalid if it contains a double-spend.  Invalid blocks will waste the miners time and money as they will be rejected by the network.

  And where is the code in Bitcoin core handling this ?

Sorry, can't help with specific location.


If the nonce is 32 bits why the proof of it is difficult? I want to know why mining of nonce is difficult?

The nonce is 32 bits (4294967296) and a high level Nvidia graphic card can check and mine it in a second.

why do we need a pool to mine a blockchain?

The vast majority of the time, none of the 2^32 possible nonces in a particular block header template will result in the header having a hash that meets the proof-of-work target.  In fact, the probability that this doesn't happen equals exactly 1 over the network difficulty.  Right now, that is 1/6,379,265,451,411.

When no nonce succeeds, one must change something else in the block header and start again.  The typical solution is to change the extranonce field in the coinbase transaction and recompute the Merkle root.  See What is the extraNonce?


Does rootstock use bitcoins or do they use their own rootstock coin? Learning about rootstock. Do they ues bitcoin or their own rootstock coin? In ethereum, they have ether, but to execute contracts it requires gas. Is there an equivalent here in rootstock or all of this is in BTC? What would be the fees then?

Rootstock uses smart bitcoins (SBTC). On a technical level this is a separate token from bitcoin (BTC). They live on a separate blockchain. On the other hand, every smart bitcoin represents one bitcoin.

Rootstock is a Bitcoin sidechain.

This works as a 2-way peg between the bitcoin blockchain and the rootstock blockchain. You use this to transfer coins between the chains. Send a bitcoin over to rootstock and it becomes a smart bitcoin. Send it back and you have a (normal) bitcoin again.

A more technical way to see it is that X amount of smart bitcoins are created by locking the same amount of bitcoins on the bitcoin blockchain. When you later unlock an amount of bitcoins, the same amount of smart bitcoins disappear again from the roostock blockchain.

The important part is that your bitcoin can only be active on one of the blockchains at any given time.


Transfer btc from offline wallet bitcoin core to bank account What are there the ways to legal transfer money from offline bitcoin core wallet to my bank account, if i have more than 100 btc?

You can't transfer bitcoin to a bank account unless you live in a dursdiciton that recognises bitcoin as a legal payment, like Japan.

So you must find someone willing to exchange fiat currency with you, then you deposit that fiat currency into your bank.

Exchanges are one way, selling directly to another party is another.

Note: Exchanges often have withdrawal limits, so find them out beforehand and I would not trust them with all of that BTC at once.

I also would be extremely wary of selling it all direct without a contract, you wouldn't sell a house without a contract, this is a similar sum of money. I'd enlist a lawyer if you find a party to sell it all at once to.

The legal aspects are taxes and money laundering compliance. Exchanges should insulate you from the money laundering issue. Then taxes: in many countries, you will need to declare capital gains taxes. To be tax efficient, consult with an accountant, with >100BTC you can afford it and can't afford not to.


how to convert pubkey wif address to hex format with bitcoinjs-lib? Is there a way with bitcoinjs-lib to import a WIF pubkey:

  1HVTiWkuGKEJXJupriTdY5MKngcq2bH6P4

and get the hexadecimal version like this:

  02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd

WIF pubkey

There is no such thing as a wallet import format pubkey. What you have shared is an address, which is HASH160(pubkey). There is no way to recover the original public key from an address. You could, however, recover the public key from an outgoing transaction from that address, as it would be revealed as part of the unlocking script.


Is there an active list of BIPs currently open for voting? How can a miner know from which two (or more) BIPs they can choose when they are about to vote? Is there a list of currently active BIPs for voting?
Thanks!

This question is based on a misconception. Miners do not vote on proposals. Consensus changes to Bitcoin are made by the entire ecosystem transitioning to new rules that they choose, by running node software that enforces these rules.
Miners are a part of that ecosystem, and their enforcing of new rules is part of what makes them safe. But if miners refuse to adopt a rule change that the rest of the ecosystem demands, they have no choice. If a rule is implemented and enforced by the network's full nodes, then miners who produce blocks that do not follow those rules will simply be ignored.
Everything works better however, if miners and the rest of the ecosystem do not diverge on what rules they're demanding and enforcing. For that purpose, several past backward-compatible consensus changes ("softforks"), have used a mechanism where miners can signal that they're ready to enforce a particular rule, and once a certain threshold is reached, all of them (including non-miners) start enforcing those rules in lockstep.
So in reality, such a signalling mechanism is for coordination, not for voting. Proposals may go through even without miners' consent, but it's better for everyone if things are synchronized.
Previous softforks that have employed such a coordination mechanism are:

BIP34 Height in coinbase (2012)
BIP65 OP_CHECKLOCKTIMEVERIFY (2014)
BIP66 Strict DER signatures (2015)
BIP68/112/113 OP_CHECKSEQUENCEVERIFY and associated relative locktime semantics (2016)
BIP141/BIP143/144 Segregated witness (2016)
BIP147 Dealing with dummy stack element malleability (packaged together with BIP141/BIP143/BIP144) (2016)
BIP91 Reduced threshold Segwit MASF (2017)

The specific rules used by each of these differ (see my answer here for details). Some used a simple threshold of 750 or 950 blocks over the past 1000; some used BIP9.
Earlier softforks (BIP16, BIP30) were coordinated at the human layer. BIP16 did use signalling in blocks as well, but only to inform changes made to the software. The actual activation was time based (as soon as enough support was signalled, node software was modified to start enforcing new rules after a certain date). As BIP16 did have a competing proposal (BIP17), it was easy to misinterpret support for one or the other as a vote. Perhaps that is where the misconception originates.
Right now (as of July 2020), there are no unactivated consensus changes implemented in node software, so there is nothing to signal for, though there are discussions about the activation mechanism to use for BIP340/341/341 (Taproot).
Disclaimer: I am a (co-)author of some of the BIP documents listed in this answer (BIP30, BIP66, BIP141/143/144, BIP340/341/342).


Duplicate transactions in blockchain Can someone explain what does this mean:

As i see: 2 transactions are having SAME txid and differ just by address. Is this normal behavior? Should I get both transactions in such cases?

Transactions can have multiple outputs. What you show are two outputs created by the same transaction.

The output positions are enumerated with the vout field. As the first one is vout = 0, the two that you show are the third and fourth output.


How do exchanges provide wallets unique wallets to users but also keep transaction fees low? So I understand that exchanges don't have to perform updates on the blockchain. However I'm not sure how they figure out the following solution without having to pay blockchain fees? I guess they do
i.e.

An exchange gives 3 users, Bill, Jane & Sally a BTC address.
Bill & Jane both send in 0.001 BTC to that address from a different exchange/wallet.
Now Bill & Jane both send 0.0005 BTC to Sally on the same exchange. Same exchange so this doesn't have to be on the chain.
So now Bill & Jane both have 0.0005 BTC and Sally has 0.001 BTC according to the exchange. However both Bill & Jane's actual wallet address still has 0.001.
Sally now withdraws her 0.001 BTC

The exchange now needs to perform two blockchain updates to fulfill this withdraw which means two transaction fees on the blockchain for the exchange.
Does anybody know how exchanges do this?

Users don't have addresses at exchanges. When you deposit to the exchange you're depositing to the exchanges wallet, with a unique address just enabling them to account for who to credit the internal balance to. Withdraws only require one on chain transaction, just debiting the amount from the database and then sending that value to the address requested.


What happened to Krad Miner (the first javascript GPU miner)? Krad Miner was the first javascript miner that supported GPUs. Now, the website yields a 502 error, and there has been no response to post #57 in the thread asking about it being dead.  Does anyone know what happened to it?

I purchased Krad Miner from the creator for the bounty cost of 50 BTC, and have released it as open source (Apache 2.0 license) on Github. Since the author has other projects using the Krad label, I have renamed it to Tumen Miner. I would currently consider it alpha-quality; I have not run it, merely cleaned it up as best I could.

In the short term, I plan to fund some minor testing and development on it. Longer term, I may start coding on it myself, if I ever find the free time. I welcome donations in the form of bug reports, code pull requests, and BTC to pay the coders.

Merry Christmas, coiners.


ElectrumX method blockchain.address.get_balance removed, how to get the script hash of a public addres and get balance? Reading the ElectrumX documentation, found that the method for getting balance of any public address was: blockchain.address.get_balance, but was removed. Now, I understand that blockchain.scripthash.get_balance is the way for getting balances for any public address, but it requires a "scriphash".
Checking documentation for Script Hashes shows stepts for hashing the address to get script hash.
With this python code, I can get the electrum server data:
import json
from time import sleep

port = 50001
host = '127.0.0.1'

content = {
    "method": "blockchain.scripthash.get_balance",
    "params": ["af6df685465a42b753bf72dfdf36c43ea3c2931025411940609da6f2404b00c4"], # this is a tx_hash
    "id": 0
}

def electrumx(host, port, content):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((host, port))
    sock.sendall(json.dumps(content).encode('utf-8')+b'\n')
    sleep(0.5)
    sock.shutdown(socket.SHUT_WR)
    res = ""
    while True:
        data = sock.recv(1024)
        if (not data):
            break
        res += data.decode()
    print(res)
    sock.close()

electrumx(host, port, content)

With a transaction hash, it throws some results, not exactly the balance of any address involved:
{"id":0,"jsonrpc":"2.0","result":{"confirmed":0,"unconfirmed":0}}

My questions are:

What means "script hash" of a public address?
Is required to use a transaction hash, like in the code?
Why when using tx hash always shows "result":{"confirmed":0,"unconfirmed":0}
even if the address has funds.
Can the script hash be obtained just from a public address?

Thank you very much.

Well, it's been a long time, but I've been able to find a way by myself.
The python function for getting script hash is this:
from pycoin.symbols.btc import network
import hashlib
def get_script_hash(addr):
    script = network.parse.address(addr).script()
    return hashlib.sha256(script).digest()[::-1].hex()

And the full code to check the balance of a public address from a local electrum server is:
import socket
import json
from time import sleep
from pycoin.symbols.btc import network
import hashlib

port = 50001
host = '127.0.0.1'

def get_script_hash(addr):
    script = network.parse.address(addr).script()
    return hashlib.sha256(script).digest()[::-1].hex()

def electrumx(host, port, content):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((host, port))
    sock.sendall(json.dumps(content).encode('utf-8') + b'\n')
    sleep(0.5)
    sock.shutdown(socket.SHUT_WR)
    res = ""
    while True:
        data = sock.recv(1024)
        if not data:
            break
        res += data.decode()
    print(res)
    balance = eval(res)['result']
    print(f'{addr} has {balance["confirmed"] / 100000000} confirmed bitcoins')
    print(f'{addr} has {balance["unconfirmed"] / 100000000} unconfirmed bitcoins')
    sock.close()

if __name__ == "__main__":
    addr = "1x8cQ1gKJ5dwBRr1mjsYfsJbWBHJDnxg9"
    script_hash = get_script_hash(addr)
    content = {
        "method": "blockchain.scripthash.get_balance",
        "params": [script_hash],
        "id": 0}
    electrumx(host, port, content)

Thank you.


How to get Ledger Nano S to work in an Ubuntu VirtualBox? I installed the ledger manager on Ubuntu VirtualBox, but I can't see any of my USB devices. My host OS is Windows 10. How do I get this to work?

You need to update the udev rules (on the guest OS) with this command:

wget -q -O - https://raw.githubusercontent.com/LedgerHQ/udev-rules/master/add_udev_rules.sh | sudo bash

It works, I verified it.

source: https://support.ledgerwallet.com/hc/en-us/articles/115005165269


How will Mt.Gox select matching orders if asking for a price that is higher than available prices E.g. if we have this order stock:

SELL 0.5 BTC @ PRICE $72 $/BTC (1)
SELL 3 BTC @ PRICE $75 $/BTC (2)
SELL 0.5 BTC @ PRICE $76 $/BTC (3)

And trying to buy 3.5 bitcoins for a price at $76.5 (higher than available prices). How will Mt.Gox select matching orders? Will it select the cheapest possible lines (1)&(2)? Is this equal to a market order?

Of course it would select the cheaper ones. It's a limit order.


Customer pays in EUR and I receive bitcoin anonymously I run a small business, and up to now I have always demanded to be paid in cash for my services.
I want to allow my customers to pay electronically through wire transfer, while remaining anonymous myself.
Is there a service which acts as a flexible always-ready EUR-to-bitcoin converter, such that my customers can pay electronically to a bank account owned by that service, whereafter an equivalent amount of bitcoin are transferred to me?

No. I don't think there are any good services that will allow customers to pay with fiat and have you receive Bitcoin even if you were okay with completing KYC, but regardless, no legitimate fiat payment processor will allow you to stay anonymous.


Double spend problem on a delay tolerant network I recently read about the Digitally project, an overlay payment scheme for use on mobile phones, whose goals are to extend mobile phone payments to areas with poor connectivity and reduce transaction fees.

In summary: DigiTally enables two people to do a payment transaction by simply copying short strings of numbers between their phones. This doesn't need either smartphones or a network connection. Either phone can upload the transaction later, once it gets a network connection.

I see the benefit of such a system working in underdeveloped economics, wherein branchless mobile banking is a way of life. Alice and Bob can engage in an offline transaction which is later verified and added to the blockchain once either of them get internet access.

Are there any technical implementations on Bitcoin or any other cryptocurrency which allow for asynchronous transactions such as the above? If not, then how can we imagine it would look like?

Is there a solution to the double spend problem that works on a delay tolerant network?

As explained in the referenced paper [4] "SMAPs: Short Message Authentication
Protocols", the security issue is the delay-tolerant networking. Bitcoin already requires a minimum of 6, or better 8, blocks before a transaction is sufficiently secured. The trade off is between delaying the settlement and lowering the risk.


Why there is only 8 peers in bitcoind? I set maxconnections=125 in bitcoin.conf but still has only 8 connections in nodelist. Please tell why?

You should check if port 8333 is open. If port is closed from internet, bitcoin client will make only 8 outgoing connections. maxconnections parameter works only for incoming connections.


Why can't a user import keys to the keypool for a blank wallet? I am creating a blank wallet with the intention of adding keys to the keypool but get an error keys can only be imported to the keypool when private keys are disabled

Why? It would be beneficial for users to be able to import their own private keys and get full functionality of the wallet with those keys. Is there any PR for this?

When you create the wallet that you are importing your keys into, presumably with something like bitcoin-cli -rpcwallet='mywallet' importmulti, it needs to be created in watchonly mode, meaning with private keys disabled. To do that, create the wallet with bitcoin-cli createwallet 'mywallet' true, where true is the argument for disable_private_keys, creating a wallet for watch-only (public) keys.


Why Would Someone Not Use a new Change Address I have previously asked questions and read about the importance of always using a new address every-time you receive a transaction, even for change. Sometimes when I watch the block explorer I see transactions where the send address and change address are the same, like this one:

Tx: 7c99440257f45b2b87f655744a8ec4f87c73f54ca5a9873e083eae5214d51aa2
It is also my understanding that most wallet software automatically generates a new address for change. This leads me to believe that the transactions where the change address is the same might be people using more advanced wallet software that gives them more control over these features. Are there known reasons or types of users who intentionally choose not to follow the advice to use new change addresses?

Are there known reasons or types of users who intentionally choose not to follow the advice to use new change addresses?

Say you perform a lot of transactions but still want to have some mechanism for your heirs to get to your bitcoin should you die. And say that you don't do anything you have any need to keep secret. In this case, it makes a lot of sense to re-use the same few addresses, the ones that you've made arrangements for your family to be able to access should something unfortunate happen to you.
The same logic might apply to a transaction system using an HSM with limited storage to secure the keys. Large numbers of addresses would mean large number of keys, meaning they couldn't all be secured by the HSM, reducing your security.
I notice you just reference "the importance of always using a new address every-time you receive a transaction, even for change". I have no idea what that importance might be, but so far as I know, bitcoin is perfectly secure even if you always reuse the very same address.


Can I detect a 51% attack as a developer I am a developer building an application that accepts payments in cryptocurrencies.

Is it possible, in the occurence of a 51% attack, to build a script that detect this, so we can suspend withdrawals automatically?

Generally, no, not until it's too late.

A typical 51% attack would look like this:

Attacker privately starts mining their own chain, which diverges from the main chain at some block N.
Attacker deposits coins to your business, sending them from address A.  Call this transaction X.
Attacker inserts in his own chain a transaction X' which conflicts with X; typically X' sends the coins from address A to another address belonging to the attacker.
Attacker waits for several confirmations of transaction X, in blocks N+1, ..., N+6 (replace 6 with however many confirmations your business wants) of the main chain.
Once there have been enough confirmations to satisfy you, you deliver goods or services to attacker.
Attacker releases his own chain, which now has blocks up to, say, N+50.  Being longer, this chain is accepted by the network.  This chain doesn't contain the transaction X but instead X', so you don't have the coins you thought you did.

Notice that up until Step 6, everything on the network looks completely normal; only the attacker knows what is going on.


Can I get the wallet in bitcoind to use P2SH segwit (on testnet)? Can I use the wallet functionality in bitcoin cli daemon with P2SH segwit on testnet/regtest? Meaning, can I receive on these addresses and send from them?

And if I can, how?

I cannot find it anywhere in the help. The only one that gets close is addwitnessaddress, but that does something else, too.

addwitnessaddress is what you want

create it, fund it and spend coins from it - then check your transactions on any blockexplorer that they are in segwit format


How to get uncompressed BTC address and private key from bit module for Python? I am new in programming and BTC. I want to make some BTC address with private keys. Till now I learn that we have compressed and uncompressed private keys. But I get only compressed private keys and address. How I can get uncompressed private key and adress with bit module? This number is just for example. I don't use them for my address. Please do the same. It's not safe to use it for your address. I made this code till now

from bit import Key
dec=115792089237316195423570985008687907852837564279074904382605163141518156494336
key = Key.from_int(dec)
print(key.address)
print(key.to_wif())

I get this results 1A7o1vWzF4fx1yqmA1NzFbhnP97P9uYQ2Q L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2GppfKbjNXRE2Ge

I use this module https://pypi.org/project/bit/

If you know someone who can help please share with me. You can see code here https://pastebin.com/6gk1Ua2b

It looks like doing such a conversion is not well supported, nor is instantiating a private key as uncompressed unless you do so with a WIF key.

However, you can change the compressed-ness by doing:

key._public_key = key._pk.public_key.format(compressed=False)

But this requires you do to this immediately after instantiation as otherwise precomputed properties such as .address will not be recomputed.


How can a non-miner store data in the block? If I am not a miner and would like to put arbitrary data in the block chain, is there currently any method or protocol to get a miner to add it for me?

There is a service named btcmsg which allows you to do this. Here is the announcement in bitcointalk. The website is at btcmsg.staticloud.com.

They use a simple protocol to write and read the messages in the blockchain:

  BTCmsg Protocol v1 (2011-09-18)

  Each message is represented by multiple payment which is calculated by
  the following algorithm:

  Two first chars for message type ('01' for md5, '02' for ascii).
  Then the message in hex (python binascii.hexlify).
  Split the long string to groups of 4 hex digits.
  Each group of 4 hex (e.g. 2 ascii letters from the message) is     represented by a payment in satoshi (maximum 0xffff=65535).
  The service fee (composed of a fixed part and a variable part times     the amount of small payments required, minus the transaction fee) can be seen within the first transaction.


Seems I was spending the output of the previous tx thats why the transaction was rejected


How to display Recipient Address, Change Address & Transaction Amount I have made A software in which i can Signed Transaction (From Electrum Un-Signed Transaction HEX), i just want to display the following thing to USER in Readable Mode :
1. Recipient Address
2. Change Address
3. Transaction Amount

How can i show this to USER to readable form so that user verify the Transaction before going broadcast.

Thanks,
Amish Sharma

Just go to BTC explorer any search in google
example:
https://www.blockchain.com/explorer
type your wallet adress or transaction ID
And check.


mining: losers get nothing? if the winning miner takes the 12BTC+fees, unless you own the biggest mining operation out there, or are not a member of the biggest pool, why bother mining, if there is no prize for second place?  does the randomness still ensure the smaller pools get lucky  just enough to keep them interested in mining BTC?

the link below claims the massive Bitmain solves only 3 blocks a day ?  what could a smaller operation/pool hope to achieve? thanks

https://coincentral.com/the-top-5-largest-mining-operations-in-the-world/

In the very early days of Bitcoin blocks were typically mined by one individual person, often referred to as "solo mining"). This made sense because with only CPU mining each person pretty much had the same probability of solving a block as the next person (unless they had several CPUs). Eventually as mining expanded, became more distributed, and hardware such as FPGAs, GPUs, and ASICs came along, the idea of pooled mining was developed. This allowed a group of people to put their computational power together and share the rewards across each "pooled" miner in accordance with their contributions once the pool had solved the block. Each pool is different, and will use different reward algorithms such as PPLNS, PPS, etc.

  why bother mining, if there is no prize for second place?

Mining has very profitable rewards, especially if you are lucky enough to solve the block while solo mining. If you do not have to share the reward among others, 12.5 BTC will likely be more than enough to pay for the electricity used to mine the block depending on location, etc. For smaller miners, pooled mining will give them a portion of the rewards depending on how much hash rate is directed to the pool, regardless of whether they have personally solved the block themselves.

  does the randomness still ensure the smaller pools get lucky just enough to keep them interested in mining BTC?

Exactly. Imagine you and a friend were the only people mining in a pool you have created. Lets say you both have one 14Th miner. If the pool solves the block, you will split the reward because you have both agreed to work together and share the rewards.


Why is only the block header SHA256-hashed and not the whole block? I read in many places that mining involves finding nonce such that SHA256(SHA256 (blockheader_including_nonce)) meets a specific criteria (0 bits...).

Why is this hashing done only on the < 100 bytes of the block header? If it's only done on header, doesn't this mean we could modify a transaction in the block and keep the same block header and hash?

How is this not a weakness?

In fact, it is done over the whole block, but indirectly.

One of the members in the block header is the Merkle root hash of the transaction hashes. Effectively, that is a hash of all the transactions.

Because that field is included in the block header, the hash of the block header is effectively a hash of all transactions as well. If a transaction would change, its hash would change, the Merkle root would change, the block header would change, and finally the block hash would change as well.

Then why is this done? There are several reasons for the exact construction, but the most important one is probably the fact that it makes the speed of mining independent from the number of transactions.


I'm trying to create a new kind of escrow with bitcoin, not sure if it's possible First off, I understand that the standard way to do escrow with bitcoin is a P2SH with a 2 of 3 multisig redeem script. I'd like to try and do escrow in the following way:

names of 3 parties involved:

money source
escrow agent
money destination

there are 2 transactions involved:

escrow transaction: the money source sends funds to a custom locking script
spending transaction: the escrow agent moves funds from the escrow transaction to the money destination

With these properties, the escrow agent has complete control over spending the funds, BUT the escrow agent can only move them to the money destination and nowhere else. (i.e. escrow agent can't steal the funds)

I realize that in order for this to work the custom locking script of the escrow transaction somehow has to reference the money destination's address and provide some mechanism such that when the escrow transaction's locking script is unlocked it checks that the transaction it is being used in is in fact going to the money destination.

It seems that one cannot directly reference the output address of the spending transaction when the spending transaction is being verified. The only way it seems to have the output address be part of the verification is indirectly via CHECKSIG (since the data being signed include the output address of the spending transaction)
But in order for this to work we would need to sign the spending transaction and include that signature in the escrow transaction, but that creates a circular dependency: the escrow transaction includes a signature of the spending transaction which includes the hash of the escrow transaction (since the escrow transaction is an input to the spending transaction). And so this would be impossible. I wish there was a hashtype that allowed you to only sign the output side of the transaction and not the inputs at all.

I'm pretty new to bitcoin, so maybe I'm missing something. But it seems that designing an escrow with the properties I described at the beginning of this question would be impossible, and the only way to do escrow is a standard P2SH 2 of 3 multisig.

The reason I don't want to do a standard multisig is that in order for it to work in a trustless way. the money source and money destination have to exchange their addresses directly (i.e. the escrow agent can't give the other 2 parties the appropriate addresses, because he could give out the wrong addresses). This way when the escrow agent signs the txn and gives it to the other party to sign they can verify that the escrow agent signed it to go to the right place.

I'd like the escrow agent to be the point of contact for the other 2 parties so that they don't need to do an address exchange prior to working with the escrow agent but can still not have to trust the escrow agent

Partial answer (not a new solution - I merely adapted the micropayment channel protocol):
if you allow for public key exchange, one solution seems to me to be:

t1: source funds an address A controlled by source and escrow
t2:
source partially signs transaction T spending A to destination. Then
she sends this partially signed transaction to escrow.

it is now up to escrow to sign and broadcast T so that destination receives the fund. Escrow cannot spend the funds differently (i.e. steal) as it would require source to cosign.

(Problem: Escrow could decide to not sign and "block the funds" (that s why Refund transactions are included in payment channels). Solved by having Escrow partially sign and send to source a transaction R sending hte funds from A back to source at t0. It s now up to source to sends herself the funds from A back. Is this an issue? Not really if you have transaction R be "timelocked")

It seems harder to find a solution without public key exchange... but it is a bit strange to forbid public key exchange.


Can a full node understand the transactions it downloads from the Bitcoin network? I understand a full node downloads and validates the entire transaction history. Can a full node read and understand these downloaded transactions, or is it just just keeping a copy of encoded information?
I'd appreciate if you could mention your sources' links in this regard.

Can a full node read and understand these downloaded transactions, ...

Yes.

or just it's just keeping a copy of encoded information?

You write "encoded" but the context makes it seem you may have meant "encrypted"
The Bitcoin network does not encrypt any data. None of the data in the blockchain is encrypted. It is all publicly readable information in plain sight.
The answer you are reading right now is encoded. The encoding used is UTF-8.


What causes a "stuck block" I've seen and heard about issues where a coin's network would get 'stuck' at a specific block.   I understand why it would get stuck due to high difficulty and low hash, but some coins seem to be unable to mine past a block with low diff and more than enough hash power on the network.

The two examples I can think of are Thorcoin currently stuck at block #85745 and more recently Suncoin at block #180561.

What exactly causes this and how does it get fixed?

A few elements of answer:

Difficulty readjustment can be done for each block on some altcoins.
Mining is a highly random process, if you keep on flipping a coin all day, you will get long series of faces. Similarly, the miners may get unlucky. Even in bitcoin you see gaps of over an hour.
The above is compounded for altcoins as miners switch from one to another depending on profitability.

So nothing really unusual. As for a fix, bitcoins' testnet uses a rule where difficulty drops to 1 when no block has been found for 20 min. But the security implications should be thought through.


Try to migrate Bitcoin Core wallet to an HD wallet but get "St13runtime" exception I am trying to follow these steps to migrate my wallet to an HD wallet. But it failed, the debug log has errors like this:

EXCEPTION: St13runtime_error
DeriveNewSeed: AddKeyPubKey failed
bitcoin in AppInit()

After some quick search, I found the #issue14422 of bitcoin is related to this issue, which says the upgradewallet option does not work when the wallet is encrypted. The issue is still open and no solution is given. So how can I upgrade my wallet to the HD wallet?

The answer you linked explains how to migrate without using upgradewallet in the section "Versions of Bitcoin Core prior to 0.17`. You will need to follow those steps instead.


bitcoin.conf file is missing Just installed bitcoin core v0.21.0 on my ubuntu server.
When I run

bitcoind -printtoconsole

It says bitcoin.conf file is missing.

2021-01-30T15:36:58Z Bitcoin Core version v0.21.0 (release build)
2021-01-30T15:36:58Z Assuming ancestors of block 0000000000000000000b9d2ec5a352ecba0592946514a92f14319dc2b367fc72 have valid signatures.
2021-01-30T15:36:58Z Setting nMinimumChainWork=00000000000000000000000000000000000000001533efd8d716a517fe2c5008
2021-01-30T15:36:58Z Using the 'shani(1way,2way)' SHA256 implementation
2021-01-30T15:36:58Z Using RdSeed as additional entropy source
2021-01-30T15:36:58Z Using RdRand as an additional entropy source
2021-01-30T15:36:58Z No wallet support compiled in!
2021-01-30T15:36:58Z Default data directory /root/.bitcoin
2021-01-30T15:36:58Z Using data directory /root/.bitcoin
2021-01-30T15:36:58Z Config file: /root/.bitcoin/bitcoin.conf (not found, skipping)

As I know, it should be in $HOME/.bitcoin folder. But it's not. Should I create it manually?

Yes. It hasn't been created automatically, at least for as long as I remember.
But not in the folder whose screesnhot you've uploaded.


In Ripple, what is "Total XRP" in the ledger header? In the spec for the ledger format there's a field called "Total XRP" in the header. Is this the total number of XRPs in circulation? Does this value get decremented with each transaction?

Can this value be incremented as well?

This is the total amount of XRP in the ledger. It is decremented with each transaction that pays a fee (which is all of them except for a few special transactions). There is no way it can be incremented.


Are Bitcoin core devs contributing to ISO/TC 307 Blockchain and distributed ledger technologies I was just being made aware of the standardization process about blockchain and distributed Leger technologies. https://www.iso.org/committee/6266604.html

In this picture from the talk that I am attending you can see that many institutions are part of the process:

However I did not see any institution close to Bitcoin development. I asked if the standard will be compatible with Bitcoin. The presenter said they are in contact with Bitcoin developers. Where could I find more information about this?

Opinion:

Committee efforts which have to aim of standardizing anything to do with the bitcoin protocol should be considered attacks against Bitcoin. Bitcoin was created specifically to eliminate the need for a (trusted/centralized) "committee". The rules of the Bitcoin protocol are decided independently by each user running the software which validates them, of their own volition. Bitcoin Core developers can only provide software to enable users to interact on the network which they choose to interact. They cannot force users to follow any rules.

There is not, and will never be a committee to decide these rules. The market decides which Bitcoin rules will succeed. This will not stop bad actors from trying to control it. You should make the effort to call them out as hostile, because they are hostile, even if they did not intend to be - they just don't yet understand that Bitcoin has made their role as rulemakers obsolete.

There is no harm in attempts to standardize methods and software surrounding Bitcoin (such as POS systems, hardware, wallets, network protocols), but these efforts are already being standardized as part of the BIP and BOLT processes, and by developers finding opportunities in the market, and these move far faster than any ISO committee will ever be able to keep up with.

This committee essentially has nothing to do with bitcoin at all. It is another "blockchain not bitcoin" effort which can only do damage to Bitcoin. It is initiated by people who are unable to accept the concept that nobody is in charge and nobody decides the rules. If they were interested in bitcoin they would be contributing on github and the mailing lists. The fact that they don't and just want to stick an ISO stamp on it is clear where their proirities lie. For them, the world seems chaotic without standards, but for Bitcoin, the chaos is its strength - it means that it is immune to external influence from specific parties and it does not need to conform to any societal norms which currently exist, or may exist in the future. Bitcoin is the free market. There are a lot of people who hate free markets and will make any effort they can to undermine Bitcoin.

I believe the majority of Bitcoin Core developers feel similar, and will ignore any attempts from ISO to influence decision making in the development of Bitcoin Core, as well as other Bitcoin clients.


GitHub won't let me fork Hivemind, maybe something about sidechain repos On my GitHub page I have a fork of bitcoin/bitcoin.

The project Hivemind seems interesting, and I want to check it out.

When I try to fork it GitHub tells me that I already have a fork of it, and it references s-matthew-english/bitcoin, which is my fork of bitcoin/bitcoin.

Why is this happening? How can I circumvent this?

You're trying to fork bitcoin-hivemind/hivemind, which is a fork of truthcoin/truthcoin-cpp, which is itself a fork of bitcoin/bitcoin. So, your hivemind repository would end up being a fork of Bitcoin too, which is not allowed due to a GitHub limitation.

The various workarounds suggested in the Stackoverflow page include:

Creating an organization to fork hivemind
Creating a second GitHub account
Deleting the bitcoin fork, forking hivemind, and creating a bitcoin branch that is even with bitcoin/bitcoin. That way you can still make pull requests to Bitcoin, as that repository is still in the fork graph of bitcoin/bitcoin.


Why is 6 the number of confirms that is considered secure? Why is 6 is the number of confirmations that is considered secure? I haven't found any mathematical explanation or otherwise that explains why it is 6 and not 5 or 7. Is there a historical reason for 6? Is there a specific way to calculate it so 6 is just a number that was chosen?

I believe this is addressed in page 8 of Satoshi's Bitcoin paper when showing the probability of an attacker catching up.

The wiki states:

  "Only 6 blocks or 1 hour is enough to make reversal computationally impractical."

The key word is "impractical".

The important sentence in Satoshi's paper is:

  "Assuming the honest blocks took the average expected time per block, the attacker's potential progress will be a Poisson distribution".

So, it is not that someone couldn't create the worlds first and own a $50 million ASIC farm, so as to have the ability to overtake the blockchain from a fork six blocks prior but that doing so would be a.) a massive undertaking, b.) obvious to all and c.) terrifically unprofitable to the attacker.


Is the Antminer S5 still worth it for low profit? I'm thinking about getting an Antminer S5 for Christmas to jump start my Bitcoin mining adventure. Using CryptoCompare's profit calculator I see that I will be losing 60 cents per day with the current kWH in my area. I have yet to talk to my parents (I'm 14) about allowing me to get it and put it in the shed. If they let me and the electric bill increase won't bother them, would the Antminer S5 be worth it? If I were to pay my parents part of the cost, say $10-$15 since the estimated cost would be $20, would it still be a little profitable?

Your question doesn't make much sense, you are asking if it is profitable yet you acknowledge that you will be losing 60 cent per day due to electricity costs.

Bitcoin mining is not very profitable unless you have zero or low electricity costs, and the constant increase in difficulty makes your hardware obsolete. It is more worthwhile to invest in a concurrency simply, and wait for the value to rise (if it does)

Is the Ant miner worth it?
Well, if you are going to lose 60 cents per day, it most likely is not, and as difficulty increases you will make less and less while losing more.

Anyways, it seems more like you want daily income at the expense of your parents (weather they realize the more expensive electric bill or not). It probably is not worth it.


bitcoin feeless transactions The mobile application cashapp specifically says I can send bitcoin to any address anywhere in the world for free.
Coinbase also says they can do off the network transactions instantly and for free as long as both parties have a coinbase address...how does this work ? Does a miner check these transactions ?
Where does the concept of average transaction fee come into place ?
https://ycharts.com/indicators/bitcoin_average_transaction_fee

These transactions don't go through the bitcoin network, it’s just coinbase/cash app crediting one users account and debiting another.


How to import a HD wallet from an extended private key I'd like to export a derived private key from my Electrum HD wallet, and use it as a HD wallet master key in a Mycelium wallet.

I used bx to get the key like this (m/2'/0) (where m is the unencrypted xprv key extracted from default_wallet JSON):

$ cat m | bx hd-private --index 2 --hard \
        | bx hd-to-wif | qrencode -o - | feh -

And scanned the resulting QR code in Mycelium using the "Add Unrelated Account/Scan".

The wallet works, but it's treated as a "single-address" wallet, not a HD wallet. I presumed that the derived xprv can be used as a master key for deriving more keys, since it contains the chaincode. Is that not the case?

Also, the Mycelium "Add Unrelated Account" screen says that

  Scan Bitcoin address, private key or HD-Account.

What format does "HD-Account" mean? Is it WIF?

UPDATE: To make it clear, the key thing I want is to have a HD account in Mycelium, whith a master key derived from my Electrum HD wallet.

The purpose of this is to have only one seed to remember store - the seed of the Electrum wallet. If my phone is lost, or my Mycelium wallet is compromised, I only have to derive it's master key again from my Electrum master key, reconstruct the wallet keys, take the money and run. And since the Mycelium master key is hardened, I don't have to worry about the rest of the tree being compromised, even if the master public key leaks.

Based on answers of Christopher Gurnee and Wizard of Ozzie, I could build a diagram to make it more clear:

UPDATE 2: Updated diagram to match Mycelium's behavior of treating imported extended private keys.

Response to clarified first part

You're pretty close, I suspect you want something simpler like this (and then typing in the xprv you extracted from an Electrum 2.x (unencrypted) wallet file):

bx hd-private --index 2 --hard | qrencode -o - | feh -

In particular, don't include the bx hd-to-wif step, that's probably what's tripping you up.

When you do the import/add-new-account in Mycelium (2.3.0+ required), make sure you're choosing the Advanced option, and then do the scan.

Once you're done, the resulting keys/addresses will be along a path of m/2'/c/i.[1]

If you ever need to do a recovery (i.e. if you lose your phone), you can import the same xprv you imported into Mycelium into a new wallet in Electrum (using the restore wallet option). It may not be documented, but Electrum 2.x will also accept an xprv during a restore, and then it will generate the same c/i path that Mycelium uses for imported xprvs.

I haven't tested any of this though... please test it out before relying on it!

Response to original first part

(this is mostly irrelevant to the clarified question)

To answer the first part of your question:

An Electrum 2.x extended master private key can be directly imported imported into Mycelium for Android (version 2.3.0+), no conversions or path derivations are required. It will result in the same list of addresses being generated in both Electrum 2.x and Mycelium. It turns out you were just overthinking the problem ;-)

This means you can just run qrencode -o - | feh - and paste your extracted xprv directly in.

More details on inter-wallet compatibility can be found here: https://bitcointalk.org/index.php?topic=1000544.0. For your specific case of exporting/importing an xprv, you can look at the third tab in the referenced spreadsheet.

Incidentally, the reason they are compatible isn't obvious. Both use BIP-32, however (as Wizard Of Ozzie already pointed out) Mycelium uses a path of m/44'/0'/a'/c/i, whereas Electrum 2.x uses a path of m/c/i.[1]

What makes them compatible is that Electrum 2.x exports the master key at the root position, however Mycelium assumes that the key was exported at the m/44'/0'/a' position. Mycelium then derives keys by appending an additional c/i path to the imported key, which is the exact same c/i path with Electrum appends to it's root key (m). A diagram might be more clear:

Electrum 2.x:           m/c/i
Mycelium:     m/44'/0'/0'/c/i
                       ^^ key being exported/imported

[1]:
a = account index
c = 0 for external, 1 for internal (change)
i = key/address index
' means hardened


Who can predict that a benign attacker has 51% hash rate of the system? In the Bitcoin network, suppose that there is an attacker who has 60% hash-rate (hr) and then other users have 40% hr. Therefore, it is obcioust if other users generate any new block, attacker can ignore it and then genrates a new block with the same height and then outrun all other miniers.

However, suppose that this benign attacker is not so malicious. I mean that if other miners find new blocks, then the attacker will accept their new blocks. Therefore, in general, other miners can mine 40% of the new block in average.

1) As this benign attacker accept any new block by other miners, is it again illegal to have more than 50% of the total hash-rate?

2) If yes, who can detect such a benign attacker?

1) As this benign attacker accepts any new block by other miners, is it again illegal to have more than 50% of the total hash-rate?

It is not illegal to have any percent of hash rate, you are allowed to have it. If you meant whether it breaks the bitcoin protocol, then the answer would be no if they are always benign. However, once they do turn malicious, they can harm the network. Refer to this link for what a 51% attacker can/cannot do.

  2) If yes, who can detect such a benign attacker?

I will present two arguments, one in a complete theoretical world and another one that uses some information that is not available to the bitcoin protocol.

Theoretically:
You cannot detect them. There could right now be a benign attacker which you describe and we cannot know about them. For a more concrete argument, consider the following two scenarios.

Scenario A: In this scenario, all the miners are honest and create certain blocks and honestly extend each other.

Scenario B: 60% of the miners are malicious(benignly as you describe) but choose to act as if they are honest.
All the block creation and exchanges which take place in scenario A and scenario B are identical. So from the point of view of observer, those are identical. And hence, in theory, we cannot detect such a benign attacker.

In practice:
    However, in practice, I believe that it is unlikely such a benign attacker exists as it would require lots of resources to be owned by a single party.


Profitability comparisons for Quarkcoin and Primecoin? I've found sites where you can put your hash rate for scrypt and SHA-256 to check which cryptocurrency would be the most profitable for you to mine, such as:

http://dustcoin.com/

http://www.coinwarz.com/cryptocurrency

I've not seen such a site include profitability comparisons for either quarkcoin or primecoin.  So my question's twofold:

Is there a site that includes either of them in the comparison of profitability?
Any reason they might not be included?

Especially after the furor caused by primecoin's launch, I find it difficult to understand this absence - whereas Dogecoin is indeed included.

The answer is that XPM(http://primecoin.org/static/primecoin-paper.pdf - see "Introduction", especially 2nd paragraph) and QRK(http://www.quarkcoins.com/bitcoin-vs-quarkcoin.html - see "SECURITY" section) have developed their own algorithms. They are not based on SHA-256 proof-of-work(used for BTC and alike - [SHA-256 CRYPTOCOINS][3]) nor on scrypt proof-of-work(used for LTC and alike - [SCRYPT CRYPTOCOINS][4]) hashing algorithms.

The websites which compare profitability use the hashrate you provide(either in SHA-256 or scrypt), the difficulty of the network and the actual price of the respective cryptocurrency in order to make a prediction on how much you can earn by mining.

The 2 cryptocoins we are discussing here are relatively new in the market, thus there is no existing database containing a list of hardware and their respective hashrates for this algorithms. As time passes, if those new coins will receive the needed attention, the community will create the needed resources in order to be able to make an estimate of earnings based on your hardware for XPM and QRK. Then everyone will be able to compare the profitability of mining.

Until then, you can only make your own calculations as there is no website to help you.

  Due to my low reputation I can only post 2 links here. Please find
  the links for reference [3] and [4] in the comments.


Forgotten SEED, Could you help me? I have a problem, when i created my new wallet, so i took a photo my seed to my mobile, that then i will write to my notebook. But next day, my mobile shuted down and i must to reset it, what my seed has been deleted.
Is it possible, how to refresh my seed or gain it back?

Do you know to help me?

Thank you so much

It is very important to write down your seed phrase with pen and paper (or some other permanent, real-world method of recording it), it is a BIG security risk to store it digitally. Do not ever take a photo of your seed phrase again!

Unfortunately, if you reset your phone and your photos were deleted , and that was the only copy of the seed (I'm assuming no cloud backup), then you may have lost your bitcoins. Your only hope is to somehow recover the deleted photo from your phone, but this may be very difficult/impossible to do.

Best of luck