How to convert Bitcoin cash address to cashAddress Format in PHP? I've been trying with cashaddress-php but it doesn't work because the address should be in hex format, I tried with hex public hash key it also didn't work.

Invalid hash length [320 bits] for pubkeyhash

Is there's any way to convert legacy bitcoin-cash address to copay(cashAddr)?

Live example

You can do it by decoding address from base58 then spliting it in version bit and payload and then assemble it into cashAddress and calculate checksum or if you want there is another project on github that claims to do that Har01d/CashAddressPHP maybe you should git it a try


Understanding Bitcoin TransactionID How do I come to know that I have received the BTC in my wallet / the transaction is successful via the transaction ID. ?
In Blockchain.info I used the transaction ID to search the transaction and it shows my receiving address in it. Which info graphic would indicate that the transaction is successful and the BTC is transferred to my wallet ?

If you can see the transaction on blockchain.info, it means it is part of the blockchain. If you can see your address, then you know it's the right one, i.e. that it was sent to you. Your bitcoin wallet will have the ability to see and spend it if you have that address in your wallet.


How can I see my hashrate for litecoin? Just for the sake of trying I installed Litecoin-Qt 0.6.3c on Ubuntu.
And for sure I started solo-mining.

The thing is, that the only thing I see is

[17:45:34] - Solo mining started

I am curious to find out with what speed am I mining, but looking into different tabs I have found no answer.

Is there a way to find my hashrate? Am I missing something?

Ok, I found the problem.

The thing is that you can not start mining prior to synchronizing with the network (getting all the blocks). The client is not telling you this and tells you that it is mining, when in fact it does not.

So there is no point in clicking start mining before you got everything. After you got all the blocks and pressing mining you can see the your speed here.


Blocks Folder and blk00000.dat files In my Bitcoin Folder I found on my old computer,theres also files of  aprox. 130 Mb .dat files. I have now, like I was told dumped the wallet.dat into my new installation of Bitcoin Core, and its running.

Will I need those blk000xx.dat files for any reason ? Are there any cions in them, or information of any value ?

those block files are your copy of the blockchain. you could stop your new bitcoind daemon and move them into the $HOME/.bitcoin/blocks folder and restart bitcoind, and save yourself and the network the necessity to re-download them.


Retrieving bitcoin from old seed In January 2016 I bought a bitcoin but I don't remember what program I used. I used the seed code and now I entered a wallet. However, it is empty. And it also says there haven't been any transactions ever. Did I enter a wrong seed or someone else's seed? Or can the history be removed? Or does it matter in which program I use the seed? Or does it have to do with the halving? Please help me to recover my BTC.

Discovering which wallet this was generated from may be important. Over the years different words and derived paths have been used by different software.
A good place to start is to look through https://walletsrecovery.org/ which may help jog your memory and a start on the recovery process.


Network status: What is "Difficulty"? How to understand "Difficulty" and how to use it?

Difficulty is a measure of how difficult it is to find a hash below a given target.

The Bitcoin network has a global block difficulty. Valid blocks must have a hash below this target.


BTC-e API clarifications Considering the trade information reported here: https://btc-e.com/api/3/trades/btc_usd

Do these refer to open orders, or to completed trades?  If this shows only completed trades, does the API offer a means to retrieve the open orders?
Each record has an 'amount' field.  Is this field always in USD for both bids and asks?

