20% difference between settxfee and actual transaction I set transaction fee with :

$ bitcoin-cli settxfee 0.00003000

Here is what i observe from block explorer for my transaction :
https://testnet.blockexplorer.com/tx/789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3

Fee Rate    0.000036 BTC per kB

I've tested with different transaction fees for several times; difference always 20% more.

I am on testnet3; using bitcoind version 0.16.0

Edit :

As Adam's answer; now i am more skeptical about byte calculation of blockchain monitoring sites (or whatever they are called).

I've inspected my transaction with getransaction call.
But i still dont see fee per kB is matching with calculation. According to hex parameter; it should be 250 bytes. So total fee should be 0.00000750. Shouldn't i take hex  parameter as size of transaction?

If adam's calculation correct; (seem like it is) then 180 * 0.00003000 / 1024 = 0.00000527. Closest answer so far with %4.5 difference.

Is my calculation correct?

bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3
{
  "amount": -0.00005000,
  "fee": -0.00000504,
  "confirmations": 190,
  "blockhash": "0000000000000287661d724d67bed9c1a8861179413e056ee0d16a8b132ad380",
  "blockindex": 12,
  "blocktime": 1527979564,
  "txid": "789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3",
  "walletconflicts": [
  ],
  "time": 1527979516,
  "timereceived": 1527979516,
  "bip125-replaceable": "no",
  "details": [
    {
      "account": "",
      "address": "momFk8PtAZoN4j7Y6jnbucEfc6teUKECEB",
      "category": "send",
      "amount": -0.00005000,
      "vout": 0,
      "fee": -0.00000504,
      "abandoned": false
    }
  ],
  "hex": "020000000001014bb52fb3493598763b53d5ba3cb41f2486cd1ec1b61bae2727d2b9fc74a7454800000000171600148febee6ac4a40d4474c2665c77bbf02350d1bb63feffffff0288130000000000001976a9145a756559278c3795092c07f49c6cf47d360bb1be88acc7c70f000000000017a914849901fe3e003ebf5be1afaf737305158d8865a58702483045022100e23a7e22a21da25f3363bbccbe0bfc94f8044e48236f20b595a456f6bc6d708b02206fc6acdc3636904458cd81770a346a75cc7d5e8ad3868168e387c9cff521b9680121038dc51cc27a4ae2f7ae52503ae4a23862cde107001b59a65639522925527a3e4788291400"
}

The problem is not with bitcoin core, it's definitely of the block explorer.

Transaction size is 104 + 32 + 34 + 10 = 180 byte, they are saying transaction size 140 byte. I don't understand how did they calculate it.

Blockchain.info saying transactions size is 250

You should not trust them for that matters, try

bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3

and see transaction size.


i have lost 83$ worth bitcoin from my blockchain wallet can any one help me to recover it? on 2018 oct 19 there was a transaction which I haven't done from my wallet of 83$ bitcoin please help me to get it back

Bitcoin transactions are generally not reversible.  If this transaction has been confirmed, your coins are gone.

If you think the transaction was erroneous, you can contact customer support for your wallet provider.  If they discover that it was due to a bug in their system, they might reimburse your money.

Unfortunately, a common cause of such loss is that someone compromised your account, e.g. by guessing your passwords, or by hacking a computer that you used to log in to that account.  If this is the case, it's unlikely that you will be reimbursed, and all you can do is plan to improve your security in the future.

In either case, it would be unwise to use this wallet ever again.  If there are still funds there, transfer them immediately to a different wallet; ideally, one created using a freshly installed operating system on a secure computer.


Confusion over 'change' when transferring funds from bitstamp to paper wallet I was about to transfer my funds from bitstamp -> paper wallet for the first time, but wanted to try it out first with $0.01 etc. I'm worried that since you have to specify where 'change' goes with bitcoin wallets, the rest of my funds will be diverted. Is this incorrect? Thanks in advance.

You are correct, the rest of your funds will be diverted. However, they will be diverted to a new "change" address that is also managed by your wallet. So, you will still own the change.

For example, suppose your wallet contains 10 BTC [1]. If you send 0.01 BTC to a paper wallet address, then your client will automatically send the remaining 9.99 BTC to a new address inside your wallet.

For more information, see the following questions:

Why do outputs need to be spent entirely?
Why does Bitcoin send the “change” to a different address?

This simplified explanation assumes that you originally had all 10 BTC sent to a single address. Normally, your wallet manages multiple addresses and adds up all the individual balances to show you the total wallet balance.


Can I retrieve missing Bitcoins that failed to process as Wallet is corrupt? I have been using an old wallet until last year - Bitcoin Version v0.8.5-beta. QT Version 4.8.3.

I stopped using it as it has become corrupt. I had made several transactions that were not successful before I realized it was corrupt. They are showing in my transactions list as a question mark with 0 confirmations, however the transaction amount has been deducted from my wallet total.

I backed up the wallet.dat file after each transaction and overwrote the previous backup when I did this.

Can I retrieve the missing bitcoins?

If you know the password to your wallet.dat, you should try to retrieve the private key adresses and import them in a wallet such as Electrum, and see if that fixes your issue.

This is a bit of a hassle when you have lots of changeadresses though, but it is better then not being able to access your funds.

When you unlocked your wallet.dat in bitcoin core, simply go to the console and

Use

  listreceivedbyaddress 0 true

OR, if you have generated new change adresses

  bitcoind listaddressgroupings

To get a list of all the adresses that you are currently using / have balance.

Then,

  walletpassphrase "your walletpassphrase here" 600
  dumpprivkey [your Bitcoin address here]

OR, you could dump all the private keys at once, if you were using alot of different adresses using the following command:

  dumpwallet

And import these keys in a wallet such as electrum.

See if this resolves your issue.


Generated a transaction id but not seen on blockchain Transaction id:

  a667e6d1a80c17bd0b55afec7c6ec618ca64a2a6c1b4f9badaf1c883bf5cb5dd

I sent bitcoin from electrum wallet with a 0.002 miner fee but it is showing unconfirmed. I tried to manually broadcast the transaction on blockchain.info but I am getting a transaction rejected because of High S value error.

If I don't see my transaction on the blockchain does that mean that my transaction was not broadcasted on the network? I am hoping that the transaction drops from the network as I do not want to resend.

High S value error indicates that a signature in your transaction doesn't adhere to BIP-62, i.e. that your signature is non-default. This is the same issue that has been levered in many of the past transaction malleability problems. This could happen for example if you use a very old version of your wallet software.

If your transaction hasn't propagated in the network, you should be able to create a new transaction with the same inputs. It might have been malleated and broadcasted with a different signature though, which would give it a different transaction id. If that's the case you should be able to find it by looking at the addresses of your inputs.


What is the actual reason for using boost:signals for few functions? The src/main.cpp has RegisterNodeSignals and UnregisterNodeSignals to register the functions as boost signals as below:

void RegisterNodeSignals(CNodeSignals& nodeSignals)
{
    nodeSignals.GetHeight.connect(&GetHeight);
    nodeSignals.ProcessMessages.connect(&ProcessMessages);
    nodeSignals.SendMessages.connect(&SendMessages);
    nodeSignals.InitializeNode.connect(&InitializeNode);
    nodeSignals.FinalizeNode.connect(&FinalizeNode);
}

Let us pick InitializeNode as an example. The actual invocation happens in src/net.cpp which invokes the function defined in src/main.cpp:

GetNodeSignals().InitializeNode(GetId(), this);

I have the following question:

Why cannot we simply call this function? Why should we complicate with boost library and signals?
Has it got to do with performance of threads? If yes, then why only the 5 functions in RegisterNodeSignals

Signals in OO is a powerful concept that allows binding instances together on runtime.

The signals concept allows to keep code modular and bind multiple instances on one signal emitter.

Just calling a function can work (for the 1-to-n you would at least need another vector of instances, etc.), but would reduce the flexibility and modularity of the code.


How are altcoins on crypto-exchanges based off BTC, ETH, and others My question deals with all the cryptoexchanges out there that only accept and use cryptocurrencies.  How is it that for example, LTC's price is based off of BTC on some excahnges (on the y-axis of a price graph)?  The reason I am asking is because lets say I own 10 LTC that stays the same price in USD and the price of BTC drops dramatically.  I then convert my LTC to BTC in the exchange and BTC then raises back up to it's original price, does that mean I just made money?  As in could I keep exchanging between the two whenever one goes up and the other goes down? I thought of this a week or two ago when bitcoin's price drastically dropped and has been fluctuating.

The "price" is usually based on the most recent trade in the specified exchange pair (e.g. LTC BTC). The most recent trade is simply two other participants on the exchange, the seller and the buyer. The seller (also called a "maker") offered to sell a particular coin at a particular price in a particular currency (e.g. to sell some amount of LTC for a specific price in BTC). The buyer (also called a "taker") offered to buy a particular coin at a particular price in a particular currency. The trade happens by the exchange when a buyer and seller's orders are matched.

Can you make money in these price differences between multiple currencies? It is possible, this is called an arbitrage. However, don't forget that the transfers usually take a bit of time and the arbitrage opportunity may have passed by the time you've made some trades, because rest assured others are looking for these arbitrage opportunities as well. Additionally, there are usually fees for each trade that eat into any earnings you might be making.

Also, this isn't that different from Forex Arbitrage trading in fiat currency markets so it is a well studied discipline and we can certainly learn from the practices established there.


GDAX Post API not working VB.net I am having trouble with a (400) bad request on POST requests.  I am able to execute all Get and Delete requests with the same signature process, but obviously the body is string.empty. We have tested all sorts of different JSON formatting to try and get this to work, but it is not working. We have not been able to find an example of ANY prehash signature to compare to.  Also, unless the POST server time is different than the GET and DELETE server times we have the correct timestamp as we are within 1 second of the GET/time API call for server time.  GDAX allows for 30 second buffer to authenticate.

