When a trade offer in Ripple incurs transit fees, who pays them? When two trade orders in Ripple are matched and they incur a transit fee for exchanging IOUs, which of the parties pays the transit fee? Is this transit fee already included in the order or is it added later? I.e. are trade offers WYSIWYG?

Transfer fees are charged whenever accounts with one set have a balance moved between other accounts. For payments, the sender always pays no matter which balances are adjusted, for trades the account 'sending/giving' pays.

So if there is a trade of USD/Bitstamp for BTC/DividendRippler between two accounts (it doesn't matter which entered the initial trade offer or if it is a BUY or SELL order) then the account that gives USD pays the 0.2% Bitstamp transfer fee and the account that gives BTC pays the 0.15% DividendRippler transfer fee.

Another example, if the trade was for USD/Bitstamp and XRP then the account giving XRP would pay no fee and the account giving USD would pay Bitstamp's 0.2% fee.

The fee is not pre-calculated into the trade offer but calculated when trades are executed. It's even possible for the issuing account to change their transfer rate/fee¹ between when the offer is posted and when it's executed, in which case the rate in effect at the time the offer is executed is the one that applies.

¹ Presumably gateways change their transfer rate rarely and according to their published policies. E.g. some gateways have promised a maximum they'll never exceed and promised to give 30 days notice before any increase. Ripple doesn't enforce any such policies however.

See also some related Ripple forum posts (that basically say the same thing):

Re: Transaction fee on the BTC/XRP in built-in Exchange?
Re: Transaction fee on the BTC/XRP in built-in Exchange?

[Edit] Small correction:
Although the overall exchange rate/price isn't adjusted to affect the transfer rate, the shown amount of the offer (the funded portion) may be adjusted as the transfer rate changes. [Ignore the rest of this if you're not interested in the details of "partially funded" offers.]

I just noticed an example of this on a trade offer that is internally represented as "taker gets 10 GBP/Bitstamp; taker pays 2940 XRP". Normally this would display on the GBP/XRP order book as an ASK with "Ask Price 294 XRP", "Size 10 GBP". If the account making the offer had at least 10.02 GBP (10 * the transfer rate of 1.002) this is what would be shown. (Since to fill the offer the offer taker would get 10 GBP but the offer maker would have to give up 10.02 GBP to cover the transfer fee).

However, the account making the offer has a balance of exactly 10 GBP/Bitstamp so due to the transfer rate this offer is considered not fully funded. Internally the offer also has fields "taker gets funded 9.980039920159681 GBP; taker pays funded 2934.131736 XRP". So this shows up in the GBP/XRP order book as an ASK with "Ask Price 294", "Size 9.980039 GBP". Note that the ask price hasn't changed, just the total amount. Someone taking 5 GBP of the offer (for 1470 XRP) would get exactly 5 GBP but the offer maker would give 5.01 GBP to cover the transfer fee. Since the offer maker only has 10 GBP the fee has to come out of that leaving only ~9.98 GBP funded.

If the transfer rate were to change the funded portion should also change. If the account were to get another 0.02 GBP (or more) the offer would be considered fully funded. If the account spends GBP and where to make their balance exactly 5.01 GBP the funded portion should change to show 5 GBP.


Mining Theory: What would happen if a block hash collision occured? To my knowledge, neither SHA256 or scrypt have ever had provable instances of hash collisions occur.. However, if this highly unlikely event was to happen, what would that mean for the state of the blockchain? Would it cause consensus confusion since there would be 2 blocks with the same hash that point back to different previous blocks? And/or would it make it best practice to avoid whatever algorithm the collision occurred with?

Just curious,

-Schwifty

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

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

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

Well explained also by P Wuille:

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


List of blockchain explorer APIs? I'm gathering a list of Bitcoin / Blockchain APIs. I mean web (REST) APIs that allow you to do basic blockchain queries through http(s) API calls, such as: getting the balance on an address, getting a list of transactions from or to an address, getting the details (inputs and outputs) for a transaction, et cetera.

I'm familiar with blocktrail.com, blockcypher.com, blockchain.info, and blockr.io, but I remember having seen others in the past. Any more?

Insight by bitpay:

https://insight.bitpay.com/

Block Explorer:

https://blockexplorer.com/

Bitcoin Chain:

https://bitcoinchain.com/block_explorer

There are many more in development, but these are ones I could find that you didn't list.


What is transaction not found on blockchain mean? Does that mean transaction still waiting in mempool, unconfirmed or never broadcasted on blockchain? I requested from my exchange (GEMINI) to withdraw bitcoin and send to my another exchange (BITTREX) on 11/11/17, four days ago. I have still not received my bitcoin at BITTREX receiving exchange; the transaction does not show in pending at receiving exchange.

Gemini exchange transaction history shows a withdrawal of bitcoin transaction with a link 'view transaction'. If I click on this link it takes me to https://insight.bitpay.com/ and shows "TRANSACTION NOT FOUND". I also searched in blockchain.info and some other explorers all show transaction not found.
So far not much luck from Gemini support. I am getting desperate with Gemini.

Here is the transaction ID;
e1e405bdd06b3ab23c3099f41f5da58ea0f5cf0bd2f891850c1d5c70fedfdb20

What is happening with this transaction?  What does "transaction not found" mean?

Is this waiting in miner's mempool to be picked up?
Is this unconfirmed and already dropped from the blockchain network.
Transaction have some error to start with and never broadcasted on blockchain network?
None of the above and have some other issue?

Is this waiting in miner's mempool to be picked up?

No. Broadcasted transactions are visible on block-explorer sites (in most cases)

  Is this unconfirmed and already dropped from the blockchain network.

It is unconfirmed, but not because already dropped, but because not yet broadcasted

  Transaction have some error to start with and never broadcasted on blockchain network?

May be. Only sender knows the correct answer

  None of the above and have some other issue?

If it is not seen - it does not exist. Point.


How do I use the getblocktemplate RPC command of Bitcoin Core GUI? I tried the following usages but none of them worked I tried the following commands, but none of them worked.
-getblocktemplate "segwit"
-Error: Error parsing JSON: segwit

-getblocktemplate ("segwit")
-Error: Error parsing JSON: segwit

-getblocktemplate "rules": ["segwit"]
-Error: Error parsing JSON: rules:

-getblocktemplate {"rules": ["segwit"]}
-Error: Error parsing JSON: {rules:

-getblocktemplate
-getblocktemplate must be called with the segwit rule set (call with {"rules": ["segwit"]}) (code -8)

-getblocktemplate {"rules": ["segwit"]}
-Error: Error parsing JSON: {rules:

How can I use this command correctly?

The GUI's debug console operates similarly to a shell. It needs quotes around the entire JSON string so that it is first interpreted as a string before the JSON is parsed. Then, if you used double quotes, you need to escape the quotes that are part of the JSON so that they aren't misinterpreted.
A valid way of writing this command is
getblocktemplate "{\"rules\":[\"segwit\"]}"

Alternatively, to avoid additional escaping, you can use single quotes on the outside:
getblocktemplate '{"rules":["segwit"]}'


Why do some transactions have more than one input? I know a normal transaction has 1 input and 2 outputs (if there is change that is the second output).

But what about this scenario?

Lets say I'm withdrawing bitcoin from my gemini account and want to calculate the fees. How would I even know if it's 7 addresses sending (which would make the byte size of the transaction larger = higher miner fees) or just 1 address sending?

To further elaborate on test-net here is our system with withdrawing btc to another wallet:
https://test-insight.bitpay.com/tx/8bc3db6a4a119e369752a52f0be39ae3a4d579adcdc49e9d92429b920000f934
https://test-insight.bitpay.com/tx/553a27e38a73ed90c792b70add3c3f894e94955440205917ee754787c17ea62b
https://test-insight.bitpay.com/tx/cecf112c7e3494826b165f4bcbeca9ef20cc800dce3d433c04b070e4fbc1da81

Here is when I deposited back into our wallet (from copay wallet that supports test net):
https://test-insight.bitpay.com/tx/5871e5957ef6ec67a336de01e6f3e4f6f4cffd9986d2f5db181fdcbf6b00d1e0

What might be confusing you, and which is a common misconception, is that the addresses themselves somehow "hold" the bitcoin balances, and gain and lose the coins via transactions. In fact all the blockchain does is link up previous outputs to new inputs, and the keys make sure only the correct person is allowed to send the coins.

Your balance is just the sum of the total unspent outputs and if you want to send a certain amount to someone, you end up creating a transaction which uses, as input, enough unspent outputs to give the right amount of coins. So if you have a few different smaller unspent outputs, and want to send a large amount, the transaction will end up using multiple of the smaller outputs as input. Because inputs and outputs are used as wholes - they can't be split up as such -
 you then usually receive a bit of change based on how much the total inputs sum up to, and how much you intended to send.

Of course, most of this is worked out by your wallet client or website which you use, so as an average user you wouldn't normally know in advance how many "addresses" are going to be involved with a specific transaction. The program will just select enough unspent outputs which you hold the keys to, and use them to create the transaction. Hopefully that answers your question to some degree.


I can't find my bitcoin address i am using electrum. First, I had a bitcoin address and I used it once to receive BTCs and then it changed. but new address is invalid.
i tired so many times. i checked all the options. but it was not OK.
what shall i do?
thank you

TL;DR: select Show Addresses item from the View menu. Then click the Addresses tab.

  First, I had a bitcoin address ...

A Hierarchical Deterministic (HD) wallet has many addresses.

  ... and I used it once to receive BTCs and then it changed.

That is normal, for privacy reasons, an HD wallet will generate a new receive address for each transaction in which you will receive BTCs.

  I can't find my bitcoin address

Look under the "Addresses" tab

(from a beginners guide)

  It will be hidden by default. To reveal it, select Show Addresses item from the View menu.

  i checked according awebanalysis.com/en/bitcoin-address-validate

I don't know that site but maybe you mis-typed an address or that site doesn't know about the type of address your wallet is using. Some online sites are not up-to-date with the latest Bitcoin features (e.g. Bech32 type addresses that start bc1...). Try another, for example http://lenschulwitz.com/base58


Why is it important that the hash algorithm is puzzle friendly? I don't understand "PUZZLE FRIENDLY". Here the definition I read:

  A hash function h is puzzle friendly if for every possible N-bit
  output value y, if K is chosen from a distribution with high minentropy,
  then it is infeasible to find X such that H(K // X) = Y, in
  time significantly less then 2^N.

And here is what is tried when mining:

H(nonce||prev_hash||tx||tx||..||tx)

"If the hash function satisfies the puzzlefriendliness
property, then the only way to
succeed in solving this hash puzzle is to just try
enough nonces one by one until you get lucky"

Ok, but what would be the problem if the hash function wasn't puzzlefriendly?
I assume that nonce is K in the definition.

In the most straightforward terms: Given a hash function H, that takes some input X from the user, and produces output Y, a good 'puzzle friendly' algorithm will not show any pre-determinable correlation between input X and output Y. That is to say, you cannot select a certain X, with hopes of returning a certain Y.

In practice, the bitcoin network accepts a block hash that is lower than some value (determined by the current network difficulty). The user should not be able to select inputs based on any sort of expected output value, the entire rang of input values* should have an equal chance of returning the desired output.

Otherwise, the user could discriminate against input values within certain ranges, thus narrowing their search field, and increasing their chance of finding a valid output. This would break the function as it is required for a POW cryptocurrency, by allowing users to make 'educated guesses'. In such a broken system, the more 'educated' a guess is, the higher chance the output will be the desired value. So the more you understand the (broken) algorithm, the less resources you would have to spend in order to compute a valid block hash.

Contrast this to the 'ideal' case where every user guess is equally likely to create a valid output. This is what is desired, and what is being referred to as a 'puzzle friendly' here.

*Note: user input includes more than just the nonce value. All input values that the user can alter would be included, there is no functional difference between changing the nonce, or changing the transaction structure


Saved bitcoin dat file, unfortunately converted to Adobe Is there a way to convert back or what do I do?   I would have thought that the old dat files would still be somewhere on my PC.  I never put them in a wallet ( .1 BC) so it was just a bunch of files. If i can access them, which ones do I need & how would I transfer them to a Trezor1 ?

Thank you

i can find this, is it usable to move the data to my wallet ?

C:\Users\Doug\SkyDrive\Documents\bitcoin (2016_09_09 22_16_58 UTC) (2017_08_22 13_54_01 UTC).dat

Filename extensions and file associations

You can probably ignore the Adobe icon and messages from Adobe.

Microsoft windows decides on the type of a file by using the last part of a files name, the part after the last period (dot), called a filename-extension. For example something.txt is a plain text file that can be edited with Notepad. something.mp3 is a music file that can be played with, for example, Windows-Media player. something.jpg is a photograph and so on.

Microsoft Windows can also associate a particular filename extension with one particular program that understands and uses the type of file that usually has that filename-extension.

Unfortunately a lot of different programs use .dat as a filename extension - it just means some kind of raw data file. The Bitcoin Core wallet (sometimes called Bitcoin-qt) uses that filename extension - for example in a file named wallet.dat.

When you install one of Adobe's products (e.g. Adobe Illustrator), the installation process has associated the .dat filename-extension with the Adobe program and removed any association with other programs.

This is why Windows explorer erroneously shows the Adobe icon next to your bitcoin .dat file. This is why Windows runs the Adobe program (not Bitcoin core) when you click on the file.

This doesn't matter that much, you can ignore it and leave the association as it is.

If you run your wallet program by finding it in the start menu or going to its web-page etc (and not by clicking on the .dat file name) it will likely work OK despite the file-association with an Adobe program.

bitcoin (2016_09_09 22_16_58 UTC) (2017_08_22 13_54_01 UTC).dat

You don't explain what kind of wallet (or web-site service) you used to store your Bitcoins before. The rest of this answer assumes you used the "Bitcoin core" wallet. If you didn't you should stop reading this answer.

The Bitcoin core wallet stores important information in a file named wallet.dat in a place on your computer's hard-disk that is not easy to find using Windows explorer.

If you open Windows explorer and, on the left hand side, click on This PC then Windows (C:), then users, then click on your name, then at the top click into the part at the top where it says This PC > Windows (C:) > Users > Yourname. It will change to C:\Users\Yourname. Move the cursor to the end (right-arrow) and add \AppData (by typing that) and press the Enter key. Click on Roaming then Bitcoin. You should see wallet.dat.

The filename you have given is different and is not one I am familiar with. This is a long-shot but,if we assume it is a backup copy of a wallet.dat saved with a special name but the same contents, you might be able to

close the Bitcoin program if it is running.
rename the existing wallet.dat to wallet.dat.new (so that you can undo these changes)
make a copy of your bitcoin (2016_09_09 22_16_58 UTC) (2017_08_22 13_54_01 UTC).dat with the name wallet.dat
put the copy into the same folder as the wallet.dat.new
start Bitcoin.

If you did not use Bitcoin core, whatever Bitcoin wallet you were using before likely has some "restore wallet" option used in conjunction with data files created using a "backup wallet" function.

  How would I transfer them to a Trezor1?

This is a separate question, you need to get some information out of your Bitcoin wallet (out of a valid wallet.dat file) and that requires a working Bitcoin core wallet program and knowledge of the password for the wallet.


Creating multiwallets I want to create wallets for users. bitcoin core allow us to
create one wallet. is there any way to create wallets for single bitcoin-qt which can able to run multi wallets at a time.I know I can rename my wallet and by re running bitcoin-qt it creates new wallet but it not allows to run both.
thanks in advance for your help

Yes. Bitcoin Core 0.16.0 introduced a multiwallet feature which is currently for the RPC interface only (the GUI part will come with the next major release). To have multiple wallets, start Bitcoin Core with the -wallet=<wallet name> option or add wallet=<wallet name> to your bitcoin.conf file. You must specify this option for each wallet you want to load.

For example, if you want to have two wallets named wallet1 and wallet2, you would start Bitcoin Core as:

bitcoin-qt -wallet=wallet1 -wallet=wallet2

or add the following to your bitcoin.conf file

wallet=wallet1
wallet=wallet2


What Happens if Hive Web Shuts Down? I've been hearing a lot of good things about Hive Web as a wallet. Apparently it's pretty secure, open source, and only requires that you keep a 12-word phrase safe. That said, what if they ever decided to shut down Hive Web suddenly? Would all your BTC go down with it, or could you simply spin up an instance of their open-source web server to regain access to your wallet?

You could most certainly spin up your own server :) Included in the Github repo is a Vagrantfile that uses Ansible to deploy and provision an instance of hive-js. This can be handy not only for creating a local test instance, but also for deploying to more public environments such as DigitalOcean or AWS.

Alternatively, because Hive Web implements BIP32/BIP39, other wallets implementing the same standard should allow for compatible 12-word seed phrases to be moved between clients. In addition to being a high priority item for Hive OSX, it seems that most if not all Bitcoin wallet developers are striving to implement these same standards.

If all else fails, you could use something like http://bip32.org/ to manually recover your master extended key and sweep the funds elsewhere.


How do I prevent the standard Bitcoin client from sending some of my Bitcoins to a change address? I found somebody that imported a paper wallet with 100BTC then used 2BTC BUT the other 98BTC were sent to a change address. Why and how can I prevent this; how can I enter a custom change address?

The standard client doesn't have any built-in options for this. You could manage it yourself if you built the transaction by the RPC API commands or, more easily, by using a client with that feature built in, like Armory:

Or, if you know what inputs will be used and the exact amounts involved, you can add the "change" yourself as an additional output. This will make it so the client won't need to generate any additional change back to itself. Remember to subtract a transaction fee, if necessary.


How do the clients agree on the target to hash for? Edit: They do not agree on a specific target hash. Any hash lower than or equal to the difficulty is sufficient. This means clients only have to agree on difficulty.

By "difficulty" I mean the number that determines the minimum acceptable hash. Higher difficulties mean lower hash minimums and thus, on average, more hash attempts needed to produce a valid block. (Related terms are target and nBits).

Every 2,016 blocks there is a difficulty change block. Unless the block is a difficulty change block, the difficulty must be precisely the same as the previous block or the block is invalid.

On a difficulty change block, the difficulty must be precisely what the difficulty algorithm requires or the block is invalid. The algorithm takes into account the amount of time it took to generate the previous group of blocks and computes a new difficulty such that the block generation time will be, on average, once every ten minutes if the network hashing power stays the same.

If you want to see this in the source code, check out the GetNextWorkRequired function in the main.cpp file.


What happens when the last added block in a blockchain is corrupted? What happens when the last added block in a blockchain is corrupted? Is it still possible for the block to be accepted by a majority of the miners?

By definition a node's idea of the blockchain is among all valid versions of history the one with the most total proof of work.

Because chains are required to be valid, it is not possible to have a block in there that violates consensus rules. It doesn't matter what miners do; full nodes will still ignore the block entirely, as if it was never created.


What's the minimum transaction with nxt? Currently the minimum transaction on Bitcoin is 5430 Satoshi, and what about NXT?

There is no minimum other than the smallest unit of NXT 0.00000001 NXT. This represents 0,00000000000072 BTC.

The issue is that the minimum fee of 1 NXT is still required for such a transaction.


Is Bitcoin a developer only currency and community? The Bitcoin repo on Github has 7 members. Ultimately, they decide what bug fixes and pull requests get merged. I don't understand how this is decentralized? Yes, it is open source, so anything they do merge can be seen by all, but how many of those all can really understand that code? Ultimately it will be the miners who will be responsible for pulling in new code - are we to say that all miners thoroughly review the source code and commit log before pulling in any changes?

So this then means that the people behind miners are usually developers themselves? Which then basically means that developers are in charge of Bitcoin as a whole? If that's the case, are developers qualified enough to create and run a currency - do we not need economists as well?

Disclaimer: I'm one of those 7 people.

It is true that changes to this one particular code repository, and the releases of the Bitcoin Core software built from it are ultimately controlled by a few people, and many miners run this software.

However:

Bitcoin Core is not the only software interacting with the Bitcoin network. There are other node and wallet implementations.
You can run a modified version, or you can fork the code and maintain a branch yourself if there are features or changes you'd rather see.
Even with Bitcoin Core powering the majority of full nodes on the network, its developers can't directly change the core protocol rules. If a change was controversial, people can (and should) refuse to upgrade. Ultimately, it is the people deciding to run a Bitcoin node that indirectly set the network's requirements.
Miners do not set the rules. This is a common misconception; many people think the longest chain created by miners is the one that gets accepted by the network. This is not correct: it is the longest valid chain that wins. Every full node - including non-miners - verify the transactions in the chain and will simply ignore a chain with faults.


Estate planning: how can I ensure my bitcoins are inheritable? What are good ways to ensure my bitcoins can be inherited by my family
when I die or become permanently incapacitated?

I think there are probably two significantly different situations to
account for, each with different requirements:

Hot wallet inheritability

I want my family to be able to inherit the bitcoins from my hot wallet,
but I'm not worried about them stealing those bitcoins or monitoring my
public transaction history while I'm still living.

Cold wallet inheritability

I also want my family to be able to inherit the bitcoins from my cold
wallet, but I'd prefer a solution that prevents them from being able to
spend the bitcoins while I'm still alive. If possible, I'd also like to
prevent them from determining my balance while I'm still alive.

It is acceptable for the solution to require periodic activity from
me, such as moving my bitcoins every six months. For example, your
answer may assume that
OP_CHECKLOCKTIMEVERIFY
has become consensus-enforced, as that's likely to happen within the
next few months---and I hope to live that long.
Because I tend to use strong encryption when available, assume that
all my data will be lost at my death unless I've specifically backed
it up for other people to use.

I use Bitcoin Core for both my hot and cold wallets (with separate wallet files), but solutions for other Bitcoin software are welcome.

Points for Hot Wallet Inheritability:

Lower exposure to risks - use hot wallets that are BIP 39 compliant and share your 12 to 24 recovery passphrase and associated password in advance.
Higher exposure to risk - share passwords on your devices that have hot wallets.  BIP 32 compliant wallets make it easy to have the same logical wallet deployed on to multiple devices (e.g., cell phone and tablet).
Highest exposure to risks - preload multiple instances of hot wallets on their devices.

Points for Cold Wallet Inheritability:

BIP 38 compliant paper wallets allow your paper wallet's Wallet Import Format (WIF) private key (Base58Check encoded) to be AES encrypted, recoverable with a password.  If you are worried about hiding the amount of the funds, just be sure your paper wallets do not have associated cryptocurrency addresses printed on them. (Cryptocurrency addresses are derived from associated associated private keys. If the private keys are encrypted, and an associated public addresses are not exposed, the amount of funds saved can remains a secret.)
A multi-party escrow service is required to ensure your funds don't get spent before the "big event". Either an on-blockchain multisig service can be applied with m of n signatures being required or an off-blockchain Shamir's Shared Secret can be applied.  The take-away point is that a sealed will is used as a mechanism (or a trusted 3rd party) is used to release the funds.
High tech approach, less privacy where m of n signatures come together for an on-blockchain approach, which doesn't have the desired privacy.
Low tech approach, desired privacy where enough Shamir Shared Secrets need to come together to reconstitute a passwords used by BIP 38 compliant paper wallets. Each heir could have their own unique paper wallets with a common passwords shared across all the wallets. It is also easier to change a will using this approach. The redistribution of updated shared secrets also gets the point across that either you are upset or happy with the behavior of your heirs.

FYSA, Some hot wallet application directly support the importation of BIP 38 encoded keys.

WARNING: As with all backup and recovery processes, perform dry-run tests in advance to be certain the backup and recovery processes are working properly.  Also, perform key generation on a computer (preferably a spare one) that will never be connected to a network again,
print on a network enabled printer private cryptocurrency keys unless they are encrypted using something like BIP 38.


Discrepency with TX amounts with TBTC I have the following transaction on the testnet:

dc5b627a93ffaca1fe02a4352406c218be17fc3e6d47cfefe7e3890037b689ad

It shows like this:

Notice that the amount is 1993.07(..) TBTC

With BitcoinD, I received the following:

Status: 90 confirmations
Date: 12/13/2017 15:56
From: unknown
To: mz7XHbwYAnfZhmMqSsgDDPpFmSuxV2i6UF (own address, label: 5f40098e-0e0d-b642-62a2-cc966775ce7f)
Credit: 0.00859375 BTC
Net amount: +0.00859375 BTC
Transaction ID: dc5b627a93ffaca1fe02a4352406c218be17fc3e6d47cfefe7e3890037b689ad
Transaction total size: 249 bytes
Output index: 0

But the amount is: 0.00859375 TBTC

Why is this?

What you have is something called a change address. Your client used an unspent output of 1993.07508548 BTC and split it into two outputs (1993.06549173 BTC & 0.00859375 BTC). The larger output is considered change back to the sender. I would imagine the 0.008 BTC output is yours as that is the output displayed on your client.

If for some reason you wish to spend this 0.008 BTC and the amount you wish to send is 0.004 BTC, the output of this transaction will act as the unspent output of the new transaction you wish to make. The total transacted will be 0.008 BTC even though your only sending 0.004 BTC.

Here is some documentation on unspent outputs


How do miners understand what a transaction does? Bitcoins are spent via transaction scripts that can be quite complicated. How do miners understand what a transaction does?

A miner has to decide whether to include a transaction in their block, but this could be quite a difficult decision, because scripts can be complicated. How could you even know, for example, that a transaction has a fee in it, without decoding the transaction? A person could create a transaction with a big fee, but it could be hard to determine that due to the script complexity.

Determining the fee of a transaction is actually very easy.

As you know, a transaction has inputs and outputs, where each output has an associated amount and a script, and each input is a link to an output of a previous transaction, along with whatever data is needed to satisfy the previous output's script.

A transaction fee is implemented by simply having the total value of the outputs be less than the total value of the inputs.  The difference represents the transaction fee and can be added to the block's coinbase transaction, to be collected as part of the miner's reward.

So in order to calculate the fee of a transaction, the miner simply has to:

Sum up the values of the outputs of the transaction.
For the inputs of the transaction, find the associated previous outputs and sum up their values.  (These will normally have already been stored in an indexed database, so it's easy to find them.) This gives the total input value.
Subtract.

Of course, the miner also has to check that the transaction is valid, since any block containing an invalid transaction is itself invalid, and won't be included in the block chain.  This is a little harder, because it does require actually "decoding" and executing the script for each of the previous outputs, and verifying that the input data and signatures provided in the current transaction satisfy those scripts.  But by design, the instructions available for those scripts is quite limited (for instance, there are no loops).  So this verification is of bounded complexity, and it can't be too hard in a computational sense.  Of course, the code to actually do the verification is already implemented in Bitcoin Core, so in practice all the miner has to do is run it.


What is the actual threat of a majority attack on the Bitcoin blockchain? As far as I understand, an attacker (in the role of a malicious miner) controlling a large portion of the current hash power could replace previously accepted blocks with alternatives.

But, what does that mean? He could

Collect the block reward
Add previously unconfirmed transactions, making them confirmed
Omit formerly confirmed transactions

But what would an attacker gain with this?

Block rewards are easier collected with real mining
Unconfirmed transactions may eventually confirm anyway
Omitted transactions may confirm just a while later anyway, too

So what's the danger with majority attacks?

An attacker controlling more than half of the mining power could do a few things. For example.

They could declare certain transactions as invalid. By refusing to include them in their blocks and refusing to build on any block that includes them the unwanted transactions would see any confirmations they picked up quickly reversed. Someone trying to make money could use this to set minimum transaction fees. A government trying to regulate bitcoin could allow only addresses registered with the government.
They could collect all the mining rewards by refusing to build on anyone else's blocks, since the total mining rewards are roughly fixed this would get them more bitcoins than just taking their fair share of mining rewards.
They could spend bitcoins to get something non-bitcoin in exchange and then later reverse those transactions leaving the people they exchanged with out of pocket.

If the attackers aim is to make money these things are probably a bad idea. They would likely destroy the value of bitcoin and destroy the attackers profits

OTOH if the attackers goal is to destroy or subvert bitcoin these things may be more worth doing.


Ransomware requesting payment through Bitcoin I read this article recently, talking about the emergence of "ransomware". An excerpt is:

The newer CryptoLocker differs by taking the ransom to a whole new level. Upon infection it doesn't make a fanfare, to the contrary, it acts in stealth performing a nefarious task in the background. You probably won't even notice the task running, as CryptoLocker silently encrypts your data files, including your precious family photos, vital Microsoft Word documents, spreadsheets, and email.
Upon completing the encryption of your files, it sends the unique key required for decrypting and unlocking your files over the internet to a secure remote server, and then the ransom begins. Immediately the CryptoLocker window displays containing the image of a shield, instructional text, and a countdown timer.
It's important to understand that the ransomware is not bluffing. Unless you pay the ransom, you will lose access to any files that have been encrypted. Once the countdown starts you have about three days to make payment, otherwise the key is destroyed and you permanently lose the ability to decrypt your files.

It seems like a logical step to request payment through Bitcoin, given that it would be much harder to track down the person receiving the payment than most other options. Sure enough, it's been done already! Admittedly, it could be a pretty daunting task for your average Joe Bloggs to figure out how to safely pay within 3 days using Bitcoin, but obviously the time limit can be made flexible.
Has any malware successfully used this technique yet, using Bitcoin? If so, does anyone know of a receiving address used more than once, thus giving an indication of how many people are paying a ransom?
Are there any websites that have statistics on such incidents?

Has any malware successfully used this technique yet, using Bitcoin?

I got around 10 people contacting me via localbitcoins in a day asking to buy exactly 2BTC to unlock their computers. I'd say it's pretty effective. I did get the addresses but don't seem to have it around now, when I looked around 30 people total had been paid out to two addresses.


Is there a way to create a tx completely offline? Maybe with a script or cli commands? I mean generating the transaction itself offline, assuming I know in advance how much bitcoin a UTXO has. In other words, without querying the network for the UTXO balance.
Then I also need to sign that tx, also offline.
And finally I can pass the signed tx to someone via bluetooth, and then he can drive to an Internet connection, and broadcast the tx.
I'm pretty sure there isn't a wallet that does this, so this needs to be some special script or a sequence of cli commands

assuming I know in advance how much bitcoin a UTXO has

createrawtransaction in Bitcoin Core requires tx id and vout, if you know it and the address which will be used for output then transaction can be created offline.

Then I also need to sign that tx, also offline

Signing will require private key or a wallet with private key depending on which of these RPC commands you prefer to use: signrawtransactionwithwallet or signrawtransactionwithkey

And finally I can pass the signed tx to someone via bluetooth, and then he can drive to an Internet connection, and broadcast the tx.

Sure. This is possible. I had even worked on a side project which can be used to send bitcoin with text messages (Internet not working but SMS works). You can even encode signed transaction hex in to words.
Related Q&A: Issues decoding the words to transaction hex

I'm pretty sure there isn't a wallet that does this, so this needs to be some special script or a sequence of cli commands

Cold storage (keeping private keys offline) is used by many people in which transaction signing is done offline. Transaction can be created on any device or wallet (online/offline) as long as you have information required to create transaction. For example: tx id and vout of UTXOs you are trying to spend.
RPC to create PSBT also requires same information. I am not sure about compatibility of different wallets so creating a transaction in one wallet and signing in other may have issues. However, I have tried creating a transaction and signing it in Electrum in this Q&A: Create unsigned tx (PSBT) in a watch-only wallet using bitcoin core, sign it in electrum and broadcast using bitcoin core
You can try one experiment:

Open Electrum Wallet. Copy one transaction id. Open it in explorer.

Disconnect Internet.

Open Bitcoin Core.

Create transaction with createrawtransaction

Convert to PSBT with converttopsbt

Copy the results and load transaction in Electrum Wallet. Sign it and copy the transaction hex.

Close all wallets. Open https://blockstream.info/tx/push in browser of any online machine.

Broadcast this transaction


Multibit export private key to usb possible? I have Multibit and want to export my private keys as a backup.

1) I cant see my external usb as a option when selecting a destination to export to.  Is this because cant export the private keys directly to a usb?

2) Once exported, is that it to make a back up of the private keys, or do you then have to re-import the private keys to transact in the wallet?

Thanks

Private keys can be exported to usb sticks or harddrives.
As for 2) when you export a private key for a back up or whatever else reason, you actually export a copy of the key . You original keys doesn't get moved out, so no, you don't neeed to re-import it.