Have a look at the documentation (unfortunately it's in russian, but google can translate): https://btc-e.com/api/3/documentation

I think it's finished trades. Look at the Depth method to get open orders https://btc-e.com/api/3/documentation#depth
If you are looking at the btc_usd pair, then the price is in USD, and the amount in BTC


What does it mean ERROR code=-28, message=Activating best chain? I am using insight-api for get block chain information. When i am trying to start insight i am getting error "ERROR code=-28, message=Activating best chain..." . I saw this error first time,please help me how to reslove this.

Full stack trace of error:

                v0.2.12

connection
info: insight server listening on port 3000 in development mode

error: ERROR code=-28, message=Activating best chain...

I am unable to understand error. i am using insight-api for this.

Thanks in advance

Your node is still starting up, you need to wait until it is finished before using the RPC interface. The RPC message is telling you to call back later, which insight-api doesn't seem to be able to understand, simply waiting until the node is completely active is a suitable workaround. This may take a few minutes depending on your servers hardware, the bitcoin-cli tool supports automatically waiting for the interface to be available with the -rpcwait flag.


Is two-phase encryption planned for the standard client? Currently, the standard client supports encryption, but only for actions that change its state (send money, generate address).

I would like the client to require two passwords - one to view any information, and another for mutating it (send money, generate address).

Is this feature planned?

No, it is not planned.

I'd suggest writing some JSON-RPC proxy code that takes RPC commands, checks to see if they're safe (or checks to see what password was given), and if they are authorized forwards them to bitcoind and passes through the result.  There is a lot of good Python code for json rpc clients and servers, although JSON-RPC is a simple enough protocol it shouldn't be hard to create a proxy in any language.


When does the Ardor - NXT to Ignis snapshot occur and which exchanges support the snapshot? I heard the Ignis snapshot is going to occur sometime in the summer of 2017. When is the exact date? And how many coins do you get for holding your NXT for Ignis? And which exchanges are on board with issuing the Ignis tokens?

No set date for release yet but with in the next few months. 1NXT will get you 0.5IGNIS.


Bitcoin core's estimatesmartfee error "Insufficient data or no feerate found" with synced node I'm running bitcoin core version 0.17.0 on the Testnet and since yesterday, I've been experiencing problems with the RPC estimatesmartfee. I'm getting as a response:

  "errors": "Insufficient data or no feerate found"

The output of getblockcount is 1434922, which complies with that number of blocks on block explorers.

getnetworkinfo says I've got 8 peers connected.

I believe my node is fully synced, and, in fact, I just made a transaction while I'm writing this.

What might be the issue here? I pasted the final lines of the debug.log here.

The fee estimation is completely based on how long your node has been running, how many transactions have entered the mempool, and how many of those transactions have been confirmed. It is not (and cannot be) based on the fee information of transactions already included in blocks. So it does not matter whether you are fully synced or not. If you just started up or if there are few transactions being confirmed, then the fee estimation will not have enough data to work.

Testnet does not have a lot of traffic, and AFAIK, a miner is currently not including any transactions in their blocks. Thus there is not a lot of information available for fee estimation to work, so it does not. That is why it is currently unavailable.


bitcoin-core automatic coin selection for business reason i need to use the bitcoin-core (v0.20.1) automatic coin selection feature and few days ago i saw a transaction come out that left me puzzled, it was like that:
input

  0.00017[...]  bc1qaddr1
  0.01292[...]  bc1qaddr2
  0.00030[...]  bc1qaddr3
  0.00020[...]  bc1qaddr4
  0.00015[...]  bc1qaddr5
  0.00035[...]  bc1qaddr6
  0.02371[...]  bc1qaddr7

output

  0.02783[...]  bc1qaddr8  > amount sent
  0.00965[...]  bc1qaddr9  > change

in this transaction 5 out of 7 utxos are unnecessary, is there some benefit in chaining toghether utxos in this way?from my point of view this is a terrible way of loosing privacy and pay way more fee than needed, what i miss?i read that bitcoin-core tries to find an exact match from available utxos and the amount to send, but if it fails then try to find a subset of utxos to reach a change of 0.01btc, is that right?so, in my case, the unneeded utxos are added to get the change of my trasaction closer to 0.01?

This occurs because Bitcoin Core's coin selection algorithm tries to have a minimum change of 0.01 BTC. Fees are subtracted from the change output so the result is that the change output has a lower value, but before fees, it will try to for the change output to be at least 0.01 BTC.
As we can see in your transaction, the change before fees is approximately 0.01 BTC. Presumably it is actually over that because you have obfuscated the last several digits. Then the transaction fee was subtracted from the change output to get the final change output value that you have.

The reason that there is a minimum change is so to avoid creating very small change outputs. Small change outputs can be detrimental to the user's wallet and to the network as a whole. Those small change outputs result in the wallet having more UTXOs, which means that for future transactions, require more UTXOs to spend. Furthermore, small values can quickly become uneconomical outputs when the feerate rises. If lots of small change outputs were being created, a wallet could end up having a significant portion of its UTXOs be unspendable when fees are high.
Additionally, by having a minimum change target, the coin selection algorithm will tend to consolidate and sweep up smaller UTXOs. This behavior is, in general, good for the wallet and good for the network. It reduces the number of UTXOs globally, reduces the number of UTXOs that the wallet needs to handle and keep track of, and makes it less likely that UTXOs in the wallet will become uneconomical in high fee events.

In general, coin selection is a hard problem which needs to balance several factors. It is not just what the fees are for the transaction right now, nor is it necessarily just about the user of the wallet in that moment. Coin selection needs to consider the cost of spending outputs in the future and how its behavior will effect the selection of UTXOs in a future transaction. Coin selection needs to balance the health of the network and the performance of the user's wallet.


Does getblockcount return the correct block count when running in prune mode? I am currently running a bitcoin node with prune=550.

The getBlockCount from $ bitcoin-cli getblockcount does not match https://blockexplorer.com/api/status?q=getBlockCount.  As I understand it, the bitcoind is still syncing the node since the bitcoin-cli getblockcount is rising at a steady pace.

Will the getblockcount from a node running with prune=550 eventually match the official getblockcount?

Yes, it will match. getblockcount is the number of blocks that you have already synced to, regardless of pruning.


Are there any Bitcoin block explorers still around that log First Seen by node data? Title..  Hoping to find out when a historical tx went into the mempool.  I'm aware this is transient data and not in the blockchain.  However i'm pretty sure I remember in the old days explorers used to log it.
edit:
i would like to find a block explorer that logs the first time its node saw particular transactions in the mempool, as opposed to the first time they were in a block.   ie:  I would like to look up a tx and see how long it sat in the mempool before it was mined.

Could you be a bit more specific?
There are a few block explorers that do provide information specific to their block explorer's running node.
Best lead I have for you is: https://bitcoinvisuals.com/
There's a lot of node information on there though I'm not sure its exactly what you're looking for.
However, I know that the owner of the site is pretty responsive and very easy to get into contact with.


Will cross-input signature aggregation need a new output type? If cross-input signature aggregation were to get implemented in a subsequent soft fork after Taproot's activation, would its use require a new output type?

Cross-Input Signature Aggregation (CISA) is an idea for allowing multiple inputs to be covered by a single signature. One of the main motivations is that it would allow multiple users to combine transactions they're about to send in a single transaction and reduce the overall cost. To that end, CISA is chiefly interesting for key path spends.
The current sketch for CISA would be to replace all but one of the corresponding scriptSigs with a one-byte placeholder and then to provide the signature for all the encompassed inputs in the last input's scriptSig.
Since BIP341 defines the spending rules for P2TR key path spends, but did not allow for an input to be spent with an empty scriptSig, it would not be possible to introduce CISA with a softfork for P2TR key path spends after activation of Taproot as proposed.
Therefore, a new output type would be needed that explicitly permits the placeholders employed by CISA.

As there is no formal proposal for CISA, yet, the above observations are potentially subject to change.


pycoin deriving wrong addresses from private key a well known private key is the sha256 hash of correct horse battery staple it yields:

uncompressed address 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T
compressed address 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8

however i am unable to reproduce this result on pycoin 0.53. the sha256 hash is

c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

but when i use the command-line utility ku in pycoin to import this secret in hex it does not yield the above addresses:

$ ku H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : H:c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
wallet key                   : xprv9s21ZrQH143K2yLSxbXemfny4nZroqhpiXEQ1MYx8vo2k7HRXypsWesNr7GkWT\
                                 uU9CeaW7QeR38NjjaSfZBAAZVkVEpXwEkxLLXP2q1iFUd
public version               : xpub661MyMwAqRbcFTQv4d4f8ojhcpQMDJRg5k9zojxZhGL1cuca5X984TBrhQw9ZJ\
                                 nvDdzsrjWG8nv4fsWjSU9HpX7pR3RKh2mezryhwXqvkF3
tree depth                   : 0
fingerprint                  : b501bac5
parent f'print               : 00000000
child index                  : 0
chain code                   : 5bbf1322eb26e8568dab5fdb60eb1dce21b0184ba5f6302a363d3d6fa673c630
private key                  : yes
secret exponent              : 10158881283648126355615721166211734569721037983262304808955335053160859610224
 hex                         : 1675b9196a0315b28d60cf62d835ca9e0c7756655f1ae267e72e87cd94f4ac70
wif                          : KwyNQchak8YmPrMjiZubCDbTGupAFPjQGp2A1mE2feyEkgjhPzNF
 uncompressed                : 5HzBHgMXJUYDKmiQGmACNaDLYhWiWziKsFjQLf7aTRv52NeoYhE
public pair x                : 51123819464118526280373633109955475860846079595385829435773454059765711587420
public pair y                : 69375255639189423482159707295881791099365542658018779127323111014791716296211
 x as hex                    : 71070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 y as hex                    : 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
y parity                     : odd
key pair as sec              : 0371070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c
 uncompressed                : 0471070e700787e78e1810b2843c0723fcf25643f9de9bb90fca95ca2941dd485c\
                                 996100d13953e2d4815df164d89d27e8af148c31e2847631acc45928c89c5613
hash160                      : b501bac5295fc5a812879a5483c456b554e0f994
 uncompressed                : c76a0a580bb6582e3f7e5e80324b0241b63f6eeb
Bitcoin address              : 1HW5NtrRYqmvvF36hxvGFf7e4F2voLyVk2
Bitcoin address uncompressed : 1KBQVzU9DnJCDZPe1r1T9SkrJAniJ2PUCx

looks like i was using pycoin wrong. for some reason the hex private key is not imported using a H:. the following works fine:

$ ku c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a

input                        : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
network                      : Bitcoin mainnet
netcode                      : BTC
secret exponent              : 88985120633792790105905686761572077713049967498756747774697023364147812997770
 hex                         : c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a
wif                          : L3p8oAcQTtuokSCRHQ7i4MhjWc9zornvpJLfmg62sYpLRJF9woSu
 uncompressed                : 5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS
public pair x                : 54652445751364966014814199642702485207468864303823415690143529040235143060593
public pair y                : 72966369330535479126907188414667138321635397511721864437822996012971795952725
 x as hex                    : 78d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 y as hex                    : a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
y parity                     : odd
key pair as sec              : 0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71
 uncompressed                : 0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71\
                                 a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455
hash160                      : 79fbfc3f34e7745860d76137da68f362380c606c
 uncompressed                : c4c5d791fcb4654a1ef5e03fe0ad3d9c598f9827
Bitcoin address              : 1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8
Bitcoin address uncompressed : 1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T

i think ku H:c4bbcb1f... may be the way to import a bip32 private key, whereas ku c4bbcb1f... just imports a regular private key as secret exponent.


Bitcoin core's estimatesmartfee gives same estimate on ECONOMICAL and CONSERVATIVE mode I have observed this behavior several times before now, the commands bitcoin-cli estimatesmartfee 2 ECONOMICAL and bitcoin-cli estimatesmartfee 2 CONSERVATIVE give the same estimates.

For example, now I get:

>bitcoin-cli estimatesmartfee 2 ECONOMICAL
{
  "feerate": 0.00173558,
  "blocks": 2
}

>bitcoin-cli estimatesmartfee 2 CONSERVATIVE
{
  "feerate": 0.00173558,
  "blocks": 2
}

>bitcoin-cli estimatesmartfee 144 ECONOMICAL
{
  "feerate": 0.00036069,
  "blocks": 2
}

>bitcoin-cli estimatesmartfee 144 CONSERVATIVE
{
  "feerate": 0.00036069,
  "blocks": 2
}

I can increase the number of blocks even higher than 144 and I get the same result both. My node has been running uninterrupted for a long time so I found no reason for these values to be wrong. However, what's the point of having two modes of estimating fees if they give the same

The two modes don't just unconditionally return the same thing. They do different calculations and can return different results under certain conditions, particularly when fees are very variable for low confirmation targets. The current fee situation just makes it so that the estimator ends up using the same values for both modes.


Cannot connect to slushpool with bfgminer I am a complete newbie and just want to see how mining works in principle. No profit required. I have created an account on slushpool and have username and password. Then I go to my Ubuntu machine (a desktop, with GPU, no ASICs or something) and ran
bfgminer -o stratum+tcp://stratum.slushpool.com:3333 -u myusername -p mypassword

It started to print in cycles
 [2020-11-13 10:17:47] Waiting for devices; press 'M+' to add, or 'Q' to quit
 [2020-11-13 10:17:47] Probing for an alive pool
 [2020-11-13 10:17:48] pool 0 JSON stratum auth failed: [
   -1,
   "Internal Server Error",
   null
]
 [2020-11-13 10:17:48] No servers were found that could be used to get work from.
 [2020-11-13 10:17:48] Please check the details from the list below of the servers you have input
 [2020-11-13 10:17:48] Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers
 [2020-11-13 10:17:48] Pool: 0  URL: stratum+tcp://stratum.slushpool.com:3333  User: myusername Password: mypassword
 [2020-11-13 10:17:48] Press any key to exit, or BFGMiner will try again in 15s.
 [2020-11-13 10:18:04] No servers were found that could be used to get work from.
 [2020-11-13 10:18:04] Please check the details from the list below of the servers you have input
 [2020-11-13 10:18:04] Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers
 [2020-11-13 10:18:04] Pool: 0  URL: stratum+tcp://stratum.slushpool.com:3333  User: myusername  Password: mypassword

Why? What is happening? What am I doing wrong?

I am also new to slushpool with bfgminer.
follow steps if it works to you .
sudo bfgminer

then enter url
stratum+tcp://stratum.slushpool.com:3333

then it will ask username with worker
username.worker

then password
thats it .


How 1 address can create 14 inputs in output transaction to 1 direct address? Check this address 1NM3apKLeDGKiFsd6gu1o4nh52efi38iEv
The reason of this extremely high fee because of 14 inputs
But why 1 address generate 14 inputs instead 1?

When funds are sent to an address, the funds are locked into a UTXO (Unspent Transaction Output). When you want to spend funds, you create an input that references a specific UTXO and satisfies the corresponding locking script. It doesn't matter whether the UTXOs were sent to the same or to different addresses. Every UTXO has to be spent explicitly and separately. There is no efficiency gain to spending multiple UTXOs received to the same address in one transaction, each still needs its own input to be spent.


What is the proper way to handle reorgs when fetching headers I work on bitcoin-s, and we've found a problem where if a node is stopped with it's chain tip being a one that is later reorged out it will not be able to continue syncing headers.
This happens because we request headers using a get headers message with hashes= <current chain tip> and stopHash=<00000..0000>. Since, our chain tip is reorged out we will receive the first 2000 block headers of the network.
My current solution is to walk back our chain tip, and each iteration check if don't get the first 2k blocks. However, I recognize this is a poor solution, is there a GetHeadersMessage that I should be using here, or a better alternative?
Thanks

The getheaders message allows you to list multiple block hashes. So instead of just putting the current chain tip, you can insert multiple block hashes. Responding nodes will see if any of those hashes are in its main chain and start sending headers from there. Since reorgs tend to be small, you could put the most recent 10 block hashes and it should be enough to handle the reorg.
Note that the maximum number of hashes you can put in a getheaders message is 101.


Can a created segwit address match a non-segwit vanity address? For example, if I have the following vanity address: 1abcde.... as my current bitcoin address, is it possible to create the same vanity address for Segwit: 3abcde... ?

yes, it is possible. i can create such prorgam for you, but without GPU acceleration it will run too slow


get the private key for change addresses Is it possible to get the private keys for change addresses that get generated?

I was wondering if there is a way to auto export that, do the clients make the change addresses or does another mechanism in the network make them?

I think you can do this by using the bitcoind JSON-RPC interface.

The following links should be helpful:

https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list

Identify the change address by looking at the transaction in question and then use "dumpprivkey ".

My understanding is that bitcoind is creating the change address every time you do a transaction where the change is greater than 0.0.


Where to find P2pool networks.py settings for altcoins? Is there a forum post or website where all the altcoin networks.py settings are being shared? I can see the P2pool forks on Github where people commit their own networks.py settings back to their own repository but none are being merged back into the original forrestv/p2pool repository. For now, I am specifically searching for the Digibyte altcoin but would like to add the other altcoins later on as well.

I am talking about this part:

    litecoin=math.Object(
    PARENT=networks.nets['litecoin'],
    SHARE_PERIOD=15, # seconds
    CHAIN_LENGTH=24*60*60//10, # shares
    REAL_CHAIN_LENGTH=24*60*60//10, # shares
    TARGET_LOOKBEHIND=200, # shares
    SPREAD=3, # blocks
    IDENTIFIER='e037d5b8c6923410'.decode('hex'),
    PREFIX='7208c1a53ef629b0'.decode('hex'),
    P2P_PORT=9 338,
    MIN_TARGET=0,
    MAX_TARGET=2**256//2**20 - 1,
    PERSIST=True,
    WORKER_PORT=9327,
    BOOTSTRAP_ADDRS='...'.split(' '),
    ANNOUNCE_CHANNEL='#p2pool-ltc',
    VERSION_CHECK=lambda v: True,
    VERSION_WARNING=lambda v: 'Upgrade Litecoin to >=0.8.5.1!' if v < 80501 else None,
),

And if none are being shared publicly, how do I edit the settings myself for the different altcoins?

You can download this fork https://github.com/Rav3nPL/p2pool-rav It has a lot of altcoins on it.


What is the ideal public nxt.properties config file for a public facing node for NXT / Ardor? I can't find a template for nxt.properties when running a public node. Is there a public template I can just copy and paste and make some adjustments for NXT / Ardor?

Are the following entries still necessary:

nxt.uiServerHost=0.0.0.0
nxt.uiServerCORS=true
nxt.uiSSL=true


Sent Bitcoin Cash to Coinbase Bitcoin address I just mistakenly sent some Bitcoin Cash from Bittrex to my Coinbase Bitcoin wallet & of course they are now stuck. Bittrex have told me  to remove a private key from a Bitcoin address and import it into a BCC wallet to recover these coins. Apart from contacting Coinbase, has anyone any ideas?

You can wait until Jan 1, 2018 [1]; they are going to add Bitcoin Cash withdraw support. Or you can contact them (of course).

[1] https://support.coinbase.com/customer/portal/articles/2853600-bitcoin-cash---frequently-asked-questions


Can't open my bitcoin wallet Help please.  In 2013 I could not remember my password.  I just recovered my password.  I try to open the same wallet I used before but only get a message from Adobe Reader "unable to open because file is not supported or is damaged".  This happens on all my back-ups also.  What can I do to get in my wallet? Thank you in advance.

This sounds like your operating system thinks that your wallet file is supposed to be opened by Adobe Reader.  Adobe Reader will not know what to do with this file, so you'll get that error.  Try opening the file directly from a Bitcoin wallet, or change your operating system to recognize wallet files (.dat) as Bitcoin wallet files, and not documents.  If you are using Windows, try this: http://windows.microsoft.com/en-us/windows/set-program-access-computer-defaults#1TC=windows-7


How to verify signature of multisig transaction How to verify signature of multisig transaction (2-2) after it being signed by first owner? How can I understand if that owner used wrong private key => wrong signature?

There is no way to check the transaction separately for each signature. Either the entire transaction is valid or it is invalid. When you receive the partially signed transaction, you would need to sign it with your own private key using the signrawtransaction command in bitcoind. It would give you two outputs (1) hex which is the serialized transaction and (2) complete. If the second output shows you "complete": true, then the transaction you received was signed with a valid private key. If it shows false then it wasn't.


How to transmit fraudulent commitment transaction on lightning channel? I'm trying to simulate a fraudulent commitment transaction on lightning. How would you submit an earlier commitment transaction. It doesn't seem like this can be done with a command. Does anyone know where in the code (LND or C-lightning) you could change it to do this?

As far as I know the lightning clients that I know of (LND, c-lightning) do not offer this possibility through their API.

So you'd be right to patch the code yourself. For LND, you should have a look at the ForceClose, which is the code that handles unilateral closing of a channel. It uses a CloseTx which it get's from the wire. If you could change that Tx to an earlier one, you would unilaterally close the channel with a fraudulent commitment transaction.

Take a look at the code here: https://github.com/lightningnetwork/lnd/blob/c37ea68ba6e1153478419914d1aa3bfcaf7abe5b/lnwallet/channel.go#L5684


cgminer freezes at random intervals I have just recently built a mining rig. The problem I am running into is that cgminer will randomly "freeze" while mining. When I say freeze cgminer will just stop accepting shares and the GPU data will stop updating; however, I am still able to issue the 'Q' command, but it does not work. I have tried everything I could think of to attempt to fix this problem. Re installing Xubuntu, lowering memclock, lowering engineclock, lowering intensity, lowering thread-concurrency, increasing voltage, upgrading/downgrading cgminer, etc. The odd thing is the fact that none of the cards crash or go sick before cgminer freezes, and you see no increase of GPU temps when cgminer does crash. The period of mining before crash seems to be completely random. It has crashed 30 seconds after startup and it has crashed 4 hours in (which was the longest uptime and it was on a higher memclock and engine clock than I am on now). To me this makes no sense why it would be crashing at all, for the cards seem perfectly stable with the settings.

System Specs:
CPU: FX 4130 quad core @ 3.8GHz, 8 MB Total Cache
PSU: HALE90 V2 1200W
GFX: 4x PowerColor HD7970 3GB GDDR5
RAM: Ballistix (by crucial) 4gb DDR3 1600MHz
SSD: SanDisk 64GB 6Gb/s
MOBO: 970 Extreme4 Socket AM3+ ATX AMD motherboard
OS: Xubuntu 12.10 x86_64

cgminer Start Parameters (start.sh script):
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
./cgminer --scrypt -o http://poolurl.com:8080 -u username -p password -I 13 -g 2 -w 256 --auto-fan --temp-target 70 --temp-overheat 85 --gpu-fan 75-90 --thread-concurrency 8192 --gpu-engine 1106 --gpu-memclock 1825 --lookup-gap 2 --gpu-powertune 20

cgminer version is 3.7.2.

If you need any more information just ask. Any help will be appreciated, for I am absolutely stumped on what is causing the problem.

Thank you,
    Kyle

I d recommend to try bfgminer , a more secure and robust fork of cgminer :

http://bfgminer.org/

https://github.com/luke-jr/bfgminer


How can I use message signing to prove that I have private keys for many different accounts? I want to prove the total sum of BTC I have access to.  Therefore I think if I use message signing to assert "owned by makerofthings7" in each address, then anyone can compute the total coins in my wallet based on that assertion.

If we only focus on the encryption part (and not what the QT client permits), what is the most efficient way to prove that I control the funds of many addresses?
Are all addresses in my wallet that contain coins available for signing & verification?  In particular what happens to the "change" addresses that are dynamically created when sending and receiving Tx?
Can I have a single signed message that is signed by all the keys in my wallet?

You can sign a message or export the private key of all the addresses in your wallet, including change addresses.

If you want to have a single message signed by all your keys the only solution I see would be to sign a message with the first key, then sign the signed message with a second key, ad nauseam.

Strictly from an encryption point of view I don't believe it is possible with ECDSA to sign with multiple keys in the same signature, I might be wrong here though.

As you may already have guessed, the most practical solution would probably be to consolidate your funds into a single address and sign a message with its private key. But it has a privacy tradeoff.


How do bitcoin nodes initially find peers? In all materials related to bitcoin, the people talk about the p2p bitcoin network.

OK, but there should be a central server that connects the peers to each one.
Like the torrent sites. The torrents are p2p but before you can start talking with the other nodes from the p2p network you should know who they are(ip addresses). That's why you are getting the torrent file-you should know who else is interested in this torrent and start talking with him.

But in internet I can't find information about the central bitcoin server -that makes the p2p clients to see each other?
Where I am wrong?
Thanks
Tonko

Although the torrent protocol requires a central server, you don't necessarily need a central server for a p2p network. The client only needs the IP address of at least one active participant. Connecting to this will give you other IP addresses to connect to.

So the only problem for a p2p network without a central server is: where to find the first IP address to connect to. Bitcoin solves this using a so called IRC bootstrap after the first installation. Basically it tries to find such ip-addresses on designated IRC channels.

This is only necessary on first run; subsequence runs it will just try ip addresses that have worked before.

More info on the IRC bootstrap: http://bitcoinmedia.com/the-irc-bootstrap-method-is-flawed/

EDIT: On further inspection, it seems that IRC bootstrapping is no longer used. See the link for details.

EDIT: See also this question regarding the initial connection (bootstrapping)


Transaction confirmed, bitcoin not received Is that normal to receive more than 6 confirmation in the Bitcoin transaction process? Because the time delay is unbelievable and I received 64 already. But according to blockchain.info, 6 confirmation enough for Bitcoin transaction.

So my question is, how much exactly transactions I have to receive at the end to be sure it's confirmed?
Because I sent my Bitcoin in the morning and now the night, but it still did not reach its destination and keep sending confirmations.

https://blockchain.info/tx/0e1ed99dc9932ec6725f9e3f0f406ac7305d53e9752f1b56a61dd8259d53f1b4

Your transaction is confirmed. As Rutger said 1 confirmation is enough, more just means more confidence. You should double-check the addresses you used, it's possible the coins were sent to the wrong place.


Python: How generate bitcoin addresses using electrum library What am I doing wrong here? I'm trying to generate bitcoin addresses from the seed but they do not match with ones from electrum application. Did I miss something? And I also have trouble with generating wifs, as it seems they removed method bitcoin.SecretToASecret(prv, compressed=True), but I can't find with what they replaced it.

from electrum import bitcoin
from electrum import keystore
from electrum.mnemonic import Mnemonic

defaultseed = "face circle glad valley exhibit find man oblige kingdom scorpion fish misery"

m44_0_0_0_0 = {
    'address': '1ALSQR3C68JLj5rtJHv594r5cviTqoXMNr',  # compressed by default
    'private_key': 'Ky9mddDtaqcLC1vv6egmgQpiZh8Lgh111LnJSyJENxJs3oW93bjD'
}

if __name__ == '__main__':

    password = ''
    bip32_seed = Mnemonic.mnemonic_to_seed(defaultseed, password)

    # m / purpose' / coin_type' / account' / change / address_index
    derivation = "m/44'/0'/0'/"
    xtype = keystore.xtype_from_derivation(derivation)
    # print('seed: {}'.format(repr(bip32_seed)))
    xprv, xpub = bitcoin.bip32_root(bip32_seed, xtype)
    # print('root: {0}  {1}'.format(xprv, xpub))

    xprv, xpub = bitcoin.bip32_private_derivation(xprv, 'm/', derivation)  # 1st account

    # generate first receiving addresses:
    i = 0
    prv, pub = bitcoin.bip32_private_derivation(xprv, "", "0/{index}".format(index=i))

    pub = bitcoin.deserialize_xkey(pub, False)[-1]
    prv = bitcoin.deserialize_xkey(prv, True)[-1]
    addr = bitcoin.public_key_to_p2pkh(pub)

    wif = 'how to generate wif from {prv} using electrum'

    print('{index:2}: {addr}  {wif}'.format(index=i, addr=addr, wif=wif))

The derivation path you used is incorrect. Electrum does not use bip44. Anyway here's one way to do this for p2pkh addresses:

from electrum import bitcoin
from electrum import keystore

seed = "<seed here>"
change = False
address_index = 0

k = keystore.from_seed( seed, '', False )
print( bitcoin.pubkey_to_address('p2pkh', k.derive_pubkey( change, address_index ) ) )


Can one send bitcoind transactions that will only be valid after a certain amount of time? The standard client only allows one to spend coins from a transaction after getting 6 confirmations (120 in case of mining rewards). Can one send bitcoind a JSON-RPC command telling it to send those unconfirmed coins before they gather enough confirmations, so the transactions would be executed once those confirmations appear (essentially telling it "once you get enough confirmations, send my coins to X")?

The bitcoin.org client will allow you to spend coins after just one confirmation has been received.

The Bitcoin protocol has no restriction that would prohibit you from spending immediately (o/unconfirmed) so it simply would be up to the client supporting it.

The My Wallet from http://www.blockchain.info/wallet  supports spending immediately after receipt.


Run bitcoind as a service in windows Motivation

I don't want to have to have bitcoin-qt running.
I want the control and error handling capabilities that come when something is running as a service.
I want bitcoind to start when windows starts in the event of a server downage

Notes
I want to service main and testnet, which I think won't be an issue since afaik bitcoind listens on both ports. I'm just mentioning this for more information.

Install

Download NSSM
Comment out #daemon=1 from bitcoin.conf with comment #incompatible with windows service
Shut down bitcoin-qt, bitcoind, bitcoin-cli to eliminate any confusion
nssm install BitcoinCore "C:\Program Files\Bitcoin\daemon\bitcoind.exe" -datadir=C:\Documents\Data\Bitcoin (use your own path of course)
nssm set BitcoinCore DisplayName Bitcoin Core
nssm set BitcoinCore Description Bitcoin node with a JSON-RPC server

Test

You should be able to see 8333 connections in netstat
You will see bitcoind in your task list under Details
If you go to Service(s), it will take you to this service.
bitcoin-qt still works even in testnet mode
bitcoin-cli still works even in -testnet
Your app still works even in testnet mode

Running mainnet and Testnet both
Repeat the steps for install, but on step 4, use
nssm install BitcoinCoreTestnet "C:\Program Files\Bitcoin\daemon\bitcoind.exe" -testnet=1 -datadir=C:\Documents\Data\Bitcoin

You will then be able to take requests for mainnet on port 8332 and testnet on port 18332


Bitcoin node 403 json-rpc have read all possible examples on the internet but still cannot connect to btc node from Java.

I'm using btcd-cli4j but have tried all other rpc libs as well, result is the same.
This is the command:

BtcdClient client = new VerboseBtcdClientImpl(httpProvider, "127.0.0.1", 8332, "foo", "bar");

This is the docker image:

version: '3.3'

services:

bitcoind:
image: seegno/bitcoind:latest
command:
  -printtoconsole
  -regtest=1
  -rest
  -rpcallowip=172.18.0.2
  -rpcuser=foo
  -rpcpassword=bar
  -rpcport=8332
  -server
  -logips
  -debug=rpc
ports:
  - 8332:8332

Have tried couple of different docker images as well. Always the same:
Exception in thread "main"

HttpLayerException(super=CommunicationException
(super=com.neemre.btcdcli4j.core.http.HttpLayerException: Error #1003001: The server responded with a non-OK (4xx) HTTP status code. Status line: HTTP/1.1 403 Forbidden, code=1003001))

My suspicion was around rpcallowip but don't know how to set correctly. This one is set by going into the docker container and executing hostanme -i to see the ip address. Setting that one in config and restarting the container.

add or changed to

rpcallowip=0.0.0.0/0

this will fix most of rpc json 403 forbidden error (this has no security issues if your using it within your network)


Noob: new to bitcoin, bitcoind will not run on Windows 10 I just heard about Bitcoin, it looks huge, and am trying to get it to work and see how it works.

I live in a very rural community and we do not have Internet yet, I had to do some dirty deeds to get my first minimal hardware, and to get this far to simply post.

--
I installed QT and let it sync.
I want to learn how to run bitcoind on my local Windows PC and issue commands in hex to the network.

I can't get bitcoind to run.

C:\bitcoin-0.17.0\bin\bitcoind -daemon -datadir=c:\bitcoin          ( when I ran QT, I added -datadir=c:\bitcoin )
Error: -daemon is not supported on this operating system

--
I am assuming I can't or should not run Bitcoin QT and the daemon at the same time.  I'm trying to understand the bitcoin commands, from the command line (not the QT console) and believe that I can not run both at the same time, because both try to sync the blockchain, correct me if I'm wrong.

You can run bitcoind.exe on windows if you leave off the -daemon flag, as the error message says. Then it will run in the command prompt window or whatever you are running it with. While it's running, you can interact with it using bitcoin-cli.exe in a separate command prompt window.

No, you can't run bitcoind and bitcoin-qt at the same time if they're using the same data/wallet directory, correct. But that's not the cause of the error here.


Why API of bitcoin exchanges use HMAC over HTTPS/SSL? Pretty all exchanges use private and public key. We sign API request with our private key using HMAC algorithm. What's the point of doing so when there is already HTTPS connection?
HTTPS provides both data integrity and ensures security of the transmission.

Isn't it enough to just POST our credentials like api.exchange.com?key=key&private_key=private_key?

This is part of strategy known as "Defense in Depth."  Each layer does not presume that the layers before or after it are certain to be secure, and takes measures to ensure security and verify security.  HMAC signatures are one of those measures.

A HMAC signature preserves the integrity of the query so that a 0.1BTC purchase doesn't get changed to a 1.0BTC regardless of the security of the HTTPS transport.

The protections granted by SSL/HTTPS/TLS are not absolute and do have some clever attacks. In addition to some non-clever attacks such as the private key of the other side of the transaction being known to some third party (either by malice, hackers, or force of law).  The same goes for other parameters needed for the integrity of the communication.  There have been experimental Man in the Middle attacks where SSL transactions have been altered.  The math wasn't broken, but other clever configuration changes were done. So the weak link there is people.


If price increases over a time period, what is the best explanation(s) if hash rate goes down? The price of bitcoin is up ~30% over the last three months, but the network hash rate is only up ~5%. How can this be explained?
I assume that new, highly efficient mining chips have been produced every week of the last three months. Therefore I would expect the global pool of miners to be able to hash more with the same amount of electricity. Since an increase in block reward revenue (in terms of USD) is proportional to an increase in price... I would have expected a "greater than 30%" increase in hash rate. Could part of the explanation be volatility in the price of electricity? Were miners operating unprofitably three months ago and have since then come to their senses? Appreciate your theories.
graph of Hash rate

The price was pretty stable and very low for most of those three months, it only picked up significantly in the last few weeks.

As the price had been low and in a long-term down-trend, the profit margin would be extraordinarily slim, making the market even more competitive. This should have limited additional investments by current players, and curbed interest of new players to enter the mining market. It appears that any technological advancements have only driven out less efficient rigs and improved profit margins slightly.

As the acquisition cost of mining rigs represents a significant portion of the total operation cost, I would assume that short swings would only cause less efficient hardware to be turned back on for the time being, but a major wave of new acquisitions would need a pronounced long-term up-trend. Even if the current swing is perceived as such, order, delivery, and taking into operation will lag behind the trend some weeks to months.


How do we talk to bitcoind in a PHP plugin? I'm trying to write a PHP plugin that will talk to bitcoind to generate a random address to send a bitcoin transaction to.

I'm really confused: how am I supposed to setup bitcoind so that we can query it to generate a random address?

Thanks!

First, run bitcoind on your server. Set up bitcoin.conf to have the correct RPC port and a password and etc.

Then, include the jsonRPCClient.php file:

include('jsonRPCClient.php');

Then, instantiate an object like so:

$bitcoind = new jsonRPCClient("http://$YOUR_RPC_USER:$YOUR_RPC_PASS@$YOUR_RPC_HOST:$YOUR_RPC_PORT/");

You can now run commands from the RPC using this object.

$bitcoind->getnetworkhashps();
$bitcoind->getrawtransaction($txid);

So if you want a new address:

$newaddr = $bitcoind->getnewaddress();


Listunspent: "Solvable - False" So i have retrieved an old wallet.dat file. When i open it in bitcoin-core i can only see the adress as an watchadress. I went to the console and typed - listunspent and this shows up.
I understand why the bits are unspendable due to the fact that it only shows as a watch-adress. But how is it possible that it says "solvable -false" since i accessed with the wallet? Am i missing something very important here?
"vout": 14,
"address": "-------------------",
"label": "",
"scriptPubKey": "----------------------",
"amount": 0.60790000,
"confirmations": 257190,
"spendable": false,
"solvable": false,
"safe": true

Solvable refers to the wallets ability to create a transaction which could spend those funds. As it is a watch only key that has been imported, there is no possible solution which it could come to in order to spend that money.


Does desktop wallet need to be online for the coins to mature? Suppose, I've installed a new coin wallet, got synchronized with the network, now I've sent some coins to my wallet. Now, if I close my wallet (and stay offline), would it get maturity after X amount of time (X is the coin maturity time) or would I have to keep my wallet online to get maturity ?

No, your wallet does not have to be online. Maturity depends on the block number in which a transaction was included into the blockchain.


Alternative currencies eWallets Are there any online wallet services that offer services for alternative cryptocoins, such as Namecoins, Litecoins, etc?

You can use the btc-e exchange for example.


How should I integrate Bitcoin payments in an online service? I am implementing a website where some users can create surveys and pay the people that complete them with bitcoins. What steps should I follow to implement this payment system? Like, information needed from each party, steps to take to confirm payment, etc.

Survey order:

You ought to have a system that uniquely identifies the survey and assigned it some string of characters. This can be just a simple number, or something more complex.
You need to use that unique id to request a Bitcoin address form bitcoind with a unique account name derived from that id. I would also advise hashing the account name, so in case your wallet gets compromised your customers' information won't get leaked.
You will present that Bitcoin address to the survey owner to send their Bitcoins to.
You should periodically check bitcoind for new transactions. In order to avoid double-spends, you should wait until you get at least 1 confirmation (preferably 6) on the transaction before letting the survey go live.

Survey is live:

You need to have a system that uniquely identifies the users filling out the survey, so they won't do the same survey twice.
Each user will need to provide their withdraw address (and you should check whether it is okay)
You should track who fills out a particular survey and keep a log of their addresses. This way you would be able to make a single payment to all of them at the end of the day, rather than make an individual payment to each person. This would save you money on transaction fees.
You can either make payments from the account unique to the survey, or move all the money into a single payout account and send payments from there. The latter would make the user receive only one payment, rather than be spammed with many. And again, this would lower your transaction fees.
You need to keep track of how much money is left for each survey and when to switch it off. You can either do that internally, or through appropriate balances in bitcoind (moving money from the account each time someone completes the survey).

These should be the basics. As always, keep your wallet secure, password protected and backed up. In case you have any more questions, you can always ask them on this StackExchange. If you need consulting, you can contact me (ThePiachu-gmail-com).


Is the Trusted Third Party an advantage or disadvantage in regards to wallet security? I'm new to bitcoin and have been reading some intros and FAQs.  Most features of bitcoin seem better than our current currency systems.  However, the one thing that strikes me is the ability to have your wallet stolen.  Either through malware, keylogger, in person, etc.  I've reading some posts on here about securing your wallet.  But the fact remains that it could get stolen.  And if it gets stolen your bitcoin balance is gone.  There is no way to recover it.  If you compare that to credit cards, when your card (or card number) gets stolen, the thief may make payments using the card, but the trusted third party (bank or credit card company) will usually not hold you liable and refund the money.
Therefore, if bitcoin were to become the most widely used currency in the world, people could lose their life savings just by a single virus infection or devious hacker.  Having that bank or credit card company involved provides that extra level of shelter.
Does anyone think this will hold back bitcoin use from becoming widespread throughout the world?

Security is, of course, an issue and when using Bitcoin you should exercise caution. That being said, it is important to remember that the Bitcoin community is rapidly evolving, and new technologies, systems, and services are being developed.

As Bitcoin continues to evolve, companies and computer programs will come up with new solutions to challenges and problems. For example, as you point out wallet security is a major issue.

Already, companies are coming up with more secure wallets, that are hacker proof, and larger exchanges and service providers are being established. For a major company like Mt. Gox there is no incentive to steal Bitcoins, they have a profitable business model and any blow back from theft would far outweigh the incentive to steal.

Over time, companies will probably grow in size so that they can provide third party security comparable to a bank or credit card company for Bitcoins. Of course, it's relevant to wonder if they can do so while maintaining confidentiality.

Security companies will also likely grow in size past that point that they would consider trying to launch any type of scam. Think about it, do you think Norton Anti-virus would ever try to launch a virus program? Most likely not. Currently, most Bitcoin security companies are pretty small, but over time a few brand names will likely emerge.

So to get to the point: No I don't think that the security issues you present will hold back Bitcoin. The Bitcoin community is creative, dynamic, and able to respond to challenges. Companies and programmers will see these challenges as opportunities, and will respond appropriately.

My guess, Bitcoin will eventually be able to provide a sort of third party security, much like a bank, to those who want the extra layer of security, most likely for increased fees. Those who do not want or need that extra layer of security won't be forced to accept it.

So, is the lack of a third party an advantage or disadvantage? Honestly, I think that depends on the situation. If you want to have a highly confidential way to store and transfer money, having a third party involved means someone will be looking into your transactions, at least to some extent. If your biggest concern is having a secure way to store money, than third parties can provide extra security. That being said, there are ways to secure your Bitcoins, and as I stated I believe Bitcoin will eventually be able to provide similar levels of protection.

On a separate note since you are new to Bitcoin, if you are using Bitcoin, I would personally advise that you not keep all of your funds in one account. Divide your bitcoins into several accounts, and if possible keep the bulk of your funds secured offline. If you have a large amount of funds, you could even consider something like a safety deposit box at a bank.

Also, I advise going with trusted brand names, like Mt. Gox, or using service providers backed by Silicon Valley funding, things like that. These sites and services should be more secure.


How to spend from a paper wallet private key using a desktop app without a mobile app? I have a paper wallet and the private key. What methods can I do on the desktop to send a portion of these bitcoins using only a desktop app? Is there an app where I can type in my private key and select how much to send?

When you launch Electrum for the first time, it wants you to create a new wallet. Same when you just choose File → New/Restore at any point.

Then, choose "Restore a wallet or import keys" and "Standard wallet". On the next page, enter your private key. The password you can choose afterwards is optional and you can skip it or only remember for the period of time you're keeping this wallet on your computer.

If you want to try this in advance without typing your own private key in, you can use the private key KzbvEHb1HvDRZMPvVF7Du9F4N5g22QkeoeZ7qPCkjSPktt5bbCDU. Is has had 50 mBTC going in and out again as you can see on the blockchain.info page about its corresponding address 15dNGcjVE8ddCt3vgYwcpJjYXK4ydZtykF and you can find out how Electrum shows this to you if you create a wallet using it. This private key has been specifically created by me to be publicly known.

Note that Electrum won't be able to create more addresses from it because it only is a single private key. It is, however, able to show the one address the private key corresponds to.

You can use my answer to your question "
How do you send to multiple addresses by paying a one time fee? Which wallet supports this?" to transfer the remaining money back to the address it came from so you can spend it using the same private key in the future.


Are transactions in a block decided by mining pool operator? My assumptions:

Most pools have an operator. All individual miners part of the pool work on block with address of the coinbase transaction owned by pool operator. pool operator gets all the bitcoins and distributes periodically to individual miners based on the proportion of the work done.

My question:

It appears to be me that technically each individual miner can choose the list of transactions except for coinbase transaction. Is this correct? or do pool operators dictate the full block contents? If either way is possible, what usually happens in practice?

technically each individual miner can choose the list of transactions
  except for coinbase transaction. Is this correct?

Technically it is possible. In fact no one do it. Pool operator assembles a list of transactions and miners only calculate sha-hashes. They do not know block contents.

  or do pool operators dictate the full block contents?

Yes


Can I recreate the xpub key if I have multiple public addresses with their corresponding private keys? Is it possible to recreate the xpub key if I have multiple public addresses with their corresponding private keys? All the keys were created from the same HD wallet.

I was hodling and watching my wallets using the addressbalance query from blockchain.info, but since moving my funds, I'd like to watch it from the xpub address but no longer have access to the app that created the private keys...

No, it is not possible. BIP 32 uses a combination of a hash function and Elliptic Curve Point Multiplication in order to derive the child keys (both public and private). Since both hashing and EC point multiplication are one way functions, you cannot find the inputs to those functions given just the outputs (i.e. child public or private keys). Thus you cannot derive the parent extended public key or extended private key given just many child public or private keys.


How to build Bitcoin Core Linux tarball from sources I'm trying to build the same tarball you can download from the website, containing the following filetree:

$ ls -R ../../bitcoin-0.15.0/
../../bitcoin-0.15.0/:
bin  include  lib  share

../../bitcoin-0.15.0/bin:
bitcoin-cli  bitcoind  bitcoin-qt  bitcoin-tx  test_bitcoin

../../bitcoin-0.15.0/include:
bitcoinconsensus.h

../../bitcoin-0.15.0/lib:
libbitcoinconsensus.so  libbitcoinconsensus.so.0  libbitcoinconsensus.so.0.0.0

../../bitcoin-0.15.0/share:
man

../../bitcoin-0.15.0/share/man:
man1

../../bitcoin-0.15.0/share/man/man1:
bitcoin-cli.1  bitcoind.1  bitcoin-qt.1  bitcoin-tx.1

I'm using the 'prefix' configure to put the binaries into a specific folder

./configure --prefix=/home/ff/bitcoin-build

Now, the content I get inside the target directory is almost the same (there are some files more). However,when I try to copy and run it inside a container it gives me an error (which is not the case with the original tarball).

So, my question is: how do I build the sources in order to produce the same tarball you get from the website?

The compiled binaries on the website are built using gitian. This is deterministic so you'll get an identical build to everyone else who has built it, for verification purposes. You can find instructions on how to do this here: https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md


How to send btc from the specific address using bitcoin api? I'd like to send bitcoin from the specific address to a address using bitcoin api. I used 'sendfrom' as follows. Each address "mqXhhivMPjeVvdVMR239EVDJiRGQUYcbDZ" and "mknGW629wzSkfWvgXF23d8eTrqibnhTcrf" has bitcoin more than 0.002btc, however it returned the "insufficient funds" error. Could you tell me how to send from the specific address?

bitcoin-cli sendfrom mqXhhivMPjeVvdVMR239EVDJiRGQUYcbDZ mknGW629wzSkfWvgXF23d8eTrqibnhTcrf 0.002

Account has insufficient funds

You cannot send from an address. All the coins inside a wallet are always treated as a single balance, for privacy reasons.

All sendfrom does is deduct the money you're sending from the virtual local account with that name. You can move money to those accounts using the move command. Received coins are by default credited to the "" account. Still, these accounts have nothing to do with actual coins on the network. This account system is scheduled for deprecation, though.

If you want to manually select the coins to use, look into the listunspent, createrawtransaction, signrawtransaction and sendrawtransaction RPC calls.


What happens if full nodes don't check for double spends or deliberately lets a double spend TX pass and then this full node relays the transaction? I am studying about Bitcoin and Blockchain tech via the Princeton crypto course, and it mentions that Full nodes do the following checks :

i)transaction is valid with the current blockchain,

ii)whether the scripts matches whitelist,

iii)transaction hasn't been seen before and

