Would moving a transaction from an old block to a new one allow more pruning? At Pruning the branches in Merkle Tree Nick ODell writes "A leaf (transaction) can be pruned when all of its outputs have been spent." So I was thinking that if a transaction is one of the last few in a block, a miner can copy the transaction into the new block being mined.  That way the miner (and the rest of the network) no longer needs that block for validation, and it can be release into the ether.

Nick also wrote that Bitcoin core won't prune that way anyway because it operates "on the assumption that you download and validate all blocks."  I am exploring the reasons for this to see if they can be addressed without keeping everything.

The idea behind downloading the entire blockchain before starting pruning mode is that you want to make sure what you start with is valid.  The only known way to do that is to get the whole thing.  Or is it?  It seems that the ubiquity of the blockchain itself is matched by the ubiquity of the valid UTXO set, so if you get a valid UTXO set and it matches what every other node says, you're good to go.  Except for Sybil attacks, right?  Would such a successful Sybil attack also allow the blockchain itself to be faked?

One difficulty with my move-a-transaction approach is that when a new node is downloading the blockchain (however much of it is still needed) it will want to verify each block, and if block X is missing, then all the blocks that contain inputs that were created in block X can't be validated, if that means validating that the transactions in it are valid.  However, the blockheader itself can still be validated.  Block X's header can't be validated because it's contents are missing.  But isn't the fact that the hash from block X is required in block X+1 enough to trust that block X was valid, and that, therefore, so are blocks X+1, X+2, X+3, etc., all the way up to and including whatever block-being-validated contains a transaction that uses an output (presumably) created in block X?

When a transaction finally shows up that does spend an unspent output from the moved transaction, it won't be possible to validate it because block X is missing.  However, if the index that identifies which block holds which transaction were updated by the miner who moves the transaction, then this is simple to solve.

Would that index-update have to address all the immediate-child transactions of the moved transactions as well so that existing, previously valid transactions could still be validated by finding the source transaction in the newly mined block?  I don't think it's necessary to re-validate transactions that are in blocks with validated headers, is it?

This seems a lot of effort for absolutely no benefit.

In the Bitcoin pruning model you discard ALL those old blocks anyway, and JUST keep the utxo set. It doesn't matter whether a utxo is in an old block or a new block, you're still keeping it in the utxoset. Any blocks you keep around is merely for convenience and to assist other nodes that request those blocks.


Recommended fee for an 100 Euro deposit What is a solid amount of fee for a 100 Euro transaction right now?

I have googled myself but the results were quite confusing to me.

I've had a bad experience with my last payment due to a low fee, so I don't want to go along that road again...

The euro value of the btc transacted does not affect the fee rate at all. What matters is the size in bytes of the raw transaction. Larger size = more fees, and vice versa.

What decides the size of a transaction? There are a few variables, but for basic transactions what will matter is the number of inputs, and the number of outputs.

You wallet software may provide a few different 'fee levels' to choose from, or it may allow you to choose a fee rate manually (this should be listed in satoshi/vbyte). At any given moment, the fee rate depends on how many other transactions are being processed, and what their fee rates are.

Think of it as a tour bus that only has room for a certain amount of people, when the demand is higher than there are number of seats, whoever pays most gets to take the bus trip first (where 'taking a trip' = having your tx confirmed in a block). Everyone else who offers to pay less will have to wait for the next trip (the next block, or longer, depending on how far back in the queue they are).

You can check to see what other people are currently willing to pay by looking at a website like Johoe's Mempool. The charts on that page show the number of txs currently in queue, and what the fee rate they are offering is. So to get your transaction confirmed right away, you will need to set a fee rate that is at the top of the chart (right now, it looks like 140+ sat/vbyte will work). Personally, I find looking at the mempool and manually estimating what the fee rate should be works better than the software solutions that just have a couple automatic options (I've tried a few different mobile wallets like this: usually they either give you an estimate that is probably higher than needed, or one so low that I know it won't confirm for days or more).

Keep in mind, if a lot of other people are looking at the graph and also submitting txs right now, there is a chance that what looks like a good fee rate now will not be enough in 10 minutes (because everyone else also sees 140 is the minimum right now, and so they all offer 200. Now your 140 is stuck in line behind them)!


Is there any software available for testing of Bitcoin security? I'm currently in the process of working on my thesis about Bitcoin security and I'm wondering if there's any software available for testing of Bitcoin security? For example, are there any programs that will try launching double-spend attacks, simulate a 51% attack, or the like?

testnet-in-a-box is a simple way to set up your own testnet network, separate from the main one.  That lets you mine your own blocks easily because the difficulty will stay low.  Then you can play around with double-spending your own coins to yourself without inconveniencing others, and without needing large amounts of hash power.


Why do people mine crypto currencies? I have read many articles and watched videos but I still can't fully understand Bitcoin, mining and blockchains. I understand a block in a blockchain contains data and its resulting hash. I also understand a miner attempts to generate a new hash by hashing the previous hash in the chain with a nonce. A miner will keep trying until they create a hash with required difficulty level.

I think I understand what happens during mining by I don't
understand why we mine? i.e. Yeah I found a block so what? (of
course miners are rewarded but why?)
How would people use this found block in a real life scenario?
Is the data in a block a real life scenario data.

A real life example will be appreciated.

If people are going to down vote please let me know why so I understand?

I think I understand what happens during mining by I don't understand why we mine? i.e. Yeah I found a block so what? (of course miners are rewarded but why?)

Miners are rewarded for mining via the block subsidy and the transaction fees (transaction fees are paid to miners). They mine in order to earn that reward; the reward has value and therefore miners will want to get it by mining.

  How would people use this found block in a real life scenario?

Blocks are not just arbitrary data, they are part of the Bitcoin blockchain and used to store transactions that are considered permanent. They don't have any other use. The point of blocks is to have a permanent transaction history that is guaranteed by the work that miners must do to create the block.

There is no other "real life scenario" or "real life example" to give here for blocks; that's just not how they work.


How to create a cryptocurrency backed by an asset (say a fiat currency or physical commodity) I want to create a cryptocurrency for use between myself and a collection of friends (as a proof of concept).

Assuming that I want to peg my cryptocurrency to (say) the Chinese Renminbi and the price of Wheat, what would be the steps in creating such a cryptocurrency?

Value is a subjective matter and as such you can't make something be worth something else.

As such, your best bet is to create a cryptocurrency and have all participants agree that it's worth the desired asset.

Every other scheme with oracles and "smart contracts" and whatnots are just an iteration of the previous aforementioned social contract between the participants of the network.

If you still want to try to develop something I'd advise you to take a look at MakerDAO and DAI from Ethereum, here. They are working on creating a stablecoin without any of the stable asset. Be advised that any people (me included) have doubts about that.


How can I regain coins on a device with insufficient memory to fully synchronize? I have started syncing the blocks and didn't know how much room was need, I am about 40 gb through and my device is full. I already have money on the account, but it isn't synced far enough to send the bitcoins out.

You can always save the private key and import it to another wallet, or in a web wallet for more convenience.


How to enable replace-by-fee via command-line in bitcoin-core? Alright, so I'm convinced replace-by-fee is a good thing. I've read it's opt-in, so how can I enable it in my bitcoin-core wallet? I don't find any flag to pass it when launching it. I want all my outgoing transaction have replace-by-fee enabled.

According to bitcoin core version 0.12.0 release notes:

It is now possible to replace transactions in the transaction memory pool of Bitcoin Core 0.12 nodes.
Transaction replacement can be disabled with a new command line option, -mempoolreplacement=0.
Note that the wallet in Bitcoin Core 0.12 does not yet have support for creating transactions that would be replaceable under BIP 125.

So the mempool can be configured to accept/reject replacement transactions, but there is not support yet for creating replaceable transactions.
Bitcoin v0.12.1 release notes do not include any modification regarding RBF.
The functionality for the wallets is split in two:

Mark the transactions as RBF (pull request not merged yet).

Replace fee of transactions that were already sent using RBF (no code or pull request in Core yet, but some scripts by Peter Todd can be used).


Tampering with the last block In a blockchain, considering that each block stores the hash of the previous block, the hash of the last block is not stored anywhere. How is this block tamperproof?

The hash that identifies a block is calculated from the block header. This hash must fulfil the difficulty requirements. Every node will check any block that they receive for validity. Since it requires a lot of proof of work to create a block whose hash fulfils the difficulty statement, it's infeasible to fake blocks and trivial to verify valid blocks.


Why shouldn't I accept PayPal when trading bitcoin? I've heard that it's not a good idea to accept PayPal payments in exchange for Bitcoin. Why?

First of all, it is likely a violation of PayPal's Acceptable Use Policy as of Oct 2011:

  3(h) involve currency exchanges or check cashing businesses

Given this, it's unlikely that PayPal would be amenable to helping at best, and may close your account (and freeze the funds it had for six months) at worst.

Another chief problem is the high likelihood of chargebacks. PayPal has generally sided with the buyer when any dispute is brought against the seller for any reason. For this reason alone, it's best to accept Bitcoin only when you trust the buyer and have some influence on their reputation.

Furthermore, Paypal has high fees (current 2.9% + $0.30 USD).


Reliable, efficient way to parse the blockchain into a SQL database I need to generate a SQL database (preferably SQLite3) of every transaction that has occurred in the blockchain. Is there an efficient way to do this using open-source software? I'm attempting to do it myself using a Haskell script that makes system calls to bitcoind but I'm having trouble making it sufficiently fast.

I created a fork of blockparser with a 'csvdump' command that will generate a details dump of the blockchain in CSV format.  There are also some support scripts in that repository for creation, population and periodic update of a PostgreSQL database.

Be aware that the resultant database is pretty large; you might want to consider PostgreSQL over SQLite for this one.


How can I recover my coins? I'm using an alt coin.

The wallet would not sync so I deleted the blkindex.dat file to restart the download. I restarted the wallet client and it downloaded all the blocks, but all my coins are gone. Using a block explorer and it says the address does not exist on the network. On the transactions, all the transaction statuses show as unconfirmed.