Should boost be installed in /usr/ or /usr/local/ for bitcoin-core? When installing bitcoin-core, libbitcoin or libbitcoin-explorer the build requires the C++ boost library. Is there any reason why I should prefer to install boost in the /usr/ hierarchy rather than /usr/local. Or should I not attempt to link all my C++ projects to the same boost build anyway, and link to a seperate boost build (of a possibly different versions installed in different locations) for each project?

Libraries should be installed in /usr/include.

For Boost, the path to it should be /usr/include/boost. That's where the linker would be looking for the libraries.

Otherwise, you may elect to install the libraries in some different directory and symlink it to /usr/include anyways.


Convert WIF to private key I am aware how to convert the private key into WIF format in python, now I am trying to reverse this process and convert a WIF formatted private key back into a 256-bit private key, following this guide: https://en.bitcoin.it/wiki/Wallet_import_format

This is the code to convert from 256-bit private key into WIF format:

import hashlib
import base58
import binascii

private_key_static = "0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D"
extended_key = "80"+private_key_static
first_sha256 = hashlib.sha256(binascii.unhexlify(extended_key)).hexdigest()
second_sha256 = hashlib.sha256(binascii.unhexlify(first_sha256)).hexdigest()

# add checksum to end of extended key
final_key = extended_key+second_sha256[:8]