iv)doesn't conflict with others its relayed (to avoid double spend).

However, the lecturer also mentioned these checks are not enforced on a node. Lets say a full node may have a full set of of UTXO but still decides to relay a transaction that has been spent before (effectively ignoring the fact that the TX is not on the UTXO pool) , and eventually this TX is relayed around and makes it into a block. Since the miners trust these nodes to verify transactions , wouldn't the TX be put into the consensus chain ?

I understand that the mining process (POW) and resulting block reward can only be  claimed/collected if the block ends up on the long-term consensus branch, but this doesn't safeguard the malicious node behavior as I have explained since miners don't check for double spends.

Since the miners trust these nodes to verify transactions, ... since miners don't check for double spends.

What makes you think this? Miners are also nodes; they are a subset of nodes. Miners still receive and verify all transactions, they don't just blindly trust what some other node has given them. Miners are incentivized to check transactions as including any invalid transactions means that the block will also be invalid and thus be rejected by the other nodes and miners on the network.

If a miner produces an invalid transaction (e.g. by including a double spend), the block will be considered invalid. Miners do not determine what is valid and invalid, nodes do. So when the nodes on the network receive that invalid block, they will reject it as invalid and not add it to their blockchain. Furthermore, since miners are also nodes, other miners will reject the block and thus they will not mine on top of it.