Is it possible to get my coins back? What caused this to happen?

Coins can "appear to be there" in unconfirmed status.

It's likely that this transaction never confirmed, and whilst you may have thought that you had the coins, in reality you did not.

Unless there has been a hardfork of the PMP blockchain of some kind, all the evidence would suggest that you never had these coins in the first place. Sorry.


Lookup Full Address For Casascius Coins Can anyone tell me how I would check the public address on my old Casascius Bitcoins? I have 3 total cons but I am unable to find where or how to check the public addresses on the coins for they only have 8 characters. I have listed all 3 of the pubic addresses below if anyone can help. Thank you in advance.

1) 134xRg9x
2) 1359wf1p
3) 1348FHtv

Thank YOU!

Here is the full list of casascius coins.

According to that your addresses are:

134xRg9xsjvmyGxA2ndDbfEw3keqizwzWG
1359wf1p4wvw7SLa8Fktsg6eJMkbUaXp5y
1348FHtvGk6Cwv9PkFw52BKSQnm1Ujf9zb


How to redeem a basic Tx? Given a raw, standard Tx (wiki):

01000000

01
26c07ece0bce7cda0ccd14d99e205f118cde27e83dd75da7b141fe487b5528fb
00000000
8b
48304502202b7e37831273d74c8b5b1956c23e79acd660635a8d1063d413c50b218eb6bc8a022100a10a3a7b5aaa0f07827207daf81f718f51eeac96695cf1ef9f2020f21a0de02f01410452684bce6797a0a50d028e9632be0c2a7e5031b710972c2a3285520fb29fcd4ecfb5fc2bf86a1e7578e4f8a305eeb341d1c6fc0173e5837e2d3c7b178aade078
ffffffff

02

b06c191e01000000
19
76a9143564a74f9ddb4372301c49154605573d7d1a88fe88ac

00e1f50500000000
19
76a914010966776006953d5567439e5e39f86a0d273bee88ac
00000000

and a private key:

18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

How does one construct a new transaction to redeem the coin from the second output? I've been trying to figure this out for a long while using etotheipi's diagram, but can't seem to grasp how a proper transaction is to be created. A step-by-step guide would be welcome.

In this answer, I will go through the steps necessary to redeem the second output of the transaction listed above. The answer will be limited to redeeming an output of the particular type present in this transaction (an output which requires providing a new transaction signed with a private key whose corresponding public key hashes to the hash in the script of the output in question), as this answer is already fairly long, even without taking into account other output types.

Short summary: We begin by constructing a new transaction, with a scriptSig containing the scriptPubKey of the output we want to redeem. The scriptPubKey of this transaction will contain a script that pays to a hash of a public key (Bitcoin address). We perform a double-SHA256 hash on this transaction with the four-byte hash code type SIGHASH_ALL appended to the end. We sign this hash with the private key supplied above. The scriptSig of this new transaction is then replaced with a script that first pushes the DER-encoded signature, plus the one-byte hash code type SIGHASH_ALL, to the stack, followed by the DER-encoded private key's corresponding public key.

Step-by-step description:

We start creating a new raw transaction which we hash and sign.

Add four-byte version field: 01000000
One-byte varint specifying the number of inputs: 01
32-byte hash of the transaction from which we want to redeem an output: eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2
Four-byte field denoting the output index we want to redeem from the transaction with the above hash (output number 2 = output index 1): 01000000
Now comes the scriptSig. For the purpose of signing the transaction, this is temporarily filled with the scriptPubKey of the output we want to redeem. First we write a one-byte varint which denotes the length of the scriptSig (0x19 = 25 bytes): 19
Then we write the temporary scriptSig which, again, is the scriptPubKey of the output we want to redeem: 76a914010966776006953d5567439e5e39f86a0d273bee88ac
Then we write a four-byte field denoting the sequence. This is currently always set to 0xffffffff: ffffffff
Next comes a one-byte varint containing the number of outputs in our new transaction. We will set this to 1 in this example: 01
We then write an 8-byte field (64 bit integer) containing the amount we want to redeem from the specified output. I will set this to the total amount available in the output minus a fee of 0.001 BTC (0.999 BTC, or 99900000 Satoshis): 605af40500000000
Then we start writing our transaction's output. We start with a one-byte varint denoting the length of the output script (0x19 or 25 bytes): 19
Then the actual output script: 76a914097072524438d003d23a2f23edb65aae1bb3e46988ac
Then we write the four-byte "lock time" field: 00000000
And at last, we write a four-byte "hash code type" (1 in our case): 01000000

We now have the following raw transaction data:

01000000
01
eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2
01000000
19
76a914010966776006953d5567439e5e39f86a0d273bee88ac
ffffffff
01
605af40500000000
19
76a914097072524438d003d23a2f23edb65aae1bb3e46988ac
00000000
01000000

(signing stage) Now we double-SHA256 hash this entire structure, which yields the hash 9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e
We then create a public/private key pair out of the provided private key. We sign the hash from step 14 with the private key, which yields the following DER-encoded signature (this signature will be different in your case): 30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06 To this signature we append the one-byte hash code type: 01. The public key is: 0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6
We construct the final scriptSig by concatenating:

One-byte script OPCODE containing the length of the DER-encoded signature plus 1 (the length of the one-byte hash code type)
The actual DER-encoded signature plus the one-byte hash code type
One-byte script OPCODE containing the length of the public key
The actual public key

We then replace the one-byte, varint length-field from step 5 with the length of the data from step 16. The length is 140 bytes, or 0x8C bytes: 8c
And we replace the temporary scriptSig from Step 6 with the data structure constructed in step 16. This becomes: 4930460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc0601410450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6
We finish off by removing the four-byte hash code type we added in step 13, and we end up with the following stream of bytes, which is the final transaction:

01000000
01
eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2
01000000
8c
4930460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc0601410450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6
ffffffff
01
605af40500000000
19
76a914097072524438d003d23a2f23edb65aae1bb3e46988ac
00000000

Python example code:

I have created an example Python script which does all the above. It is intentionally as verbose as possible, and heavily commented, with as few functions as possible, in order to resemble the step-by-step guide above. The number of code lines can easily be reduced to one half, but I choose to post it in this verbose format as I judge that it's the easiest to follow (ie. no 'jumping' backwards and forwards through functions). The script contains 76 non-empty, non-comment lines.
The script depends on bitcointools (for serializing and deserializing transactions, and base58 encoding/decoding) and ecdsa_ssl.py from my fork of joric's brutus repository (for constructing public/private EC key pairs and ECDSA signing). The easiest way to get the script to run is to clone bitcointools into a folder, and put ecdsa_ssl.py from the above URL in the same folder along with this script, and executing the script from there.
You will want to replace the address in the SEND_TO_ADDRESS variable in this script with the address you want the coins sent to, unless you're feeling generous :).

#bitcointools
from deserialize import parse_Transaction, opcodes
from BCDataStream import BCDataStream
from base58 import bc_address_to_hash_160, b58decode, public_key_to_bc_address, hash_160_to_bc_address

import ecdsa_ssl

import Crypto.Hash.SHA256 as sha256
import Crypto.Random

#transaction, from which we want to redeem an output
HEX_TRANSACTION="010000000126c07ece0bce7cda0ccd14d99e205f118cde27e83dd75da7b141fe487b5528fb000000008b48304502202b7e37831273d74c8b5b1956c23e79acd660635a8d1063d413c50b218eb6bc8a022100a10a3a7b5aaa0f07827207daf81f718f51eeac96695cf1ef9f2020f21a0de02f01410452684bce6797a0a50d028e9632be0c2a7e5031b710972c2a3285520fb29fcd4ecfb5fc2bf86a1e7578e4f8a305eeb341d1c6fc0173e5837e2d3c7b178aade078ffffffff02b06c191e010000001976a9143564a74f9ddb4372301c49154605573d7d1a88fe88ac00e1f505000000001976a914010966776006953d5567439e5e39f86a0d273bee88ac00000000"
#output to redeem. must exist in HEX_TRANSACTION
OUTPUT_INDEX=1
#address we want to send the redeemed coins to.
#REPLACE WITH YOUR OWN ADDRESS, unless you're feeling generous
SEND_TO_ADDRESS="1L4xtXCdJNiYnyqE6UsB8KSJvqEuXjz6aK"
#fee we want to pay (in BTC)
TX_FEE=0.001
#constant that defines the number of Satoshis per BTC
COIN=100000000
#constant used to determine which part of the transaction is hashed.
SIGHASH_ALL=1
#private key whose public key hashes to the hash contained in scriptPubKey of output number *OUTPUT_INDEX* in the transaction described in HEX_TRANSACTION
PRIVATE_KEY=0x18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

def dsha256(data):
   return sha256.new(sha256.new(data).digest()).digest()

tx_data=HEX_TRANSACTION.decode('hex_codec')
tx_hash=dsha256(tx_data)

#here we use bitcointools to parse a transaction. this gives easy access to the various fields of the transaction from which we want to redeem an output
stream = BCDataStream()
stream.write(tx_data)
tx_info = parse_Transaction(stream)

if len(tx_info['txOut']) < (OUTPUT_INDEX+1):
   raise RuntimeError, "there are only %d output(s) in the transaction you're trying to redeem from. you want to redeem output index %d" % (len(tx_info['txOut']), OUTPUT_INDEX)

#this dictionary is used to store the values of the various transaction fields
#  this is useful because we need to construct one transaction to hash and sign
#  and another that will be the final transaction
tx_fields = {}

##here we start creating the transaction that we hash and sign
sign_tx = BCDataStream()
##first we write the version number, which is 1
tx_fields['version'] = 1
sign_tx.write_int32(tx_fields['version'])
##then we write the number of transaction inputs, which is one
tx_fields['num_txin'] = 1
sign_tx.write_compact_size(tx_fields['num_txin'])