# Wallet Import Format = base 58 encoded final_key
WIF = base58.b58encode(binascii.unhexlify(final_key))

print (WIF)

Now my attempt to reverse this process looks like this:

import hashlib
import base58
import binascii

private_key_WIF = 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ
first_encode = base58.b58decode(binascii.hexlify(private_key_WIF))
print (first_encode)

Instead of receiving the byte string, I get following error:

TypeError: a bytes-like object is required, not 'str'

(All private keys used are sample keys taken from Bitcoin Wiki.)

converts WIF private key back to basic private key format
import hashlib
import base58
import binascii

private_key_WIF = input("WIF: ")
first_encode = base58.b58decode(private_key_WIF)
private_key_full = binascii.hexlify(first_encode)
private_key = private_key_full[2:-8]
print(private_key)


What is the public key used to generate the Genesis block? I'm trying to create and build a working fork of Bitcoin -- in order to understand how it works at the source code level. I see a lot of articles explaining how to create altcoins but they are not very helpful for the learning purpose as they skip a lot of details and tend to tell you what to do without explaining why.

Regarding this question, I couldn't find any article/document even remotely mentioning anything about the public key used for generating the genesis block -- I believe this is an important things to know, at least because it's been used to generate the genesis block of Bitcoin. Looking at the source code:

Bitcoin 0.1.5 - main.cpp @1490:

  txNew.vout[0].scriptPubKey = CScript() << CBigNum("0x5F1DF16B2B704C8A578D0BBAF74D385CDE12C11EE50455F3C438EF4C3FBCF649B6DE611FEAE06279A60939E028A8D65C10B73071A6F16719274855FEB0FD8A6704") << OP_CHECKSIG;

Bitcoin 0.8.0 main.cpp @2715

  txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;

These two public keys are same. First one appeared in the very first version of Bitcoin -- as far as I can see in the Github repo. Second one is the latest usage before it being totally removed from the source code.

My questions are:

What is this public key? Is this [supposedly] Satoshi's personal public key or just a random key generated for the sake of generating the genesis block?
Is there any other application for this public key or it's only useful when generating the genesis block? e.g. signing transactions? verifying the integrity of the mined blocks?
There are different formats used for Public/Private key pairs. What is  the format used for this specific key? Is there any built-in API/utility inside the Bitcoin source that could be used for generating or testing the validity of the key?
What are the consequences of using a broken/invalid public key at this stage? Given the fact that the genesis block is unspendable.

Second one is the latest usage before it being totally removed from the source code.

It wasn't removed. It just got moved:

static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

(Source.)

If you mean "Is it the key that he used to sign announcements and emails," no. That's the PGP key 5EC948A1. If you mean, "Is this the key that can broadcast alerts," no. That's defined here:

https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L90

The key is thought to belong to Satoshi Nakamoto, though.
It's useless. You don't actually need the private component of the key to generate or verify the genesis block. And, like you say, you can't even spend the associated Bitcoins. For all we know, it might just be a random point on the ECDSA curve, with no associated private key.
This appears to be a normal uncompressed key. It starts with 0x04, followed by 64 bytes. The difference in how it was expressed between 0.1.5 and 0.8.0 is just a result of endianness. As for how to generate it, just call getnewaddress followed by validateaddress on the result.
Nothing.


What are some proposed privacy features coming to the bitcoin lightning network? If I'm correct, a bitcoin sent into a lightning channel technically looks like any Bitcoin transaction. From there if the channel never closes, the Bitcoins can essentially stay in a "locked" state in that channel which can give it some interesting properties such as the most needed feature in Bitcoin, privacy & fungibility.

What are some projects that are currently implementing privacy features into the Bitcoin lightning network? If there aren't any, what has been discussed that could be possible?

I am not sure if I get your question right. Please tell me if not and I shall iterate on my answer.

First of all the lightning network indeed has a different privacy model only opening and closing of channels is stored to the redundant public ledger called blockchain. Once the channel is open even when routing is applied the payment itself is pretty private.

I have been told that people work on a truly decentralized marketplace on top of lightning. Obviously payment or exchanging of goods and currency seems like an obvious application.

In a similar direction I believe selling digital goods and file-sharing can be powered on top of lightning as it does not require the person who is shopping to register an account. Any digital good could be symmetrically encrypted with the preimage of the invoice as the key

I know that the people from bhb networks are trying to build the rgb protocol on top of lightning which would give colored coins and the ability to issue tokens which could also be transferred via lightning.

On a protocol level there is an ongoing effort to implement rendez vous routing which is an improvement over onion routing. With rendez vous the person getting paid will be able to hide the location of his/her private node it might maintain by proving the remainder of an onion with the issued invoice making a payment from some rendez vous point to the payee.

I personally suggested JIT routing which would produce less routing failures and thus keep channel balance private.

As mentioned I hope your question was meant to go in this direction.


What to look for in Bitcoin-core logfile when something bad happens About a week ago I was trying to reorganise my file structure with Bitcoin Core, I accidentally moved the file before listing it as a backup so when I opened Core, it didn't work.
I tried returning the files to the same location but that didn't work so I reinstalled it and tried to open my wallet but it would freeze up as soon as I would click the "Open Wallet" button. I then synced it up to date but the issue persists.
I have seen a suggestion to read the log but honestly I'm not sure what I'm looking for.

I have seen a suggestion to read the log ...

That is a good suggestion.
Normally it wouldn't be needed. The program should explain to the user when it is unable to do something. However if you have been deleting, renaming or moving it's data files, you are undermining it's foundations in a way that the program designers won't have anticipated - in these circumstances, a logfile is a good place to look to try to understand what the problem is.
For any program, not just bitcoin core, you can check for program options to increase the amount of information logged - for example there might be a debug option - often a -d or -debug command-line flag.