If miners mine on top of the invalid block, there will be a blockchain fork. The nodes on the network will refuse to follow a chain that contains an invalid block, even if it has more work. They only follow the valid chain with the most work, and an invalid block makes that chain invalid.


What happens if "transaction size" is larger than "maximum block size"? Assuming a transaction size is T Bytes, while maximum block size is B Bytes, such that T>B.

What happens for this transaction?

It will be divided into two smaller parts and will be stored in two separate blocks? Or it will not be confirmed at all? Or A dynamic block size could be used ?

P.S. Although, actually maximum block size is 1 MB and seems to be enough for every transaction; however, we would like to know the strategy of the Bitcoin in such a situation.

Note: Since in addressed answer is mentioned: "What limits transaction size is cost." the question does not seem to be the same, where my question is not what is the maximum size of a transaction, but is what happens if size of a transaction is larger than maximum block size.

Nick Odell answers the original question:

  The maximum transaction size is the size of the block. Source.

and

  Transactions larger than 100 kilobytes (including witness at a 75% discount rate) are non-standard. Source 1. Source 2.

so the case that you are describing will not occur as transactions lager than the blocksize will be sorted out.


What should be less than the target? When I go to BlockExplorer and observe the hash of block 514441's header I see it to be:

0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6

However when I obtain the header of block 514441 from:

