Why do I get: Error:
has no matching Script

The example code for psbt.addOutput() with address ‘1KRMKfeZcmosxALVYESdPNez1AP1mEtywp’ works as expected. But if I change this to an testnet address I get this error: ‘ has no matching script’. I expect I need to specify testnet somewhere, but do not know where.

    const psbt = new bitcoin.Psbt();
    psbt.addInput({
        hash: 'b881ecef041a7396f3c225644507955732ae98d4a736de7b9ac235c69e1eb182',  
        nonWitnessUtxo: Buffer.from(
        '020000000001012aa24043833303b066cf10...1a1800',
        'hex',
       ),

    });

    psbt.addOutput({
      //address: '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp', <- works
      address: 'mhm89vYkAjmU3MWUtyCUcsYYUvkgXT1FAw',
      value: 7240446,     //was 7250446

    });

Why is getdescriptorinfo returning an error “Invalid descriptor (code -5)”

I am using Bitcoin Core bitcoin-cli with getdescriptorinfo like so:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdescriptorinfo", "params":["sh(multi(2,[3c60330a/1]03061b79f20d49790c15bdaf15ec8db6d75275f62f04a56eaac31f5c2db48736fc,[d54e4481/1]0396bd8d30f0128dcc67e143cf46efd686bf9e4dc8587facc07f81bb248d1b0209,[1e132a06/1]03c77aa842edc8af76b76f5c29a1133b45b78c8c26a170090184e500232abd15a4))#3qpdv9la"] }' -H 'content-type: text/plain;' http://bitcoin:password@127.0.0.1:18332/

But it returns Invalid descriptor (code -5)

What am I doing wrong?

What is the formula for inferring hash rate from difficulty and block frequency?

Two parts to this question

1/ There have recently been concerns over drops in hash rate observed on sites such as blockchain.com.

However, my understanding is that hash rate is inferred from the difficulty level and the block intervals.

I am trying to work out the exact formula for the inference of hash rate.

I know that the average time we can expect to find a block in is calculated with the following formula:

average time to find a block = (difficulty * 32 ** 2)/ hash rate

Would that mean that hash rate is inferred with the following formula?

hash rate = (difficulty * 32 ** 2)/ time interval between the last two blocks

2/ I mainly want the first part answered but if you are feeling rosy today, an answer to this second part would be amazing.

Block times are Poisson distributed. I understand that this allows us to calculate the probability that block times increase to such an extent over the course of a day that it infers a 40% reduction in hash rate.

Does anyone know the exact calculation which would let us calculate this probability?

Here’s some rough ideas I have about the calculation:

The following formula allows us to calculate the probability that k events take place in time period t.

P(k in t) = (e ** -lam)*(lam**k / k!)
where lam = (average events which can be expected to be observed per unit of time * t)

The average events which can be expected to be observed in the case of block intervals is 1 block per ten minutes so 1/10

Let’s say we have hash rate dropping 50% over the course of one day, would that imply that we are observing 288 blocks over the course of 1440 minutes?

If I am thinking about this in the correct way, this would mean the calculation is as follows:

P(288 blocks in 1440 minutes) = (e ** -(144)*((144**288)/288!)

Not sure if this calculation is correct. But to take it further, this would calculate the small probability of exactly 288 blocks being found in 1440 minutes. But if it were possible to calculate the Poisson distribution of block intervals, we may be able to find the probability of finding greater than or equal to 288 blocks in 1440 minutes.

As you can probably tell, my understanding of the second part of the question is limited so if you have an answer to even just the fist part, that would be amazing!

Bus error (core dumped)

Running a new install of Ubuntu 18.04.3 LTS and downloading blocks in bitcoin-qt up to over 70% when pgm quits with “Bus error (core dumped)”.

Anyone else gets this or how to fix it? (-rescan didn’t help)

Thanks.

Was libbitcoin a part of bitcoin core in the past?

I am trying to use c++ code from the book of Antonopoulos for some time now and I seem to lack an include named bitcoin/bitcoin.hpp.

To compile the code the g++ compiler gets a pkg-config input with libbitcoin. So I suspect I would have to install this library.

Since the book does not mention to install anything else then bitcoin core I really wonder if parts of libbitcoin have originally been part of bitcoin core and have been excluded at some point.

The other explanation would be that the author forgot to mention it. But it seems a bit overload that I have to install another complete system for a full node (libbitcoin) to be able to run the code since the book explicitly says that running a full node with bitcoin core should suffice.

It is just a minor thing and probably laughable for an expert in the field but I am also learning how to use pkg-config and the compiler by doing this.

There have been suggestions to just install parts of libbitcoin but the developers said it is advisable to install the full thing with the automatic install skript.

Also, there is libbitcoin-dev, which is a package in debian (I run Raspbian Buster), but I was not able to compile the code with it.

How is it possible price on Coinbase drops below my Limit Order when it is only partially filled?

I had a post only limit order place for €172 per ETH, about 50% of the order filled before the price dropped to €171.95, leaving my limit order somehow still open? The order was placed when the price was above €172 so didn’t execute as a market order at any point.

This has happened several times on Coinbase Pro, surely the point of a limit order is to the keep the order on the book, so why is the price skipping my order?

Running into ELIFECYCLE error while trying to install filebazaar

Trying to install filebazaar on Ubuntu 18.04 and getting an error on the canvas module… anyone familiar with this issue? I’ve been all over node-canvas’s github issues (such as this one where I left a comment), but none of the solutions are working for me so far.

Here’s the command I’m running:

$ sudo npm install -g filebazaar

And here’s the error output:

$ sudo npm install -g canvas@1.6.13

> canvas@1.6.13 install /usr/local/lib/node_modules/canvas
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/canvas/build'
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v12.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/chris/.npm/_logs/2019-09-17T20_39_13_514Z-debug.log

Any assistance is appreciated 🙂