... but honestly I'm not sure what I'm looking for.

You are looking for anything that looks like a major error rather than routine activity. Mostly indicated by words like "error", "failed", "unable", "denied" and so on.
You are also looking for messages relating the the action you took just before the unwanted behaviour occurred. In your example, you clicked "Open wallet" so you are looking for messages that contain the word "wallet" or "file" or "open". In Bitcoin core you know the wallet is stored in a file named "wallet.dat" so that is a good thing to look for.
Most likely these messages are near the end of the log file, so that might be a good place to start looking.
If you find lines in the log file that look interesting, also look at nearby lines to get a sense of what the program is trying to do and what might be happening. If you post an extract of the log to a Q&A website like this, include maybe ten or so lines either side of the ones that caught your attention. Don't include too much as no-one wants to read hundreds of lines. Don't post too little.


How does bundling as a bundler in Ardor work? What do the bundling options mean in Ardor when you are bundling?

Minimum Rate
Rate
Fee Limit
Overpay

Maybe this post can help:

https://thewiring.com/2017/05/19/ardor-fees-child-chain-fees-bundlers-forgers-lets-clarify/

Hope it helps a bit

  The idea behind Ardor is brilliant. And sometimes brilliant ideas
  require some time to be fully understood.

  One of the great features of Ardor is that there can be many child
  chains running under the blockchain infrastructure built on the Ardor
  nodes (main chain). At the release of the live Ardor software in Q3
  2017, all the functionalities of the current NXT will be implemented
  in the first Ardor child chain called Ignis.

  But one thing that is apparently not clear to everybody is how the
  fees structure looks like in the child chains and in the Ardor main
  chain. So let’s clarify.

  Let’s start from the Ardor main chain.

  Forging blocks on the Ardor main chain will work as today’s NXT
  forging. The Proof of Stake protocol allows the forging node with more
  tokens to have better chances to forge a block. Forging is the
  equivalent of mining in the NXT/Ardor world. The reward of a forged
  block is the sum of the transaction fees within that block.

  These blocks will contain transactions from the main chain and from
  the child chains. The Ardor main chain will be the only one forging
  and providing the blockchain infrastructure to all child chains.

  So that’s clear. Ardor’s forging process works as today’s NXT forging
  with the exception that there are also transactions from the child
  chains packed in the same blocks.

  Let’s now move to the child chains. Let’s take for example Ignis, the
  first child chain of Ardor.

  Users doing transactions within Ignis do not have to worry about Ardor
  fees. They can simply transfer Ignis from one account to the other,
  issue an Asset, send a message, etc by just paying a fee in Ignis. The
  child chain fees can change because they will be defined by the
  “bundlers”.

  So what is a “bundler”? A “bundler” is the link between the child
  chain and the main chain. It’s the one that collects the child chain
  fees and then pays the main chain (Ardor) to pack those transactions
  in a block.

  There will be bundlers for each child chain and anyone can setup a
  bundler as long the account holds some Ardor.

  Here is how the Bundler setup page looks like (example for Ignis):

  The field “Minimum Rate” is a multiplier for the defined Ardor fee for
  that specific transaction. The result of that multiplication will be
  the minimum transaction fee in child chain token users will have to
  pay so that the bundler will bundle their child chain transaction.

  “Fee Limit” is the total amount you want to spend in Ardor fees.

  “Overpay” is the extra you want to pay more in case of competing
  bundlers. This is a multiplier of what you will pay in terms of Ardor
  fee.

  Let’s hypothetically assume that these are the fixed prices for a
  couple of transaction in Ardor (still in development so let’s not be
  too picky with the exact amounts):

  Basic transaction (money transfer, sending message, etc): 0.1 Ardor
  Asset issuing: 1000 Ardor Now lets assume a bundler is set with these
  parameters:

  Minimum Rate: 10 Fee Limit: 200 Overpay: 0.1 Someone now sends a
  message to someone else in the Ignis child chain. The client will
  automatically set the fee to the minimum fee offered by the bundlers.
  Let’s assume that our bundler is the only one, then the fee that will
  be applied will be:

  0.1 Ardor fee x 10 Minimum Rate = 1 Ignis

  So the message will be delivered with 1 Ignis fee.

  The bundler then has to pay 0.1 Ardor + (0.1 Ardor x 0.1 Overpay) =
  0.11 Ardor

  Let’s set another bundler with these parameters:

  Minimum Rate: 1 Fee Limit: 5000 Overpay: 2 Someone issues an Asset on
  the Ignis child chain. Here is how the fees will look like:

  1000 Ardor fee x 1 Minimum Rate = 1000 Ignis

  So the Asset will cost 1000 Ignis to the user.

  The bundler instead will pay 1000 Ardor + (1000 Ardor x 2 Overpay) =
  3000 Ardor

  As the bundler has set a Fee Limit of 5000, it can afford to pay the
  3000 Ardor mentioned above and still have 2000 Ardor budget for the
  following “bundles”.

  Keep in mind that the bundler gets the child chain fees, and this is
  where it gets interesting. The bundlers will then have to follow the
  exchange rate between, for example, Ardor and Ignis and define the
  Bundler in a way that he/she can recover the expenses.

  Let’s assume that 1 Ardor = 1 Ignis in terms of value.

  Let’s suppose that we have a Bundler set in the following way:

  Minimum Rate: 1 Fee Limit: 1000 Overpay: 0 Someone sends a message and
  pays a fee of 0.1 Ignis (0.1 fixed Ardor fee multiplied by Minimum
  Rate 1) to the bundler.

  So the bundler received a value 0.1 Ignis and pays a 0.1 Ardor as the
  value of Ardor and Ignis, in this example are the same, then there is
  no loss and no gain for the Bundler.

  Assuming the same Bundler defined above, but the value of Ardor is 10
  times the value of Ignis, so you need 10 Ignis to buy 1 Ardor.

  In that case there would be a loss for the Bundler as it will receive
  0.1 Ignis fee but will pay 0.1 Ardor fee which is worth 10 times more. So in that scenario the Bundlers have to adjust their Bundler settings
  to be more reasonable financially, in this case a 0 gain/loss would be
  achieved by setting Minimum Rate to 10.

  This is where more Bundlers will have to compete to be the most
  attractive but also to make a little gain maybe. This will be defined
  by the market.

  I hope this example helps to understand the fee structure in Ardor,
  but please be aware that Ardor is still being developed so things
  might be different when it will go live.


Are really all transactions (the whole blockchain) stored on every client? I've read through some explanations saying that every client in the network knows every transaction because when someone wants to perform a transaction, he sends that informationen (how much, to whom and his own address) to everybody he knows and everybody they know and every.... and so on. Until it gets confirmed by everybody in the network. Then the transaction can take place. So everybody in the network knows that this transaction happens, and add the new block to their chain.

Does REALLY everybody have the whole history of transactions (a.k.a one HUGE chain of blocks) stored on their (lets say) computer?

Really all? Isn't this amount of bytes too much for normal hard disks (in my computer, smartphone, ...) considering ALL transactions which have ever happened and happen?

Everyone running a bitcoin Core node must download the entire ledger of transactions listed on the blockchain... But the vast majority of Bitcoin wallets are simply a place that stores a user's private key and allows users to interact with the network. When someone sends a transaction from their wallet, it gets broadcast to the network and eventually to Bitcoin miners.

Once a miner finds the next block (that includes your transaction), the solution gets broadcast to the network and those that are running the full Bitcoin Core software incorporate that block into the blockchain.

So although not everyone needs to download the full bitcoin blockchain, there are still a very large number of people who do, and by doing so, secure the network.


How do nodes come to a consensus on difficulty? Specifically I would like to know what messages are sent between nodes in order to figure out total processing power of the network and therefore difficulty. How is the new difficulty value spread through the network and what if nodes do not agree on it?

There is no coordination done specifically for difficulty calculations. The difficulty is computed deterministically based on the data in the blockchain (shared among all nodes), specifically the timestamps of blocks.


Is it legal to buy Litecoin and sell those within a few minutes? In US, is it legal to buy and sell cyber currency within a few minutes?

I cannot think of any law it would violate.  But legal advice needs to come from a lawyer who you hire.

Note that if you sell it for more than you paid to buy it, regardless of how long you held it, you need to report it on your tax return as a capital gain, and pay the appropriate taxes.  (If you sell it for less, you may be able to deduct a capital loss, subject to a variety of restrictions.)


Best GPUs for Mining GPU mining is the way to go, as at August 2011, until something better arrives on the market. There are plenty of GPUs out there, but only a handful offer the best performance when comparing total number of Bitcoins generated vs. power consumed vs. initial purchase cost of the chip.

Which GPUs provide the best performance in regards to Bitcoin Generation vs. Power Consumption?

According to https://en.bitcoin.it/wiki/Mining_hardware_comparison the best GPU in regards to power consumption is the 5970, the tricky part is finding one of those for sale.


How to tell if a cryptocurrency exchange or trading platform is trustworthy? I've seen a good-looking website for buying and selling cryptocurrencies, should I trust it with my money?

Here's a few checks I'd advise anyone to do.

Does it promise to earn you more than 10% profit in less than a month? If so it is a fraud.