https://blockchain.info/rawblock/0000000000000000004ec916884d8b2cd3dc0e80ab199cc23e528e7dc10fafc6?format=hex

and I double hash the first 640 bits using Java's SHA256 implementation I get the following (they are byte reversals of each other):

c6 af 0f c1 7d 8e 52 3e c2 9c 19 ab 80 0e dc d3 2c 8b 4d 88 16 c9 4e 00 00 00 00 00 00 00 00 00

Which is the actual block header hash that has to be less than the target value?

Which is the actual block header hash that has to be less than the target value?

Both.

SHA256 produces an array of 32 bytes as output. Bitcoin treats those 32 bytes as a 256-bit LSB integer (least significant bit first). It is this integer that is compared to the target.

However, as humans are used to seeing numbers formatted in MSB order (most significant bit first), that too is what happens in Bitcoin. The formatting with the zeroes up front is not the output of the hash function. It is the output of the hash function, interpreted as an LSB-encoded integer, and then formatted in hexadecimal in MSB order.


lookup in distributed ledgers We know that the bitcoin distributed ledgers is stored in a serialized blockchain based on the transactions' chronicle order.

The current size of this database is about 100 GB. How can they search easily within this database? For example, if I got a paper-wallet previously loaded with some bits from Xapo, and I try to sweep its bitcoin value into a copay wallet (different from Xapo), it takes about 75 second to search & get its balance!