Public Shared Function placeOrder()
    Try
        Dim Body As String = "{""type"":""limit"",""side"":""sell"",""product_id"":""BTC-USD"",""price"":""20000"",""size\"":""0.02235229""}"
        Dim ts As String = GetNonce()
        Dim method As String = "/orders"
        Dim str_GDAX_Main As String = "https://api.gdax.com"
        Dim sig As String = GetSignature(ts, "POST", method, Body)
        Dim fr As System.Net.HttpWebRequest
        Dim targetURI As New Uri(str_GDAX_Main & method)
        'Dim response As String

        Dim jsonDataBytes As Byte() = Encoding.UTF8.GetBytes(Body)

        fr = DirectCast(HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)
        fr.Headers.Add("CB-ACCESS-KEY", config_API_Key)
        fr.Headers.Add("CB-ACCESS-SIGN", sig)
        fr.Headers.Add("CB-ACCESS-TIMESTAMP", ts)
        fr.Headers.Add("CB-ACCESS-PASSPHRASE", config_API_Passphrase)
        fr.UserAgent = UserAgent
        fr.Accept = "application/json"
        fr.Method = "POST"
        fr.ContentLength = jsonDataBytes.Length

        Dim stream = fr.GetRequestStream()
        stream.Write(jsonDataBytes, 0, jsonDataBytes.Length)
        stream.Close()

        Dim response = fr.GetResponse().GetResponseStream()

        Dim reader As New StreamReader(response)
        Dim res = reader.ReadToEnd()
        reader.Close()
        response.Close()
        Return res

        'If (fr.GetResponse().ContentLength > 0) Then
        '    Dim str As New System.IO.StreamReader(fr.GetResponse().GetResponseStream())
        '    response = (str.ReadToEnd())
        '    str.Close()
        'End If

        'Form1.RichTextBox1.Text = (response)
    Catch ex As System.Net.WebException
        MessageBox.Show(ex.Message)
        'Error in accessing the resource, handle it
    End Try
End Function

Public Shared Function GetNonce() As String
    Return (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds.ToString()
End Function

Public Shared Function GetSignature(nonce As String, method As String, url As String, body As String) As String
    Dim message As String = String.Concat(nonce, method.ToUpper(), url, body)
    Dim encoding = New ASCIIEncoding()
    Dim keyByte As Byte() = Convert.FromBase64String(config_API_Secret)
    Dim messageBytes As Byte() = encoding.GetBytes(message)
    Using hmacsha256 = New HMACSHA256(keyByte)
        Dim hashmessage As Byte() = hmacsha256.ComputeHash(messageBytes)
        Return Convert.ToBase64String(hashmessage)
    End Using
End Function

We have no idea if our body is incorrect or if the URI is incorrect or what the problem is.  If someone can take a look at it and figure out where our body syntax error is.  Or if we should look elsewhere.

your "Public Shared Function GetSignature" works fine! I have been racking my head for a couple of days writing my own but with no luck! Thanks for your snippet!

As far as your problem someone may have already answered it.

To troubleshoot further problems I recommend after you get an HTTP Error to continue your stream and GDAX will give you helpful information.

here is how I handle a web exception.

          Catch ex As WebException

        Dim output As New ClassWebRequestOutput
        output._ErrorMessage = ex.Message.ToString

        Dim exResponse As String
        output._Error = True

        exResponse = New StreamReader(ex.Response.GetResponseStream()).ReadToEnd
        output._Resopnse = exResponse

        Return output
        Exit Function

This continues the web connection with helpful hints.


Ways to monitoring BTC trading profit and loss? Does anyone have recommendations when it comes to monitoring BTC trading profit and loss? I find it confusing when taking into account the transaction fee the exchanges impose (ie- GDAX). I use Coinigy for charts and entering orders.

No need for fancy scripts and databases:

[what you put in] - [what you got out] = [your profit]

All you need to know:

the price of BTC at the beginning of the period
the price of BTC at the end of the period
have a list of all USD deposits/withdrawals
have a list of all BTC deposits/withdrawals (and the value of BTC in USD at that moment the deposit or withdrawal was made)

I will try to explain with an example:

Starting balance = $0 + 1 BTC
Deposit $1,000 (balance = $1,000 + 1 BTC)
Buy 1 BTC @ $900/BTC 1% fee = 0.01 BTC (balance = $100 + 1.99 BTC)
Sell 0.5 BTC @ $920/BTC 1% fee = $46 (balance = $555.40 + 1.49 BTC)
Withdraw $500 (balance = $55.40 + 1.49 BTC)

For a certain period in time the profit

= ([value of all assets at end of period] – [value of all assets at beginning of period]) + ([value of assets withdrawn] – [value of assets deposited])
= (($55.40 + 1.49BTC) - ($0 + 1BTC)) + (($500 + 0BTC) - ($1,000 + 0BTC))
= (($55.40 + 1.49BTC x $920) - ($0 + 1BTC x $900)) + (($500 + $0 x $920) - ($1,000 + $0 x $900)) // convert BTC to USD for the price at that time
= (($55.40 + $1,370.80) - ($0 + $900)) + (($500 + $0) - ($1,000 + $0))
= ($1,426.20 - $900) - $500 // My assets is worth $1426.20 at the end of the period, it was worth $900 at the beginning of the period but I added $500 from external sources (deposit - withdraw)
= $26.20 // Total value of my assets increased by $26.20

Even if I made zero trades for the month and the BTC price increased while I had BTC "stock", I would have made "profit" from a USD perspective as my total assets' value increased in USD terms.


Is bitcoin sustainable? A rather dumb title, however I have question that I cant get a grip on related to bitcoin:

If the amount of bitcoin is supposed to have an upper limit, what is the incentive to mine in the future if that limit is reached?
If one entity controls more than 50% of the network then the protocol will break down, doesn't the continuous rise in difficulty destine that only one ASIC miner will be left?
Who is it that sets that difficulty level and why then is it  called decentral?
To participate you need the complete blockchain stored locally. How is this supposed to scale when data to store is growing exponentially?

I seems that the system is built to only day just vanish.

I'll address your points individually:

Bitcoin mining in the future will be supported by transaction fees rather than the block reward, see this question for more details: What will happen to mining after the 20 999 999th Bitcoin?
Not sure what you mean here, why would an increasing difficulty lead to only one miner? If people stopped mining, the difficulty would go back down again because the hash rate would have decreased, so there's an equilibrium point based on how profitable mining is at any one time
The difficulty is just an algorithm which is based on the time taken to mine the last 2016 blocks (technically only 2015, because of a bug, but that doesn't matter). So everyone agrees on the difficulty, everyone can calculate the current difficulty by looking at the blockchain. No one person sets the difficulty, everyone does.
Scaling is an issue which is a big topic at the moment, because yeah the blockchain is getting very large. But please note that it's possible to run a pruned node which only stores some of the most recent blocks and doesn't all the way back to the genesis block. Full nodes never use this historical data anyway other than when serving brand new nodes with blocks to get them up and running, and when rebuilding their UTXO set, which normally is only done once when the node first starts and doesn't need to be done again.


Why isn't Bitcoin-QT or any other Bitcoin related app on the App Store for Mac? I assume that someone may have tried to upload a Bitcoin app and it was rejected, but does anyone have information on what specific rules Bitcoin-related applications violate on the App Store?

As far as I know, there have been no submissions of Bitcoin apps to the Mac App Store.

A Bitcoin app for iOS was submitted to the App Store in May 2011 by Ehud Ben-Reiven. He reported that it was rejected because "...it involves intermediate currency...". He subsequently open-sourced the code, bitcoinApp, but, as of this writing, it hasn't been updated in years.

Blockchain.info had some success in submitting an Blockchain app which uses the site's API to do all the heavy work. However, it was removed without reason in May 2012 and later restored in August 2012. This app relies on Blockchain.info as a hosted wallet, though, and is not a fat client.

TL;DR Apple disallows Bitcoin clients because it considers Bitcoin to be an "intermediate currency".

Speculative TL;DR Apple disallows Bitcoin clients directly because it's a payments system that circumvents Apple's desire to take a cut of all money that flows within its app ecosystem. It's not known how Venmo and other payment networks are allowed to circumvent that, if they even do.


coinbase receiving addresses reused! I generated a new receiving address on CoinBase so that someone can send me BTC.  I immediately searched the address on blockchain.info and was quite surprised to see that it already had many transactions going back several months!  What is coinbase doing?  Why don't they give me a brand new address?  How can they keep track of what account to credit if they give multiple customers the same receiving address?

It's likely that only used the address internally, so it was not assigned to a customer. I would expect that from here on out until forever, whenever coins are sent to this address, it will credit your account.


Can't pay with Electrum - invalid password? Update

  Well, it was my bad, dreadfully sorry guys. My bad with the password
  and seed, mixed some things up :(  Everything restored successfully.

I use Electrum 1.8.1 (portable edition) and have some mBTCs in my wallet (electrum.dat). I tried to send a payment and was asked to type the password which I had set before. The password is kept in KeePass, I pasted it from KeePass and... "invalid password". But it is correct for sure.

I have the seed (12 words) well kept. I tried to restore the wallet with the seed, after backuping my electrum.dat and deleting it, but if I paste the seed words and the wallet is created and synchronized, I'm told the wallet has no transaction history (therefore, no money there).

I tried these ideas as you can see above: https://bitcointalk.org/index.php?topic=261777.0 and https://bitcointalk.org/index.php?topic=170610.0

Questions:

1) How could it happen that Electrum says the password is invalid when trying to send the money?

2) How could it happen that no transaction history is detected after using the seed (12 words) to restore the wallet?

3) Does it have anything to do with the list of Electrum servers? It is shown when I try to restore the wallet using the seed. If yes, do I have to try every server from the list to understand which one keeps the data about my wallet?

4) How do I recover my mBTCs from the Electrum wallet? I see the number I have, but can't send because of the password issue.

The first experience with Bitcoins and kind of frustrating... I hope I've explained the situation more or less well.

Be sure that you are entering the correct password you've set (be careful with added blank spaces, keyboard localization...). You can try to crack your own password if you remember most of it.

Maybe the transactions that you remember were on imported keys? If so, they are only in that encrypted wallet file. Your seed can only restore the keys derived from it.

Electrum servers are all the same and give the same information (they only differ from hardware).


Is there a usable Namecoin GUI client? Is there any GUI client that is capable of trading Namecoin, and is somewhat trusted by the community?

Multicoin can be used to trade Namecoin although the functions for registering names and such cannot be used.

There is a current bounty of 750NMC to produce a web UI for the client to run within a local machine. It can be found on the http://dot-bit.org wiki site.


Is Butterfly Labs reputable / Should I preorder the SC Jalepeno? I'm somewhat new to the mining scene but I'm a bit familiar with everything. I see that GPU mining will become much less cost effective over the next year or so, especially around December when the block reward size drops to 25 BTC.