Does it make implausibly impressive claims like "SEC awards {businessname} as one of the best Trading platform of 2018 with 247 contact"? (hint: that's not the sort of thing the SEC ever does).

Are there very many spelling errors and poor grammar?

See if the website is a copy of another website. Take a jargon-phrase from the website, it should be around a dozen words and not include the business name (or other things copiers change) and put it in quotes in a web search engine. See if other websites are using the same phrases. See if any found websites are nearly identical copies. e.g. "We are the only binary options broker that truly places emphasis on you" (LOL!)

Use a "whois" service to look up the domain name registration

if the website is http://example.com/ look up example.com. Was it only registered a few months ago?
Where was it registered? Is the registrar located in a faraway country with a poor record for investigating online crime? Do you want to deal with a business that you have no way to sue? A place with no feasible legal remedies for you as a foreigner?

If the website claims for example "7 years of forex experience" but was only registered 1 year ago you should regard it as probably untrustworthy.

Check the website for contact details. Does it give a physical address?

if not I'd say it is untrustworthy.
Is it a full address or something vague (one site has "west midlands UK" as a contact address - which is obviously deliberately vague and useless as a contact address).
Use something like streetview in Google Maps to view the contact location.

Some websites give an address that is actually a small wooden home in farmland or suburbia - this is obviously a fake address chosen at random.
Some websites give an address in an office building that rents tiny
offices by the day - this is suspicious

Look for company registration details. For example, if the site says it is registered company 123456 in the UK, go to the UK companies house website and look up that company number.

If details don't match, don't trust the website
If details do match check how long ago the business was first registered and whether they have filed accounts etc in the last year. Are they shown as active or inactive, have they changed names. Look for evidence of a bad business - sometimes you find a winding-up notice or de-registration notice.


How to get info for public address from bitcoin-cli + local db? (Can it be done without creating a wallet?) I just started running my own full node.  IBD is finished, and I'm now learning how to use bitcoin-cli.
First I would like to extract all the available information for one or more public addresses from the downloaded blockchain.
For the most part 1, I have not been able to find a way to do this that does not require creating a wallet.
For example, if I run
% bitcoin-cli getaddressinfo 1XPTgDRhN8RFnzniWCddobD9iKZatrvH4

...I get an error message that says
error code: -18
error message:
No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A \
default wallet is no longer automatically created)

(BTW, I get the same error as long as I provide one argument after getaddressinfo, irrespective of its value.)
It seems to me that it should not be that difficult to dump all the information that the local blockchain currently has for a given address, without the need for a wallet.
Can this be done with bitcoin-cli?
If not, is there some other way to do it (without creating a wallet)?

1The only partial exception to this statement is that, if I have a transaction ID, I can use bitcoin-cli gettxout repeatedly, and look for the desired address(es) in the output.  This is not only absurdly laborious, but it requires having a specific transaction ID.

getaddressinfo is a wallet RPC. It reports the information a specific wallet has about a receiving address it created. Without wallet, there is no information.

It seems to me that it should not be that difficult to dump all the information that the local blockchain currently has for a given address, without the need for a wallet.

The local blockchain database in Bitcoin Core has no information about addresses or the scripts they refer to at all. All it has is the raw block data, and a database of unspent transaction outputs (indexed only by the txid and output position that created them - as you can query using gettxout).
It is of course still possible to index the chain and compute information related to addresses/scripts, like various block explorer websites do. Such functionality does not exist in Bitcoin Core, as it is unnecessary for the features it provides (full block validation, wallet functions, ...).

If not, is there some other way to do it (without creating a wallet)?

Perhaps you're interested in the scantxoutset RPC. You give it a descriptor (which can contain an address, but also xpubs, ...) and it will scan the current set of unspent transaction outputs that are assigned to those. Note however that this doesn't use any index, so it is rather slow (several minutes) for a query.
If you want the ability to query things faster, various indexing software packages exist.


Im new to Bitcoin and want to know if storing wallet on my hard drive could corupt it? Will storing a wallet on my hard drive increase the risk of corruption to the drive?

It will increase the risk of corruption as much as storing any other file of the same size on your hard drive, which is to say that there is no additional risk of corruption for having a wallet. Wallet files aren't special in some way that makes them more prone to damaging a hard drive.


Differences/similarities of "Bitcoin script" and "Ethereum smart contract"? Can we compare Bitcoin script and Ethereum smart contract ?

And if yes,

What are differences/similarities of Bitcoin script and Ethereum smart contract in sense of functionality, architecture and how to interact with blockchain?

Does Bitcoin script run on-chain (similar to Ethereum smart contracts) or they run off-chain?

As they say, Ethereum is Turing complete, Bitcoin script is intentionally not Turing complete.

Ethereum has a virtual machine with a set of opcodes. Bitcoin script is defined by different opcodes, defined in src/script/script.h. There are good descriptions of the opcodes at https://en.bitcoin.it/wiki/Script.

Differences include:

Ethereum charges for each operation: https://github.com/djrtwo/evm-opcode-gas-costs to account for differences in computation difficulty.
Bitcoin scripts are limited to a certain complexity (e.g. num of sigops) to prevent DoS attacks.

Similarities include:

Contracts live on the blockchain. In an Ethereum-specific binary format (EVM bytecode), and in Bitcoin as Bitcoin Script.

  Does Bitcoin script run on-chain (similar to Ethereum smart contracts)
  or they run off-chain?

Yes. Script can be stored in 3 places in a transaction: witness, scriptSig and scriptPubkey. These transactions are stored in blocks on the blockchain, and are run by nodes validating them.


Help running cgminer on Ubuntu 14.04 - waiting for USB hotplug devices, and other errors I'm a total noob regarding bitcoin mining, I've installed cgminer using apt-get install but I can't get it to work.

I start it with this command:

./cgminer  -o stratum+tcp://www.albamine.net:3333 -u Weblogin.WorkerName -p WorkerPassword