##then we write the actual transaction data
#'prevout_hash'
tx_fields['prevout_hash'] = tx_hash
sign_tx.write(tx_fields['prevout_hash']) #hash of the the transaction from which we want to redeem an output
#'prevout_n'
tx_fields['output_index'] = OUTPUT_INDEX
sign_tx.write_uint32(tx_fields['output_index']) #which output of the transaction with tx id 'prevout_hash' do we want to redeem?

##next comes the part of the transaction input. here we place the script of the *output* that we want to redeem
tx_fields['scriptSigHash'] = tx_info['txOut'][OUTPUT_INDEX]['scriptPubKey']
#first write the size
sign_tx.write_compact_size(len(tx_fields['scriptSigHash']))
#then the data
sign_tx.write(tx_fields['scriptSigHash'])

#'sequence'
tx_fields['sequence'] = 0xffffffff
sign_tx.write_uint32(tx_fields['sequence'])

##then we write the number of transaction outputs. we'll just use a single output in this example
tx_fields['num_txout'] = 1
sign_tx.write_compact_size(tx_fields['num_txout'])
##then we write the actual transaction output data
#we'll redeem everything from the original output minus TX_FEE
tx_fields['value'] = tx_info['txOut'][OUTPUT_INDEX]['value']-(TX_FEE*COIN)
sign_tx.write_int64(tx_fields['value'])
##this is where our scriptPubKey goes (a script that pays out to an address)
#we want the following script:
#"OP_DUP OP_HASH160  OP_EQUALVERIFY OP_CHECKSIG"
address_hash = bc_address_to_hash_160(SEND_TO_ADDRESS)
#chr(20) is the length of the address_hash (20 bytes or 160 bits)
scriptPubKey = chr(opcodes.OP_DUP) + chr(opcodes.OP_HASH160) + \
   chr(20) + address_hash + chr(opcodes.OP_EQUALVERIFY) + chr(opcodes.OP_CHECKSIG)
#first write the length of this lump of data
tx_fields['scriptPubKey'] = scriptPubKey
sign_tx.write_compact_size(len(tx_fields['scriptPubKey']))
#then the data
sign_tx.write(tx_fields['scriptPubKey'])

#write locktime (0)
tx_fields['locktime'] = 0
sign_tx.write_uint32(tx_fields['locktime'])
#and hash code type (1)
tx_fields['hash_type'] = SIGHASH_ALL
sign_tx.write_int32(tx_fields['hash_type'])

#then we obtain the hash of the signature-less transaction (the hash that we sign using our private key)
hash_scriptless = dsha256(sign_tx.input)

##now we begin with the ECDSA stuff.
## we create a private key from the provided private key data, and sign hash_scriptless with it
## we also check that the private key's corresponding public key can actually redeem the specified output

k = ecdsa_ssl.KEY()
k.generate(('%064x' % PRIVATE_KEY).decode('hex'))

#here we retrieve the public key data generated from the supplied private key
pubkey_data = k.get_pubkey()
#then we create a signature over the hash of the signature-less transaction
sig_data=k.sign(hash_scriptless)
#a one byte "hash type" is appended to the end of the signature (https://en.bitcoin.it/wiki/OP_CHECKSIG)
sig_data = sig_data + chr(SIGHASH_ALL)

#let's check that the provided privat key can actually redeem the output in question
if (bc_address_to_hash_160(public_key_to_bc_address(pubkey_data)) != tx_info['txOut'][OUTPUT_INDEX]['scriptPubKey'][3:-2]):
   bytes = b58decode(SEND_TO_ADDRESS, 25)
   raise RuntimeError, "The supplied private key cannot be used to redeem output index %d\nYou need to supply the private key for address %s" % \
                           (OUTPUT_INDEX, hash_160_to_bc_address(tx_info['txOut'][OUTPUT_INDEX]['scriptPubKey'][3:-2], bytes[0]))

##now we begin creating the final transaction. this is a duplicate of the signature-less transaction,
## with the scriptSig filled out with a script that pushes the signature plus one-byte hash code type, and public key from above, to the stack

final_tx = BCDataStream()
final_tx.write_int32(tx_fields['version'])
final_tx.write_compact_size(tx_fields['num_txin'])
final_tx.write(tx_fields['prevout_hash'])
final_tx.write_uint32(tx_fields['output_index'])

##now we need to write the actual scriptSig.
## this consists of the DER-encoded values r and s from the signature, a one-byte hash code type, and the public key in uncompressed format
## we also need to prepend the length of these two data pieces (encoded as a single byte
## containing the length), before each data piece. this length is a script opcode that tells the
## Bitcoin script interpreter to push the x following bytes onto the stack

scriptSig = chr(len(sig_data)) + sig_data + chr(len(pubkey_data)) + pubkey_data
#first write the length of this data
final_tx.write_compact_size(len(scriptSig))
#then the data
final_tx.write(scriptSig)

##and then we simply write the same data after the scriptSig that is in the signature-less transaction,
#  leaving out the four-byte hash code type (as this is encoded in the single byte following the signature data)

final_tx.write_uint32(tx_fields['sequence'])
final_tx.write_compact_size(tx_fields['num_txout'])
final_tx.write_int64(tx_fields['value'])
final_tx.write_compact_size(len(tx_fields['scriptPubKey']))
final_tx.write(tx_fields['scriptPubKey'])
final_tx.write_uint32(tx_fields['locktime'])

#prints out the final transaction in hex format (can be used as an argument to bitcoind's sendrawtransaction)
print final_tx.input.encode('hex')


Can I Recover Bitcoins Transferred to a “Sending” Address? In a moment of carelessness, I mistakenly used one of my wallet's sending addresses as the recipient for a transfer from a bitcoin exchange. The exchange confirms the transaction completed, but nothing shows up on my end. Is there any way to recover the amount?

Bitcoin payments are irreversible

  Any transaction issued with Bitcoin cannot be reversed, they can only
  be refunded by the person receiving the funds. That means you should
  take care to do business with people and organizations you know and
  trust, or who have an established reputation. For their part,
  businesses need to keep control of the payment requests they are
  displaying to their customers. Bitcoin can detect typos and usually
  won't let you send money to an invalid address by mistake. Additional
  services might exist in the future to provide more choice and
  protection for the consumer.

No, they might not be lost. Addresses can both be used both for sending and receiving transactions. You have sent them to one of your own addresses. In your case you transferred to another address you own. So your wallet will have a new total minus the transaction cost. So technically, you could refund yourself again but you will loose another transaction cost.

Crucial note:
All of this depends on your wallet. Some online wallet services share addresses between different users, so you want to be careful if you are using one of those.

If you are using the standard client, all your addresses are fully under your control and are safe to receive transactions.

Source


Bitcoin Wallet Unsynched and Lost BTC? I downloaded the original bitcoin wallet for the mac in 2014. I purchased my first BTC around that date and I simply did not keep my wallet synched and up to date. I attempted to download the blockchain from bitcointalk.org and it did not work. However, after downloading, my wallet now says I have 0.0 BTC available and 0.0BTC pending. However, on the right side you can still see the transaction history from when I originally bought the BTC and it shows the full amount there. Is my BTC permanently gone? How can I retrieve my BTC and synch my wallet to the current blockchain? Any help would be great and I would even be willing to send some BTC as a reward to anyone who can help me retrieve my BTC.

Do you know your Bitcoin address?

Check on https://blockchain.info/ that it still has a value.

Locate wallet.dat, it should be in ~/Library/Application Support/Bitcoin/.

Install MultiBit and get a new address.

Visit https://blockchain.info/wallet/import-wallet. Drag the wallet.dat file into the dotted area. Follow the instructions.

Send your coins from blockchain.info to your new MultiBit address.

You'll now be in control of your coins again without requiring huge blockchain downloads.


Can the 51% attack be made to become 81% attack or 91% attack? Since the 51% attack happens if there are more than 50% of nodes that fake the data on the blockchain, can it be actually 81% or 91% that is needed to fake the data, because it would be much harder if more than 80% of the nodes are "bad guys".
So what I mean is, can it be the case that even 79% cannot be an attack, but need to be a higher number, such as 81% or 91%.
It may appear if the verification of data can reach a 50% level, reaching out to 1 more node of those 50% can make it become 80% to 100% easily, so one extra step is all it takes?

The 51 percent attack isn't necessarily "faking the data". It is generally referred to say including a double spend in a block that would normally be rejected by the network but the honest part of the network struggles to reject that block and the chain built on top of it because it has a minority of hashpower. The point being that proof of work is still completed, it isn't "faked". But in answer to your question, of course a 81 percent attack or 91 percent attack would be even more concerning than a 51 percent attack. It is called 51 percent because that is the minimum needed to pull off the attack.
There is nothing that can be done to increase the minimum of 51 percent needed to pull off the attack to say 81 percent in a proof of work context, it is the nature of the system. Of course, in reality the network may choose to follow the chain with reduced proof of work but without the double spend transaction in it. It would be disruptive, extremely expensive for the attacker and could (likely) fail.


How to retrieve the from and to wallet addresses of a transaction? Given a transaction's inputs and outputs, I'd like to be able to extract the wallet address (or addresses) which sent the transaction, and also the address/addresses that will receive the transaction.

Which part / field of the input refers to the hash of the output?
And which part / field of the output refers to the address which will receive the output?

I'm using bitcoinj. I've tried looking at the scriptSig of inputs and scriptPubKey of the outputs, but it isn't making much sense to me.

E.g, for the genesis transaction: https://blockchain.info/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b?show_adv=true

The output's scriptPubKey is [04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] CHECKSIG

But the receiver address is 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

How can I extract that the receiver address is that from that scriptPubKey?

Which part / field of the input refers to the hash of the output?

The outpoint contains a txid (32 bytes) and vout (4 bytes), which specify the output you're spending.

This is not the sending address!