So, how can they search in this large serialized database within this short-time? I am asking about the technology behind that!

The balance is calculated from the UTXO set where unspent outputs belong to the address in question. Most block explorers will enable the transaction index, parse the historical and live data, and dump it into a database that runs on top of bitcoin to track additional statistics. As you can imagine this requires a lot more disk storage, but it makes things like searching faster.


Electrum addresses start with "b" As far as I know, all bitcoin addresses start with a "1" or "3" prefix.
I've just started using electrum wallet and all the addresses it generated had a prefix of "b", or even "bc".
Is this legit or some scam, and if legit, does it have a special meaning (like segwit addresses starting with "3" prefix) and where can I read more about it?

These are native SegWit addresses, specified in BIP173 using a format called Bech32. They begin with 'bc1'.

Addresses that begin with a 3 are P2SH addresses, an address format that has been around for over 5 years now. They were originally used by multisig wallets like CoPay and GreenAddress, which only saw limited usage. However, SegWit can also be used in compatibility mode, using the existing P2SH format, so that old clients can send to it. This gave rise to the myth that '3' addresses are specifically for SegWit.


How do I specify many utxo in a bitcoin cash transaction? I want to create a Tx with bitcoincashjs:
create-a-transaction
But how do I specify multi inputs: from(utxo) and multi outputs: to ?

const bch = require('bitcoincashjs');