I followed these instructions:  (I'm mining for scotcoin.)

  Install Ubuntu
  Install updates
  sudo apt-get update
  Install updates for your graphics card
  Install misc packages
  sudo apt-get install gedit git libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm
  Edit grub configuration
  sudo gedit /etc/default/grub
  Edit GRUB_TIMEOUT=10 to GRUB_TIMEOUT="10"
  sudo update-grub
  Download ATI OpenCL drivers. Untar it and run the script inside.
  Reboot.
  git clone git://github.com/ckolivas/cgminer
  Download the ADL SDK. Unzip it. Copy the include directory into cgminer, and name it ADL_SDK
  Check dependencies for cgminer.
  cd ~/cgminer
  ./autogen.sh
  Create the build script:
  CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure
  make
  Run using
  export DISPLAY=:0; export GPU_USE_SYNC_OBJECTS=1; ./cgminer -n

The first few times I tried I got an error that repeatedly said:

KnC spiL Can not open SPI device /dev/spidev1.0: No such file or directory.

NowI'm getting a terminal that looks like this, and I have no idea. I've googled select sections of the code but can't figure out what it's all about. Any suggestions would be gratefully received. Thanks.

Info. Running Ubuntu 14:04 on a System 76 Galago Ultra pro.

Your system reports: Intel's new Iris Pro graphics.

As far as ubuntu 13.10 was concerned the package cgminer was compiled for nvidia graphics cards and installed the module for ubuntu.

Consider running a system with dedicated GPU w/ PCIe: e. g. nvidia and ATI and possibly compile cgminer by yourself.

I tried bfgminer for ubuntu now, see here: http://jarco.be/install-bfgminer-ubuntu-mint/

...but cannot get it to work for litecoin scrypt right now...

NOW up and running bfgminer compiled for ubuntu 14.04 with howto from here:
https://debianhelp.wordpress.com/2012/01/02/bitcoin-mining-in-ubuntu-with-bfgminer/

with some minor changes:

installed "bitcoin-qt" instead of "bitcoin"
sudo apt-get install uthash-dev
./autogen.sh && ./configure --enable-scrypt --enable-opencl && make
modified ".bfgminer/bfgminer.conf" can be pasted here, if you want
-> 880kh/s @ ATI Radeon R9 290X


Is this the answer to Bitcoin's massive energy consumption issues? In today’s world carbon footprint and efficiency matter.

A lot of real world resources are burned away and a massive amount of computing power and electricity is spent on the bitcoin ledger to verify blocks.

It is necessary but it could be done better and efficiently. Here is my solution using renewable energy with the latest technology.

As I move forward with this project what do you foresee being the largest obstacles? What are any questions that come to mind?

Can you offer any guidance in support of what we are trying to do?

You can probably make more money selling the energy you farm than you can mining BTC with it.


How to install & activate a c-lightning plugin in lightningd? I recently stumbled across the https://github.com/lightningd/plugins github repo and wanted to install the autopilot plugin. But how can I install and activate the plugin which I downloaded from the website.

As explained on the simple funds overview plugin you just have to start lightningd with the plugin argument like this:

lightningd --plugin=/path/to/plugin/directory/plugin-file-name.py

of course plugins could also be written in other languages than python.

You see this mechanism also in action in this video which explains who to write and run your own plugins.

Also you can move the plugin to the clightning codebase to the plugindirectory (version at time of giving that answer). plugins which are stored there are automatically called and activated on lightningd startup if the file of the plugin is executable.

You will also need c-lightning version bigger than 0.6 as plugins where not a thing before.


Do Miners get a reward for re-confirming blocks? As far as I know, to ensure double-spending didn't happened and also for other security reasons, there is minimum number of confirmations that a transaction should have to be accepted. That value is around 4-6 blocks I think, but merchants can put their own threshold.

My question is if with the sub-sequent confirmations after the first one, the miners get the mining reward, or a share of it.

Or maybe a transaction is included in different blocks per each confirmation? But how the mining fees are paid then?

If there is no reward for re-confirmations, I'm wondering what would happen after the Bitcoin limit is reached and the only reward for the miners will be the transaction fees. Will transaction get more than 1 confirmation then?

Yes, miners get a reward for "re-confirming" blocks; no, it's not a direct reward.
Each block must reference the preceding block by including a hash of the preceding block's header in its own header.  That means each block confirms the block before it, which confirms the block before it, etc..., all the ways back to block 0 (the genesis block).

When we say a transaction has 1 confirmation, that means it's included in a block.

When we say a transaction has 2 confirmations, that means it's included in a block which is followed by one block.

When we say a transaction has 3 confirmations, that means it's included in a block which is followed by two blocks.  Etc...

When the block subsidy stops (or becomes so low it's mostly irrelevant), miners will create blocks only for their transaction fees.  So miners will attempt to mine block A for its fees (giving its transactions one confirmation); after it's mined, miners will attempt to mine block B for its transaction fees---and block B will confirm the transactions in block A, raising their confirmation score to two.  So transactions will still get more than one transaction then.
There is some concern that Bitcoin with transaction fees only will encourage miners to fork the chain and "re-mine" recent blocks with high transaction fees.  Some people call this "fee sniping", and if it's a legitimate concern, it still probably won't manifest for several years---and developers are already talking about ways to make it harder and less potentially profitable.


Transaction won't confirm Hoping someone can help me! I'm pretty new to all this.

I sent a payment about 12 hours ago, but it's still marked as 0 confirmed. I was fairly sure the address I sent it to was correct, but it won't send and I'm a bit lost as to what to do.

Is anyone able to shed some light on it? There's a transaction fee included so didn't think I'd be put on the bottom of the pile.

Transaction ID is: 12c3cfa1ecdfbed226c8d2f48767ff7e6845d31850eaae6ea8ad31977521ca1e-000

Just wait, it will eventually confirm. When I process large transactions they usually take hours to confirm. Smaller transactions usually go through quicker. There is a lot of randomness involved in the confirmation process and it might also have to do with the wallet you are using.

So don't worry, your transaction will eventually be confirmed.


Why are coinbase transaction outputs greater than reward? If the sum of the coinbase transaction's outputs must be less than or equal to the current reward (25 btc currently), why in practice do blocks have a slightly higher coinbase transaction output (for example this block has a coinbase transaction with an output value of 25.25058085 BTC.

The extra 0.25058085 BTC is the sum of the transaction fees on the block (each transactions fee is the difference between the value of the transaction's inputs and the transaction's outputs).

As you can see, this block which had no transactions on it, and therefore no transaction fees, had a coinbase transaction whose sum of outputs was exactly equal to the reward (50 btc at the time).


Need a cold wallet. Segwit, Lightning, Fees? I have all my coins on exchanges. I'd like to keep some in cold storage. I know I can create one at walletgenerator.net. But I'm scared because I think there might be a better way or it may not be worth it at all. If I'm going to lose 20% sending it there and 20% sending it somewhere else it's not worth it. What fees could I expect sending .1 BTC from an exchange to that wallet and the fee sending off there? I hear about segwit and lightning all the time, but have no idea how that works.

I don't think the wallet from walletgenerator.net is segwit or lighting, so is there a better wallet to use? Is it even worth it, or am I better off with LTC? Can you recommend an exerciser I can do with a small amount to quell my stress? Trading advice is everywhere, but finding reliable answers to wallet and security questions is near impossible.

Fees are not based on the value that is being transferred but rather the size of the transaction in bytes. The fee is to pay the cost of storing the data that makes up the transaction itself, not for the amount that is being transacted. Thus giving the fee as a percentage of a value will be completely inaccurate and giving a fee estimate for the cost of spending a given value will also be completely inaccurate.

When you are sending from an exchange, the exchange will usually pay the fee for you or they will tell you how much the fee will be when you send.

When you use a desktop wallet, the wallet will also tell you how much you are paying in fees. You can choose to also set your fee manually. Keep in mind that setting the fee to something very low can result in your transaction taking a long time to confirm.

To reduce fees when spending, you will want to use Segwit. Segwit effectively reduces the size of your transaction when you spend from segwit outputs. Segwit is completely backwards compatible (except for the new address format) and you can send to and receive from non-segwit addresses when you use segwit.

To use segwit, you must use a wallet that is capable of creating segwit outputs and addresses. There are two types of addresses, bech32 (begin with bc1) and p2sh nested (begin with 3) addresses. Bech32 addresses are new and not all wallets support sending to them, so it is better for you to use the p2sh nested addresses.

I recommend that you use Electrum. However Electrum does not support creating a new wallet with p2sh nested addresses. You can still use Electrum to do so by following these instructions: https://www.reddit.com/r/Bitcoin/comments/7mvw0m/psa_contrary_to_popular_belief_you_can_create/.

You should not use a paper wallet (like the ones created by walletgenerator.net) unless you aren't planning on moving your Bitcoin for a very long time. Paper wallets are, in general, more difficult to use and easy to get lost or damaged thus resulting in coin loss.

Lightning is unrelated to this.


How does a Bitcoin client know its transaction has been accepted by the whole network? Say Belly, Alice and Teddy are Bitcoin clients.

Belly makes a transaction to send 1 btc to Alice.
He broadcasts this transaction to the P2P network.
Teddy calculates a valid hashcode and add Belly's transaction into his block chain.

Then here is the question. How does Belly know his transaction has been accepted? Even he knows Teddy has added it into his block chain, this block chain can be rejected later if there is a longer block chain on the network, right? And what if Teddy is malicious and lying?

I heard you need to wait until 6 clients accept your transaction. I'm not sure what this exactly means. And why 6, not 5 or 7?

6 blocks, not 6 clients. The chances of catching up to the block with the transactions that is buried 6 blocks deep is slim. Granted of course that the dishonest party has not a very significant part (say less than 15% or so) of the hashing power. These changes can be calculated using Poisson distribution, as done in Satoshi's original paper (last pages).


Bitcoin core full node won't start on mac reboot! I had been running bitcoin core qt for a few months fine and then on rebooting my mac and opening the application the following prompt popped up

  Error: Cannot parse configuration file: specified data directory ""/Users/username/Library/Application Support/Bitcoin/"" does not exist..

I'm a long way from being technically competent but I'm 99% sure the data directory does exist.

Any advice on what else this could be? or what I'm doing wrong?

1) Place bitcoin core in the application folder
2) Start terminal
3) Paste

/Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt --resetguisettings

4) Hit enter


Possible to check who signed the transaction in a multi-sig transaction case? Say you have a multi-sig tx that originated from a 2-of-3 P2SH address.

Is it possible to say who signed the transaction? i.e. you can get access to the redeem script once the tx is broadcasted, and thus you have access to all 3 public keys that generated the 2-of-3 P2SH address. Arguably you can identify which public keys signed the transaction?

If yes, then how?

Is it possible to say who signed the transaction? i.e. you can get access to the redeem script once the tx is broadcasted, and thus you have access to all 3 public keys that generated the 2-of-3 P2SH address. Arguably you can identify which public keys signed the transaction?

Yes it is possible. When a transaction is broadcast, the redeemScript and all of the signatures are revealed and publicly available in the transaction itself. It is then trivial to just check which signature corresponds to which public key in the redeemScript. You just check the signature against each public key in the redeemScript and whichever one verifies tells you which public key corresponds to that signature.

Script interpreters essentially do this in order to validate multisig spends.


bitcoind service daemon So I am running bitcoind everything is fine and the blockchain got synced etc.
Next step is to have bitcoind starting on boot.
I get this error on starting the service after creating a nano /etc/systemd/system/bitcoind.service the erro is Error: Unable to create the PID file /home/path/.bitcoin/bitcoind.pid: Permission denied

thanks in advance.

It look like a permission read/write error, if you are sure about the bitcoin binary you are using, then try to run your command with sudo at the begining of it or try a sudo chmod 711 /etc/systemd/system/bitcoind.service which will give the proper right to the file you want to use.


anyone attempted a multiple p2sh(multisig) send (ideally using python)? I attempted to use pycoin to do a "create_signed_tx" in python, but had no joy: Do you think it might be technically possible to use spendables(UTXOs) from multiple source P2SH wallets in a single push to the network ? Anyone done this successfully yet(ideally using python)?

answer is yes, its possible: I was merely doing it wrong in my earlier attempt(s):
have posted a gist to illustrate how I got it working using a few python libraries on the testnet: https://gist.github.com/kumrzz/111f8ea12af3528f496cbe678d153fc0


How convert a mnemonic phrase back and forth between different number of words? I'm relatively new to cryptocurrencies in general and I've tried using Bitcoin and a few altcoins, but it always bothers me that some digital assets are not available in all wallets. To my understanding, I could use the same mnemonic phrase in all wallets, even if some assets are not listed, if that's true I wouldn't have to store a different list of words for each wallet. The only problem is that most popular wallets support a different numbers of words in the mnemonic phrase. Is it possible to convert back and forth between say, for instance, a 24-word phrase to a 12-word phrase, and what tools can I use to make the conversion?

Is it possible to convert back and forth between say, for instance, a 24-word phrase to a 12-word phrase, and what tools can I use to make the conversion?

No, that is not possible. The mnemonic words represent an entropy, for example the 24 word mnemonic phrase represents 256 bits of entropy while a 12 word mnemonic represents 128 bits of entropy. These mnemonic words are passed to a PBKDF2 function to generate a seed that will then be used to generate master keys for different tokens. It's also important to note that if you use a passphrase to your wallet, that passphrase will be used as a 'salt' in the PBKDF2 function and will generate a completely different seed, had you not used a passphrase.

  To my understanding, I could use the same mnemonic phrase in all wallets, even if some assets are not listed, if that's true I wouldn't have to store a different list of words for each wallet

Care has to be while doing that as many wallets use different paths of master key generation. If you use multiple wallets interchangeably, try to note the derivation path. For example, say hardware wallet A uses m/49'/0'/0' as the path, it will generate completely different addresses as compared to a wallet that will use a m/44'/0'/0' derivation.


Where Bitcoin is kept and what fees are included when liquidating Bitcoin I have small question, where does bitcoin "banks" keep money you pay them for bitcoins? do they keep it in some kinda bank ?

and when we sell bitcoins to dollars what fee do we pay?

Bitcoin "banks" are markets, not savings institutions. When you buy a bitcoin, you have bought a bitcoin; the money becomes the seller's. When you sell a bitcoin the money becomes yours and the bitcoin becomes theirs; similarly when you buy something with a bitcoin.

Since the value of bitcoins is not nailed down, there's no question of a transaction fee; you just agree with the other person on what the price of the goods is in bitcoins (or on what the conversion rate to/from other currencies will be). If you don't like the price or rate one person charges, you go elsewhere.