What you do (when you're not dealing with a coinbase transaction) is that you look up the transaction with the txid, and look at the transaction output that corresponds to vout. So, for example, if vout was 3, you would look at the fourth output of the corresponding transaction. If vout was 0, you would look at the first output. The address that can spend that output is the sending address of the original transaction.

The genesis transaction is a coinbase transaction, so the txid is all zeroes, and the vout is all ones.

  And which part / field of the output refers to the address which will receive the output?

It depends on the format of the output, but here are the general rules:

If it's P2PK, like here, run HASH160 on the first element of the scriptPubKey, then encode it as an address.
If it's P2PKH, take the third element of the scriptPubKey, and encode the pubkeyhash as an address.
If it's P2SH take the second element of the scriptPubKey, and encode it as an address with Address.fromP2SHHash.

I go into more detail about possible kinds of addresses here: Which bitcoin script forms should be detected when tracking wallet balance?

  How can I extract that the receiver address is that from that scriptPubKey?

Do this:

import org.bitcoinj.core.*;
import org.bitcoinj.params.MainNetParams;

import org.spongycastle.crypto.digests.RIPEMD160Digest;

import java.nio.file.Files;
import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Test {
    public static void main(String[] args) throws Exception {
        byte[] b;
        NetworkParameters np = MainNetParams.get();
        Context.propagate(new Context(np));
        b = Files.readAllBytes(new File("genesis.bin").toPath());
        Transaction tx1 = new Transaction(np, b);
        System.out.println(tx1);
        byte[] pk = tx1.getOutput(0).getScriptPubKey().getPubKey();
        System.out.println(bytesToHex(pk));
        System.out.println(bytesToHex(hash160(pk)));
        Address a = new Address(np, hash160(pk));
        System.out.println(a);
    }
    static byte[] hash160(byte[] in) {
        MessageDigest d1;
        try {
            d1 = MessageDigest.getInstance("SHA-256");
        } catch(NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        d1.update(in);
        byte[] digest = d1.digest();
        RIPEMD160Digest d2 = new RIPEMD160Digest();
        d2.update(digest, 0, 32);
        byte[] ret = new byte[20];
        d2.doFinal(ret, 0);
        return ret;
    }
    final protected static char[] hexArray = "0123456789abcdef".toCharArray();
    public static String bytesToHex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for ( int j = 0; j < bytes.length; j++ ) {
            int v = bytes[j] & 0xFF;
            hexChars[j * 2] = hexArray[v >>> 4];
            hexChars[j * 2 + 1] = hexArray[v & 0x0F];
        }
        return new String(hexChars);
    }
}

(Note that I have a file in my current working directory named genesis.bin, which contains the raw bytes for the genesis transaction.)

And you get:

  4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
     == COINBASE TXN (scriptSig PUSHDATA(4)[ffff001d] PUSHDATA(1)[04] PUSHDATA(69)[5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73])  (scriptPubKey PUSHDATA(65)[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] CHECKSIG)

04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f
62e907b15cbf27d5425399ebf6f0fb50ebb88f18
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

Which is the address we were trying to get.


Dont understand how to buy Bitcoin. Looked at sites but makes no sense to me I can see prices and do not understand how you buy Bitcoin. I was told you could buy as little as $1 worth.  What would you get for $100?  Nothing really helps me understand this.

Think of it like dollars and cents, pounds and pence.

Current exchange rate is US$350/BTC = $0.35/mBTC

So $1 buys ~3 mBTC (ie ฿0.0003) . Likewise $100 buys ฿0.2895.

Use this formula:

Bitcoins bought = (purchase amount) / (exchange rate)

This is no different than any exchange rate. Check out XBT @ xe.com


Is there any python lib could be used to analysis the local block data? Just downloaded all the block files to local and want to try some analysis on the transaction data in the block.
is there any python library can be used to do the analysis?

https://github.com/keviny/bitcoin-block-parser
May could help for simple analysis


What information about a transaction can be assumed accurate before confirmation? When sending a Bitcoin transaction, what information in that transaction can be assumed to be accurate before receiving a confirmation?

Can you verify the from address?
Can you verify that the amount transferred is accurate?
Can you verify that the sender has enough balance to be sending this amount?
Anything else?

Given the following two situations:

A.) Taking into account double spending.

B.) Assuming a situation where double spending is unlikely / deemed to be not worth a scammer's time.

Thank you!

Think of a bitcoin transaction as a paper check, and confirmation as cashing the check.  The check, itself, is no different prior to cashing than it is after cashing.  However, the person who gave you the check could have closed down his account after writing you the check, yet prior to you cashing the check, thus making the check invalid.  The check contains the same information, but the system to which it belongs changes.

So the account the check/transaction is drawn from remains the same.  The amount of the check/transaction remains the same.  Who the check is made out to remains the same.  However, whether or not the money represented by the check/transaction has already been claimed can change.

So:

  Can you verify the from address?

Yes

  Can you verify that the amount transferred is accurate?

Yes

  Can you verify that the sender has enough balance to be sending this amount?

Yes, but it could change if a competing transaction is broadcast prior to confirmation.  So in your scenario A, a double spend attempt could spend the UTXO before the "real" transaction makes it into a block.  This means that you can't verify the validity of your transaction until at least 1 confirmation.  In your scenario B, where double spending isn't economically feasible, you can assume that if the outputs the transaction inputs draw from are unspent, then the transaction is valid.

  Anything else?

Deriving additional information from a transaction is too large a topic for this answer.  You may want to look into blockchain analysis.

Also keep in mind that this check/transaction metaphor breaks down at some point.  For example, Bitcoin transactions can have multiple inputs and outputs.  Also, anyone can look to see whether an input is unspent, and not just a central authority.


How are bitcoins put in to circulation? I'm excited because I bought my first bitcoins today! (0.41 bitcoins at that!)
I'm wondering how they are put in to circulation? From my understanding it seems that the algorithm generates x bitcoins every hour, where x is a diminishing value, until eventually zero coins are being created... so let's say an hour from now 5 bitcoins are created... Where are they created and how are they put into circulation? Or are they created evenly throughout everyone's wallets and just distributed evenly (in which case I might receive 0.000001 bitcoins in the next hour?) And what is a bitcoin miner?

Also, what happens if my computer is destroyed and my wallet file with my bitcoins is lost? Are those bitcoins gone forever? Wouldn't this cause the supply of bitcoins to go down overtime until eventually there are very few bitcoins left?

Thanks! God bless!

(I bolded my 3 questions so that they are easy to find and answer).

Let me answer your questions out of order:

  What's the point of bitcoin mining / how they are put in to circulation?

https://bitcoin.stackexchange.com/a/3201/2306

  what happens if my computer is destroyed. Are those bit coins gone forever?

Yes.

  Wouldn't this cause the supply of bit coins to go down overtime until eventually there are very few bit coins left?

Yes.


Is there a way to run bitcoind without being a full node? I want to be able to run bitcoind on a VPS I rented, but I neither have good bandwidth nor RAM so I do not want to be a full node.  How would I go about configuring things so that I can run bitcoind without acting as a full node or relaying transactions?

You might not want to run bitcoind at all then, you could just use a client-only node (AKA thin client) tool such as bitcoinj.

Before going for a thin client approach, make sure you understand the differences from running a full node and also some security concerns.


How to track Segregated Witness adoption rates How can I find out what the current Segregated witness adoption rate is, so as to see how it is progressing towards the 95% readiness required for it to activate.

There is nothing to track until 0.12.2 is released. Once that happens the process is described here:

https://bitcoinmagazine.com/articles/the-segregated-witness-timeline-from-idea-to-adoption-in-six-steps-1461255570

"First, miners (or pools) running Bitcoin Core 0.12.2 (and Bitcoin implementations that merged similar code), automatically start signalling they are ready to mine Segregated Witness transactions. This happens through version bits they include in blocks they do mine that indicate what types of transactions and blocks they can mine.

Once miners representing 95 percent of hash power (1,916 blocks) within a single difficulty period (2,016 blocks/about two weeks) include the right version bit, the soft fork is locked in."

Block explorers will make it easy to track the progress after 0.12.2 is released


Which KYC solution providers are used by Bitcoin companies? I am wondering which Know Your Client solution providers are used by Bitcoin companies?

Jumio is used by a few companies, including SnapSwap, CoinMKT, etc. Their notable products include NetVerify and BISON.
miiCard is used by Bylls and Bittylicious.
Sphonic is used by Bitnet.


How to buy with Poloniex API? Hi I have a question about buy method. Recently I received successful message from Poloniex
I run once buy order method with option immediateOrCancel.
I get two trades instead of the expected one.

{'orderNumber': '269159954730', 'amountUnfilled': '0.00000000', 'resultingTrades': [{'total': '0.00323034', 'tradeID': '16775174', 'amount': '0.10364748', 'rate': '0.03116670', 'date': '2018-04-22 10:59:11', 'type': 'buy'}, {'total': '0.05271018', 'tradeID': '16775175', 'amount': '1.68942915', 'rate': '0.03120000', 'date': '2018-04-22 10:59:11', 'type': 'buy'}]}

Could someone help me with that or say why it's happend?

What was your purchase amount set at? 0.03120000??

It would appear that you tried to buy at 0.03120000

however as there was a sell order already placed at 0.03116670 you filled that order first, then completed your buy with the rest of the amount at the 0.03120000


Another 140 GB for BCH? My question is should I allocate another ~140 GB of disk space for BCH full node?
Thanks!

If you want to run full BCH node - then yes. Most of these 140Gb is the same for now as with BTC node though, but that's not going to help you in reducing space requirements.

You can always run your node pruned, with ~5-10Gb space requirement max.

If you intend to run both BCH and BTC nodes at the same time on same computer - the issue will be that they both require port 8333 open. Unless you have multiple IPv4 adresses or IPv6 subnet - you will have to choose only 1 node visible to the world.


Keeping Track of User Deposits with Bitcoin I found the following statements about Bitcoin on the Ethereum SE:

When using Bitcoin one can generate new address per user of service
and save pair (address -> userId), so it is always obvious which
specific user sent coins.
Also, all these coins are stored in the wallet as UTXO, so it is easy to send them to another address paying fee once

I need to generate different unique deposit addresses for each user,
so they can send funds to their accounts while I can keep track of how
much each user deposited. This is fairly easy in other cryptos such as
bitcoin