As an entry level miner, I don't have a decent rig to just use a pool with or anything. I'm stuck with a quad core AMD mobile CPU in an HP laptop with the worst ATI card known to mankind, giving me about 7.5 Mh/s using rpcminer-4way. Based on what I've seen, the claims that Butterfly Labs is making are pretty substantial and if they're true, they could greatly change the playing field. At a price as low as $150 for 3 Gh/s, I would be willing to invest, since I don't have the money right now to build a GPU mining machine.

I have seen many people preorder the SC Jalepeno model and I'd just like some additional info and background on the company and their products before shelling out $150-$300. And are there any comparable low-cost FPGA or ASIC USB devices with a decent Mh/s/$?

EDIT:

My original answer may have made sense back when the question was asked, but now it is clear that Butterfly Labs cannot be trusted.

As they say, "fool me once, shame on you; fool me twice, shame on me". After all the delays and controversies with their FPGA line, they have given their word that with the experience gained they really will be able to deliver their ASIC line on October 2012. 10 months later (and 20-fold difficulty increase later), even the first pre-orderers didn't get their orders in full. This didn't stop them from announcing a new line, with pre-orders and the same empty promises. Which, if they deliver, will be better performing than their first ASIC line, without any compensation to their loyal customers who have waited more than a year.

The fact that their CEO was shown to be a convicted felon doesn't help.


How are fees determined in the Lightning Network? How are fees determined in the Lightning Network?

For transactions that occur on chain, fees are determined by the availability or demand for space in node's mempools. How are they determined in the Lightning Network?

If there aren't fees in the Lightning Network, what is the economic incentive to operate a node?

Fees are determined by the node operators. It's a free market, you can set whatever fee you want. Of course there's lots of competition, so if you want people to route payments through you, you should set a low or no fee.

  If there aren't fees in the Lightning Network, what is the economic incentive to operate a node?

Even without fees, there is still an incentive to operating a node and using LN. In order to use LN, you must be a node. You will want to use LN to avoid paying higher fees with on chain transactions, and thus you will be operating a LN node.


ListAccounts JSON array data isn't consistently formatted (compared to ListReceivedByAccount) When I perform a ListAccounts query I get this:

  {
  "result": {
    "": 0.0,
    "account": 0.0,
    "account3": 0.0,
    "account7": 0.0
  },
  "error": null,
  "id": "1"
}