Can you have a transaction without a change output? While reading about the fees here https://metamug.com/article/security/bitcoin-transaction-fee-satoshi-per-byte.html
The article said that "In the simplest case, you'll have one input and two outputs (the recipient, and change). So in=1 and out=2."
Does that mean that I cannot send the entire amount from one address to another? I thought that the simplest case is in=1 and out=1. And that in = out + fee

Yes, absolutely you can. I think the article intend "the simplest case" in the real world usage, where is highly unlikely that you have to pay the exact amount of one of your UTXO, if not they are wrong and your example is the simplest transaction you can made.


The bitcoin mining algorithm from a programmer's viewpoint This page: Blocks said mining is actually to solve a mathematical problem, but reading Block hashing algorithm doesn't give much help.
I also tried reading bitcoind source code, but reading code takes much more time than reading documentation:)

And I have written a simple json-rpc client to call getwork() method to fetch the "data", but what should I do next to this "data"?

Anyone could explain the mining process in programmer's view?

The Mining Algorithm is as follows:

Step 0 - Retrieve the hash of the previous block from the network.
Step 1 - Gather a list of potential transactions known as a "block". This list of transactions comes from the peer-to-peer bitcoin network.
Step 2 - Calculate a hash for a block of potential transactions along with a random number.
Step 3 - If the hash is more than the currently set difficulty level, then you have mined that block.
If not, start over from Step 1. Any additions to the list of transactions from step 1 along with change in the random number from Step 2 mean that there's a chance that the criterion will be met in the next go around.

From a programmer's view, the pseudo code might look something like this:

P := The hash of the previously mined block
B := A block of transactions
H := A hash function
D := Difficulty Level

0 Retreive P
1 Construct/Modify B
2 IF H(P, B, Some Random Number) > D END
3 GOTO 1

I should warn you that there are a few inaccuracies in that description, but for the most part, that should be good enough. And here are a few more useful clarifications:

What's a hash?

A hash is a function that converts data into a number within a certain range. The hash has the property that knowing it's output is essentially unpredictable (within the given range). The specific hash function used for bitcoin mining is SHA256 applied twice.

How does the difficulty level work?

This unpredictable nature of the hash function means that putting in random data (the transaction + the random number) will essentially produce a random number within a certain range. Further restricting the range of the desired output affects how likely one is to find it in a single round. This creates a way to probabilistically determine how often a solution will be found based on the number of times the algorithm can be run on the network. Specifically, when you hear the term "gigahashes" or "terahashes", this refers to the number of times Step 3 can be run. As the number of hashes per second across the entire network grows, the network automatically raises the difficulty such that a solution will be found within about 10 minutes.

What happens when a block is mined?

When a block is mined, the miner sends the block to all other miners on the network as evidence that it has found it. This block contains a list of transactions, the found hash, the specific random number, and a reference to the previous hash. As each miner receives the newly mined block, it removes all transactions that it is currently mining that exist within the block (because they've already been confirmed in the block chain) and broadcasts the block to other miners that do the same thing. The propagation happens pretty quickly.

Note: the original miner of the block gets a "miners' fee", which is a reward consisting of any unspent coins from transactions in addition to a "coinbase" reward. The coinbase reward started out at 50 bitcoins and halves after every 210,000 blocks (about once every 4 years). The coinbase reward will eventually get so small that it will be miniscule compared to miners's fees.


How do I reduce the Bitcoin transaction fee? I am using Bitcoin Wallet v5.09-v5.10 on Android 6.0.1. Is there a way to lower the Bitcoin transaction fee?

Yes, use Send Coins > Options > Fee to select one of three fee levels. The actual fee is dynamic and depends on the byte size of your payment. Use

Priority if a payment is urgent
Normal if you want confirmation roughly within the next hour
Economic if you don't care about confirmation times (mostly if you're sending to another wallet of yours)


How does a mix between Proof of Work/Stake work? (Peercoin) I think I understand Proof of Stake and Proof of Work from a conceptual point now. For themselves both are good ideas for sure, but how would a crypto currency like Peercoin (PPC) combine both of them? I mean, when active clients are waiting for the stake and they are contesting against others, there are also at the same time the normal miners using Proof of Work, calculating hashes.
How is it then decided who will actuallly create and publish the next block? Some kind of prioritisation must be built into the currency. But then again, when some Proof of Work is done the block will have the threshold included for calculating the next hash. What is to be included by Proof of Stake clients?

I really hope to get how that connection works, that would be brilliant if someone could explain.

Thanks

I am not an expert on Peercoin, but a hybrid consensus model of Proof-of-work (PoW) and Proof-of-Stake (PoS) already exists with Decred (DCR), and I know a couple of things about it.

Differences between PoW & PoS:

PoW needs miners who use mining hardware to find blocks and verify new  transactions sent to the network.
PoS needs stakeholders who stake/lock up coins to validate blocks already mined by the miners. The stakers can vote to invalidate blocks created unfavourable PoW-mining behaviour, like mining empty blocks.

Similarities between PoW & Pos:

Both PoW- and PoS-miners have voting power to create consensus of code changes on the blockchain.
Both PoW- and PoS-miners gain block rewards or a percentage of the reward.
Both PoW- and PoS-miners can use mining pools for a more consistent and stable flow of funds.
Both PoW- and PoS-mining are methods of making the network more secure against attacks.

Decred PoS ticket system (simplified):

Tickets have a price. e.g: 100 DCR. (see https://dcrstats.com for current ticket price.) This amount varies depending on how many tickets are are bought in total on the network. When you buy a ticket, the amount is staked/locked up and is still in your ownership.
After a period of time (from 28 days to 142 days), if the ticket has successfully vote, then the DCR are sent back to your wallet + a portion of the block reward. This reward amount varies depends on many factors, and can be everything from 10-30% reward per year.
Decred is developing ticket-splitting pools so stakers wouldn't need the whole ticket price to begin staking.

I looked up PeerCoin (PPC) Staking/Minting

Staking PeerCoin is done by having the coins stay in your synced wallet. This means you are running a PeerCoin node, and this will reward you ~1% per year. This is called 'Minting'. (Read https://peercoin.net/minting for more info.) I didn't find many technical details in the Whitepaper of PPC.

I hope this clarifies some things about PoW/PoS Hybrid Consensus System, and I'm sorry I can't provide more specific info about PeerCoin.


OP_CHECKSIG signature hash type 0 On the Bitcoin Wiki's OP_CHECKSIG documentation:

  Firstly always this (the default) procedure is applied:

  the public key and the signature are popped from the stack, in that order. If the hash-type value is 0, then it is replaced by the last_byte of the signature. Then the last byte of the signature is always deleted.

The signature format is:

  0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] [sighash]

In case if hash type is 0 then we should  get last byte from [S]
and remove it I think it will corrupt signature!

Maybe I don't correctly understand this documentation. Could anybody explain the correct behavior in this case?

I've done some testing with pybitcointools and one of the BitcoinCore test vectors with a SIGHASH of zero.

For SIGHASH =0, the Tx which is signed

It's just a matter of appending 4 nullbytes, instead of 01000000, to the signing transaction.

The Core software checks for this non-standard hashtype now, however we can see there's no problem in validating these rare transactions since the code only checks for SIGHASH ACP, SINGLE & NONE. See Python-Bitcoinlib's code for a Python interpretation

See this test vector, where the hash being validated is 11743b220e9e24e89abd4ff124a2740531fe7d7f9b4e26de14710a532fd543e2.

FWIW, Pybitcointools needs to have the txhash function edited so that instead of if hashcode:, it reads if hashcode is not None:. The else clause in that function was confusing me, but it appears to be for hashing signed transactions (ie to return the TxID)


Raw block / other messages Where can I find a raw version of the Bitcoin blocks and other messages that are sent between the Bitcoin clients?

The wiki describes this:
 - https://en.bitcoin.it/wiki/Protocol_specification#Common_structures

BlockExplorer will show the raw data.  For example:
 - http://blockexplorer.com/rawblock/00000000000008d11f13eed2e13f2765eceaf00de36e0ec040a10cc3738bdc74


Why is BIP-147 (Dealing with dummy stack element malleability, part of segwit) necessary? Given BIP-11 (M-of-N Standard Transactions) it's not clear why BIP-147 (Dealing with dummy stack element malleability) is necessary.

BIP-11 states:

  OP_CHECKMULTISIG transactions are redeemed using a standard scriptSig:

OP_0 ...signatures...

  (OP_0 is required because of a bug in OP_CHECKMULTISIG; it pops one too many items off the execution stack, so a dummy value must be placed on the stack).

Yet BIP-147 claims:

  A design flaw in OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY causes them to consume an extra stack element ("dummy element") after signature validation. The dummy element is not inspected in any manner, and could be replaced by any value without invalidating the script. ... [my emphasis]

This statement appears to contradict BIP-11, which clearly requires OP_0 as the first validation script element.

I can think of two reasons for BIP-147:

BIP-11 doesn't explicitly require the stack to be checked but just that a multisignature validation script begins with OP_0;
BIP-11 doesn't apply at all to OP_CHECKMULTISIGVERIFY.

Are these indeed motivations for BIP-147, and are there others?

BIP 11 is not a consensus rule, but a recommendation on how to use multisig on the network.

BIP 147 is correct in describing the existing network consensus rules: OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY pop one element more off the stack then needed, and ignore that element. BIP 147 changes the rule to make these opcodes not ignore the element, but require it to be a 0. To be compliant with BIP 11, transactions already had to put a 0 zero there, and in practice everyone always has. But there was no requirement that transactions follow BIP11 - it was just a recommendation for better interoperability. With BIP147 it becomes required to have a 0 there for every transaction to be valid.

The reason for changing this is malleability: currently, anyone can take a valid transaction that uses any of these opcodes, and take the 0 and replace it with anything else, without invalidating the transaction.

Ideally, we would want to fix the bug entirely, and make OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY  not pop off an unneeded stack element. However, that would be backward incompatible, and thus only apply to new transactions if we don't want to break existing software. The approach in BIP147 applies to all multisig transactions.