Are these statements true?
If so, can someone explain why it "is fairly easy" to do this in Bitcoin"? Doesn't Bitcoin also require UTXO Sweep when consolidating BTC from many addresses to one address? I was under the impression that BTC does not allow multiple public addresses corresponding to a single private key?

Yes, each UTXO needs to be spend individually, regardless of which address they were received to. I think it would be appropriate to read this advice as "at least one address per customer". Having separate addresses per customer will make it much simpler for you to track which customer's account needs to be credited than having only a single address for your service altogether. However, if you're not in a scenario where you're just taking deposits for a user, but e.g. selling products or services, I would even recommend to use a separate address for each payment process, which would make it trivial to discern not only the customer but also which invoice got settled.
Today, wallets generally use hierarchical deterministic derivation to generate many addresses from one master secret. Under the hood, each address is associated with a different private key, but all private keys can be regenerated from the master secret. This allows you to track many addresses with a single wallet, but simplifies backups and secret management.
Address reuse is terrible for both your and your users' financial privacy and has no palpable advantages when you start to consider the additional overhead of figuring out who paid with which transaction. I can only vehemently dissuade from using the same address for selling to multiple customers. If you get a lot of volume, it will be trivial for people to claim foreign payments as theirs and you will lose a lot of time investigating and acquiring proof from the actual customer. Using separate addresses may be more work in the beginning, but just gets rid of this whole class of issues.


what does it mean to have >51% hashing power for mining a block? Can someone please shine some light on this and how it links to the analogy between honest node and attacker ?

also can attacker start mining 2 blocks ahead ? or 3 or 4 blocks ahead ? In the white paper it has only 1 block ?

What does it mean to have > 51% hashing power for mining a block?

Having more than 50% of the hashing power in the total network means that you are likely to produce more that 50% of the blocks at current difficultly. This alone is not bad at first.

  How does this link to the analogy between honest node and attacker ?

However with more than 50% of the blocks produced you could also start mining blocks on another private chain. While mining you could buy something from a merchant with bitcoin. On your private chain you don't include the transaction to the merchant.

Once the merchant has send you the bought goods you could broadcast the private chain. Since you have more blocks (with more hashing work put into) all honest nodes would accept your (previously private) chain as a valid chain. You'd have double spend the coins. The merchant wouldn't have received any coins for the send goods.

  Also can attacker start mining 2 blocks ahead? or 3 or 4 blocks ahead?

It only makes sense to mine a block on top of another valid block. You need block A to mine block B. However you don't have to broadcast A to mine B.


is bitcoin stability by securitization possible? Bitcoin is subject to high volatility with little means of hedging. The available ways of hedging being to be short or buy puts on VERY ILLIQUID exchanges that contain no market participants, no market makers, or any order book depth.

could a hedged bitcoin fund with redeemable shares act as a stabilized security?

This, of course, creates a quasi-central banker role, where proper management can lead to stability, but proper management may not always be. But it is more inline with commodity hedging, where a producer (of crops for instance), hedges his output with futures. Such a quasi-hybrid role being fit for a quasi-commodity currency.

As such, an Exchange Traded Fund (ETF) or Exchange Traded Notes (ETN) can be created on existing exchanges. Securitization is practically the wild west even amongst the myriad of regulators, making the leverage and hedging possibilities endless.

Anyway, thoughts on why this would or would not work for bitcoin as the underlying asset?

proper tags: securitization, securities, etf, etn, hedging

Yes, this is possible but like cracking a good hash, signature, or key it is improbable.

Assuming that the supply of a coin remains perfectly stable and is expected to do so, some massively overwhelming amount of derivatives could do this, but there would have to be no transaction costs to achieve this level of stability because any cost to trade will be passed onto to the holder as volatility since any cost would reduce the demand for those volatility-reducing derivatives.

A single entity would not be able to do this; furthermore, a large percentage of total world wealth would have to be dedicated to this purpose, all hedging and speculating in random harmony.

Those are the conditions for perfect price stability through relying on derivatives.

Determining liquidity levels is better when cryptocurrencies are compared to their fiat counterparts.  Bitcoin is 3x the spread for fiats, last I checked, so there is still plenty of transaction costs.  This is not to say that fiats and securities don't have transaction costs.  For one thing, locked markets are forbidden, so there will always be transaction costs in the amount of the bid-ask spread for the duration of that restriction.  This shows that for the level of price stability achieved by other fixed supply commodities, cryptos would have to be at approximately equal to such commodities respective ratios of notional to underlying.

Most cryptos have a wall on this potential in the form of confirmation times.  A dynamic trader cannot exist in a market with one hour delays on trade confirmations even at the periphery since they need to trade between exchanges and other assets.  The low confirmation cryptos have the best chance for stabilization by derivative.

However, this isn't to suggest that approaching the ideal isn't possible.  The more derivatives that are tied to an underlying coin will result in more price stability for that coin.


Can bitcoins be counterfeited? Traditional currencies have anti-counterfeiting features designed to make them hard to copy, but despite this attempt counterfeit money is a real threat.  Since bitcoins are digital, it's trivial to copy them.  Does this mean that bitcoins can be counterfeited?

There is no such thing as a "bitcoin" that can be copied. Rather, there is a list of all the transactions that have taken place on the bitcoin network and the order they have taken place. Every client has a copy of this list. Essentially, the only way to counterfeit bitcoins would be to spend them in more than one place. This is called a double-spend attack. However, because of the design of the bitcoin block chain (the list of all the transactions) and the way that list is secured by mining, this requires a tremendous amount of computer power.

http://en.bitcoin.it/wiki/How_bitcoin_works#Double_spending

See also the question about how mining works

What exactly is Mining?


What makes an unconfirmed tx 'suspicious'? (likely to be replaced or never confirm) When looking at Bitcoin unconfirmed transactions, I'm trying to distinguish between txs that are likely to confirm (whether that be in the first next block or in 2 hours) versus txs that are likely to be replaced, or never to confirm at all.

Obviously, txs with the opt-in RBF flag fall in the latter category.

But I guess there are other criteria, such as:

having an extremely low fee, or even zero fee.
Having lots of dust outputs.
Depending on unconfirmed inputs.

Anything else I should take into consideration? What other factors could make a tx less likely to end up confirmed?

For example, besides dust output, do dust (i.e. many small) inputs make a tx less sure to confirm? (other than more inputs causing larger tx data, thus resulting in a lower fee when measured in satoshis per KB)

Replacing transactions without confirmation is relatively easy.
I would tag every transaction without confirmation as "suspicious".

RBF is a policy and miners could also replace transaction that do not sign opt-in-RBF.

Best way to check if a 0-conf transactions will be mined soon:

check nSequence number (only accept 0-conf if nSequence number is INT_MAX)
check the transactions fee-rate and compare it with your estimated fee (requires a mempool/bitcoin-core)
Calculate the risks: every 0-conf transaction can be replaced/double-spent! High value items should not be "dispatched" < 6 confirmations (IMO).


Why do AMD's GPUs mine faster than Nvidia's? I have been searching Google all day and cannot find any real information. I'm looking for information in detail, such as specifications or the qualities of the GPUs that make the differences.

Summary: different approach to calculations. Nvidia GPUs are more like CPUs, in that they have only a few processors that do work, but faster. ATI GPUs have slower processors, but a lot more of them.

You can find a more complete description on the relevant wiki page :

  Firstly, AMD designs GPUs with many simple ALUs/shaders (VLIW design) that run at a relatively low frequency clock (typically 1120-3200 ALUs at 625-900 MHz), whereas Nvidia's microarchitecture consists of fewer more complex ALUs and tries to compensate with a higher shader clock (typically 448-1024 ALUs at 1150-1544 MHz). Because of this VLIW vs. non-VLIW difference, Nvidia uses up more square millimeters of die space per ALU, hence can pack fewer of them per chip, and they hit the frequency wall sooner than AMD which prevents them from increasing the clock high enough to match or surpass AMD's performance. This translates to a raw ALU performance advantage for AMD:

AMD Radeon HD 6990: 3072 ALUs x 830 MHz = 2550 billion 32-bit instruction per second
Nvidia GTX 590: 1024 ALUs x 1214 MHz = 1243 billion 32-bit instruction per second

  This approximate 2x-3x performance difference exists across the entire range of AMD and Nvidia GPUs. It is very visible in all ALU-bound GPGPU workloads such as Bitcoin, password bruteforcers, etc.

  Secondly, another difference favoring Bitcoin mining on AMD GPUs instead of Nvidia's is that the mining algorithm is based on SHA-256, which makes heavy use of the 32-bit integer right rotate operation. This operation can be implemented as a single hardware instruction on AMD GPUs (BIT_ALIGN_INT), but requires three separate hardware instructions to be emulated on Nvidia GPUs (2 shifts + 1 add). This alone gives AMD another 1.7x performance advantage (~1900 instructions instead of ~3250 to execute the SHA-256 compression function).

  Combined together, these 2 factors make AMD GPUs overall 3x-5x faster when mining Bitcoins.


resetting blockchain and transactions won't clear stuck transaction I'm using MultiBit Classic (sorry) and I have a stuck sent transaction due to low fee.

I keep resetting the blockchain and transactions in the application, but the transaction in question keeps showing up.

Should I be just waiting longer for the transaction to drop? Is constant opening MBC just making the problem worse?

Not sure if this is the real solution, but I exported my MultiBit Classic private keys and imported my address to blockchain.info wallet service.

Once I did that my transaction was confirmed within 24hrs.


Uncomfirmed Transaction I sent 2.1439245 bitcoins to
1AEcB37MngXzuvailFr1f31qobvzBFXF4e9
on May 27 and the transaction has still not been received. I contacted the merchant that I bought from and they said that they have not received any bitcoins and I should claim for a refund.
The transaction number is
6ff626d639d4fb9658ecaff

As others already pointed out, neither the address nor the transaction id are valid. Therefore, you have not sent any bitcoin when using that address, except if you wallet is really poorly made.