However ListReceivedByAccount(0, true); looks like this:

  {
   "result": [
     {
       "account": "",
       "amount": 0.0,
       "confirmations": 0
     },
     {
       "account": "account",
       "amount": 0.0,
       "confirmations": 0
     },
     {
       "account": "account3",
       "amount": 0.0,
       "confirmations": 0
     },
     {
       "account": "account7",
       "amount": 0.0,
       "confirmations": 0
     }
   ],
   "error": null,
   "id": "1"

Notice how the embedded array data is formatted differently?  Is there a name or term that describes these different array formats (named vs unnamed)?

Why is it different and can this be fixed in a future version?

If it is fixed in a future version will the outermost "id" property become "2" so I can add the logic to my parsers?

JSON data structure supports lists (arrays).

http://en.wikipedia.org/wiki/JSON

In the first API command (ListAccounts) the result contents is an object which contains a string.  Inside this string is a set of data records, each of which is a key/value item.

In the second (ListReceivedByAccount) the result contents is an array of objects, each of which holds account data.

That does appear inconsistent, where perhaps the first call should have returned an array as well.

However a rule of thumb is that existing APIs should not change.  They can be deprecated and replaced but a call is expected to behave in a consistent manner.

The Bitcoin client is an open source project and thus an issue ticket for this inconsistency can be opened and a pull request with the source for a new API call submitted.  Whether such an issue is merged into the client depends on a number of factors, including severity of problem.


Logging into Binance.com via VPN gives: "Network unavailable,please refresh and try again" When using my VPN I get the following error: Network unavailable,please refresh and try again

However it works fine when using it without VPN. What is the cause of this?

To bypass that check goto: hw_login.html instead of login.html when you are on the binance login page. Just replace login.html with hw_login.html


How does this simple script use the OP_CHECKSIG opcode? I have this Script P2PKH

<A Signature> <A Public Key>
OP_DUP OP_HASH160 <A Public Key Hash> OP_EQUALVERIFY OP_CHECKSIG

The bitcoin.org documentation say this

  The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.

Now I want to understand how the code is running inside the stack and how the OP_CHECKSIG work.

My question comes from the fact, why use another operator (OP_CHECKSIG) if is used the operator OP_EQUALVERIFY to does control ?

But I have another question on OP_DUP, the documentation say this

  Duplicates the top stack item.

Why when the bitcoin run the script need to duplicate the items inside the stack?

to close, exist other documentation on Bitcoin Script language?

Let's run through the program.

The stack starts as <A sig> <A pubkey>.
You run OP_DUP. The stack is now <A sig> <A pubkey> <A pubkey>.
You run OP_HASH160. The stack is now <A sig> <A pubkey> <A pubkeyhash>.
You push (A expected pubkeyhash). The stack is now <A sig> <A pubkey> <A pubkeyhash> <A expected pubkeyhash>.
You run OP_EQUALVERIFY. If the initial public key on the stack does matches the expected one, the execution aborts and the script fails. If it matches, the resulting stack is <A sig> <A pubkey>.
You run OP_CHECKSIG. If the signature matches, the resulting stack is 1, which means success.

Without the OP_DUP, it would be impossible to verify the public key both against the signature and against the expected public key hash.


How to buy a million ripples? If someone wanted to buy up lots of ripples, say a million, how would they go about doing it?

Currently the exchanges don't seem to give good rates, and trading one-to-one with someone else would be inefficient. Is OpenCoin selling directly? At the current Bitstamp rate, it would cost $4444.44 to buy 1,000,000 XRP.

For now you can request a private sale at a good rate by emailing Bitstamp customer service or directly Nejc Kodrič  (nejc dot kodric at bitstamp.net)


How to restore wallet from 15-word seed mnemonic? The wallet was created around Feb 2013, using unknown wallet software. All that is known is a passprase, and 15 words. I suspect the passphrase was used to encrypt the wallet, and is probably irrelevant here, since the wallet file itself is lost.

All words are found in the "old" Electrum list. But the number 15 is puzzling, since no version of Electrum ever produced 15 words by default, as far as I know. I considered the possibility that this mnemonic was extended with custom words, but it looks like custom words in Electrum work only with the "new" word list.

I cloned Electrum repository from github and tried converting mnemonic to hex seed using the old list, then converting it back to mnemonic using the "new" word list. This method produces 15 words that Electrum GUI does recognize as 12 + 3 (extended), but leads to empty wallet.

My working hypothesis: there ought to be another wallet software that existed around 2013 that used Electrum's "old" word list and generated 15 words by default. Any other ideas or suggestions?

Mnemonic phrase from 2015 or earlier, and not an Electrum seed?
Then there is a high probability it is blockchain.info's legacy wallet recovery mnemonic.
Which can be recovered here https://blockchain.info/wallet/forgot-password
Correction:
This is a blockchain.info mnemonic. It contains your WALLET ID and Password (pre 2013 contains only Password and/or password plus alias)
You can decrypt the mnemonic using blockchain.com webpage they have a legacy (HD is only 12 words) page which changes from time to time.
With that you can login to your account and access your coins.


Improve uniqueness of block for nonce creation I am going through online Blockchain course and in the course, they have mentioned that uniqueness of a block is defined using hashes with leading zeros as well as timestamp. Since, in the training, they have assumed 18 leading zeros in hashes, the valid hash count is 4 billion. So, with the unique combination, every node has 4 billion valid hashes per second to get the golden nonce. But since all the miners are trying at the same time to generate the nonce, this range gets covered quickly within a second. So for this, the solution is to change block configuration.

My question is -
If per second, all the 4 billion hashes are getting covered without finding golden nonce, why cannot we have 1 more field in the block like node id?

So, the uniqueness of the block can be defined using 3 variables - node id, timestamp and hash. Since node id of the node is unique to the node, every node gets free chance to use up to 4 billion hashes per timestamp.

I am sure this must been thought of by designers or probably I am not thinking properly.

Blocks include more than just those 3 variables. One of the most important ones is the merkle root. This is the hash of all of the transactions in the block, in a particular order. If different transactions are included or they are included in a different order, that merkle root is going to be different. So if each miner has a different merkle root, then they are going to have their own set of nonces to work with. That is what actually provides uniqueness here.

Miners all have different merkle roots. This is because the merkle root includes the transaction that pays the mining reward - the coinbase transaction. Since every miner wants that reward, they will have a coinbase transaction which is different from every miner as it will include their payout address, not someone else's. So by virtue of having different payout addresses in their coinbase transactions, the blocks that miners are working on will be unique and different from other miners.


BIP39 seed and secret key My understanding is that the 12-word seed is used to recover wallets' private keys. However, if each private key is 256-bits long, and the dictionary for the seed only contains 2048 words, then that's not nearly enough to cover them all: 2048^12 = 2^132 << 2^256.

Where is my misunderstanding?

2048^12 = 2^132 << 2^256

It doesn't need to be able to describe every private key. You always start with the mnemonic, never calculating a mnemonic from a private key.


bitcoin-cli can't connect to server I'm trying to put up a simple system for some penetration tests.
I have an Ubuntu server 16.04.1 with apache2 and bitcoin.
all running "Hiddn service" through tor (and bitcoind proxied 127.0.0.1:9050).
Now, using easybitcoin.php , the apache shows getinfo, send receive, all good.
but using bitcoin-cli nothing works! "couldn't connect to server"..

my bitcoin.conf is:
server=1
listen=1
proxy=127.0.0.1:9050
rpcuser=myuser
rpcpassword=mypassword

Any ideas why bitcoin-cli can't connect?

You should try adding daemon=1 to your bitcoin.conf file.


I've inherited BTC, how do I recover and sell it? Update>>> I have the 12 word phrase and the 34 letter and number address for wallet...
Mom passed away the day after Thanksgiving. I have all her paperwork and mine as I was her only child. I have a string of numbers and letters and a 12 word collection related to her bitcoin however I am not at all familiar with bitcoin and am not very versed in technology. How should I proceed? Thank You.

I'm sorry to hear of your loss. Recovering the funds will require some careful work, but go slowly and make sure you understand what you're doing, and you'll find it isn't that hard!
Importantly: Be very wary going forward - lots of scammers will likely attempt to prey upon you and steal your funds! DO NOT share the 12 words or 34 letter string with anybody online! DO NOT input those words into any online website or service. You do not need to trust or depend on anyone else to recover the funds. There is no 'official' anything in Bitcoin - it is a decentralized network without any admin. You (the user) are in full control, you can accomplish all the required actions without any dependance on a third party (except for the sale of BTC -> fiat currency, perhaps).

Those words are the 'key' that will allow you to spend the bitcoin, so to speak. To use the key, you will need to find some secure wallet software. I would suggest starting by looking at bitcoin.org, and selecting a wallet from the list they have there.
Once you have some wallet software running, you will want to select an option to 'recover'/'import'/etc your wallet, at which time you will be prompted to enter the 12-word mnemonic seed phrase. Once you do so, you should hopefully see the wallet load properly, showing the funds and all past transactions.
If an empty wallet with no transaction history loads, then you will likely need to select a different 'derivation path' for the wallet to follow. Some wallets (eg Electrum) allow the user to define a derivation path, while others do not. You may need to find software that allows you this more fine-grained contro.(Under the hood, the wallet is using the 12-word phrase to derive the cryptographic keys that allow you to spend the wallet's funds. There are different standards for which keys the wallet will derive, selecting the correct path is important!). It is helpful to know which wallet software was originally used to create the wallet, but if you don't have that information then all hope is not lost, it might just take some extra work. You could take a look at WalletsRecovery.org for some help/info.
With the wallet recovered, you will need to find somewhere to sell the coins for your local currency. Do your research to find a reputable service in your area, as you'll need to trust them completely with your funds. Once you've made a choice, send a transaction by copying the deposit address from the exchange service to your wallet's 'send' field. You can then make the trade for your local currency, and withdraw to your bank account by whatever methods the exchange service offers.

Keep in mind that you will want to make sure the device you load the wallet onto is secure. For example, a brand new iphone is going to be a more secure device than a 10-year old windows PC that hasn't been updated regularly.
You may want to consider how much BTC is at play here - if it is a huge sum then it may be worth first acquiring a small amount of BTC yourself first, to familiarize yourself with the tools and procedure of sending/receiving/recovering funds. That way, if you make any mistakes, you will just lose a small amount of funds, instead of the inheritance.


bitcoin repo sighash.json data format Bitcoin enthusiast here. Learning "the hard way" how bitcoin works (andreas books, looking in js/python implementations), I'm writing (as an hobby) some code here and there to understand things and to test it, I'm using the tests available on the bitcoin github repo. But now, I'm struggling with the ones on the sighash.json file.

What is the encoding format used for the raw transactions ? (first element on each array).

I understand the traditional format which looks like 0100000000010280e688...000ffffffffe9b54...39da98ac00000000. But here I'm honestly lost. On the tests file, it doesn't look like a regular transaction.

Example:

907c2bc503ade11cc3b04eb2918b6f547b0630ab569273824748c87ea14b0696526c66ba74020000004ab65ababfd1f9bdd4ef073c7afc4ae00da8a66f429c917a0081ad1e1dabce28d373eab81d8628de802000000096aab5253ab52000052ad042b5f25efb33beec9f3364e8a9139e8439d9d7e26529c3c30b6c3fd89f8684cfd68ea0200000009ab53526500636a52ab599ac2fe02a526ed040000000008535300516352515164370e010000000003006300ab2ec229

How am I supposed to decode such string ?

Thanks.

You decode them in exactly the same way that you decode a transaction. They are perfectly valid transactions and a decoder should be able to decode them properly and get meaningful data out of them. The reason they look weird is because every part of the transaction is randomly generated so the fields do not necessarily contain data that you expect (e.g. the version number is randomly generated instead of the standard 01000000 or 02000000).


What is the difference between PSBT support in Coldcard and Trezor? The 10x Security Bitcoin Guide says that the only two hardware wallets support BIP174 (partially signed Bitcoin transactions, or PSBT). However, this Reddit thread says that "You can use PSBT with Trezor via HWI". This Github issue elaborates.
What is the difference between the level of support of PSBT between Coldcard / Cobo and Trezor? Should a user care?

The Coldcard handles PSBT directly and natively. A PSBT can given to the device by writing it to a microSD card and inserting the card into the device. It will be able to load the PSBT and process it as a transaction. Additionally when communicating with the device over USB, PSBTs can be given directly instead of being packed into another data structure.
However other hardware wallets like the Trezor do not have this capability yet. Instead these must be given transactions over USB and those transactions must be packed into device specific data structures. The HWI software does this translation for users - it takes PSBTs and converts them into the format that each hardware wallet uses.


Hosted web wallet based on bitcoin core - approach to handling keys I'm building a website for my client, that is essentially a web-based hosted wallet.

I'm going to use bitcoin core and talk to it via its API in order to handle the transactions.

I understand that I can allow users to export their private keys and import them by using

  dumpprivkey

and

  importprivkey

The question is: after several thousands of users will create their wallets, the server's wallet.dat file is going to be really huge.
Would that make the bitcoin server slow?

I'm thinking about queuing all the requests to the bitcoin server and store there only one key at a time. But that would require to restart the server everytime, and would basically make every request time consuming?

What is the correct approach to this?

Thank you

The question is: after several thousands of users will create their wallets, the server's wallet.dat file is going to be really huge. Would that make the bitcoin server slow?

Yes, it is know that when the wallet.dat file is very large it noticeable slows down Bitcoin Core. However this only happens when there are millions of keys stored in the wallet.

Instead of having all of the private keys in one file, you can use Bitcoin Core's multiwallet feature. This feature allows you to have multiple wallet files loaded into Bitcoin Core so this should avoid the issue of having too large of a wallet file. It will also let each use have their own wallet file so only one user's coins are actually moved when spending any money. The only downside to this is that loading and unloading a wallet requires restarting. Once PR 10740 is merged, you will be able to dynamically load and unload wallets. Note that having many wallets loaded at the same time may also be problematic.


How do I clear a stuck Bitcoin transaction.The other answers did not help my situation How do I clear a stuck Bitcoin transaction without being in control of the senders wallet?
I have a #number to go on and my wallet address.
The sender does not know how to help me.

if the transaction did not use the optional replace-by-fee scheme, then after 14 days it should be dropped from all mempools and the sender would have the coins back.

if the sender is unavilable or uncooperative and you need the transaction to go through, look for miner priority services; they allow you to pay a fee to get the transaction prioritized.


receive payement bitcoin api like blockchain API v1? I am looking for a API function as the first version of the API blockchain.info (no API key).

If there are none, I'd like you to tell me where to turn to create an API with a similar operation and a callback.

Thank you.

please check this API https://bitaps.com/api/

No registration required, no API keys, simple RESTfull API

To create payment address use: https://bitaps.com/api/#Create_payment_address

To handle callback:
https://bitaps.com/api/#Processing_the_callback

If you need help with development contact support@bitaps.com


Is there a point to vanity addresses if a new destination address should be created per sender? There is some advice for merchants to have a unique Bitcoin address for each incoming address.    Apparently this will help associate a transaction with a sender.

Since it can take a long time to generate a vanity address:

Is there any benefit to doing this if one should be created per sender?
When does it make sense to use a vanity address?

Vanity address' purpose is generally in its name - vanity. You mainly use it to show off, like say in forum's signatures or general donation address, not for business in most cases. Usually you won't want to use a vanity address when you want to remain anonymous, which is what you try to accomplish by using a new address for each transaction. You can use the vanity address to mark your brand as well. For example, SatoshiDice's addresses all start with "1Dice".

Generally, you would use a vanity address if you can spare the computational power where people could see it quite clearly, and use the other addresses when you don't want to make an effort.


How to know Block height when a transaction entered Mempool? I'm hosting a Listening Bitcoin Node in Capital of Pakistan. I want to know the Block height when Transaction entered the mempool. Right now I'm using the time from the Json format of the Transaction and Checking the Block height against it. Do you guys think that this method is reliable or I fear that transactions in my mempool have more latency than usual node in Europe. Should use an Api to find the Entry Block Height of the transaction?
Please also suggest an api also?

Bitcoin Core has a getmempoolentry command. This takes a txid and returns information about that transaction's mempool status. This includes height which is the block height when transaction entered pool.


What will happend when a certain node is not connected to full node? what will happen when there are some full nodes in the network which are not connected to one client-how can he get new blocks updates?

thank you

can he get new blocks updates?

no. you can test this case. just run your daemon with the parameters -connect=127.0.0.1 -listen=0 and you would not get new blocks


How is a blockchain split resolved? Let's say two miners created 2 different blocks and broadcast them into the network. Now some clients see blockchain 1 and other blockchain 2 which are different from each other.
I would like to understand technically as possible how in the end the majority of clients will continue with only single chain and the other be abandoned?
Why will they choose one over the other?
I would like to believe this is done automatically by the clients / miners without human touch, only by some kind of coded logic. That logic is what I'm after.

Related question: What happens to extinct blockchains, and transactions inside of them?

You're looking for CBlockIndexWorkComparator, which operates by three rules. The rules are applied one at a time, and if a rule leads to a tie, then the next rule is applied.

Which blockchain has the most work?
Which one was received first? (This can be different for different clients, which is why the previous rule is applied first.)
Which one has a larger pointer address? (This is largely random, and different for different clients.)


Why is my Bitcoin transaction taking so long I am new to Bitcoin (using Bitcoin core client) and i tried to make a transaction but its taken 4 days so far and i not sure what to do?

https://blockchain.info/tx/8c2057ca78c0843b881c2620127d140cdeeeb73f38fa6444d9aecd82d0979cc9

The transaction appears to have a very low "fee per byte" of 20.09 satoshis per byte.  A transaction I just completed got confirmed 5 times within 30 minutes or so with a fee per byte of 298 satoshis/byte.

You need to make sure the fee you specify for the transaction is attractive to miners, otherwise it will take a long time for the transaction to be confirmed.

Earn.com has a great bitcoin fee tool at https://bitcoinfees.earn.com/ (I'm not associated with Earn in any way)


Confusion about Addresses I have a little bit confusion about addresses segwit and not segwit.

I can see P2WPKH and P2WSH from this link https://en.bitcoin.it/wiki/BIP_0173, and they are segwit and start with bc (mainnet) or tb (testnet).

But I can see even P2SH, start with 3 nested P2WPKH or P2WSH, and that address start with 3.

Then When we speak about P2WPKH and P2WSH we mean Native and start with bc, or We can have even P2WPKH start with 1 and P2WSH start with 3?

when I create

bitcoin-cli getnewaddress "segwit" "p2sh-segwit"

which kind of script I have? P2PK?

6 types of Bitcoin addresses (in parentheses are the data they keep):
Legacy

P2PKH 1... (a public key's hash)
P2SH  3... (a script's hash) (defined in BIP16)

SegWit (P2WPKH/P2WSH) nested in P2SH (defined in BIP141)

P2SH-P2WPKH 3... (a public key's hash)
P2SH-P2WSH 3... (a script's hash)

(these start with three because these addresses are meant to be compatible with existing wallets, who would see those addresses as P2SH wallets)
Native SegWit (P2WPKH/P2WSH) (defined in BIP141 + BIP173)

P2WPKH bc1... (a public key's hash)
P2WSH bc1... (a script's hash) (but longer than P2WPKH)

which kind of script I have? P2PK?

getnewaddress can't return P2PK because you can either pay directly to a script (which can be P2PK) or a script enclosed in P2SH (or its derivatives P2SH-P2WSH and P2WSH). But that's not very useful.
The documentation says:

Arguments:

"label"          (string, optional) The label name for the address to be linked to. If not provided, the default label "" is used. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.

"address_type"   (string, optional) The address type to use. Options are "legacy", "p2sh-segwit", and "bech32". Default is set by -addresstype.

The legacy type means P2PKH, p2sh-segwit means P2SH-P2WPKH and bech32 means P2WPKH.


How to experience the thrill of mining? Bitcoins are hard to mine now. I've always wanted to actually earn them, but never actually gotten much of anything. I want to create my own blockchain, separate from any other networks, so that mining will be faster and I'll actually be able to experience the thrill of mining bitcoins.

Will someone give me a suggestion, program link, or what have you re: a private network? I just want to try it. Not a spendable coin fork, just something that I can enjoy watching for a bit.

Have you tried understanding why you have that desire? It might help you understand more about what makes you tick.

You might like to try mining Litecoins, or even on the Bitcoin Testnet. Or, you could try some Bitcoin mining with the Eligius pool, which from memory will pay out any amount after 2 weeks (whereas most pools have a minimum payout). If you can manage to mine 0.01BTC, that is enough to make a transaction from most eWallets (again, they often have a minimum transaction, usually 0.01BTC), and you could possibly even buy something from coindl.com with it.

Alternatively, you might get more satisfaction by playing Minecraft (it has a free trial), which can give the same sense of satisfaction when  you find something of "value".

Another option to consider is earning some dollars, or whatever your local currency is, and exchanging it for bitcoins. Or even just save some dollars on electricity by not mining, and exchange those for bitcoins. Or, sell something on bitmit maybe?


calculating z1

  replace the input with the corresponding output script

This is the step where you made a small mistake.

The UTXO that's being spent is from txid 9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280 which contains two txouts. When you did the script replacement, you chose txout #0 (with a hash160 of cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d), but the tx being signed is spending txout #1 (with a hash160 of 09a4cb092dc30da1354369fc78f482365ce2767a).

Doing the replacement with the correct txout script results in this, which hashes to the z1 value you were expecting:

010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000


how to get block information using node js I have used bitcoin-core package in node js to get the information about the block detail using rpc command.

For example:

var Client = require('bitcoin-core');

const client = new Client({ headers:'false', host:'127.0.0.1', network:'testnet', password:'xxxx',port:'18332', ssl: {
    enabled: false,
    strict: false
  }, timeout:'3000', username:'xxxx' });

client.getBlockchainInformation().then((help) => console.log(help));

It throws below mentioned error:

unhandled rejection rpcerror: not found

Any solution for this.

Thanks in advance.

The function client.getBlockchainInformation and the other methods exposed by the bitcoin-core npm module use bitcoin-core's REST interface. In order to use it, however, it must be enabled when you start bitcoind with the -rest flag.

  The REST API can be enabled with the -rest option.

  The interface runs on the same port as the JSON-RPC interface, by
  default port 8332 for mainnet, port 18332 for testnet, and port 18443
  for regtest.

e.g.:

$ bitcoind -rest

or in bitcoin.conf

rest=1


Why is the Bitcoin Gold Hardfork happening? I haven't been following up on the story behind Bitcoin Gold. I wonder why this is a fork from the already created Bitcoin ledger, and why this cannot be a fork from the core software, and start their own ledger from the beginning.

It's just a group of people trying create more money and gain control of their own blockchain using a hard fork.

My guess on why they aren't starting their own blockchain and just forking Bitcoin's is that Bitcoin already has huge name recognition and they probably already own a bunch of Bitcoins to begin with.  If they fork the Bitcoin chain with the name "Bitcoin Gold" they can basically ride the coattails of Bitcoin and possibly create an altcoin with significant value (making money out of nothing).  This is nothing short of fraud, and anybody who ends up buying "Bitcoin Gold" coins is essentially just giving them free money.


Consensus roles for op_return What is the validation rule, not policy, for op_return? What is the maximum length of the data that can be attached? Is it 514 bytes? As if the maximum script size was 520 bytes -1 byte for the instruction itself and -3 bytes for push instruction? Also is it possible to have more instructions after op_return, not just one push?

Each scriptPubKey is limited to 10000 bytes.
Each individual push in a scriptPubKey is limited to 520 bytes.
Transactions are limited by the block weight limit.


Testnet3 app will not sync to peers I was just trying to connect testnet3 to my own testnet node through the "trusted peer" and "skip regular peers" settings, but it seems that in this way it cannot connect to a trusted peer which runs 0.21.0.
I tested several 0.21.0 nodes and it does not connect to any of them. However, it does connect to a trusted peer which is 0.17.0, for example. Also, with default settings (no trusted node) it displays some 0.21.0 nodes in the peers list, not sure why.
Did anyone notice this and managed to find a workaround? Thank you.

I was able to connect one of my node with other (both v0.21.0)

I copied the IP address from local address returned in getnetworkinfo
Used it in bitcoin.conf of other node in below format:
testnet=1
test.addnode=IP


Alternative to the move command? As you know, account commands are deprecated in the future. In the same wallet, how do we carry other address bitcoins in one address ?

You can't, even with accounts. Bitcoin is not transferred between addresses when using the move command. It does not magically transfer Bitcoin from one address to another when you use move. The only way to do that is to make a Bitcoin transaction. All that move did was it changed which account an address was associated with. Nothing was actually moved, just a wallet internal database entry was changed.


Will there be a hard-fork with BTC and B2X? Will there be a hard-fork between B2X and BTC?
How can we know for sure?
When will it occur?

Thank you!

David

Will there be a hard-fork between B2X and BTC?

Yes, most likely, although it's hard to know for sure. There seems to be enough people who want the 2x fork that it will happen, and there definitely are people who will continue running Bitcoin Core (which is the form of the bitcoin protocol that will stay with the current block size), which will create two separate chains. There is a really good debate on this fork that took place recently that you can watch here

  How can we know for sure?
  When will it occur?

We will know for sure once we get to block 494,784 which is when the fork is scheduled to happen (sometime around Nov 16). You can view the current block number (usually referred to as "block height") over at blockchain.info. Watch for news around that time about what is happening. Coindesk is a good resource for that.


Why is the field 'hash' necessary in a bitcoin transaction? Using bitcoin-cli decoderawtransaction I see results like...

{
  "txid": "d2183b3ea763f41a30ec5ba6fbf6e5f32e0ca6a5e8761249c533fe22190f71f1",
  "hash": "d2183b3ea763f41a30ec5ba6fbf6e5f32e0ca6a5e8761249c533fe22190f71f1",
  "version": 2,
  "size": 225,
  "vsize": 225,
   etc...

Why is the "hash" field necessary if the txid field is already a hash? (more specifically a double-pass through SHA-256 of the transaction's data)

I'm noticing in some transactions that txid and hash are equal, but in others they're not.  Appreciate any explanation on the difference since I'm struggling to figure it out through Google and the source code comments.

Note that Bitcoin transactions don't actually contain the txid or hash within them. This is only part of the decoding output from Bitcoin Core.

The hash is there because of segwit. Segwit specifies that witness data for a segwit input (i.e. signatures, scripts) are not part of the txid. Those are in a separate area in the transaction. You can see this information decoded in the txinwitness field. So the hash is over the entire transaction, including this witness data, but the txid is not. Since transactions that do not have any segwit inputs do not have witness fields for their inputs, the txid and hash are the same.


What happened with MtGox on 2011/9/12? On that date, some erratic out-of-spread trades appeared on MtGox.

The explanation given says that accounts may have been compromised by the CosbyCoin attack on bitcointalk.org. I do not understand how this can lead to out-of-spread orders being executed.

He says the issue is resolved and proceeds to give us a speech about password security and says that we should keep trading "in confidence".

That does not satisfy me at all.

Some more info by upb from #mtgox:

 so there IS some underlying bug which was triggered that caused invalid order matching
<@MagicalTux> yes, but it requires a large amount of funds to be triggered
<@MagicalTux> normal users, unless millionaire, wouldn't trigger it
< upb> must be some kind of integer overflow ;-)
<@MagicalTux> it happens when an order executes way too many orders at once
<@MagicalTux> I'm adding some code to avoid this from happening, but nobody in their right mind would do that

This actually reminded me of about 2-3 Weeks ago when I noticed a bug and reported it on #mtgox.

The bug worked as follows:

I had a buy order at, let's say 1 BTC for USD 10.0, last trade was 10.001
someone partly filled that order, let's say he filled 0.3 BTC
this had the effect of my order being in state "pending" with 0.7 BTC for USD 10.0
while my order was pending, a lower order (say at USD 9.99) was filled

I complained and a short while after, MagicalTux said he found the problem and fixed it.

I don't know if this could have anything to do with the current problem, but "it happens when an order executes way too many orders at once" sound kind of like this could be the case.

I also remember someone suggesting this above bug could be exploited to disable a lot of orders in order to "get to" an order that would normally be well out of spread. Maybe someone managed to pull off this exploit. That would also match MagicalTux saying something about 2000 accounts being created. Maybe these accounts were used to "disable" orders by filling a small part of them successively in order to execute an order well out of spread.


Wallet balance showing as unconfirmed - SOLVED! I'm using MultiBit and my wallet balance is showing as unconfirmed. The last transaction I made was a couple of months ago and seemed to be fine (https://blockchain.info/tx-index/25339607f1d5e3f36cd964554fd85c399c9359e58b169d6b7028b3627ef74f12).

When I try to make a payment with the unconfirmed funds I'm told "The error was insufficient money, missing XXX satoshis..."

I can see the correct balance in MultiBit but it is unconfirmed. The confirmed balance appears to be Zero. Any insight on what might have happened here or how I can fix it? I should say that I'm synced to the network and have 10 peers showing. Thanks for any help

My problem was easily solved, I simply had to Repair Wallet - an option in the Manage Wallet sidebar choice. All fixed!


How to get bitcoin bip32 public key from private key? I need to know how to get the corresponding public key of a private key in hd-wallets, I don't need the derived ones but the public key who is related to the private I got. If there is an algorithm using python it will be very helpful but also the formula will be good as well.
thank you.

I need to know how to get the corresponding public key of a private key in hd-wallets, I don't need the derived ones but the public key who is related to the private I got.

A private key derived using the BIP32 hierarchical derivation is similar to any other one and the corresponding public key is obtained by "multiplying" your private by G, as for any other private key.
You want to use a specific crypto library for this operation, and I believe coincurve to be a good maintained Python binding to libsecp.
You can also use python-bip32 to simplify your use of BIP32 derived keys (relies on coincurve under the hood).


What is the easiest way to check what was the balance of address X at block Y? (without 3rd party services) I need to have a possibility to check balance on every address. So far I tried used getreceivedbyaddress, but as far as I understand with this command I can check only addresses which I have in my wallet, right?

I also found information, that to have a possibility to analyze transactions of others I need to set txindex=1 in my bitcoin bitcoin.conf file. I read that this will help me with getrawtransaction which will be able to get me details about any transaction. Does txindex=1 will also help with getreceivedbyaddress?

and last, but not least... how to check balance of particular address in the past? Can I use getreceivedbyaddress <address> 100000 where 100000  would be amount of required confirmations, so I would check 100000 blocks in the past?

As you have rightly mentioned getreceivedbyaddress does not return a value for non node addresses, i.e. the addresses which are not in your nodes wallet.

txindex=1 in the configuration file followed by restarting bitcoind with -reindex parameter creates indexes for all the txs so that you can open them up with getrawtransaction and check the details inside the transaction.

The only way you can check for the addresses balance at any given block is to crawl all the blocks before the block under consideration and check each transaction's vout whether it contains the address under consideration. Also you will have to check whether any of the vouts you just went through have not been spent which would decrease the balance accordingly.


Creation and Distribution of a New Block Given that a block is collection of transactions that a miner can accumulate in 10 minutes, could it not be the case that every miner gets to work on one's own block? Delays in the network imply that miner A could have collected only 20 transactions in the time Miner B is able to collect 100 transactions. Questions:

Does this imply that every miner could be working an different
block to add to the chain? Or, are they all working on the same
block in a given 10min interval?
What about adding a newly mined block to the local copies of all
other participants? If there is not explicit synchronization between
all the participants, some participants (miners) could be working on
a stale copy of the blockchain in which the latest transaction has
not posted yet. How is this prevented?

Related question: When miners are working on their block, does everybody's block have the same transactions in them?

Does this imply that every miner could be working an different block to add to the chain? Or, are they all working on the same block in a given 10min interval?

Each miner is 'working on a different block', in that any valid block they find will be unique (if another miner simultaneously finds a valid block at the same blockheight, it will have a different hash). The miners can add whatever transactions they'd like to the block, and even if all the transactions are the same, the blocks will still be unique (because other variables will be different, such as the payout address for the coinbase transaction).

  What about adding a newly mined block to the local copies of all other participants? If there is not explicit synchronization between all the participants, some participants (miners) could be working on a stale copy of the blockchain in which the latest transaction has not posted yet. How is this prevented?

Miners broadcast the blocks they find to the network, and everyone updates their copy of the blockchain. The system incentivizes everyone to start working on the next block immediately, since mining on a stale block is wasted work. As a miner, you would want to ensure you have very good network connectivity, so that you hear about new blocks as soon as possible.

The network has been optimized for low latency, see for example the FIBRE relay network. So in practice miners are able to work efficiently, we can see proof of this by the fact that orphan blocks are becoming more rare.


The value of Quarkcoin knowing that big amount was preminted Few hours ago I was looking at bitcoin.stackexchange and found a question about quarkcoin. I was curious to know what is this. Reading a little bit I have found that it does not provide anything new except of:

combining a lot of cryptofunctions in a big ball of mud and calling it super secure
quick block generation 30 secs
more coins to mint
Total of 247 million QRK will be mined in ~ 6 months, after that ~ 1 million QRK p.a. (~ 0.5% p.a inflation)
other small tweaks

And from wiki page it is written:

  Of the 247 million QRK the developers own roughly 85-90% of them.

I am just curious what value does it bring to the table and why someone would like to mint it, if it sounds like it was created just for developers to dump it for some other crypto.

It really depends on what happens to that original 85%-90%. If the developers really own that large an amount, they will always be able to corner the market if they work together.

That idea troubles me, but I still buy Quarks because I see the value in the multiple hashing algorithms.

I think perhaps 85%-90% is quite clever as it puts Quarks on the map a lot quicker. Right? I think this has helped them gain press attention to their increased security meassures, by becoming the 5th largest crypto-currency available. I'm thinking that's an effect of generating so much currency so quickly.

I would expect value to continue to come into Quark, especially after Bill Still and Max Keiser talk about it on the 19th, then again as the new financial year starts around the world and everyone has another panic attack about the state of the world economy.

My point is, after the value has increased for a while and flattened out (if it does), I would expect Quarks to be used as currency earlier than Bitcoin. If quarks go to a dollar in 2014, then that's a lot of currency already out there, and it's not so expensive for people to invest, and not such a big deal when you spend a Quark.

The original holders of that 80%-90% would be more insentivized to spend that currency into the market than if they held Bitcoin (assuming it does not rise too fast).

One thing I really want to know, is how people arrive at the idea that the "the developers" own that much, and how they 80%-90% figure is arrived at. Are they meaning 3 developers, or do they mean 100 developers, 1000? It makes a big difference.

I guess we will have to wait and see if those original developers will put their Quarks where they mouths are and spend enough Quarks into the market on real goods and services, that they begin to circulate and become useful to everyone as a currency.

The way I see it, and I may be crazy, but those original developers would do themselves a huge favor if they got together and re-distributed a good portion of their monopoly as a PR exercise.

It would say a lot. And it would do a lot for Quarks as a currency to have a smooth distribution across the market.


What happens to unclaimed Open Assets (colored coins) asset quantity units? I'm trying to understand the Open Assets transaction example given here.

Everything makes sense, more or less, until the end of the description:

  Output 6 receives the first 3 units of input 5. Input 5 has the asset ID A2 so the asset ID A2 is assigned to output 6.

What happens to the remaining 6 units of Asset A2? The unit count starts at 9 for input 5, and output 6 claims 3 units. That leaves 6 units unaccounted for. Input 5 is spent after this transaction, so it's not clear how it can be reclaimed.

What am I missing?

I had the exact same question when reading over that specification document. I'm not sure if that is a mistake in the example, but the conclusion I reached is that the colored coins are destroyed.

I tested this with the Python Open assets library and the transaction that claimed less than the full possible number of assets was still a valid colored coins transaction.

So, unlike normal coins where the 'leftovers' are given to the miners, unclaimed open assets are destroyed.


What Bitcoin profitability calculators account for taxation on miner income? If I were to run a miner, I want to be ethical and pay all relevant income tax and gain all required licensing, etc for my country.

My miner income is probably taxed at a 1099 income rate or lower, but to be less region-specific, a calculator could potentially account for hardware (and other) costs and also allow the user to specify tax rates.

What profitability calculators take this into account?

None do now and none likely will anytime soon.

This will vary per-tax jurisdiction and per individual circumstances because income taxes are based on profit not on revenue.

This is the very first inquiry I've seen where this feature has been requested, incidentally.


from b58check to hex and back I am manipulating (with pybitcointools) some regular addresses as well as some P2SH and stumbled upon the following:

Case 1:

>>> b58check_to_hex('17rq8m5SW8XoZ9dHEkQyBfc5w2XQnQvznz')
'4b3d51202139ff109f6d10b637081f2de48d4b35'
>>> hex_to_b58check('4b3d51202139ff109f6d10b637081f2de48d4b35')
'17rq8m5SW8XoZ9dHEkQyBfc5w2XQnQvznz'

second command is the inverse mapping of the first one

Case 2:

>>> b58check_to_hex('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
'6ad55439d8faab476bbc0f89183ce689f8f6985b'
>>> hex_to_b58check('6ad55439d8faab476bbc0f89183ce689f8f6985b')
'1AjtBhDNMGVxfLJoRzPrjAo3DPEMps6xEd'

second command is NOT the inverse mapping of the first one

This surprises me a lot. Can someone give me some hints as to why this is the case please?

Thank you

The second case is a P2SH address. You must supply the version number/magic byte for the address, which is 5 for P2SH.

>>> bitcoin.b58check_to_hex('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
'6ad55439d8faab476bbc0f89183ce689f8f6985b'
>>> bitcoin.hex_to_b58check('6ad55439d8faab476bbc0f89183ce689f8f6985b', magicbyte=5)
'3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f'

To figure out what the magic byte of an address is, use this:

>>> bitcoin.get_version_byte('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
5


BIP deterministic seeds, number of words and compatible wallets I like to have a list of Bitcoin wallets that accepts various types of deterministic seeds. I have read that some seeds can not be imported in e.g. Electrum of other.
So a list with following columns would be ideal for me:
BIP type | word count | compatible wallets

Can someone assist me here please?

AFAIK, the two most common sets of HD wallet mnemonic seeds used are BIP 39 compliant or Electrum Wallet compliant.  Most of the more secure hardware HD wallet devices support the BIP 39 standard, which appears to be deprecating the older set of Electrum HD seed words. People should not have to do a deep dive into Electrum Python code to find the list of wallet mnemonic seeds. The old Armory paper mnemonics backups are too difficult for non-technologists to utilize, and should be treated as deprecated.

With the BIP 44 standard being defined across a plethora of altcoins, and HD hardware wallet vendors supporting BIP 39, I'm thinking the prevalence or days of using Electrum mnemonic seeds will be numbered.

For whatever reason, Monero cryptocurrency choose to use Electrum seeds, and yet also SLIP 44 registered their altcoin. This confuses wallet developers needing to support Monero while ensuring customer wallet portability across different implementations. End users will demand the simplicity of using one set of mnemonic words to reconstitute their wallets across multiple cryptocurrencies, not two. This means the reference offline JavaScript available at probably needs a redo.


Why do testnet blocks have future timestamp? I am playing experiments with testnet blockchain, and it seems like the best block is always set about 2 hours into the future.

For example, now, the block has timestamp 90 minutes into the future. I am not linking the block itself since it will be quickly outdated anyway, but you can look at https://testnet.blockexplorer.com and the newest block will always be into the future.

How is that possible? Shoudln't the network check the timestamps, if they are sensible? Also, if anyone can fake the timestamps, do they have any reason to exist at all?

This extends both to mainnet and testnet; however, I haven't seen it happen on mainnet. Why?

Testnet is frequently attacked, abused, due to the complete lack of value and proof of work. A piece of code which is intended to allow a difficulty 1 block is none has been found in 20 minutes also enables a person to "warp" forward and mine multiple in a row. If this is exploited over the difficulty adjustment, the entire chain difficulty is reset to difficulty 1.

The result is that it is trivial to make forks hundreds of thousands of blocks long, with insane timestamps that only vaguely match reality within the consensus rules. They're never going to make a lot of sense as a result. This doesn't happen on mainnet because the difficulty reset code doesn't exist there.


What exactly are Bitcoins? I've heard the term several times. I know that it's an online currency, but I'd like to know more, without having to search too hard.

My main questions:

What can bitcoins be used for?
Where does one acquire bitcoins?
When were they first created?

What exactly are Bitcoins?

bitcoins are the right and possiblility to write some data (transaction) to some database (blockchain) passing this right to another person.

  What can bitcoins be used for?

What can gold be used for? Trading/exchanging for all other things

  Where does one acquire bitcoins?

Where does one acquire gold? Either buy it, or mine it, or steal it, or find it

  When were they first created?

When gold was first created? Dumb question. Just think that it exists today


Doesn't an Oracle go against the Blockchain principles? From what I understand of the blockchain, the main motivation, the very foundation of this technology, is the search for peer-to-peer exchange without mutual trust, without a trusted third party, so trustless exchanges.

However, the purpose of an Oracle is to provide an external data that is invertible. It is therefore necessary to have confidence in this oracle, while it can provide false data (voluntarily knowing that it can be beneficial or not by simple measurement error (for an IoT sensor) / algorithm error / human error...).

In this context, does an oracle not go against the previous principle? Where are there ways to get trustless Oracles?

Thank you all.

The use of an Oracle does somewhat go against the founding principle of transacting without the need for a trusted third party.

As Nakamoto's whitepaper states:

  What is needed is an electronic payment system based on cryptographic proof instead of trust,
  allowing any two willing parties to transact directly with each other without the need for a trusted
  third party.

Of course the majority of transactions do not need trusted third parties such as oracles or escrow agents. But for those that do, trust is a key issue.

Other people have suggested trust minimisation strategies that can be used with oracles.

  multiple independent oracles
  trusted hardware
  Amazon AWS oracles


How to create multi-user bitcoin wallet using UTXO? We are developing bitcoin wallet for multi-user. We are using Bitcoin core as Bitcoin wallet. Bitcoin core is generating random address. we cannot show balance because After one transaction rest of user's balance goes to a new address. so we can not show the real balance of any user? But we can not use old accounting system. How to create multi-user bitcoin wallet using UTXO and show user address balance.

I'm assuming that you're using a fully custodial setup. You need to implement logic to keep track of their balances in a database. Hereby, you give each new user a new deposit address and keep track whom you have shown which addresses. When you receive funds, you credit the corresponding user in your database. When they withdraw, you deduct from their balance. Hereby, you need to consider the confirmation status and transaction fees of the corresponding transactions.

To be honest, if you're having trouble mapping individual user balances to your customers, it worries me that you are aiming to manage funds for others.
You should perhaps consider relying on a third party service to manage the funds of your business for you. However, even then you'll need to implement the basic business logic yourself.


How do you determine 'magic byte' or version for alt coins? I'm looking at creating a deterministic wallet for some of the less popular altcoins. Bitcoin has a magic byte of '0488b21e' and litecoin '019da462'. How are these determined or calculated? Also how would I generate these values for other altcoins?

0x0488B21E is the extended public key prefix / version bytes (as described in BIP32) and stands for xpub. In the same manner, 0x019DA462 stands for Ltub.

For bitcoin and litecoin these codes are:

Network             Extended private    Version bytes        Extended public    Version bytes
                    key prefix                               key prefix
---------------------------------------------------------------------------------------------
Bitcoin main        xprv                0x0488ADE4           xpub               0x0488B21E
Bitcoin testnet     tprv                0x04358394           tpub               0x043587CF
Litecoin main       Ltpv                0x019D9CFE           Ltub               0x019DA462
Litecoin testnet    ttpv                0x0436EF7D           ttub               0x0436F6E1


Bitcoind block chain structure I am trying to understand the structure of the underlying block chain stored in the core implementation (or rather just the BLK files used by a fullnode). My question is ; does the block chain store the complete tree structure , i.e all the forks which were encountered? Or does it purge the entries once a fork is resolved.

If i were to read the blk files sequentially , can i assume that every single block read is correctly ordered and no forks are present?

Thanks!

the BLK files are not an API. You shouldn't directly read those files.
What you should do is requesting the headers/block via the JSON RPC interface (or the REST interface).

You can get the genesis block hash via:

bitcoin-cli getblockhash 0

Then you can get a block (without transactions):

bitcoin-cli getblock <hash>

Then get the next block by looking at the nextblockhash item in the block JSON response, etc.

Also, consider using the REST interface. There you can get binary responses which are much faster (no JSON encoding/decoding overhead).


Why doesn't the Bitcoin-qt client ask for the Wallet passphrase upon startup? I've just encrypted my wallet.dat file using the "Settings -> Encrypt Wallet" menu option.

I then closed the client and re-opened it.

I was expecting to be prompted to put in the wallet password once I reopened the client.

I was asked for no password. I don't understand, what is the point of my having set up a wallet password if I can just use it without unlocking?

When you encrypt the wallet, only the private keys are actually being encrypted. You will be prompted to enter your encryption passphrase when the private keys are needed.

Public keys in the keypool, transaction information, and other metadata remain unencrypted because they are either public information or have no effect on the security of your Bitcoin. This means that you will be able to get new addresses (they come from precomputed public keys in the keypool) and receive transactions. It is only when you try to spend any of your Bitcoin or when the keypool runs out that you will need to enter your passphrase.

It is actually safer to prompt for the passphrase when needed because then the actually important things that are encrypted (i.e. the private keys) are unencrypted in memory for as little time as possible. This reduces the risk of them being exposed.


How do transaction fees exacerbate instability in Bitcoin in the future? I came across the paper On the Instability of Bitcoin Without the Block Reward where it says that in the near future where the incentives are only due to the transactions, instability issues will appear.  With only transaction fees, the variance of the miner reward is very high due to the randomness of the block arrival time, and it becomes attractive to fork a “wealthy” block to “steal” the rewards therein.

I tried to read the paper, however I could not understand the exact reason for the instability. So, what is the simple idea that rewards only composed from transaction fees will result in instability that does not appear while there still is a block subsidy?

As Nick answered quite adequately:

After subsidy has diminished sufficiently as soon as a block is mined that clears out the mempool there will be no income for a miner that mines a successor block, but full income if they successfully remine the prior block. Even once more transactions show up, it will continue to be more profitable to remine the last block for some time especially since they can also take the new transactions that show up.

I wanted to also offer an answer to talk about some of what we've been doing about it.

This issue has been known about in the Bitcoin community for a long time, we've normally discussed it under the name "fee sniping"-- and it was one of the points I raised in my first post in the modern blocksize debate.

Already implemented in Bitcoin Core and some other wallets is a anti-fee-sniping technique where wallets nlocktime their newly created transactions to the current block height. The effect of this is that a sniping miner can take the transactions in the prior block, but not newly arriving ones.  This makes the incentive to go forward build faster. Future enhancements to this move could might be to set the locktime further in the future when the user authors a transaction which has a feerate below the next block worth of transactions, or just don't care about confirmation speed.

The primary response, which is why it came up in a post about the block size, is that the blocksize limit helps tremendously: If there is a consistent backlog there is still a drop of income immediately after a block but it is much less significant.  The paper doesn't really consider this case, basically dismissing it, and noting that fees are not isotropic. They aren't but they don't need to be to substantially diminish instability and even today we find that when the network isn't under-loaded the backlog appears to be enough to produce stability.
(Red: Block template fees immediately before a block was found, green is immediately after)

Finally, it has been proposed that if/when the network is hardforked the rules be adjusted so that coinbase transactions can spend immature coinbase outputs. Among other things, this would allow miners to pay forward excess fees to encourage other miners to confirm their blocks.  Analysis of the strategies seems to suggest that there is no stable equilibrium when there is no block size limit or back-log,  but it seems likely that there is with a limit (e.g. pay forward the difference between your candidate block and a hypothetical double-size alternative, down scaled by your opponents odds of successfully getting two blocks in a row). But this is an open area for research.

Unfortunately the paper you cite just considers perpetual inflation to be the solution and doesn't consider it too carefully. It even advocates Ethereum which at most has an inflation rate which asymptotically tends to zero (meaning even if inflation rescues them from this issue now, it will eventually do so no longer)-- and thats even if it goes that far: It is my understanding that the Ethereum Foundation has recently stated an intent to lower the inflation rate to combat the price falling.


How are paths found in Lightning Network? I understand now how multihop payments can work in LN, but how do we discover payment paths in Lightning Network in the first place?  Obviously you'd need to take into account the available capacity of the route, and you'd want to discover the cheapest path.

There shouldn't be a payment channel directory, so would it rely on a peer-based search?

Note: This answer was written in Spring 2016 and has since been overtaken by an actual spec and multiple implementations. I'm hoping to update this answer shortly.

Summarizing mostly from r/bitcoin: How are paths found in Lightning Network?, the currently suggested routing would be similar to the Border Gateway Protocol.

At intervals, the following process is initiated:

A beacon node B is selected via a pseudo-random process.
Neighbors of B broadcast their shortest route to B to their neighbors.
The neighbors of neighbors of B now become aware of a route to B and in turn broadcast their shortest route to B.
This cascades through the network until every reachable node has broadcasted their shortest route to the beacon node B.
Whenever a node becomes aware of a new shorter route, it broadcasts this updated shortest route as well.
After a short wait, start from top with a new beacon node B1.

Nodes remember their shortest routes to a number of previously selected beacon node.

Now, Alice wants to send 0.3BTC to Bob.
Alice has shortest routes to B, B1, and B2. Bob just came online and only knows B2. They add together their respective paths to B2 and thus find a path:

     Alice → N1 → N2 → B2 ← N3 ← Bob

If they have multiple common beacons, they can also compare different paths, and check whether any earlier nodes in their routes match. If they instead had found:

     Alice → N1 → N2 → B2 ← N2 ← Bob

They could shorten the route to:

     Alice → N1 → N2 ← Bob

Altogether, "shortest" would be some combination of reachable, sufficient liquidity, lowest fee, fewest hops, and most reliable. As Hash Time Lock Contracts are nearly trustless (only potentially locking your money for some time), and operating a routing wallet should have low resource requirements, it seems likely that the payment routing market should achieve a healthy competition, therefore discouraging nodes to lock money by establishing channels just to earn fees from routing. Payment channels between nodes that have some form of regular business relationship seem more likely as there is an immediate benefit.

Sources: harda, mmeijeri, mmeijeri.


What is the purpose of addr_from and addr_recv in version message? I understand from this answer the semantics of addr_from and addr_recv. It is not clear to me though what is their purpose. Don't we assume that the transport layer protocol takes care of, well, transport?

What happens if I send a version message where the information addr_from or addr_recv is missing or incorrect? E.g., in this answer the example code includes the following:

addr_recv = struct.pack("Q", 0)
addr_recv += struct.pack(">16s", "127.0.0.1")
addr_recv += struct.pack(">H", 8333)
addr_from = struct.pack("Q", 0)
addr_from += struct.pack(">16s", "127.0.0.1")
addr_from += struct.pack(">H", 8333)

If that works, why include anything meaningful in those fields?

Answered in this comment:

  Bitcoin Core actually ignores addr_from in received version
  messages. addr_recv is used to influence the heuristic that
  determines which of the receiving node's IP addresses is publicly
  reachable.


Developers, programmers new to bitcoin engineering ecosystem Any sites, forums dedicated  to developers new to bitcoin.
Any recommended git repo, site that shows how to interact with a node, do .i.e. p2sh,p2pkh on testnet.

Any sites, forums dedicated to developers new to bitcoin

https://bitcoin.stackexchange.com
And if you your question is closed here then, https://reddit.com/r/bitcoin
IRC: #bitcoin-core-pr-reviews IRC channel on freenode
Slack: https://bitcoincore.slack.com, https://lightningdevkit.slack.com, https://lightningcommunity.slack.com and https://suredbits.slack.com
Follow bitcoin devs on Twitter
Sometimes you find or discuss interesting things on different GitHub repositories as well like https://github.com/bitcoin/bitcoin

Any recommended git repo, site that shows how to interact with a node, do .i.e. p2sh,p2pkh on testnet.

https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line


Instant confirmations with pre-published, locked, transactions (Clarification: This is not an attempt to solve the problem of a vendor taking the money and running without handing over the merchandise.  Problems like that can't be solved without some third party.  The purpose here is for A to give bitcoin to B, where B can be instantly certain that he has access to the bitcoin.)

I have an idea that depends on the Script system in Bitcoin, but maybe I'm asking too much.  It would allow for instant confirmations between parties who arrange a negotiation a few hours in advance.  I don't know very much about Script though.  Is the following scheme possible?  Would extensions to the Script be required?

Person A and Person B are going to meet in a few hours for a business deal.  If all goes well, they hope to shake hands and A will want to instantly send some BTC to B.

In advance, A publishes a transaction that sends the money to B.  By the time the meeting occurs it will have received enough confirmations.  But this won't be a normal transaction.  It should include some further conditions:

First, the transaction should include a hash, such that the transaction won't complete unless a document is produced which has that hash.

When they shake hands, A can instantly show that document to B and B can verify that the document produces the correct hash.  B can then be confident that the transaction will be processed fully later when he produces the document.

There is no double-spending problem here.  The output of the special transaction has already been locked to send to B, it cannot be sent anywhere else.

We need a way to rollback this if A and B do not reach agreement.  Can Script allow a transaction to be cancelled if its outputs are not used a specified timeframe?  I guess not.  (Partially cancelled, the transaction fee should remain valid.)

Another approach to this rollback is for the special transaction to also include a special output which sends all the money back to another of A's address.  But this should have some sort of time lock on it, such that it isn't allowed to happen until a suitable delay, 24 hours, has occured.  Is it possible for the outputs to be double the total inputs in a case like this, where maybe we can prove that only one output can be claimed?  (I envisage having non-overlapping timelocks on both transactions in order.)

This is a solved problem, see https://bitcointalk.org/index.php?topic=25786.0 and this.

It has also been recently implemented in BitcoinJ, and called "Micropayment channels".


bitcoin-qt and ubuntu 18.10 bitcoin-qt worked well on Ubuntu 18.04, after the upgrade to 18.10 it won't start anymore. Can't find any hints in log-files.
Help appreciated!
kr Heinz

This may be connected to the fact that Berkeley DB can't be built on Ubuntu 18.10:

Can’t build Berkley database on ubuntu 18.10. During call to make install getting error: definition of ‘int __atomic_compare_exchange(db_atomic_t*, atomic_value_t, atomic_value_t)’ ambiguates built-in declaration ‘bool __atomic_compare_exchange(long unsigned int, volatile void*, void*, void*, int, int)’


Bitcoin MultiSig balance not showing under listaccounts I added 2-2 MultiSig address into wallet via bitcoin cli (Testnet)

  addmultisigaddress  <'["key","key"]'> [account]

1 key of current wallet and other public key from different node wallet.

Account is showing

  0.000000

Although more than six confirmations on the transaction: https://live.blockcypher.com/btc-testnet/tx/297b6f6c14486e9eda1b2a04e20e3bd161758afeafa7d4b0109fa7fca11154ae/

Most importantly listaccounts not listing the account associated with the MultiSig address.

getaddressesbyaccount [MultiSigAccount] shows the MultiSig address created above.

How can I get the balance of MultiSig address via bitcoin-cli?

Edit 1:

What does this command return: $ bitcoin-cli -testnet validateaddress <your-multisig-address>?

{
  "isvalid": true,
  "address": "2Mv4iYeyQtVV1M7rqzgUc68QzQ21vy1o36Z",
  "scriptPubKey": "a9141eeba411eae41a1a3dc7456ec4d599aef84afd7687",
  "ismine": false,
  "iswatchonly": true,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_scripthash",
  "hex": "00206e908e1cca44b136fbf666f356114ca6a84c1fbed0327a155c204580310a7a11",
  "embedded": {
    "isscript": true,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "6e908e1cca44b136fbf666f356114ca6a84c1fbed0327a155c204580310a7a11",
    "script": "multisig",
    "hex": "52210240d4ae4819e35e346560efe665f79453210a0b26184e08705964c5eb89e885ca2103fcc7e4690f7bd3a51db7ed438ef9a7ffb0bf316467f39b384935befee4eb208552ae",
    "sigsrequired": 2,
    "pubkeys": [
      "0240d4ae4819e35e346560efe665f79453210a0b26184e08705964c5eb89e885ca",
      "03fcc7e4690f7bd3a51db7ed438ef9a7ffb0bf316467f39b384935befee4eb2085"
    ],
    "address": "tb1qd6ggu8x2gjcnd7lkvme4vy2v565yc8a76qe8592uypzcqvg20ggslwnwl8",
    "scriptPubKey": "00206e908e1cca44b136fbf666f356114ca6a84c1fbed0327a155c204580310a7a11"
  },
  "addresses": [
    "tb1qd6ggu8x2gjcnd7lkvme4vy2v565yc8a76qe8592uypzcqvg20ggslwnwl8"
  ],
  "account": "multisig22",
  "timestamp": 0
}

The documentation on addmultisigaddress states:

  This functionality is only intended for use with non-watchonly
  addresses. See importaddress for watchonly p2sh address support.

Since the wallet does not have both private keys, it won't show a balance unless you use importaddress. Note the ismine: false property in validateaddress, that means your wallet doesn't have ability to spend (doesn't have private keys).

addmultisigaddress nrequired ["key",...] ( "account" "address_type" )

Add a nrequired-to-sign multisignature address to the wallet. Requires
a new wallet backup. Each key is a Bitcoin address or hex-encoded
public key. This functionality is only intended for use with
non-watchonly addresses. See `importaddress` for watchonly p2sh
address support. If 'account' is specified (DEPRECATED), assign
address to that account.

To watch a multisig address (get it's balance), you should use importaddress:

importaddress "address" ( "label" rescan p2sh )

Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.

Arguments:
1. "script"           (string, required) The hex-encoded script (or address)
2. "label"            (string, optional, default="") An optional label
3. rescan               (boolean, optional, default=true) Rescan the wallet for transactions
4. p2sh                 (boolean, optional, default=false) Add the P2SH version of the script as well

Note: This call can take minutes to complete if rescan is true, during that time, other rpc calls may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes. If you have the full public key, you should call importpubkey instead of this.

Note: If you import a non-standard raw script in hex form, outputs sending to it will be treated as change, and not show up in many RPCs.

Examples:

Import a script with rescan
> bitcoin-cli importaddress "myscript"

Import using a label without rescan
> bitcoin-cli importaddress "myscript" "testing" false

As a JSON-RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importaddress", "params": ["myscript", "testing", false] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/