How to specify the right input and output to be signed for SIGHASH_SINGLE For my understand, when building a new TX, need to produce a new scriptSig for the TX; and need add a sigHash code at the end of the TX. If the sighash type is SIGHASH_SINGLE, for a TX with multiple input and output, how to specify the right input and output to sign.

A signature is applied to the input being signed by default, so you don't really pick the input.

You have two options:

SIGHASH_SINGLE - All inputs are signed, and a single output with the same vout index as your vin index is signed. That is to say, if you have a tx with 5 inputs, out of which your input is the second one, and 4 outputs, all five inputs and the second output will be signed.

SIGHASH_SINGLE | SIGHASH_ANYONECANPAY - This will only sign your input and the corresponding output, instead of signing all the inputs. Essentially, in the above example, input 2 and output 2 will be signed.


Recover Bitcoin From Transaction ID Back in 2013 I bought some bitcoin for a relatively low price, and stored them in an Electrum wallet on my PC. However, I changed PCs a year or two later, and forgot to copy the bitcoin wallet over.

Given the current soaring price, I now have a renewed interest in trying to recover these seemingly lost bitcoins.

I took a screenshot of the blockchain.info page that was displayed shortly after the transaction was completed. I believe this shows the transaction ID, plus the wallet Id it was transferred to.

Here's an edited version of the page I screenshotted, obviously with the IDs hidden so no-one else steals them :)

I've tried revisiting this website, based on the previous URL, which I believe was the transaction Id. I receive an error: Invalid Transaction Hash

Now, obviously bitcoin has split in two, and this was pre-split.

So, what are the various values that are shown on the screenshot (top left appears to be transaction id, bottom right is my wallet id?)

And can any of this be used to rescue the bitcoins?

All of the information in the screenshot is publicly available.
And no, they won't be useful for recovering your Bitcoin.
If you used Electrum, you either need the wallet, the recovery phrase(seeds) or the private key(s) to recover you Bitcoins. Note that when you first create your wallet, you are instructed to write down the seed (12 or 13 dictionary words), so if you followed the instructions and still have the seed you can recover the wallet.


Unconfirmed BTC transaction / TXID doesn't exist? I recently tried sending some btc to coinbase.  In a hurry I did not put a transaction fee.  I've tried to explain to their customer support what is going on.  I offered to charge me a fee through my wallet on coinbase to do a pay for parent protocol. Their lack of understanding is making me worry.  I tried using ViaBTC.  I put in the transaction ID and they said the TXID did not exist.  Any suggestions would be appreciated.  Its approaching 7 days now.  Thank you.

In any case, receiver (Coinbase) can't do much to make your transaction confirm faster. Except CPFP, but you can do the same with your change output, if you have it. But, as mentioned above, if tx fee really is 0, it will not be relayed by the network, as default relay fee is 1 satoshi per vbyte. Also, in 7 days it should have been confirmed, as mempool clears out regularly at the moment. I bet you will not see that transaction by txid in any public block explorer either. So, you should just send them again from the wallet you initially send them out.


Restore Block.io multisig wallet in Electrum I've exported my private keys from Block.io. They're compressed WIF keys (starting with L...).

Additionally I've got the following data from Block.io:

Address type: P2SH (obviously)
Redeem script
Redeem script hex
Two public keys

I've tried to restore that wallet in Electrum with the information I have. But as far as I understand, Electrum needs extended private keys to restore the wallet, right?

So, is there a way to restore that wallet? Maybe in a different wallet client? I've researched a whole evening but couldn't find the answer.

I knew that but I hadn't enough reputation to comment.

I have found a solution. I've got my BCH today from block.io which was already empty but it had a BTC on the day of fork.
So what you have to do is:

First of all you should get from security settings of you block.io profile: "Redeem Script Hex", and two private keys. (actually you will have some more strings and values but only these three required to claim your BCH).

After that:

Go to http://www.motelmaya.com/BCH/BCH.html

I know this seems strange and may cause doubts and believe me I wasn't sure too. But the real deal was: getting BCH (I had 0,5 of BTC at block.io wallet) or getting nothing.

So, then:

Click +TX
Enter the redeem HEX that you received from block.io in the first box (Address, WIF key or Redeem Script)
Click on "Advanced options" -> "Network" -> Settings and change the network to "Bitcoin Cash (mainnet)"
Click New -> Transaction or +TX once more.
Put in the amount you want to transfer and the address you are sending to (your new BCH wallet I guess - I've used my blockchain.info wallet address), make sure that the fee is not too high (I've entered something like 0.000317
Click "Submit", you will get a long HEX string. copy it
Click "Sign", paste the copied string, paste the first private key from the  block.io to the "Private key" field, click "Submit", copy the string.
Paste the string into the second box (below the "Private key" field), paste the second private key from the block.io, click Submit, copy the output
Go to "Broadcast", paste the string and click "Submit".

That's it. You will recieve TXid which you will be able to check at https://bitcoincash.blockexplorer.com

Actually all regards should go to ohad serfaty but I can't comment the post where he advised this method because of low reputation.

Good luck!


Can arbitrary transactions be aggregated? Is it possible to take multiple transactions in the form:

[A->X] , [B->Y] , [C->Z], where A,B,C,X,Y,Z are arbitrary, unrelated Bitcoin users/wallets

and aggregate them to a single transaction:

[inputs:(A,B,C) outputs: (X,Y,Z)]?

Why yes or why not? Is it possible for some types of transactions and not others?

It might appear as a weird question, but it is part of a research I am conducting, so please feel free to elaborate regarding the technical details (so I will know where to pursue the matter further).

Yes and no.

This can be done for all types of Bitcoin transactions, but only collaboratively by the senders controlling A, B and C. There is even a protocol available to find partners which is called "CoinJoin". The idea is to increase privacy, although this is not necessarily achieved by CoinJoin, as it is often easy to calculate which inputs would correspond to what outputs.

Transaction aggregation cannot be done by third parties or only a subset of the participants, as a signature in Bitcoin needs to cover the complete transaction data. Therefore, to update a transaction with another input and more outputs, all the original signatories need to add their signature again as well.

If you're interested in the topic, you should look into the following keywords:

Transaction cut through
CoinJoin
Mimblewimble
"Schnorr Signature Aggregation"
RingCT or Ring confidential transactions on Monero


addnode in bitcoin.conf doesn't work (Regtest mode) I'm trying to make to nodes on the same computer communicate.
I set up two bitcoin folder with two bitcoin.conf files.
bitcoin.conf in the second node is the following:

rpcuser=bitcoinrpc
rpcpassword=roiroiroiroiroi
addnode=127.0.0.1:18444

while in the first node is just I've just set the rpcuser and rpcpasswords

Now I start the nodes with the following command

First node
./bitcoin/src/bitcoind -regtest

Second node ./bitcoin/src/bitcoind  -regtest -rpcport=5444 -port=18888 -datadir=/Users/tommaso/.bitcoin/

But they don't connect to each other.

Only if a run the command ./bitcoin/src/bitcoin-cli  -regtest -rpcport=5444 -datadir=/Users/tommaso/.bitcoin/ addnode "127.0.0.1:18444" "onetry"
 they finally connect

Why does addnode=127.0.0.1:18444 in bitcoin.conf doesn't work?

well im late but i can tell.

it works, use following string

addnode IP:8333 add   but the Port you dont need to show, because everyone uses the same port, because thats the one he set as open on his router. the rpc port must only defined once at startupt. in addnode dont use it, because you could be bound on an IP too via the bind= command, then the server dont know what to do.


Can anyone explain the differences in behavior of getrawtransaction and gettransaction in RPC? I right clicked the transaction history in the QT client and pasted in the TxID below.

Q1

In the following test, can anyone explain what the purpose of the suffix -000 is and what it's used for?

gettransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000

Q2

Why doesn't a raw transaction support the same transaction ID format as the previous command?  (I need to remove the -000 characters)

getrawtransaction 54b9be14443b152b02ed0b18d27504631cccfa84ce9ada03f9558fbb85b6129c-000
ERROR: parameter 1 must be hexadecimal string

Q3

When I enable index=1 in bitcoin.conf and reindex, why can't I call GetTransaction for transactions not in my wallet?  I would like JSON friendly results

Q1: A ledger entry in the wallet view corresponds to a single output of a transaction. The suffix is there to distinguish which output of the transaction is used. It's a bit of strange choice to format it that way; in most places, ':' is used as a separator.

Q2: getrawtransaction queries the memory pool, the set of unspent transaction outputs and the blockchain (if txindex is enabled) for a transaction. It doesn't query a single output, so you pass in just the hexadecimal identifier. You can query individual unspent transaction outputs using the gettxout command (which takes a txid + the output index as separate arguments). You can pass an extra 1 as argument to getrawtransaction to have it decoded, instead of just the raw hex. decoderawtransaction can do this for arbitrary hex-encoded raw transactions. Perhaps this is the answer to Q3.

Q3: gettransaction is a wallet RPC. It cannot operate on anything else, as it needs the higher abstraction layer. It computes debit/credit and fee, which requires identifying which outputs are from/to you, and which are change. This requires knowing what keys belong to you. It does not query the blockchain, but you can use 'getrawtransaction [txid] 1' to get a decoded form of blockchain transactions (with txindex enabled).


Is it always necessary to be in the pool with the most miners joining to have the most profitable mining pool? I realise that opinion on a specific pool is subjective and prone to change.

My question: If I am in pool A and additional miners join then my share in the pool is reduced proportionately. Additionally, the pool received more block find rewards proportionately. Similarly, the reverse if users leave the pool. My mining reward in the pool is largely unchanged.

If miners join pool B then pool A finds lees blocks proportionately and my mining reward is also reduced. The reverse is also true.

It seems that the most profitable pool, with all other things being equal, is always the pool with the most miners joining? Both because they are not joining pool B I do not suffer any loss (or, they are leaving pool C) and, because the new miners are joining pool A I do not suffer any loss.

It seems like the ideal scenario is for pool A to syphon all users from all other pools and become a conglomerated 'Mining Central'? Or rather, for all other miners in pool B and C to quit.

Please correct my assumptions if they are wrong.

This isn't correct.  Your reward is reduced (in the long run) by the same amount whenever a new miner joins, regardless of whether they choose your pool or a different one.

If they choose your pool, it's true that your share of the pool decreases, and the pool's share of the total rewards increases, but these changes don't completely cancel out.  The net effect is a decrease in your reward.

Let's try an example with small numbers.  Suppose there are 10 miners in the world, all having equal hash power.  6 of them, including you, belong to Pool A, and the other 4 belong to Pool B.  So Pool A collects 6/10 of all rewards, and you get 1/6 of those, so you are getting 1/10 of all rewards.

Now suppose a new miner joins Pool A.  Pool A will now get 7/11 of all rewards, and you get 1/7 of those, so you are now getting 1/11 of all rewards - less than before.  If you work out the numbers, the pool's fraction of the total got multiplied by 1.06, and your fraction of the pool got divided by 1.16.

If the new miner joins Pool B instead, Pool A now gets 6/11 of all rewards, and you get 1/6 of those, so your share of the total is again 1/11.

As such, ignoring differences in pool administration fees and such, you get rewarded the same whether you are in a large pool or a small one.  The only difference is that in a large pool, your rewards will be paid out more steadily as frequent small payments, while in a small pool, you will tend to see infrequent large payments instead.


How long should I expect to wait for payout on p2pool Basically, I have 20 GH/s running on p2pool I've had no pay out for about 4 days which seems a long time.

The time to share is also 110 hours and stays at 110 hours. It never drops and so am getting 0 shares in 5 days.

Basically my question is this normal? will it suddenly kick in or is there something wrong with my setup.

Just needed to be patient, is sorted now.


The status of the transaction I send 0.00528479 BTC to the address 1HkqAUTgCgnnMP1CconWudxWAT3fMVpLtw with network fee of 0.0001 BTC. i checked the status and i dont know whether confirmed or not. one shows in green colour and one shows in red Color. kindly help me.

The bitcoins were received by the address and then spent, leaving the address with no balance. It appears both transactions are confirmed.


Help about BitlyCore Please I need help. I want to know if anyone knows about BitlyCore.com I have been running the full block for days now and it's just stuck at 87% please I need help.

It's a scam, it will never reach 100%. Your money is gone. You can report the theft to your local police but they won't be able to recover your money for you.
A safe website to find guidance on Bitcoin wallet software is https://bitcoin.org/en/choose-your-wallet
The correct website for downloading Bitcoin core is https://bitcoincore.org/en/download/
Ignore any other websites offering a wallet whose name ends with the word "core". There are many scammers who exploit the lack of knowledge of people new to Bitcoin.

See also

Bitly core website not loading
Please i need help about BitlyCore.com
Bitswallet core

It will help to also read

Can't spend Watch-Only coins, have I been scammed?
How can I get a private key for this address


If SegWit only increases the capacity to only 2-4x only. Wouldn't we have the same issue in a few years again? If I understand correctly. SegWit is one of the solutions to the full 1MB block problem that doesn't require a hard fork. But I've read this only increases the 1MB to maybe about 2-4x only. If that is the case, wouldn't we have the same problem down the line when transactions reach that level again?

Just like a hard-fork blocksize increase SegWit  will not solve the scalability issue by itself. Either provides chiefly a fixed factor increase in capacity.

SegWit is also a way to kick the can down the road, but in comparison to the hard-fork blocksize increase, it also solves other issues, doesn't require a hard-fork, and makes blocksize increases less problematic: SegWit resolves an issue where transactions require quadratic effort for verification. The problem was highlighted by the "megatransaction" created by f2pool last July. While capacity only increases linearly with bigger blocks, effort to verify blocks increases at a super-linear rate. For SegWit transactions the transaction verification takes linear effort, making bigger blocks cause less of an advantage for the author of the latest block. Hence, SegWit helps reduces centralizing pressure on mining in the face of capacity increases.

On-chain scalability is always limited to linear growth anyway: For every transaction that you resolve on-chain, you need to provide the storage space on-chain. While we will be able to go down that route for a bit, it is unsustainable for large amounts of transactions and we wouldn't be able to reach e.g. the transaction counts corresponding to the payment counts of credit card companies.

Scalability improvements need to make better than linear use of the blockchain capacity.
Unlike a hard-fork blocksize increase, SegWit sets the stage for further improvements in the future. One promising proposal is the Lightning Network, which compounds numerous payments at the cost of two or three on-chain transactions. Another exciting improvement is the introduction of Schnorr signatures. Schnorr signatures are smaller than ECDSA signatures, but due to their homomorphic nature allow for both signature aggregation and key aggregation. In addition, Schnorr signatures enable the use of adaptor signatures that allow for a wide range of smartcontracts to be created with Scriptless Scripts.

Last but not least, SegWit introduces Script versioning. This allows to specify which version of Script to use to interpret a transaction, allowing multiple versions of Script to coexist safely at the same time in the network. Script versioning allows much easier deployment of Script improvements to expunge bugs and vulnerabilities, or to add new features like Schnorr signatures.


Is it possible to run HD derivation with an encrypted master node or seed? Given either a seed or the private part of a master node, that is encrypted using AES-256-CBC (or another secured symmetrical cypher) with key K, is it possible to run derivation such as described in BIP32 to obtain derived private keys also encrypted using the same algorithm and the same key K?

It seems like you are looking for an encryption scheme which allows operations to be performed on cipher text, which would result in the same as the same operations being applied to the unencrypted data.

Example: Homomorphic encryption which supports addition

E(data0) + E(data1) = E(data0 + data1)
k being the encryption key, and E(...) the encrypted cipher text.

In then case of HD keys, the desired encryption scheme would need to enable the following

hd_child_derivation(E(m)) = E( hd_child_derivation(m) )
hd_child_derivation() involving a HMACSHA512 function and EC-point operations

I am not sure which encryption schemes would fulfil the above requirements, but fully homomorphic encryption schemes seem to be possible: https://crypto.stanford.edu/craig/craig-thesis.pdf


WSL PATH command help Following these intr: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md I have retrieved a git for a crypto. But I am hung up on the step where I add the PATH command. Per the instr:

PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var.

I am unsure of what to place in this command. But obviously need to put a correct file location for my git? Any help appreciated.

It is a command that you enter into the command prompt. This isn't a file or something that you have to add to a file, just type it (or copy and paste it) into the command prompt once the bash shell is running.


BitcoinCore 0.13 HD wallet chain structure What are the "paths" of keys from BitcoinCore 0.13 HDWallet?
As is described in BIP32
, I consider a path to be the route from the root node to the key node. For example, m/0'/0'/1' stands for the second hardened child of the first hardened child of the first hardened child of the master root node.

I want to know that to be able to regenerate this chain myself using some bitcoin library in case gaps in my chain will exceed 20 keys (current default gap value of BitcoinCore 0.13).

It uses m/0'/0'/i' with i incrementing over time.

The dumpwallet RPC command will produce a text file with all private keys in it, including the BIP32 seed.


Why did my Coinbase transaction take 4.5 hours to get in a block? Why did this transaction take so long to be put in a block?

I initiated a 7 BTC transfer at 6:13 PM Eastern Time from Coinbase to an external address in an over the counter transaction today. It was put in a block 4.5 hours later (10:42 Eastern Time)

Not conducive to doing business at all :(

I checked /tried these things:

I saw many blocks had been mined since my transaction was initiated at Coinbase.
I saw there was a fee on the transaction
I tweeted an inquiry to Coinbase
I saw Coinbase was connected to 118 peers
I saw other Coinbase transactions posted after mine confirmed within 20 minutes.
I tried to manually broadcast the raw transaction on blockchain
I read Coinbase blog post that they had slow confirms in February.

Brian from Coinbase here.  Sorry you experienced delays!  There have been some issues in the past that we are working to improve.  Coinbase sends a high volume of bitcoin transactions (often in parallel across many machines), and as a result we sometimes encounters issues that are uncommon elsewhere.  In this case, I believe the root of the issue was around spending coins where the inputs were not in a block yet.  We broadcast a large number of transactions, and sometimes other nodes receive them out of order (the transaction that spends the change could arrive before the transaction that generated the change).  The official client, bitcoind, had an issue (unclear whether it was a bug, or intended) where a transaction in the orphan pool that got connected up (it's input transaction finally arrived) did not subsequently get relayed to the rest of the network like a regular transaction.  We've been chatting with Gavin about this to see what solutions could make it into a near term release.

An issue like this could cause it to not be relayed to most/many miners, which is why it would take a long time to make it into a block.

As a short term fix we manually push transactions to well connected nodes like blockchain.info to ensure they are well propagated.  Thanks for bearing with us as we continue improving things. Experiences like this are definitely not what we strive for.  Hope the explanation helps!


How do I get my Ravencoin wallet address on Ravencore? Very new to this, and couldn't find help on Google.

Click on receive on the left vertical bar. Below the input boxes you will see "Request Payment." There you will be able to see your address.


Can I be the transaction processor and take in transaction fees as income without mining a Bitcoin? Can I be the transaction processor and take in transaction fees as income without mining a Bitcoin?  Would the fees be so low that it is not practical?
Or is it true that I have to be a miner in order to process any transaction? However, after year 2140, when all Bitcoins have been mined, then will people only use the computer to process transactions without doing any mining?

No. When miners mine blocks, that is "processing transactions".


Are Bisq offer ids picked or partially picked by humans? Two recent Bisq "offer ids" are:

"emzlols-7639fae0-cd4d-48cf-acc5-abc97dab89db-124"
"aixcp-6efe1e8d-90bf-4c25-b021-53616cad1109-124"

(Emphasis mine. These are fully public, so I don't see a reason to redact/censor them here.)

I can't help but notice that the first says "lols" in it. Is this a pure coincidence, auto-generated randomly, or are these id strings somehow picked by the offer makers/sellers? At least the first part before the first dash?

Bisq Offer IDs are randomly generated and consist of 3 parts separated by "-":

Prefix: between 5 to 8 characters in length
Randomly generated UUID: 5 sections of 4, 2, 2, 2, & 6 hex values separated by "-"
Bisq Version: "." separators removed

In your first example, emzlols-7639fae0-cd4d-48cf-acc5-abc97dab89db-124, emzlols is the Prefix, 7639fae0-cd4d-48cf-acc5-abc97dab89db is the Randomly generated UUID, and 124 indicates a Bisq Version of 1.2.4

The IDs are created in a method called getRandomOfferId() in the bisq.core.offer.CreateOfferService class as of Bisq v1.2.4.

The Short ID for an offer is its Prefix.


Public key with 142 characters? I've read that public keys that bitcoin uses have 130 characters (65 bytes), but on the page: http://blockexplorer.com/tx/7e9bf03454b9ff80974d39d02a8088154e60ee65726e239f70341366d1a1ccf7
I've found a public key: 30440220fe5322474a08626beac8fd44b9854fa3af52c14848993a9216b18b29793539f40220dd66a46dc1daa3d0d33fae22b7cc8ee3c753b062cc2e1a3be76183ee1f9dbbcb01 (140 characters), in addition the public key doesn't start with '04'.
There are a lot of keys with 140 characters. Is https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses wrong or have I missed something?

The public key is the 2nd word in the scriptSig but you're looking at the first word.  That's the signature.  Signatures are 71 to 73 bytes (142 to 146 characters) long.  I think you must have miscounted when you wrote that the one you found had 140 characters.

In the example you're looking at, the public key (i.e. the 2nd word in the scriptSig) is:

04
73769dda763e1f3f0ff1ca65343ed27279d73a63eaf88ca93714f0605d5d06bd
6d57cc6c3097909c5e0947341201d4960e4e16598687aa29c7b6c4675b7d66b6

and is 65 bytes long, as expected.


Controlling bitcoind connection bandwidth The bitcoin github repo has a  bash script given to control the flow of outbound traffic by using the bash script given  on : https://github.com/bitcoin/bitcoin/blob/master/contrib/qos/tc.sh

I am running two bitcoind instances on a local machine with different ports: 18441 and 18442, how do I make use of this script or tweak it, to control the connection bandwidth between the two bitcoind instances ?

If you're running two bitcoind instances on one machine, depending on the use case, you may instead be better off by connecting one to the other only, and not make it talk to the network. This will reduce the total bandwidth used significantly, as every block and transaction will only be fetched once.

Run the first one normally, and use -connect=127.0.0.1:18442 on the second.


Are Bitcoin transaction fees competitive? I was listening today to their conversation about the transcation fees in Bitcoin and Michael Sailor's understanding stroke me as inaccurate.
Is there any direct incentive within the Bitcoin protocol itself to lower the fees?
I've found some people on the Web who claim that including a small number of feeless transactions is incentivized, allegedly in order to decrease the difficulty of finding the nonce.
I'm not sure about this matter - hence the question.
I'm aware of a range of indirect incentives like the incentive to try to keep Bitcoin users away from using other blockchains. There is also the incentive to collect as much with fees as possible in order to reinvest it in ASIC and the infrastructure. Such indirect incentives are outside of the scope of this question.
From what I read, the inner workings of mining are the following:

New transactions are broadcast to all nodes.
Each node collects new transactions into a block.
Each node works on finding a difficult proof-of-work for its block.
When a node finds a proof-of-work, it broadcasts the block to all nodes.
Nodes accept the block only if all transactions in it are valid and not already spent.
Nodes express their acceptance of the block.

First, a miner takes the transactions and their fees (step 2), and only after this step they compute their POW (step 3). However low the block reward, it
is still the fact of solving the puzzle that determines which node is going to confirm their block. I've found nothing
in the whitepaper that suggests that there is any relation between the fees of the transactions that were collected and the likelihood of
computing the POW.
There seems to be nothing baked into the protocol that can directly stop any miner from producing let's say almost empty blocks or blocks with transaction fees of their preference so long as they are winning POW contest and the transactions are valid.
Decades ahead in the world of diminished block rewards any miner's attitude towards the transaction fees does not give them any competitive advantage over another in finding the nonce... is my understanding correct?

There is no advantage or disadvantage for miners to include transactions, except for:

If they don't include transactions they don't receive the fees (which are still dwarfed by subsidy for now, but perhaps not forever), though fees can also be paid out of band.
It takes some time to build a block candidate with new transactions immediately after learning about another miner having broadcast another block. This time is short, but nonetheless nontrivial and may represent a loss of income (through subsidy) if it is wasted. Some miners therefore start working on an empty block immediately (which is certainly valid), and only in a second step switch to a candidate that includes transactions.

Bitcoin's consensus rules have no hardcoded amounts in them besides the subsidy. This means that miners are free to pick whatever transactions they like (as long as they are valid), regardless of fee. Due to block resource limitations (size pre-segwit, weight post-segwit, sigops, ...), the optimally rational choice tends to be to prefer transactions with high fee per weight. This effectively creates a block space market, where transaction creators bid for the rate-limited space available in blocks.
Some protocol rules on the public P2P network have additional rules for relay. For example, there is a minimum relay feerate (1 sat / vbyte), and replacement transactions have to "pay" some feerate for the bytes of the transactions they replace. Their minimum values are not set by the market, but by policies implemented by the network's node software. They can also be bypassed by submitted directly to miners. During times of contention, these rules are mostly irrelevant, as the markets will force transactions to pay higher feerates anyway.
A long time ago, the default mining software that came with the Bitcoin client included a policy that would reserve a small area per block for "free transactions", which were selected based on "priority" (which was defined in function of age and value of the UTXOs spent rather than fee). I believe this was intended to promote cheap transaction usage. It was purely a client-side choice that was uneconomical for miners.


Can I import my wallet while my btc core is syncing I'm upgrading my btc core to v0.18.1. I'd like to export my wallet to electrum. Is it possible while syncing? How?

Like this?

  This guide is intended for users of Bitcoin-Qt who do not want to wait for their wallet to be synchronized with the network, which may take many hours or days depending on the hardware spec. The guide teaches users how to transfer their coins to Electrum bitcoin wallet, which has lower security but a faster startup time.

To answer your question, yes you can.  Syncing the blockchain has nothing to do with your private keys.  Electrum has a list of blockchain servers to use your keys with immediately.


How does one node connect to other nodes I am wondering how does one client connect to whole blockchain system if there is no centralized node which connecting other nodes together?

So for example if I want to create my own decentralized network how should my client now where to connect?

There is no centralised server required.

1.
If you start a node the first time, it will try to load a bunch of other nodes IPs via the build in list of available DNS seeds (there are ~5 seeds available).

2.
If those DNS seeds are not available, the Bitcoin-Core client uses its fallback IP list (a regularly updated list of IPs)

3.
Once a node could connect to one of those IPs (retrieved via DNS seeder or static list) it will ask for more IPs from known nodes (p2p address relay)


Is there an easy way to consolidate Dust Microtransactions I just found out today that all those websites I go to to earn like .0000087 for clicking around here and there have now in a way corrupted my wallet as yesterday I deposited 50$ into my wallet and when I try to transfer it to make a payment to another wallet, no matter what I get transaction fees. How can I clean my wallet of this dust. I know there is a program out there that claims to rid yourself of this dust, but there is no real directions on how to use it.

My question is three parts

Is there a client/wallet that allows you to transfer out of certain incoming transactions?
Is there an easy way to clean the wallet now that it has this dust?
If I transfer everything in the wallet will it clean the wallet? And if so does the wallet I transferred to now have the issue with the dust, does the dust transfer?

Let's take a step back and define dust: dust is an transaction output with a very low value.  When creating an input to a new transaction that spends that output, you have to use 36 bytes to reference it (the outpoint), about 72 bytes for the signature, either 65 or 33 bytes for the public key (depending on whether it was compressed, plus about 10 more bytes for other things.  Let's round it to 150 bytes.

Transaction fees are usually computed per kilobyte, so if you pay 0.0001 BTC per kB, dust is not worth spending if its worth less than 0.0000015 BTC.  Hopefully, defining all this will make the following answers a bit more clear.

Bitcoin Core's "raw" RPCs let you choose what outputs to spend.  You'll typically run listtransactions to get outputs available to your wallet, createrawtransaction to create a transaction spending specific outputs, signrawtransaction to sign the transaction, and sendrawtransaction to broadcast the transaction to the network.  If you do this, you want to be very careful---once a transaction has been broadcast, it's very difficult to change any mistakes in it.
As you alluded to in your question, Peter Todd's dust-b-gone will purge a Bitcoin Core wallet of dust transactions by giving them to someone else (Todd, I think, but it could go to 100% transaction fees---either way, nobody is getting rich off dust).  I haven't used it, but the instructions look simple.
Yes, if you transfer everything in the wallet, the dust will be gone.  That's because dust is an output from a previous transaction---once you use that output as an input in a new transaction, all that matters is the value of the output in that new transaction.

Although I've never used Bitcoin Core with dust, it's likely to be the smartest Bitcoin wallet about keeping dust-related transaction fees low---so if you want an easy graphical solution, I suggest just using Bitcoin-Qt.


How BTC value is determined in USD from a trading pair? I know this is more of a general trading question but how is BTC or any base currency value determined in another currency from a trading pair?

An example of what I mean is take the BTC/NEO trading pair, how do you determine the BTC value in USD from that trading pair?

If one bitcoin is $1,000 (for the sake of easy math), and 1 Neo is worth 0.1 BTC, then you can determine the USD value of one Neo is $100.

1000 * 0.1 = 100


if the hardware wallet company ledger goes out of business, what will happen to my crypto asset / private keys in ledger? if the hardware wallet company ledger goes out of business, what will happen to my crypto asset / private keys in ledger? I heard that the hardware wallet ledger is not open-source, so will the company get access to my private key? Will I be able to transfer my crypto elsewhere?

Your keys are stored securely on the hardware device itself.
If Ledger (or Trezor) goes out of business then their wallet client will also most likely not be supported anymore.
This isn’t that much of an issue. Other wallets have support for interacting with your hardware wallet, like Electrum for BTC, Electron Cash for BCH, and MyEtherWallet’s website for ETH.
If you also have your seed written down, you can import that seed into Electrum. This is more of a last resort move though.


Should signature verification by key recovery ignore compression status? The bitcoinj library's API offers a signMessage method of the ECKey class which returns a signature (r,s) as 65 bytes encoded as a Base64 string. The crunch of the encoding lies in the additional leading byte which allows key recovery (the 64 bytes of (r,s) alone are not enough for that purpose). In particular, the leading byte of the encoding includes information regarding the compression status of the signing key.

Now I assume this specific signature encoding was implemented for a very good reason, which I suspect is the fact that it is a standard encoding, present in many other bitcoin libraries and in core.

Now when verifying a signature through key recovery, the verifyMessage method ignores the compression status of the recovered key and simply ensures that the corresponding elliptic curve points match. Sure, this is a pretty good check, but why do we bother encoding the compression status of a signing key, if we are going to ignore it later? Is this the semantics other known libraries have adopted, or indeed core? I attach a small snippet for illustration:

import org.bitcoinj.core.ECKey;
import java.security.SignatureException;

public class Test
{
  public static void main(String[] args)
  {
    String message = "some arbitrary message";

    ECKey k1 = new ECKey();      // random , compressed
    ECKey k2 = k1.decompress();

    // Signature (r,s) encoded as 65 bytes, with leading byte
    // allowing key recovery (including compression status)
    String sig1 = k1.signMessage(message);
    String sig2 = k2.signMessage(message);

    // compression status is encoded in signature => differing leading byte
    System.out.println(sig1);   // INgDhkt98Mme9m9AQ+nqtjyvjj ...
    System.out.println(sig2);   // HNgDhkt98Mme9m9AQ+nqtjyvjj ...

    // signatures are verified succesfully
    try
    {
      k1.verifyMessage(message, sig1);  // compressed case
    }
    catch(SignatureException e)
    {
      System.out.println("it should not happen");
    }

    try
    {
      k2.verifyMessage(message, sig2);  // uncompressed case
    }
    catch(SignatureException e)
    {
      System.out.println("it should not happen");
    }

    // in fact, compression status is ignored ...
    try
    {
      k1.verifyMessage(message, sig2);  // should it throw ?
    }
    catch(SignatureException e)
    {
      System.out.println("it does not happen");
    }

  }
}

Mileage may vary with this answer. The short answer is probably no when using libbitcoin.

Rationale: Over a year ago, when I experimented with sending funds to a uncompressed address using a signed transaction, the corresponding compressed keys could not be used to spend the same funds, the opposite was also true. The balance was dependent upon the compression of a key. When receiving with funds with an uncompressed address, only use the associated uncompressed private key to spend.  Similarly, when receiving receiving with funds with a compressed address, only use the associated compressed private key to spend.


State of transaction and UTXO What I have learned is that state is an abstract thing and is maintained by the node locally and the state of the current blockchain can be reached by starting all the way from the genesis block and updating the state to the current state. So the state keeps adding utxos.

Does the state keep track of only the UTXOs which are unspent or the state keeps track of both the spent and the unspent utxos. What I think is ,they should be removed from the memory pool. Also what I think is that the memory pool is nothing else but the state of the blockchain.

Please clarify my confusions. Thanks

UTXO stands for Unspent Transaction Outputs. Thus, a node only keeps track of transaction outputs that are unspent. As soon as a transaction (even an unconfirmed one) consumes a UTXO, it is removed from the UTXO db (if the tx is dropped, it is added back).

  What I think is ,they should be removed from the memory pool.

The mempool is a list of unconfirmed transactions consuming as-of-yet available UTXOs. UTXOs are not removed from the memory pool. There is a separate UTXO database

  Also what I think is that the memory pool is nothing else but the state of the blockchain.

The state of the blockchain is the UTXO database. The mempool is essentially a list of proposed changes to the UTXO set, which can be mined and confirmed, which then results in an update to the state of the blockchain.


What is the format of the standard claim script? With reference to this:
https://en.bitcoin.it/wiki/Transactions#Pay-to-PubkeyHash

It would seem the claim script is simply the signature consisting of S and R and the public key.

However I know at least the signature gets DER encoded, which is fine I found a library for that, but I don't know the details. For instance is it:
DER(S,R)+pubkey, DER(R,S)+pubkey or DER(S+R+pubkey) and so on, there are many permutations etc.?

I'm looking for something like this where you can see what each byte is supposed to be:
https://en.bitcoin.it/wiki/Protocol_specification

In short the answer is this:

InScript length                               : VarInt (1-9 bytes)
PushData operation of R/S/Hash_all/DER bytes  : OP_PUSH (1-9 bytes)
DER sequence type byte                        : 0x30
DER sequence length                           : 0x44-0x46
DER integer type                              : 0x02
DER integer length                            : 0x20-0x21
32 R bytes, left padded with 0x00 IF leftmost byte >= 0x80 - hence varying lengths above.
DER integer type                              : 0x02
DER integer length                            : 0x20-0x21
32 S bytes, left padded with 0x00 IF leftmost byte >= 0x80 - hence varying lengths above.
Sighash_All type byte                         : 0x01
PushData operation of publickey bytes         : OP_PUSH (1-9 bytes)
PubKey version/type byte                      : 0x04
Public key in 64 bytes of data - X and Y 32 bytes each

Answer taken from here:
https://bitcointalk.org/index.php?topic=653313.0

After looking at it becomes pretty obvious that DER was a mistake on Satoshis part and something provided to him by OpenSSL.

I mean why encode unsigned integers as signed - then pad them to make them unsigned again.

Why these sequence and length definitions when we already know the length from the push byte op - why DER encode at all when its ALWAYS 32 bytes R followed by 32 bytes S?

Clearly its pretty silly.


Can you broadcast a segwit transaction using a non segwit node? If non segwit nodes view segwit transactions as anyone can spend ,why can't you broadcast a segwit transaction using them?

Segwit was designed in such a way that segwit transactions, after removing the witness, are valid but non-standard to old nodes.

This guarantees that old nodes won't reject such transactions when they're seen in blocks, but still won't be relayed or mined by old software.


Store Bitcoins offline I have some bitcoins and ether at Blockchain.info and I am really scared of losing them.

How do I best secure them? Right now I have a paper with the code to restore my wallet, but my coins are still stored at Blockchain.info.

Wouldn't it be better to store them completely offline? How do I do this? What is the difference of storing them at Blockchain.info and keep a paper with the code to restore the wallet?

I guess if I store my coins at Blockchain.info, I have to trust that they don't go bankrupt, they don't steal my coins, and no one hacks their servers and steal my coins.

Therefore, I guess it's more safe to store them physically, but I don't understand how they are stored physically. From my understanding, I just create a code that can validate that I am the owner of the coins. So if I in the future want to see my coins, I can create an online wallet using the physically stored code?

What I basically want is to store my coins offline but have a wallet where I can see exactly how many coins I can access with the offline stored code (without giving the code to an online wallet).

I have also looked at Ledger, but they are very pricey and I don't really see the value in them, since I still have to store a code on a physically printed paper to be sure I can still access the coins in case I break or lose the Ledger.

Might be worth reading through https://bitcoin.org/en/secure-your-wallet.

Personally I use a local encrypted wallet (standard bitcoin core software) that I back up to USB. My assumption is that the strength of the wallet encryption is good enough that even if my PC or USB is compromised the wallet pass phrase will keep my coins safe.


How will internet "take-down" affect bitcoin value? What will happen to the value of bitcoin in the immediate aftermath of an internet "take-down?"  I assume that it will be temporary, but wouldn't this cause the comparative price of bitcoin be adversely affected due to the panic?

Of course, assuming you could actually pull it off (which is near impossible at this point, but assume you could) but also keep in mind that bitcoin doesn't actually need the internet to continue working.

In all honesty though, bitcoin's market price would be the least of our worries in the event of a total internet shut-down.


What are the pros / cons of using Electrum 3.3.2 over Bitcoin core 0.17.1? And what about running your own Electrum Server? Aside from not having to download the entire bitcoin blockchain when using electrum, what other advantages are there over using Bitcoin core 0.17.1?

Also if I chose to use my own electrum server, what advantage is that over Bitcoin Core 0.17.1?

Using Electrum has some advantages and disadvantages over Bitcoin Core. Electrum is a bit more feature rich than Bitcoin Core. It supports hardware wallets, 2 Factor Authentication with a third party paid service, (better) multisig, and mnemonic phrases. There's probably a few other things that I've forgotten. However Electrum comes at the risk of decreased privacy and security. You are sending all of your data an Electrum server. That server knows all of your addresses and your transactions. That server can also withhold transaction information or refuse to relay transactions that you make. Electrum servers can also currently push malicious phishing messages to your Electrum wallet. That issue is currently in the process of being fixed (it requires a protocol change).

If you use your own server, there are a lot of benefits. If you trust that the server software is not malicious, then you won't have the cons mentioned above. Your transactions will be private and the server won't be withholding or refusing to relay transactions because you control it. Since it is your own server, you can have Electrum installed on multiple devices pointed to that server too. However running your own server has a cost. It requires a fully synced bitcoind with transaction index enabled. The electrum server will also maintain its own indexes. Overall, the setup can use over 250 GB of disk space, possibly even 300 GB. It also takes a long time for it to sync and build all of the necessary databases. Running an electrum server also uses significant CPU and RAM especially during the initial setup.

If having the full blockchain with additional databases is too much, you could instead use Electrum Personal Server. This is like running your own full blown Electrum server but only for your addresses and transactions. It can run without transaction index and be ran with a pruned bitcoind so you don't need to store the whole blockchain. With some manual configuring, you can also use Electrum Personal Server with Electrum wallets on multiple devices.


how i can make bitcoin address generator like mycelium gear using php script this is the code i got,how i can generated new random address using 1 pubkey,everytime page refresh;i try to use timestamp but din't work.

<?php

// step 1

$publickey='0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6';

$step1=hexStringToByteString($publickey);

echo "step1 ".$publickey."
";

// step 2

$step2=hash("sha256",$step1);
echo "step2 ".$step2."
";

// step 3

$step3=hash('ripemd160',hexStringToByteString($step2));
echo "step3 ".$step3."
";

// step 4

$step4="00".$step3;
echo "step4 ".$step4."
";

// step 5

$step5=hash("sha256",hexStringToByteString($step4));
echo "step5 ".$step5."
";

// step 6

$step6=hash("sha256",hexStringToByteString($step5));
echo "step6 ".$step6."
";

// step 7

$checksum=substr($step6,0,8);
echo "step7 ".$checksum."
";

// step 8

$step8=$step4.$checksum;
echo "step8 ".$step8."
";

// step 9
// base conversion is from hex to base58 via decimal.
// Leading hex zero converts to 1 in base58 but it is dropped
// in the intermediate decimal stage.  Simply added back manually.

$step9="1".bc_base58_encode(bc_hexdec($step8));
echo "step9 ".$step9."

";

function hexStringToByteString($hexString){
    $len=strlen($hexString);

    $byteString="";
    for ($i=0;$i<$len;$i=$i+2){
        $charnum=hexdec(substr($hexString,$i,2));
        $byteString.=chr($charnum);
    }

return $byteString;
}

// BCmath version for huge numbers
function bc_arb_encode($num, $basestr) {
    if( ! function_exists('bcadd') ) {
        Throw new Exception('You need the BCmath extension.');
    }

    $base = strlen($basestr);
    $rep = '';

    while( true ){
        if( strlen($num) < 2 ) {
            if( intval($num) <= 0 ) {
                break;
            }
        }
        $rem = bcmod($num, $base);
        $rep = $basestr[intval($rem)] . $rep;
        $num = bcdiv(bcsub($num, $rem), $base);
    }
    return $rep;
}

function bc_arb_decode($num, $basestr) {
    if( ! function_exists('bcadd') ) {
        Throw new Exception('You need the BCmath extension.');
    }

    $base = strlen($basestr);
    $dec = '0';

    $num_arr = str_split((string)$num);
    $cnt = strlen($num);
    for($i=0; $i < $cnt; $i++) {
        $pos = strpos($basestr, $num_arr[$i]);
        if( $pos === false ) {
            Throw new Exception(sprintf('Unknown character %s at offset %d', $num_arr[$i], $i));
        }
        $dec = bcadd(bcmul($dec, $base), $pos);
    }
    return $dec;
}

// base 58 alias
function bc_base58_encode($num) {
    return bc_arb_encode($num, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
}
function bc_base58_decode($num) {
    return bc_arb_decode($num, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
}

//hexdec with BCmath
function bc_hexdec($num) {
    return bc_arb_decode(strtolower($num), '0123456789abcdef');
}
function bc_dechex($num) {
    return bc_arb_encode($num, '0123456789abcdef');
}
?>

The step you're missing is actually generating the public keys, since addresses are just hashes of a public key. Mycelium uses BIP39 with BIP32 to produce deterministic public keys, using the BIP44 scheme AFAICT. The following example does the same in PHP using the composer package: bitwasp/bitcoin.

Disclaimer: I maintain the library in question.

use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Mnemonic\Bip39;
use BitWasp\Bitcoin\Mnemonic\MnemonicFactory;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;

$generate = true;
$math = Bitcoin::getMath();
$bip39 = MnemonicFactory::bip39();

if ($generate) {
    $mnemonic = $bip39->create();
} else {
    $mnemonic = 'glad car usual air stomach again ecology champion ranch radar meadow wolf shrug film over glue chalk derive inform always ivory anchor jaguar umbrella floor topple click polar grid economy hint raccoon canal nose organ prepare differ escape utility major dirt scan soul shiver mention raw smoke rhythm';
}

// Produce HD root key from mnemonic
$entropy = $bip39->mnemonicToEntropy($mnemonic);
$hdRoot = HierarchicalKeyFactory::fromEntropy($entropy);

// Lets derive a branch:
$sequence = new HierarchicalKeySequence($math);
// purpose' / coin_type' / account' / change / ...
$branch = $hdRoot->deriveFromList($sequence->decodePath('44h/0h/0/0'));

// Now lets print the first 5
for ($i = 0; $i < 5; $i++) {
    $child = $branch->deriveChild($i);
    echo $child->getPublicKey()->getAddress()->getAddress() . "\n";
}


Who will the first adopters of Taproot be (assuming it is activated at some stage)? What incentives are there to start using it straight away? Adoption of SegWit by users and companies after it was activated was slow. Should we expect adoption of Taproot to be slow also (assuming it is activated at some stage)?
Who will the first adopters of Taproot be? What incentives are there for users and companies to start using it straight away?

(A 2-of-2, 3-of-3, n-of-n will be referred to as a multisig scheme and a 1-of-2, 2-of-3, k-of-n where k < n will be referred to as a threshold scheme)
The most significant incentives for using Taproot (in terms of reducing transaction fees) exist for those who are using either multisignature/threshold schemes (the larger the multisig the larger the incentive) or complex scripts (that may also include various multisignature/threshold schemes within them).
There are various MuSig schemes that are at different levels of maturity. Classic MuSig (for multisignature, not threshold) has gone through multiple iterations and is at a point where its design is unlikely to be revised significantly. It is not yet used in production but it is plausible that it could be if and when Taproot is activated on mainnet.
Murch has an excellent Medium post and a StackExchange answer describing the fee savings from using Taproot and MuSig for a 2-of-3 threshold signature use case. There is not a threshold MuSig scheme that is ready to be used in production (at the time of writing, October 2020) but using multisig MuSig you can get up to 45% fee savings in comparison to using P2WSH. You do this by setting up your Taproot key path spend as a 2-of-2 MuSig (with only one combined key going onchain if it is used) and two alternative 2-of-2 MuSig script path spends as separate leaves in the Taptree. (You are effectively turning a 2-of-3 threshold into three alternative 2-of-2 MuSigs. This is the most efficient approach because for each MuSig only one key and one signature goes onchain when a MuSig scheme is used to spend.)
Assuming that you will use the key path spend the majority of the time (i.e. you can identify two of the three keys that will be used the majority of the time) the fee savings really are significant. These incentives are likely to drive some of the early adoption of Taproot.
For more details on the current state of Taproot multisignature and threshold schemes see this presentation from Tim Ruffing at London Bitcoin Devs (June 2020).
Thanks to Pieter Wuille and Murch for answering my questions on IRC. Any errors are my own.


Does a transaction have multiple signatures In the question "Is there a way to prove ownership of a transaction?" the statement was made "A (regular) transaction must be signed with the private keys of the addresses of all the inputs".

Does that imply that a transaction has multiple signatures or is a single signature just encryted with multiple private keys?

Each input has its own and unique signature. This allows users to forge advanced transactions, such as offline signing where each participant agrees to provide inputs separately.

Even if all inputs belong to the same address, each one is signed separately (with the same private key in this case).

Oh, and multisignature addresses (P2SH, pay-to-script-hash) allow several signatures per input too!


Bitcoin Transaction Structure Is there a "standard" Bitcoin transaction format?

The context is that I am putting together a tech talk to explain the blockchain concept to complete newbies, and I wanted to show the general structure of a transaction. However, I see different JSON document structures (different field names and content structure) returned by different sources, for the same transaction. For example, compare the output of the following 3 sources for Tx ID 90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219

https://blockexplorer.com/api/tx/90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219
https://blockchain.info/tx/90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219?format=json
https://cdn4.cryptocoinsnews.com/wp-content/uploads/2014/07/Bitcoin_tx_example.png

I know the image (#3) is showing only a subset but it has in and out arrays, and an input has a prev_out object with a hash string field. However, #1 (BlockExplorer) has vin and vout arrays, and the input does not have a prev_out object. It directly contains a string txid field with the hash of previous output transaction. There is yet another JSON structure in #2 (blockchain.info).

Is there an "official" or "standard" JSON structure of a transaction? If so, I would like to show that in my talk. Or what would be the recommended way to show a newbie what a Bitcoin transaction looks like?

The official or standard names would be the ones built into the bitcoin JSON-RPC API. The developer reference section is a good place to start you can see example outputs from different calls.

For example the result to the gettransaction call:

{
    "amount" : 0.00000000,
    "fee" : 0.00000000,
    "confirmations" : 106670,
    "blockhash" : "000000008b630b3aae99b6fe215548168bed92167c47a2f7ad4df41e571bcb51",
    "blockindex" : 1,
    "blocktime" : 1396321351,
    "txid" : "5a7d24cd665108c66b2d56146f244932edae4e2376b561b3d396d5ae017b9589",
    "walletconflicts" : [
    ],
    "time" : 1396321351,
    "timereceived" : 1418924711,
    "bip125-replaceable" : "no",
    "details" : [
        {
            "account" : "",
            "address" : "mjSk1Ny9spzU2fouzYgLqGUD8U41iR35QN",
            "category" : "send",
            "amount" : -0.10000000,
            "vout" : 0,
            "fee" : 0.00000000
        },
        {
            "account" : "doc test",
            "address" : "mjSk1Ny9spzU2fouzYgLqGUD8U41iR35QN",
            "category" : "receive",
            "amount" : 0.10000000,
            "vout" : 0
        }
    ],
    "hex" : "0100000001cde58f2e37d000eabbb60d9cf0b79ddf67cede6dba58732539983fa341dd5e6c010000006a47304402201feaf12908260f666ab369bb8753cdc12f78d0c8bdfdef997da17acff502d321022049ba0b80945a7192e631c03bafd5c6dc3c7cb35ac5c1c0ffb9e22fec86dd311c01210321eeeb46fd878ce8e62d5e0f408a0eab41d7c3a7872dc836ce360439536e423dffffffff0180969800000000001976a9142b14950b8d31620c6cc923c5408a701b1ec0a02088ac00000000"
}

Source: https://bitcoin.org/en/developer-reference#gettransaction


Using bitcoind, is it possible to set a specific fee with sendtoaddress? For example, setting the fee to exactly 1000 sats or 300 sat/kw?

You cannot set an absolute fee, however you can use the settxfee RPC to set the fee rate for the wallet before you make the transaction. Note that this isn't persisted in the wallet and is only held in memory, so you will need to do it again if you restart Bitcoin Core or reload the wallet.

In the next major release of Bitcoin Core, version 0.21, you will be able to set the fee rate in sendtoaddress itself.


What would be the benefits of 10x the energy spent Let's suppose the bitcoin network grew to be 10x the size it currently is in terms of the amount of energy spent. No other changes to the protocol were made.

What benefits would this have versus where the network stands today from an end-user perspective? If blocktimes are fixed at 10 minutes and blocksizes stay consistent, then what type of improvements would we see?

Improvements

More Secure from 51% attacks
?

It seems confirmations could be sped up, but the initial confirmation still takes 10 minutes by design. I haven't heard of people complain about confirmation times, and from what I have seen on computing power performing a 51% attack on the bitcoin network as it stands today is not close to being practical. I am interested though what else I am missing.

I am not suggesting the use of POS or something else.

Note first of all that "10x the nodes" and "10x the mining energy" are different things.  A "node" is just a computer that participates in the Bitcoin network by receiving and relaying transactions.  Most nodes don't do any mining, but conversely a single node may support an unlimited amount of mining power.  So there is no real relationship between the number of nodes and the amount of mining power on the network.

Having 10x as many nodes would make it slightly easier for a user to connect to a node to send and receive transactions, and would make the network somewhat more robust against a network split (where not all nodes are able to communicate with each other).  However, it might also make it take slightly longer for a transaction to get to a miner, since more hops would be needed.  There wouldn't be any major positive or negative effects that I know of.

If the network had 10x more mining power, the main benefit would be security against 51% attacks, since an attacker would now need 10x more mining power of his own to mount such an attack.  (Of course, if mining hardware became more efficient in the meantime, this might not actually increase the costs of such an attack versus today - but they would still be 10x higher than without the mining power increase.)

There wouldn't be any long-term improvement in confirmation speed, since as you say the difficulty would adjust to keep the block time at 10 minutes.  (If all the mining power came online at the same time, there would be a temporary increase in confirmation speed for the first few days, since the difficulty adjustment happens only at specified intervals and the maximum adjustment at each such interval is by a factor of 4.)

I am not sure what you mean by "censorship resistant".  A mining power increase wouldn't do anything to help prevent a government from trying to block Bitcoin traffic from the Internet.

There wouldn't be any other major end-user effects that I can think of.  Resistance against 51% attacks is the main one.


Do pending transaction orders on the Ardor coin exchange or Ardor asset exchange expire? I made a transaction on the coin exchange and if I never cancel it, when would it expire and return the funds to me? Or do I have to submit a new cancel order? And is this the same for asset exchange orders?

The order remains active until you cancel it by issuing a Cancel Order transaction.  Which means you will pay a transaction fee but you will get the unused portion of your funds returned to you.


How to determine what type of coins a wallet.dat contains? I have a number of wallets. Is it possible to detect the type of (alternative) coin it contains?

Here's one way I found.

Get pywallet (https://github.com/jackjack-jj/pywallet) and run

python pywallet.py --dumpwallet --wallet=/foo/bar/wallet.dat

Look in the output for a field called names.  This will contain a list of addresses in the coin's own format, and by looking at the first character you can try to identify the coin by its version byte.  See here for a list of some common ones.  For example, 1 is Bitcoin, L is Litecoin, etc.

Note that you will see a number of other fields named defaultkey, addr, etc.  These will appear to be in Bitcoin address format (starting with 1), no matter what the actual coin is.  The reason is that for these keys, the wallet.dat file only contains the private key, and pywallet has to do the conversion to the public key and address.  In  particular, pywallet has to fill in the version byte, and it always picks the Bitcoin version byte unless told otherwise on the command line.  So you always get a Bitcoin-style address in these fields, so for purposes of identifying the coin, you should ignore them.


How can I use Ripple to accept Bitcoin, USD, and other currencies on my site? I don't want to limit myself to just using Bitcoin on my site, especially when there are other interesting Alt-coins on the market.

I'm pretty sure I can use Ripple to accept Bitcoin, however I'm unsure how to set this up.

Can someone explain how I can do this?  (and then redeem my ripple-for-Bitcoin receivable)

You may also be interested in an answer to "How to accept payments via Ripple on a website".

It depends on if it makes sense to you to price your product or service in Bitcoin or in some other currency. For example, if your costs and profit margins are based in EUR then it makes sense to set your price in EUR (even if you'll later turn that into bitcoin). No matter what units/currency you denominate your price in, with Ripple people can pay using whatever assets they hold which Ripple can find a payment path for.

Assuming you want to set your price in bitcoin and end up with bitcoin in your private bitcoin wallet you could do something like the following:

Create a Ripple address
Chose one (or more) of the Ripple gateways that support bitcoin. You're looking for one that you trust to (temporarily) hold your bitcoin for you, that has low (or zero) fees, that has good liquidity, etc. Add trust lines to in BTC to that gateway for an amount that you are comfortable with (or to multiple gateways in various amounts).
Use Ripple URIs on your site to help customers initiate Ripple payments with their client. The customer will then be given the option to pay with any of their assets for which paths exist.
Periodically use the bitcoin bridge or withdraw via your Ripple gateway to get your BTC Ripple balance as bitcoin into your bitcoin wallet.

Alternatively you could use a service such as DividendRippler to attach a Bitcoin address to a Ripple address. Using DividendRippler you can generate a Ripple payment URI that sends BTC to their Ripple address with a destination tag generated for you and DividendRipple then forwards recieved BTC onto the blockchain to the address you've provided.


Does Bitfinex support B2X? Will BTC holders at the moment of the fork be credited B2X on a 1:1 ratio? I know, we should hold them in cold storage, etc, but I can't know for sure whether Bitfinex will credit the B2X on a 1:1 ratio for BTC holders.

Thank you for your answers!

David

There's no 2X fork anymore now, since it has been called off


BTC Lightning Network Can someone please give me some insight as to when LN will be fully operational on the bitcoin network.

Additionally, as outlined in the 2008 Nakamoto whitepaper, the solution to the double-spend problem is clearly addressed and solved, however, given that with LN supposedly 'Billions of transactions per second' may happen off-chain, then what are the implications for how the double-spend problem is addressed?.

This is presumably handled in the software layer, under the knowledge that people must firstly stake a quantity of bitcoin in order to support the electronic IOU's.

If the above is correct, which it may not be (please correct me if I am wrong), then doesn't LN essentially become almost in a sense a 'Bitcoin backed' new cryptocurrency?

what are the implications for how the double-spend problem is addressed?

The solution to the double spend problem does not change.  Participants of the lighting network hold valid transactions for actual bitcoin.  Because bitcoin cannot be double spent, the lightning network doesn't have to solve this problem.

  This is presumably handled in the software layer, under the knowledge that people must firstly stake a quantity of bitcoin in order to support the electronic IOU's.

Despite the fact that the transactions haven't been broadcast, I wouldn't consider money on the lightning network to be just an IOU.  While it is still unsettled, it's more complete of a transaction than what we typically think of as an IOU.  The smart contacts, themselves, make the exchange on the lightning network effectively irreversible.

  doesn't LN essentially become almost in a sense a 'Bitcoin backed' new cryptocurrency?

No.  If that was true, then credit card transactions would be a separate dollar-backed currency.  Lightning is a method of exchanging bitcoin.  That doesn't mean it's a new currency, just a means of moving money.


Is there a reliable way to measure bitcoin wealth distribution? Given the difficult of detecting lost coins, or telling between hoarded and lost coins, it seems impossible to actually report on the real wealth distribution of the bitcoin currency.

The protocol gives no information about who controls an address. In an extreme case, every address could be controlled by just one person, or every address could have a unique owner. However, a degree of traffic analysis is possible, and if you have access to other data from outside the Bitcoin network, you could correlate transactions with these non-Bitcoin events and infer who the real-world owners of the addresses are.

For example, if you had access to ISP records of who uses an IP address that has just mined a block, you could start to build profiles of the owners of new coins.

But there are many barriers to achieving the total information awareness that you would need to build a comprehensive profile of all coin owners, so the short answer is no, there is no reliable way to measure Bitcoin wealth distribution.


Bitcoin Miner Profit using 600 GH/s Monarch from Butterflylabs Butterflylabs has a new 600 GH/s Bitcoin miner for $2,196.

According to here, 600 GH/s at today's rate would mine approximately $170 a day. This means you make back the original cost of the miner in about two weeks and start making a profit from there on.

This seems too good to be true. Is there something I am missing here?

The part you are missing is that it is a preorder and the current estimate is that if you ordered now, you would likely not receive your mining hardware until April 2014.

This site shows a good calculator and I have configured it to show the (lack of) profits you would make if you started mining with this miner starting in April:

http://mining.thegenesisblock.com/a/7141b8c779


If miners pay income tax, could a change in tax laws affect network security? Assuming that more than half of the Bitcoin miners pay taxes on revenue gained, could a increase in income tax laws (or similar) cause those ethical miners to go out of business? ... and the Bitcoin network to be more vulnerable to attack?

Taxes are paid on profits, not revenues. If their mining operation was profitable before, it will remain so even after the tax increase. Also, depending on the kind of tax it could increase equally to any alternative occupation they might have, so there would be no reason it should make any miner operation go out of business; definitely not enough to warrant concerns about the network security.


Is it possible to exchange bitcoins into PayPal credit? I'm aware that PayPal's terms of conditions do not allow for purchase of virtual currencies such as bitcoins, however, is it possible to sell bitcoins and receive PayPal credit in return? MtGox allows you to exchange BTC > USD, but there's no way to withdraw it using Paypal or a similar service.

Is there an exchange that supports either MtGox coupons or direct bitcoin transactions to top up a PayPal account, without the use of a credit card or bank transfer? I'm interested in more obfuscated methods/workarounds as well, even with the use of multiple exchanges.

Some people are selling bitcoins and receiving PayPal payment on LocalBitcoins.com:

https://localbitcoins.com/sell-bitcoins-online/paypal/

LocalBitcoins is in-person exchange. The problems with PayPal tend to hit the bitcoin seller; because PayPal transfers are reversible and bitcoin transactions are irreversible you must trust the party to whom you are selling bitcoins. A malicious party can file a PayPal claim and get their fiat currency payment recalled after they receive the bitcoins. This problem is not specific to PayPal, but all credit card backed payment methods (Venmo, Dwolla, etc.)

Some people have found it possible to resolve issues with PayPal payment recall policy.

Also LocalBitcoins has guide how to avoid this kind of fraud. The sellers have 25% - 50% margin when selling on PayPal, so they can cover up possible losses. Also when done successfully one can profit from the risk, as there is high demand buying bitcoins on PayPal.

LocalBitcoins also has an API, so you can at least half automatize the process, but you still need to have enough buyer audience to make sure there is demand for your bitcoins (there is).


Transactions that have outputs value more then inputs value possible? Transactions have 2 ways to get into blockchain in bitcoind:

mempool -> newblock
newblock no in mempool

lets check AcceptToMemoryPool function

https://github.com/bitcoin/bitcoin/blob/c719cefc417cc578f48b33069b764339a61054ce/src/main.cpp#L876

CAmount nFees = nValueIn-nValueOut;

in case outs > ins

nFees<0

if (mempoolRejectFee > 0 && nFees < mempoolRejectFee) {
        return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", false, strprintf("%d < %d", nFees, mempoolRejectFee));

negative nFees will be rejected all is good in this point

ok
lets check Connectblock  function

https://github.com/bitcoin/bitcoin/blob/c719cefc417cc578f48b33069b764339a61054ce/src/main.cpp#L1805

for each tx in block we do:

nFees += view.GetValueIn(tx)-tx.GetValueOut();

https://github.com/bitcoin/bitcoin/blob/c719cefc417cc578f48b33069b764339a61054ce/src/main.cpp#L1826

 CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus());
if (block.vtx[0].GetValueOut() > blockReward)
    return state.DoS(100,
                     error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
                           block.vtx[0].GetValueOut(), blockReward),
                           REJECT_INVALID, "bad-cb-amount");

At this point we calculate max possible reward for this block: all tx fees + mining reward

then we check that coinbase reward not more then this value

what if same miner create and include transaction that have inputs for 1 btc and have outputs for 2 btc, so fee for this tx will be -1 btc

then miner can set reward for coinbase transaction to  25 btc  + all fees - 1 btc.

so this (block.vtx[0].GetValueOut() > blockReward)  return True

as result we have Transaction, that  create more coins then received, inside blockchain

Where is my error?

That isn't allowed, even within a block. Here is the code that checks for that:

main.cpp: ConnectBlock

    if (!CheckInputs(tx, state, view, fScriptChecks, flags, false, nScriptCheckThreads ? &vChecks : NULL))
        return error("ConnectBlock(): CheckInputs on %s failed with %s",
            tx.GetHash().ToString(), FormatStateMessage(state));

main.cpp: CheckInputs

if (!Consensus::CheckTxInputs(tx, state, inputs, GetSpendHeight(inputs)))
    return false;

main.cpp: CheckTxInputs

for (unsigned int i = 0; i < tx.vin.size(); i++)
{
    const COutPoint &prevout = tx.vin[i].prevout;
    const CCoins *coins = inputs.AccessCoins(prevout.hash);
    // [11 lines snipped]
    nValueIn += coins->vout[prevout.n].nValue;
    // [3 lines snipped]
}

if (nValueIn < tx.GetValueOut())
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false,
        strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(tx.GetValueOut())));


Will "all" bitcoins ultimately vanish? (be unusable) During this CCC conference from 2011, starting from 00:18:55, the presenter suggests that as bitcoins can be lost (lost private key, dead owner, sending to an "eater" address that nobody posses, etc.), and as the total amount of bitcoins has a known threshold (21 millions), there is a possibility that given enough time, most bitcoins, if not all, will actually vanish (be unusable).

The questions is when?

Actually, according to him:

if 0.5% of bitcoins are getting lost per year, "all" bitcoins will be gone by approx. 2032;
if the losing rate is 0.1% per year, it will probably last for a century, but will ultimately be doomed.

And if we suppose that inactive wallets (2 years with no transaction) are in fact lost wallets, we reach that 0.1%/year threshold...

The math is clearly absurdly unrealistic because as there are fewer Bitcoins available, it becomes harder to lose them. So the rate of loss has to decay as the availability of Bitcoins goes down.


How do I receive Bitcoins from my clients who owe me money? How do I receive Bitcoins from my clients who owe me money? I do not have a web site. Currently I send my clients an invoice. They discharge the invoice by sending me a check drawn on their bank checking account. Do I have to send them a Bitcoin "key" or account number of some kind?

You send them a bitcoin address along with the invoice. Use a different address each time, so that you can tell who paid you.


What is the purpose of OP_DROP From what I can tell OP_DROP is a method of storing non validation data in a tx ( seperate from using data after OP_RETURN ).

However in this unlocking script described by bip199, the timeout block and timeout op are before the OP_DROP, meaning they would be dropped during validation? OP_DROP can't be describing what comes after because that should be the payment path validation - and because afaik bitcoin script is stack based.

What is the point of OP_DROP? How does it apply in the following script?

OP_IF
    [HASHOP] <digest> OP_EQUALVERIFY OP_DUP OP_HASH160 <seller pubkey hash>
OP_ELSE
    <num> [TIMEOUTOP] OP_DROP OP_DUP OP_HASH160 <buyer pubkey hash>
OP_ENDIF
OP_EQUALVERIFY
OP_CHECKSIG

The TIMEOUTOP, which is one of OP_CHECKSEQUENCEVERIFY or OP_CHECKLOCKTIMEVERIFY, will either:

Terminate the script with an error if the TIMEOUT conditions are not met
Act as a NOP and leave the stack unchanged if the TIMEOUT conditions are met

2 occurs if the timeout has been met, and leaves the top of the stack with the timeout delay value. OP_DROP removes this value from the top of the stack, allowing the regular p2pkh script to continue execution by consuming the rest of the stack.


Any advantages in terms of our location & East-West timing differences for self mining on a 100 th/s btc rig I do live in india.. I believe that bitcoin mining rig owners are very lessaound us ..I read some where that  we will be able to mine more bitcoins  while the west or far-east  sleeps..

What you read is not accurate.  There is no significant difference in mining performance depending on your location.

First of all, as far as I know, the vast majority of miners run their equipment 24 hours a day (since leaving them idle just wastes the investment in hardware), so time zone differences are irrelevant.

Also, to first order, your chances of mining a Bitcoin block depend only on your hash rate and the network difficulty; it makes no difference what other miners are doing at that moment.  So even if the rest of the world quit mining completely for several hours, it wouldn't help you at all.

Of course, the network difficulty is determined indirectly by how much mining is being done around the world, but the difficulty is adjusted only once every 14 days or so (2016 blocks), so variations over the course of a day would average out.

There is actually a very slight disadvantage in being in a part of the world that has relatively few miners.  Suppose, for example, that most miners are in New York and a few are in Bombay.  If New York-based Miner A finds a block (say at height 12345) and announces it on the network, New York miners will know about it quickly, while it will take a few tens or hundreds of milliseconds to propagate across the Internet to Bombay.  During this short time, Bombay miners are at a disadvantage.  If Miner B in New York and Miner C in Bombay both find blocks during this window, B's will be linked back to A's block, whereas C's will be linked to the block before A's.  Thus B's block is part of the longer chain and will be accepted by the network, while C's will be orphaned.     But since this window would be less than a second for each block, which happens roughly every 10 minutes (600 seconds) on average, the disadavantage is at most a couple tenths of a percent.

The most important way that your location would impact your mining profitability is your local cost for electricity.


How much time it takes to verify a Bitcoin signature in the Satoshi client? Assuming:

An average modern computer
Using a single thread, as the current Satoshi client does
Using the OpenSSL library, as the Satoshi Bitcoin client does
The signature is not in the signature cache

I speculate that the time may be between 1 and 10 msec.

It depends a lot on the hardware, and on the architecture. OpenSSL use some assembly-optimized routines, which result in a speed factor of +- x2 between 32 bit and 64 bit (the latter is faster). That said, I've seen verifications taking around 0.47 ms on an Intel Xeon E5-1650 @ 3.20GHz, using 64-bit code.

Also, version 0.8 will actually do signature verification in parallel. There is also a patch with an optimized ECDSA verifier for the specific curve we're using, which should give a 20% speedup (discovered by Hal Finney). This patch will probably not make it into v0.8, though.


Can I find a bitcoin wallet from an address directly from blockchain data? (not website) For example
https://www.walletexplorer.com/wallet/03457b955f9c055c/addresses shows all the addresses linked to wallet 03457b955f
How do they do that?
Thank you !!

How do they do that?

See https://www.walletexplorer.com/info

What is on this site?
WalletExplorer.com is Bitcoin blockchain explorer, with two additional features:

it merges addresses together, if WalletExplorer thinks that they are part of the same wallet
wallet can have name

How wallets are computed? When are addresses merged together?
Just a basic algorithm is used to determine wallet addresses. Addresses are merged together, if they are co-spent in one transaction. So if addresses A and B are co-spent in transaction T1, and addresses B and C are co-spent in transaction T2, all addresses A, B and C will be part of one wallet.
Sometimes, an address belongs to some service but it was never co-spent with others. Then that address stays unnamed. It is typically more often at addresses with higher amount (as there is no need to co-spending).
How are names discovered?
In most of the cases, I registered to service, made transaction(s) and saw which wallet bitcoins were merged with, or from which wallet it was withdrawn.
There is probably no easier way how to discover names other than this.
Please note that the name database is not updated, so it does not contain newer exchanges (or newer wallets of existing exchanges)


How long for Bitcoin core to initially synchronise? Now i tried sweeping with my private key but its says needed to confirm output no output

how long will [Bitcoin core] take to sync?

How long it takes to sync depends on your computer and your network connection.

It may take a week.

Bitcoin core will give you an estimate - but that assumes the computer is never turned off, never sleeps, hibernates or drops into a low-power mode and never runs other CPU-intensive tasks while core is syncing.

  is there a way to get the bitcoin out incase

in case of what?

You can export the private key and then import it into a lightweight (SPV) wallet which will allow you to spend your BTC without needing to download and verify the whole blockchain first.

See

https://bitcoin.stackexchange.com/a/78758/13866 which covers debug console commands

listreceivedbyaddress 0 true
dumpprivkey <address>

How can I export the private key for an address from the satoshi client?
List of wallets showing which support SPV


I need clarification on moving BTC to another wallet First off-- I am a total newb-- just bought btc today. Its sitting in a DEX wallet and I want to move it to another wallet. Which key do I use to identify the new wallet when I want to send?  Are they asking for the set of words or the jibberish key?

I would expect the "jibberish key" is the address in this case. The set of words is known as a "seed", and is used to back up all the private keys in your wallet. NEVER share those words with anyone, anyone with those words can spend all your bitcoins.

"Normal" bitcoin addresses start with a 1 and are usually around 34 characters long, made up of lowercase letters, uppercase letters and numbers. An example is 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2. Some bitcoin addresses also start with a 3. More recently a new type of address has begun being used, starting with bc1, but its unlikely you will see these commonly for a while. These addresses are all anyone needs to send transactions to you, they will never need the seed words or the private keys or anything else. Keep those safe and to yourself.

Some wallets such as blockchain.info also use a wallet identifier which is made up of numbers, letters and dashes (-), that is also for private use and does not need to be shared, it is not an address.


Can an attacker steal a very recent tx and alter it, broadcasting a new tx with his address on the output? I'm reading the technical FAQs on the wiki, and what I don't see is, if I create a transaction with signed prev_outs and new outputs, do I also sign the ENTIRE new tx before broadcasting? I don't see any field in the spec for a final overall signature.

So what I'm asking is, if I receive a tx from a peer, what is stopping me from altering that tx message so the output is now my own address, and trying to broadcast my new fraudulent tx to the network faster and to more peers than the original honest tx?

In a typical transaction, every signature in the transaction is a signature over all the outputs. So you can't change any of the outputs without invalidating all the signatures.


Why blockcypher send transaction is throwing fatal error? I am trying to send bitcoin implementing blockcypher API, but having difficulty in using the following code snippet...

i. http://blockcypher.github.io/php-client/sample/doc/transaction-api/CreateTransaction.html

ii. http://blockcypher.github.io/php-client/sample/doc/transaction-api/CreateAndSignAndSendTransaction.html

The transaction is being created perfectly, but following error is being thrown while trying to send it...

Fatal error: Uncaught exception 'BlockCypher\Exception\BlockCypherSignatureException' with message '1 private keys do not correspond to any input. Please check private keys provided.' in /www/myserver.com/blockcypher1/php-client/blockcypher/php-client/lib/BlockCypher/Api/TXSkeleton.php:148 Stack trace: #0 /www/myserver.com/blockcypher1/php-client/blockcypher/php-client/lib/BlockCypher/Api/TXSkeleton.php(96): BlockCypher\Api\TXSkeleton->generateSignatures(Object(BlockCypher\Crypto\PrivateKeyList), 'btc') #1 /www/myserver.com/blockcypher1/php-client/blockcypher/php-client/lib/BlockCypher/Client/TXClient.php(35): BlockCypher\Api\TXSkeleton->sign(Array, 'btc') #2 /www/myserver.com/blockcypher1/send.php(19): BlockCypher\Client\TXClient->sign(Object(BlockCypher\Api\TXSkeleton), Array) #3 {main} thrown in /www/myserver.com/blockcypher1/php-client/blockcypher/php-client/lib/BlockCypher/Api/TXSkeleton.php on line 148

But, I have provided unencrypted Hex private key of my input address. Also tried with WIF. None is working! How do I solve this ?

The problem was caused becasue BlockCypher-php-client-1.2.2 does not support uncompressed public keys.

Details: https://github.com/blockcypher/php-client/issues/5


Is it possible to create a blockchain network which will not increase in difficulty? I would like to create a blockchain network which will stay at the same level of complexity, meaning it won't take longer or need stronger hardware to mine.
Is such a thing possible?

It is possible, but very stupid to do. If you keep the difficulty the same, hardware will get better and better over time (or just more of it is used to mine your altcoin) and this will cause blocks to be produced faster and faster and faster. This makes attacks much easier to take place too.


Segwit: dropping signature from relay In the process of trying to understand the effects of segwit on Bitcoin I started watching this:

https://www.youtube.com/watch?v=NOYNZB5BCHM

Which are the cases in which the receiver does not need the signatures? (minute 6.20)

Am I right, saying that signatures for segwit outputs will never be relayed to old clients?

Yes and no: this is a presentation from 2015, and you are referencing a section which Pieter described as "assume we can redesign bitcoin". So bitcoin hasn't been redesigned, and not everything has been implemented as described in 6:20.

How it is handled today is part of a discussion with Andrew in bitcointalk (read down to page end). Older nodes don't get to see the witness data. They get just tx data, in an "anyone can spend" way, so it is recognized as valid tx by older nodes. Newer nodes get the witness data (of course).

  Am i right saying that signatures for segwit outputs will never be
  relayed to old clients?

yes.


Who first defined/coined The Double-Spending Problem? The Double-Spending problem is a variant of the Byzantine Generals Problem which has a nice write up by Lamport, Shostak and Pease. But who first coined/defined the specific Double-Spending problem? Or linked the BGP to the digital currency domain? Does there exist a proper academic write up, defining the problem, that predates bitcoin?

I searched for a bit and can only find write ups after Nakamoto's publication.

Does there exist a proper academic write up, defining the problem, that predates bitcoin?

Google ngrams shows the phrase being used as early as the 1970s but that is probably not in the context of digital currencies.

The earliest reference I could easily find is in several articles in "Advances in Cryptology - CRYPTO '93"

For example in "Untraceable Off-Line Cash in Wallet with Observers" by Stefan Brands.

Since several articles mention double spending I expect the coinage of this phrase in this context is older than 1993.

However there were no mentions in CRYPTO '92.


Having trouble transfering private keys from Bitcoin Core to Electrum, for want of not having to wait for sync This morning, I purchased some bitcoin for the first time on CEX.IO, and soon withdrew it to the Bitcoin Core wallet I had set up. What I did not realise was that I would have to download the blockchain data and store it, which is proving painfully slow on my lacklustre internet connection. I have since downloaded Electrum, obtained the private key from the Bitcoin core console, and imported this into my Electrum wallet. Although Electrum says it has imported, it does not read the correct public address that BC does, and my balance is still at zero. When I check the balance of the address online it still reads as it should. Can anyone help with this?

Redo the import. Start via file > new/restore, enter a unique filename and click next to begin the process. This time prepend one of the following to the private key:

p2wpkh: if the address in question begins with bc1
p2wpkh-p2sh: if the address in question begins with 3

For example:

p2wpkh-p2sh:Ky9mddDtaqcLC1vv6egmgQpiZh8Lgh111LnJSyJENxJs3oW93bjD

You can also click on the info button on the private key entry step to see further examples.


Converting WIF as Base58 string to byte array in bash I want to convert wif as Base58 string to byte array.

Private key to WIF

printf 800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D | xxd -r -p | base58

  5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

Now I want reverse this (WIF to private key), form 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ to 800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D

Im using that library https://github.com/keis/base58 But I can change or better if I can use only bash without extra library

full example https://en.bitcoin.it/wiki/Wallet_import_format

You need to use the decode flag -d:

printf "5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ" | base58 -c -d | xxd -p
800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d
72aa1d

To have xxd output all on one line, give it a large column number -c flag:

$ printf "5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ" | base58 -c -d | xxd -p -c 1000
800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d

If you really want the checksum included 507A5B8D (the last 4 bytes), omit the -c flag which denotes checksum encoding:

$ printf "5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ" | base58 -d | xxd -p -c 1000
800c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d507a5b8d


Race attack with transaction fees let's say I run a simple race attack (say in a restaurant). I transfer BTC to the restaurant but seconds before (or after) I send the very same coins to myself. To make this deal more likely for myself I assign a much higher fee to the transaction loop for myself. How common are such race attacks? I don't think the restaurant can wait like 6 blocks before they accept my payment. I would be most happy if you can point me to papers, stats, etc. Or is there a big gap in my logic?

Or is there a big gap in my logic?

Your logic is right, it is just that no decent service will accept a payment unless 1, 3 or even 6 block confirmation.

  How common are such race attacks

Not common at all, but if the services or the person is forced to accept unconfirmed block, here is a link with information about how to better perform and how to defend against a race attack.

https://bitcoin.stackexchange.com/a/74283/95422

  I don't think the restaurant can wait like 6 blocks before they accept my payment

You are right, and the fact that you have to wait ~30 minutes can be a problem for mass adoption, this is one of the reason there is a project called the lightning network build on top of bitcoin trying to solve this  and other major things by rendering transaction instantaneous while keeping the security, you can read more here: https://lightning.network/


How do you create a wallet with MultiBit? I just downloaded MultiBit for Windows and I am trying to create a wallet. When I click that, nothing happens.  It just says "connecting" on the bottom left status bar. No wallets are seen.

Well, I did that (clicked "create wallet") and nothing happened.  The wallet file shows up in the correct spot on my desktop (the .wallet file I mean...) but nothing show up in the wallet column on the app itself.

Perhaps my firewall is blocking something?  on the bottom left it does not say "connected".

To create a wallet in MultiBit:

Open MultiBit.
Click on "New Wallet"

Enter a proper name for your wallet.

Wallah! A wallet!

It sounds to me like you're having connection troubles, though. Are you behind a firewall, proxy, or anything that could interfere with your connection? Consider trying a new internet connection.

Here is the MultiBit Help page: https://multibit.org/help.html


Withrdawing bitcoin from web-based exchange wallet to local wallet. My wallet passphrase is requested- is this necessary? I understand (maybe incorrectly) this is the seed passphrase/ the 12 words generated when wallet is created. Is this normal to provide this information to the web-based wallet when sending it, to receive it in a local wallet?

When withdrawing the funds from the "cloud" wallet to my local wallet.. wouldn't providing my seed/passphrase be a security flaw as a wallet can be recovered from it? Or am I interpreting this as the wrong passphrase...? I am using Electrum as my local wallet.

NEVER share your seed pass phrase/mnemonic. Anyone that has it can steal your bitcoins, and there is NO reason a web-wallet would need it in order to transfer your funds.

If the web-wallet is requesting a password in order to withdraw funds, it is most likely the password to log in to your web wallet account, or a secondary password you set up to spend funds from your web wallet account.


How can I run Bitcoin Core with the -zapwallettxes option in Windows OS I have been trying to run Bitcoin Core with -zapwallettxes option by starting the command line prompt, and typing (cmd.exe) Start bitcoin-qt with --zapwallettxes=1 but it keeps saying Windows cannot find bitcoin-qt. I am trying to remove a stuck transaction and have the bitcoins back in my wallet. Any help would be much appreciated.

James

First always backup your wallet.dat prior to actions then

Try running

"C:\Program Files (x86)\Bitcoin\bitcoin-qt" --zapwallettxes=1

or

"C:\Program Files\Bitcoin\bitcoin-qt" --zapwallettxes=1


How to recover access to funds with blockchain.info passphrase Now at blockchain.info wallet I did backup my pass phrase. But I have no idea what my private key(s) are. There is no export that I can find. I understand there used to be.

If blockchain.info goes out of business, can I use my pass phrase to gain access to my funds from another wallet?

The answer is yes, I can access my funds using only my pass phrase.

Mycelium, for example, when installed, comes up and asks if I want to restore a wallet from a 12-word passphrase, which is what blockchain.info created.

It then found my funds and will allow me to send / receive.

I have since learned that the pass phrase is just used to generate the private key using the SHA-256 hash algorithm.