const privateKey = new bch.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
const utxos = [{
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}, {
  'txId' : '115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986',
  'outputIndex' : 0,
  'address' : '17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV',
  'script' : '76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac',
  'satoshis' : 50000
}];
const transaction = new bch.Transaction()
  .from(utxos)
  .to('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
  .sign(privateKey);

console.log(transaction.toString())

  from: A high level interface to add an input from a UTXO. It has a series of variants:

  from(utxo): add an input from an Unspent Transaction Output. Currently, only P2PKH outputs are supported.

  from(utxos): same as above, but passing in an array of Unspent Outputs.

  from(utxo, publicKeys, threshold): add an input that spends a UTXO with a P2SH output for a Multisig script. The publicKeys argument is an array of public keys, and threshold is the number of required signatures in the Multisig script.

Details: https://bitcore.io/api/lib/transaction#adding-inputs


How do SPV (simple payment verification) wallets learn about incoming transactions? I try to understand a SPV implementation.

I read the wiki pages on Protocol Specification and Thin Client Security as well as the white-paper's chapter 8 .

What I don't understand:
Assume user A has Bitcoin address X.
User A can do getheaders and load all block headers and then have all block hashes and timestamps.

So: how does a SPV client then find possible transactions to the user's Bitcoin address X without loading all blocks (and all transactions)?

You are right that SPV as described in the Bitcoin paper does not explain how to discover payments to yourself, without downloading full blocks. My guess is that Satoshi either planned to develop this later, or that he assumed you'd just be told about payments to yourself (pay-to-IP, as existed next to pay-to-pubkeyhash as is used now).

Practical implementations of SPV nodes today however use a protocol extension called bloom filters, described in BIP 37. They use getheaders to fetch block information prior to their wallet's birth timestamp, and request filtered blocks afterwards. To do so, they submit a bloom filter that describes the addresses and transactions they are interested in to the peer. The peer then only includes the relevant transactions in blocks it submits, together with their Merkle paths to prove that these transactions were indeed part of said block.


For SIGHASH_SINGLE do the outputs other than at the input index, have 8 bytes or 9 bytes including a VarInt? The bitcoin wiki says:

  All other txCopy outputs aside from the output that is the same as the
  current input index are set to a blank script and a value of (long)
  -1.

https://en.bitcoin.it/wiki/OP_CHECKSIG#Hashtype_SIGHASH_SINGLE

It's hard finding what this means in the C++ client. Does it mean that the outputs, other than the output with the same index as the input being signed for, only have 8 bytes for the value or does it mean they also have another byte for the VarInt set to zero; 9 bytes in total?

Thanks.

Transaction outputs have a "value" field that's an 8-byte signed integer (always 8 bytes) indicating how many satoshis (0.00000001 BTC each) are available for that output.  That is the thing that gets set to -1 on the other outputs in SIGHASH_SINGLE mode.

This looks to be the code responsible for making this happen, from script.cpp:

/** Serialize an output of txTo */
template<typename S>
void SerializeOutput(S &s, unsigned int nOutput, int nType, int nVersion) const {
    if (fHashSingle && nOutput != nIn)
        // Do not lock-in the txout payee at other indices as txin
        ::Serialize(s, CTxOut(), nType, nVersion);
    else
        ::Serialize(s, txTo.vout[nOutput], nType, nVersion);
}

If we're in SIGHASH_SINGLE mode, and the index of the output is different from the index of the input, then the thing that we sign in this spot is just a dummy CTxOut object, whose parameterless constructor (in core.h) calls SetNull(), which sets the field called "nValue" to -1 (-0.00000001 BTC) and clears the scriptPubKey, which ensures that it's a 0-byte vector.

When CTxOut gets serialized, it writes the nValue and scriptPubKey per this (core.h again):

IMPLEMENT_SERIALIZE
(
    READWRITE(nValue);
    READWRITE(scriptPubKey);
)

nValue serializes as the 8-byte twos-complement representation of -1, or 0xFFFFFFFFFFFFFFFF.
scriptPubKey serializes as a 1-byte CompactSize that indicates that the script is 0 bytes long, or 0x0.


What contributions have Chaincode developers made to Bitcoin? Related question: What contributions have Blockstream developers made to the Bitcoin project?
Blockstream's contributions and involvement in Bitcoin is discussed a lot. I want to know Chaincode Labs's involvement, contributions and influence in Bitcoin.

Few things that were mentioned on Chaincode's website:

Chaincode engineers develop, review, test and maintain Bitcoin Core

Chaincode has contributed research and design for many of the recent improvements in the Bitcoin protocol, e.g. Erlay and Compact Blocks.

The Chaincode Residency is a program for engineers to develop experience with Bitcoin. Chaincode has hosted several residencies focused on the Bitcoin protocol, Bitcoin Core, Lightning Network applications and the Lightning protocol.

Bitcoin Optech helps Bitcoin users and businesses integrate scaling technologies through workshops, documentation, weekly newsletters, original research, case studies and announcements.

The Chaincode Podcast brings you interviews with the most influential Bitcoin engineers about Bitcoin protocol development.

https://chaincode.com/projects


51% attack and rewriting to the latest checkpoint This is not a question about the consequence of a 51% on the price nor as to the motivation of the attacker. Let say we don't care that it's not realistic and we don't care that the attacker wouldn't be rational.

Let's just assume an attacker has always 50%+1 (51%) of the mining power.

My understanding is that if I've got 51% of the mining power I can always, probability-wise, rewrite the blockchain to a blockchain with the more PoW.
I know there are checkpoints in the codebase with hashes of certain blocks and so I cannot wait decades (or hundreds of years), to rewrite the blockchain from scratch.

I read this statement, which I don't know is correct not:

  Crypto Fact:  Longest (Bitcoin) Chain with the Most Difficulty Wins , unless a Checkpoint Blocks it.

But can I always rewrite to the latest checkpoint?

When are these checkpoints added and how "far back" do these checkpoints go?

Is there a maximum number of blocks or "rewrite" that nodes can accept hardcoded in the protocol? (where nodes would reject the chain with the most PoW because it "tries to rewrite too many blocks").

What about if I've got 99% of the mining power, is this different than having 75% or 51%?

I mean, theoretically, is there an attack I can mount with 99% that I cannot do with 51%?

This is really just a single question which I think boils down to: Can I always rewrite to the latest checkpoint if I own 51% of the mining power?

As long as both competing chain-tips are adhering to the same rules, the chain with the most aggregate difficulty ("heavier") will win, regardless of height. Nodes performing the initial sync would automatically end up on the heavier chain by comparing the aggregate difficulty of the chain-tips offered by their peers due to headers-first synchronization.
However, pruned Bitcoin Core nodes already in sync with the "lighter" chain would not be able to reorganize to the heavier if they no longer keep all blocks up to the common ancestor of the two chains. Instead, such a pruned node would have to resync from scratch.

If an attacker controlled hashrate equivalent to 100% of the SHA-256d hashpower they would today be able to rebuild a blockchain of the same aggregate difficulty as Bitcoin's in approximately 186 days.

The checkpoint system is deprecated (see e.g. this GitHub-discussion), instead new releases of Bitcoin Core since 0.14.0 by default use an assumed valid block. The performance of the initial synchronisation is hereby improved by the same mechanism as checkpointing used: Up to the height of the assumevalid block the verifying of scripts/signatures is skipped, only block validity is checked, the UTXO Set is populated, and any data on transactions that concern the node's wallet is collected.

The advantage of assumevalid over checkpoints is that it doesn't force the node onto a predefined chain. The user can pick another block or turn the feature off completely in the configuration of their node. Bitcoin Core by default uses a blockheight that predates the release by multiple weeks.

As such, the defense against such an attack could be to collectively agree to resync with assumevalid set to any block after the attacker's chain has forked off.


When we're calling `getrawtransaction` how does Bitcoin-core calc and verify confirmations? if a transaction has 10 confirmation, does bitcoin-core check if the txid exists in the last 10 blocks? or its calculated based on transaction block number?

First of all, multiple confirmations does not mean that a transaction or its hash is included in multiple blocks. One confirmation means that a transaction was included in a block. More than one confirmation means that blocks have been mined on top of the block containing the transaction.

So what Bitcoin Core does is it records the hash and height of the block that contains the transaction, subtracts the current main chain height from the block height and then adds one. This counts the number of blocks mined after the block containing the transaction and then counts the block itself. This results in the number of confirmations the transaction has.


When using the lightning network, do you have to lock or deposit your coins somewhere? Trying to understand the lightning network some more. When using this new 2nd layer on top of bitcoin.

Do you lock your bitcoins on the lightning network so you can get "pegged" equivalent bitcoin tokens in the lightning network?
If these coins are locked and you sent half your coins to another user, now that person has a claim of 50% of your coins from your "locked" coins. So doesn't this mean its the same as depositing your coins into a 3rd party (lightning network) and letting that party deal with the transactions?

Do you lock your bitcoins on the lightning network so you can get "pegged" equivalent bitcoin tokens in the lightning network?

Yes your Bitcoin is locked into a payment channel, but you do not get "pegged" equivalent Bitcoin tokens. You are still using Bitcoin and making Bitcoin transactions, not something else.

  If these coins are locked and you sent half your coins to another user, now that person has a claim of 50% of your coins from your "locked" coins. So doesn't this mean its the same as depositing your coins into a 3rd party (lightning network) and letting that party deal with the transactions?

No. That other person cannot take your coins without you agreeing to it or doing something stupid (like broadcasting an old commitment transaction). If that person refuses to sign transactions to allow you to close the channel, you can close it yourself without risking any of your coins. You will just need to wait for the timeout to expire before you are allowed to move your coins.


Decodescript for a Testnet pubkey hash address This is the address information:

bitcoin-cli validateaddress n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW
{
  "isvalid": true,
  "address": "n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW",
  "scriptPubKey": "76a914ec90ca28c0ec302e991fb1c8171bf49c0d3d05be88ac",
  "isscript": false,
  "iswitness": false
}
bitcoin-cli decodescript 76a914ec90ca28c0ec302e991fb1c8171bf49c0d3d05be88ac
{
  "asm": "OP_DUP OP_HASH160 ec90ca28c0ec302e991fb1c8171bf49c0d3d05be OP_EQUALVERIFY OP_CHECKSIG",
  "reqSigs": 1,
  "type": "pubkeyhash",
  "addresses": [
    "n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW"
  ],
  "p2sh": "2NFyoZJJuWpvyiHFirFqsQnPXXna6mtf4Li",
  "segwit": {
    "asm": "0 ec90ca28c0ec302e991fb1c8171bf49c0d3d05be",
    "hex": "0014ec90ca28c0ec302e991fb1c8171bf49c0d3d05be",
    "reqSigs": 1,
    "type": "witness_v0_keyhash",
    "addresses": [
      "tb1qajgv52xqasczaxglk8ypwxl5nsxn6pd7307tfg"
    ],
    "p2sh-segwit": "2MwgL2byHmKdRvfGhufKpJkpAvtDLpo1REs"
  }
}

  Why are the 2 P2SH addresses also shown? Are they interchangeable?
  What do they have in common?

  What is a "witness_v0_keyhash" address?

From bitcoin-cli help decodescript:

{
  "asm":"asm",          (string) Script public key
  "type":"type",        (string) The output type (e.g. nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_unknown)
  "reqSigs": n,         (numeric) The required signatures
  "addresses": [        (json array of string)
     "address"          (string) bitcoin address
     ,...
  ],
  "p2sh":"str"          (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).
  "segwit": {           (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness).
    "asm":"str",        (string) String representation of the script public key
    "hex":"hexstr",     (string) Hex string of the script public key
    "type":"str",       (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)
    "reqSigs": n,       (numeric) The required signatures (always 1)
    "addresses": [      (json array of string) (always length 1)
      "address"         (string) segwit address
       ,...
    ],
    "p2sh-segwit":"str" (string) address of the P2SH script wrapping this witness redeem script.
}

Additional explanation, using your example:

n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW: this is a "legacy" pay-to-pubkey-hash address. Coins sent to this address are locked with the asm script you see in the output. They can be unlocked with a scriptSig that contains the public key that matches the hash, followed by a signature matching the public key.

p2sh: 2NFyoZJJuWpvyiHFirFqsQnPXXna6mtf4Li: This one is a bit confusing. It is still a "legacy" (not segwit) address, and it is a pay-to-script-hash address. Coins sent to this address are locked with a hash of the entire script you see above in asm. They are spent by pushing a scriptSig with the entire serialized script (DUP/HASH/EQUAL/CHECKSIG) followed by the public key and finally the signature.

segwit: tb1qajgv52xqasczaxglk8ypwxl5nsxn6pd7307tfg:  Here is a segwit address. BIP141 defines a few segwit address types and this one, as you can see, is a pay-to-witness-pubkey-hash or witness_v0_keyhash or p2wpkh address. Coins sent to this address are locked with a hash of a public key only (along with a specific byte that indicates segregated witness). They are spent by pushing an EMPTY scriptSig and providing a witness stack that has the public key and signature.

p2sh-segwit: 2MwgL2byHmKdRvfGhufKpJkpAvtDLpo1REs: Another segwit address. This one, as you can see, is a NESTED pay-to-witness-pubkey-hash or p2wpkh-p2sh address. Coins sent to this address are locked with a hash of the witness program seen in the asm section of the segwit section. They are spent by providing the serialized witness program in a scriptSig and ALSO including a witness stack with public key and signature.

Summary

If you have one private key, you can spend coins sent to any of these four addresses.


Most secure way of sending bitcoins from bitcoin-qt offline wallet I have an offline wallet created by Bitcoin-QT.
I want to send some of the bitcoins in this wallet to another address.

The most secure way I can think of is this:

Boot from a Linux Live CD
Install Bitcoin-qt and let Bitcoin-QT sync with the network
Import the wallet to Bitcoin-QT and send bitcoins
Save the wallet because of the change (https://en.bitcoin.it/wiki/Change) which was sent to a new created address in the wallet

But what happens if between step 3. and 4. your computer crashes?
All bitcoins which should be left in your wallet are lost.

Is there a more secure way of sending bitcoins from your offline wallet with Bitcoin-QT?
If not, whats the most secure way to do this in general?

I don't think that is really a problem, but first of all why do you want to use a Linux Live boot? Is that to disable possibly installed malware? When you send your transaction make sure that you install your temporary bitcoin client on a persistent drive, e.g. not on the computers RAM (this will take a lot of time, so better clear out your computer instead of this approach). Your private key will be generated before you send your transaction, so you can't lose it when power shuts of.

This won't save you of course when power shuts down and your hard-drive crashes at the same moment, but when you are dealing with large amounts of bitcoins you could probably use some RAID configuration (e.g. RAID-1) for your hard-drives and still be fine. Or you could buy an external power source as backup.


Can you specify a date in the future for the Bitcoin transaction I just came across this Transaction: https://blockchain.info/tx/cf77c2b888916c0debfb801d3d129ba5b7f6445e0dd6db9238b313b51369024c

Received Time:  2063-08-04 05:00:33

Raw Transaction: https://blockchain.info/rawtx/cf77c2b888916c0debfb801d3d129ba5b7f6445e0dd6db9238b313b51369024c

Is it just one case, maybe some kind of bug, which has already been solved, or is this a normal behavior?

Is there any official information regarding this topic?

That looks like a glitch with blockchain.info, there is no "time" encoded in a bitcoin transaction itself so that number is likely just when blockchain.info received the transaction.

In general though, it is possible to create a transaction which is only valid after a certain point in time or a certain block height in the blockchain, by using the "locktime" component of a transaction. If a locktime on the transaction is set, the transaction can only be included in a block after that point, not before, which may be of interest to you.


Why can't I import a used private key? According the the Bitcoin Wiki, when importing a private key:

  Bitcoind will rescan the entire
  block data to ensure this key has not been used before.
  This process will take from one to two minutes,
  depending on your CPU performance. DO NOT abort it before finishing!

Why is this scanning necessary?  Wouldn't this prevent me from changing from one bitcoin client to another, because that would involve importing (used) private keys from the old client into the new?

It is usually longer than 2 minutes...
Please look at the blockchain as a database storing addresses and balances.
If you have an address (privkey) from the very beginning, you search in the blockchain for records about your address.
But if you import address, which was unknown to this client, you have to go through blockchain once again, in order to search for records corresponding to this address. Elsewhere, how could you know balance of this address, if you didn't look at it before importing?
In my opinion, it doesn't prevent you from importing anything. If you want to skip rescan, use bitcoind importprivkey l12n3lj2nl2n3213lkj4n3lk4n false. You can import a lot of privkeys this way, and rescan at the end with the last address or via start switch bitcoind -rescan.
Please note that rescaning is not necessary when importing keys with 0 BTC.


how to differentiate bitcoin-cli command when have testnet & mainnet both running I have bitcoin testnet3, mainnet, regtest both running in the same server, I can interactive with them by curl, because the ports are different, but when comes to bitcoin-cli how can I specific the network I want interactive with?

I get below error:

$ bitcoin-cli -regtest setgenerate true 101  # I want use regtest
Error: Invalid combination of -regtest and -testnet.

You can pass the -rpcport flag to bitcoin-cli to specify which node to connect to when running multiple on the same machine.


cannot get bitcoind working on ubuntu 12.04 i was previously using ubuntu 10.04 and i tried to install bitcoind. this failed and i upgraded to ubuntu 12.04. when i run bitcoind it still doesn't work:

$ bitcoind
************************
EXCEPTION: 11DbException
Db::open: Invalid argument
bitcoin in AppInit()

terminate called after throwing an instance of 'DbException'
  what():  Db::open: Invalid argument
Aborted (core dumped)

also trying to install again does not work:

$ sudo apt-get install bitcoind
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bitcoind
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 981 kB of archives.
After this operation, 2,873 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu/ precise/main bitcoind amd64 0.8.5-precise1 [981 kB]
Fetched 981 kB in 7s (130 kB/s)
(Reading database ... 222704 files and directories currently installed.)
Unpacking bitcoind (from .../bitcoind_0.8.5-precise1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/bitcoind_0.8.5-precise1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/bitcoind', which is also in package bitcoin 0.3.24-ppa2~lucid
No apport report written because MaxReports is reached already
                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/bitcoind_0.8.5-precise1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

how can i get bitcoind working? i don't mind uninstalling and reinstalling if that is what it takes...

update 1

i just tried removing the package and installing again, but still no luck:

$ sudo apt-get remove --purge bitcoind
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package bitcoind is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

$ sudo apt-get install bitcoind
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bitcoind
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 981 kB of archives.
After this operation, 2,873 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu/ precise/main bitcoind amd64 0.8.5-precise1 [981 kB]
Fetched 981 kB in 7s (136 kB/s)
(Reading database ... 222704 files and directories currently installed.)
Unpacking bitcoind (from .../bitcoind_0.8.5-precise1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/bitcoind_0.8.5-precise1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/bitcoind', which is also in package bitcoin 0.3.24-ppa2~lucid
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/bitcoind_0.8.5-precise1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Try to overwrite the existing version:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/bitcoind_0.8.5-precise1_amd64.deb


Can a publicly visible but privately mined block chain be trusted? Outside of Bitcoin, if a company set up a blockchain like structure that can be publicly accessed but only the company itself mines blocks, does that mean the blockchain can't be trusted?

I have only a rough theory in mind, no hard examples. Say a card game was implemented using a block chain. Card collections and game stats are stored in a blockchain and accessed by all the players of the game. None of the players mine any of the blocks. As players play the game, trade cards, open booster packs, etc they submit varying types of transactions to the company and the company verifies and adds the data to the blockchain. But the company mines the blockchain to solidify those transactions themselves and not allowing clients to mine at all.

I can see how money (Bitcoin, fiat, etc) would change hands for rare cards or booster packs. Inherently there would be value for the cards not unlike Magic: The Gathering or Pokemon having rare cards that people want. Can a player trust the company's blockchain? Since the number of miners is controlled by the company, what would be an acceptable difficulty for the miners to have to reach? Wouldn't too low of a difficulty not be enough proof of work to be trusted?

Since it's in the company's best interest to promote the proper use of the chain it's not really a 51% attack (technically a 100% attack). The users would know they're not mining from the beginning. Would this be any different than the company choosing postgres over MySQL? It's just the company's choice for storage, right?

I'm hoping that data transparency and data integrity can be preserved by having a publicly visible blockchain but since there's no reward to users for mining there's not much reason they will actually mine.

There's really no point. There's much simpler ways to provide the same data transparency and integrity guarantees. The only reason to use a blockchain would be so you could say "it's cool because we use a blockchain".

You can use transactions without a blockchain. You can map ownership to cryptographic identities without a blockchain. The sole miner just sign that it's accepted a transaction rather than doing anything like mining.

A blockchain doesn't do anything for data transparency. Just because you have a blockchain doesn't compel you to make it publicly accessible. And you can make data publicly accessible regardless of its format, blockchain or not.

And there's lots of costs associated with blockchains, none of which give any benefit. The whole point of mining is to allow you to determine what is truth without a central authority to say what is true. If you have that anyway, what's the point?

This is such an easy to solve problem and blockchains have such complex tradeoffs, it would really only make sense if you were too lazy to build something more appropriate and just happened to have a blockchain solution you could easily drop in.


Mining on Amazon EC2 Was there ever a time when mining on Amazon EC2 was profitable? When the difficulty was low, so was the exchange rate, so I'm not sure.

Sure there was, when mining-difficulty was very low. And the miners did not have yet implemented mining on GPUs.


bip39 converting from entropy to seed failing tests with entropy "00000000000000000000000000000000" Trying to convert hexadecimal string of entropy to seed sentence with the below snippet. Failing the first test with 16 zero bytes. It seems that my function came to conclusion that checksum is '1011' yet it should by '0011' (by this page for instance) therefore I do have a mistake in seed sentence where my last word is on index 13 (accuse) and correct word is on index 3 (about). What is broken in my function? Also, there is not much of an implementation details in bip39, if you know about some resources (not just core codebase) they'd be warmly welcome!

import hashlib
import requests
import unicodedata

def get_word_list():
    url = "https://raw.githubusercontent.com/"
    uri = "bitcoin/bips/master/bip-0039/english.txt"
    return requests.get(url + uri).text.split()

def checksum_length(entropy_bits: int) -> int:
    return int(entropy_bits / 32)

def mnemonic_from_entropy(entropy: str) -> str:
    word_list = get_word_list()
    entropy_bits = len(entropy) * 4
    entropy_bytes = bytes.fromhex(entropy)
    print(entropy_bytes.hex())
    entropy_int = int.from_bytes(entropy_bytes, byteorder="big")
    sha256_entropy_bytes = hashlib.sha256(entropy_bytes).digest()
    sha256_entropy_int = int.from_bytes(sha256_entropy_bytes, "big")
    checksum_bit_length = checksum_length(entropy_bits=entropy_bits)
    checksum = bin(sha256_entropy_int)[2:2 + checksum_bit_length]
    entropy_checksum = bin(entropy_int)[2:] + checksum
    entropy_checksum = entropy_checksum.zfill(entropy_bits + checksum_bit_length)
    bin_indexes = re.findall("." * 11, entropy_checksum)
    indexes = [int(index, 2) for index in bin_indexes]
    mnemonic_lst = [word_list[index] for index in indexes]
    mnemonic_sentence = unicodedata.normalize("NFKD", " ".join(mnemonic_lst))
    return mnemonic_sentence

if __name__ == "__main__":
    mnemonic_from_entropy("00000000000000000000000000000000")

you need to remove python binary denominator '0b' and then zero fill the binary representation of sha256 digest to 256bits --> then it works

checksum = bin(sha256_entropy_int)[2:].zfill(256)[:checksum_bit_length]

also there is a reference implementation mentioned in the bip (must have missed it initially)


Is there any study or research of how to make BTC transfers refundable? is there any study or recent research of making the bitcoins transfer refundable? As if your account is hacked and the bitcoins are transferred there is no way I can return it back.

At the technical level - No.

Credit card charge-backs work because the credit networks such as VISA and MasterCard (and participating banks) are giant clearing houses or multilateral bank arrangements to that effect. Anyone with an ongoing relationship with a bank essentially agrees to having money removed from their account or frozen in the case of a dispute or other funny business.

This is difficult to enforce with bitcoin addresses, if those addresses avoid the more centralised parts of the bitcoin ecology (currency exchanges, escrows, off-block payment gateways) that are more motivated to trace, penalise and report theft and fraud.

However:

Bitcoin insurance may become a popular way to mitigate against theft or fraud. This should actually be quite easy for insurance companies to calculate actuarial tables and premiums for; as the global transaction log for this currency is entirely visible.
Escrow is a common option for "reversible" transactions but only because the atomic irreversible bitcoin transactions are split into two separate transactions: One to the escrow and one from the escrow - assuming the escrow service is more trustworthy than the original buyer/seller arrangement... Escrow can provide a potential reversible service for fraud but would be pretty useless against theft.
A bounty arrangement might be viable. As actually offloading the bitcoins to a fiat currency is hard to hide (unless your mixer service provides pools of large volume and uniform dispatch interval); offering a bounty or amnesty of X% of the stolen money might result in the thief returning it.


Is Electrum Cryptographically Secure? Electrum seems very user friendly, thin and convenient, but is it cryptographically secure?  One of the ways to attack any cryptographic system is to exploit weaknesses in the key generation algorithm.  Electrum uses a deterministic algorithm based on a pseudo-random seed to derive the public and private keys.  Is this a cryptographically secure way of generating keys?

The seed generated by Electrum is a 128-bit random number. It is encoded as a sequence of 12 words, for the purpose of memorization. However, it is important to understand that it has 128-bits of entropy.

https://bitcointalk.org/index.php?topic=153990.msg1632127#msg1632127

https://electrum.org/faq.html#seed