It might, however, be the case that you wallet doesn't show you the funds any more if you tried to send them. In this case, export your private key and create a new wallet using it. The new wallet will show you your funds and you'll be able to send them to a correct address.


Automate Bip39 seed recovery I recently was locked out of my Ledger NanoS when I forgot the pin code. Upon trying to reset from my recovery phrase I realized that I only have 23 of the 24 required words (not sure how it happened unfortunately). I am not positive which position the word is in but I am certain the order of the other 23 words is correct.
That being said I have to try all possibilities in every other position.

I found this post giving me a list of words to populate the missing word:
Lost my Bitcoin wallet and have only 11 out of 12 mnemonic seed phrase words. How can I get my Bitcoins?

I am searching for a piece of code that would allow me to churn the solutions without manually trying the wallets 1 by 1.

Do you know one of the addresses in the keychain? Ledger uses BIP44 derivation so you could write a loop to check different seed phrases and check the resulting addresses against an address you know that should be in the keychain. This way you can type in your recovery words without having to be online.

For example if it were me I'd probably write something using the bitcoinjs-lib. Here's a start written with bitcoinjs (NOTE I'm using version 3.3.2). This will take a recovery seed and an address and it will search the keychain and tell you whether or not the address exists within it.

//var words = "segment increase inch ensure corn cigar suggest fetch output proof peasant enact";
//var addr = "1c4XzQx7Uh8CnxzAN5CRrUjkbxGB1GUWp";

var searchbtn = document.getElementById("searchbtn");
searchbtn.onclick = function(){

    var words = document.getElementById("words").value;
    var addr = document.getElementById("addr").value;
    var depth = document.getElementById("depth").value;
    inkeychain(addr, words, depth);
}

function inkeychain(addr, keychain, depth){
    var isfound = false;
    for(var i=0;i<depth;i++){
        var seed = hd.bip39.mnemonicToSeed(keychain);
        var root = b.bitcoin.HDNode.fromSeedBuffer(seed)
        //const root = bitcoin.HDNode.fromSeedHex(seed.toString('hex'))
        var wallet = root.derivePath("m/44'/0'/0'/0/"+i);

        //legacy
        var address = wallet.getAddress();
        var wif = wallet.keyPair.toWIF();

        //segwit p2sh
        var pubKey = wallet.keyPair.getPublicKeyBuffer();
        var pubKeyHash = b.bitcoin.crypto.hash160(pubKey);
        var redeemScript = b.bitcoin.script.witnessPubKeyHash.output.encode(pubKeyHash);
        var redeemScriptHash = b.bitcoin.crypto.hash160(redeemScript);
        var scriptPubKey2 = b.bitcoin.script.scriptHash.output.encode(redeemScriptHash);
        var p2shsegwit = b.bitcoin.address.fromOutputScript(scriptPubKey2);

        if(address===addr){
        isfound = true;
            console.log(address, wif);
            $('#result').html('Found '+addr+' in this keychain at '+i+' position in the keychain');
            alert('Found!');
        } else if (p2shsegwit===addr){
            //check for segwit p2sh
            isfound = true;
            console.log(p2shsegwit, wif);
            $('#result').html('Found '+addr+' in this keychain at '+i+' position in the keychain');
            alert('Found!');
        }
    }
if(isfound===false){
    $('#result').html('No matches');
}

}

https://bitcoinfunction.com/?id=5d9ea508d9bed

From here you could take it a step further and make the words variable an array with all your different combos and then loop them all through.


How to deterministically generate large number of bitcoin addresses and monitor them I want to generate a large number of bitcoin addresses to provide visitors for each transaction and I want to monitor payments to those addresses.

How do I deterministically generate those large number of addresses and monitor payments to them.

One options would be a bitcoinJ - bitcoin java library.

new ECKey().toAddress(new MainNetParams()).toString();

gives you a valid bitcoin address.


how do you get your computer not to run out of memory with the system syncing after choosing a wallet Bitcoin core, they have a 7 years system sync which i am a first time user.  I didn't know that and money was sent to the account.  I can't access the money.  It is not showing up.  Back to the issue besides where is my money.  My computer can't upload all the syncing because it is running out of memory.  I backed up my computer erased most of the backup and still don't have enough memory.  so someone please tell my way your app takes up and over my whole computer.  Please get this to work as i am not a tech person or anything but i am extremely disappointed with the tech side trying to help.

You can configure Bitcoin Core to run with --dbcache=50 which will limit the database cache size to 50MB (default is 100MB).  You can read more about it here.

Alternatively, you probably don't need to be running a full node, and should instead consider using an SPV wallet, which will consume a lot less of your system resources.


Create a transaction from addresses A and B sending to address C Related: Using bitcore to create a transaction with two addresses and change address

I would like to create a transaction from addresses A and B sending to address C

In the above question I get a little confused (it looks like hes doing one transaction that sends from addresses A and B to addresses C and D receiving change at address E) because it looks like he is signing it with the two receiving addresses!

Usually when I create and sign a tx with Bitcore I sign it with the sending address's private key not the receiving address (in my case the receiving address would be a user I do not personally know)

The bitcore docs say:

  To send a transaction to a multisig address, the API is the same as in the above example. To spend outputs that require multiple signatures, the process needs extra information: the public keys of the signers that can unlock that output.

var multiSigTx = new Transaction()
.from(utxo, publicKeys, threshold)
.change(address)
.sign(myKeys);

var serialized = multiSigTx.toObject();

The two parts to this that confuse me are:

Bitcore quote - To send a transaction to a multisig address...

Is this different from a regular address? I notice that the example is lacking .to(address, amount)

Why is Richard from the related question signing with the receiving address's private keys?

Logically shouldn't my desired action look something like this?:

var transaction=new Bitcore.Transaction()
.fee(fee)
.from([output_A,output_B])
.to(pubkey_C,satoshis-fee)
.change(address_A)                    //don't loose the change
.sign([privatekey_A,privatekey_B]);

output_A is from address A and output_B is from address B (both my addresses)

You are right in how your transaction should look like. However, you are getting confused since you are looking for the wrong concept.

You are not sending funds to a multisig address, that is an address shared by multiple users in which some of them need to sign a transaction or order to spend funds from the address. You are (if I've got it right) willing to spend funds from two different addresses (A and B) in order to send funds to a third address: C.

Therefore, what you should build is a transaction with inputs from both addresses A and B, in which each input may be sign by the corresponding address from the latter two.


What is the normalized transaction hash of a transaction? With the recent commotion around transaction malleability, it seems like the Bitcoin developers have been working on a semi-fix for it, called the normalized transaction hash.

It's implemented here in this pull request by sipa.

What is this hash and how is it different from the regular transaction hash? How can it be constructed? How does it try to solve the malleability problem?

It is a hash of the transaction without the input scripts.  SIGHASH_ALL says all inputs and outputs are included in the hash.  These are the areas covered by the standard payment methods and they cannot be modified without invalidating the transaction.  One of the problems, though, is that there are other payment methods which do change the inputs and thus the normalized transaction ID would change in those cases.  But it does cover the common transactions.


What's the point of having a stack-based scripting language, if only a few standard forms are allowed? What is the purpose of a stackmachine if only some standard script forms are allowed? And why are some scripts allowed and perfectly fine in mined blocks but rejected by clients if found in transactions; what's the point of that? The more I read about script the less it makes sense.

OK, the original concept of scripts was not perfect. But with p2sh (BIP-16) any script can be realized


What happen if a popular channel hub turns dishonest? I've read and watched as many presentations as I could about the lightning network.  I have a few questions about the economic model of the network.

What would happen when a large hub turns nefarious and change the transaction state dishonestly?  I understand that everyone who has an open channel with that hub can revert and back out of the channel on their own accords.  I assume the software will send the last good state of the channel back to layer 1 - bitcoin to settle.  Wouldn't that flood the blockchain with settlement transactions?  Same thing could happen if a software glitch happen to one of the hub rendering it dishonest/buggy output (like what happened with parity in Ethereum).
Since bitcoin fee is dynamic and blocksize is limited, what happen if the fee to settle a channel exceed the value of the channel itself?  Wouldn't that mean a huge amount of fund would be deadlocked?

What would happen when a large hub turns nefarious and change the transaction state dishonestly?

They can't do that. In order to change the channel state, both parties in the channel MUST sign the commitment transaction that does so. A hub is not some centralized node that has full power over all of their open channels. In order for any actions to occur in a payment channel, both parties must agree to it and sign the transactions.

  Since bitcoin fee is dynamic and blocksize is limited, what happen if the fee to settle a channel exceed the value of the channel itself? Wouldn't that mean a huge amount of fund would be deadlocked?

The fee rate paid in the commitment transactions are decided beforehand and locked into place before any transactions are made. If the fee rate were to change, then the parties in the channel can agree to increase the fee rate by using the update_fee message.


Does government really seize Bitconnect assets? https://www.coindesk.com/us-court-freezes-bitconnect-assets-as-lawsuits-mount/

This says yes.

However, bitconnect is anonymous.

So how can it be?

Any sources of the success and failure of seizing

"Seizing"
Freezing is not seizing.
Seizing would mean transferring ownership of assets to the court.
Freezing means the subjects of the orders are not able to use or dispose of assets of theirs that are under the jurisdiction of U.S. District Court, Western District of Kentucky. The final disposition of the assets depends on the outcome of a court case or on the expiry of the order.
"Government"
Whether you consider this particular court "government" probably depends on where you live.
"Anonymous"
Bitconnect is not exactly anonymous, there are names of individuals in the company registration that is associated with the business. Whether those are real names is not guaranteed. There is also a named individual in the class action
Effectiveness
I doubt any of the business' assets are currently held within the jurisdiction of this particular court.
Compliance with the order probably depends wholly on cooperation by the people involved in bitconnect. So far as I know, the court has no way to apply any sanctions if they do not cooperate.

http://internationalbusinesslawadvisor.com/worldwide-freezing-orders-enforceable-worldwide/

Is a WFO Enforceable Outside of the Country Where it was Issued?
The short answer is no. The WFO applicant must register for enforcement in the foreign country where enforcement is sought.  At such time as the foreign court approves the WFO for local application, enforcement would be proper.
The U.S. Perspective
From the U.S. perspective, courts have been hostile to the kind of relief available in foreign courts with a WFO. While U.S. courts will, as a matter of course, issue a freezing order in support of a U.S. proceeding, they have repeatedly expressed extreme reluctance to do so in support of a non-U.S. proceeding as a matter of course

"Do as you would be done by" applies?


How to paginate through api? I have looked at the following link:https://dashblockexplorer.com/api/txs/?block=990001, and I am wondering how to paginate. You may notice that pageTotal is equal to 5.

From its api info page, dashblockexplorer.com uses insigth api, and so just append to the url:

  &pageNum=#

For example, for the next page (#1, as it starts on zero):

  https://dashblockexplorer.com/api/txs/?block=990001&pageNum=1

Last page should be pageNum = pagesTotal-1


How do you setup your own Bitcoin / Litecoin / Primecoin / Altcoin pool? Whats a good tutorial? I was wondering how would one setup their own pool for one of the alt coins. Is there a good tutorial link on how to setup your own pool? I'm mainly looking to setup a datacoin pool but was wondering how to get that up.

You may find my answer on how to start mining Bitcoins useful, as it touches on setting up your own pools:

How can I start mining Bitcoin?

Also this post goes into a bit more detail on using Stratum + Push Pool.

How to setup stratum with pushpool and VARDIFF? (litecoin)

Some info on eloipool configuration:

Managing Diff variable on eloipool software

If you wanted some more specific information let me know.


How to compute merkle root without coinbasetxn? How do you build a merkle root without a coinbase transaction? I compute the merkle root without the coinbase portion and I get a different root then the submitter.

What pool are you using? As an example, if you hit (POST a request to) eligius pool (http://gbt.mining.eligius.st:9337) with the body as

{"id": 0, "method": "getblocktemplate", "params": [{"capabilities": ["coinbasetxn", "workid", "coinbase/append"]}]}

as taken from https://en.bitcoin.it/wiki/Getblocktemplate you will get a coinbasetxn field returned in the json.


Where can I find some guidelines on how to program a merged mining transaction? In answer to question "How does merged mining work?", we can read that in order to merged mine, we need to create a Bitcoin transaction containing a Namecoin block hash and put it on the tip of the merkle tree. Where can one find some guidelines or specification on how to create such a transaction?

I'd suggest looking at the merged mining spec at the bitcoin wiki.

When I was writing my merged mining implementation I also looked at the source code of namecoind, bitcoind and merged-mine-proxy.

As far as I know there is still no easier documentation on how to implement merged mining, so you will likely be looking through existing source code a lot to figure out the details. The merged mining spec was a big help for me though, even if it is a bit slim.


What malleability means is that you can create a transaction that is identical in its meaning (same inputs, same outputs) but with a different TXID. That is problematic for 2nd layer protocols where transactions build onto each other but aren't necessarily published to chain.

But a "malleated" transaction is still a double spend. And it appears newer versions  of bitcoin-core that support RBF won't accept double spends into their mempool.

See code snippet here: Validation Error: Error #-26: 258: txn-mempool-conflict


What are the ways to secure bitcoin daemon on linux? I just integreated mining pool on my server. which means miners connect to my pool and get paid. before they get paid, it goes to my address and that address is located in bitcoin daemon. What are the ways to secure coin daemon? so that no one can access it ever? if accessed , they can steal money.

Ideally, you should not be storing the wallet receiving the mining payouts on the same server that hosts your pool software.

In general, when dealing with security, you want to minimize the attack surface. Any additional software you run increases the attack surface, since any vulnerabilities in non-daemon software might allow someone to exfiltrate the wallet or to pass commands to the wallet.

Once you have the wallet on a separate, isolated server, you should follow common best practices such as not having a public RPC interface, IP whitelisting for incoming connections, change all default passwords, disable password and root ssh login, have a strong password on the wallet itself.


Do imperfections in dice make them unsuitable to make really good bitcoin private keys? Dice do have imperfections (depending on how expensive ones you get), but would they not still have enough entropy such that a private key generated by them could be considered really safe? I am thinking of paper wallets storing lots of coins, potentially.

It would short circuit the problems with the implementations of random number generators on computers (the recent Android bug, and the Debian bug between 2006 and 2008)

http://www.debian.org/security/2008/dsa-1571

If a die is missing a side one would notice, so they are a lot easier to inspect for big errors than computer code.

So, how much would imperfections in dice lower the entropy? Could you just calculate with a lower base, e.g. 5.765*N rather than 6*N with a perfect die (5.765 then being a measurement of imperfection of a specific die).

Edit: maybe rather 6**(N-x), where x are the extra occurrences of one number.

You can certainly use any randomness source you like to generate a private key; however, any bias or correlation in your random inputs will make your key easier to guess and reduce its security.

I wasn't able to find a comprehensive analysis of dice randomness in the scientific literature, but this paper could be a start:

  Labby, Z. Weldon's dice, automated.  Chance 22(4): 6-13, 2009.  http://statistics.uchicago.edu/about/docs/labby09dice.pdf

Based on a total of 315672 die rolls, the author found a statistically significant bias toward the numbers 1 and 6.  The other references in that paper could be useful.  I also found remarks elsewhere that casino dice, which have flat faces rather than hollowed-out pips, may be less likely to be biased.  Of course, your dice could be different; if you wanted, you could roll them a large number of times and perform various statistical tests on the outcomes.

Even if your dice are biased, there are various ways to extract randomness from your data to obtain unbiased random numbers.  One of the simplest approaches (though not the most efficient) was described by von Neumann in 1951:

  Von Neumann, J.  Various techniques used in connection with random digits. NIST journal, Applied Math Series, 12:36-38, 1951.

There's a description of the technique here.  Note that it depends on the die rolls being independent and identically distributed, so you would need to roll the same die in exactly the same way each time to get a truly unbiased result.


Why did Bitcoin Core wallet send my coins to this address? Yesterday evening I installed the Bitcoin Core wallet (v0.11.2 (64-bit) from the Chocolatey repo to my Windows 10 machine). I had some coins in an old wallet.dat that I copied to the data directory. That worked fine. While the Blockchain was downloading, I transferred the balance from the old wallet to a new address (in my MultiBit HD wallet): 1JRyKhLLXMeVPpeEw3fvcJbUmrZYtRiojd.

Bitcoin Core wallet created a new transaction to that address in the transaction list. Unfortunately, a few seconds later, it also created a new transaction with the same amount, but to an unfamiliar address: 1Msx9dp6uVr1rrz6pUxXwqLL3oxB9fDn1j.

This new transaction was soon confirmed, while the transaction I entered remains with status Conflicted.

Here's (the relevant part of) the transaction list in Bitcoin Core wallet:

Here's the transaction I asked Bitcoin Core wallet to create, and the mystery transaction it created on it's own initiative:

What could have happened here? Is there any way I can find the PK for the mystery address (could it be a change address in the wallet or something like that)?

The transaction that shows up as confirmed (8f1fb5fa1) was confirmed almost a year ago in block 345970, although your client is showing it with a recent date. I think you might have not synchronized with the network before attempting to transfer the coins to your new wallet, at which point the client still showed the coins in your balance. You later caught up with the blockchain and your wallet noticed that the coins were no longer available, marking your new transaction as a conflict/doublespend.

If this is indeed the case, then this is perfectly normal. If this were your address then the wallet would notice this automatically and credit you with the coins. It could either be that you migrated your funds at some point to a new wallet or that malware was involved.


Why Coinbase hot wallet showing insane price that BTC didn't reach for the day? I m bit suspicious about Coinbase service. It shows the current BTC is 16900 USD but in Bitfinex is 15 326 USD.

The worst part is I selected buy BTC from Coinbase its showing 17686.50 USD. How on earth such price variance?

I raised the complaint to Coinbase no answer from them, I felt bit dodgy about their service.

I felt discouraged to use mobile wallet they are not providing the correct exchange rate. Could someone can suggest me best way to buy BTC and move to other wallets?

With such volatility, all exchanges vary a great deal. At time of writing this answer, bitcoin price had jumped another 20% in less than a day and it wasn't too strange to see any two exchanges vary by $500 or more (Current source). Each exchange calculates their buy and sell prices a little differently.

True exchanges like Bitfinex all have different user bases in addition to variation in their buy/sell calculations. This means they may have slightly different supply and demand effects. None of the exchanges are centrally monitored, as with stock exchanges, so they must calculate buy and sell rates on their own.

Coinbase is not a true exchange. Your buy and sell orders are not filled by others buying and selling. Instead, you are buying and selling from Coinbase. Like any currency exchange you might find at banks or international airports, Coinbase offers a larger spread (the difference between buy and sell price)  as part of their profit scheme. For the user, Coinbase offers value over true exchanges by filling any order immediately and simplifying the process.


What method does My Wallet use to encode messages in the blockchain? What kind of protocol does My Wallet use?

Messages are stored in a database at blockchain.info (so that text should probably be changed). For a while it did use the blockchain for storing messages but this was changed after concerns from a few of the core developers.

Concerns were expressed by Matt Corallo here

  Oh god, thats awful...that is quite possibly the worst way to
  implement messages in terms of network load...

and by Gavin Andresen here.

  Yes, please don't create lots of unspendable scriptPubKeys. There are
  more prunable ways of embedding messages into transactions. And there
  are even better ways of associating messages with transactions, so
  only people involved with the transaction can read the message (if
  that's desired).

Here is the message that implementation was changed back to using a centralized database.

  Since a few developers have expressed concern I've changed the notes
  back to the centralised database for now. I still think there are many
  use cases where you might want to contact the owner of an address
  without needing to know an email etc, a decentralised way to do this
  would be great.


How do I investigate an address or transaction? My non-profit organization received a donation for which no one contacted us to claim credit.  I am intrigued and would like to find out as much as I can about the donor using the blockchain.  What services / tools exist to do this?  Some ideas I have are:

Did he/she embed a text message in the transaction?
Can any information be gleaned from the web of transactions involving that address?

The simplest way to get information about the transaction is to use the Blockchain web site.  They have some easy-use-tools that can show you which transactions the funds came from, and the submitting IP address.  Use the URL http://blockchain.info/tx/transactionid.

For example: http://blockchain.info/tx/cc4ffa39d766fadfc6bd48a2144492e6e7b07c9b4046f7edbad3ec63869dd071

I don't think you'll get much information about the IP address, because addresses are not part of the transaction information.  A Bitcoin host only knows the address of the peer that relayed a transaction, which usually isn't the originating address.

You can trace what other transactions your donation came from, but putting a name to a bitcoin address can be difficult.  Your best bet might be to do a Google search for the address of some of the upstream transactions.  If someone used their well-known address for donating, then you might be able to find them.  But if the originating addresses were never put onto a web page by their owners, then you're out of luck.

If you are a government and the funds originated through one of the currency exchanges, you could use a warrant to get whatever information the exchange has on a transaction.  Given the state of privacy rights these days... well don't get me started.


First Bitcoin transaction When making your first bitcoin transaction, at what time do you generate the public and private keys and how do you store your private key on a hardware wallet?

at what time do you generate the public and private keys

Your wallet (the software managing your keys and your connection to the Bitcoin network) handles this for you, typically just before you generate an address to receive a payment.

  how do you store your private key on a hardware wallet

The hardware wallet comes with a software which handles the storage of the key(s) on the hardware.

You might want to take a look to the wiki page about "storing bitcoins" and follow the links :).


How to decrypt encrypted_privkey Background how I got here:
I have a very old wallet file in .dat format (from 2017)
The backup is as far as I remember just a copy of the wallet file from bitcoin-core's ~/.bitcoin directory.
I tried opening it in "modern" bitcoin-core by:

copying the wallet file into ~/.bitcoin/wallets/walletName/walletName.dat
adding the wallet name to list in ~/.bitcoin/settings.json

Now, upon starting bitcoin-core I get this message:
Error: Failed to load database path '/home/{redacted}/.bitcoin/wallets/OldWallet_1'. Data is not in recognized format.

So, having no meaningful results in google other than pywallet, I decided to try importing it to electron... and discovered that electron doesn't have an option to import bitcoin-core wallets (wtf?).
I did find some information about "pywallet", I tried using it to recover information from my .dat file, I had to modify it a bit since my encryption password is really long and has many weird characters in it so passing it as an argument for script execution is incredibly difficult.
I managed to get list of all addresses defined in this file and "encrypted_privkey" for each address.
I didn't manage to get it to decrypt anything, because the script crashes with "Segmentation Fault (core dumped)" (everyone loves C/C++).
The question:
So, my question is, given I know the password to this wallet (I think I also recovered the encryption salt) and I have "encrypted_privkey" list, how do I decrypt them so I can import them in electron?
[edit]
I just tried importing my dashcoin wallet to dash-core, I get the same error message, so it's very likely that something about the wallet file format has changed during the time I wasn't using cryptocurrencies.
If anyone knows how to "upgrade" the file format, please let me know, it'll also solve the problem.

there is command opton in bitcoin core, there you can type "upgradewallet"
check if something happens.


If everybody stops paying transactions fees What would happen if hypothetically, every bitcoin user decides in consensus with the rest of the world to stop paying transactions fees from now on. Miners will be forced to include transactions anyways in the blocks, because if they don't, bitcoin will become useless for most people, thus decreasing its value as a whole. The 25 BTC they would get from solving empty blocks will be close to zero in value.

So why miners can't be satisfied with just the coinbase earnings? no fees for users = more adoption = BTC value goes up.

So why miners can't be satisfied with just the coinbase earnings? no fees for users = more adoption = BTC value goes up.

First of all, transaction fees is used as a mechanism in bitcoin to deter spam. If transactions can be made without paying transaction fees, then there is no cost to the user to create spam transactions that will eventually overwhelm the network. So, the inclusion of transaction fees is a necessity for network health.

Secondly, it is not necessarily true that "no fees for users = more adoption = BTC value goes up". Paypal incurs zero fees for friend to friend transactions, does everyone own a Paypal account? Would onboarding many users that do not pay transaction fees cause Paypal shares to rise? Probably not.

Finally, a fee market for bitcoin transactions is a good thing as miners need to be compensated for the work they contribute to generate blocks. As block subsidy tends to zero, the proportion of mining revenue derived from transaction fees must rise or at least reach an equilibrium where the mining revenue is equal to the security cost of securing the bitcoin blockchain.


Installing Bitcoin-Qt on Ubuntu I am using Ubuntu 11.10. I have downloaded Bitcoin-Qt, but I don't think it has installed itself. The instructions say "download and install" the software, but I'm afraid I need instructions that are a little more specific. If you can tell me how to install the software it would be greatly appreciated.

sudo add-apt-repository ppa:luke-jr/bitcoincore
sudo apt-get update
sudo apt-get install bitcoin


World-wide price for generating 1BTC Can we find an algorithm to compute the average price (as energy consumption) of 1 BTC being generated if we know: hash rate, difficulty, energy price?

The parameters you need to calculate this are:

E - the mining efficiency, measured in MHash/J. Data on this for various hardware is available in Mining hardware comparison (though this take into account only the card's power and not of the system it is in). Or you can calculate it for a given system by dividing the total hashrate (in MHash/s) by the power consumed (in W).

c - the cost of electricity, measured in $/KWh.

B - the bitcoin reward per block.

D - the difficulty.

The cost to generate 1 BTC is:

c*D/(838*B*E)

For example, if E=2, c=0.1, B=50 and D=1,500,000, this is
0.1*1500000/(838*50*2) = $1.79

The 838 "magic number" comes from the various unit conversion factors - 2^32 hashes per difficulty-1 hash, 3,600,000 Joules per Kilowatt-hour, 1,000,000 Hashes per MHash.


Can a Raspberry Pi power 1 USB Asic Miner? Looking at other setups it seems everyone is running with multiple USB Asic Miners through powered USB Hubs. Can the Raspberry Pi power a single miner through USB? Even using a 2 amp power adapter?

Yes.

I have been running my Pi (B, 512mb) with a 1.5 amp power supply with 1 usb erupter (Sapphire) for over a week with no problems. Directly connected to the Raspberry, no hub.


Can an unsynchronized node create a valid transaction? I'm trying to understand how bitcoin transactions work. From what I understand, in the Bitcoin network nodes hold different versions of the Blockchain and after some time the different chains start converging to form the main chain (longest sequence is preferred).

Here's a scenario. Node A is holding a chain which is not in sync with the rest of the nodes and node A decides to post a transaction. The miners will pick up this transaction and add them to a block in their own chain which is different than Node A's chain.

So now when Node A looks at the network, will it just ignore its own inconsistent chain and pick the miners' chain? Will the transaction made by node A even show up in the blockchain?

Node A is holding a chain which is not in sync with the rest of the nodes and node A decides to post a transaction.

Your node, that is not synced, will only let you spend outputs that it has validated as unspent. So in your scenario step 1 may not be able to happen depending on age of the UTXO and what block your node is at. An old node that is not synced can only spend old coins that haven't moved.

A more detailed answer from A. Chow: https://bitcoin.stackexchange.com/a/91822/26873


How do I calculate what the TOTAL Wallet fees are going to be with Bitcoin-Qt v0.6.3? The new release of BitcoinQt Wallet v0.6.3 looks much better but I still can't find out how much the total fees are to send coins.
My wallet has 0.52390169 BTC and I tried to spend it and got the message "Total exceeds your balance when the .01  BTC tranasaction fee is included" Fair enough so I reduced the spend to 0.51390169 and the get the message "Total exceeds your balance when the .23 BTC tranasaction fee is included"
This doesn't seem right or fair.
How do I calculate what the TOTAL fees are going to be?

The fee will change with time, if it happened to be high due to the coins being recently received.

There is a fork of the client that doesn't require any fee to be paid.  Your transaction will just take a day or so to get any confirmations.

You can wait to let the coins in your wallet age and then at least the fee should be small and consistent.


Statement: for an attacker to change history, they must solve computational puzzles at a faster rate than the rest of the participants combined I'm new to cryptocurrency and blockchain. I just started reading the textbook Bitcoin and Cryptocurrency Technologies by Narayananm, Bonneau, Felten, Miller and Goldfeder.

The statement in the title is given in the introduction to the book (page 17 in the pre-publication draft for anyone interested)

I'm assuming it is accurate and that it is connected to the architecture of the bitcoin blockchain. However, I don't quite understand why this is the case. Is it because in order to change history you need to change the entire chain up to the block you want to change? And why do you need do be faster than all others combined?

Any explanation would be greatly appreciated!

Edit: Later, on page 33:

  as long as we store the hash pointer at the head of the list in a
  place where the adversary cannot change it, the adversary will be
  unable to change any block without being detected.

Does this mean that if the head pointer is unalterable (the genesis block) the statement is false?

I will answer my own question for anyone that might be wondering the same.

If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes.


Bitcoin Core private key import I would like to import the private keys from a multisig paper wallet to Bitcoin Core. My aim is to convert the paper wallet to an electronic wallet and to be able to export the corresponding wallet.dat. What's the recommended way of doing this via the command line?

Firstly, you need to know both all the public keys, and at least the threshold (M for a M of N multisig) number of private keys.
You can then import the public keys, private keys, and script to bitcoind by using the importmulti RPC command and either providing an output descriptor or a a raw address / scriptPubkey (+ redeemScript / witnessScript if using a P2(W)SH).
To quote the help:
$ bitcoin-cli help importmulti
importmulti "requests" ( "options" )

Import addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.
If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.
Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls
may report that the imported keys, addresses or scripts exist but related transactions are still missing.
Note: Use "getwalletinfo" to query the scanning progress.